typeorm 0.3.18-dev.a909d5b → 0.3.18-dev.aa8d24c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -23
- package/browser/driver/DriverUtils.js +2 -5
- package/browser/driver/DriverUtils.js.map +1 -1
- package/browser/driver/mongodb/MongoQueryRunner.d.ts +3 -3
- package/browser/driver/mongodb/MongoQueryRunner.js.map +1 -1
- package/browser/driver/mongodb/typings.d.ts +3 -3
- package/browser/driver/mongodb/typings.js.map +1 -1
- package/browser/driver/oracle/OracleQueryRunner.js +34 -2
- package/browser/driver/oracle/OracleQueryRunner.js.map +1 -1
- package/browser/driver/postgres/PostgresQueryRunner.js +20 -12
- package/browser/driver/postgres/PostgresQueryRunner.js.map +1 -1
- package/browser/driver/sap/SapDriver.d.ts +8 -0
- package/browser/driver/sap/SapDriver.js +14 -3
- package/browser/driver/sap/SapDriver.js.map +1 -1
- package/browser/driver/sap/SapQueryRunner.d.ts +5 -14
- package/browser/driver/sap/SapQueryRunner.js +53 -55
- package/browser/driver/sap/SapQueryRunner.js.map +1 -1
- package/browser/driver/sqlserver/SqlServerConnectionCredentialsOptions.d.ts +2 -1
- package/browser/driver/sqlserver/SqlServerConnectionCredentialsOptions.js.map +1 -1
- package/browser/driver/sqlserver/SqlServerConnectionOptions.d.ts +5 -0
- package/browser/driver/sqlserver/SqlServerConnectionOptions.js.map +1 -1
- package/browser/driver/sqlserver/SqlServerQueryRunner.js +13 -0
- package/browser/driver/sqlserver/SqlServerQueryRunner.js.map +1 -1
- package/browser/driver/sqlserver/authentication/AzureActiveDirectoryDefaultAuthentication.d.ts +12 -0
- package/browser/driver/sqlserver/authentication/AzureActiveDirectoryDefaultAuthentication.js +3 -0
- package/browser/driver/sqlserver/authentication/AzureActiveDirectoryDefaultAuthentication.js.map +1 -0
- package/browser/entity-manager/EntityManager.js +5 -1
- package/browser/entity-manager/EntityManager.js.map +1 -1
- package/browser/entity-manager/MongoEntityManager.d.ts +8 -4
- package/browser/entity-manager/MongoEntityManager.js +7 -0
- package/browser/entity-manager/MongoEntityManager.js.map +1 -1
- package/browser/entity-schema/EntitySchemaOptions.d.ts +4 -0
- package/browser/entity-schema/EntitySchemaOptions.js.map +1 -1
- package/browser/entity-schema/EntitySchemaTransformer.js +7 -0
- package/browser/entity-schema/EntitySchemaTransformer.js.map +1 -1
- package/browser/error/QueryFailedError.d.ts +3 -3
- package/browser/error/QueryFailedError.js.map +1 -1
- package/browser/find-options/FindOptionsUtils.js +1 -1
- package/browser/find-options/FindOptionsUtils.js.map +1 -1
- package/browser/find-options/FindOptionsWhere.d.ts +1 -1
- package/browser/find-options/FindOptionsWhere.js.map +1 -1
- package/browser/index.d.ts +1 -0
- package/browser/index.js +1 -0
- package/browser/index.js.map +1 -1
- package/browser/metadata-builder/EntityMetadataBuilder.js +13 -0
- package/browser/metadata-builder/EntityMetadataBuilder.js.map +1 -1
- package/browser/naming-strategy/DefaultNamingStrategy.d.ts +0 -1
- package/browser/naming-strategy/DefaultNamingStrategy.js +0 -3
- package/browser/naming-strategy/DefaultNamingStrategy.js.map +1 -1
- package/browser/naming-strategy/NamingStrategyInterface.d.ts +0 -4
- package/browser/naming-strategy/NamingStrategyInterface.js.map +1 -1
- package/browser/persistence/Subject.js +2 -1
- package/browser/persistence/Subject.js.map +1 -1
- package/browser/persistence/SubjectExecutor.js +1 -1
- package/browser/persistence/SubjectExecutor.js.map +1 -1
- package/browser/persistence/subject-builder/ManyToManySubjectBuilder.js +6 -2
- package/browser/persistence/subject-builder/ManyToManySubjectBuilder.js.map +1 -1
- package/browser/platform/PlatformTools.js +2 -0
- package/browser/platform/PlatformTools.js.map +1 -1
- package/browser/query-builder/QueryBuilder.js +1 -1
- package/browser/query-builder/QueryBuilder.js.map +1 -1
- package/browser/query-builder/SelectQueryBuilder.js +4 -1
- package/browser/query-builder/SelectQueryBuilder.js.map +1 -1
- package/browser/repository/MongoRepository.d.ts +8 -4
- package/browser/repository/MongoRepository.js +6 -0
- package/browser/repository/MongoRepository.js.map +1 -1
- package/browser/repository/Repository.d.ts +1 -1
- package/browser/repository/Repository.js +9 -5
- package/browser/repository/Repository.js.map +1 -1
- package/browser/subscriber/Broadcaster.d.ts +1 -1
- package/browser/subscriber/Broadcaster.js +2 -1
- package/browser/subscriber/Broadcaster.js.map +1 -1
- package/browser/subscriber/event/InsertEvent.d.ts +5 -0
- package/browser/subscriber/event/InsertEvent.js.map +1 -1
- package/commands/CommandUtils.js +6 -1
- package/commands/CommandUtils.js.map +1 -1
- package/commands/EntityCreateCommand.d.ts +3 -0
- package/commands/EntityCreateCommand.js +7 -0
- package/commands/EntityCreateCommand.js.map +1 -1
- package/commands/InitCommand.js +1 -1
- package/commands/InitCommand.js.map +1 -1
- package/commands/MigrationCreateCommand.d.ts +5 -1
- package/commands/MigrationCreateCommand.js +6 -1
- package/commands/MigrationCreateCommand.js.map +1 -1
- package/commands/MigrationGenerateCommand.d.ts +5 -1
- package/commands/MigrationGenerateCommand.js +8 -1
- package/commands/MigrationGenerateCommand.js.map +1 -1
- package/commands/SubscriberCreateCommand.d.ts +3 -0
- package/commands/SubscriberCreateCommand.js +7 -0
- package/commands/SubscriberCreateCommand.js.map +1 -1
- package/driver/DriverUtils.js +2 -5
- package/driver/DriverUtils.js.map +1 -1
- package/driver/mongodb/MongoQueryRunner.d.ts +3 -3
- package/driver/mongodb/MongoQueryRunner.js.map +1 -1
- package/driver/mongodb/typings.d.ts +3 -3
- package/driver/mongodb/typings.js.map +1 -1
- package/driver/oracle/OracleQueryRunner.js +34 -2
- package/driver/oracle/OracleQueryRunner.js.map +1 -1
- package/driver/postgres/PostgresQueryRunner.js +20 -12
- package/driver/postgres/PostgresQueryRunner.js.map +1 -1
- package/driver/sap/SapDriver.d.ts +8 -0
- package/driver/sap/SapDriver.js +15 -4
- package/driver/sap/SapDriver.js.map +1 -1
- package/driver/sap/SapQueryRunner.d.ts +5 -14
- package/driver/sap/SapQueryRunner.js +53 -55
- package/driver/sap/SapQueryRunner.js.map +1 -1
- package/driver/sqlserver/SqlServerConnectionCredentialsOptions.d.ts +2 -1
- package/driver/sqlserver/SqlServerConnectionCredentialsOptions.js.map +1 -1
- package/driver/sqlserver/SqlServerConnectionOptions.d.ts +5 -0
- package/driver/sqlserver/SqlServerConnectionOptions.js.map +1 -1
- package/driver/sqlserver/SqlServerQueryRunner.js +13 -0
- package/driver/sqlserver/SqlServerQueryRunner.js.map +1 -1
- package/driver/sqlserver/authentication/AzureActiveDirectoryDefaultAuthentication.d.ts +12 -0
- package/driver/sqlserver/authentication/AzureActiveDirectoryDefaultAuthentication.js +4 -0
- package/driver/sqlserver/authentication/AzureActiveDirectoryDefaultAuthentication.js.map +1 -0
- package/entity-manager/EntityManager.js +5 -1
- package/entity-manager/EntityManager.js.map +1 -1
- package/entity-manager/MongoEntityManager.d.ts +8 -4
- package/entity-manager/MongoEntityManager.js +7 -0
- package/entity-manager/MongoEntityManager.js.map +1 -1
- package/entity-schema/EntitySchemaOptions.d.ts +4 -0
- package/entity-schema/EntitySchemaOptions.js.map +1 -1
- package/entity-schema/EntitySchemaTransformer.js +7 -0
- package/entity-schema/EntitySchemaTransformer.js.map +1 -1
- package/error/QueryFailedError.d.ts +3 -3
- package/error/QueryFailedError.js.map +1 -1
- package/find-options/FindOptionsUtils.js +1 -1
- package/find-options/FindOptionsUtils.js.map +1 -1
- package/find-options/FindOptionsWhere.d.ts +1 -1
- package/find-options/FindOptionsWhere.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/index.mjs +2 -0
- package/metadata-builder/EntityMetadataBuilder.js +13 -0
- package/metadata-builder/EntityMetadataBuilder.js.map +1 -1
- package/naming-strategy/DefaultNamingStrategy.d.ts +0 -1
- package/naming-strategy/DefaultNamingStrategy.js +0 -3
- package/naming-strategy/DefaultNamingStrategy.js.map +1 -1
- package/naming-strategy/NamingStrategyInterface.d.ts +0 -4
- package/naming-strategy/NamingStrategyInterface.js.map +1 -1
- package/package.json +1 -1
- package/persistence/Subject.js +2 -1
- package/persistence/Subject.js.map +1 -1
- package/persistence/SubjectExecutor.js +1 -1
- package/persistence/SubjectExecutor.js.map +1 -1
- package/persistence/subject-builder/ManyToManySubjectBuilder.js +6 -2
- package/persistence/subject-builder/ManyToManySubjectBuilder.js.map +1 -1
- package/platform/PlatformTools.js +2 -0
- package/platform/PlatformTools.js.map +1 -1
- package/query-builder/QueryBuilder.js +1 -1
- package/query-builder/QueryBuilder.js.map +1 -1
- package/query-builder/SelectQueryBuilder.js +4 -1
- package/query-builder/SelectQueryBuilder.js.map +1 -1
- package/repository/MongoRepository.d.ts +8 -4
- package/repository/MongoRepository.js +6 -0
- package/repository/MongoRepository.js.map +1 -1
- package/repository/Repository.d.ts +1 -1
- package/repository/Repository.js +9 -5
- package/repository/Repository.js.map +1 -1
- package/subscriber/Broadcaster.d.ts +1 -1
- package/subscriber/Broadcaster.js +2 -1
- package/subscriber/Broadcaster.js.map +1 -1
- package/subscriber/event/InsertEvent.d.ts +5 -0
- package/subscriber/event/InsertEvent.js.map +1 -1
- package/typeorm-model-shim.js +61 -53
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/find-options/FindOptionsUtils.ts"],"names":[],"mappings":";;;AAGA,oCAAqD;AAErD,uDAAmD;AAInD,oCAAsD;AAEtD;;GAEG;AACH,MAAa,gBAAgB;IACzB,4EAA4E;IAC5E,wBAAwB;IACxB,4EAA4E;IAE5E;;OAEG;IACH,MAAM,CAAC,gBAAgB,CACnB,GAAQ;QAER,MAAM,eAAe,GAA2B,GAAG,CAAA;QACnD,OAAO,CACH,eAAe;YACf,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC;gBAClC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC;gBACxC,OAAO,eAAe,CAAC,MAAM,KAAK,QAAQ;gBAC1C,OAAO,eAAe,CAAC,SAAS,KAAK,QAAQ;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CAAC,SAAS,KAAK,SAAS;oBAC9B,MAAM,CAAC,OAAO,KAAK,SAAS;oBAC5B,MAAM,CAAC,SAAS,KAAK,aAAa,EACpC;oBACE,SAAQ;iBACX;gBACD,SAAS,GAAG,KAAK,CAAA;gBACjB,MAAK;aACR;YAED,IAAI,SAAS,EAAE;gBACX,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC,CAAA;aAC9B;YAED,uCAAuC;YACvC,IAAI,CAAC,kBAAkB,CACnB,EAAE,EACF,aAAa,EACb,QAAQ,CAAC,qBAAqB,CACjC,CAAA;QACL,CAAC,CAAC,CAAA;IACN,CAAC;CACJ;AAxbD,4CAwbC","file":"FindOptionsUtils.js","sourcesContent":["import { FindManyOptions } from \"./FindManyOptions\"\nimport { FindOneOptions } from \"./FindOneOptions\"\nimport { SelectQueryBuilder } from \"../query-builder/SelectQueryBuilder\"\nimport { FindRelationsNotFoundError } from \"../error\"\nimport { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { DriverUtils } from \"../driver/DriverUtils\"\nimport { FindTreeOptions } from \"./FindTreeOptions\"\nimport { ObjectLiteral } from \"../common/ObjectLiteral\"\nimport { RelationMetadata } from \"../metadata/RelationMetadata\"\nimport { EntityPropertyNotFoundError } from \"../error\"\n\n/**\n * Utilities to work with FindOptions.\n */\nexport class FindOptionsUtils {\n // -------------------------------------------------------------------------\n // Public Static Methods\n // -------------------------------------------------------------------------\n\n /**\n * Checks if given object is really instance of FindOneOptions interface.\n */\n static isFindOneOptions<Entity = any>(\n obj: any,\n ): obj is FindOneOptions<Entity> {\n const possibleOptions: FindOneOptions<Entity> = obj\n return (\n possibleOptions &&\n (Array.isArray(possibleOptions.select) ||\n Array.isArray(possibleOptions.relations) ||\n typeof possibleOptions.select === \"object\" ||\n typeof possibleOptions.relations === \"object\" ||\n typeof possibleOptions.where === \"object\" ||\n // typeof possibleOptions.where === \"string\" ||\n typeof possibleOptions.join === \"object\" ||\n typeof possibleOptions.order === \"object\" ||\n typeof possibleOptions.cache === \"object\" ||\n typeof possibleOptions.cache === \"boolean\" ||\n typeof possibleOptions.cache === \"number\" ||\n typeof possibleOptions.comment === \"string\" ||\n typeof possibleOptions.lock === \"object\" ||\n typeof possibleOptions.loadRelationIds === \"object\" ||\n typeof possibleOptions.loadRelationIds === \"boolean\" ||\n typeof possibleOptions.loadEagerRelations === \"boolean\" ||\n typeof possibleOptions.withDeleted === \"boolean\" ||\n typeof possibleOptions.relationLoadStrategy === \"string\" ||\n typeof possibleOptions.transaction === \"boolean\")\n )\n }\n\n /**\n * Checks if given object is really instance of FindManyOptions interface.\n */\n static isFindManyOptions<Entity = any>(\n obj: any,\n ): obj is FindManyOptions<Entity> {\n const possibleOptions: FindManyOptions<Entity> = obj\n return (\n possibleOptions &&\n (this.isFindOneOptions(possibleOptions) ||\n typeof (possibleOptions as FindManyOptions<any>).skip ===\n \"number\" ||\n typeof (possibleOptions as FindManyOptions<any>).take ===\n \"number\" ||\n typeof (possibleOptions as FindManyOptions<any>).skip ===\n \"string\" ||\n typeof (possibleOptions as FindManyOptions<any>).take ===\n \"string\")\n )\n }\n\n /**\n * Checks if given object is really instance of FindOptions interface.\n */\n static extractFindManyOptionsAlias(object: any): string | undefined {\n if (this.isFindManyOptions(object) && object.join)\n return object.join.alias\n\n return undefined\n }\n\n /**\n * Applies give find many options to the given query builder.\n\n static applyFindManyOptionsOrConditionsToQueryBuilder<T>(qb: SelectQueryBuilder<T>, options: FindManyOptions<T>|Partial<T>|undefined): SelectQueryBuilder<T> {\n if (this.isFindManyOptions(options))\n return this.applyOptionsToQueryBuilder(qb, options);\n\n if (options)\n return qb.where(options);\n\n return qb;\n }*/\n\n /**\n * Applies give find options to the given query builder.\n\n static applyOptionsToQueryBuilder<T>(qb: SelectQueryBuilder<T>, options: FindOneOptions<T>|FindManyOptions<T>|undefined): SelectQueryBuilder<T> {\n\n // if options are not set then simply return query builder. This is made for simplicity of usage.\n if (!options || (!this.isFindOneOptions(options) && !this.isFindManyOptions(options)))\n return qb;\n\n if (options.transaction === true) {\n qb.expressionMap.useTransaction = true;\n }\n\n if (!qb.expressionMap.mainAlias || !qb.expressionMap.mainAlias.hasMetadata)\n return qb;\n\n const metadata = qb.expressionMap.mainAlias!.metadata;\n\n // apply all options from FindOptions\n if (options.comment) {\n qb.comment(options.comment);\n }\n\n if (options.withDeleted) {\n qb.withDeleted();\n }\n\n if (options.select) {\n qb.select([]);\n options.select.forEach(select => {\n if (!metadata.hasColumnWithPropertyPath(`${select}`))\n throw new TypeORMError(`${select} column was not found in the ${metadata.name} entity.`);\n\n const columns = metadata.findColumnsWithPropertyPath(`${select}`);\n\n for (const column of columns) {\n qb.addSelect(qb.alias + \".\" + column.propertyPath);\n }\n });\n }\n\n if (options.relations) {\n // Copy because `applyRelationsRecursively` modifies it\n const allRelations = [...options.relations];\n this.applyRelationsRecursively(qb, allRelations, qb.expressionMap.mainAlias!.name, qb.expressionMap.mainAlias!.metadata, \"\");\n // recursive removes found relations from allRelations array\n // if there are relations left in this array it means those relations were not found in the entity structure\n // so, we give an exception about not found relations\n if (allRelations.length > 0)\n throw new FindRelationsNotFoundError(allRelations);\n }\n\n if (options.join) {\n if (options.join.leftJoin)\n Object.keys(options.join.leftJoin).forEach(key => {\n qb.leftJoin(options.join!.leftJoin![key], key);\n });\n\n if (options.join.innerJoin)\n Object.keys(options.join.innerJoin).forEach(key => {\n qb.innerJoin(options.join!.innerJoin![key], key);\n });\n\n if (options.join.leftJoinAndSelect)\n Object.keys(options.join.leftJoinAndSelect).forEach(key => {\n qb.leftJoinAndSelect(options.join!.leftJoinAndSelect![key], key);\n });\n\n if (options.join.innerJoinAndSelect)\n Object.keys(options.join.innerJoinAndSelect).forEach(key => {\n qb.innerJoinAndSelect(options.join!.innerJoinAndSelect![key], key);\n });\n }\n\n if (options.cache) {\n if (options.cache instanceof Object) {\n const cache = options.cache as { id: any, milliseconds: number };\n qb.cache(cache.id, cache.milliseconds);\n } else {\n qb.cache(options.cache);\n }\n }\n\n if (options.lock) {\n if (options.lock.mode === \"optimistic\") {\n qb.setLock(options.lock.mode, options.lock.version);\n } else if (\n options.lock.mode === \"pessimistic_read\" ||\n options.lock.mode === \"pessimistic_write\" ||\n options.lock.mode === \"dirty_read\" ||\n options.lock.mode === \"pessimistic_partial_write\" ||\n options.lock.mode === \"pessimistic_write_or_fail\" ||\n options.lock.mode === \"for_no_key_update\" ||\n options.lock.mode === \"for_key_share\"\n ) {\n const tableNames = options.lock.tables ? options.lock.tables.map((table) => {\n const tableAlias = qb.expressionMap.aliases.find((alias) => {\n return alias.metadata.tableNameWithoutPrefix === table;\n });\n if (!tableAlias) {\n throw new TypeORMError(`\"${table}\" is not part of this query`);\n }\n return qb.escape(tableAlias.name);\n }) : undefined;\n qb.setLock(options.lock.mode, undefined, tableNames);\n }\n }\n\n if (options.loadRelationIds === true) {\n qb.loadAllRelationIds();\n\n } else if (options.loadRelationIds instanceof Object) {\n qb.loadAllRelationIds(options.loadRelationIds as any);\n }\n\n if (options.where)\n qb.where(options.where);\n\n if ((options as FindManyOptions<T>).skip)\n qb.skip((options as FindManyOptions<T>).skip!);\n\n if ((options as FindManyOptions<T>).take)\n qb.take((options as FindManyOptions<T>).take!);\n\n if (options.order)\n Object.keys(options.order).forEach(key => {\n const order = ((options as FindOneOptions<T>).order as any)[key as any];\n\n if (!metadata.findColumnWithPropertyPath(key))\n throw new Error(`${key} column was not found in the ${metadata.name} entity.`);\n\n switch (order) {\n case 1:\n qb.addOrderBy(qb.alias + \".\" + key, \"ASC\");\n break;\n case -1:\n qb.addOrderBy(qb.alias + \".\" + key, \"DESC\");\n break;\n case \"ASC\":\n qb.addOrderBy(qb.alias + \".\" + key, \"ASC\");\n break;\n case \"DESC\":\n qb.addOrderBy(qb.alias + \".\" + key, \"DESC\");\n break;\n }\n });\n\n return qb;\n }*/\n\n static applyOptionsToTreeQueryBuilder<T extends ObjectLiteral>(\n qb: SelectQueryBuilder<T>,\n options?: FindTreeOptions,\n ): SelectQueryBuilder<T> {\n if (options?.relations) {\n // Copy because `applyRelationsRecursively` modifies it\n const allRelations = [...options.relations]\n\n FindOptionsUtils.applyRelationsRecursively(\n qb,\n allRelations,\n qb.expressionMap.mainAlias!.name,\n qb.expressionMap.mainAlias!.metadata,\n \"\",\n )\n\n // recursive removes found relations from allRelations array\n // if there are relations left in this array it means those relations were not found in the entity structure\n // so, we give an exception about not found relations\n if (allRelations.length > 0)\n throw new FindRelationsNotFoundError(allRelations)\n }\n\n return qb\n }\n\n // -------------------------------------------------------------------------\n // Protected Static Methods\n // -------------------------------------------------------------------------\n\n /**\n * Adds joins for all relations and sub-relations of the given relations provided in the find options.\n */\n public static applyRelationsRecursively(\n qb: SelectQueryBuilder<any>,\n allRelations: string[],\n alias: string,\n metadata: EntityMetadata,\n prefix: string,\n ): void {\n // find all relations that match given prefix\n let matchedBaseRelations: RelationMetadata[] = []\n if (prefix) {\n const regexp = new RegExp(\"^\" + prefix.replace(\".\", \"\\\\.\") + \"\\\\.\")\n matchedBaseRelations = allRelations\n .filter((relation) => relation.match(regexp))\n .map((relation) =>\n metadata.findRelationWithPropertyPath(\n relation.replace(regexp, \"\"),\n ),\n )\n .filter((entity) => entity) as RelationMetadata[]\n } else {\n matchedBaseRelations = allRelations\n .map((relation) =>\n metadata.findRelationWithPropertyPath(relation),\n )\n .filter((entity) => entity) as RelationMetadata[]\n }\n\n // go through all matched relations and add join for them\n matchedBaseRelations.forEach((relation) => {\n // generate a relation alias\n let relationAlias: string = DriverUtils.buildAlias(\n qb.connection.driver,\n { joiner: \"__\" },\n alias,\n relation.propertyPath,\n )\n\n // add a join for the found relation\n const selection = alias + \".\" + relation.propertyPath\n if (qb.expressionMap.relationLoadStrategy === \"query\") {\n qb.concatRelationMetadata(relation)\n } else {\n qb.leftJoinAndSelect(selection, relationAlias)\n }\n\n // remove added relations from the allRelations array, this is needed to find all not found relations at the end\n allRelations.splice(\n allRelations.indexOf(\n prefix\n ? prefix + \".\" + relation.propertyPath\n : relation.propertyPath,\n ),\n 1,\n )\n\n // try to find sub-relations\n let relationMetadata: EntityMetadata | undefined\n let relationName: string | undefined\n\n if (qb.expressionMap.relationLoadStrategy === \"query\") {\n relationMetadata = relation.inverseEntityMetadata\n relationName = relationAlias\n } else {\n const join = qb.expressionMap.joinAttributes.find(\n (join) => join.entityOrProperty === selection,\n )\n relationMetadata = join!.metadata!\n relationName = join!.alias.name\n }\n\n if (!relationName || !relationMetadata) {\n throw new EntityPropertyNotFoundError(\n relation.propertyPath,\n metadata,\n )\n }\n\n this.applyRelationsRecursively(\n qb,\n allRelations,\n relationName,\n relationMetadata,\n prefix\n ? prefix + \".\" + relation.propertyPath\n : relation.propertyPath,\n )\n\n // join the eager relations of the found relation\n // Only supported for \"join\" relationLoadStrategy\n if (qb.expressionMap.relationLoadStrategy === \"join\") {\n const relMetadata = metadata.relations.find(\n (metadata) =>\n metadata.propertyName === relation.propertyPath,\n )\n if (relMetadata) {\n this.joinEagerRelations(\n qb,\n relationAlias,\n relMetadata.inverseEntityMetadata,\n )\n }\n }\n })\n }\n\n public static joinEagerRelations(\n qb: SelectQueryBuilder<any>,\n alias: string,\n metadata: EntityMetadata,\n ) {\n metadata.eagerRelations.forEach((relation) => {\n // generate a relation alias\n let relationAlias: string = DriverUtils.buildAlias(\n qb.connection.driver,\n { joiner: \"__\" },\n alias,\n relation.propertyPath,\n )\n\n // add a join for the relation\n // Checking whether the relation wasn't joined yet.\n let addJoin = true\n // TODO: Review this validation\n for (const join of qb.expressionMap.joinAttributes) {\n if (\n join.condition !== undefined ||\n join.mapToProperty !== undefined ||\n join.isMappingMany !== undefined ||\n join.direction !== \"LEFT\" ||\n join.entityOrProperty !==\n `${alias}.${relation.propertyPath}`\n ) {\n continue\n }\n addJoin = false\n relationAlias = join.alias.name\n break\n }\n\n const joinAlreadyAdded = Boolean(\n qb.expressionMap.joinAttributes.find(\n (joinAttribute) =>\n joinAttribute.alias.name === relationAlias,\n ),\n )\n\n if (addJoin && !joinAlreadyAdded) {\n qb.leftJoin(alias + \".\" + relation.propertyPath, relationAlias)\n }\n\n // Checking whether the relation wasn't selected yet.\n // This check shall be after the join check to detect relationAlias.\n let addSelect = true\n for (const select of qb.expressionMap.selects) {\n if (\n select.aliasName !== undefined ||\n select.virtual !== undefined ||\n select.selection !== relationAlias\n ) {\n continue\n }\n addSelect = false\n break\n }\n\n if (addSelect) {\n qb.addSelect(relationAlias)\n }\n\n // (recursive) join the eager relations\n this.joinEagerRelations(\n qb,\n relationAlias,\n relation.inverseEntityMetadata,\n )\n })\n }\n}\n"],"sourceRoot":".."}
|
|
1
|
+
{"version":3,"sources":["../../src/find-options/FindOptionsUtils.ts"],"names":[],"mappings":";;;AAGA,oCAAqD;AAErD,uDAAmD;AAInD,oCAAsD;AAEtD;;GAEG;AACH,MAAa,gBAAgB;IACzB,4EAA4E;IAC5E,wBAAwB;IACxB,4EAA4E;IAE5E;;OAEG;IACH,MAAM,CAAC,gBAAgB,CACnB,GAAQ;QAER,MAAM,eAAe,GAA2B,GAAG,CAAA;QACnD,OAAO,CACH,eAAe;YACf,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC;gBAClC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC;gBACxC,OAAO,eAAe,CAAC,MAAM,KAAK,QAAQ;gBAC1C,OAAO,eAAe,CAAC,SAAS,KAAK,QAAQ;gBAC7C,OAAO,eAAe,CAAC,KAAK,KAAK,QAAQ;gBACzC,+CAA+C;gBAC/C,OAAO,eAAe,CAAC,IAAI,KAAK,QAAQ;gBACxC,OAAO,eAAe,CAAC,KAAK,KAAK,QAAQ;gBACzC,OAAO,eAAe,CAAC,KAAK,KAAK,QAAQ;gBACzC,OAAO,eAAe,CAAC,KAAK,KAAK,SAAS;gBAC1C,OAAO,eAAe,CAAC,KAAK,KAAK,QAAQ;gBACzC,OAAO,eAAe,CAAC,OAAO,KAAK,QAAQ;gBAC3C,OAAO,eAAe,CAAC,IAAI,KAAK,QAAQ;gBACxC,O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AC;CACJ;AAxbD,4CAwbC","file":"FindOptionsUtils.js","sourcesContent":["import { FindManyOptions } from \"./FindManyOptions\"\nimport { FindOneOptions } from \"./FindOneOptions\"\nimport { SelectQueryBuilder } from \"../query-builder/SelectQueryBuilder\"\nimport { FindRelationsNotFoundError } from \"../error\"\nimport { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { DriverUtils } from \"../driver/DriverUtils\"\nimport { FindTreeOptions } from \"./FindTreeOptions\"\nimport { ObjectLiteral } from \"../common/ObjectLiteral\"\nimport { RelationMetadata } from \"../metadata/RelationMetadata\"\nimport { EntityPropertyNotFoundError } from \"../error\"\n\n/**\n * Utilities to work with FindOptions.\n */\nexport class FindOptionsUtils {\n // -------------------------------------------------------------------------\n // Public Static Methods\n // -------------------------------------------------------------------------\n\n /**\n * Checks if given object is really instance of FindOneOptions interface.\n */\n static isFindOneOptions<Entity = any>(\n obj: any,\n ): obj is FindOneOptions<Entity> {\n const possibleOptions: FindOneOptions<Entity> = obj\n return (\n possibleOptions &&\n (Array.isArray(possibleOptions.select) ||\n Array.isArray(possibleOptions.relations) ||\n typeof possibleOptions.select === \"object\" ||\n typeof possibleOptions.relations === \"object\" ||\n typeof possibleOptions.where === \"object\" ||\n // typeof possibleOptions.where === \"string\" ||\n typeof possibleOptions.join === \"object\" ||\n typeof possibleOptions.order === \"object\" ||\n typeof possibleOptions.cache === \"object\" ||\n typeof possibleOptions.cache === \"boolean\" ||\n typeof possibleOptions.cache === \"number\" ||\n typeof possibleOptions.comment === \"string\" ||\n typeof possibleOptions.lock === \"object\" ||\n typeof possibleOptions.loadRelationIds === \"object\" ||\n typeof possibleOptions.loadRelationIds === \"boolean\" ||\n typeof possibleOptions.loadEagerRelations === \"boolean\" ||\n typeof possibleOptions.withDeleted === \"boolean\" ||\n typeof possibleOptions.relationLoadStrategy === \"string\" ||\n typeof possibleOptions.transaction === \"boolean\")\n )\n }\n\n /**\n * Checks if given object is really instance of FindManyOptions interface.\n */\n static isFindManyOptions<Entity = any>(\n obj: any,\n ): obj is FindManyOptions<Entity> {\n const possibleOptions: FindManyOptions<Entity> = obj\n return (\n possibleOptions &&\n (this.isFindOneOptions(possibleOptions) ||\n typeof (possibleOptions as FindManyOptions<any>).skip ===\n \"number\" ||\n typeof (possibleOptions as FindManyOptions<any>).take ===\n \"number\" ||\n typeof (possibleOptions as FindManyOptions<any>).skip ===\n \"string\" ||\n typeof (possibleOptions as FindManyOptions<any>).take ===\n \"string\")\n )\n }\n\n /**\n * Checks if given object is really instance of FindOptions interface.\n */\n static extractFindManyOptionsAlias(object: any): string | undefined {\n if (this.isFindManyOptions(object) && object.join)\n return object.join.alias\n\n return undefined\n }\n\n /**\n * Applies give find many options to the given query builder.\n\n static applyFindManyOptionsOrConditionsToQueryBuilder<T>(qb: SelectQueryBuilder<T>, options: FindManyOptions<T>|Partial<T>|undefined): SelectQueryBuilder<T> {\n if (this.isFindManyOptions(options))\n return this.applyOptionsToQueryBuilder(qb, options);\n\n if (options)\n return qb.where(options);\n\n return qb;\n }*/\n\n /**\n * Applies give find options to the given query builder.\n\n static applyOptionsToQueryBuilder<T>(qb: SelectQueryBuilder<T>, options: FindOneOptions<T>|FindManyOptions<T>|undefined): SelectQueryBuilder<T> {\n\n // if options are not set then simply return query builder. This is made for simplicity of usage.\n if (!options || (!this.isFindOneOptions(options) && !this.isFindManyOptions(options)))\n return qb;\n\n if (options.transaction === true) {\n qb.expressionMap.useTransaction = true;\n }\n\n if (!qb.expressionMap.mainAlias || !qb.expressionMap.mainAlias.hasMetadata)\n return qb;\n\n const metadata = qb.expressionMap.mainAlias!.metadata;\n\n // apply all options from FindOptions\n if (options.comment) {\n qb.comment(options.comment);\n }\n\n if (options.withDeleted) {\n qb.withDeleted();\n }\n\n if (options.select) {\n qb.select([]);\n options.select.forEach(select => {\n if (!metadata.hasColumnWithPropertyPath(`${select}`))\n throw new TypeORMError(`${select} column was not found in the ${metadata.name} entity.`);\n\n const columns = metadata.findColumnsWithPropertyPath(`${select}`);\n\n for (const column of columns) {\n qb.addSelect(qb.alias + \".\" + column.propertyPath);\n }\n });\n }\n\n if (options.relations) {\n // Copy because `applyRelationsRecursively` modifies it\n const allRelations = [...options.relations];\n this.applyRelationsRecursively(qb, allRelations, qb.expressionMap.mainAlias!.name, qb.expressionMap.mainAlias!.metadata, \"\");\n // recursive removes found relations from allRelations array\n // if there are relations left in this array it means those relations were not found in the entity structure\n // so, we give an exception about not found relations\n if (allRelations.length > 0)\n throw new FindRelationsNotFoundError(allRelations);\n }\n\n if (options.join) {\n if (options.join.leftJoin)\n Object.keys(options.join.leftJoin).forEach(key => {\n qb.leftJoin(options.join!.leftJoin![key], key);\n });\n\n if (options.join.innerJoin)\n Object.keys(options.join.innerJoin).forEach(key => {\n qb.innerJoin(options.join!.innerJoin![key], key);\n });\n\n if (options.join.leftJoinAndSelect)\n Object.keys(options.join.leftJoinAndSelect).forEach(key => {\n qb.leftJoinAndSelect(options.join!.leftJoinAndSelect![key], key);\n });\n\n if (options.join.innerJoinAndSelect)\n Object.keys(options.join.innerJoinAndSelect).forEach(key => {\n qb.innerJoinAndSelect(options.join!.innerJoinAndSelect![key], key);\n });\n }\n\n if (options.cache) {\n if (options.cache instanceof Object) {\n const cache = options.cache as { id: any, milliseconds: number };\n qb.cache(cache.id, cache.milliseconds);\n } else {\n qb.cache(options.cache);\n }\n }\n\n if (options.lock) {\n if (options.lock.mode === \"optimistic\") {\n qb.setLock(options.lock.mode, options.lock.version);\n } else if (\n options.lock.mode === \"pessimistic_read\" ||\n options.lock.mode === \"pessimistic_write\" ||\n options.lock.mode === \"dirty_read\" ||\n options.lock.mode === \"pessimistic_partial_write\" ||\n options.lock.mode === \"pessimistic_write_or_fail\" ||\n options.lock.mode === \"for_no_key_update\" ||\n options.lock.mode === \"for_key_share\"\n ) {\n const tableNames = options.lock.tables ? options.lock.tables.map((table) => {\n const tableAlias = qb.expressionMap.aliases.find((alias) => {\n return alias.metadata.tableNameWithoutPrefix === table;\n });\n if (!tableAlias) {\n throw new TypeORMError(`\"${table}\" is not part of this query`);\n }\n return qb.escape(tableAlias.name);\n }) : undefined;\n qb.setLock(options.lock.mode, undefined, tableNames);\n }\n }\n\n if (options.loadRelationIds === true) {\n qb.loadAllRelationIds();\n\n } else if (options.loadRelationIds instanceof Object) {\n qb.loadAllRelationIds(options.loadRelationIds as any);\n }\n\n if (options.where)\n qb.where(options.where);\n\n if ((options as FindManyOptions<T>).skip)\n qb.skip((options as FindManyOptions<T>).skip!);\n\n if ((options as FindManyOptions<T>).take)\n qb.take((options as FindManyOptions<T>).take!);\n\n if (options.order)\n Object.keys(options.order).forEach(key => {\n const order = ((options as FindOneOptions<T>).order as any)[key as any];\n\n if (!metadata.findColumnWithPropertyPath(key))\n throw new Error(`${key} column was not found in the ${metadata.name} entity.`);\n\n switch (order) {\n case 1:\n qb.addOrderBy(qb.alias + \".\" + key, \"ASC\");\n break;\n case -1:\n qb.addOrderBy(qb.alias + \".\" + key, \"DESC\");\n break;\n case \"ASC\":\n qb.addOrderBy(qb.alias + \".\" + key, \"ASC\");\n break;\n case \"DESC\":\n qb.addOrderBy(qb.alias + \".\" + key, \"DESC\");\n break;\n }\n });\n\n return qb;\n }*/\n\n static applyOptionsToTreeQueryBuilder<T extends ObjectLiteral>(\n qb: SelectQueryBuilder<T>,\n options?: FindTreeOptions,\n ): SelectQueryBuilder<T> {\n if (options?.relations) {\n // Copy because `applyRelationsRecursively` modifies it\n const allRelations = [...options.relations]\n\n FindOptionsUtils.applyRelationsRecursively(\n qb,\n allRelations,\n qb.expressionMap.mainAlias!.name,\n qb.expressionMap.mainAlias!.metadata,\n \"\",\n )\n\n // recursive removes found relations from allRelations array\n // if there are relations left in this array it means those relations were not found in the entity structure\n // so, we give an exception about not found relations\n if (allRelations.length > 0)\n throw new FindRelationsNotFoundError(allRelations)\n }\n\n return qb\n }\n\n // -------------------------------------------------------------------------\n // Protected Static Methods\n // -------------------------------------------------------------------------\n\n /**\n * Adds joins for all relations and sub-relations of the given relations provided in the find options.\n */\n public static applyRelationsRecursively(\n qb: SelectQueryBuilder<any>,\n allRelations: string[],\n alias: string,\n metadata: EntityMetadata,\n prefix: string,\n ): void {\n // find all relations that match given prefix\n let matchedBaseRelations: RelationMetadata[] = []\n if (prefix) {\n const regexp = new RegExp(\"^\" + prefix.replace(\".\", \"\\\\.\") + \"\\\\.\")\n matchedBaseRelations = allRelations\n .filter((relation) => relation.match(regexp))\n .map((relation) =>\n metadata.findRelationWithPropertyPath(\n relation.replace(regexp, \"\"),\n ),\n )\n .filter((entity) => entity) as RelationMetadata[]\n } else {\n matchedBaseRelations = allRelations\n .map((relation) =>\n metadata.findRelationWithPropertyPath(relation),\n )\n .filter((entity) => entity) as RelationMetadata[]\n }\n\n // go through all matched relations and add join for them\n matchedBaseRelations.forEach((relation) => {\n // generate a relation alias\n let relationAlias: string = DriverUtils.buildAlias(\n qb.connection.driver,\n { joiner: \"__\" },\n alias,\n relation.propertyPath,\n )\n\n // add a join for the found relation\n const selection = alias + \".\" + relation.propertyPath\n if (qb.expressionMap.relationLoadStrategy === \"query\") {\n qb.concatRelationMetadata(relation)\n } else {\n qb.leftJoinAndSelect(selection, relationAlias)\n }\n\n // remove added relations from the allRelations array, this is needed to find all not found relations at the end\n allRelations.splice(\n allRelations.indexOf(\n prefix\n ? prefix + \".\" + relation.propertyPath\n : relation.propertyPath,\n ),\n 1,\n )\n\n // try to find sub-relations\n let relationMetadata: EntityMetadata | undefined\n let relationName: string | undefined\n\n if (qb.expressionMap.relationLoadStrategy === \"query\") {\n relationMetadata = relation.inverseEntityMetadata\n relationName = relationAlias\n } else {\n const join = qb.expressionMap.joinAttributes.find(\n (join) => join.entityOrProperty === selection,\n )\n relationMetadata = join!.metadata!\n relationName = join!.alias.name\n }\n\n if (!relationName || !relationMetadata) {\n throw new EntityPropertyNotFoundError(\n relation.propertyPath,\n metadata,\n )\n }\n\n this.applyRelationsRecursively(\n qb,\n allRelations,\n relationName,\n relationMetadata,\n prefix\n ? prefix + \".\" + relation.propertyPath\n : relation.propertyPath,\n )\n\n // join the eager relations of the found relation\n // Only supported for \"join\" relationLoadStrategy\n if (qb.expressionMap.relationLoadStrategy === \"join\") {\n const relMetadata = metadata.relations.find(\n (metadata) =>\n metadata.propertyName === relation.propertyPath,\n )\n if (relMetadata) {\n this.joinEagerRelations(\n qb,\n relationAlias,\n relMetadata.inverseEntityMetadata,\n )\n }\n }\n })\n }\n\n public static joinEagerRelations(\n qb: SelectQueryBuilder<any>,\n alias: string,\n metadata: EntityMetadata,\n ) {\n metadata.eagerRelations.forEach((relation) => {\n // generate a relation alias\n let relationAlias: string = DriverUtils.buildAlias(\n qb.connection.driver,\n { joiner: \"__\" },\n alias,\n relation.propertyName,\n )\n\n // add a join for the relation\n // Checking whether the relation wasn't joined yet.\n let addJoin = true\n // TODO: Review this validation\n for (const join of qb.expressionMap.joinAttributes) {\n if (\n join.condition !== undefined ||\n join.mapToProperty !== undefined ||\n join.isMappingMany !== undefined ||\n join.direction !== \"LEFT\" ||\n join.entityOrProperty !==\n `${alias}.${relation.propertyPath}`\n ) {\n continue\n }\n addJoin = false\n relationAlias = join.alias.name\n break\n }\n\n const joinAlreadyAdded = Boolean(\n qb.expressionMap.joinAttributes.find(\n (joinAttribute) =>\n joinAttribute.alias.name === relationAlias,\n ),\n )\n\n if (addJoin && !joinAlreadyAdded) {\n qb.leftJoin(alias + \".\" + relation.propertyPath, relationAlias)\n }\n\n // Checking whether the relation wasn't selected yet.\n // This check shall be after the join check to detect relationAlias.\n let addSelect = true\n for (const select of qb.expressionMap.selects) {\n if (\n select.aliasName !== undefined ||\n select.virtual !== undefined ||\n select.selection !== relationAlias\n ) {\n continue\n }\n addSelect = false\n break\n }\n\n if (addSelect) {\n qb.addSelect(relationAlias)\n }\n\n // (recursive) join the eager relations\n this.joinEagerRelations(\n qb,\n relationAlias,\n relation.inverseEntityMetadata,\n )\n })\n }\n}\n"],"sourceRoot":".."}
|
|
@@ -9,7 +9,7 @@ import { EqualOperator } from "./EqualOperator";
|
|
|
9
9
|
* It means the result of FindOptionsWhereProperty<1 | 2> doesn't include FindOperator<1 | 2> but FindOperator<1> | FindOperator<2>.
|
|
10
10
|
* So we keep the original Union as Original and pass it to the FindOperator too. Original remains Union as extends is not used for it.
|
|
11
11
|
*/
|
|
12
|
-
export type FindOptionsWhereProperty<PropertyToBeNarrowed, Property = PropertyToBeNarrowed> = PropertyToBeNarrowed extends Promise<infer I> ? FindOptionsWhereProperty<NonNullable<I>> : PropertyToBeNarrowed extends Array<infer I> ? FindOptionsWhereProperty<NonNullable<I>> : PropertyToBeNarrowed extends Function ? never : PropertyToBeNarrowed extends Buffer ? Property | FindOperator<Property> : PropertyToBeNarrowed extends Date ? Property | FindOperator<Property> : PropertyToBeNarrowed extends ObjectId ? Property | FindOperator<Property> : PropertyToBeNarrowed extends string ? Property | FindOperator<Property> : PropertyToBeNarrowed extends number ? Property | FindOperator<Property> : PropertyToBeNarrowed extends boolean ? Property | FindOperator<Property> : PropertyToBeNarrowed extends object ? FindOptionsWhere<Property> | FindOptionsWhere<Property>[] | EqualOperator<Property> | FindOperator<any> | boolean : Property | FindOperator<Property>;
|
|
12
|
+
export type FindOptionsWhereProperty<PropertyToBeNarrowed, Property = PropertyToBeNarrowed> = PropertyToBeNarrowed extends Promise<infer I> ? FindOptionsWhereProperty<NonNullable<I>> : PropertyToBeNarrowed extends Array<infer I> ? FindOptionsWhereProperty<NonNullable<I>> : PropertyToBeNarrowed extends Function ? never : PropertyToBeNarrowed extends Buffer ? Property | FindOperator<Property> : PropertyToBeNarrowed extends Date ? Property | FindOperator<Property> : PropertyToBeNarrowed extends ObjectId ? Property | FindOperator<Property> : PropertyToBeNarrowed extends string ? Property | FindOperator<Property> : PropertyToBeNarrowed extends number ? Property | FindOperator<Property> : PropertyToBeNarrowed extends boolean ? Property | FindOperator<Property> : PropertyToBeNarrowed extends object ? FindOptionsWhere<Property> | FindOptionsWhere<Property>[] | EqualOperator<Property> | FindOperator<any> | boolean | Property : Property | FindOperator<Property>;
|
|
13
13
|
/**
|
|
14
14
|
* Used for find operations.
|
|
15
15
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/find-options/FindOptionsWhere.ts"],"names":[],"mappings":"","file":"FindOptionsWhere.js","sourcesContent":["import { FindOperator } from \"./FindOperator\"\nimport { ObjectId } from \"../driver/mongodb/typings\"\nimport { EqualOperator } from \"./EqualOperator\"\n\n/**\n * A single property handler for FindOptionsWhere.\n *\n * The reason why we have both \"PropertyToBeNarrowed\" and \"Property\" is that Union is narrowed down when extends is used.\n * It means the result of FindOptionsWhereProperty<1 | 2> doesn't include FindOperator<1 | 2> but FindOperator<1> | FindOperator<2>.\n * So we keep the original Union as Original and pass it to the FindOperator too. Original remains Union as extends is not used for it.\n */\nexport type FindOptionsWhereProperty<\n PropertyToBeNarrowed,\n Property = PropertyToBeNarrowed,\n> = PropertyToBeNarrowed extends Promise<infer I>\n ? FindOptionsWhereProperty<NonNullable<I>>\n : PropertyToBeNarrowed extends Array<infer I>\n ? FindOptionsWhereProperty<NonNullable<I>>\n : PropertyToBeNarrowed extends Function\n ? never\n : PropertyToBeNarrowed extends Buffer\n ? Property | FindOperator<Property>\n : PropertyToBeNarrowed extends Date\n ? Property | FindOperator<Property>\n : PropertyToBeNarrowed extends ObjectId\n ? Property | FindOperator<Property>\n : PropertyToBeNarrowed extends string\n ? Property | FindOperator<Property>\n : PropertyToBeNarrowed extends number\n ? Property | FindOperator<Property>\n : PropertyToBeNarrowed extends boolean\n ? Property | FindOperator<Property>\n : PropertyToBeNarrowed extends object\n ?\n | FindOptionsWhere<Property>\n | FindOptionsWhere<Property>[]\n | EqualOperator<Property>\n | FindOperator<any>\n | boolean\n : Property | FindOperator<Property>\n\n/**\n * Used for find operations.\n */\nexport type FindOptionsWhere<Entity> = {\n [P in keyof Entity]?: P extends \"toString\"\n ? unknown\n : FindOptionsWhereProperty<NonNullable<Entity[P]>>\n}\n"],"sourceRoot":".."}
|
|
1
|
+
{"version":3,"sources":["../../src/find-options/FindOptionsWhere.ts"],"names":[],"mappings":"","file":"FindOptionsWhere.js","sourcesContent":["import { FindOperator } from \"./FindOperator\"\nimport { ObjectId } from \"../driver/mongodb/typings\"\nimport { EqualOperator } from \"./EqualOperator\"\n\n/**\n * A single property handler for FindOptionsWhere.\n *\n * The reason why we have both \"PropertyToBeNarrowed\" and \"Property\" is that Union is narrowed down when extends is used.\n * It means the result of FindOptionsWhereProperty<1 | 2> doesn't include FindOperator<1 | 2> but FindOperator<1> | FindOperator<2>.\n * So we keep the original Union as Original and pass it to the FindOperator too. Original remains Union as extends is not used for it.\n */\nexport type FindOptionsWhereProperty<\n PropertyToBeNarrowed,\n Property = PropertyToBeNarrowed,\n> = PropertyToBeNarrowed extends Promise<infer I>\n ? FindOptionsWhereProperty<NonNullable<I>>\n : PropertyToBeNarrowed extends Array<infer I>\n ? FindOptionsWhereProperty<NonNullable<I>>\n : PropertyToBeNarrowed extends Function\n ? never\n : PropertyToBeNarrowed extends Buffer\n ? Property | FindOperator<Property>\n : PropertyToBeNarrowed extends Date\n ? Property | FindOperator<Property>\n : PropertyToBeNarrowed extends ObjectId\n ? Property | FindOperator<Property>\n : PropertyToBeNarrowed extends string\n ? Property | FindOperator<Property>\n : PropertyToBeNarrowed extends number\n ? Property | FindOperator<Property>\n : PropertyToBeNarrowed extends boolean\n ? Property | FindOperator<Property>\n : PropertyToBeNarrowed extends object\n ?\n | FindOptionsWhere<Property>\n | FindOptionsWhere<Property>[]\n | EqualOperator<Property>\n | FindOperator<any>\n | boolean\n | Property\n : Property | FindOperator<Property>\n\n/**\n * Used for find operations.\n */\nexport type FindOptionsWhere<Entity> = {\n [P in keyof Entity]?: P extends \"toString\"\n ? unknown\n : FindOptionsWhereProperty<NonNullable<Entity[P]>>\n}\n"],"sourceRoot":".."}
|
package/index.d.ts
CHANGED
|
@@ -114,6 +114,7 @@ export * from "./schema-builder/table/TableForeignKey";
|
|
|
114
114
|
export * from "./schema-builder/table/TableIndex";
|
|
115
115
|
export * from "./schema-builder/table/TableUnique";
|
|
116
116
|
export * from "./schema-builder/table/Table";
|
|
117
|
+
export * from "./schema-builder/view/View";
|
|
117
118
|
export * from "./schema-builder/options/TableCheckOptions";
|
|
118
119
|
export * from "./schema-builder/options/TableColumnOptions";
|
|
119
120
|
export * from "./schema-builder/options/TableExclusionOptions";
|
package/index.js
CHANGED
|
@@ -121,6 +121,7 @@ tslib_1.__exportStar(require("./schema-builder/table/TableForeignKey"), exports)
|
|
|
121
121
|
tslib_1.__exportStar(require("./schema-builder/table/TableIndex"), exports);
|
|
122
122
|
tslib_1.__exportStar(require("./schema-builder/table/TableUnique"), exports);
|
|
123
123
|
tslib_1.__exportStar(require("./schema-builder/table/Table"), exports);
|
|
124
|
+
tslib_1.__exportStar(require("./schema-builder/view/View"), exports);
|
|
124
125
|
tslib_1.__exportStar(require("./schema-builder/options/TableCheckOptions"), exports);
|
|
125
126
|
tslib_1.__exportStar(require("./schema-builder/options/TableColumnOptions"), exports);
|
|
126
127
|
tslib_1.__exportStar(require("./schema-builder/options/TableExclusionOptions"), exports);
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA;GACG;AACH,4BAAyB;AAEzB,4EAA4E;AAC5E,wBAAwB;AACxB,4EAA4E;AAE5E,oDAAyB;AACzB,sDAA2B;AAC3B,gEAAqC;AACrC,8DAAmC;AACnC,iEAAsC;AACtC,6DAAkC;AAClC,+DAAoC;AACpC,gEAAqC;AACrC,kDAAuB;AACvB,qEAA0C;AAC1C,+EAAoD;AACpD,+EAAoD;AACpD,qFAA0D;AAC1D,4EAAiD;AACjD,+EAAoD;AACpD,4EAAiD;AACjD,4EAAiD;AACjD,yEAA8C;AAC9C,6EAAkD;AAClD,4EAAiD;AACjD,0EAA+C;AAC/C,4EAAiD;AACjD,gFAAqD;AACrD,6EAAkD;AAClD,4EAAiD;AACjD,6EAAkD;AA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uGAAqG;AAA5F,sJAAA,iCAAiC,OAAA;AAE1C,2EAAyE;AAAhE,0HAAA,mBAAmB,OAAA;AAC5B,0DAAwD;AAA/C,kHAAA,eAAe,OAAA;AACxB,kEAAgE;AAAvD,0HAAA,mBAAmB,OAAA","file":"index.js","sourcesContent":["/*!\n */\nimport \"reflect-metadata\"\n\n// -------------------------------------------------------------------------\n// Commonly Used exports\n// -------------------------------------------------------------------------\n\nexport * from \"./globals\"\nexport * from \"./container\"\nexport * from \"./common/EntityTarget\"\nexport * from \"./common/ObjectType\"\nexport * from \"./common/ObjectLiteral\"\nexport * from \"./common/MixedList\"\nexport * from \"./common/DeepPartial\"\nexport * from \"./common/RelationType\"\nexport * from \"./error\"\nexport * from \"./decorator/columns/Column\"\nexport * from \"./decorator/columns/CreateDateColumn\"\nexport * from \"./decorator/columns/DeleteDateColumn\"\nexport * from \"./decorator/columns/PrimaryGeneratedColumn\"\nexport * from \"./decorator/columns/PrimaryColumn\"\nexport * from \"./decorator/columns/UpdateDateColumn\"\nexport * from \"./decorator/columns/VersionColumn\"\nexport * from \"./decorator/columns/VirtualColumn\"\nexport * from \"./decorator/columns/ViewColumn\"\nexport * from \"./decorator/columns/ObjectIdColumn\"\nexport * from \"./decorator/listeners/AfterInsert\"\nexport * from \"./decorator/listeners/AfterLoad\"\nexport * from \"./decorator/listeners/AfterRemove\"\nexport * from \"./decorator/listeners/AfterSoftRemove\"\nexport * from \"./decorator/listeners/AfterRecover\"\nexport * from \"./decorator/listeners/AfterUpdate\"\nexport * from \"./decorator/listeners/BeforeInsert\"\nexport * from \"./decorator/listeners/BeforeRemove\"\nexport * from \"./decorator/listeners/BeforeSoftRemove\"\nexport * from \"./decorator/listeners/BeforeRecover\"\nexport * from \"./decorator/listeners/BeforeUpdate\"\nexport * from \"./decorator/listeners/EventSubscriber\"\nexport * from \"./decorator/options/ColumnOptions\"\nexport * from \"./decorator/options/IndexOptions\"\nexport * from \"./decorator/options/JoinColumnOptions\"\nexport * from \"./decorator/options/JoinTableOptions\"\nexport * from \"./decorator/options/RelationOptions\"\nexport * from \"./decorator/options/EntityOptions\"\nexport * from \"./decorator/options/ValueTransformer\"\nexport * from \"./decorator/relations/JoinColumn\"\nexport * from \"./decorator/relations/JoinTable\"\nexport * from \"./decorator/relations/ManyToMany\"\nexport * from \"./decorator/relations/ManyToOne\"\nexport * from \"./decorator/relations/OneToMany\"\nexport * from \"./decorator/relations/OneToOne\"\nexport * from \"./decorator/relations/RelationCount\"\nexport * from \"./decorator/relations/RelationId\"\nexport * from \"./decorator/entity/Entity\"\nexport * from \"./decorator/entity/ChildEntity\"\nexport * from \"./decorator/entity/TableInheritance\"\nexport * from \"./decorator/entity-view/ViewEntity\"\nexport * from \"./decorator/tree/TreeLevelColumn\"\nexport * from \"./decorator/tree/TreeParent\"\nexport * from \"./decorator/tree/TreeChildren\"\nexport * from \"./decorator/tree/Tree\"\nexport * from \"./decorator/Index\"\nexport * from \"./decorator/Unique\"\nexport * from \"./decorator/Check\"\nexport * from \"./decorator/Exclusion\"\nexport * from \"./decorator/Generated\"\nexport * from \"./decorator/EntityRepository\"\nexport * from \"./find-options/operator/And\"\nexport * from \"./find-options/operator/Any\"\nexport * from \"./find-options/operator/ArrayContainedBy\"\nexport * from \"./find-options/operator/ArrayContains\"\nexport * from \"./find-options/operator/ArrayOverlap\"\nexport * from \"./find-options/operator/Between\"\nexport * from \"./find-options/operator/Equal\"\nexport * from \"./find-options/operator/In\"\nexport * from \"./find-options/operator/IsNull\"\nexport * from \"./find-options/operator/LessThan\"\nexport * from \"./find-options/operator/LessThanOrEqual\"\nexport * from \"./find-options/operator/ILike\"\nexport * from \"./find-options/operator/Like\"\nexport * from \"./find-options/operator/MoreThan\"\nexport * from \"./find-options/operator/MoreThanOrEqual\"\nexport * from \"./find-options/operator/Not\"\nexport * from \"./find-options/operator/Raw\"\nexport * from \"./find-options/operator/JsonContains\"\nexport * from \"./find-options/EqualOperator\"\nexport * from \"./find-options/FindManyOptions\"\nexport * from \"./find-options/FindOneOptions\"\nexport * from \"./find-options/FindOperator\"\nexport * from \"./find-options/FindOperatorType\"\nexport * from \"./find-options/FindOptionsOrder\"\nexport * from \"./find-options/FindOptionsRelations\"\nexport * from \"./find-options/FindOptionsSelect\"\nexport * from \"./find-options/FindOptionsUtils\"\nexport * from \"./find-options/FindOptionsWhere\"\nexport * from \"./find-options/FindTreeOptions\"\nexport * from \"./find-options/JoinOptions\"\nexport * from \"./find-options/OrderByCondition\"\nexport * from \"./logger/AbstractLogger\"\nexport * from \"./logger/Logger\"\nexport * from \"./logger/LoggerOptions\"\nexport * from \"./logger/AdvancedConsoleLogger\"\nexport * from \"./logger/SimpleConsoleLogger\"\nexport * from \"./logger/FileLogger\"\nexport * from \"./metadata/EntityMetadata\"\nexport * from \"./entity-manager/EntityManager\"\nexport * from \"./repository/AbstractRepository\"\nexport * from \"./repository/Repository\"\nexport * from \"./repository/BaseEntity\"\nexport * from \"./repository/TreeRepository\"\nexport * from \"./repository/MongoRepository\"\nexport * from \"./repository/RemoveOptions\"\nexport * from \"./repository/SaveOptions\"\nexport * from \"./schema-builder/table/TableCheck\"\nexport * from \"./schema-builder/table/TableColumn\"\nexport * from \"./schema-builder/table/TableExclusion\"\nexport * from \"./schema-builder/table/TableForeignKey\"\nexport * from \"./schema-builder/table/TableIndex\"\nexport * from \"./schema-builder/table/TableUnique\"\nexport * from \"./schema-builder/table/Table\"\nexport * from \"./schema-builder/options/TableCheckOptions\"\nexport * from \"./schema-builder/options/TableColumnOptions\"\nexport * from \"./schema-builder/options/TableExclusionOptions\"\nexport * from \"./schema-builder/options/TableForeignKeyOptions\"\nexport * from \"./schema-builder/options/TableIndexOptions\"\nexport * from \"./schema-builder/options/TableOptions\"\nexport * from \"./schema-builder/options/TableUniqueOptions\"\nexport * from \"./schema-builder/options/ViewOptions\"\nexport * from \"./driver/mongodb/typings\"\nexport * from \"./driver/types/DatabaseType\"\nexport * from \"./driver/types/GeoJsonTypes\"\nexport * from \"./driver/types/ReplicationMode\"\nexport * from \"./driver/sqlserver/MssqlParameter\"\n\n// export * from \"./data-source\";\n\nexport { ConnectionOptionsReader } from \"./connection/ConnectionOptionsReader\"\nexport { ConnectionOptions } from \"./connection/ConnectionOptions\"\nexport { DataSource } from \"./data-source/DataSource\"\nexport { Connection } from \"./connection/Connection\"\nexport { ConnectionManager } from \"./connection/ConnectionManager\"\nexport { DataSourceOptions } from \"./data-source/DataSourceOptions\"\nexport { Driver } from \"./driver/Driver\"\nexport { QueryBuilder } from \"./query-builder/QueryBuilder\"\nexport { SelectQueryBuilder } from \"./query-builder/SelectQueryBuilder\"\nexport { DeleteQueryBuilder } from \"./query-builder/DeleteQueryBuilder\"\nexport { InsertQueryBuilder } from \"./query-builder/InsertQueryBuilder\"\nexport { UpdateQueryBuilder } from \"./query-builder/UpdateQueryBuilder\"\nexport { RelationQueryBuilder } from \"./query-builder/RelationQueryBuilder\"\nexport { Brackets } from \"./query-builder/Brackets\"\nexport { NotBrackets } from \"./query-builder/NotBrackets\"\nexport { WhereExpressionBuilder } from \"./query-builder/WhereExpressionBuilder\"\nexport { WhereExpression } from \"./query-builder/WhereExpressionBuilder\"\nexport { InsertResult } from \"./query-builder/result/InsertResult\"\nexport { UpdateResult } from \"./query-builder/result/UpdateResult\"\nexport { DeleteResult } from \"./query-builder/result/DeleteResult\"\nexport { QueryResult } from \"./query-runner/QueryResult\"\nexport { QueryRunner } from \"./query-runner/QueryRunner\"\nexport { MongoEntityManager } from \"./entity-manager/MongoEntityManager\"\nexport { Migration } from \"./migration/Migration\"\nexport { MigrationExecutor } from \"./migration/MigrationExecutor\"\nexport { MigrationInterface } from \"./migration/MigrationInterface\"\nexport { DefaultNamingStrategy } from \"./naming-strategy/DefaultNamingStrategy\"\nexport { NamingStrategyInterface } from \"./naming-strategy/NamingStrategyInterface\"\nexport { LegacyOracleNamingStrategy } from \"./naming-strategy/LegacyOracleNamingStrategy\"\nexport { InsertEvent } from \"./subscriber/event/InsertEvent\"\nexport { LoadEvent } from \"./subscriber/event/LoadEvent\"\nexport { UpdateEvent } from \"./subscriber/event/UpdateEvent\"\nexport { RemoveEvent } from \"./subscriber/event/RemoveEvent\"\nexport { SoftRemoveEvent } from \"./subscriber/event/SoftRemoveEvent\"\nexport { RecoverEvent } from \"./subscriber/event/RecoverEvent\"\nexport { TransactionCommitEvent } from \"./subscriber/event/TransactionCommitEvent\"\nexport { TransactionRollbackEvent } from \"./subscriber/event/TransactionRollbackEvent\"\nexport { TransactionStartEvent } from \"./subscriber/event/TransactionStartEvent\"\nexport { EntitySubscriberInterface } from \"./subscriber/EntitySubscriberInterface\"\nexport { EntitySchema } from \"./entity-schema/EntitySchema\"\nexport { EntitySchemaColumnOptions } from \"./entity-schema/EntitySchemaColumnOptions\"\nexport { EntitySchemaIndexOptions } from \"./entity-schema/EntitySchemaIndexOptions\"\nexport { EntitySchemaRelationOptions } from \"./entity-schema/EntitySchemaRelationOptions\"\nexport { EntitySchemaEmbeddedColumnOptions } from \"./entity-schema/EntitySchemaEmbeddedColumnOptions\"\nexport { ColumnType } from \"./driver/types/ColumnTypes\"\nexport { EntitySchemaOptions } from \"./entity-schema/EntitySchemaOptions\"\nexport { InstanceChecker } from \"./util/InstanceChecker\"\nexport { TreeRepositoryUtils } from \"./util/TreeRepositoryUtils\"\n"],"sourceRoot":"."}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA;GACG;AACH,4BAAyB;AAEzB,4EAA4E;AAC5E,wBAAwB;AACxB,4EAA4E;AAE5E,oDAAyB;AACzB,sDAA2B;AAC3B,gEAAqC;AACrC,8DAAmC;AACnC,iEAAsC;AACtC,6DAAkC;AAClC,+DAAoC;AACpC,gEAAqC;AACrC,kDAAuB;AACvB,qEAA0C;AAC1C,+EAAoD;AACpD,+EAAoD;AACpD,qFAA0D;AAC1D,4EAAiD;AACjD,+EAAoD;AACpD,4EAAiD;AACjD,4EAAiD;AACjD,yEAA8C;AAC9C,6EAAkD;AAClD,4EA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A,qBAAqB,OAAA;AAE9B,2FAAyF;AAAhF,wIAAA,0BAA0B,OAAA;AAWnC,6DAA2D;AAAlD,4GAAA,YAAY,OAAA;AAIrB,uGAAqG;AAA5F,sJAAA,iCAAiC,OAAA;AAE1C,2EAAyE;AAAhE,0HAAA,mBAAmB,OAAA;AAC5B,0DAAwD;AAA/C,kHAAA,eAAe,OAAA;AACxB,kEAAgE;AAAvD,0HAAA,mBAAmB,OAAA","file":"index.js","sourcesContent":["/*!\n */\nimport \"reflect-metadata\"\n\n// -------------------------------------------------------------------------\n// Commonly Used exports\n// -------------------------------------------------------------------------\n\nexport * from \"./globals\"\nexport * from \"./container\"\nexport * from \"./common/EntityTarget\"\nexport * from \"./common/ObjectType\"\nexport * from \"./common/ObjectLiteral\"\nexport * from \"./common/MixedList\"\nexport * from \"./common/DeepPartial\"\nexport * from \"./common/RelationType\"\nexport * from \"./error\"\nexport * from \"./decorator/columns/Column\"\nexport * from \"./decorator/columns/CreateDateColumn\"\nexport * from \"./decorator/columns/DeleteDateColumn\"\nexport * from \"./decorator/columns/PrimaryGeneratedColumn\"\nexport * from \"./decorator/columns/PrimaryColumn\"\nexport * from \"./decorator/columns/UpdateDateColumn\"\nexport * from \"./decorator/columns/VersionColumn\"\nexport * from \"./decorator/columns/VirtualColumn\"\nexport * from \"./decorator/columns/ViewColumn\"\nexport * from \"./decorator/columns/ObjectIdColumn\"\nexport * from \"./decorator/listeners/AfterInsert\"\nexport * from \"./decorator/listeners/AfterLoad\"\nexport * from \"./decorator/listeners/AfterRemove\"\nexport * from \"./decorator/listeners/AfterSoftRemove\"\nexport * from \"./decorator/listeners/AfterRecover\"\nexport * from \"./decorator/listeners/AfterUpdate\"\nexport * from \"./decorator/listeners/BeforeInsert\"\nexport * from \"./decorator/listeners/BeforeRemove\"\nexport * from \"./decorator/listeners/BeforeSoftRemove\"\nexport * from \"./decorator/listeners/BeforeRecover\"\nexport * from \"./decorator/listeners/BeforeUpdate\"\nexport * from \"./decorator/listeners/EventSubscriber\"\nexport * from \"./decorator/options/ColumnOptions\"\nexport * from \"./decorator/options/IndexOptions\"\nexport * from \"./decorator/options/JoinColumnOptions\"\nexport * from \"./decorator/options/JoinTableOptions\"\nexport * from \"./decorator/options/RelationOptions\"\nexport * from \"./decorator/options/EntityOptions\"\nexport * from \"./decorator/options/ValueTransformer\"\nexport * from \"./decorator/relations/JoinColumn\"\nexport * from \"./decorator/relations/JoinTable\"\nexport * from \"./decorator/relations/ManyToMany\"\nexport * from \"./decorator/relations/ManyToOne\"\nexport * from \"./decorator/relations/OneToMany\"\nexport * from \"./decorator/relations/OneToOne\"\nexport * from \"./decorator/relations/RelationCount\"\nexport * from \"./decorator/relations/RelationId\"\nexport * from \"./decorator/entity/Entity\"\nexport * from \"./decorator/entity/ChildEntity\"\nexport * from \"./decorator/entity/TableInheritance\"\nexport * from \"./decorator/entity-view/ViewEntity\"\nexport * from \"./decorator/tree/TreeLevelColumn\"\nexport * from \"./decorator/tree/TreeParent\"\nexport * from \"./decorator/tree/TreeChildren\"\nexport * from \"./decorator/tree/Tree\"\nexport * from \"./decorator/Index\"\nexport * from \"./decorator/Unique\"\nexport * from \"./decorator/Check\"\nexport * from \"./decorator/Exclusion\"\nexport * from \"./decorator/Generated\"\nexport * from \"./decorator/EntityRepository\"\nexport * from \"./find-options/operator/And\"\nexport * from \"./find-options/operator/Any\"\nexport * from \"./find-options/operator/ArrayContainedBy\"\nexport * from \"./find-options/operator/ArrayContains\"\nexport * from \"./find-options/operator/ArrayOverlap\"\nexport * from \"./find-options/operator/Between\"\nexport * from \"./find-options/operator/Equal\"\nexport * from \"./find-options/operator/In\"\nexport * from \"./find-options/operator/IsNull\"\nexport * from \"./find-options/operator/LessThan\"\nexport * from \"./find-options/operator/LessThanOrEqual\"\nexport * from \"./find-options/operator/ILike\"\nexport * from \"./find-options/operator/Like\"\nexport * from \"./find-options/operator/MoreThan\"\nexport * from \"./find-options/operator/MoreThanOrEqual\"\nexport * from \"./find-options/operator/Not\"\nexport * from \"./find-options/operator/Raw\"\nexport * from \"./find-options/operator/JsonContains\"\nexport * from \"./find-options/EqualOperator\"\nexport * from \"./find-options/FindManyOptions\"\nexport * from \"./find-options/FindOneOptions\"\nexport * from \"./find-options/FindOperator\"\nexport * from \"./find-options/FindOperatorType\"\nexport * from \"./find-options/FindOptionsOrder\"\nexport * from \"./find-options/FindOptionsRelations\"\nexport * from \"./find-options/FindOptionsSelect\"\nexport * from \"./find-options/FindOptionsUtils\"\nexport * from \"./find-options/FindOptionsWhere\"\nexport * from \"./find-options/FindTreeOptions\"\nexport * from \"./find-options/JoinOptions\"\nexport * from \"./find-options/OrderByCondition\"\nexport * from \"./logger/AbstractLogger\"\nexport * from \"./logger/Logger\"\nexport * from \"./logger/LoggerOptions\"\nexport * from \"./logger/AdvancedConsoleLogger\"\nexport * from \"./logger/SimpleConsoleLogger\"\nexport * from \"./logger/FileLogger\"\nexport * from \"./metadata/EntityMetadata\"\nexport * from \"./entity-manager/EntityManager\"\nexport * from \"./repository/AbstractRepository\"\nexport * from \"./repository/Repository\"\nexport * from \"./repository/BaseEntity\"\nexport * from \"./repository/TreeRepository\"\nexport * from \"./repository/MongoRepository\"\nexport * from \"./repository/RemoveOptions\"\nexport * from \"./repository/SaveOptions\"\nexport * from \"./schema-builder/table/TableCheck\"\nexport * from \"./schema-builder/table/TableColumn\"\nexport * from \"./schema-builder/table/TableExclusion\"\nexport * from \"./schema-builder/table/TableForeignKey\"\nexport * from \"./schema-builder/table/TableIndex\"\nexport * from \"./schema-builder/table/TableUnique\"\nexport * from \"./schema-builder/table/Table\"\nexport * from \"./schema-builder/view/View\"\nexport * from \"./schema-builder/options/TableCheckOptions\"\nexport * from \"./schema-builder/options/TableColumnOptions\"\nexport * from \"./schema-builder/options/TableExclusionOptions\"\nexport * from \"./schema-builder/options/TableForeignKeyOptions\"\nexport * from \"./schema-builder/options/TableIndexOptions\"\nexport * from \"./schema-builder/options/TableOptions\"\nexport * from \"./schema-builder/options/TableUniqueOptions\"\nexport * from \"./schema-builder/options/ViewOptions\"\nexport * from \"./driver/mongodb/typings\"\nexport * from \"./driver/types/DatabaseType\"\nexport * from \"./driver/types/GeoJsonTypes\"\nexport * from \"./driver/types/ReplicationMode\"\nexport * from \"./driver/sqlserver/MssqlParameter\"\n\n// export * from \"./data-source\";\n\nexport { ConnectionOptionsReader } from \"./connection/ConnectionOptionsReader\"\nexport { ConnectionOptions } from \"./connection/ConnectionOptions\"\nexport { DataSource } from \"./data-source/DataSource\"\nexport { Connection } from \"./connection/Connection\"\nexport { ConnectionManager } from \"./connection/ConnectionManager\"\nexport { DataSourceOptions } from \"./data-source/DataSourceOptions\"\nexport { Driver } from \"./driver/Driver\"\nexport { QueryBuilder } from \"./query-builder/QueryBuilder\"\nexport { SelectQueryBuilder } from \"./query-builder/SelectQueryBuilder\"\nexport { DeleteQueryBuilder } from \"./query-builder/DeleteQueryBuilder\"\nexport { InsertQueryBuilder } from \"./query-builder/InsertQueryBuilder\"\nexport { UpdateQueryBuilder } from \"./query-builder/UpdateQueryBuilder\"\nexport { RelationQueryBuilder } from \"./query-builder/RelationQueryBuilder\"\nexport { Brackets } from \"./query-builder/Brackets\"\nexport { NotBrackets } from \"./query-builder/NotBrackets\"\nexport { WhereExpressionBuilder } from \"./query-builder/WhereExpressionBuilder\"\nexport { WhereExpression } from \"./query-builder/WhereExpressionBuilder\"\nexport { InsertResult } from \"./query-builder/result/InsertResult\"\nexport { UpdateResult } from \"./query-builder/result/UpdateResult\"\nexport { DeleteResult } from \"./query-builder/result/DeleteResult\"\nexport { QueryResult } from \"./query-runner/QueryResult\"\nexport { QueryRunner } from \"./query-runner/QueryRunner\"\nexport { MongoEntityManager } from \"./entity-manager/MongoEntityManager\"\nexport { Migration } from \"./migration/Migration\"\nexport { MigrationExecutor } from \"./migration/MigrationExecutor\"\nexport { MigrationInterface } from \"./migration/MigrationInterface\"\nexport { DefaultNamingStrategy } from \"./naming-strategy/DefaultNamingStrategy\"\nexport { NamingStrategyInterface } from \"./naming-strategy/NamingStrategyInterface\"\nexport { LegacyOracleNamingStrategy } from \"./naming-strategy/LegacyOracleNamingStrategy\"\nexport { InsertEvent } from \"./subscriber/event/InsertEvent\"\nexport { LoadEvent } from \"./subscriber/event/LoadEvent\"\nexport { UpdateEvent } from \"./subscriber/event/UpdateEvent\"\nexport { RemoveEvent } from \"./subscriber/event/RemoveEvent\"\nexport { SoftRemoveEvent } from \"./subscriber/event/SoftRemoveEvent\"\nexport { RecoverEvent } from \"./subscriber/event/RecoverEvent\"\nexport { TransactionCommitEvent } from \"./subscriber/event/TransactionCommitEvent\"\nexport { TransactionRollbackEvent } from \"./subscriber/event/TransactionRollbackEvent\"\nexport { TransactionStartEvent } from \"./subscriber/event/TransactionStartEvent\"\nexport { EntitySubscriberInterface } from \"./subscriber/EntitySubscriberInterface\"\nexport { EntitySchema } from \"./entity-schema/EntitySchema\"\nexport { EntitySchemaColumnOptions } from \"./entity-schema/EntitySchemaColumnOptions\"\nexport { EntitySchemaIndexOptions } from \"./entity-schema/EntitySchemaIndexOptions\"\nexport { EntitySchemaRelationOptions } from \"./entity-schema/EntitySchemaRelationOptions\"\nexport { EntitySchemaEmbeddedColumnOptions } from \"./entity-schema/EntitySchemaEmbeddedColumnOptions\"\nexport { ColumnType } from \"./driver/types/ColumnTypes\"\nexport { EntitySchemaOptions } from \"./entity-schema/EntitySchemaOptions\"\nexport { InstanceChecker } from \"./util/InstanceChecker\"\nexport { TreeRepositoryUtils } from \"./util/TreeRepositoryUtils\"\n"],"sourceRoot":"."}
|
package/index.mjs
CHANGED
|
@@ -734,6 +734,19 @@ class EntityMetadataBuilder {
|
|
|
734
734
|
* Creates indices for the table of single table inheritance.
|
|
735
735
|
*/
|
|
736
736
|
createKeysForTableInheritance(entityMetadata) {
|
|
737
|
+
const isDiscriminatorColumnAlreadyIndexed = entityMetadata.indices.some(({ givenColumnNames }) => {
|
|
738
|
+
var _a;
|
|
739
|
+
return !!givenColumnNames &&
|
|
740
|
+
Array.isArray(givenColumnNames) &&
|
|
741
|
+
givenColumnNames.length === 1 &&
|
|
742
|
+
givenColumnNames[0] ===
|
|
743
|
+
((_a = entityMetadata.discriminatorColumn) === null || _a === void 0 ? void 0 : _a.databaseName);
|
|
744
|
+
});
|
|
745
|
+
// If the discriminator column is already indexed, there is no need to
|
|
746
|
+
// add another index on top of it.
|
|
747
|
+
if (isDiscriminatorColumnAlreadyIndexed) {
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
737
750
|
entityMetadata.indices.push(new IndexMetadata_1.IndexMetadata({
|
|
738
751
|
entityMetadata: entityMetadata,
|
|
739
752
|
columns: [entityMetadata.discriminatorColumn],
|