typeorm 0.2.42-dev.a855b90 → 0.2.42-dev.baa5880

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.
Files changed (165) hide show
  1. package/README.md +38 -0
  2. package/browser/common/RelationType.d.ts +14 -0
  3. package/browser/common/RelationType.js +3 -0
  4. package/browser/common/RelationType.js.map +1 -0
  5. package/browser/connection/BaseConnectionOptions.d.ts +5 -0
  6. package/browser/connection/BaseConnectionOptions.js.map +1 -1
  7. package/browser/connection/Connection.d.ts +5 -1
  8. package/browser/connection/Connection.js +46 -30
  9. package/browser/connection/Connection.js.map +1 -1
  10. package/browser/connection/ConnectionMetadataBuilder.d.ts +3 -3
  11. package/browser/connection/ConnectionMetadataBuilder.js +54 -22
  12. package/browser/connection/ConnectionMetadataBuilder.js.map +1 -1
  13. package/browser/connection/ConnectionOptionsReader.js +33 -28
  14. package/browser/connection/ConnectionOptionsReader.js.map +1 -1
  15. package/browser/connection/options-reader/ConnectionOptionsEnvReader.js +1 -0
  16. package/browser/connection/options-reader/ConnectionOptionsEnvReader.js.map +1 -1
  17. package/browser/driver/aurora-data-api/AuroraDataApiQueryRunner.js +1 -1
  18. package/browser/driver/aurora-data-api/AuroraDataApiQueryRunner.js.map +1 -1
  19. package/browser/driver/mongodb/MongoConnectionOptions.d.ts +1 -1
  20. package/browser/driver/mongodb/MongoConnectionOptions.js.map +1 -1
  21. package/browser/driver/postgres/PostgresQueryRunner.js +38 -14
  22. package/browser/driver/postgres/PostgresQueryRunner.js.map +1 -1
  23. package/browser/entity-manager/EntityManager.js +1 -11
  24. package/browser/entity-manager/EntityManager.js.map +1 -1
  25. package/browser/entity-schema/EntitySchemaRelationOptions.d.ts +6 -0
  26. package/browser/entity-schema/EntitySchemaRelationOptions.js.map +1 -1
  27. package/browser/entity-schema/EntitySchemaTransformer.js +1 -0
  28. package/browser/entity-schema/EntitySchemaTransformer.js.map +1 -1
  29. package/browser/find-options/FindOneOptions.d.ts +6 -0
  30. package/browser/find-options/FindOneOptions.js.map +1 -1
  31. package/browser/find-options/FindOptionsUtils.js +4 -0
  32. package/browser/find-options/FindOptionsUtils.js.map +1 -1
  33. package/browser/find-options/operator/Like.d.ts +1 -1
  34. package/browser/find-options/operator/Like.js +1 -1
  35. package/browser/find-options/operator/Like.js.map +1 -1
  36. package/browser/find-options/operator/Not.d.ts +1 -1
  37. package/browser/find-options/operator/Not.js +1 -1
  38. package/browser/find-options/operator/Not.js.map +1 -1
  39. package/browser/globals.js +34 -7
  40. package/browser/globals.js.map +1 -1
  41. package/browser/index.d.ts +1 -0
  42. package/browser/index.js +1 -0
  43. package/browser/index.js.map +1 -1
  44. package/browser/migration/MigrationExecutor.js +1 -1
  45. package/browser/migration/MigrationExecutor.js.map +1 -1
  46. package/browser/query-builder/DeleteQueryBuilder.d.ts +3 -1
  47. package/browser/query-builder/DeleteQueryBuilder.js +3 -1
  48. package/browser/query-builder/DeleteQueryBuilder.js.map +1 -1
  49. package/browser/query-builder/InsertQueryBuilder.js +2 -2
  50. package/browser/query-builder/InsertQueryBuilder.js.map +1 -1
  51. package/browser/query-builder/RelationLoader.js +11 -6
  52. package/browser/query-builder/RelationLoader.js.map +1 -1
  53. package/browser/query-builder/SelectQueryBuilder.d.ts +9 -0
  54. package/browser/query-builder/SelectQueryBuilder.js +27 -20
  55. package/browser/query-builder/SelectQueryBuilder.js.map +1 -1
  56. package/browser/query-builder/UpdateQueryBuilder.d.ts +3 -1
  57. package/browser/query-builder/UpdateQueryBuilder.js +3 -1
  58. package/browser/query-builder/UpdateQueryBuilder.js.map +1 -1
  59. package/browser/query-builder/WhereExpressionBuilder.d.ts +3 -1
  60. package/browser/query-builder/WhereExpressionBuilder.js.map +1 -1
  61. package/browser/query-runner/BaseQueryRunner.d.ts +2 -2
  62. package/browser/query-runner/BaseQueryRunner.js +3 -3
  63. package/browser/query-runner/BaseQueryRunner.js.map +1 -1
  64. package/browser/repository/TreeRepository.js +1 -1
  65. package/browser/repository/TreeRepository.js.map +1 -1
  66. package/browser/schema-builder/RdbmsSchemaBuilder.js +1 -1
  67. package/browser/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
  68. package/browser/util/DirectoryExportedClassesLoader.d.ts +1 -1
  69. package/browser/util/DirectoryExportedClassesLoader.js +55 -31
  70. package/browser/util/DirectoryExportedClassesLoader.js.map +1 -1
  71. package/browser/util/ImportUtils.d.ts +1 -0
  72. package/browser/util/ImportUtils.js +90 -0
  73. package/browser/util/ImportUtils.js.map +1 -0
  74. package/browser/util/RandomGenerator.d.ts +0 -4
  75. package/browser/util/RandomGenerator.js +0 -9
  76. package/browser/util/RandomGenerator.js.map +1 -1
  77. package/commands/CommandUtils.d.ts +4 -0
  78. package/commands/CommandUtils.js +10 -0
  79. package/commands/CommandUtils.js.map +1 -1
  80. package/commands/InitCommand.d.ts +9 -7
  81. package/commands/InitCommand.js +72 -43
  82. package/commands/InitCommand.js.map +1 -1
  83. package/commands/MigrationCreateCommand.d.ts +2 -0
  84. package/commands/MigrationCreateCommand.js +7 -1
  85. package/commands/MigrationCreateCommand.js.map +1 -1
  86. package/commands/MigrationGenerateCommand.d.ts +2 -0
  87. package/commands/MigrationGenerateCommand.js +7 -1
  88. package/commands/MigrationGenerateCommand.js.map +1 -1
  89. package/common/RelationType.d.ts +14 -0
  90. package/common/RelationType.js +4 -0
  91. package/common/RelationType.js.map +1 -0
  92. package/connection/BaseConnectionOptions.d.ts +5 -0
  93. package/connection/BaseConnectionOptions.js.map +1 -1
  94. package/connection/Connection.d.ts +5 -1
  95. package/connection/Connection.js +46 -30
  96. package/connection/Connection.js.map +1 -1
  97. package/connection/ConnectionMetadataBuilder.d.ts +3 -3
  98. package/connection/ConnectionMetadataBuilder.js +53 -21
  99. package/connection/ConnectionMetadataBuilder.js.map +1 -1
  100. package/connection/ConnectionOptionsReader.js +32 -27
  101. package/connection/ConnectionOptionsReader.js.map +1 -1
  102. package/connection/options-reader/ConnectionOptionsEnvReader.js +1 -0
  103. package/connection/options-reader/ConnectionOptionsEnvReader.js.map +1 -1
  104. package/driver/aurora-data-api/AuroraDataApiQueryRunner.js +1 -1
  105. package/driver/aurora-data-api/AuroraDataApiQueryRunner.js.map +1 -1
  106. package/driver/mongodb/MongoConnectionOptions.d.ts +1 -1
  107. package/driver/mongodb/MongoConnectionOptions.js.map +1 -1
  108. package/driver/postgres/PostgresQueryRunner.js +38 -14
  109. package/driver/postgres/PostgresQueryRunner.js.map +1 -1
  110. package/entity-manager/EntityManager.js +1 -11
  111. package/entity-manager/EntityManager.js.map +1 -1
  112. package/entity-schema/EntitySchemaRelationOptions.d.ts +6 -0
  113. package/entity-schema/EntitySchemaRelationOptions.js.map +1 -1
  114. package/entity-schema/EntitySchemaTransformer.js +1 -0
  115. package/entity-schema/EntitySchemaTransformer.js.map +1 -1
  116. package/find-options/FindOneOptions.d.ts +6 -0
  117. package/find-options/FindOneOptions.js.map +1 -1
  118. package/find-options/FindOptionsUtils.js +4 -0
  119. package/find-options/FindOptionsUtils.js.map +1 -1
  120. package/find-options/operator/Like.d.ts +1 -1
  121. package/find-options/operator/Like.js +1 -1
  122. package/find-options/operator/Like.js.map +1 -1
  123. package/find-options/operator/Not.d.ts +1 -1
  124. package/find-options/operator/Not.js +1 -1
  125. package/find-options/operator/Not.js.map +1 -1
  126. package/globals.js +33 -6
  127. package/globals.js.map +1 -1
  128. package/index.d.ts +1 -0
  129. package/index.js +1 -0
  130. package/index.js.map +1 -1
  131. package/index.mjs +352 -0
  132. package/migration/MigrationExecutor.js +1 -1
  133. package/migration/MigrationExecutor.js.map +1 -1
  134. package/package.json +1 -1
  135. package/query-builder/DeleteQueryBuilder.d.ts +3 -1
  136. package/query-builder/DeleteQueryBuilder.js +3 -1
  137. package/query-builder/DeleteQueryBuilder.js.map +1 -1
  138. package/query-builder/InsertQueryBuilder.js +2 -2
  139. package/query-builder/InsertQueryBuilder.js.map +1 -1
  140. package/query-builder/RelationLoader.js +11 -6
  141. package/query-builder/RelationLoader.js.map +1 -1
  142. package/query-builder/SelectQueryBuilder.d.ts +9 -0
  143. package/query-builder/SelectQueryBuilder.js +27 -20
  144. package/query-builder/SelectQueryBuilder.js.map +1 -1
  145. package/query-builder/UpdateQueryBuilder.d.ts +3 -1
  146. package/query-builder/UpdateQueryBuilder.js +3 -1
  147. package/query-builder/UpdateQueryBuilder.js.map +1 -1
  148. package/query-builder/WhereExpressionBuilder.d.ts +3 -1
  149. package/query-builder/WhereExpressionBuilder.js.map +1 -1
  150. package/query-runner/BaseQueryRunner.d.ts +2 -2
  151. package/query-runner/BaseQueryRunner.js +3 -3
  152. package/query-runner/BaseQueryRunner.js.map +1 -1
  153. package/repository/TreeRepository.js +1 -1
  154. package/repository/TreeRepository.js.map +1 -1
  155. package/schema-builder/RdbmsSchemaBuilder.js +1 -1
  156. package/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
  157. package/util/DirectoryExportedClassesLoader.d.ts +1 -1
  158. package/util/DirectoryExportedClassesLoader.js +54 -31
  159. package/util/DirectoryExportedClassesLoader.js.map +1 -1
  160. package/util/ImportUtils.d.ts +1 -0
  161. package/util/ImportUtils.js +94 -0
  162. package/util/ImportUtils.js.map +1 -0
  163. package/util/RandomGenerator.d.ts +0 -4
  164. package/util/RandomGenerator.js +0 -9
  165. package/util/RandomGenerator.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/find-options/FindOptionsUtils.ts"],"names":[],"mappings":";AAGA,OAAO,EAAC,0BAA0B,EAAC,MAAM,qCAAqC,CAAC;AAE/E,OAAO,EAAC,WAAW,EAAC,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC;;GAEG;AACH;IAAA;IAoUA,CAAC;IAlUG,4EAA4E;IAC5E,wBAAwB;IACxB,4EAA4E;IAE5E;;OAEG;IACI,iCAAgB,GAAvB,UAAsC,GAAQ;QAC1C,IAAM,eAAe,GAA2B,GAAG,CAAC;QACpD,OAAO,eAAe;YA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AA1C,IAAM,MAAM,WAAA;oBACb,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,IAAI,MAAM,CAAC,SAAS,KAAK,aAAa,EAAE;wBACtG,SAAS;qBACZ;oBACD,SAAS,GAAG,KAAK,CAAC;oBAClB,MAAM;iBACT;;;;;;;;;YAED,IAAI,SAAS,EAAE;gBACX,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;aAC/B;YAED,uCAAuC;YACvC,KAAI,CAAC,kBAAkB,CAAC,EAAE,EAAE,aAAa,EAAE,QAAQ,CAAC,qBAAqB,CAAC,CAAC;QAC/E,CAAC,CAAC,CAAC;IACP,CAAC;IAEL,uBAAC;AAAD,CApUA,AAoUC,IAAA","file":"FindOptionsUtils.js","sourcesContent":["import {FindManyOptions} from \"./FindManyOptions\";\nimport {FindOneOptions} from \"./FindOneOptions\";\nimport {SelectQueryBuilder} from \"../query-builder/SelectQueryBuilder\";\nimport {FindRelationsNotFoundError} from \"../error/FindRelationsNotFoundError\";\nimport {EntityMetadata} from \"../metadata/EntityMetadata\";\nimport {DriverUtils} from \"../driver/DriverUtils\";\nimport { TypeORMError } from \"../error\";\nimport { FindTreeOptions } from \"./FindTreeOptions\";\n\n/**\n * Utilities to work with FindOptions.\n */\nexport class FindOptionsUtils {\n\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>(obj: any): obj is FindOneOptions<Entity> {\n const possibleOptions: FindOneOptions<Entity> = obj;\n return possibleOptions &&\n (\n Array.isArray(possibleOptions.select) ||\n possibleOptions.where instanceof Object ||\n typeof possibleOptions.where === \"string\" ||\n Array.isArray(possibleOptions.relations) ||\n possibleOptions.join instanceof Object ||\n possibleOptions.order instanceof Object ||\n possibleOptions.cache instanceof Object ||\n typeof possibleOptions.cache === \"boolean\" ||\n typeof possibleOptions.cache === \"number\" ||\n possibleOptions.lock instanceof Object ||\n possibleOptions.loadRelationIds instanceof Object ||\n typeof possibleOptions.loadRelationIds === \"boolean\" ||\n typeof possibleOptions.loadEagerRelations === \"boolean\" ||\n typeof possibleOptions.withDeleted === \"boolean\" ||\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>(obj: any): obj is FindManyOptions<Entity> {\n const possibleOptions: FindManyOptions<Entity> = obj;\n return possibleOptions && (\n this.isFindOneOptions(possibleOptions) ||\n typeof (possibleOptions as FindManyOptions<any>).skip === \"number\" ||\n typeof (possibleOptions as FindManyOptions<any>).take === \"number\" ||\n typeof (possibleOptions as FindManyOptions<any>).skip === \"string\" ||\n typeof (possibleOptions as FindManyOptions<any>).take === \"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.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 ) {\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>(qb: SelectQueryBuilder<T>, options?: FindTreeOptions): SelectQueryBuilder<T> {\n if (options?.relations) {\n // Copy because `applyRelationsRecursively` modifies it\n const allRelations = [...options.relations];\n\n FindOptionsUtils.applyRelationsRecursively(qb, allRelations, qb.expressionMap.mainAlias!.name, qb.expressionMap.mainAlias!.metadata, \"\");\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(qb: SelectQueryBuilder<any>, allRelations: string[], alias: string, metadata: EntityMetadata, prefix: string): void {\n\n // find all relations that match given prefix\n let matchedBaseRelations: string[] = [];\n if (prefix) {\n const regexp = new RegExp(\"^\" + prefix.replace(\".\", \"\\\\.\") + \"\\\\.\");\n matchedBaseRelations = allRelations\n .filter(relation => relation.match(regexp))\n .map(relation => relation.replace(regexp, \"\"))\n .filter(relation => metadata.findRelationWithPropertyPath(relation));\n } else {\n matchedBaseRelations = allRelations.filter(relation => metadata.findRelationWithPropertyPath(relation));\n }\n\n // go through all matched relations and add join for them\n matchedBaseRelations.forEach(relation => {\n\n // generate a relation alias\n let relationAlias: string = DriverUtils.buildAlias(qb.connection.driver, { shorten: true, joiner: \"__\" }, alias, relation);\n\n // add a join for the found relation\n const selection = alias + \".\" + relation;\n qb.leftJoinAndSelect(selection, relationAlias);\n\n // remove added relations from the allRelations array, this is needed to find all not found relations at the end\n allRelations.splice(allRelations.indexOf(prefix ? prefix + \".\" + relation : relation), 1);\n\n // try to find sub-relations\n const join = qb.expressionMap.joinAttributes.find(join => join.entityOrProperty === selection);\n this.applyRelationsRecursively(qb, allRelations, join!.alias.name, join!.metadata!, prefix ? prefix + \".\" + relation : relation);\n\n // join the eager relations of the found relation\n const relMetadata = metadata.relations.find(metadata => metadata.propertyName === relation);\n if (relMetadata) {\n this.joinEagerRelations(qb, relationAlias, relMetadata.inverseEntityMetadata);\n }\n });\n }\n\n public static joinEagerRelations(qb: SelectQueryBuilder<any>, alias: string, metadata: EntityMetadata) {\n metadata.eagerRelations.forEach(relation => {\n\n // generate a relation alias\n let relationAlias = DriverUtils.buildAlias(qb.connection.driver, { shorten: true }, qb.connection.namingStrategy.eagerJoinRelationAlias(alias, relation.propertyPath));\n\n // add a join for the relation\n // Checking whether the relation wasn't joined yet.\n let addJoin = true;\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 !== `${alias}.${relation.propertyPath}`\n ) {\n continue;\n }\n addJoin = false;\n relationAlias = join.alias.name;\n break;\n }\n\n if (addJoin) {\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 (select.aliasName !== undefined || select.virtual !== undefined || select.selection !== relationAlias) {\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(qb, relationAlias, relation.inverseEntityMetadata);\n });\n }\n\n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../browser/src/find-options/FindOptionsUtils.ts"],"names":[],"mappings":";AAGA,OAAO,EAAC,0BAA0B,EAAC,MAAM,qCAAqC,CAAC;AAE/E,OAAO,EAAC,WAAW,EAAC,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC;;GAEG;AACH;IAAA;IAyUA,CAAC;IAvUG,4EAA4E;IAC5E,wBAAwB;IACxB,4EAA4E;IAE5E;;OAEG;IACI,iCAAgB,GAAvB,UAAsC,GAAQ;QAC1C,IAAM,eAAe,GAA2B,GAAG,CAAC;QACpD,OAAO,eAAe;YAClB,CACI,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC;gBACrC,eAAe,CAAC,KAAK,YAAY,MAAM;gBACvC,OAAO,eAAe,CAAC,KAAK,KAAK,QAAQ;gBACzC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC;gBACxC,eAAe,CAAC,IAAI,Y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MAAM,CAAC,OAAO,KAAK,SAAS,IAAI,MAAM,CAAC,SAAS,KAAK,aAAa,EAAE;wBACtG,SAAS;qBACZ;oBACD,SAAS,GAAG,KAAK,CAAC;oBAClB,MAAM;iBACT;;;;;;;;;YAED,IAAI,SAAS,EAAE;gBACX,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;aAC/B;YAED,uCAAuC;YACvC,KAAI,CAAC,kBAAkB,CAAC,EAAE,EAAE,aAAa,EAAE,QAAQ,CAAC,qBAAqB,CAAC,CAAC;QAC/E,CAAC,CAAC,CAAC;IACP,CAAC;IAEL,uBAAC;AAAD,CAzUA,AAyUC,IAAA","file":"FindOptionsUtils.js","sourcesContent":["import {FindManyOptions} from \"./FindManyOptions\";\nimport {FindOneOptions} from \"./FindOneOptions\";\nimport {SelectQueryBuilder} from \"../query-builder/SelectQueryBuilder\";\nimport {FindRelationsNotFoundError} from \"../error/FindRelationsNotFoundError\";\nimport {EntityMetadata} from \"../metadata/EntityMetadata\";\nimport {DriverUtils} from \"../driver/DriverUtils\";\nimport { TypeORMError } from \"../error\";\nimport { FindTreeOptions } from \"./FindTreeOptions\";\n\n/**\n * Utilities to work with FindOptions.\n */\nexport class FindOptionsUtils {\n\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>(obj: any): obj is FindOneOptions<Entity> {\n const possibleOptions: FindOneOptions<Entity> = obj;\n return possibleOptions &&\n (\n Array.isArray(possibleOptions.select) ||\n possibleOptions.where instanceof Object ||\n typeof possibleOptions.where === \"string\" ||\n Array.isArray(possibleOptions.relations) ||\n possibleOptions.join instanceof Object ||\n possibleOptions.order instanceof Object ||\n possibleOptions.cache instanceof Object ||\n typeof possibleOptions.cache === \"boolean\" ||\n typeof possibleOptions.cache === \"number\" ||\n typeof possibleOptions.comment === \"string\" ||\n possibleOptions.lock instanceof Object ||\n possibleOptions.loadRelationIds instanceof Object ||\n typeof possibleOptions.loadRelationIds === \"boolean\" ||\n typeof possibleOptions.loadEagerRelations === \"boolean\" ||\n typeof possibleOptions.withDeleted === \"boolean\" ||\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>(obj: any): obj is FindManyOptions<Entity> {\n const possibleOptions: FindManyOptions<Entity> = obj;\n return possibleOptions && (\n this.isFindOneOptions(possibleOptions) ||\n typeof (possibleOptions as FindManyOptions<any>).skip === \"number\" ||\n typeof (possibleOptions as FindManyOptions<any>).take === \"number\" ||\n typeof (possibleOptions as FindManyOptions<any>).skip === \"string\" ||\n typeof (possibleOptions as FindManyOptions<any>).take === \"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 ) {\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>(qb: SelectQueryBuilder<T>, options?: FindTreeOptions): SelectQueryBuilder<T> {\n if (options?.relations) {\n // Copy because `applyRelationsRecursively` modifies it\n const allRelations = [...options.relations];\n\n FindOptionsUtils.applyRelationsRecursively(qb, allRelations, qb.expressionMap.mainAlias!.name, qb.expressionMap.mainAlias!.metadata, \"\");\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(qb: SelectQueryBuilder<any>, allRelations: string[], alias: string, metadata: EntityMetadata, prefix: string): void {\n\n // find all relations that match given prefix\n let matchedBaseRelations: string[] = [];\n if (prefix) {\n const regexp = new RegExp(\"^\" + prefix.replace(\".\", \"\\\\.\") + \"\\\\.\");\n matchedBaseRelations = allRelations\n .filter(relation => relation.match(regexp))\n .map(relation => relation.replace(regexp, \"\"))\n .filter(relation => metadata.findRelationWithPropertyPath(relation));\n } else {\n matchedBaseRelations = allRelations.filter(relation => metadata.findRelationWithPropertyPath(relation));\n }\n\n // go through all matched relations and add join for them\n matchedBaseRelations.forEach(relation => {\n\n // generate a relation alias\n let relationAlias: string = DriverUtils.buildAlias(qb.connection.driver, { shorten: true, joiner: \"__\" }, alias, relation);\n\n // add a join for the found relation\n const selection = alias + \".\" + relation;\n qb.leftJoinAndSelect(selection, relationAlias);\n\n // remove added relations from the allRelations array, this is needed to find all not found relations at the end\n allRelations.splice(allRelations.indexOf(prefix ? prefix + \".\" + relation : relation), 1);\n\n // try to find sub-relations\n const join = qb.expressionMap.joinAttributes.find(join => join.entityOrProperty === selection);\n this.applyRelationsRecursively(qb, allRelations, join!.alias.name, join!.metadata!, prefix ? prefix + \".\" + relation : relation);\n\n // join the eager relations of the found relation\n const relMetadata = metadata.relations.find(metadata => metadata.propertyName === relation);\n if (relMetadata) {\n this.joinEagerRelations(qb, relationAlias, relMetadata.inverseEntityMetadata);\n }\n });\n }\n\n public static joinEagerRelations(qb: SelectQueryBuilder<any>, alias: string, metadata: EntityMetadata) {\n metadata.eagerRelations.forEach(relation => {\n\n // generate a relation alias\n let relationAlias = DriverUtils.buildAlias(qb.connection.driver, { shorten: true }, qb.connection.namingStrategy.eagerJoinRelationAlias(alias, relation.propertyPath));\n\n // add a join for the relation\n // Checking whether the relation wasn't joined yet.\n let addJoin = true;\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 !== `${alias}.${relation.propertyPath}`\n ) {\n continue;\n }\n addJoin = false;\n relationAlias = join.alias.name;\n break;\n }\n\n if (addJoin) {\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 (select.aliasName !== undefined || select.virtual !== undefined || select.selection !== relationAlias) {\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(qb, relationAlias, relation.inverseEntityMetadata);\n });\n }\n\n}\n"],"sourceRoot":".."}
