UNPKG

3.09 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../../src/repository/RepositoryFactory.ts"],"names":[],"mappings":";;AAAA,mDAAgD;AAEhD,2CAAwC;AACxC,6DAA0D;AAC1D,qDAAkD;AAIlD;;GAEG;AACH;IAAA;IAyCA,CAAC;IAvCG,4EAA4E;IAC5E,iBAAiB;IACjB,4EAA4E;IAE5E;;OAEG;IACH,kCAAM,GAAN,UAAO,OAAsB,EAAE,QAAwB,EAAE,WAAyB;QAE9E,IAAI,QAAQ,CAAC,QAAQ,EAAE;YACnB,4HAA4H;YAC5H,kEAAkE;YAClE,IAAM,UAAU,GAAG,IAAI,+BAAc,EAAO,CAAC;YAC7C,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE;gBACtB,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,QAAQ;gBAClB,WAAW,EAAE,WAAW;aAC3B,CAAC,CAAC;YACH,OAAO,UAAU,CAAC;SAErB;aAAM;YACH,4HAA4H;YAC5H,kEAAkE;YAClE,IAAI,UAAU,SAAiB,CAAC;YAChC,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,YAAY,yBAAW,EAAE;gBAClD,UAAU,GAAG,IAAI,iCAAe,EAAE,CAAC;aACtC;iBAAM;gBACH,UAAU,GAAG,IAAI,uBAAU,EAAO,CAAC;aACtC;YACD,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE;gBACtB,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,QAAQ;gBAClB,WAAW,EAAE,WAAW;aAC3B,CAAC,CAAC;YAEH,OAAO,UAAU,CAAC;SACrB;IACL,CAAC;IAEL,wBAAC;AAAD,CAzCA,AAyCC,IAAA;AAzCY,8CAAiB","file":"RepositoryFactory.js","sourcesContent":["import {TreeRepository} from \"./TreeRepository\";\nimport {EntityMetadata} from \"../metadata/EntityMetadata\";\nimport {Repository} from \"./Repository\";\nimport {MongoDriver} from \"../driver/mongodb/MongoDriver\";\nimport {MongoRepository} from \"./MongoRepository\";\nimport {QueryRunner} from \"../query-runner/QueryRunner\";\nimport {EntityManager} from \"../entity-manager/EntityManager\";\n\n/**\n * Factory used to create different types of repositories.\n */\nexport class RepositoryFactory {\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Creates a repository.\n */\n create(manager: EntityManager, metadata: EntityMetadata, queryRunner?: QueryRunner): Repository<any> {\n\n if (metadata.treeType) {\n // NOTE: dynamic access to protected properties. We need this to prevent unwanted properties in those classes to be exposed,\n // however we need these properties for internal work of the class\n const repository = new TreeRepository<any>();\n Object.assign(repository, {\n manager: manager,\n metadata: metadata,\n queryRunner: queryRunner,\n });\n return repository;\n\n } else {\n // NOTE: dynamic access to protected properties. We need this to prevent unwanted properties in those classes to be exposed,\n // however we need these properties for internal work of the class\n let repository: Repository<any>;\n if (manager.connection.driver instanceof MongoDriver) {\n repository = new MongoRepository();\n } else {\n repository = new Repository<any>();\n }\n Object.assign(repository, {\n manager: manager,\n metadata: metadata,\n queryRunner: queryRunner,\n });\n\n return repository;\n }\n }\n\n}"],"sourceRoot":".."}
\No newline at end of file