@@ -1,6 +1,6 @@
1
1
  import { FindOperator } from "../FindOperator";
2
2
  /**
3
3
  * Find Options Operator.
4
- * Example: { someField: Like("%some sting%") }
4
+ * Example: { someField: Like("%some string%") }
5
5
  */
6
6
  export declare function Like<T>(value: T | FindOperator<T>): FindOperator<T>;
@@ -1,7 +1,7 @@
1
1
  import { FindOperator } from "../FindOperator";
2
2
  /**
3
3
  * Find Options Operator.
4
- * Example: { someField: Like("%some sting%") }
4
+ * Example: { someField: Like("%some string%") }
5
5
  */
6
6
  export function Like(value) {
7
7
  return new FindOperator("like", value);
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/find-options/operator/Like.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAE7C;;;GAGG;AACH,MAAM,UAAU,IAAI,CAAI,KAAwB;IAC5C,OAAO,IAAI,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC","file":"Like.js","sourcesContent":["import {FindOperator} from \"../FindOperator\";\n\n/**\n * Find Options Operator.\n * Example: { someField: Like(\"%some sting%\") }\n */\nexport function Like<T>(value: T|FindOperator<T>) {\n return new FindOperator(\"like\", value);\n}"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/find-options/operator/Like.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAE7C;;;GAGG;AACH,MAAM,UAAU,IAAI,CAAI,KAAwB;IAC5C,OAAO,IAAI,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC","file":"Like.js","sourcesContent":["import {FindOperator} from \"../FindOperator\";\n\n/**\n * Find Options Operator.\n * Example: { someField: Like(\"%some string%\") }\n */\nexport function Like<T>(value: T|FindOperator<T>) {\n return new FindOperator(\"like\", value);\n}\n"],"sourceRoot":"../.."}
@@ -1,7 +1,7 @@
1
1
  import { FindOperator } from "../FindOperator";
2
2
  /**
3
3
  * Find Options Operator.
4
- * Used to negotiate expression.
4
+ * Used to negate expression.
5
5
  * Example: { title: not("hello") } will return entities where title not equal to "hello".
6
6
  */
7
7
  export declare function Not<T>(value: T | FindOperator<T>): FindOperator<T>;
@@ -1,7 +1,7 @@
1
1
  import { FindOperator } from "../FindOperator";
2
2
  /**
3
3
  * Find Options Operator.
4
- * Used to negotiate expression.
4
+ * Used to negate expression.
5
5
  * Example: { title: not("hello") } will return entities where title not equal to "hello".
6
6
  */
7
7
  export function Not(value) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/find-options/operator/Not.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAE7C;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAI,KAAwB;IAC3C,OAAO,IAAI,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC1C,CAAC","file":"Not.js","sourcesContent":["import {FindOperator} from \"../FindOperator\";\n\n/**\n * Find Options Operator.\n * Used to negotiate expression.\n * Example: { title: not(\"hello\") } will return entities where title not equal to \"hello\".\n */\nexport function Not<T>(value: T|FindOperator<T>) {\n return new FindOperator(\"not\", value);\n}"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/find-options/operator/Not.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAE7C;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAI,KAAwB;IAC3C,OAAO,IAAI,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC1C,CAAC","file":"Not.js","sourcesContent":["import {FindOperator} from \"../FindOperator\";\n\n/**\n * Find Options Operator.\n * Used to negate expression.\n * Example: { title: not(\"hello\") } will return entities where title not equal to \"hello\".\n */\nexport function Not<T>(value: T|FindOperator<T>) {\n return new FindOperator(\"not\", value);\n}\n"],"sourceRoot":"../.."}
@@ -1,4 +1,4 @@
1
- import { __awaiter, __generator } from "tslib";
1
+ import { __awaiter, __generator, __values } from "tslib";
2
2
  import { MetadataArgsStorage } from "./metadata-args/MetadataArgsStorage";
3
3
  import { PlatformTools } from "./platform/PlatformTools";
4
4
  import { ConnectionOptionsReader } from "./connection/ConnectionOptionsReader";
@@ -75,18 +75,45 @@ export function createConnection(optionsOrName) {
75
75
  */
76
76
  export function createConnections(options) {
77
77
  return __awaiter(this, void 0, void 0, function () {
78
- var connections;
79
- return __generator(this, function (_a) {
80
- switch (_a.label) {
78
+ var connections, connections_1, connections_1_1, connection, e_1_1;
79
+ var e_1, _a;
80
+ return __generator(this, function (_b) {
81
+ switch (_b.label) {
81
82
  case 0:
82
83
  if (!!options) return [3 /*break*/, 2];
83
84
  return [4 /*yield*/, new ConnectionOptionsReader().all()];
84
85
  case 1:
85
- options = _a.sent();
86
- _a.label = 2;
86
+ options = _b.sent();
87
+ _b.label = 2;
87
88
  case 2:
88
89
  connections = options.map(function (options) { return getConnectionManager().create(options); });
89
- return [2 /*return*/, Promise.all(connections.map(function (connection) { return connection.connect(); }))];
90
+ _b.label = 3;
91
+ case 3:
92
+ _b.trys.push([3, 8, 9, 10]);
93
+ connections_1 = __values(connections), connections_1_1 = connections_1.next();
94
+ _b.label = 4;
95
+ case 4:
96
+ if (!!connections_1_1.done) return [3 /*break*/, 7];
97
+ connection = connections_1_1.value;
98
+ return [4 /*yield*/, connection.connect()];
99
+ case 5:
100
+ _b.sent();
101
+ _b.label = 6;
102
+ case 6:
103
+ connections_1_1 = connections_1.next();
104
+ return [3 /*break*/, 4];
105
+ case 7: return [3 /*break*/, 10];
106
+ case 8:
107
+ e_1_1 = _b.sent();
108
+ e_1 = { error: e_1_1 };
109
+ return [3 /*break*/, 10];
110
+ case 9:
111
+ try {
112
+ if (connections_1_1 && !connections_1_1.done && (_a = connections_1.return)) _a.call(connections_1);
113
+ }
114
+ finally { if (e_1) throw e_1.error; }
115
+ return [7 /*endfinally*/];
116
+ case 10: return [2 /*return*/, connections];
90
117
  }
91
118
  });
92
119
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/globals.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAY/C;;GAEG;AACH,MAAM,UAAU,sBAAsB;IAClC,8FAA8F;IAC9F,qGAAqG;IACrG,mGAAmG;IACnG,8EAA8E;IAC9E,6FAA6F;IAC7F,8FAA8F;IAC9F,iFAAiF;IACjF,4FAA4F;IAC5F,IAAM,WAAW,GAAG,aAAa,CAAC,iBAAiB,EAAE,CAAC;IACtD,IAAI,CAAC,WAAW,CAAC,0BAA0B;QACvC,WAAW,CAAC,0BAA0B,GAAG,IAAI,mBAAmB,EA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C,gBAAgB,CAAC,CAAC;AAC5F,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAS,WAAiC,EAAE,cAAkC;IAAlC,+BAAA,EAAA,0BAAkC;IAC5G,OAAO,oBAAoB,EAAE,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,kBAAkB,CAAS,WAAW,CAAC,CAAC;AAC9F,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAS,WAAkC,EAAE,KAAc,EAAE,cAAkC;IAAlC,+BAAA,EAAA,0BAAkC;IAC7H,IAAI,WAAW,EAAE;QACb,OAAO,aAAa,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;KAC/E;IAED,OAAO,aAAa,CAAC,cAAc,CAAC,CAAC,kBAAkB,EAAE,CAAC;AAC9D,CAAC","file":"globals.js","sourcesContent":["import { MetadataArgsStorage } from \"./metadata-args/MetadataArgsStorage\";\nimport { PlatformTools } from \"./platform/PlatformTools\";\nimport { ConnectionOptions } from \"./connection/ConnectionOptions\";\nimport { ConnectionOptionsReader } from \"./connection/ConnectionOptionsReader\";\nimport { ConnectionManager } from \"./connection/ConnectionManager\";\nimport { getFromContainer } from \"./container\";\nimport { Connection } from \"./connection/Connection\";\nimport { EntityManager } from \"./entity-manager/EntityManager\";\nimport { MongoEntityManager } from \"./entity-manager/MongoEntityManager\";\nimport { SqljsEntityManager } from \"./entity-manager/SqljsEntityManager\";\nimport { EntityTarget } from \"./common/EntityTarget\";\nimport { Repository } from \"./repository/Repository\";\nimport { TreeRepository } from \"./repository/TreeRepository\";\nimport { ObjectType } from \"./common/ObjectType\";\nimport { MongoRepository } from \"./repository/MongoRepository\";\nimport { SelectQueryBuilder } from \"./query-builder/SelectQueryBuilder\";\n\n/**\n * Gets metadata args storage.\n */\nexport function getMetadataArgsStorage(): MetadataArgsStorage {\n // we should store metadata storage in a global variable otherwise it brings too much problems\n // one of the problem is that if any entity (or any other) will be imported before consumer will call\n // useContainer method with his own container implementation, that entity will be registered in the\n // old old container (default one post probably) and consumer will his entity.\n // calling useContainer before he imports any entity (or any other) is not always convenient.\n // another reason is that when we run migrations typeorm is being called from a global package\n // and it may load entities which register decorators in typeorm of local package\n // this leads to impossibility of usage of entities in migrations and cli related operations\n const globalScope = PlatformTools.getGlobalVariable();\n if (!globalScope.typeormMetadataArgsStorage)\n globalScope.typeormMetadataArgsStorage = new MetadataArgsStorage();\n\n return globalScope.typeormMetadataArgsStorage;\n}\n\n/**\n * Reads connection options stored in ormconfig configuration file.\n */\nexport async function getConnectionOptions(connectionName: string = \"default\"): Promise<ConnectionOptions> {\n return new ConnectionOptionsReader().get(connectionName);\n}\n\n/**\n * Gets a ConnectionManager which creates connections.\n */\nexport function getConnectionManager(): ConnectionManager {\n return getFromContainer(ConnectionManager);\n}\n\n/**\n * Creates a new connection and registers it in the manager.\n * Only one connection from ormconfig will be created (name \"default\" or connection without name).\n */\nexport async function createConnection(): Promise<Connection>;\n\n/**\n * Creates a new connection from the ormconfig file with a given name.\n */\nexport async function createConnection(name: string): Promise<Connection>;\n\n/**\n * Creates a new connection and registers it in the manager.\n */\nexport async function createConnection(options: ConnectionOptions): Promise<Connection>;\n\n/**\n * Creates a new connection and registers it in the manager.\n *\n * If connection options were not specified, then it will try to create connection automatically,\n * based on content of ormconfig (json/js/yml/xml/env) file or environment variables.\n * Only one connection from ormconfig will be created (name \"default\" or connection without name).\n */\nexport async function createConnection(optionsOrName?: any): Promise<Connection> {\n const connectionName = typeof optionsOrName === \"string\" ? optionsOrName : \"default\";\n const options = optionsOrName instanceof Object ? optionsOrName : await getConnectionOptions(connectionName);\n return getConnectionManager().create(options).connect();\n}\n\n/**\n * Creates new connections and registers them in the manager.\n *\n * If connection options were not specified, then it will try to create connection automatically,\n * based on content of ormconfig (json/js/yml/xml/env) file or environment variables.\n * All connections from the ormconfig will be created.\n */\nexport async function createConnections(options?: ConnectionOptions[]): Promise<Connection[]> {\n if (!options)\n options = await new ConnectionOptionsReader().all();\n const connections = options.map(options => getConnectionManager().create(options));\n return Promise.all(connections.map(connection => connection.connect()));\n}\n\n/**\n * Gets connection from the connection manager.\n * If connection name wasn't specified, then \"default\" connection will be retrieved.\n */\nexport function getConnection(connectionName: string = \"default\"): Connection {\n return getConnectionManager().get(connectionName);\n}\n\n/**\n * Gets entity manager from the connection.\n * If connection name wasn't specified, then \"default\" connection will be retrieved.\n */\nexport function getManager(connectionName: string = \"default\"): EntityManager {\n return getConnectionManager().get(connectionName).manager;\n}\n\n/**\n * Gets MongoDB entity manager from the connection.\n * If connection name wasn't specified, then \"default\" connection will be retrieved.\n */\nexport function getMongoManager(connectionName: string = \"default\"): MongoEntityManager {\n return getConnectionManager().get(connectionName).manager as MongoEntityManager;\n}\n\n/**\n * Gets Sqljs entity manager from connection name.\n * \"default\" connection is used, when no name is specified.\n * Only works when Sqljs driver is used.\n */\nexport function getSqljsManager(connectionName: string = \"default\"): SqljsEntityManager {\n return getConnectionManager().get(connectionName).manager as SqljsEntityManager;\n}\n\n/**\n * Gets repository for the given entity class.\n */\nexport function getRepository<Entity>(entityClass: EntityTarget<Entity>, connectionName: string = \"default\"): Repository<Entity> {\n return getConnectionManager().get(connectionName).getRepository<Entity>(entityClass);\n}\n\n/**\n * Gets tree repository for the given entity class.\n */\nexport function getTreeRepository<Entity>(entityClass: EntityTarget<Entity>, connectionName: string = \"default\"): TreeRepository<Entity> {\n return getConnectionManager().get(connectionName).getTreeRepository<Entity>(entityClass);\n}\n\n/**\n * Gets tree repository for the given entity class.\n */\nexport function getCustomRepository<T>(customRepository: ObjectType<T>, connectionName: string = \"default\"): T {\n return getConnectionManager().get(connectionName).getCustomRepository(customRepository);\n}\n\n/**\n * Gets mongodb repository for the given entity class or name.\n */\nexport function getMongoRepository<Entity>(entityClass: EntityTarget<Entity>, connectionName: string = \"default\"): MongoRepository<Entity> {\n return getConnectionManager().get(connectionName).getMongoRepository<Entity>(entityClass);\n}\n\n/**\n * Creates a new query builder.\n */\nexport function createQueryBuilder<Entity>(entityClass?: EntityTarget<Entity>, alias?: string, connectionName: string = \"default\"): SelectQueryBuilder<Entity> {\n if (entityClass) {\n return getRepository(entityClass, connectionName).createQueryBuilder(alias);\n }\n\n return getConnection(connectionName).createQueryBuilder();\n}\n"],"sourceRoot":"."}
1
+ {"version":3,"sources":["../browser/src/globals.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAY/C;;GAEG;AACH,MAAM,UAAU,sBAAsB;IAClC,8FAA8F;IAC9F,qGAAqG;IACrG,mGAAmG;IACnG,8EAA8E;IAC9E,6FAA6F;IAC7F,8FAA8F;IAC9F,iFAAiF;IACjF,4FAA4F;IAC5F,IAAM,WAAW,GAAG,aAAa,CAAC,iBAAiB,EAAE,CAAC;IACtD,IAAI,CAAC,WAAW,CAAC,0BAA0B;QACvC,WAAW,CAAC,0BAA0B,GAAG,IAAI,mBAAmB,EAAE,CAAC;IAEvE,OAAO,WAAW,CAAC,0BAA0B,CAAC;AAClD,CAAC;AAED;;GAEG;AACH,MAAM,UAAgB,oBAAoB,CAAC,cAAkC;IAAlC,+BAAA,EAAA,0BAAkC;;;YACzE,sBAAO,IAAI,uBAAuB,EAAE,CAAC,GAAG,CAAC,cAAc,CAAC,EAAC;;;CAC5D;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB;IAChC,OAAO,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;AAC/C,CAAC;AAkBD;;;;;;GAMG;AACH,MAAM,UAAgB,gBAAgB,CAAC,aAAmB;;;;;;oBAChD,cAAc,GAAG,OAAO,aAAa,KAAK,Q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AAE,cAAc,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;KAC/E;IAED,OAAO,aAAa,CAAC,cAAc,CAAC,CAAC,kBAAkB,EAAE,CAAC;AAC9D,CAAC","file":"globals.js","sourcesContent":["import { MetadataArgsStorage } from \"./metadata-args/MetadataArgsStorage\";\nimport { PlatformTools } from \"./platform/PlatformTools\";\nimport { ConnectionOptions } from \"./connection/ConnectionOptions\";\nimport { ConnectionOptionsReader } from \"./connection/ConnectionOptionsReader\";\nimport { ConnectionManager } from \"./connection/ConnectionManager\";\nimport { getFromContainer } from \"./container\";\nimport { Connection } from \"./connection/Connection\";\nimport { EntityManager } from \"./entity-manager/EntityManager\";\nimport { MongoEntityManager } from \"./entity-manager/MongoEntityManager\";\nimport { SqljsEntityManager } from \"./entity-manager/SqljsEntityManager\";\nimport { EntityTarget } from \"./common/EntityTarget\";\nimport { Repository } from \"./repository/Repository\";\nimport { TreeRepository } from \"./repository/TreeRepository\";\nimport { ObjectType } from \"./common/ObjectType\";\nimport { MongoRepository } from \"./repository/MongoRepository\";\nimport { SelectQueryBuilder } from \"./query-builder/SelectQueryBuilder\";\n\n/**\n * Gets metadata args storage.\n */\nexport function getMetadataArgsStorage(): MetadataArgsStorage {\n // we should store metadata storage in a global variable otherwise it brings too much problems\n // one of the problem is that if any entity (or any other) will be imported before consumer will call\n // useContainer method with his own container implementation, that entity will be registered in the\n // old old container (default one post probably) and consumer will his entity.\n // calling useContainer before he imports any entity (or any other) is not always convenient.\n // another reason is that when we run migrations typeorm is being called from a global package\n // and it may load entities which register decorators in typeorm of local package\n // this leads to impossibility of usage of entities in migrations and cli related operations\n const globalScope = PlatformTools.getGlobalVariable();\n if (!globalScope.typeormMetadataArgsStorage)\n globalScope.typeormMetadataArgsStorage = new MetadataArgsStorage();\n\n return globalScope.typeormMetadataArgsStorage;\n}\n\n/**\n * Reads connection options stored in ormconfig configuration file.\n */\nexport async function getConnectionOptions(connectionName: string = \"default\"): Promise<ConnectionOptions> {\n return new ConnectionOptionsReader().get(connectionName);\n}\n\n/**\n * Gets a ConnectionManager which creates connections.\n */\nexport function getConnectionManager(): ConnectionManager {\n return getFromContainer(ConnectionManager);\n}\n\n/**\n * Creates a new connection and registers it in the manager.\n * Only one connection from ormconfig will be created (name \"default\" or connection without name).\n */\nexport async function createConnection(): Promise<Connection>;\n\n/**\n * Creates a new connection from the ormconfig file with a given name.\n */\nexport async function createConnection(name: string): Promise<Connection>;\n\n/**\n * Creates a new connection and registers it in the manager.\n */\nexport async function createConnection(options: ConnectionOptions): Promise<Connection>;\n\n/**\n * Creates a new connection and registers it in the manager.\n *\n * If connection options were not specified, then it will try to create connection automatically,\n * based on content of ormconfig (json/js/yml/xml/env) file or environment variables.\n * Only one connection from ormconfig will be created (name \"default\" or connection without name).\n */\nexport async function createConnection(optionsOrName?: any): Promise<Connection> {\n const connectionName = typeof optionsOrName === \"string\" ? optionsOrName : \"default\";\n const options = optionsOrName instanceof Object ? optionsOrName : await getConnectionOptions(connectionName);\n return getConnectionManager().create(options).connect();\n}\n\n/**\n * Creates new connections and registers them in the manager.\n *\n * If connection options were not specified, then it will try to create connection automatically,\n * based on content of ormconfig (json/js/yml/xml/env) file or environment variables.\n * All connections from the ormconfig will be created.\n */\nexport async function createConnections(options?: ConnectionOptions[]): Promise<Connection[]> {\n if (!options)\n options = await new ConnectionOptionsReader().all();\n const connections = options.map(options => getConnectionManager().create(options));\n // Do not use Promise.all or test 8522 will produce a dangling sqlite connection\n for (const connection of connections) {\n await connection.connect()\n }\n return connections;\n}\n\n/**\n * Gets connection from the connection manager.\n * If connection name wasn't specified, then \"default\" connection will be retrieved.\n */\nexport function getConnection(connectionName: string = \"default\"): Connection {\n return getConnectionManager().get(connectionName);\n}\n\n/**\n * Gets entity manager from the connection.\n * If connection name wasn't specified, then \"default\" connection will be retrieved.\n */\nexport function getManager(connectionName: string = \"default\"): EntityManager {\n return getConnectionManager().get(connectionName).manager;\n}\n\n/**\n * Gets MongoDB entity manager from the connection.\n * If connection name wasn't specified, then \"default\" connection will be retrieved.\n */\nexport function getMongoManager(connectionName: string = \"default\"): MongoEntityManager {\n return getConnectionManager().get(connectionName).manager as MongoEntityManager;\n}\n\n/**\n * Gets Sqljs entity manager from connection name.\n * \"default\" connection is used, when no name is specified.\n * Only works when Sqljs driver is used.\n */\nexport function getSqljsManager(connectionName: string = \"default\"): SqljsEntityManager {\n return getConnectionManager().get(connectionName).manager as SqljsEntityManager;\n}\n\n/**\n * Gets repository for the given entity class.\n */\nexport function getRepository<Entity>(entityClass: EntityTarget<Entity>, connectionName: string = \"default\"): Repository<Entity> {\n return getConnectionManager().get(connectionName).getRepository<Entity>(entityClass);\n}\n\n/**\n * Gets tree repository for the given entity class.\n */\nexport function getTreeRepository<Entity>(entityClass: EntityTarget<Entity>, connectionName: string = \"default\"): TreeRepository<Entity> {\n return getConnectionManager().get(connectionName).getTreeRepository<Entity>(entityClass);\n}\n\n/**\n * Gets tree repository for the given entity class.\n */\nexport function getCustomRepository<T>(customRepository: ObjectType<T>, connectionName: string = \"default\"): T {\n return getConnectionManager().get(connectionName).getCustomRepository(customRepository);\n}\n\n/**\n * Gets mongodb repository for the given entity class or name.\n */\nexport function getMongoRepository<Entity>(entityClass: EntityTarget<Entity>, connectionName: string = \"default\"): MongoRepository<Entity> {\n return getConnectionManager().get(connectionName).getMongoRepository<Entity>(entityClass);\n}\n\n/**\n * Creates a new query builder.\n */\nexport function createQueryBuilder<Entity>(entityClass?: EntityTarget<Entity>, alias?: string, connectionName: string = \"default\"): SelectQueryBuilder<Entity> {\n if (entityClass) {\n return getRepository(entityClass, connectionName).createQueryBuilder(alias);\n }\n\n return getConnection(connectionName).createQueryBuilder();\n}\n"],"sourceRoot":"."}
@@ -7,6 +7,7 @@ export * from "./common/EntityTarget";
7
7
  export * from "./common/ObjectType";
8
8
  export * from "./common/ObjectLiteral";
9
9
  export * from "./common/DeepPartial";
10
+ export * from "./common/RelationType";
10
11
  export * from "./error";
11
12
  export * from "./decorator/columns/Column";
12
13
  export * from "./decorator/columns/CreateDateColumn";
package/browser/index.js CHANGED
@@ -10,6 +10,7 @@ export * from "./common/EntityTarget";
10
10
  export * from "./common/ObjectType";
11
11
  export * from "./common/ObjectLiteral";
12
12
  export * from "./common/DeepPartial";
13
+ export * from "./common/RelationType";
13
14
  export * from "./error";
14
15
  export * from "./decorator/columns/Column";
15
16
  export * from "./decorator/columns/CreateDateColumn";
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/index.ts"],"names":[],"mappings":"AAAA;GACG;AACH,OAAO,kBAAkB,CAAC;AAE1B,4EAA4E;AAC5E,wBAAwB;AACxB,4EAA4E;AAE5E,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC;AACrD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC;AACtD,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,c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AAkB,EAAC,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAC,kBAAkB,EAAC,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAC,WAAW,EAAC,MAAM,6BAA6B,CAAC;AAGxD,OAAO,EAAC,YAAY,EAAC,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAC,YAAY,EAAC,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAC,YAAY,EAAC,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EAAC,kBAAkB,EAAC,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAC,iBAAiB,EAAC,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAC,qBAAqB,EAAC,MAAM,yCAAyC,CAAC;AAY9E,OAAO,EAAC,YAAY,EAAC,MAAM,8BAA8B,CAAC","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/DeepPartial\";\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/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/AfterUpdate\";\nexport * from \"./decorator/listeners/BeforeInsert\";\nexport * from \"./decorator/listeners/BeforeRemove\";\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/transaction/Transaction\";\nexport * from \"./decorator/transaction/TransactionManager\";\nexport * from \"./decorator/transaction/TransactionRepository\";\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/Any\";\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/FindConditions\";\nexport * from \"./find-options/FindManyOptions\";\nexport * from \"./find-options/FindOneOptions\";\nexport * from \"./find-options/FindOperator\";\nexport * from \"./find-options/FindOperatorType\";\nexport * from \"./find-options/JoinOptions\";\nexport * from \"./find-options/OrderByCondition\";\nexport * from \"./find-options/FindOptionsUtils\";\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/ReplicationMode\";\nexport * from \"./driver/sqlserver/MssqlParameter\";\n\nexport {ConnectionOptionsReader} from \"./connection/ConnectionOptionsReader\";\nexport {Connection} from \"./connection/Connection\";\nexport {ConnectionManager} from \"./connection/ConnectionManager\";\nexport {ConnectionOptions} from \"./connection/ConnectionOptions\";\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 {FindOneOptions} from \"./find-options/FindOneOptions\";\nexport {FindManyOptions} from \"./find-options/FindManyOptions\";\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 {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 {ColumnType} from \"./driver/types/ColumnTypes\";\n"],"sourceRoot":"."}
1
+ {"version":3,"sources":["../browser/src/index.ts"],"names":[],"mappings":"AAAA;GACG;AACH,OAAO,kBAAkB,CAAC;AAE1B,4EAA4E;AAC5E,wBAAwB;AACxB,4EAA4E;AAE5E,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,SAAS,CAAC;AACxB,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC;AACrD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAm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C,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;AAGjE,OAAO,EAAC,YAAY,EAAC,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAC,kBAAkB,EAAC,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAC,kBAAkB,EAAC,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAC,kBAAkB,EAAC,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAC,kBAAkB,EAAC,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAC,WAAW,EAAC,MAAM,6BAA6B,CAAC;AAGxD,OAAO,EAAC,YAAY,EAAC,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAC,YAAY,EAAC,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAC,YAAY,EAAC,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EAAC,kBAAkB,EAAC,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAC,iBAAiB,EAAC,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAC,qBAAqB,EAAC,MAAM,yCAAyC,CAAC;AAY9E,OAAO,EAAC,YAAY,EAAC,MAAM,8BAA8B,CAAC","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/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/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/AfterUpdate\";\nexport * from \"./decorator/listeners/BeforeInsert\";\nexport * from \"./decorator/listeners/BeforeRemove\";\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/transaction/Transaction\";\nexport * from \"./decorator/transaction/TransactionManager\";\nexport * from \"./decorator/transaction/TransactionRepository\";\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/Any\";\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/FindConditions\";\nexport * from \"./find-options/FindManyOptions\";\nexport * from \"./find-options/FindOneOptions\";\nexport * from \"./find-options/FindOperator\";\nexport * from \"./find-options/FindOperatorType\";\nexport * from \"./find-options/JoinOptions\";\nexport * from \"./find-options/OrderByCondition\";\nexport * from \"./find-options/FindOptionsUtils\";\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/ReplicationMode\";\nexport * from \"./driver/sqlserver/MssqlParameter\";\n\nexport {ConnectionOptionsReader} from \"./connection/ConnectionOptionsReader\";\nexport {Connection} from \"./connection/Connection\";\nexport {ConnectionManager} from \"./connection/ConnectionManager\";\nexport {ConnectionOptions} from \"./connection/ConnectionOptions\";\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 {FindOneOptions} from \"./find-options/FindOneOptions\";\nexport {FindManyOptions} from \"./find-options/FindManyOptions\";\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 {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 {ColumnType} from \"./driver/types/ColumnTypes\";\n"],"sourceRoot":"."}
@@ -263,7 +263,7 @@ var MigrationExecutor = /** @class */ (function () {
263
263
  _c.label = 2;
264
264
  case 2: return [4 /*yield*/, migration.instance.up(queryRunner)
265
265
  .catch(function (error) {
266
- _this.connection.logger.logMigration("Migration \"" + migration.name + "\" has been failed, error: " + (error === null || error === void 0 ? void 0 : error.message));
266
+ _this.connection.logger.logMigration("Migration \"" + migration.name + "\" failed, error: " + (error === null || error === void 0 ? void 0 : error.message));
267
267
  throw error;
268
268
  })
269
269
  .then(function () { return __awaiter(_this, void 0, void 0, function () {
@@ -1 +1 @@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AAC,GAAG,SAAS,CAAC,IAAI,CAAC;yBACvC;6BAEG,CAAA,IAAI,CAAC,UAAU,CAAC,MAAM,YAAY,WAAW,CAAA,EAA7C,wBAA6C;wBACvC,WAAW,GAAG,WAA+B,CAAC;wBACpD,qBAAM,WAAW,CAAC,kBAAkB,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAS,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,EAAA;;wBAApI,SAAoI,CAAC;;;wBAE/H,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC;wBACpD,qBAAM,EAAE,CAAC,MAAM,EAAE;iCACZ,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC;iCAC1B,KAAK,CAAI,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,kBAAe,CAAC;iCAC/C,QAAQ,CAAI,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,aAAU,CAAC;iCACxC,aAAa,CAAC,UAAU,CAAC;iCACzB,OAAO,EAAE,EAAA;;wBALd,SAKc,CAAC;;;;;;KAGtB;IAEe,2CAAe,GAA/B,UAA+C,QAAsD;;;;;;wBAC3F,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC;;;;wBAGxE,sBAAO,QAAQ,CAAC,WAAW,CAAC,EAAC;;6BAEzB,CAAC,IAAI,CAAC,WAAW,EAAjB,wBAAiB;wBACjB,qBAAM,WAAW,CAAC,OAAO,EAAE,EAAA;;wBAA3B,SAA2B,CAAC;;;;;;;KAGvC;IACL,wBAAC;AAAD,CAnfA,AAmfC,IAAA","file":"MigrationExecutor.js","sourcesContent":["import {Table} from \"../schema-builder/table/Table\";\nimport {Connection} from \"../connection/Connection\";\nimport {Migration} from \"./Migration\";\nimport {ObjectLiteral} from \"../common/ObjectLiteral\";\nimport {QueryRunner} from \"../query-runner/QueryRunner\";\nimport {SqlServerDriver} from \"../driver/sqlserver/SqlServerDriver\";\nimport {MssqlParameter} from \"../driver/sqlserver/MssqlParameter\";\nimport {RdbmsSchemaBuilder} from \"../schema-builder/RdbmsSchemaBuilder\";\nimport {MongoDriver} from \"../driver/mongodb/MongoDriver\";\nimport {MongoQueryRunner} from \"../driver/mongodb/MongoQueryRunner\";\nimport {TypeORMError} from \"../error\";\n\n/**\n * Executes migrations: runs pending and reverts previously executed migrations.\n */\nexport class MigrationExecutor {\n\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Indicates how migrations should be run in transactions.\n * all: all migrations are run in a single transaction\n * none: all migrations are run without a transaction\n * each: each migration is run in a separate transaction\n */\n transaction: \"all\" | \"none\" | \"each\" = \"all\";\n\n // -------------------------------------------------------------------------\n // Private Properties\n // -------------------------------------------------------------------------\n\n private readonly migrationsDatabase?: string;\n private readonly migrationsSchema?: string;\n private readonly migrationsTable: string;\n private readonly migrationsTableName: string;\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(protected connection: Connection,\n protected queryRunner?: QueryRunner) {\n\n const { schema } = this.connection.driver.options as any;\n const database = this.connection.driver.database;\n this.migrationsDatabase = database;\n this.migrationsSchema = schema;\n this.migrationsTableName = connection.options.migrationsTableName || \"migrations\";\n this.migrationsTable = this.connection.driver.buildTableName(this.migrationsTableName, schema, database);\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Tries to execute a single migration given.\n */\n public async executeMigration(migration: Migration): Promise<Migration> {\n return this.withQueryRunner(async (queryRunner) => {\n await this.createMigrationsTableIfNotExist(queryRunner);\n await (migration.instance as any).up(queryRunner);\n await this.insertExecutedMigration(queryRunner, migration);\n\n return migration;\n });\n }\n\n /**\n * Returns an array of all migrations.\n */\n public async getAllMigrations(): Promise<Migration[]> {\n return Promise.resolve(this.getMigrations());\n }\n\n /**\n * Returns an array of all executed migrations.\n */\n public async getExecutedMigrations(): Promise<Migration[]> {\n return this.withQueryRunner(async queryRunner => {\n await this.createMigrationsTableIfNotExist(queryRunner);\n\n return await this.loadExecutedMigrations(queryRunner);\n });\n }\n\n /**\n * Returns an array of all pending migrations.\n */\n public async getPendingMigrations(): Promise<Migration[]> {\n const allMigrations = await this.getAllMigrations();\n const executedMigrations = await this.getExecutedMigrations();\n\n return allMigrations.filter(migration =>\n !executedMigrations.find(\n executedMigration =>\n executedMigration.name === migration.name\n )\n );\n }\n\n /**\n * Inserts an executed migration.\n */\n public insertMigration(migration: Migration): Promise<void> {\n return this.withQueryRunner(q => this.insertExecutedMigration(q, migration));\n }\n\n /**\n * Deletes an executed migration.\n */\n public deleteMigration(migration: Migration): Promise<void> {\n return this.withQueryRunner(q => this.deleteExecutedMigration(q, migration));\n }\n\n /**\n * Lists all migrations and whether they have been executed or not\n * returns true if there are unapplied migrations\n */\n async showMigrations(): Promise<boolean> {\n let hasUnappliedMigrations = false;\n const queryRunner = this.queryRunner || this.connection.createQueryRunner();\n // create migrations table if its not created yet\n await this.createMigrationsTableIfNotExist(queryRunner);\n // get all migrations that are executed and saved in the database\n const executedMigrations = await this.loadExecutedMigrations(queryRunner);\n\n // get all user's migrations in the source code\n const allMigrations = this.getMigrations();\n\n for (const migration of allMigrations) {\n const executedMigration = executedMigrations.find(executedMigration => executedMigration.name === migration.name);\n\n if (executedMigration) {\n this.connection.logger.logSchemaBuild(` [X] ${migration.name}`);\n } else {\n hasUnappliedMigrations = true;\n this.connection.logger.logSchemaBuild(` [ ] ${migration.name}`);\n }\n }\n\n // if query runner was created by us then release it\n if (!this.queryRunner) {\n await queryRunner.release();\n }\n\n return hasUnappliedMigrations;\n }\n\n /**\n * Executes all pending migrations. Pending migrations are migrations that are not yet executed,\n * thus not saved in the database.\n */\n async executePendingMigrations(): Promise<Migration[]> {\n\n const queryRunner = this.queryRunner || this.connection.createQueryRunner();\n // create migrations table if its not created yet\n await this.createMigrationsTableIfNotExist(queryRunner);\n\n // create the typeorm_metadata table if necessary\n const schemaBuilder = this.connection.driver.createSchemaBuilder();\n\n if (schemaBuilder instanceof RdbmsSchemaBuilder) {\n await schemaBuilder.createMetadataTableIfNecessary(queryRunner);\n }\n\n // get all migrations that are executed and saved in the database\n const executedMigrations = await this.loadExecutedMigrations(queryRunner);\n\n // get the time when last migration was executed\n let lastTimeExecutedMigration = this.getLatestTimestampMigration(executedMigrations);\n\n // get all user's migrations in the source code\n const allMigrations = this.getMigrations();\n\n // variable to store all migrations we did successefuly\n const successMigrations: Migration[] = [];\n\n // find all migrations that needs to be executed\n const pendingMigrations = allMigrations.filter(migration => {\n // check if we already have executed migration\n const executedMigration = executedMigrations.find(executedMigration => executedMigration.name === migration.name);\n if (executedMigration)\n return false;\n\n // migration is new and not executed. now check if its timestamp is correct\n // if (lastTimeExecutedMigration && migration.timestamp < lastTimeExecutedMigration.timestamp)\n // throw new TypeORMError(`New migration found: ${migration.name}, however this migration's timestamp is not valid. Migration's timestamp should not be older then migrations already executed in the database.`);\n\n // every check is passed means that migration was not run yet and we need to run it\n return true;\n });\n\n // if no migrations are pending then nothing to do here\n if (!pendingMigrations.length) {\n this.connection.logger.logSchemaBuild(`No migrations are pending`);\n // if query runner was created by us then release it\n if (!this.queryRunner)\n await queryRunner.release();\n return [];\n }\n\n // log information about migration execution\n this.connection.logger.logSchemaBuild(`${executedMigrations.length} migrations are already loaded in the database.`);\n this.connection.logger.logSchemaBuild(`${allMigrations.length} migrations were found in the source code.`);\n if (lastTimeExecutedMigration)\n this.connection.logger.logSchemaBuild(`${lastTimeExecutedMigration.name} is the last executed migration. It was executed on ${new Date(lastTimeExecutedMigration.timestamp).toString()}.`);\n this.connection.logger.logSchemaBuild(`${pendingMigrations.length} migrations are new migrations that needs to be executed.`);\n\n // start transaction if its not started yet\n let transactionStartedByUs = false;\n if (this.transaction === \"all\" && !queryRunner.isTransactionActive) {\n await queryRunner.startTransaction();\n transactionStartedByUs = true;\n }\n\n // run all pending migrations in a sequence\n try {\n for (const migration of pendingMigrations) {\n if (this.transaction === \"each\" && !queryRunner.isTransactionActive) {\n await queryRunner.startTransaction();\n transactionStartedByUs = true;\n }\n\n await migration.instance!.up(queryRunner)\n .catch(error => { // informative log about migration failure\n this.connection.logger.logMigration(`Migration \"${migration.name}\" has been failed, error: ${error?.message}`);\n throw error;\n })\n .then(async () => { // now when migration is executed we need to insert record about it into the database\n await this.insertExecutedMigration(queryRunner, migration);\n // commit transaction if we started it\n if (this.transaction === \"each\" && transactionStartedByUs)\n await queryRunner.commitTransaction();\n })\n .then(() => { // informative log about migration success\n successMigrations.push(migration);\n this.connection.logger.logSchemaBuild(`Migration ${migration.name} has been executed successfully.`);\n });\n }\n\n // commit transaction if we started it\n if (this.transaction === \"all\" && transactionStartedByUs)\n await queryRunner.commitTransaction();\n\n } catch (err) { // rollback transaction if we started it\n if (transactionStartedByUs) {\n try { // we throw original error even if rollback thrown an error\n await queryRunner.rollbackTransaction();\n } catch (rollbackError) { }\n }\n\n throw err;\n\n } finally {\n\n // if query runner was created by us then release it\n if (!this.queryRunner)\n await queryRunner.release();\n }\n return successMigrations;\n\n }\n\n /**\n * Reverts last migration that were run.\n */\n async undoLastMigration(): Promise<void> {\n\n const queryRunner = this.queryRunner || this.connection.createQueryRunner();\n\n // create migrations table if its not created yet\n await this.createMigrationsTableIfNotExist(queryRunner);\n\n // get all migrations that are executed and saved in the database\n const executedMigrations = await this.loadExecutedMigrations(queryRunner);\n\n // get the time when last migration was executed\n let lastTimeExecutedMigration = this.getLatestExecutedMigration(executedMigrations);\n\n // if no migrations found in the database then nothing to revert\n if (!lastTimeExecutedMigration) {\n this.connection.logger.logSchemaBuild(`No migrations was found in the database. Nothing to revert!`);\n return;\n }\n\n // get all user's migrations in the source code\n const allMigrations = this.getMigrations();\n\n // find the instance of the migration we need to remove\n const migrationToRevert = allMigrations.find(migration => migration.name === lastTimeExecutedMigration!.name);\n\n // if no migrations found in the database then nothing to revert\n if (!migrationToRevert)\n throw new TypeORMError(`No migration ${lastTimeExecutedMigration.name} was found in the source code. Make sure you have this migration in your codebase and its included in the connection options.`);\n\n // log information about migration execution\n this.connection.logger.logSchemaBuild(`${executedMigrations.length} migrations are already loaded in the database.`);\n this.connection.logger.logSchemaBuild(`${lastTimeExecutedMigration.name} is the last executed migration. It was executed on ${new Date(lastTimeExecutedMigration.timestamp).toString()}.`);\n this.connection.logger.logSchemaBuild(`Now reverting it...`);\n\n // start transaction if its not started yet\n let transactionStartedByUs = false;\n if ((this.transaction !== \"none\") && !queryRunner.isTransactionActive) {\n await queryRunner.startTransaction();\n transactionStartedByUs = true;\n }\n\n try {\n await migrationToRevert.instance!.down(queryRunner);\n await this.deleteExecutedMigration(queryRunner, migrationToRevert);\n this.connection.logger.logSchemaBuild(`Migration ${migrationToRevert.name} has been reverted successfully.`);\n\n // commit transaction if we started it\n if (transactionStartedByUs)\n await queryRunner.commitTransaction();\n\n } catch (err) { // rollback transaction if we started it\n if (transactionStartedByUs) {\n try { // we throw original error even if rollback thrown an error\n await queryRunner.rollbackTransaction();\n } catch (rollbackError) { }\n }\n\n throw err;\n\n } finally {\n\n // if query runner was created by us then release it\n if (!this.queryRunner)\n await queryRunner.release();\n }\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Creates table \"migrations\" that will store information about executed migrations.\n */\n protected async createMigrationsTableIfNotExist(queryRunner: QueryRunner): Promise<void> {\n // If driver is mongo no need to create\n if (this.connection.driver instanceof MongoDriver) {\n return;\n }\n const tableExist = await queryRunner.hasTable(this.migrationsTable); // todo: table name should be configurable\n if (!tableExist) {\n await queryRunner.createTable(new Table(\n {\n database: this.migrationsDatabase,\n schema: this.migrationsSchema,\n name: this.migrationsTable,\n columns: [\n {\n name: \"id\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.migrationId}),\n isGenerated: true,\n generationStrategy: \"increment\",\n isPrimary: true,\n isNullable: false\n },\n {\n name: \"timestamp\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.migrationTimestamp}),\n isPrimary: false,\n isNullable: false\n },\n {\n name: \"name\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.migrationName}),\n isNullable: false\n },\n ]\n },\n ));\n }\n }\n\n /**\n * Loads all migrations that were executed and saved into the database (sorts by id).\n */\n protected async loadExecutedMigrations(queryRunner: QueryRunner): Promise<Migration[]> {\n if (this.connection.driver instanceof MongoDriver) {\n const mongoRunner = queryRunner as MongoQueryRunner;\n return await mongoRunner.databaseConnection\n .db(this.connection.driver.database!)\n .collection(this.migrationsTableName)\n .find<Migration>()\n .sort({\"_id\": -1})\n .toArray();\n } else {\n const migrationsRaw: ObjectLiteral[] = await this.connection.manager\n .createQueryBuilder(queryRunner)\n .select()\n .orderBy(this.connection.driver.escape(\"id\"), \"DESC\")\n .from(this.migrationsTable, this.migrationsTableName)\n .getRawMany();\n return migrationsRaw.map(migrationRaw => {\n return new Migration(parseInt(migrationRaw[\"id\"]), parseInt(migrationRaw[\"timestamp\"]), migrationRaw[\"name\"]);\n });\n }\n }\n\n /**\n * Gets all migrations that setup for this connection.\n */\n protected getMigrations(): Migration[] {\n const migrations = this.connection.migrations.map(migration => {\n const migrationClassName = migration.name || (migration.constructor as any).name;\n const migrationTimestamp = parseInt(migrationClassName.substr(-13), 10);\n if (!migrationTimestamp || isNaN(migrationTimestamp)) {\n throw new TypeORMError(`${migrationClassName} migration name is wrong. Migration class name should have a JavaScript timestamp appended.`);\n }\n\n return new Migration(undefined, migrationTimestamp, migrationClassName, migration);\n });\n\n this.checkForDuplicateMigrations(migrations);\n\n // sort them by timestamp\n return migrations.sort((a, b) => a.timestamp - b.timestamp);\n }\n\n protected checkForDuplicateMigrations(migrations: Migration[]) {\n const migrationNames = migrations.map(migration => migration.name);\n const duplicates = Array.from(new Set(migrationNames.filter((migrationName, index) => migrationNames.indexOf(migrationName) < index)));\n if (duplicates.length > 0) {\n throw Error(`Duplicate migrations: ${duplicates.join(\", \")}`);\n }\n }\n\n /**\n * Finds the latest migration (sorts by timestamp) in the given array of migrations.\n */\n protected getLatestTimestampMigration(migrations: Migration[]): Migration|undefined {\n const sortedMigrations = migrations.map(migration => migration).sort((a, b) => (a.timestamp - b.timestamp) * -1);\n return sortedMigrations.length > 0 ? sortedMigrations[0] : undefined;\n }\n\n /**\n * Finds the latest migration in the given array of migrations.\n * PRE: Migration array must be sorted by descending id.\n */\n protected getLatestExecutedMigration(sortedMigrations: Migration[]): Migration|undefined {\n return sortedMigrations.length > 0 ? sortedMigrations[0] : undefined;\n }\n\n /**\n * Inserts new executed migration's data into migrations table.\n */\n protected async insertExecutedMigration(queryRunner: QueryRunner, migration: Migration): Promise<void> {\n const values: ObjectLiteral = {};\n if (this.connection.driver instanceof SqlServerDriver) {\n values[\"timestamp\"] = new MssqlParameter(migration.timestamp, this.connection.driver.normalizeType({ type: this.connection.driver.mappedDataTypes.migrationTimestamp }) as any);\n values[\"name\"] = new MssqlParameter(migration.name, this.connection.driver.normalizeType({ type: this.connection.driver.mappedDataTypes.migrationName }) as any);\n } else {\n values[\"timestamp\"] = migration.timestamp;\n values[\"name\"] = migration.name;\n }\n if (this.connection.driver instanceof MongoDriver) {\n const mongoRunner = queryRunner as MongoQueryRunner;\n await mongoRunner.databaseConnection.db(this.connection.driver.database!).collection(this.migrationsTableName).insertOne(values);\n } else {\n const qb = queryRunner.manager.createQueryBuilder();\n await qb.insert()\n .into(this.migrationsTable)\n .values(values)\n .execute();\n }\n }\n\n /**\n * Delete previously executed migration's data from the migrations table.\n */\n protected async deleteExecutedMigration(queryRunner: QueryRunner, migration: Migration): Promise<void> {\n\n const conditions: ObjectLiteral = {};\n if (this.connection.driver instanceof SqlServerDriver) {\n conditions[\"timestamp\"] = new MssqlParameter(migration.timestamp, this.connection.driver.normalizeType({ type: this.connection.driver.mappedDataTypes.migrationTimestamp }) as any);\n conditions[\"name\"] = new MssqlParameter(migration.name, this.connection.driver.normalizeType({ type: this.connection.driver.mappedDataTypes.migrationName }) as any);\n } else {\n conditions[\"timestamp\"] = migration.timestamp;\n conditions[\"name\"] = migration.name;\n }\n\n if (this.connection.driver instanceof MongoDriver) {\n const mongoRunner = queryRunner as MongoQueryRunner;\n await mongoRunner.databaseConnection.db(this.connection.driver.database!).collection(this.migrationsTableName).deleteOne(conditions);\n } else {\n const qb = queryRunner.manager.createQueryBuilder();\n await qb.delete()\n .from(this.migrationsTable)\n .where(`${qb.escape(\"timestamp\")} = :timestamp`)\n .andWhere(`${qb.escape(\"name\")} = :name`)\n .setParameters(conditions)\n .execute();\n }\n\n }\n\n protected async withQueryRunner<T extends any>(callback: (queryRunner: QueryRunner) => T | Promise<T>) {\n const queryRunner = this.queryRunner || this.connection.createQueryRunner();\n\n try {\n return callback(queryRunner);\n } finally {\n if (!this.queryRunner) {\n await queryRunner.release();\n }\n }\n }\n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../browser/src/migration/MigrationExecutor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,+BAA+B,CAAC;AAEpD,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAGtC,OAAO,EAAC,eAAe,EAAC,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAC,cAAc,EAAC,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAC,kBAAkB,EAAC,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAC,WAAW,EAAC,MAAM,+BAA+B,CAAC;AAE1D,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AAEtC;;GAEG;AACH;IAuBI,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,2BAAsB,UAAsB,EACtB,WAAyB;QADzB,eAAU,GAAV,UAAU,CAAY;QACtB,gBAAW,GAAX,WAAW,CAAc;QA1B/C,4EAA4E;QAC5E,oBAAoB;QACpB,4EAA4E;QAE5E;;;;;WAKG;QACH,gBAAW,GAA4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a,CAAC,UAAU,CAAC;iCACzB,OAAO,EAAE,EAAA;;wBALd,SAKc,CAAC;;;;;;KAGtB;IAEe,2CAAe,GAA/B,UAA+C,QAAsD;;;;;;wBAC3F,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC;;;;wBAGxE,sBAAO,QAAQ,CAAC,WAAW,CAAC,EAAC;;6BAEzB,CAAC,IAAI,CAAC,WAAW,EAAjB,wBAAiB;wBACjB,qBAAM,WAAW,CAAC,OAAO,EAAE,EAAA;;wBAA3B,SAA2B,CAAC;;;;;;;KAGvC;IACL,wBAAC;AAAD,CAnfA,AAmfC,IAAA","file":"MigrationExecutor.js","sourcesContent":["import {Table} from \"../schema-builder/table/Table\";\nimport {Connection} from \"../connection/Connection\";\nimport {Migration} from \"./Migration\";\nimport {ObjectLiteral} from \"../common/ObjectLiteral\";\nimport {QueryRunner} from \"../query-runner/QueryRunner\";\nimport {SqlServerDriver} from \"../driver/sqlserver/SqlServerDriver\";\nimport {MssqlParameter} from \"../driver/sqlserver/MssqlParameter\";\nimport {RdbmsSchemaBuilder} from \"../schema-builder/RdbmsSchemaBuilder\";\nimport {MongoDriver} from \"../driver/mongodb/MongoDriver\";\nimport {MongoQueryRunner} from \"../driver/mongodb/MongoQueryRunner\";\nimport {TypeORMError} from \"../error\";\n\n/**\n * Executes migrations: runs pending and reverts previously executed migrations.\n */\nexport class MigrationExecutor {\n\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Indicates how migrations should be run in transactions.\n * all: all migrations are run in a single transaction\n * none: all migrations are run without a transaction\n * each: each migration is run in a separate transaction\n */\n transaction: \"all\" | \"none\" | \"each\" = \"all\";\n\n // -------------------------------------------------------------------------\n // Private Properties\n // -------------------------------------------------------------------------\n\n private readonly migrationsDatabase?: string;\n private readonly migrationsSchema?: string;\n private readonly migrationsTable: string;\n private readonly migrationsTableName: string;\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(protected connection: Connection,\n protected queryRunner?: QueryRunner) {\n\n const { schema } = this.connection.driver.options as any;\n const database = this.connection.driver.database;\n this.migrationsDatabase = database;\n this.migrationsSchema = schema;\n this.migrationsTableName = connection.options.migrationsTableName || \"migrations\";\n this.migrationsTable = this.connection.driver.buildTableName(this.migrationsTableName, schema, database);\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Tries to execute a single migration given.\n */\n public async executeMigration(migration: Migration): Promise<Migration> {\n return this.withQueryRunner(async (queryRunner) => {\n await this.createMigrationsTableIfNotExist(queryRunner);\n await (migration.instance as any).up(queryRunner);\n await this.insertExecutedMigration(queryRunner, migration);\n\n return migration;\n });\n }\n\n /**\n * Returns an array of all migrations.\n */\n public async getAllMigrations(): Promise<Migration[]> {\n return Promise.resolve(this.getMigrations());\n }\n\n /**\n * Returns an array of all executed migrations.\n */\n public async getExecutedMigrations(): Promise<Migration[]> {\n return this.withQueryRunner(async queryRunner => {\n await this.createMigrationsTableIfNotExist(queryRunner);\n\n return await this.loadExecutedMigrations(queryRunner);\n });\n }\n\n /**\n * Returns an array of all pending migrations.\n */\n public async getPendingMigrations(): Promise<Migration[]> {\n const allMigrations = await this.getAllMigrations();\n const executedMigrations = await this.getExecutedMigrations();\n\n return allMigrations.filter(migration =>\n !executedMigrations.find(\n executedMigration =>\n executedMigration.name === migration.name\n )\n );\n }\n\n /**\n * Inserts an executed migration.\n */\n public insertMigration(migration: Migration): Promise<void> {\n return this.withQueryRunner(q => this.insertExecutedMigration(q, migration));\n }\n\n /**\n * Deletes an executed migration.\n */\n public deleteMigration(migration: Migration): Promise<void> {\n return this.withQueryRunner(q => this.deleteExecutedMigration(q, migration));\n }\n\n /**\n * Lists all migrations and whether they have been executed or not\n * returns true if there are unapplied migrations\n */\n async showMigrations(): Promise<boolean> {\n let hasUnappliedMigrations = false;\n const queryRunner = this.queryRunner || this.connection.createQueryRunner();\n // create migrations table if its not created yet\n await this.createMigrationsTableIfNotExist(queryRunner);\n // get all migrations that are executed and saved in the database\n const executedMigrations = await this.loadExecutedMigrations(queryRunner);\n\n // get all user's migrations in the source code\n const allMigrations = this.getMigrations();\n\n for (const migration of allMigrations) {\n const executedMigration = executedMigrations.find(executedMigration => executedMigration.name === migration.name);\n\n if (executedMigration) {\n this.connection.logger.logSchemaBuild(` [X] ${migration.name}`);\n } else {\n hasUnappliedMigrations = true;\n this.connection.logger.logSchemaBuild(` [ ] ${migration.name}`);\n }\n }\n\n // if query runner was created by us then release it\n if (!this.queryRunner) {\n await queryRunner.release();\n }\n\n return hasUnappliedMigrations;\n }\n\n /**\n * Executes all pending migrations. Pending migrations are migrations that are not yet executed,\n * thus not saved in the database.\n */\n async executePendingMigrations(): Promise<Migration[]> {\n\n const queryRunner = this.queryRunner || this.connection.createQueryRunner();\n // create migrations table if its not created yet\n await this.createMigrationsTableIfNotExist(queryRunner);\n\n // create the typeorm_metadata table if necessary\n const schemaBuilder = this.connection.driver.createSchemaBuilder();\n\n if (schemaBuilder instanceof RdbmsSchemaBuilder) {\n await schemaBuilder.createMetadataTableIfNecessary(queryRunner);\n }\n\n // get all migrations that are executed and saved in the database\n const executedMigrations = await this.loadExecutedMigrations(queryRunner);\n\n // get the time when last migration was executed\n let lastTimeExecutedMigration = this.getLatestTimestampMigration(executedMigrations);\n\n // get all user's migrations in the source code\n const allMigrations = this.getMigrations();\n\n // variable to store all migrations we did successefuly\n const successMigrations: Migration[] = [];\n\n // find all migrations that needs to be executed\n const pendingMigrations = allMigrations.filter(migration => {\n // check if we already have executed migration\n const executedMigration = executedMigrations.find(executedMigration => executedMigration.name === migration.name);\n if (executedMigration)\n return false;\n\n // migration is new and not executed. now check if its timestamp is correct\n // if (lastTimeExecutedMigration && migration.timestamp < lastTimeExecutedMigration.timestamp)\n // throw new TypeORMError(`New migration found: ${migration.name}, however this migration's timestamp is not valid. Migration's timestamp should not be older then migrations already executed in the database.`);\n\n // every check is passed means that migration was not run yet and we need to run it\n return true;\n });\n\n // if no migrations are pending then nothing to do here\n if (!pendingMigrations.length) {\n this.connection.logger.logSchemaBuild(`No migrations are pending`);\n // if query runner was created by us then release it\n if (!this.queryRunner)\n await queryRunner.release();\n return [];\n }\n\n // log information about migration execution\n this.connection.logger.logSchemaBuild(`${executedMigrations.length} migrations are already loaded in the database.`);\n this.connection.logger.logSchemaBuild(`${allMigrations.length} migrations were found in the source code.`);\n if (lastTimeExecutedMigration)\n this.connection.logger.logSchemaBuild(`${lastTimeExecutedMigration.name} is the last executed migration. It was executed on ${new Date(lastTimeExecutedMigration.timestamp).toString()}.`);\n this.connection.logger.logSchemaBuild(`${pendingMigrations.length} migrations are new migrations that needs to be executed.`);\n\n // start transaction if its not started yet\n let transactionStartedByUs = false;\n if (this.transaction === \"all\" && !queryRunner.isTransactionActive) {\n await queryRunner.startTransaction();\n transactionStartedByUs = true;\n }\n\n // run all pending migrations in a sequence\n try {\n for (const migration of pendingMigrations) {\n if (this.transaction === \"each\" && !queryRunner.isTransactionActive) {\n await queryRunner.startTransaction();\n transactionStartedByUs = true;\n }\n\n await migration.instance!.up(queryRunner)\n .catch(error => { // informative log about migration failure\n this.connection.logger.logMigration(`Migration \"${migration.name}\" failed, error: ${error?.message}`);\n throw error;\n })\n .then(async () => { // now when migration is executed we need to insert record about it into the database\n await this.insertExecutedMigration(queryRunner, migration);\n // commit transaction if we started it\n if (this.transaction === \"each\" && transactionStartedByUs)\n await queryRunner.commitTransaction();\n })\n .then(() => { // informative log about migration success\n successMigrations.push(migration);\n this.connection.logger.logSchemaBuild(`Migration ${migration.name} has been executed successfully.`);\n });\n }\n\n // commit transaction if we started it\n if (this.transaction === \"all\" && transactionStartedByUs)\n await queryRunner.commitTransaction();\n\n } catch (err) { // rollback transaction if we started it\n if (transactionStartedByUs) {\n try { // we throw original error even if rollback thrown an error\n await queryRunner.rollbackTransaction();\n } catch (rollbackError) { }\n }\n\n throw err;\n\n } finally {\n\n // if query runner was created by us then release it\n if (!this.queryRunner)\n await queryRunner.release();\n }\n return successMigrations;\n\n }\n\n /**\n * Reverts last migration that were run.\n */\n async undoLastMigration(): Promise<void> {\n\n const queryRunner = this.queryRunner || this.connection.createQueryRunner();\n\n // create migrations table if its not created yet\n await this.createMigrationsTableIfNotExist(queryRunner);\n\n // get all migrations that are executed and saved in the database\n const executedMigrations = await this.loadExecutedMigrations(queryRunner);\n\n // get the time when last migration was executed\n let lastTimeExecutedMigration = this.getLatestExecutedMigration(executedMigrations);\n\n // if no migrations found in the database then nothing to revert\n if (!lastTimeExecutedMigration) {\n this.connection.logger.logSchemaBuild(`No migrations was found in the database. Nothing to revert!`);\n return;\n }\n\n // get all user's migrations in the source code\n const allMigrations = this.getMigrations();\n\n // find the instance of the migration we need to remove\n const migrationToRevert = allMigrations.find(migration => migration.name === lastTimeExecutedMigration!.name);\n\n // if no migrations found in the database then nothing to revert\n if (!migrationToRevert)\n throw new TypeORMError(`No migration ${lastTimeExecutedMigration.name} was found in the source code. Make sure you have this migration in your codebase and its included in the connection options.`);\n\n // log information about migration execution\n this.connection.logger.logSchemaBuild(`${executedMigrations.length} migrations are already loaded in the database.`);\n this.connection.logger.logSchemaBuild(`${lastTimeExecutedMigration.name} is the last executed migration. It was executed on ${new Date(lastTimeExecutedMigration.timestamp).toString()}.`);\n this.connection.logger.logSchemaBuild(`Now reverting it...`);\n\n // start transaction if its not started yet\n let transactionStartedByUs = false;\n if ((this.transaction !== \"none\") && !queryRunner.isTransactionActive) {\n await queryRunner.startTransaction();\n transactionStartedByUs = true;\n }\n\n try {\n await migrationToRevert.instance!.down(queryRunner);\n await this.deleteExecutedMigration(queryRunner, migrationToRevert);\n this.connection.logger.logSchemaBuild(`Migration ${migrationToRevert.name} has been reverted successfully.`);\n\n // commit transaction if we started it\n if (transactionStartedByUs)\n await queryRunner.commitTransaction();\n\n } catch (err) { // rollback transaction if we started it\n if (transactionStartedByUs) {\n try { // we throw original error even if rollback thrown an error\n await queryRunner.rollbackTransaction();\n } catch (rollbackError) { }\n }\n\n throw err;\n\n } finally {\n\n // if query runner was created by us then release it\n if (!this.queryRunner)\n await queryRunner.release();\n }\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Creates table \"migrations\" that will store information about executed migrations.\n */\n protected async createMigrationsTableIfNotExist(queryRunner: QueryRunner): Promise<void> {\n // If driver is mongo no need to create\n if (this.connection.driver instanceof MongoDriver) {\n return;\n }\n const tableExist = await queryRunner.hasTable(this.migrationsTable); // todo: table name should be configurable\n if (!tableExist) {\n await queryRunner.createTable(new Table(\n {\n database: this.migrationsDatabase,\n schema: this.migrationsSchema,\n name: this.migrationsTable,\n columns: [\n {\n name: \"id\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.migrationId}),\n isGenerated: true,\n generationStrategy: \"increment\",\n isPrimary: true,\n isNullable: false\n },\n {\n name: \"timestamp\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.migrationTimestamp}),\n isPrimary: false,\n isNullable: false\n },\n {\n name: \"name\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.migrationName}),\n isNullable: false\n },\n ]\n },\n ));\n }\n }\n\n /**\n * Loads all migrations that were executed and saved into the database (sorts by id).\n */\n protected async loadExecutedMigrations(queryRunner: QueryRunner): Promise<Migration[]> {\n if (this.connection.driver instanceof MongoDriver) {\n const mongoRunner = queryRunner as MongoQueryRunner;\n return await mongoRunner.databaseConnection\n .db(this.connection.driver.database!)\n .collection(this.migrationsTableName)\n .find<Migration>()\n .sort({\"_id\": -1})\n .toArray();\n } else {\n const migrationsRaw: ObjectLiteral[] = await this.connection.manager\n .createQueryBuilder(queryRunner)\n .select()\n .orderBy(this.connection.driver.escape(\"id\"), \"DESC\")\n .from(this.migrationsTable, this.migrationsTableName)\n .getRawMany();\n return migrationsRaw.map(migrationRaw => {\n return new Migration(parseInt(migrationRaw[\"id\"]), parseInt(migrationRaw[\"timestamp\"]), migrationRaw[\"name\"]);\n });\n }\n }\n\n /**\n * Gets all migrations that setup for this connection.\n */\n protected getMigrations(): Migration[] {\n const migrations = this.connection.migrations.map(migration => {\n const migrationClassName = migration.name || (migration.constructor as any).name;\n const migrationTimestamp = parseInt(migrationClassName.substr(-13), 10);\n if (!migrationTimestamp || isNaN(migrationTimestamp)) {\n throw new TypeORMError(`${migrationClassName} migration name is wrong. Migration class name should have a JavaScript timestamp appended.`);\n }\n\n return new Migration(undefined, migrationTimestamp, migrationClassName, migration);\n });\n\n this.checkForDuplicateMigrations(migrations);\n\n // sort them by timestamp\n return migrations.sort((a, b) => a.timestamp - b.timestamp);\n }\n\n protected checkForDuplicateMigrations(migrations: Migration[]) {\n const migrationNames = migrations.map(migration => migration.name);\n const duplicates = Array.from(new Set(migrationNames.filter((migrationName, index) => migrationNames.indexOf(migrationName) < index)));\n if (duplicates.length > 0) {\n throw Error(`Duplicate migrations: ${duplicates.join(\", \")}`);\n }\n }\n\n /**\n * Finds the latest migration (sorts by timestamp) in the given array of migrations.\n */\n protected getLatestTimestampMigration(migrations: Migration[]): Migration|undefined {\n const sortedMigrations = migrations.map(migration => migration).sort((a, b) => (a.timestamp - b.timestamp) * -1);\n return sortedMigrations.length > 0 ? sortedMigrations[0] : undefined;\n }\n\n /**\n * Finds the latest migration in the given array of migrations.\n * PRE: Migration array must be sorted by descending id.\n */\n protected getLatestExecutedMigration(sortedMigrations: Migration[]): Migration|undefined {\n return sortedMigrations.length > 0 ? sortedMigrations[0] : undefined;\n }\n\n /**\n * Inserts new executed migration's data into migrations table.\n */\n protected async insertExecutedMigration(queryRunner: QueryRunner, migration: Migration): Promise<void> {\n const values: ObjectLiteral = {};\n if (this.connection.driver instanceof SqlServerDriver) {\n values[\"timestamp\"] = new MssqlParameter(migration.timestamp, this.connection.driver.normalizeType({ type: this.connection.driver.mappedDataTypes.migrationTimestamp }) as any);\n values[\"name\"] = new MssqlParameter(migration.name, this.connection.driver.normalizeType({ type: this.connection.driver.mappedDataTypes.migrationName }) as any);\n } else {\n values[\"timestamp\"] = migration.timestamp;\n values[\"name\"] = migration.name;\n }\n if (this.connection.driver instanceof MongoDriver) {\n const mongoRunner = queryRunner as MongoQueryRunner;\n await mongoRunner.databaseConnection.db(this.connection.driver.database!).collection(this.migrationsTableName).insertOne(values);\n } else {\n const qb = queryRunner.manager.createQueryBuilder();\n await qb.insert()\n .into(this.migrationsTable)\n .values(values)\n .execute();\n }\n }\n\n /**\n * Delete previously executed migration's data from the migrations table.\n */\n protected async deleteExecutedMigration(queryRunner: QueryRunner, migration: Migration): Promise<void> {\n\n const conditions: ObjectLiteral = {};\n if (this.connection.driver instanceof SqlServerDriver) {\n conditions[\"timestamp\"] = new MssqlParameter(migration.timestamp, this.connection.driver.normalizeType({ type: this.connection.driver.mappedDataTypes.migrationTimestamp }) as any);\n conditions[\"name\"] = new MssqlParameter(migration.name, this.connection.driver.normalizeType({ type: this.connection.driver.mappedDataTypes.migrationName }) as any);\n } else {\n conditions[\"timestamp\"] = migration.timestamp;\n conditions[\"name\"] = migration.name;\n }\n\n if (this.connection.driver instanceof MongoDriver) {\n const mongoRunner = queryRunner as MongoQueryRunner;\n await mongoRunner.databaseConnection.db(this.connection.driver.database!).collection(this.migrationsTableName).deleteOne(conditions);\n } else {\n const qb = queryRunner.manager.createQueryBuilder();\n await qb.delete()\n .from(this.migrationsTable)\n .where(`${qb.escape(\"timestamp\")} = :timestamp`)\n .andWhere(`${qb.escape(\"name\")} = :name`)\n .setParameters(conditions)\n .execute();\n }\n\n }\n\n protected async withQueryRunner<T extends any>(callback: (queryRunner: QueryRunner) => T | Promise<T>) {\n const queryRunner = this.queryRunner || this.connection.createQueryRunner();\n\n try {\n return callback(queryRunner);\n } finally {\n if (!this.queryRunner) {\n await queryRunner.release();\n }\n }\n }\n}\n"],"sourceRoot":".."}
@@ -42,7 +42,9 @@ export declare class DeleteQueryBuilder<Entity> extends QueryBuilder<Entity> imp
42
42
  */
43
43
  orWhere(where: Brackets | string | ((qb: this) => string) | ObjectLiteral | ObjectLiteral[], parameters?: ObjectLiteral): this;
44
44
  /**
45
- * Adds new AND WHERE with conditions for the given ids.
45
+ * Sets WHERE condition in the query builder with a condition for the given ids.
46
+ * If you had previously WHERE expression defined,
47
+ * calling this function will override previously set WHERE conditions.
46
48
  */
47
49
  whereInIds(ids: any | any[]): this;
48
50
  /**