taon-typeorm 18.0.19 → 18.0.20

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 (867) hide show
  1. package/browser/esm2022/lib/typeorm/driver/cordova/CordovaDriver.mjs +1 -1
  2. package/browser/esm2022/lib/typeorm/driver/cordova/CordovaQueryRunner.mjs +1 -1
  3. package/browser/esm2022/lib/typeorm/driver/nativescript/NativescriptDriver.mjs +1 -1
  4. package/browser/esm2022/lib/typeorm/driver/nativescript/NativescriptQueryRunner.mjs +1 -1
  5. package/browser/esm2022/lib/typeorm/driver/react-native/ReactNativeDriver.mjs +1 -1
  6. package/browser/esm2022/lib/typeorm/driver/react-native/ReactNativeQueryRunner.mjs +1 -1
  7. package/browser/esm2022/lib/typeorm/driver/sqljs/SqljsDriver.mjs +1 -1
  8. package/browser/esm2022/lib/typeorm/driver/sqljs/SqljsQueryRunner.mjs +1 -1
  9. package/browser/esm2022/lib/typeorm/index.mjs +1 -3
  10. package/browser/fesm2022/taon-typeorm.mjs.map +1 -1
  11. package/client/esm2022/lib/typeorm/driver/cordova/CordovaDriver.mjs +1 -1
  12. package/client/esm2022/lib/typeorm/driver/cordova/CordovaQueryRunner.mjs +1 -1
  13. package/client/esm2022/lib/typeorm/driver/nativescript/NativescriptDriver.mjs +1 -1
  14. package/client/esm2022/lib/typeorm/driver/nativescript/NativescriptQueryRunner.mjs +1 -1
  15. package/client/esm2022/lib/typeorm/driver/react-native/ReactNativeDriver.mjs +1 -1
  16. package/client/esm2022/lib/typeorm/driver/react-native/ReactNativeQueryRunner.mjs +1 -1
  17. package/client/esm2022/lib/typeorm/driver/sqljs/SqljsDriver.mjs +1 -1
  18. package/client/esm2022/lib/typeorm/driver/sqljs/SqljsQueryRunner.mjs +1 -1
  19. package/client/esm2022/lib/typeorm/index.mjs +1 -3
  20. package/client/fesm2022/taon-typeorm.mjs.map +1 -1
  21. package/index.js +15 -2
  22. package/index.js.map +1 -1
  23. package/lib/build-info._auto-generated_.js.map +1 -1
  24. package/lib/index._auto-generated_.d.ts +1 -0
  25. package/lib/index._auto-generated_.js.map +1 -1
  26. package/lib/index.js +15 -2
  27. package/lib/index.js.map +1 -1
  28. package/lib/typeorm/cache/DbQueryResultCache.js +178 -231
  29. package/lib/typeorm/cache/DbQueryResultCache.js.map +1 -1
  30. package/lib/typeorm/cache/QueryResultCache.js.map +1 -1
  31. package/lib/typeorm/cache/QueryResultCacheFactory.js +11 -11
  32. package/lib/typeorm/cache/QueryResultCacheFactory.js.map +1 -1
  33. package/lib/typeorm/cache/QueryResultCacheOptions.js.map +1 -1
  34. package/lib/typeorm/cache/RedisQueryResultCache.js +121 -149
  35. package/lib/typeorm/cache/RedisQueryResultCache.js.map +1 -1
  36. package/lib/typeorm/cli-ts-node-commonjs.js.map +1 -1
  37. package/lib/typeorm/cli-ts-node-esm.js +7 -5
  38. package/lib/typeorm/cli-ts-node-esm.js.map +1 -1
  39. package/lib/typeorm/cli.d.ts +1 -1
  40. package/lib/typeorm/cli.js +15 -16
  41. package/lib/typeorm/cli.js.map +1 -1
  42. package/lib/typeorm/commands/CacheClearCommand.js +37 -65
  43. package/lib/typeorm/commands/CacheClearCommand.js.map +1 -1
  44. package/lib/typeorm/commands/CommandUtils.js +57 -112
  45. package/lib/typeorm/commands/CommandUtils.js.map +1 -1
  46. package/lib/typeorm/commands/EntityCreateCommand.js +35 -47
  47. package/lib/typeorm/commands/EntityCreateCommand.js.map +1 -1
  48. package/lib/typeorm/commands/InitCommand.js +397 -168
  49. package/lib/typeorm/commands/InitCommand.js.map +1 -1
  50. package/lib/typeorm/commands/MigrationCreateCommand.js +58 -52
  51. package/lib/typeorm/commands/MigrationCreateCommand.js.map +1 -1
  52. package/lib/typeorm/commands/MigrationGenerateCommand.js +141 -138
  53. package/lib/typeorm/commands/MigrationGenerateCommand.js.map +1 -1
  54. package/lib/typeorm/commands/MigrationRevertCommand.js +49 -77
  55. package/lib/typeorm/commands/MigrationRevertCommand.js.map +1 -1
  56. package/lib/typeorm/commands/MigrationRunCommand.js +52 -82
  57. package/lib/typeorm/commands/MigrationRunCommand.js.map +1 -1
  58. package/lib/typeorm/commands/MigrationShowCommand.js +32 -60
  59. package/lib/typeorm/commands/MigrationShowCommand.js.map +1 -1
  60. package/lib/typeorm/commands/QueryCommand.js +47 -83
  61. package/lib/typeorm/commands/QueryCommand.js.map +1 -1
  62. package/lib/typeorm/commands/SchemaDropCommand.js +33 -61
  63. package/lib/typeorm/commands/SchemaDropCommand.js.map +1 -1
  64. package/lib/typeorm/commands/SchemaLogCommand.js +57 -81
  65. package/lib/typeorm/commands/SchemaLogCommand.js.map +1 -1
  66. package/lib/typeorm/commands/SchemaSyncCommand.js +33 -61
  67. package/lib/typeorm/commands/SchemaSyncCommand.js.map +1 -1
  68. package/lib/typeorm/commands/SubscriberCreateCommand.js +35 -47
  69. package/lib/typeorm/commands/SubscriberCreateCommand.js.map +1 -1
  70. package/lib/typeorm/commands/VersionCommand.js +38 -54
  71. package/lib/typeorm/commands/VersionCommand.js.map +1 -1
  72. package/lib/typeorm/common/DeepPartial.js.map +1 -1
  73. package/lib/typeorm/common/EntityTarget.js.map +1 -1
  74. package/lib/typeorm/common/MixedList.js.map +1 -1
  75. package/lib/typeorm/common/NonNever.js.map +1 -1
  76. package/lib/typeorm/common/ObjectLiteral.js.map +1 -1
  77. package/lib/typeorm/common/ObjectType.js.map +1 -1
  78. package/lib/typeorm/common/RelationType.js.map +1 -1
  79. package/lib/typeorm/connection/BaseConnectionOptions.js.map +1 -1
  80. package/lib/typeorm/connection/Connection.js +3 -9
  81. package/lib/typeorm/connection/Connection.js.map +1 -1
  82. package/lib/typeorm/connection/ConnectionManager.js +23 -31
  83. package/lib/typeorm/connection/ConnectionManager.js.map +1 -1
  84. package/lib/typeorm/connection/ConnectionMetadataBuilder.js +48 -78
  85. package/lib/typeorm/connection/ConnectionMetadataBuilder.js.map +1 -1
  86. package/lib/typeorm/connection/ConnectionOptions.js.map +1 -1
  87. package/lib/typeorm/connection/ConnectionOptionsReader.js +146 -214
  88. package/lib/typeorm/connection/ConnectionOptionsReader.js.map +1 -1
  89. package/lib/typeorm/connection/options-reader/ConnectionOptionsEnvReader.js +50 -58
  90. package/lib/typeorm/connection/options-reader/ConnectionOptionsEnvReader.js.map +1 -1
  91. package/lib/typeorm/connection/options-reader/ConnectionOptionsXmlReader.js +45 -58
  92. package/lib/typeorm/connection/options-reader/ConnectionOptionsXmlReader.js.map +1 -1
  93. package/lib/typeorm/connection/options-reader/ConnectionOptionsYmlReader.js +14 -23
  94. package/lib/typeorm/connection/options-reader/ConnectionOptionsYmlReader.js.map +1 -1
  95. package/lib/typeorm/constants.js.map +1 -1
  96. package/lib/typeorm/container.js +9 -12
  97. package/lib/typeorm/container.js.map +1 -1
  98. package/lib/typeorm/data-source/BaseDataSourceOptions.js.map +1 -1
  99. package/lib/typeorm/data-source/DataSource.js +320 -478
  100. package/lib/typeorm/data-source/DataSource.js.map +1 -1
  101. package/lib/typeorm/data-source/DataSourceOptions.js.map +1 -1
  102. package/lib/typeorm/data-source/index.js +16 -3
  103. package/lib/typeorm/data-source/index.js.map +1 -1
  104. package/lib/typeorm/decorator/Check.js +5 -5
  105. package/lib/typeorm/decorator/Check.js.map +1 -1
  106. package/lib/typeorm/decorator/EntityRepository.js +1 -1
  107. package/lib/typeorm/decorator/EntityRepository.js.map +1 -1
  108. package/lib/typeorm/decorator/Exclusion.js +5 -5
  109. package/lib/typeorm/decorator/Exclusion.js.map +1 -1
  110. package/lib/typeorm/decorator/Generated.js +2 -3
  111. package/lib/typeorm/decorator/Generated.js.map +1 -1
  112. package/lib/typeorm/decorator/Index.js +5 -5
  113. package/lib/typeorm/decorator/Index.js.map +1 -1
  114. package/lib/typeorm/decorator/Unique.js +8 -8
  115. package/lib/typeorm/decorator/Unique.js.map +1 -1
  116. package/lib/typeorm/decorator/columns/Column.js +4 -4
  117. package/lib/typeorm/decorator/columns/Column.js.map +1 -1
  118. package/lib/typeorm/decorator/columns/CreateDateColumn.js +1 -1
  119. package/lib/typeorm/decorator/columns/CreateDateColumn.js.map +1 -1
  120. package/lib/typeorm/decorator/columns/DeleteDateColumn.js +1 -1
  121. package/lib/typeorm/decorator/columns/DeleteDateColumn.js.map +1 -1
  122. package/lib/typeorm/decorator/columns/ObjectIdColumn.js +1 -1
  123. package/lib/typeorm/decorator/columns/ObjectIdColumn.js.map +1 -1
  124. package/lib/typeorm/decorator/columns/PrimaryColumn.js +5 -5
  125. package/lib/typeorm/decorator/columns/PrimaryColumn.js.map +1 -1
  126. package/lib/typeorm/decorator/columns/PrimaryGeneratedColumn.js +4 -4
  127. package/lib/typeorm/decorator/columns/PrimaryGeneratedColumn.js.map +1 -1
  128. package/lib/typeorm/decorator/columns/UpdateDateColumn.js +1 -1
  129. package/lib/typeorm/decorator/columns/UpdateDateColumn.js.map +1 -1
  130. package/lib/typeorm/decorator/columns/VersionColumn.js +1 -1
  131. package/lib/typeorm/decorator/columns/VersionColumn.js.map +1 -1
  132. package/lib/typeorm/decorator/columns/ViewColumn.js +1 -1
  133. package/lib/typeorm/decorator/columns/ViewColumn.js.map +1 -1
  134. package/lib/typeorm/decorator/columns/VirtualColumn.js +5 -5
  135. package/lib/typeorm/decorator/columns/VirtualColumn.js.map +1 -1
  136. package/lib/typeorm/decorator/entity/ChildEntity.js +1 -1
  137. package/lib/typeorm/decorator/entity/ChildEntity.js.map +1 -1
  138. package/lib/typeorm/decorator/entity/Entity.js +4 -4
  139. package/lib/typeorm/decorator/entity/Entity.js.map +1 -1
  140. package/lib/typeorm/decorator/entity/TableInheritance.js +1 -1
  141. package/lib/typeorm/decorator/entity/TableInheritance.js.map +1 -1
  142. package/lib/typeorm/decorator/entity-view/ViewEntity.js +4 -4
  143. package/lib/typeorm/decorator/entity-view/ViewEntity.js.map +1 -1
  144. package/lib/typeorm/decorator/listeners/AfterInsert.js +2 -2
  145. package/lib/typeorm/decorator/listeners/AfterInsert.js.map +1 -1
  146. package/lib/typeorm/decorator/listeners/AfterLoad.js +2 -2
  147. package/lib/typeorm/decorator/listeners/AfterLoad.js.map +1 -1
  148. package/lib/typeorm/decorator/listeners/AfterRecover.js +2 -2
  149. package/lib/typeorm/decorator/listeners/AfterRecover.js.map +1 -1
  150. package/lib/typeorm/decorator/listeners/AfterRemove.js +2 -2
  151. package/lib/typeorm/decorator/listeners/AfterRemove.js.map +1 -1
  152. package/lib/typeorm/decorator/listeners/AfterSoftRemove.js +2 -2
  153. package/lib/typeorm/decorator/listeners/AfterSoftRemove.js.map +1 -1
  154. package/lib/typeorm/decorator/listeners/AfterUpdate.js +2 -2
  155. package/lib/typeorm/decorator/listeners/AfterUpdate.js.map +1 -1
  156. package/lib/typeorm/decorator/listeners/BeforeInsert.js +2 -2
  157. package/lib/typeorm/decorator/listeners/BeforeInsert.js.map +1 -1
  158. package/lib/typeorm/decorator/listeners/BeforeRecover.js +2 -2
  159. package/lib/typeorm/decorator/listeners/BeforeRecover.js.map +1 -1
  160. package/lib/typeorm/decorator/listeners/BeforeRemove.js +2 -2
  161. package/lib/typeorm/decorator/listeners/BeforeRemove.js.map +1 -1
  162. package/lib/typeorm/decorator/listeners/BeforeSoftRemove.js +2 -2
  163. package/lib/typeorm/decorator/listeners/BeforeSoftRemove.js.map +1 -1
  164. package/lib/typeorm/decorator/listeners/BeforeUpdate.js +2 -2
  165. package/lib/typeorm/decorator/listeners/BeforeUpdate.js.map +1 -1
  166. package/lib/typeorm/decorator/listeners/EventSubscriber.js +1 -1
  167. package/lib/typeorm/decorator/listeners/EventSubscriber.js.map +1 -1
  168. package/lib/typeorm/decorator/options/ColumnCommonOptions.js.map +1 -1
  169. package/lib/typeorm/decorator/options/ColumnEmbeddedOptions.js.map +1 -1
  170. package/lib/typeorm/decorator/options/ColumnEnumOptions.js.map +1 -1
  171. package/lib/typeorm/decorator/options/ColumnHstoreOptions.js.map +1 -1
  172. package/lib/typeorm/decorator/options/ColumnNumericOptions.js.map +1 -1
  173. package/lib/typeorm/decorator/options/ColumnOptions.js.map +1 -1
  174. package/lib/typeorm/decorator/options/ColumnWithLengthOptions.js.map +1 -1
  175. package/lib/typeorm/decorator/options/ColumnWithWidthOptions.js.map +1 -1
  176. package/lib/typeorm/decorator/options/EntityOptions.js.map +1 -1
  177. package/lib/typeorm/decorator/options/IndexOptions.js.map +1 -1
  178. package/lib/typeorm/decorator/options/JoinColumnOptions.js.map +1 -1
  179. package/lib/typeorm/decorator/options/JoinTableMultipleColumnsOptions.js.map +1 -1
  180. package/lib/typeorm/decorator/options/JoinTableOptions.js.map +1 -1
  181. package/lib/typeorm/decorator/options/PrimaryGeneratedColumnIdentityOptions.js.map +1 -1
  182. package/lib/typeorm/decorator/options/PrimaryGeneratedColumnNumericOptions.js.map +1 -1
  183. package/lib/typeorm/decorator/options/PrimaryGeneratedColumnUUIDOptions.js.map +1 -1
  184. package/lib/typeorm/decorator/options/RelationOptions.js.map +1 -1
  185. package/lib/typeorm/decorator/options/SpatialColumnOptions.js.map +1 -1
  186. package/lib/typeorm/decorator/options/TransactionOptions.js.map +1 -1
  187. package/lib/typeorm/decorator/options/UniqueOptions.js.map +1 -1
  188. package/lib/typeorm/decorator/options/ValueTransformer.js.map +1 -1
  189. package/lib/typeorm/decorator/options/ViewColumnOptions.js.map +1 -1
  190. package/lib/typeorm/decorator/options/ViewEntityOptions.js.map +1 -1
  191. package/lib/typeorm/decorator/options/VirtualColumnOptions.js.map +1 -1
  192. package/lib/typeorm/decorator/relations/JoinColumn.js +3 -3
  193. package/lib/typeorm/decorator/relations/JoinColumn.js.map +1 -1
  194. package/lib/typeorm/decorator/relations/JoinTable.js +1 -1
  195. package/lib/typeorm/decorator/relations/JoinTable.js.map +1 -1
  196. package/lib/typeorm/decorator/relations/ManyToMany.js +5 -5
  197. package/lib/typeorm/decorator/relations/ManyToMany.js.map +1 -1
  198. package/lib/typeorm/decorator/relations/ManyToOne.js +5 -5
  199. package/lib/typeorm/decorator/relations/ManyToOne.js.map +1 -1
  200. package/lib/typeorm/decorator/relations/OneToMany.js +3 -3
  201. package/lib/typeorm/decorator/relations/OneToMany.js.map +1 -1
  202. package/lib/typeorm/decorator/relations/OneToOne.js +5 -5
  203. package/lib/typeorm/decorator/relations/OneToOne.js.map +1 -1
  204. package/lib/typeorm/decorator/relations/RelationCount.js +1 -1
  205. package/lib/typeorm/decorator/relations/RelationCount.js.map +1 -1
  206. package/lib/typeorm/decorator/relations/RelationId.js +1 -1
  207. package/lib/typeorm/decorator/relations/RelationId.js.map +1 -1
  208. package/lib/typeorm/decorator/tree/Tree.js +1 -1
  209. package/lib/typeorm/decorator/tree/Tree.js.map +1 -1
  210. package/lib/typeorm/decorator/tree/TreeChildren.js +4 -4
  211. package/lib/typeorm/decorator/tree/TreeChildren.js.map +1 -1
  212. package/lib/typeorm/decorator/tree/TreeLevelColumn.js +1 -1
  213. package/lib/typeorm/decorator/tree/TreeLevelColumn.js.map +1 -1
  214. package/lib/typeorm/decorator/tree/TreeParent.js +4 -4
  215. package/lib/typeorm/decorator/tree/TreeParent.js.map +1 -1
  216. package/lib/typeorm/driver/Driver.js.map +1 -1
  217. package/lib/typeorm/driver/DriverFactory.js +24 -27
  218. package/lib/typeorm/driver/DriverFactory.js.map +1 -1
  219. package/lib/typeorm/driver/DriverUtils.js +78 -126
  220. package/lib/typeorm/driver/DriverUtils.js.map +1 -1
  221. package/lib/typeorm/driver/Query.js +6 -5
  222. package/lib/typeorm/driver/Query.js.map +1 -1
  223. package/lib/typeorm/driver/SqlInMemory.js +4 -7
  224. package/lib/typeorm/driver/SqlInMemory.js.map +1 -1
  225. package/lib/typeorm/driver/aurora-mysql/AuroraMysqlConnection.js +9 -12
  226. package/lib/typeorm/driver/aurora-mysql/AuroraMysqlConnection.js.map +1 -1
  227. package/lib/typeorm/driver/aurora-mysql/AuroraMysqlConnectionCredentialsOptions.js.map +1 -1
  228. package/lib/typeorm/driver/aurora-mysql/AuroraMysqlConnectionOptions.js.map +1 -1
  229. package/lib/typeorm/driver/aurora-mysql/AuroraMysqlDriver.js +392 -399
  230. package/lib/typeorm/driver/aurora-mysql/AuroraMysqlDriver.js.map +1 -1
  231. package/lib/typeorm/driver/aurora-mysql/AuroraMysqlQueryRunner.js +1320 -2084
  232. package/lib/typeorm/driver/aurora-mysql/AuroraMysqlQueryRunner.js.map +1 -1
  233. package/lib/typeorm/driver/aurora-postgres/AuroraPostgresConnectionOptions.js.map +1 -1
  234. package/lib/typeorm/driver/aurora-postgres/AuroraPostgresDriver.js +50 -78
  235. package/lib/typeorm/driver/aurora-postgres/AuroraPostgresDriver.js.map +1 -1
  236. package/lib/typeorm/driver/aurora-postgres/AuroraPostgresQueryRunner.js +89 -160
  237. package/lib/typeorm/driver/aurora-postgres/AuroraPostgresQueryRunner.js.map +1 -1
  238. package/lib/typeorm/driver/better-sqlite3/BetterSqlite3ConnectionOptions.js.map +1 -1
  239. package/lib/typeorm/driver/better-sqlite3/BetterSqlite3Driver.js +78 -152
  240. package/lib/typeorm/driver/better-sqlite3/BetterSqlite3Driver.js.map +1 -1
  241. package/lib/typeorm/driver/better-sqlite3/BetterSqlite3QueryRunner.js +96 -155
  242. package/lib/typeorm/driver/better-sqlite3/BetterSqlite3QueryRunner.js.map +1 -1
  243. package/lib/typeorm/driver/capacitor/CapacitorConnectionOptions.js.map +1 -1
  244. package/lib/typeorm/driver/capacitor/CapacitorDriver.js +44 -89
  245. package/lib/typeorm/driver/capacitor/CapacitorDriver.js.map +1 -1
  246. package/lib/typeorm/driver/capacitor/CapacitorQueryRunner.js +70 -122
  247. package/lib/typeorm/driver/capacitor/CapacitorQueryRunner.js.map +1 -1
  248. package/lib/typeorm/driver/cockroachdb/CockroachConnectionCredentialsOptions.js.map +1 -1
  249. package/lib/typeorm/driver/cockroachdb/CockroachConnectionOptions.js.map +1 -1
  250. package/lib/typeorm/driver/cockroachdb/CockroachDriver.js +368 -404
  251. package/lib/typeorm/driver/cockroachdb/CockroachDriver.js.map +1 -1
  252. package/lib/typeorm/driver/cockroachdb/CockroachQueryRunner.js +1752 -2862
  253. package/lib/typeorm/driver/cockroachdb/CockroachQueryRunner.js.map +1 -1
  254. package/lib/typeorm/driver/cordova/CordovaConnectionOptions.js.map +1 -1
  255. package/lib/typeorm/driver/cordova/CordovaDriver.js +36 -58
  256. package/lib/typeorm/driver/cordova/CordovaDriver.js.map +1 -1
  257. package/lib/typeorm/driver/cordova/CordovaQueryRunner.js +86 -164
  258. package/lib/typeorm/driver/cordova/CordovaQueryRunner.js.map +1 -1
  259. package/lib/typeorm/driver/expo/ExpoConnectionOptions.js.map +1 -1
  260. package/lib/typeorm/driver/expo/ExpoDriver.js +34 -44
  261. package/lib/typeorm/driver/expo/ExpoDriver.js.map +1 -1
  262. package/lib/typeorm/driver/expo/ExpoQueryRunner.js +114 -204
  263. package/lib/typeorm/driver/expo/ExpoQueryRunner.js.map +1 -1
  264. package/lib/typeorm/driver/mongodb/MongoConnectionOptions.js.map +1 -1
  265. package/lib/typeorm/driver/mongodb/MongoDriver.js +269 -243
  266. package/lib/typeorm/driver/mongodb/MongoDriver.js.map +1 -1
  267. package/lib/typeorm/driver/mongodb/MongoQueryRunner.js +357 -793
  268. package/lib/typeorm/driver/mongodb/MongoQueryRunner.js.map +1 -1
  269. package/lib/typeorm/driver/mongodb/typings.js.map +1 -1
  270. package/lib/typeorm/driver/mysql/MysqlConnectionCredentialsOptions.js.map +1 -1
  271. package/lib/typeorm/driver/mysql/MysqlConnectionOptions.js.map +1 -1
  272. package/lib/typeorm/driver/mysql/MysqlDriver.js +475 -480
  273. package/lib/typeorm/driver/mysql/MysqlDriver.js.map +1 -1
  274. package/lib/typeorm/driver/mysql/MysqlQueryRunner.js +1692 -2466
  275. package/lib/typeorm/driver/mysql/MysqlQueryRunner.js.map +1 -1
  276. package/lib/typeorm/driver/nativescript/NativescriptConnectionOptions.js.map +1 -1
  277. package/lib/typeorm/driver/nativescript/NativescriptDriver.js +46 -50
  278. package/lib/typeorm/driver/nativescript/NativescriptDriver.js.map +1 -1
  279. package/lib/typeorm/driver/nativescript/NativescriptQueryRunner.js +62 -101
  280. package/lib/typeorm/driver/nativescript/NativescriptQueryRunner.js.map +1 -1
  281. package/lib/typeorm/driver/oracle/OracleConnectionCredentialsOptions.js.map +1 -1
  282. package/lib/typeorm/driver/oracle/OracleConnectionOptions.js.map +1 -1
  283. package/lib/typeorm/driver/oracle/OracleDriver.js +345 -377
  284. package/lib/typeorm/driver/oracle/OracleDriver.js.map +1 -1
  285. package/lib/typeorm/driver/oracle/OracleQueryRunner.js +1484 -2384
  286. package/lib/typeorm/driver/oracle/OracleQueryRunner.js.map +1 -1
  287. package/lib/typeorm/driver/postgres/PostgresConnectionCredentialsOptions.js.map +1 -1
  288. package/lib/typeorm/driver/postgres/PostgresConnectionOptions.js.map +1 -1
  289. package/lib/typeorm/driver/postgres/PostgresDriver.js +574 -690
  290. package/lib/typeorm/driver/postgres/PostgresDriver.js.map +1 -1
  291. package/lib/typeorm/driver/postgres/PostgresQueryRunner.js +2153 -3379
  292. package/lib/typeorm/driver/postgres/PostgresQueryRunner.js.map +1 -1
  293. package/lib/typeorm/driver/react-native/ReactNativeConnectionOptions.js.map +1 -1
  294. package/lib/typeorm/driver/react-native/ReactNativeDriver.js +34 -44
  295. package/lib/typeorm/driver/react-native/ReactNativeDriver.js.map +1 -1
  296. package/lib/typeorm/driver/react-native/ReactNativeQueryRunner.js +60 -94
  297. package/lib/typeorm/driver/react-native/ReactNativeQueryRunner.js.map +1 -1
  298. package/lib/typeorm/driver/sap/SapConnectionCredentialsOptions.js.map +1 -1
  299. package/lib/typeorm/driver/sap/SapConnectionOptions.js.map +1 -1
  300. package/lib/typeorm/driver/sap/SapDriver.js +310 -305
  301. package/lib/typeorm/driver/sap/SapDriver.js.map +1 -1
  302. package/lib/typeorm/driver/sap/SapQueryRunner.js +1635 -2561
  303. package/lib/typeorm/driver/sap/SapQueryRunner.js.map +1 -1
  304. package/lib/typeorm/driver/spanner/SpannerConnectionCredentialsOptions.js.map +1 -1
  305. package/lib/typeorm/driver/spanner/SpannerConnectionOptions.js.map +1 -1
  306. package/lib/typeorm/driver/spanner/SpannerDriver.js +250 -236
  307. package/lib/typeorm/driver/spanner/SpannerDriver.js.map +1 -1
  308. package/lib/typeorm/driver/spanner/SpannerQueryRunner.js +1136 -2168
  309. package/lib/typeorm/driver/spanner/SpannerQueryRunner.js.map +1 -1
  310. package/lib/typeorm/driver/sqlite/SqliteConnectionOptions.js.map +1 -1
  311. package/lib/typeorm/driver/sqlite/SqliteDriver.js +82 -169
  312. package/lib/typeorm/driver/sqlite/SqliteDriver.js.map +1 -1
  313. package/lib/typeorm/driver/sqlite/SqliteQueryRunner.js +78 -122
  314. package/lib/typeorm/driver/sqlite/SqliteQueryRunner.js.map +1 -1
  315. package/lib/typeorm/driver/sqlite-abstract/AbstractSqliteDriver.js +280 -268
  316. package/lib/typeorm/driver/sqlite-abstract/AbstractSqliteDriver.js.map +1 -1
  317. package/lib/typeorm/driver/sqlite-abstract/AbstractSqliteQueryRunner.js +1158 -1990
  318. package/lib/typeorm/driver/sqlite-abstract/AbstractSqliteQueryRunner.js.map +1 -1
  319. package/lib/typeorm/driver/sqljs/SqljsConnectionOptions.js.map +1 -1
  320. package/lib/typeorm/driver/sqljs/SqljsDriver.js +187 -253
  321. package/lib/typeorm/driver/sqljs/SqljsDriver.js.map +1 -1
  322. package/lib/typeorm/driver/sqljs/SqljsQueryRunner.js +88 -147
  323. package/lib/typeorm/driver/sqljs/SqljsQueryRunner.js.map +1 -1
  324. package/lib/typeorm/driver/sqlserver/MssqlParameter.js +10 -13
  325. package/lib/typeorm/driver/sqlserver/MssqlParameter.js.map +1 -1
  326. package/lib/typeorm/driver/sqlserver/SqlServerConnectionCredentialsOptions.js.map +1 -1
  327. package/lib/typeorm/driver/sqlserver/SqlServerConnectionOptions.js.map +1 -1
  328. package/lib/typeorm/driver/sqlserver/SqlServerDriver.js +352 -372
  329. package/lib/typeorm/driver/sqlserver/SqlServerDriver.js.map +1 -1
  330. package/lib/typeorm/driver/sqlserver/SqlServerQueryRunner.js +1979 -3068
  331. package/lib/typeorm/driver/sqlserver/SqlServerQueryRunner.js.map +1 -1
  332. package/lib/typeorm/driver/sqlserver/authentication/AzureActiveDirectoryAccessTokenAuthentication.js.map +1 -1
  333. package/lib/typeorm/driver/sqlserver/authentication/AzureActiveDirectoryMsiAppServiceAuthentication.js.map +1 -1
  334. package/lib/typeorm/driver/sqlserver/authentication/AzureActiveDirectoryMsiVmAuthentication.js.map +1 -1
  335. package/lib/typeorm/driver/sqlserver/authentication/AzureActiveDirectoryPasswordAuthentication.js.map +1 -1
  336. package/lib/typeorm/driver/sqlserver/authentication/AzureActiveDirectoryServicePrincipalSecret.js.map +1 -1
  337. package/lib/typeorm/driver/sqlserver/authentication/DefaultAuthentication.js.map +1 -1
  338. package/lib/typeorm/driver/sqlserver/authentication/NtlmAuthentication.js.map +1 -1
  339. package/lib/typeorm/driver/types/ColumnTypes.js.map +1 -1
  340. package/lib/typeorm/driver/types/CteCapabilities.js.map +1 -1
  341. package/lib/typeorm/driver/types/DataTypeDefaults.js.map +1 -1
  342. package/lib/typeorm/driver/types/DatabaseType.js.map +1 -1
  343. package/lib/typeorm/driver/types/IsolationLevel.js.map +1 -1
  344. package/lib/typeorm/driver/types/MappedColumnTypes.js.map +1 -1
  345. package/lib/typeorm/driver/types/MetadataTableType.js.map +1 -1
  346. package/lib/typeorm/driver/types/ReplicationMode.js.map +1 -1
  347. package/lib/typeorm/driver/types/UpsertType.js.map +1 -1
  348. package/lib/typeorm/entity-manager/EntityManager.js +351 -469
  349. package/lib/typeorm/entity-manager/EntityManager.js.map +1 -1
  350. package/lib/typeorm/entity-manager/EntityManagerFactory.js +7 -10
  351. package/lib/typeorm/entity-manager/EntityManagerFactory.js.map +1 -1
  352. package/lib/typeorm/entity-manager/MongoEntityManager.js +371 -487
  353. package/lib/typeorm/entity-manager/MongoEntityManager.js.map +1 -1
  354. package/lib/typeorm/entity-manager/SqljsEntityManager.js +16 -37
  355. package/lib/typeorm/entity-manager/SqljsEntityManager.js.map +1 -1
  356. package/lib/typeorm/entity-schema/EntitySchema.js +5 -5
  357. package/lib/typeorm/entity-schema/EntitySchema.js.map +1 -1
  358. package/lib/typeorm/entity-schema/EntitySchemaCheckOptions.js.map +1 -1
  359. package/lib/typeorm/entity-schema/EntitySchemaColumnOptions.js.map +1 -1
  360. package/lib/typeorm/entity-schema/EntitySchemaEmbeddedColumnOptions.js +17 -5
  361. package/lib/typeorm/entity-schema/EntitySchemaEmbeddedColumnOptions.js.map +1 -1
  362. package/lib/typeorm/entity-schema/EntitySchemaEmbeddedError.js +11 -14
  363. package/lib/typeorm/entity-schema/EntitySchemaEmbeddedError.js.map +1 -1
  364. package/lib/typeorm/entity-schema/EntitySchemaExclusionOptions.js.map +1 -1
  365. package/lib/typeorm/entity-schema/EntitySchemaIndexOptions.js.map +1 -1
  366. package/lib/typeorm/entity-schema/EntitySchemaOptions.js +82 -5
  367. package/lib/typeorm/entity-schema/EntitySchemaOptions.js.map +1 -1
  368. package/lib/typeorm/entity-schema/EntitySchemaRelationIdOptions.js.map +1 -1
  369. package/lib/typeorm/entity-schema/EntitySchemaRelationOptions.js.map +1 -1
  370. package/lib/typeorm/entity-schema/EntitySchemaTransformer.js +51 -68
  371. package/lib/typeorm/entity-schema/EntitySchemaTransformer.js.map +1 -1
  372. package/lib/typeorm/entity-schema/EntitySchemaUniqueOptions.js.map +1 -1
  373. package/lib/typeorm/error/AlreadyHasActiveConnectionError.js +6 -9
  374. package/lib/typeorm/error/AlreadyHasActiveConnectionError.js.map +1 -1
  375. package/lib/typeorm/error/CannotAttachTreeChildrenEntityError.js +6 -9
  376. package/lib/typeorm/error/CannotAttachTreeChildrenEntityError.js.map +1 -1
  377. package/lib/typeorm/error/CannotConnectAlreadyConnectedError.js +5 -8
  378. package/lib/typeorm/error/CannotConnectAlreadyConnectedError.js.map +1 -1
  379. package/lib/typeorm/error/CannotCreateEntityIdMapError.js +7 -11
  380. package/lib/typeorm/error/CannotCreateEntityIdMapError.js.map +1 -1
  381. package/lib/typeorm/error/CannotDetermineEntityError.js +6 -9
  382. package/lib/typeorm/error/CannotDetermineEntityError.js.map +1 -1
  383. package/lib/typeorm/error/CannotExecuteNotConnectedError.js +5 -8
  384. package/lib/typeorm/error/CannotExecuteNotConnectedError.js.map +1 -1
  385. package/lib/typeorm/error/CannotGetEntityManagerNotConnectedError.js +5 -8
  386. package/lib/typeorm/error/CannotGetEntityManagerNotConnectedError.js.map +1 -1
  387. package/lib/typeorm/error/CannotReflectMethodParameterTypeError.js +7 -10
  388. package/lib/typeorm/error/CannotReflectMethodParameterTypeError.js.map +1 -1
  389. package/lib/typeorm/error/CircularRelationsError.js +6 -9
  390. package/lib/typeorm/error/CircularRelationsError.js.map +1 -1
  391. package/lib/typeorm/error/ColumnTypeUndefinedError.js +8 -11
  392. package/lib/typeorm/error/ColumnTypeUndefinedError.js.map +1 -1
  393. package/lib/typeorm/error/ConnectionIsNotSetError.js +5 -8
  394. package/lib/typeorm/error/ConnectionIsNotSetError.js.map +1 -1
  395. package/lib/typeorm/error/ConnectionNotFoundError.js +5 -8
  396. package/lib/typeorm/error/ConnectionNotFoundError.js.map +1 -1
  397. package/lib/typeorm/error/CustomRepositoryCannotInheritRepositoryError.js +7 -10
  398. package/lib/typeorm/error/CustomRepositoryCannotInheritRepositoryError.js.map +1 -1
  399. package/lib/typeorm/error/CustomRepositoryDoesNotHaveEntityError.js +7 -10
  400. package/lib/typeorm/error/CustomRepositoryDoesNotHaveEntityError.js.map +1 -1
  401. package/lib/typeorm/error/CustomRepositoryNotFoundError.js +7 -10
  402. package/lib/typeorm/error/CustomRepositoryNotFoundError.js.map +1 -1
  403. package/lib/typeorm/error/DataTypeNotSupportedError.js +7 -11
  404. package/lib/typeorm/error/DataTypeNotSupportedError.js.map +1 -1
  405. package/lib/typeorm/error/DriverOptionNotSetError.js +6 -9
  406. package/lib/typeorm/error/DriverOptionNotSetError.js.map +1 -1
  407. package/lib/typeorm/error/DriverPackageNotInstalledError.js +6 -9
  408. package/lib/typeorm/error/DriverPackageNotInstalledError.js.map +1 -1
  409. package/lib/typeorm/error/EntityMetadataNotFoundError.js +10 -14
  410. package/lib/typeorm/error/EntityMetadataNotFoundError.js.map +1 -1
  411. package/lib/typeorm/error/EntityNotFoundError.js +13 -17
  412. package/lib/typeorm/error/EntityNotFoundError.js.map +1 -1
  413. package/lib/typeorm/error/EntityPropertyNotFoundError.js +7 -11
  414. package/lib/typeorm/error/EntityPropertyNotFoundError.js.map +1 -1
  415. package/lib/typeorm/error/FindRelationsNotFoundError.js +9 -13
  416. package/lib/typeorm/error/FindRelationsNotFoundError.js.map +1 -1
  417. package/lib/typeorm/error/ForbiddenTransactionModeOverrideError.js +6 -9
  418. package/lib/typeorm/error/ForbiddenTransactionModeOverrideError.js.map +1 -1
  419. package/lib/typeorm/error/InitializedRelationError.js +7 -10
  420. package/lib/typeorm/error/InitializedRelationError.js.map +1 -1
  421. package/lib/typeorm/error/InsertValuesMissingError.js +6 -9
  422. package/lib/typeorm/error/InsertValuesMissingError.js.map +1 -1
  423. package/lib/typeorm/error/LimitOnUpdateNotSupportedError.js +5 -8
  424. package/lib/typeorm/error/LimitOnUpdateNotSupportedError.js.map +1 -1
  425. package/lib/typeorm/error/LockNotSupportedOnGivenDriverError.js +5 -8
  426. package/lib/typeorm/error/LockNotSupportedOnGivenDriverError.js.map +1 -1
  427. package/lib/typeorm/error/MetadataAlreadyExistsError.js +6 -9
  428. package/lib/typeorm/error/MetadataAlreadyExistsError.js.map +1 -1
  429. package/lib/typeorm/error/MetadataWithSuchNameAlreadyExistsError.js +6 -9
  430. package/lib/typeorm/error/MetadataWithSuchNameAlreadyExistsError.js.map +1 -1
  431. package/lib/typeorm/error/MissingDeleteDateColumnError.js +5 -8
  432. package/lib/typeorm/error/MissingDeleteDateColumnError.js.map +1 -1
  433. package/lib/typeorm/error/MissingDriverError.js +6 -10
  434. package/lib/typeorm/error/MissingDriverError.js.map +1 -1
  435. package/lib/typeorm/error/MissingJoinColumnError.js +12 -16
  436. package/lib/typeorm/error/MissingJoinColumnError.js.map +1 -1
  437. package/lib/typeorm/error/MissingJoinTableError.js +12 -16
  438. package/lib/typeorm/error/MissingJoinTableError.js.map +1 -1
  439. package/lib/typeorm/error/MissingPrimaryColumnError.js +6 -9
  440. package/lib/typeorm/error/MissingPrimaryColumnError.js.map +1 -1
  441. package/lib/typeorm/error/MustBeEntityError.js +5 -8
  442. package/lib/typeorm/error/MustBeEntityError.js.map +1 -1
  443. package/lib/typeorm/error/NamingStrategyNotFoundError.js +9 -13
  444. package/lib/typeorm/error/NamingStrategyNotFoundError.js.map +1 -1
  445. package/lib/typeorm/error/NestedSetMultipleRootError.js +5 -8
  446. package/lib/typeorm/error/NestedSetMultipleRootError.js.map +1 -1
  447. package/lib/typeorm/error/NoConnectionForRepositoryError.js +6 -9
  448. package/lib/typeorm/error/NoConnectionForRepositoryError.js.map +1 -1
  449. package/lib/typeorm/error/NoConnectionOptionError.js +6 -9
  450. package/lib/typeorm/error/NoConnectionOptionError.js.map +1 -1
  451. package/lib/typeorm/error/NoNeedToReleaseEntityManagerError.js +7 -10
  452. package/lib/typeorm/error/NoNeedToReleaseEntityManagerError.js.map +1 -1
  453. package/lib/typeorm/error/NoVersionOrUpdateDateColumnError.js +5 -8
  454. package/lib/typeorm/error/NoVersionOrUpdateDateColumnError.js.map +1 -1
  455. package/lib/typeorm/error/OffsetWithoutLimitNotSupportedError.js +7 -10
  456. package/lib/typeorm/error/OffsetWithoutLimitNotSupportedError.js.map +1 -1
  457. package/lib/typeorm/error/OptimisticLockCanNotBeUsedError.js +5 -8
  458. package/lib/typeorm/error/OptimisticLockCanNotBeUsedError.js.map +1 -1
  459. package/lib/typeorm/error/OptimisticLockVersionMismatchError.js +5 -8
  460. package/lib/typeorm/error/OptimisticLockVersionMismatchError.js.map +1 -1
  461. package/lib/typeorm/error/PersistedEntityNotFoundError.js +5 -8
  462. package/lib/typeorm/error/PersistedEntityNotFoundError.js.map +1 -1
  463. package/lib/typeorm/error/PessimisticLockTransactionRequiredError.js +5 -8
  464. package/lib/typeorm/error/PessimisticLockTransactionRequiredError.js.map +1 -1
  465. package/lib/typeorm/error/PrimaryColumnCannotBeNullableError.js +6 -9
  466. package/lib/typeorm/error/PrimaryColumnCannotBeNullableError.js.map +1 -1
  467. package/lib/typeorm/error/QueryFailedError.js +18 -17
  468. package/lib/typeorm/error/QueryFailedError.js.map +1 -1
  469. package/lib/typeorm/error/QueryRunnerAlreadyReleasedError.js +5 -8
  470. package/lib/typeorm/error/QueryRunnerAlreadyReleasedError.js.map +1 -1
  471. package/lib/typeorm/error/QueryRunnerProviderAlreadyReleasedError.js +6 -9
  472. package/lib/typeorm/error/QueryRunnerProviderAlreadyReleasedError.js.map +1 -1
  473. package/lib/typeorm/error/RepositoryNotTreeError.js +9 -13
  474. package/lib/typeorm/error/RepositoryNotTreeError.js.map +1 -1
  475. package/lib/typeorm/error/ReturningStatementNotSupportedError.js +5 -8
  476. package/lib/typeorm/error/ReturningStatementNotSupportedError.js.map +1 -1
  477. package/lib/typeorm/error/SubjectRemovedAndUpdatedError.js +6 -9
  478. package/lib/typeorm/error/SubjectRemovedAndUpdatedError.js.map +1 -1
  479. package/lib/typeorm/error/SubjectWithoutIdentifierError.js +5 -8
  480. package/lib/typeorm/error/SubjectWithoutIdentifierError.js.map +1 -1
  481. package/lib/typeorm/error/TransactionAlreadyStartedError.js +5 -8
  482. package/lib/typeorm/error/TransactionAlreadyStartedError.js.map +1 -1
  483. package/lib/typeorm/error/TransactionNotStartedError.js +5 -8
  484. package/lib/typeorm/error/TransactionNotStartedError.js.map +1 -1
  485. package/lib/typeorm/error/TreeRepositoryNotSupportedError.js +5 -8
  486. package/lib/typeorm/error/TreeRepositoryNotSupportedError.js.map +1 -1
  487. package/lib/typeorm/error/TypeORMError.js +9 -18
  488. package/lib/typeorm/error/TypeORMError.js.map +1 -1
  489. package/lib/typeorm/error/UpdateValuesMissingError.js +5 -8
  490. package/lib/typeorm/error/UpdateValuesMissingError.js.map +1 -1
  491. package/lib/typeorm/error/UsingJoinColumnIsNotAllowedError.js +6 -9
  492. package/lib/typeorm/error/UsingJoinColumnIsNotAllowedError.js.map +1 -1
  493. package/lib/typeorm/error/UsingJoinColumnOnlyOnOneSideAllowedError.js +7 -10
  494. package/lib/typeorm/error/UsingJoinColumnOnlyOnOneSideAllowedError.js.map +1 -1
  495. package/lib/typeorm/error/UsingJoinTableIsNotAllowedError.js +7 -10
  496. package/lib/typeorm/error/UsingJoinTableIsNotAllowedError.js.map +1 -1
  497. package/lib/typeorm/error/UsingJoinTableOnlyOnOneSideAllowedError.js +7 -10
  498. package/lib/typeorm/error/UsingJoinTableOnlyOnOneSideAllowedError.js.map +1 -1
  499. package/lib/typeorm/error/index.js +75 -62
  500. package/lib/typeorm/error/index.js.map +1 -1
  501. package/lib/typeorm/find-options/EqualOperator.js +6 -10
  502. package/lib/typeorm/find-options/EqualOperator.js.map +1 -1
  503. package/lib/typeorm/find-options/FindManyOptions.js.map +1 -1
  504. package/lib/typeorm/find-options/FindOneOptions.js.map +1 -1
  505. package/lib/typeorm/find-options/FindOperator.js +90 -94
  506. package/lib/typeorm/find-options/FindOperator.js.map +1 -1
  507. package/lib/typeorm/find-options/FindOperatorType.js.map +1 -1
  508. package/lib/typeorm/find-options/FindOptionsOrder.js.map +1 -1
  509. package/lib/typeorm/find-options/FindOptionsRelations.js.map +1 -1
  510. package/lib/typeorm/find-options/FindOptionsSelect.js.map +1 -1
  511. package/lib/typeorm/find-options/FindOptionsUtils.js +56 -87
  512. package/lib/typeorm/find-options/FindOptionsUtils.js.map +1 -1
  513. package/lib/typeorm/find-options/FindOptionsWhere.js.map +1 -1
  514. package/lib/typeorm/find-options/FindTreeOptions.js.map +1 -1
  515. package/lib/typeorm/find-options/JoinOptions.js.map +1 -1
  516. package/lib/typeorm/find-options/OrderByCondition.js.map +1 -1
  517. package/lib/typeorm/find-options/mongodb/MongoFindManyOptions.js.map +1 -1
  518. package/lib/typeorm/find-options/mongodb/MongoFindOneOptions.js.map +1 -1
  519. package/lib/typeorm/find-options/operator/And.js +2 -6
  520. package/lib/typeorm/find-options/operator/And.js.map +1 -1
  521. package/lib/typeorm/find-options/operator/Any.js +1 -1
  522. package/lib/typeorm/find-options/operator/Any.js.map +1 -1
  523. package/lib/typeorm/find-options/operator/ArrayContainedBy.js +1 -1
  524. package/lib/typeorm/find-options/operator/ArrayContainedBy.js.map +1 -1
  525. package/lib/typeorm/find-options/operator/ArrayContains.js +1 -1
  526. package/lib/typeorm/find-options/operator/ArrayContains.js.map +1 -1
  527. package/lib/typeorm/find-options/operator/ArrayOverlap.js +1 -1
  528. package/lib/typeorm/find-options/operator/ArrayOverlap.js.map +1 -1
  529. package/lib/typeorm/find-options/operator/Between.js +1 -1
  530. package/lib/typeorm/find-options/operator/Between.js.map +1 -1
  531. package/lib/typeorm/find-options/operator/Equal.js +1 -1
  532. package/lib/typeorm/find-options/operator/Equal.js.map +1 -1
  533. package/lib/typeorm/find-options/operator/ILike.js +1 -1
  534. package/lib/typeorm/find-options/operator/ILike.js.map +1 -1
  535. package/lib/typeorm/find-options/operator/In.js +1 -1
  536. package/lib/typeorm/find-options/operator/In.js.map +1 -1
  537. package/lib/typeorm/find-options/operator/IsNull.js +1 -1
  538. package/lib/typeorm/find-options/operator/IsNull.js.map +1 -1
  539. package/lib/typeorm/find-options/operator/LessThan.js +1 -1
  540. package/lib/typeorm/find-options/operator/LessThan.js.map +1 -1
  541. package/lib/typeorm/find-options/operator/LessThanOrEqual.js +1 -1
  542. package/lib/typeorm/find-options/operator/LessThanOrEqual.js.map +1 -1
  543. package/lib/typeorm/find-options/operator/Like.js +1 -1
  544. package/lib/typeorm/find-options/operator/Like.js.map +1 -1
  545. package/lib/typeorm/find-options/operator/MoreThan.js +1 -1
  546. package/lib/typeorm/find-options/operator/MoreThan.js.map +1 -1
  547. package/lib/typeorm/find-options/operator/MoreThanOrEqual.js +1 -1
  548. package/lib/typeorm/find-options/operator/MoreThanOrEqual.js.map +1 -1
  549. package/lib/typeorm/find-options/operator/Not.js +1 -1
  550. package/lib/typeorm/find-options/operator/Not.js.map +1 -1
  551. package/lib/typeorm/find-options/operator/Raw.js +1 -1
  552. package/lib/typeorm/find-options/operator/Raw.js.map +1 -1
  553. package/lib/typeorm/globals.js +33 -99
  554. package/lib/typeorm/globals.js.map +1 -1
  555. package/lib/typeorm/index.d.ts +0 -1
  556. package/lib/typeorm/index.js +136 -126
  557. package/lib/typeorm/index.js.map +1 -1
  558. package/lib/typeorm/logger/AdvancedConsoleLogger.js +26 -26
  559. package/lib/typeorm/logger/AdvancedConsoleLogger.js.map +1 -1
  560. package/lib/typeorm/logger/DebugLogger.js +24 -27
  561. package/lib/typeorm/logger/DebugLogger.js.map +1 -1
  562. package/lib/typeorm/logger/FileLogger.js +31 -30
  563. package/lib/typeorm/logger/FileLogger.js.map +1 -1
  564. package/lib/typeorm/logger/Logger.js.map +1 -1
  565. package/lib/typeorm/logger/LoggerFactory.js +9 -12
  566. package/lib/typeorm/logger/LoggerFactory.js.map +1 -1
  567. package/lib/typeorm/logger/LoggerOptions.js.map +1 -1
  568. package/lib/typeorm/logger/SimpleConsoleLogger.js +25 -25
  569. package/lib/typeorm/logger/SimpleConsoleLogger.js.map +1 -1
  570. package/lib/typeorm/metadata/CheckMetadata.js +30 -6
  571. package/lib/typeorm/metadata/CheckMetadata.js.map +1 -1
  572. package/lib/typeorm/metadata/ColumnMetadata.js +343 -199
  573. package/lib/typeorm/metadata/ColumnMetadata.js.map +1 -1
  574. package/lib/typeorm/metadata/EmbeddedMetadata.js +174 -153
  575. package/lib/typeorm/metadata/EmbeddedMetadata.js.map +1 -1
  576. package/lib/typeorm/metadata/EntityListenerMetadata.js +35 -15
  577. package/lib/typeorm/metadata/EntityListenerMetadata.js.map +1 -1
  578. package/lib/typeorm/metadata/EntityMetadata.js +516 -372
  579. package/lib/typeorm/metadata/EntityMetadata.js.map +1 -1
  580. package/lib/typeorm/metadata/ExclusionMetadata.js +30 -6
  581. package/lib/typeorm/metadata/ExclusionMetadata.js.map +1 -1
  582. package/lib/typeorm/metadata/ForeignKeyMetadata.js +60 -24
  583. package/lib/typeorm/metadata/ForeignKeyMetadata.js.map +1 -1
  584. package/lib/typeorm/metadata/IndexMetadata.js +119 -73
  585. package/lib/typeorm/metadata/IndexMetadata.js.map +1 -1
  586. package/lib/typeorm/metadata/RelationCountMetadata.js +40 -10
  587. package/lib/typeorm/metadata/RelationCountMetadata.js.map +1 -1
  588. package/lib/typeorm/metadata/RelationIdMetadata.js +47 -18
  589. package/lib/typeorm/metadata/RelationIdMetadata.js.map +1 -1
  590. package/lib/typeorm/metadata/RelationMetadata.js +270 -187
  591. package/lib/typeorm/metadata/RelationMetadata.js.map +1 -1
  592. package/lib/typeorm/metadata/UniqueMetadata.js +72 -47
  593. package/lib/typeorm/metadata/UniqueMetadata.js.map +1 -1
  594. package/lib/typeorm/metadata/types/ClosureTreeOptions.js.map +1 -1
  595. package/lib/typeorm/metadata/types/DeferrableType.js.map +1 -1
  596. package/lib/typeorm/metadata/types/EventListenerTypes.js +13 -16
  597. package/lib/typeorm/metadata/types/EventListenerTypes.js.map +1 -1
  598. package/lib/typeorm/metadata/types/OnDeleteType.js.map +1 -1
  599. package/lib/typeorm/metadata/types/OnUpdateType.js.map +1 -1
  600. package/lib/typeorm/metadata/types/PropertyTypeInFunction.js.map +1 -1
  601. package/lib/typeorm/metadata/types/RelationTypeInFunction.js.map +1 -1
  602. package/lib/typeorm/metadata/types/RelationTypes.js.map +1 -1
  603. package/lib/typeorm/metadata/types/TableTypes.js.map +1 -1
  604. package/lib/typeorm/metadata/types/TreeTypes.js.map +1 -1
  605. package/lib/typeorm/metadata-args/CheckMetadataArgs.js.map +1 -1
  606. package/lib/typeorm/metadata-args/ColumnMetadataArgs.js.map +1 -1
  607. package/lib/typeorm/metadata-args/DiscriminatorValueMetadataArgs.js.map +1 -1
  608. package/lib/typeorm/metadata-args/EmbeddedMetadataArgs.js.map +1 -1
  609. package/lib/typeorm/metadata-args/EntityListenerMetadataArgs.js.map +1 -1
  610. package/lib/typeorm/metadata-args/EntityRepositoryMetadataArgs.js.map +1 -1
  611. package/lib/typeorm/metadata-args/EntitySubscriberMetadataArgs.js.map +1 -1
  612. package/lib/typeorm/metadata-args/ExclusionMetadataArgs.js.map +1 -1
  613. package/lib/typeorm/metadata-args/GeneratedMetadataArgs.js.map +1 -1
  614. package/lib/typeorm/metadata-args/IndexMetadataArgs.js.map +1 -1
  615. package/lib/typeorm/metadata-args/InheritanceMetadataArgs.js.map +1 -1
  616. package/lib/typeorm/metadata-args/JoinColumnMetadataArgs.js.map +1 -1
  617. package/lib/typeorm/metadata-args/JoinTableMetadataArgs.js.map +1 -1
  618. package/lib/typeorm/metadata-args/MetadataArgsStorage.js +108 -113
  619. package/lib/typeorm/metadata-args/MetadataArgsStorage.js.map +1 -1
  620. package/lib/typeorm/metadata-args/NamingStrategyMetadataArgs.js.map +1 -1
  621. package/lib/typeorm/metadata-args/RelationCountMetadataArgs.js.map +1 -1
  622. package/lib/typeorm/metadata-args/RelationIdMetadataArgs.js.map +1 -1
  623. package/lib/typeorm/metadata-args/RelationMetadataArgs.js.map +1 -1
  624. package/lib/typeorm/metadata-args/TableMetadataArgs.js.map +1 -1
  625. package/lib/typeorm/metadata-args/TransactionEntityMetadataArgs.js.map +1 -1
  626. package/lib/typeorm/metadata-args/TransactionRepositoryMetadataArgs.js.map +1 -1
  627. package/lib/typeorm/metadata-args/TreeMetadataArgs.js.map +1 -1
  628. package/lib/typeorm/metadata-args/UniqueMetadataArgs.js.map +1 -1
  629. package/lib/typeorm/metadata-args/types/ColumnMode.js.map +1 -1
  630. package/lib/typeorm/metadata-builder/ClosureJunctionEntityMetadataBuilder.js +14 -15
  631. package/lib/typeorm/metadata-builder/ClosureJunctionEntityMetadataBuilder.js.map +1 -1
  632. package/lib/typeorm/metadata-builder/EntityMetadataBuilder.js +291 -347
  633. package/lib/typeorm/metadata-builder/EntityMetadataBuilder.js.map +1 -1
  634. package/lib/typeorm/metadata-builder/EntityMetadataValidator.js +63 -77
  635. package/lib/typeorm/metadata-builder/EntityMetadataValidator.js.map +1 -1
  636. package/lib/typeorm/metadata-builder/JunctionEntityMetadataBuilder.js +64 -69
  637. package/lib/typeorm/metadata-builder/JunctionEntityMetadataBuilder.js.map +1 -1
  638. package/lib/typeorm/metadata-builder/MetadataUtils.js +12 -15
  639. package/lib/typeorm/metadata-builder/MetadataUtils.js.map +1 -1
  640. package/lib/typeorm/metadata-builder/RelationJoinColumnBuilder.js +43 -49
  641. package/lib/typeorm/metadata-builder/RelationJoinColumnBuilder.js.map +1 -1
  642. package/lib/typeorm/migration/Migration.js +23 -4
  643. package/lib/typeorm/migration/Migration.js.map +1 -1
  644. package/lib/typeorm/migration/MigrationExecutor.js +432 -691
  645. package/lib/typeorm/migration/MigrationExecutor.js.map +1 -1
  646. package/lib/typeorm/migration/MigrationInterface.js.map +1 -1
  647. package/lib/typeorm/naming-strategy/DefaultNamingStrategy.js +80 -84
  648. package/lib/typeorm/naming-strategy/DefaultNamingStrategy.js.map +1 -1
  649. package/lib/typeorm/naming-strategy/NamingStrategyInterface.js.map +1 -1
  650. package/lib/typeorm/persistence/EntityPersistExecutor.js +154 -212
  651. package/lib/typeorm/persistence/EntityPersistExecutor.js.map +1 -1
  652. package/lib/typeorm/persistence/Subject.js +162 -149
  653. package/lib/typeorm/persistence/Subject.js.map +1 -1
  654. package/lib/typeorm/persistence/SubjectChangeMap.js.map +1 -1
  655. package/lib/typeorm/persistence/SubjectChangedColumnsComputer.js +29 -35
  656. package/lib/typeorm/persistence/SubjectChangedColumnsComputer.js.map +1 -1
  657. package/lib/typeorm/persistence/SubjectDatabaseEntityLoader.js +99 -130
  658. package/lib/typeorm/persistence/SubjectDatabaseEntityLoader.js.map +1 -1
  659. package/lib/typeorm/persistence/SubjectExecutor.js +635 -879
  660. package/lib/typeorm/persistence/SubjectExecutor.js.map +1 -1
  661. package/lib/typeorm/persistence/SubjectTopoligicalSorter.js +62 -58
  662. package/lib/typeorm/persistence/SubjectTopoligicalSorter.js.map +1 -1
  663. package/lib/typeorm/persistence/subject-builder/CascadesSubjectBuilder.js +16 -19
  664. package/lib/typeorm/persistence/subject-builder/CascadesSubjectBuilder.js.map +1 -1
  665. package/lib/typeorm/persistence/subject-builder/ManyToManySubjectBuilder.js +50 -53
  666. package/lib/typeorm/persistence/subject-builder/ManyToManySubjectBuilder.js.map +1 -1
  667. package/lib/typeorm/persistence/subject-builder/OneToManySubjectBuilder.js +28 -33
  668. package/lib/typeorm/persistence/subject-builder/OneToManySubjectBuilder.js.map +1 -1
  669. package/lib/typeorm/persistence/subject-builder/OneToOneInverseSideSubjectBuilder.js +19 -20
  670. package/lib/typeorm/persistence/subject-builder/OneToOneInverseSideSubjectBuilder.js.map +1 -1
  671. package/lib/typeorm/persistence/tree/ClosureSubjectExecutor.js +202 -271
  672. package/lib/typeorm/persistence/tree/ClosureSubjectExecutor.js.map +1 -1
  673. package/lib/typeorm/persistence/tree/MaterializedPathSubjectExecutor.js +79 -121
  674. package/lib/typeorm/persistence/tree/MaterializedPathSubjectExecutor.js.map +1 -1
  675. package/lib/typeorm/persistence/tree/NestedSetSubjectExecutor.js +220 -353
  676. package/lib/typeorm/persistence/tree/NestedSetSubjectExecutor.js.map +1 -1
  677. package/lib/typeorm/platform/PlatformTools.js +66 -78
  678. package/lib/typeorm/platform/PlatformTools.js.map +1 -1
  679. package/lib/typeorm/query-builder/Alias.js +31 -32
  680. package/lib/typeorm/query-builder/Alias.js.map +1 -1
  681. package/lib/typeorm/query-builder/Brackets.js +8 -5
  682. package/lib/typeorm/query-builder/Brackets.js.map +1 -1
  683. package/lib/typeorm/query-builder/DeleteQueryBuilder.js +96 -120
  684. package/lib/typeorm/query-builder/DeleteQueryBuilder.js.map +1 -1
  685. package/lib/typeorm/query-builder/InsertOrUpdateOptions.js.map +1 -1
  686. package/lib/typeorm/query-builder/InsertQueryBuilder.js +321 -367
  687. package/lib/typeorm/query-builder/InsertQueryBuilder.js.map +1 -1
  688. package/lib/typeorm/query-builder/JoinAttribute.js +175 -206
  689. package/lib/typeorm/query-builder/JoinAttribute.js.map +1 -1
  690. package/lib/typeorm/query-builder/JoinOptions.js.map +1 -1
  691. package/lib/typeorm/query-builder/NotBrackets.js +4 -11
  692. package/lib/typeorm/query-builder/NotBrackets.js.map +1 -1
  693. package/lib/typeorm/query-builder/QueryBuilder.js +400 -646
  694. package/lib/typeorm/query-builder/QueryBuilder.js.map +1 -1
  695. package/lib/typeorm/query-builder/QueryBuilderCte.js.map +1 -1
  696. package/lib/typeorm/query-builder/QueryBuilderUtils.js +5 -9
  697. package/lib/typeorm/query-builder/QueryBuilderUtils.js.map +1 -1
  698. package/lib/typeorm/query-builder/QueryExpressionMap.js +304 -233
  699. package/lib/typeorm/query-builder/QueryExpressionMap.js.map +1 -1
  700. package/lib/typeorm/query-builder/QueryPartialEntity.js.map +1 -1
  701. package/lib/typeorm/query-builder/RelationIdLoader.js +166 -189
  702. package/lib/typeorm/query-builder/RelationIdLoader.js.map +1 -1
  703. package/lib/typeorm/query-builder/RelationLoader.js +81 -94
  704. package/lib/typeorm/query-builder/RelationLoader.js.map +1 -1
  705. package/lib/typeorm/query-builder/RelationQueryBuilder.js +91 -127
  706. package/lib/typeorm/query-builder/RelationQueryBuilder.js.map +1 -1
  707. package/lib/typeorm/query-builder/RelationRemover.js +121 -124
  708. package/lib/typeorm/query-builder/RelationRemover.js.map +1 -1
  709. package/lib/typeorm/query-builder/RelationUpdater.js +130 -148
  710. package/lib/typeorm/query-builder/RelationUpdater.js.map +1 -1
  711. package/lib/typeorm/query-builder/ReturningResultsEntityUpdator.js +131 -159
  712. package/lib/typeorm/query-builder/ReturningResultsEntityUpdator.js.map +1 -1
  713. package/lib/typeorm/query-builder/SelectQuery.js.map +1 -1
  714. package/lib/typeorm/query-builder/SelectQueryBuilder.js +955 -1211
  715. package/lib/typeorm/query-builder/SelectQueryBuilder.js.map +1 -1
  716. package/lib/typeorm/query-builder/SelectQueryBuilderOption.js.map +1 -1
  717. package/lib/typeorm/query-builder/SoftDeleteQueryBuilder.js +155 -194
  718. package/lib/typeorm/query-builder/SoftDeleteQueryBuilder.js.map +1 -1
  719. package/lib/typeorm/query-builder/UpdateQueryBuilder.js +204 -246
  720. package/lib/typeorm/query-builder/UpdateQueryBuilder.js.map +1 -1
  721. package/lib/typeorm/query-builder/WhereClause.js.map +1 -1
  722. package/lib/typeorm/query-builder/WhereExpressionBuilder.js.map +1 -1
  723. package/lib/typeorm/query-builder/relation-count/RelationCountAttribute.js +85 -98
  724. package/lib/typeorm/query-builder/relation-count/RelationCountAttribute.js.map +1 -1
  725. package/lib/typeorm/query-builder/relation-count/RelationCountLoadResult.js.map +1 -1
  726. package/lib/typeorm/query-builder/relation-count/RelationCountLoader.js +153 -172
  727. package/lib/typeorm/query-builder/relation-count/RelationCountLoader.js.map +1 -1
  728. package/lib/typeorm/query-builder/relation-count/RelationCountMetadataToAttributeTransformer.js +16 -17
  729. package/lib/typeorm/query-builder/relation-count/RelationCountMetadataToAttributeTransformer.js.map +1 -1
  730. package/lib/typeorm/query-builder/relation-id/RelationIdAttribute.js +93 -107
  731. package/lib/typeorm/query-builder/relation-id/RelationIdAttribute.js.map +1 -1
  732. package/lib/typeorm/query-builder/relation-id/RelationIdLoadResult.js.map +1 -1
  733. package/lib/typeorm/query-builder/relation-id/RelationIdLoader.js +259 -267
  734. package/lib/typeorm/query-builder/relation-id/RelationIdLoader.js.map +1 -1
  735. package/lib/typeorm/query-builder/relation-id/RelationIdMetadataToAttributeTransformer.js +16 -17
  736. package/lib/typeorm/query-builder/relation-id/RelationIdMetadataToAttributeTransformer.js.map +1 -1
  737. package/lib/typeorm/query-builder/result/DeleteResult.js +14 -8
  738. package/lib/typeorm/query-builder/result/DeleteResult.js.map +1 -1
  739. package/lib/typeorm/query-builder/result/InsertResult.js +19 -18
  740. package/lib/typeorm/query-builder/result/InsertResult.js.map +1 -1
  741. package/lib/typeorm/query-builder/result/UpdateResult.js +24 -18
  742. package/lib/typeorm/query-builder/result/UpdateResult.js.map +1 -1
  743. package/lib/typeorm/query-builder/transformer/DocumentToEntityTransformer.js +24 -26
  744. package/lib/typeorm/query-builder/transformer/DocumentToEntityTransformer.js.map +1 -1
  745. package/lib/typeorm/query-builder/transformer/PlainObjectToDatabaseEntityTransformer.js +77 -112
  746. package/lib/typeorm/query-builder/transformer/PlainObjectToDatabaseEntityTransformer.js.map +1 -1
  747. package/lib/typeorm/query-builder/transformer/PlainObjectToNewEntityTransformer.js +16 -22
  748. package/lib/typeorm/query-builder/transformer/PlainObjectToNewEntityTransformer.js.map +1 -1
  749. package/lib/typeorm/query-builder/transformer/RawSqlResultsToEntityTransformer.js +117 -132
  750. package/lib/typeorm/query-builder/transformer/RawSqlResultsToEntityTransformer.js.map +1 -1
  751. package/lib/typeorm/query-runner/BaseQueryRunner.js +227 -393
  752. package/lib/typeorm/query-runner/BaseQueryRunner.js.map +1 -1
  753. package/lib/typeorm/query-runner/QueryLock.js +19 -32
  754. package/lib/typeorm/query-runner/QueryLock.js.map +1 -1
  755. package/lib/typeorm/query-runner/QueryResult.js +14 -9
  756. package/lib/typeorm/query-runner/QueryResult.js.map +1 -1
  757. package/lib/typeorm/query-runner/QueryRunner.js.map +1 -1
  758. package/lib/typeorm/repository/AbstractRepository.js +46 -50
  759. package/lib/typeorm/repository/AbstractRepository.js.map +1 -1
  760. package/lib/typeorm/repository/BaseEntity.js +106 -123
  761. package/lib/typeorm/repository/BaseEntity.js.map +1 -1
  762. package/lib/typeorm/repository/EntityId.js.map +1 -1
  763. package/lib/typeorm/repository/FindTreesOptions.js.map +1 -1
  764. package/lib/typeorm/repository/MongoRepository.js +109 -135
  765. package/lib/typeorm/repository/MongoRepository.js.map +1 -1
  766. package/lib/typeorm/repository/RemoveOptions.js.map +1 -1
  767. package/lib/typeorm/repository/Repository.js +108 -140
  768. package/lib/typeorm/repository/Repository.js.map +1 -1
  769. package/lib/typeorm/repository/SaveOptions.js.map +1 -1
  770. package/lib/typeorm/repository/TreeRepository.js +107 -154
  771. package/lib/typeorm/repository/TreeRepository.js.map +1 -1
  772. package/lib/typeorm/repository/UpsertOptions.js.map +1 -1
  773. package/lib/typeorm/schema-builder/MongoSchemaBuilder.js +30 -42
  774. package/lib/typeorm/schema-builder/MongoSchemaBuilder.js.map +1 -1
  775. package/lib/typeorm/schema-builder/RdbmsSchemaBuilder.js +727 -1938
  776. package/lib/typeorm/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
  777. package/lib/typeorm/schema-builder/SchemaBuilder.js.map +1 -1
  778. package/lib/typeorm/schema-builder/options/TableCheckOptions.js.map +1 -1
  779. package/lib/typeorm/schema-builder/options/TableColumnOptions.js.map +1 -1
  780. package/lib/typeorm/schema-builder/options/TableExclusionOptions.js.map +1 -1
  781. package/lib/typeorm/schema-builder/options/TableForeignKeyOptions.js.map +1 -1
  782. package/lib/typeorm/schema-builder/options/TableIndexOptions.js.map +1 -1
  783. package/lib/typeorm/schema-builder/options/TableOptions.js.map +1 -1
  784. package/lib/typeorm/schema-builder/options/TableUniqueOptions.js.map +1 -1
  785. package/lib/typeorm/schema-builder/options/ViewOptions.js.map +1 -1
  786. package/lib/typeorm/schema-builder/table/Table.js +160 -157
  787. package/lib/typeorm/schema-builder/table/Table.js.map +1 -1
  788. package/lib/typeorm/schema-builder/table/TableCheck.js +24 -15
  789. package/lib/typeorm/schema-builder/table/TableCheck.js.map +1 -1
  790. package/lib/typeorm/schema-builder/table/TableColumn.js +123 -41
  791. package/lib/typeorm/schema-builder/table/TableColumn.js.map +1 -1
  792. package/lib/typeorm/schema-builder/table/TableExclusion.js +19 -9
  793. package/lib/typeorm/schema-builder/table/TableExclusion.js.map +1 -1
  794. package/lib/typeorm/schema-builder/table/TableForeignKey.js +52 -20
  795. package/lib/typeorm/schema-builder/table/TableForeignKey.js.map +1 -1
  796. package/lib/typeorm/schema-builder/table/TableIndex.js +52 -16
  797. package/lib/typeorm/schema-builder/table/TableIndex.js.map +1 -1
  798. package/lib/typeorm/schema-builder/table/TableUnique.js +26 -16
  799. package/lib/typeorm/schema-builder/table/TableUnique.js.map +1 -1
  800. package/lib/typeorm/schema-builder/util/TableUtils.js +5 -8
  801. package/lib/typeorm/schema-builder/util/TableUtils.js.map +1 -1
  802. package/lib/typeorm/schema-builder/util/ViewUtils.js +4 -7
  803. package/lib/typeorm/schema-builder/util/ViewUtils.js.map +1 -1
  804. package/lib/typeorm/schema-builder/view/View.js +32 -10
  805. package/lib/typeorm/schema-builder/view/View.js.map +1 -1
  806. package/lib/typeorm/subscriber/Broadcaster.js +180 -216
  807. package/lib/typeorm/subscriber/Broadcaster.js.map +1 -1
  808. package/lib/typeorm/subscriber/BroadcasterResult.js +16 -29
  809. package/lib/typeorm/subscriber/BroadcasterResult.js.map +1 -1
  810. package/lib/typeorm/subscriber/EntitySubscriberInterface.js.map +1 -1
  811. package/lib/typeorm/subscriber/event/InsertEvent.js.map +1 -1
  812. package/lib/typeorm/subscriber/event/LoadEvent.js.map +1 -1
  813. package/lib/typeorm/subscriber/event/RecoverEvent.js.map +1 -1
  814. package/lib/typeorm/subscriber/event/RemoveEvent.js.map +1 -1
  815. package/lib/typeorm/subscriber/event/SoftRemoveEvent.js.map +1 -1
  816. package/lib/typeorm/subscriber/event/TransactionCommitEvent.js.map +1 -1
  817. package/lib/typeorm/subscriber/event/TransactionRollbackEvent.js.map +1 -1
  818. package/lib/typeorm/subscriber/event/TransactionStartEvent.js.map +1 -1
  819. package/lib/typeorm/subscriber/event/UpdateEvent.js.map +1 -1
  820. package/lib/typeorm/util/ApplyValueTransformers.js +9 -12
  821. package/lib/typeorm/util/ApplyValueTransformers.js.map +1 -1
  822. package/lib/typeorm/util/DateUtils.js +44 -53
  823. package/lib/typeorm/util/DateUtils.js.map +1 -1
  824. package/lib/typeorm/util/DepGraph.js +50 -53
  825. package/lib/typeorm/util/DepGraph.js.map +1 -1
  826. package/lib/typeorm/util/DirectoryExportedClassesLoader.js +48 -70
  827. package/lib/typeorm/util/DirectoryExportedClassesLoader.js.map +1 -1
  828. package/lib/typeorm/util/ImportUtils.js +43 -65
  829. package/lib/typeorm/util/ImportUtils.js.map +1 -1
  830. package/lib/typeorm/util/InstanceChecker.js +64 -67
  831. package/lib/typeorm/util/InstanceChecker.js.map +1 -1
  832. package/lib/typeorm/util/ObjectUtils.js +13 -42
  833. package/lib/typeorm/util/ObjectUtils.js.map +1 -1
  834. package/lib/typeorm/util/OrmUtils.js +91 -158
  835. package/lib/typeorm/util/OrmUtils.js.map +1 -1
  836. package/lib/typeorm/util/PathUtils.js +8 -8
  837. package/lib/typeorm/util/PathUtils.js.map +1 -1
  838. package/lib/typeorm/util/RandomGenerator.js +22 -25
  839. package/lib/typeorm/util/RandomGenerator.js.map +1 -1
  840. package/lib/typeorm/util/StringUtils.js +17 -21
  841. package/lib/typeorm/util/StringUtils.js.map +1 -1
  842. package/lib/typeorm/util/TreeRepositoryUtils.js +27 -30
  843. package/lib/typeorm/util/TreeRepositoryUtils.js.map +1 -1
  844. package/lib/typeorm/util/VersionUtils.js +9 -13
  845. package/lib/typeorm/util/VersionUtils.js.map +1 -1
  846. package/lib/typeorm/util/escapeRegExp.js +2 -2
  847. package/lib/typeorm/util/escapeRegExp.js.map +1 -1
  848. package/migrations/index.js +15 -2
  849. package/migrations/index.js.map +1 -1
  850. package/migrations/migrations_index._auto-generated_.d.ts +1 -0
  851. package/migrations/migrations_index._auto-generated_.js.map +1 -1
  852. package/package.json +8 -44
  853. package/src.d.ts +1 -1
  854. package/taon.jsonc +3 -30
  855. package/tmp-environment.json +8 -370
  856. package/websql/esm2022/lib/typeorm/driver/cordova/CordovaDriver.mjs +1 -1
  857. package/websql/esm2022/lib/typeorm/driver/cordova/CordovaQueryRunner.mjs +1 -1
  858. package/websql/esm2022/lib/typeorm/driver/nativescript/NativescriptDriver.mjs +1 -1
  859. package/websql/esm2022/lib/typeorm/driver/nativescript/NativescriptQueryRunner.mjs +1 -1
  860. package/websql/esm2022/lib/typeorm/driver/react-native/ReactNativeDriver.mjs +1 -1
  861. package/websql/esm2022/lib/typeorm/driver/react-native/ReactNativeQueryRunner.mjs +1 -1
  862. package/websql/esm2022/lib/typeorm/driver/sqljs/SqljsDriver.mjs +1 -1
  863. package/websql/esm2022/lib/typeorm/driver/sqljs/SqljsQueryRunner.mjs +1 -1
  864. package/websql/esm2022/lib/typeorm/index.mjs +1 -3
  865. package/websql/fesm2022/taon-typeorm.mjs.map +1 -1
  866. package/browser/package.json +0 -25
  867. package/websql/package.json +0 -25
@@ -1,36 +1,52 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MigrationExecutor = void 0;
4
- var tslib_1 = require("tslib");
5
- var Table_1 = require("../schema-builder/table/Table");
6
- var Migration_1 = require("./Migration");
4
+ const Table_1 = require("../schema-builder/table/Table");
5
+ const Migration_1 = require("./Migration");
7
6
  //#region @backend
8
- var MssqlParameter_1 = require("../driver/sqlserver/MssqlParameter");
7
+ const MssqlParameter_1 = require("../driver/sqlserver/MssqlParameter");
9
8
  //#endregion
10
- var error_1 = require("../error");
11
- var InstanceChecker_1 = require("../util/InstanceChecker");
9
+ const error_1 = require("../error");
10
+ const InstanceChecker_1 = require("../util/InstanceChecker");
12
11
  /**
13
12
  * Executes migrations: runs pending and reverts previously executed migrations.
14
13
  */
15
- var MigrationExecutor = /** @class */ (function () {
14
+ class MigrationExecutor {
15
+ connection;
16
+ queryRunner;
17
+ // -------------------------------------------------------------------------
18
+ // Public Properties
19
+ // -------------------------------------------------------------------------
20
+ /**
21
+ * Indicates how migrations should be run in transactions.
22
+ * all: all migrations are run in a single transaction
23
+ * none: all migrations are run without a transaction
24
+ * each: each migration is run in a separate transaction
25
+ */
26
+ transaction = "all";
27
+ /**
28
+ * Option to fake-run or fake-revert a migration, adding to the
29
+ * executed migrations table, but not actually running it. This feature is
30
+ * useful for when migrations are added after the fact or for
31
+ * interoperability between applications which are desired to each keep
32
+ * a consistent migration history.
33
+ */
34
+ fake;
35
+ // -------------------------------------------------------------------------
36
+ // Private Properties
37
+ // -------------------------------------------------------------------------
38
+ migrationsDatabase;
39
+ migrationsSchema;
40
+ migrationsTable;
41
+ migrationsTableName;
16
42
  // -------------------------------------------------------------------------
17
43
  // Constructor
18
44
  // -------------------------------------------------------------------------
19
- function MigrationExecutor(connection, queryRunner) {
45
+ constructor(connection, queryRunner) {
20
46
  this.connection = connection;
21
47
  this.queryRunner = queryRunner;
22
- // -------------------------------------------------------------------------
23
- // Public Properties
24
- // -------------------------------------------------------------------------
25
- /**
26
- * Indicates how migrations should be run in transactions.
27
- * all: all migrations are run in a single transaction
28
- * none: all migrations are run without a transaction
29
- * each: each migration is run in a separate transaction
30
- */
31
- this.transaction = "all";
32
- var schema = this.connection.driver.options.schema;
33
- var database = this.connection.driver.database;
48
+ const { schema } = this.connection.driver.options;
49
+ const database = this.connection.driver.database;
34
50
  this.migrationsDatabase = database;
35
51
  this.migrationsSchema = schema;
36
52
  this.migrationsTableName =
@@ -43,742 +59,467 @@ var MigrationExecutor = /** @class */ (function () {
43
59
  /**
44
60
  * Tries to execute a single migration given.
45
61
  */
46
- MigrationExecutor.prototype.executeMigration = function (migration) {
47
- return tslib_1.__awaiter(this, void 0, void 0, function () {
48
- var _this = this;
49
- return tslib_1.__generator(this, function (_a) {
50
- return [2 /*return*/, this.withQueryRunner(function (queryRunner) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
51
- var schemaBuilder;
52
- return tslib_1.__generator(this, function (_a) {
53
- switch (_a.label) {
54
- case 0: return [4 /*yield*/, this.createMigrationsTableIfNotExist(queryRunner)
55
- // create typeorm_metadata table if it's not created yet
56
- ];
57
- case 1:
58
- _a.sent();
59
- schemaBuilder = this.connection.driver.createSchemaBuilder();
60
- if (!InstanceChecker_1.InstanceChecker.isRdbmsSchemaBuilder(schemaBuilder)) return [3 /*break*/, 3];
61
- return [4 /*yield*/, schemaBuilder.createMetadataTableIfNecessary(queryRunner)];
62
- case 2:
63
- _a.sent();
64
- _a.label = 3;
65
- case 3: return [4 /*yield*/, queryRunner.beforeMigration()];
66
- case 4:
67
- _a.sent();
68
- return [4 /*yield*/, migration.instance.up(queryRunner)];
69
- case 5:
70
- _a.sent();
71
- return [4 /*yield*/, queryRunner.afterMigration()];
72
- case 6:
73
- _a.sent();
74
- return [4 /*yield*/, this.insertExecutedMigration(queryRunner, migration)];
75
- case 7:
76
- _a.sent();
77
- return [2 /*return*/, migration];
78
- }
79
- });
80
- }); })];
81
- });
62
+ async executeMigration(migration) {
63
+ return this.withQueryRunner(async (queryRunner) => {
64
+ await this.createMigrationsTableIfNotExist(queryRunner);
65
+ // create typeorm_metadata table if it's not created yet
66
+ const schemaBuilder = this.connection.driver.createSchemaBuilder();
67
+ if (InstanceChecker_1.InstanceChecker.isRdbmsSchemaBuilder(schemaBuilder)) {
68
+ await schemaBuilder.createMetadataTableIfNecessary(queryRunner);
69
+ }
70
+ await queryRunner.beforeMigration();
71
+ await migration.instance.up(queryRunner);
72
+ await queryRunner.afterMigration();
73
+ await this.insertExecutedMigration(queryRunner, migration);
74
+ return migration;
82
75
  });
83
- };
76
+ }
84
77
  /**
85
78
  * Returns an array of all migrations.
86
79
  */
87
- MigrationExecutor.prototype.getAllMigrations = function () {
88
- return tslib_1.__awaiter(this, void 0, void 0, function () {
89
- return tslib_1.__generator(this, function (_a) {
90
- return [2 /*return*/, Promise.resolve(this.getMigrations())];
91
- });
92
- });
93
- };
80
+ async getAllMigrations() {
81
+ return Promise.resolve(this.getMigrations());
82
+ }
94
83
  /**
95
84
  * Returns an array of all executed migrations.
96
85
  */
97
- MigrationExecutor.prototype.getExecutedMigrations = function () {
98
- return tslib_1.__awaiter(this, void 0, void 0, function () {
99
- var _this = this;
100
- return tslib_1.__generator(this, function (_a) {
101
- return [2 /*return*/, this.withQueryRunner(function (queryRunner) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
102
- return tslib_1.__generator(this, function (_a) {
103
- switch (_a.label) {
104
- case 0: return [4 /*yield*/, this.createMigrationsTableIfNotExist(queryRunner)];
105
- case 1:
106
- _a.sent();
107
- return [4 /*yield*/, this.loadExecutedMigrations(queryRunner)];
108
- case 2: return [2 /*return*/, _a.sent()];
109
- }
110
- });
111
- }); })];
112
- });
86
+ async getExecutedMigrations() {
87
+ return this.withQueryRunner(async (queryRunner) => {
88
+ await this.createMigrationsTableIfNotExist(queryRunner);
89
+ return await this.loadExecutedMigrations(queryRunner);
113
90
  });
114
- };
91
+ }
115
92
  /**
116
93
  * Returns an array of all pending migrations.
117
94
  */
118
- MigrationExecutor.prototype.getPendingMigrations = function () {
119
- return tslib_1.__awaiter(this, void 0, void 0, function () {
120
- var allMigrations, executedMigrations;
121
- return tslib_1.__generator(this, function (_a) {
122
- switch (_a.label) {
123
- case 0: return [4 /*yield*/, this.getAllMigrations()];
124
- case 1:
125
- allMigrations = _a.sent();
126
- return [4 /*yield*/, this.getExecutedMigrations()];
127
- case 2:
128
- executedMigrations = _a.sent();
129
- return [2 /*return*/, allMigrations.filter(function (migration) {
130
- return !executedMigrations.find(function (executedMigration) {
131
- return executedMigration.name === migration.name;
132
- });
133
- })];
134
- }
135
- });
136
- });
137
- };
95
+ async getPendingMigrations() {
96
+ const allMigrations = await this.getAllMigrations();
97
+ const executedMigrations = await this.getExecutedMigrations();
98
+ return allMigrations.filter((migration) => !executedMigrations.find((executedMigration) => executedMigration.name === migration.name));
99
+ }
138
100
  /**
139
101
  * Inserts an executed migration.
140
102
  */
141
- MigrationExecutor.prototype.insertMigration = function (migration) {
142
- var _this = this;
143
- return this.withQueryRunner(function (q) {
144
- return _this.insertExecutedMigration(q, migration);
145
- });
146
- };
103
+ insertMigration(migration) {
104
+ return this.withQueryRunner((q) => this.insertExecutedMigration(q, migration));
105
+ }
147
106
  /**
148
107
  * Deletes an executed migration.
149
108
  */
150
- MigrationExecutor.prototype.deleteMigration = function (migration) {
151
- var _this = this;
152
- return this.withQueryRunner(function (q) {
153
- return _this.deleteExecutedMigration(q, migration);
154
- });
155
- };
109
+ deleteMigration(migration) {
110
+ return this.withQueryRunner((q) => this.deleteExecutedMigration(q, migration));
111
+ }
156
112
  /**
157
113
  * Lists all migrations and whether they have been executed or not
158
114
  * returns true if there are unapplied migrations
159
115
  */
160
- MigrationExecutor.prototype.showMigrations = function () {
161
- return tslib_1.__awaiter(this, void 0, void 0, function () {
162
- var hasUnappliedMigrations, queryRunner, executedMigrations, allMigrations, _loop_1, this_1, allMigrations_1, allMigrations_1_1, migration;
163
- var e_1, _a;
164
- return tslib_1.__generator(this, function (_b) {
165
- switch (_b.label) {
166
- case 0:
167
- hasUnappliedMigrations = false;
168
- queryRunner = this.queryRunner || this.connection.createQueryRunner();
169
- // create migrations table if its not created yet
170
- return [4 /*yield*/, this.createMigrationsTableIfNotExist(queryRunner)
171
- // get all migrations that are executed and saved in the database
172
- ];
173
- case 1:
174
- // create migrations table if its not created yet
175
- _b.sent();
176
- return [4 /*yield*/, this.loadExecutedMigrations(queryRunner)
177
- // get all user's migrations in the source code
178
- ];
179
- case 2:
180
- executedMigrations = _b.sent();
181
- allMigrations = this.getMigrations();
182
- _loop_1 = function (migration) {
183
- var executedMigration = executedMigrations.find(function (executedMigration) {
184
- return executedMigration.name === migration.name;
185
- });
186
- if (executedMigration) {
187
- this_1.connection.logger.logSchemaBuild("[X] ".concat(migration.name));
188
- }
189
- else {
190
- hasUnappliedMigrations = true;
191
- this_1.connection.logger.logSchemaBuild("[ ] ".concat(migration.name));
192
- }
193
- };
194
- this_1 = this;
195
- try {
196
- for (allMigrations_1 = tslib_1.__values(allMigrations), allMigrations_1_1 = allMigrations_1.next(); !allMigrations_1_1.done; allMigrations_1_1 = allMigrations_1.next()) {
197
- migration = allMigrations_1_1.value;
198
- _loop_1(migration);
199
- }
200
- }
201
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
202
- finally {
203
- try {
204
- if (allMigrations_1_1 && !allMigrations_1_1.done && (_a = allMigrations_1.return)) _a.call(allMigrations_1);
205
- }
206
- finally { if (e_1) throw e_1.error; }
207
- }
208
- if (!!this.queryRunner) return [3 /*break*/, 4];
209
- return [4 /*yield*/, queryRunner.release()];
210
- case 3:
211
- _b.sent();
212
- _b.label = 4;
213
- case 4: return [2 /*return*/, hasUnappliedMigrations];
214
- }
215
- });
216
- });
217
- };
116
+ async showMigrations() {
117
+ let hasUnappliedMigrations = false;
118
+ const queryRunner = this.queryRunner || this.connection.createQueryRunner();
119
+ // create migrations table if its not created yet
120
+ await this.createMigrationsTableIfNotExist(queryRunner);
121
+ // get all migrations that are executed and saved in the database
122
+ const executedMigrations = await this.loadExecutedMigrations(queryRunner);
123
+ // get all user's migrations in the source code
124
+ const allMigrations = this.getMigrations();
125
+ for (const migration of allMigrations) {
126
+ const executedMigration = executedMigrations.find((executedMigration) => executedMigration.name === migration.name);
127
+ if (executedMigration) {
128
+ this.connection.logger.logSchemaBuild(`[X] ${migration.name}`);
129
+ }
130
+ else {
131
+ hasUnappliedMigrations = true;
132
+ this.connection.logger.logSchemaBuild(`[ ] ${migration.name}`);
133
+ }
134
+ }
135
+ // if query runner was created by us then release it
136
+ if (!this.queryRunner) {
137
+ await queryRunner.release();
138
+ }
139
+ return hasUnappliedMigrations;
140
+ }
218
141
  /**
219
142
  * Executes all pending migrations. Pending migrations are migrations that are not yet executed,
220
143
  * thus not saved in the database.
221
144
  */
222
- MigrationExecutor.prototype.executePendingMigrations = function () {
223
- return tslib_1.__awaiter(this, void 0, void 0, function () {
224
- var queryRunner, schemaBuilder, executedMigrations, lastTimeExecutedMigration, allMigrations, successMigrations, pendingMigrations, transactionStartedByUs, _loop_2, this_2, pendingMigrations_1, pendingMigrations_1_1, migration, e_2_1, err_1, rollbackError_1;
225
- var e_2, _a;
226
- var _this = this;
227
- return tslib_1.__generator(this, function (_b) {
228
- switch (_b.label) {
229
- case 0:
230
- queryRunner = this.queryRunner || this.connection.createQueryRunner();
231
- // create migrations table if it's not created yet
232
- return [4 /*yield*/, this.createMigrationsTableIfNotExist(queryRunner)
233
- // create the typeorm_metadata table if it's not created yet
234
- ];
235
- case 1:
236
- // create migrations table if it's not created yet
237
- _b.sent();
238
- schemaBuilder = this.connection.driver.createSchemaBuilder();
239
- if (!InstanceChecker_1.InstanceChecker.isRdbmsSchemaBuilder(schemaBuilder)) return [3 /*break*/, 3];
240
- return [4 /*yield*/, schemaBuilder.createMetadataTableIfNecessary(queryRunner)];
241
- case 2:
242
- _b.sent();
243
- _b.label = 3;
244
- case 3: return [4 /*yield*/, this.loadExecutedMigrations(queryRunner)
245
- // get the time when last migration was executed
246
- ];
247
- case 4:
248
- executedMigrations = _b.sent();
249
- lastTimeExecutedMigration = this.getLatestTimestampMigration(executedMigrations);
250
- allMigrations = this.getMigrations();
251
- successMigrations = [];
252
- pendingMigrations = allMigrations.filter(function (migration) {
253
- // check if we already have executed migration
254
- var executedMigration = executedMigrations.find(function (executedMigration) {
255
- return executedMigration.name === migration.name;
256
- });
257
- if (executedMigration)
258
- return false;
259
- // migration is new and not executed. now check if its timestamp is correct
260
- // if (lastTimeExecutedMigration && migration.timestamp < lastTimeExecutedMigration.timestamp)
261
- // 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.`);
262
- // every check is passed means that migration was not run yet and we need to run it
263
- return true;
264
- });
265
- if (!!pendingMigrations.length) return [3 /*break*/, 7];
266
- this.connection.logger.logSchemaBuild("No migrations are pending");
267
- if (!!this.queryRunner) return [3 /*break*/, 6];
268
- return [4 /*yield*/, queryRunner.release()];
269
- case 5:
270
- _b.sent();
271
- _b.label = 6;
272
- case 6: return [2 /*return*/, []];
273
- case 7:
274
- // log information about migration execution
275
- this.connection.logger.logSchemaBuild("".concat(executedMigrations.length, " migrations are already loaded in the database."));
276
- this.connection.logger.logSchemaBuild("".concat(allMigrations.length, " migrations were found in the source code."));
277
- if (lastTimeExecutedMigration)
278
- this.connection.logger.logSchemaBuild("".concat(lastTimeExecutedMigration.name, " is the last executed migration. It was executed on ").concat(new Date(lastTimeExecutedMigration.timestamp).toString(), "."));
279
- this.connection.logger.logSchemaBuild("".concat(pendingMigrations.length, " migrations are new migrations must be executed."));
280
- transactionStartedByUs = false;
281
- if (!(this.transaction === "all" && !queryRunner.isTransactionActive)) return [3 /*break*/, 9];
282
- return [4 /*yield*/, queryRunner.startTransaction()];
283
- case 8:
284
- _b.sent();
285
- transactionStartedByUs = true;
286
- _b.label = 9;
287
- case 9:
288
- _b.trys.push([9, 20, 25, 28]);
289
- _loop_2 = function (migration) {
290
- return tslib_1.__generator(this, function (_c) {
291
- switch (_c.label) {
292
- case 0:
293
- if (!this_2.fake) return [3 /*break*/, 2];
294
- // directly insert migration record into the database if it is fake
295
- return [4 /*yield*/, this_2.insertExecutedMigration(queryRunner, migration)
296
- // nothing else needs to be done, continue to next migration
297
- ];
298
- case 1:
299
- // directly insert migration record into the database if it is fake
300
- _c.sent();
301
- return [2 /*return*/, "continue"];
302
- case 2:
303
- if (!(this_2.transaction === "each" &&
304
- !queryRunner.isTransactionActive)) return [3 /*break*/, 4];
305
- return [4 /*yield*/, queryRunner.startTransaction()];
306
- case 3:
307
- _c.sent();
308
- transactionStartedByUs = true;
309
- _c.label = 4;
310
- case 4: return [4 /*yield*/, migration
311
- .instance.up(queryRunner)
312
- .catch(function (error) {
313
- // informative log about migration failure
314
- _this.connection.logger.logMigration("Migration \"".concat(migration.name, "\" failed, error: ").concat(error === null || error === void 0 ? void 0 : error.message));
315
- throw error;
316
- })
317
- .then(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
318
- return tslib_1.__generator(this, function (_a) {
319
- switch (_a.label) {
320
- case 0:
321
- // now when migration is executed we need to insert record about it into the database
322
- return [4 /*yield*/, this.insertExecutedMigration(queryRunner, migration)
323
- // commit transaction if we started it
324
- ];
325
- case 1:
326
- // now when migration is executed we need to insert record about it into the database
327
- _a.sent();
328
- if (!(this.transaction === "each" &&
329
- transactionStartedByUs)) return [3 /*break*/, 3];
330
- return [4 /*yield*/, queryRunner.commitTransaction()];
331
- case 2:
332
- _a.sent();
333
- _a.label = 3;
334
- case 3: return [2 /*return*/];
335
- }
336
- });
337
- }); })
338
- .then(function () {
339
- // informative log about migration success
340
- successMigrations.push(migration);
341
- _this.connection.logger.logSchemaBuild("Migration ".concat(migration.name, " has been ").concat(_this.fake ? "(fake)" : "", " executed successfully."));
342
- })];
343
- case 5:
344
- _c.sent();
345
- return [2 /*return*/];
346
- }
347
- });
348
- };
349
- this_2 = this;
350
- _b.label = 10;
351
- case 10:
352
- _b.trys.push([10, 15, 16, 17]);
353
- pendingMigrations_1 = tslib_1.__values(pendingMigrations), pendingMigrations_1_1 = pendingMigrations_1.next();
354
- _b.label = 11;
355
- case 11:
356
- if (!!pendingMigrations_1_1.done) return [3 /*break*/, 14];
357
- migration = pendingMigrations_1_1.value;
358
- return [5 /*yield**/, _loop_2(migration)];
359
- case 12:
360
- _b.sent();
361
- _b.label = 13;
362
- case 13:
363
- pendingMigrations_1_1 = pendingMigrations_1.next();
364
- return [3 /*break*/, 11];
365
- case 14: return [3 /*break*/, 17];
366
- case 15:
367
- e_2_1 = _b.sent();
368
- e_2 = { error: e_2_1 };
369
- return [3 /*break*/, 17];
370
- case 16:
371
- try {
372
- if (pendingMigrations_1_1 && !pendingMigrations_1_1.done && (_a = pendingMigrations_1.return)) _a.call(pendingMigrations_1);
373
- }
374
- finally { if (e_2) throw e_2.error; }
375
- return [7 /*endfinally*/];
376
- case 17:
377
- if (!(this.transaction === "all" && transactionStartedByUs)) return [3 /*break*/, 19];
378
- return [4 /*yield*/, queryRunner.commitTransaction()];
379
- case 18:
380
- _b.sent();
381
- _b.label = 19;
382
- case 19: return [3 /*break*/, 28];
383
- case 20:
384
- err_1 = _b.sent();
385
- if (!transactionStartedByUs) return [3 /*break*/, 24];
386
- _b.label = 21;
387
- case 21:
388
- _b.trys.push([21, 23, , 24]);
389
- // we throw original error even if rollback thrown an error
390
- return [4 /*yield*/, queryRunner.rollbackTransaction()];
391
- case 22:
392
- // we throw original error even if rollback thrown an error
393
- _b.sent();
394
- return [3 /*break*/, 24];
395
- case 23:
396
- rollbackError_1 = _b.sent();
397
- return [3 /*break*/, 24];
398
- case 24: throw err_1;
399
- case 25:
400
- if (!!this.queryRunner) return [3 /*break*/, 27];
401
- return [4 /*yield*/, queryRunner.release()];
402
- case 26:
403
- _b.sent();
404
- _b.label = 27;
405
- case 27: return [7 /*endfinally*/];
406
- case 28: return [2 /*return*/, successMigrations];
407
- }
408
- });
145
+ async executePendingMigrations() {
146
+ const queryRunner = this.queryRunner || this.connection.createQueryRunner();
147
+ // create migrations table if it's not created yet
148
+ await this.createMigrationsTableIfNotExist(queryRunner);
149
+ // create the typeorm_metadata table if it's not created yet
150
+ const schemaBuilder = this.connection.driver.createSchemaBuilder();
151
+ if (InstanceChecker_1.InstanceChecker.isRdbmsSchemaBuilder(schemaBuilder)) {
152
+ await schemaBuilder.createMetadataTableIfNecessary(queryRunner);
153
+ }
154
+ // get all migrations that are executed and saved in the database
155
+ const executedMigrations = await this.loadExecutedMigrations(queryRunner);
156
+ // get the time when last migration was executed
157
+ let lastTimeExecutedMigration = this.getLatestTimestampMigration(executedMigrations);
158
+ // get all user's migrations in the source code
159
+ const allMigrations = this.getMigrations();
160
+ // variable to store all migrations we did successfully
161
+ const successMigrations = [];
162
+ // find all migrations that needs to be executed
163
+ const pendingMigrations = allMigrations.filter((migration) => {
164
+ // check if we already have executed migration
165
+ const executedMigration = executedMigrations.find((executedMigration) => executedMigration.name === migration.name);
166
+ if (executedMigration)
167
+ return false;
168
+ // migration is new and not executed. now check if its timestamp is correct
169
+ // if (lastTimeExecutedMigration && migration.timestamp < lastTimeExecutedMigration.timestamp)
170
+ // 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.`);
171
+ // every check is passed means that migration was not run yet and we need to run it
172
+ return true;
409
173
  });
410
- };
174
+ // if no migrations are pending then nothing to do here
175
+ if (!pendingMigrations.length) {
176
+ this.connection.logger.logSchemaBuild(`No migrations are pending`);
177
+ // if query runner was created by us then release it
178
+ if (!this.queryRunner)
179
+ await queryRunner.release();
180
+ return [];
181
+ }
182
+ // log information about migration execution
183
+ this.connection.logger.logSchemaBuild(`${executedMigrations.length} migrations are already loaded in the database.`);
184
+ this.connection.logger.logSchemaBuild(`${allMigrations.length} migrations were found in the source code.`);
185
+ if (lastTimeExecutedMigration)
186
+ this.connection.logger.logSchemaBuild(`${lastTimeExecutedMigration.name} is the last executed migration. It was executed on ${new Date(lastTimeExecutedMigration.timestamp).toString()}.`);
187
+ this.connection.logger.logSchemaBuild(`${pendingMigrations.length} migrations are new migrations must be executed.`);
188
+ // start transaction if its not started yet
189
+ let transactionStartedByUs = false;
190
+ if (this.transaction === "all" && !queryRunner.isTransactionActive) {
191
+ await queryRunner.startTransaction();
192
+ transactionStartedByUs = true;
193
+ }
194
+ // run all pending migrations in a sequence
195
+ try {
196
+ for (const migration of pendingMigrations) {
197
+ if (this.fake) {
198
+ // directly insert migration record into the database if it is fake
199
+ await this.insertExecutedMigration(queryRunner, migration);
200
+ // nothing else needs to be done, continue to next migration
201
+ continue;
202
+ }
203
+ if (this.transaction === "each" &&
204
+ !queryRunner.isTransactionActive) {
205
+ await queryRunner.startTransaction();
206
+ transactionStartedByUs = true;
207
+ }
208
+ await migration
209
+ .instance.up(queryRunner)
210
+ .catch((error) => {
211
+ // informative log about migration failure
212
+ this.connection.logger.logMigration(`Migration "${migration.name}" failed, error: ${error?.message}`);
213
+ throw error;
214
+ })
215
+ .then(async () => {
216
+ // now when migration is executed we need to insert record about it into the database
217
+ await this.insertExecutedMigration(queryRunner, migration);
218
+ // commit transaction if we started it
219
+ if (this.transaction === "each" &&
220
+ transactionStartedByUs)
221
+ await queryRunner.commitTransaction();
222
+ })
223
+ .then(() => {
224
+ // informative log about migration success
225
+ successMigrations.push(migration);
226
+ this.connection.logger.logSchemaBuild(`Migration ${migration.name} has been ${this.fake ? "(fake)" : ""} executed successfully.`);
227
+ });
228
+ }
229
+ // commit transaction if we started it
230
+ if (this.transaction === "all" && transactionStartedByUs)
231
+ await queryRunner.commitTransaction();
232
+ }
233
+ catch (err) {
234
+ // rollback transaction if we started it
235
+ if (transactionStartedByUs) {
236
+ try {
237
+ // we throw original error even if rollback thrown an error
238
+ await queryRunner.rollbackTransaction();
239
+ }
240
+ catch (rollbackError) { }
241
+ }
242
+ throw err;
243
+ }
244
+ finally {
245
+ // if query runner was created by us then release it
246
+ if (!this.queryRunner)
247
+ await queryRunner.release();
248
+ }
249
+ return successMigrations;
250
+ }
411
251
  /**
412
252
  * Reverts last migration that were run.
413
253
  */
414
- MigrationExecutor.prototype.undoLastMigration = function () {
415
- return tslib_1.__awaiter(this, void 0, void 0, function () {
416
- var queryRunner, schemaBuilder, executedMigrations, lastTimeExecutedMigration, allMigrations, migrationToRevert, transactionStartedByUs, err_2, rollbackError_2;
417
- return tslib_1.__generator(this, function (_a) {
418
- switch (_a.label) {
419
- case 0:
420
- queryRunner = this.queryRunner || this.connection.createQueryRunner();
421
- // create migrations table if it's not created yet
422
- return [4 /*yield*/, this.createMigrationsTableIfNotExist(queryRunner)
423
- // create typeorm_metadata table if it's not created yet
424
- ];
425
- case 1:
426
- // create migrations table if it's not created yet
427
- _a.sent();
428
- schemaBuilder = this.connection.driver.createSchemaBuilder();
429
- if (!InstanceChecker_1.InstanceChecker.isRdbmsSchemaBuilder(schemaBuilder)) return [3 /*break*/, 3];
430
- return [4 /*yield*/, schemaBuilder.createMetadataTableIfNecessary(queryRunner)];
431
- case 2:
432
- _a.sent();
433
- _a.label = 3;
434
- case 3: return [4 /*yield*/, this.loadExecutedMigrations(queryRunner)
435
- // get the time when last migration was executed
436
- ];
437
- case 4:
438
- executedMigrations = _a.sent();
439
- lastTimeExecutedMigration = this.getLatestExecutedMigration(executedMigrations);
440
- // if no migrations found in the database then nothing to revert
441
- if (!lastTimeExecutedMigration) {
442
- this.connection.logger.logSchemaBuild("No migrations was found in the database. Nothing to revert!");
443
- return [2 /*return*/];
444
- }
445
- allMigrations = this.getMigrations();
446
- migrationToRevert = allMigrations.find(function (migration) { return migration.name === lastTimeExecutedMigration.name; });
447
- // if no migrations found in the database then nothing to revert
448
- if (!migrationToRevert)
449
- throw new error_1.TypeORMError("No migration ".concat(lastTimeExecutedMigration.name, " was found in the source code. Make sure you have this migration in your codebase and its included in the connection options."));
450
- // log information about migration execution
451
- this.connection.logger.logSchemaBuild("".concat(executedMigrations.length, " migrations are already loaded in the database."));
452
- this.connection.logger.logSchemaBuild("".concat(lastTimeExecutedMigration.name, " is the last executed migration. It was executed on ").concat(new Date(lastTimeExecutedMigration.timestamp).toString(), "."));
453
- this.connection.logger.logSchemaBuild("Now reverting it...");
454
- transactionStartedByUs = false;
455
- if (!(this.transaction !== "none" && !queryRunner.isTransactionActive)) return [3 /*break*/, 6];
456
- return [4 /*yield*/, queryRunner.startTransaction()];
457
- case 5:
458
- _a.sent();
459
- transactionStartedByUs = true;
460
- _a.label = 6;
461
- case 6:
462
- _a.trys.push([6, 14, 19, 22]);
463
- if (!!this.fake) return [3 /*break*/, 10];
464
- return [4 /*yield*/, queryRunner.beforeMigration()];
465
- case 7:
466
- _a.sent();
467
- return [4 /*yield*/, migrationToRevert.instance.down(queryRunner)];
468
- case 8:
469
- _a.sent();
470
- return [4 /*yield*/, queryRunner.afterMigration()];
471
- case 9:
472
- _a.sent();
473
- _a.label = 10;
474
- case 10: return [4 /*yield*/, this.deleteExecutedMigration(queryRunner, migrationToRevert)];
475
- case 11:
476
- _a.sent();
477
- this.connection.logger.logSchemaBuild("Migration ".concat(migrationToRevert.name, " has been ").concat(this.fake ? "(fake)" : "", " reverted successfully."));
478
- if (!transactionStartedByUs) return [3 /*break*/, 13];
479
- return [4 /*yield*/, queryRunner.commitTransaction()];
480
- case 12:
481
- _a.sent();
482
- _a.label = 13;
483
- case 13: return [3 /*break*/, 22];
484
- case 14:
485
- err_2 = _a.sent();
486
- if (!transactionStartedByUs) return [3 /*break*/, 18];
487
- _a.label = 15;
488
- case 15:
489
- _a.trys.push([15, 17, , 18]);
490
- // we throw original error even if rollback thrown an error
491
- return [4 /*yield*/, queryRunner.rollbackTransaction()];
492
- case 16:
493
- // we throw original error even if rollback thrown an error
494
- _a.sent();
495
- return [3 /*break*/, 18];
496
- case 17:
497
- rollbackError_2 = _a.sent();
498
- return [3 /*break*/, 18];
499
- case 18: throw err_2;
500
- case 19:
501
- if (!!this.queryRunner) return [3 /*break*/, 21];
502
- return [4 /*yield*/, queryRunner.release()];
503
- case 20:
504
- _a.sent();
505
- _a.label = 21;
506
- case 21: return [7 /*endfinally*/];
507
- case 22: return [2 /*return*/];
254
+ async undoLastMigration() {
255
+ const queryRunner = this.queryRunner || this.connection.createQueryRunner();
256
+ // create migrations table if it's not created yet
257
+ await this.createMigrationsTableIfNotExist(queryRunner);
258
+ // create typeorm_metadata table if it's not created yet
259
+ const schemaBuilder = this.connection.driver.createSchemaBuilder();
260
+ if (InstanceChecker_1.InstanceChecker.isRdbmsSchemaBuilder(schemaBuilder)) {
261
+ await schemaBuilder.createMetadataTableIfNecessary(queryRunner);
262
+ }
263
+ // get all migrations that are executed and saved in the database
264
+ const executedMigrations = await this.loadExecutedMigrations(queryRunner);
265
+ // get the time when last migration was executed
266
+ let lastTimeExecutedMigration = this.getLatestExecutedMigration(executedMigrations);
267
+ // if no migrations found in the database then nothing to revert
268
+ if (!lastTimeExecutedMigration) {
269
+ this.connection.logger.logSchemaBuild(`No migrations was found in the database. Nothing to revert!`);
270
+ return;
271
+ }
272
+ // get all user's migrations in the source code
273
+ const allMigrations = this.getMigrations();
274
+ // find the instance of the migration we need to remove
275
+ const migrationToRevert = allMigrations.find((migration) => migration.name === lastTimeExecutedMigration.name);
276
+ // if no migrations found in the database then nothing to revert
277
+ if (!migrationToRevert)
278
+ throw new error_1.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.`);
279
+ // log information about migration execution
280
+ this.connection.logger.logSchemaBuild(`${executedMigrations.length} migrations are already loaded in the database.`);
281
+ this.connection.logger.logSchemaBuild(`${lastTimeExecutedMigration.name} is the last executed migration. It was executed on ${new Date(lastTimeExecutedMigration.timestamp).toString()}.`);
282
+ this.connection.logger.logSchemaBuild(`Now reverting it...`);
283
+ // start transaction if its not started yet
284
+ let transactionStartedByUs = false;
285
+ if (this.transaction !== "none" && !queryRunner.isTransactionActive) {
286
+ await queryRunner.startTransaction();
287
+ transactionStartedByUs = true;
288
+ }
289
+ try {
290
+ if (!this.fake) {
291
+ await queryRunner.beforeMigration();
292
+ await migrationToRevert.instance.down(queryRunner);
293
+ await queryRunner.afterMigration();
294
+ }
295
+ await this.deleteExecutedMigration(queryRunner, migrationToRevert);
296
+ this.connection.logger.logSchemaBuild(`Migration ${migrationToRevert.name} has been ${this.fake ? "(fake)" : ""} reverted successfully.`);
297
+ // commit transaction if we started it
298
+ if (transactionStartedByUs)
299
+ await queryRunner.commitTransaction();
300
+ }
301
+ catch (err) {
302
+ // rollback transaction if we started it
303
+ if (transactionStartedByUs) {
304
+ try {
305
+ // we throw original error even if rollback thrown an error
306
+ await queryRunner.rollbackTransaction();
508
307
  }
509
- });
510
- });
511
- };
308
+ catch (rollbackError) { }
309
+ }
310
+ throw err;
311
+ }
312
+ finally {
313
+ // if query runner was created by us then release it
314
+ if (!this.queryRunner)
315
+ await queryRunner.release();
316
+ }
317
+ }
512
318
  // -------------------------------------------------------------------------
513
319
  // Protected Methods
514
320
  // -------------------------------------------------------------------------
515
321
  /**
516
322
  * Creates table "migrations" that will store information about executed migrations.
517
323
  */
518
- MigrationExecutor.prototype.createMigrationsTableIfNotExist = function (queryRunner) {
519
- return tslib_1.__awaiter(this, void 0, void 0, function () {
520
- var tableExist;
521
- return tslib_1.__generator(this, function (_a) {
522
- switch (_a.label) {
523
- case 0:
524
- // If driver is mongo no need to create
525
- if (this.connection.driver.options.type === "mongodb") {
526
- return [2 /*return*/];
527
- }
528
- return [4 /*yield*/, queryRunner.hasTable(this.migrationsTable)]; // todo: table name should be configurable
529
- case 1:
530
- tableExist = _a.sent() // todo: table name should be configurable
531
- ;
532
- if (!!tableExist) return [3 /*break*/, 3];
533
- return [4 /*yield*/, queryRunner.createTable(new Table_1.Table({
534
- database: this.migrationsDatabase,
535
- schema: this.migrationsSchema,
536
- name: this.migrationsTable,
537
- columns: [
538
- {
539
- name: "id",
540
- type: this.connection.driver.normalizeType({
541
- type: this.connection.driver.mappedDataTypes
542
- .migrationId,
543
- }),
544
- isGenerated: true,
545
- generationStrategy: "increment",
546
- isPrimary: true,
547
- isNullable: false,
548
- },
549
- {
550
- name: "timestamp",
551
- type: this.connection.driver.normalizeType({
552
- type: this.connection.driver.mappedDataTypes
553
- .migrationTimestamp,
554
- }),
555
- isPrimary: false,
556
- isNullable: false,
557
- },
558
- {
559
- name: "name",
560
- type: this.connection.driver.normalizeType({
561
- type: this.connection.driver.mappedDataTypes
562
- .migrationName,
563
- }),
564
- isNullable: false,
565
- },
566
- ],
567
- }))];
568
- case 2:
569
- _a.sent();
570
- _a.label = 3;
571
- case 3: return [2 /*return*/];
572
- }
573
- });
574
- });
575
- };
324
+ async createMigrationsTableIfNotExist(queryRunner) {
325
+ // If driver is mongo no need to create
326
+ if (this.connection.driver.options.type === "mongodb") {
327
+ return;
328
+ }
329
+ const tableExist = await queryRunner.hasTable(this.migrationsTable); // todo: table name should be configurable
330
+ if (!tableExist) {
331
+ await queryRunner.createTable(new Table_1.Table({
332
+ database: this.migrationsDatabase,
333
+ schema: this.migrationsSchema,
334
+ name: this.migrationsTable,
335
+ columns: [
336
+ {
337
+ name: "id",
338
+ type: this.connection.driver.normalizeType({
339
+ type: this.connection.driver.mappedDataTypes
340
+ .migrationId,
341
+ }),
342
+ isGenerated: true,
343
+ generationStrategy: "increment",
344
+ isPrimary: true,
345
+ isNullable: false,
346
+ },
347
+ {
348
+ name: "timestamp",
349
+ type: this.connection.driver.normalizeType({
350
+ type: this.connection.driver.mappedDataTypes
351
+ .migrationTimestamp,
352
+ }),
353
+ isPrimary: false,
354
+ isNullable: false,
355
+ },
356
+ {
357
+ name: "name",
358
+ type: this.connection.driver.normalizeType({
359
+ type: this.connection.driver.mappedDataTypes
360
+ .migrationName,
361
+ }),
362
+ isNullable: false,
363
+ },
364
+ ],
365
+ }));
366
+ }
367
+ }
576
368
  /**
577
369
  * Loads all migrations that were executed and saved into the database (sorts by id).
578
370
  */
579
- MigrationExecutor.prototype.loadExecutedMigrations = function (queryRunner) {
580
- return tslib_1.__awaiter(this, void 0, void 0, function () {
581
- var mongoRunner, migrationsRaw;
582
- return tslib_1.__generator(this, function (_a) {
583
- switch (_a.label) {
584
- case 0:
585
- if (!(this.connection.driver.options.type === "mongodb")) return [3 /*break*/, 2];
586
- mongoRunner = queryRunner;
587
- return [4 /*yield*/, mongoRunner.databaseConnection
588
- .db(this.connection.driver.database)
589
- .collection(this.migrationsTableName)
590
- .find()
591
- .sort({ _id: -1 })
592
- .toArray()
593
- //#endregion
594
- ];
595
- case 1: return [2 /*return*/, _a.sent()
596
- //#endregion
597
- ];
598
- case 2: return [4 /*yield*/, this.connection.manager
599
- .createQueryBuilder(queryRunner)
600
- .select()
601
- .orderBy(this.connection.driver.escape("id"), "DESC")
602
- .from(this.migrationsTable, this.migrationsTableName)
603
- .getRawMany()];
604
- case 3:
605
- migrationsRaw = _a.sent();
606
- return [2 /*return*/, migrationsRaw.map(function (migrationRaw) {
607
- return new Migration_1.Migration(parseInt(migrationRaw["id"]), parseInt(migrationRaw["timestamp"]), migrationRaw["name"]);
608
- })];
609
- }
371
+ async loadExecutedMigrations(queryRunner) {
372
+ if (this.connection.driver.options.type === "mongodb") {
373
+ //#region @backendFunc
374
+ const mongoRunner = queryRunner;
375
+ return await mongoRunner.databaseConnection
376
+ .db(this.connection.driver.database)
377
+ .collection(this.migrationsTableName)
378
+ .find()
379
+ .sort({ _id: -1 })
380
+ .toArray();
381
+ //#endregion
382
+ }
383
+ else {
384
+ const migrationsRaw = await this.connection.manager
385
+ .createQueryBuilder(queryRunner)
386
+ .select()
387
+ .orderBy(this.connection.driver.escape("id"), "DESC")
388
+ .from(this.migrationsTable, this.migrationsTableName)
389
+ .getRawMany();
390
+ return migrationsRaw.map((migrationRaw) => {
391
+ return new Migration_1.Migration(parseInt(migrationRaw["id"]), parseInt(migrationRaw["timestamp"]), migrationRaw["name"]);
610
392
  });
611
- });
612
- };
393
+ }
394
+ }
613
395
  /**
614
396
  * Gets all migrations that setup for this connection.
615
397
  */
616
- MigrationExecutor.prototype.getMigrations = function () {
617
- var migrations = this.connection.migrations.map(function (migration) {
618
- var migrationClassName = migration.name || migration.constructor.name;
619
- var migrationTimestamp = parseInt(migrationClassName.substr(-13), 10);
398
+ getMigrations() {
399
+ const migrations = this.connection.migrations.map((migration) => {
400
+ const migrationClassName = migration.name || migration.constructor.name;
401
+ const migrationTimestamp = parseInt(migrationClassName.substr(-13), 10);
620
402
  if (!migrationTimestamp || isNaN(migrationTimestamp)) {
621
- throw new error_1.TypeORMError("".concat(migrationClassName, " migration name is wrong. Migration class name should have a JavaScript timestamp appended."));
403
+ throw new error_1.TypeORMError(`${migrationClassName} migration name is wrong. Migration class name should have a JavaScript timestamp appended.`);
622
404
  }
623
405
  return new Migration_1.Migration(undefined, migrationTimestamp, migrationClassName, migration);
624
406
  });
625
407
  this.checkForDuplicateMigrations(migrations);
626
408
  // sort them by timestamp
627
- return migrations.sort(function (a, b) { return a.timestamp - b.timestamp; });
628
- };
629
- MigrationExecutor.prototype.checkForDuplicateMigrations = function (migrations) {
630
- var migrationNames = migrations.map(function (migration) { return migration.name; });
631
- var duplicates = Array.from(new Set(migrationNames.filter(function (migrationName, index) {
632
- return migrationNames.indexOf(migrationName) < index;
633
- })));
409
+ return migrations.sort((a, b) => a.timestamp - b.timestamp);
410
+ }
411
+ checkForDuplicateMigrations(migrations) {
412
+ const migrationNames = migrations.map((migration) => migration.name);
413
+ const duplicates = Array.from(new Set(migrationNames.filter((migrationName, index) => migrationNames.indexOf(migrationName) < index)));
634
414
  if (duplicates.length > 0) {
635
- throw Error("Duplicate migrations: ".concat(duplicates.join(", ")));
415
+ throw Error(`Duplicate migrations: ${duplicates.join(", ")}`);
636
416
  }
637
- };
417
+ }
638
418
  /**
639
419
  * Finds the latest migration (sorts by timestamp) in the given array of migrations.
640
420
  */
641
- MigrationExecutor.prototype.getLatestTimestampMigration = function (migrations) {
642
- var sortedMigrations = migrations
643
- .map(function (migration) { return migration; })
644
- .sort(function (a, b) { return (a.timestamp - b.timestamp) * -1; });
421
+ getLatestTimestampMigration(migrations) {
422
+ const sortedMigrations = migrations
423
+ .map((migration) => migration)
424
+ .sort((a, b) => (a.timestamp - b.timestamp) * -1);
645
425
  return sortedMigrations.length > 0 ? sortedMigrations[0] : undefined;
646
- };
426
+ }
647
427
  /**
648
428
  * Finds the latest migration in the given array of migrations.
649
429
  * PRE: Migration array must be sorted by descending id.
650
430
  */
651
- MigrationExecutor.prototype.getLatestExecutedMigration = function (sortedMigrations) {
431
+ getLatestExecutedMigration(sortedMigrations) {
652
432
  return sortedMigrations.length > 0 ? sortedMigrations[0] : undefined;
653
- };
433
+ }
654
434
  /**
655
435
  * Inserts new executed migration's data into migrations table.
656
436
  */
657
- MigrationExecutor.prototype.insertExecutedMigration = function (queryRunner, migration) {
658
- return tslib_1.__awaiter(this, void 0, void 0, function () {
659
- var values, mongoRunner, qb;
660
- return tslib_1.__generator(this, function (_a) {
661
- switch (_a.label) {
662
- case 0:
663
- values = {};
664
- if (this.connection.driver.options.type === "mssql") {
665
- //#region @backend
666
- values["timestamp"] = new MssqlParameter_1.MssqlParameter(migration.timestamp, this.connection.driver.normalizeType({
667
- type: this.connection.driver.mappedDataTypes
668
- .migrationTimestamp,
669
- }));
670
- values["name"] = new MssqlParameter_1.MssqlParameter(migration.name, this.connection.driver.normalizeType({
671
- type: this.connection.driver.mappedDataTypes.migrationName,
672
- }));
673
- //#endregion
674
- }
675
- else {
676
- values["timestamp"] = migration.timestamp;
677
- values["name"] = migration.name;
678
- }
679
- if (!(this.connection.driver.options.type === "mongodb")) return [3 /*break*/, 2];
680
- mongoRunner = queryRunner;
681
- return [4 /*yield*/, mongoRunner.databaseConnection
682
- .db(this.connection.driver.database)
683
- .collection(this.migrationsTableName)
684
- .insertOne(values)
685
- //#endregion
686
- ];
687
- case 1:
688
- _a.sent();
689
- return [3 /*break*/, 4];
690
- case 2:
691
- qb = queryRunner.manager.createQueryBuilder();
692
- return [4 /*yield*/, qb
693
- .insert()
694
- .into(this.migrationsTable)
695
- .values(values)
696
- .execute()];
697
- case 3:
698
- _a.sent();
699
- _a.label = 4;
700
- case 4: return [2 /*return*/];
701
- }
702
- });
703
- });
704
- };
437
+ async insertExecutedMigration(queryRunner, migration) {
438
+ const values = {};
439
+ if (this.connection.driver.options.type === "mssql") {
440
+ //#region @backend
441
+ values["timestamp"] = new MssqlParameter_1.MssqlParameter(migration.timestamp, this.connection.driver.normalizeType({
442
+ type: this.connection.driver.mappedDataTypes
443
+ .migrationTimestamp,
444
+ }));
445
+ values["name"] = new MssqlParameter_1.MssqlParameter(migration.name, this.connection.driver.normalizeType({
446
+ type: this.connection.driver.mappedDataTypes.migrationName,
447
+ }));
448
+ //#endregion
449
+ }
450
+ else {
451
+ values["timestamp"] = migration.timestamp;
452
+ values["name"] = migration.name;
453
+ }
454
+ if (this.connection.driver.options.type === "mongodb") {
455
+ //#region @backend
456
+ const mongoRunner = queryRunner;
457
+ await mongoRunner.databaseConnection
458
+ .db(this.connection.driver.database)
459
+ .collection(this.migrationsTableName)
460
+ .insertOne(values);
461
+ //#endregion
462
+ }
463
+ else {
464
+ const qb = queryRunner.manager.createQueryBuilder();
465
+ await qb
466
+ .insert()
467
+ .into(this.migrationsTable)
468
+ .values(values)
469
+ .execute();
470
+ }
471
+ }
705
472
  /**
706
473
  * Delete previously executed migration's data from the migrations table.
707
474
  */
708
- MigrationExecutor.prototype.deleteExecutedMigration = function (queryRunner, migration) {
709
- return tslib_1.__awaiter(this, void 0, void 0, function () {
710
- var conditions, mongoRunner, qb;
711
- return tslib_1.__generator(this, function (_a) {
712
- switch (_a.label) {
713
- case 0:
714
- conditions = {};
715
- if (this.connection.driver.options.type === "mssql") {
716
- //#region @backend
717
- conditions["timestamp"] = new MssqlParameter_1.MssqlParameter(migration.timestamp, this.connection.driver.normalizeType({
718
- type: this.connection.driver.mappedDataTypes
719
- .migrationTimestamp,
720
- }));
721
- conditions["name"] = new MssqlParameter_1.MssqlParameter(migration.name, this.connection.driver.normalizeType({
722
- type: this.connection.driver.mappedDataTypes.migrationName,
723
- }));
724
- //#endregion
725
- }
726
- else {
727
- conditions["timestamp"] = migration.timestamp;
728
- conditions["name"] = migration.name;
729
- }
730
- if (!(this.connection.driver.options.type === "mongodb")) return [3 /*break*/, 2];
731
- mongoRunner = queryRunner;
732
- return [4 /*yield*/, mongoRunner.databaseConnection
733
- .db(this.connection.driver.database)
734
- .collection(this.migrationsTableName)
735
- .deleteOne(conditions)
736
- //#endregion
737
- ];
738
- case 1:
739
- _a.sent();
740
- return [3 /*break*/, 4];
741
- case 2:
742
- qb = queryRunner.manager.createQueryBuilder();
743
- return [4 /*yield*/, qb
744
- .delete()
745
- .from(this.migrationsTable)
746
- .where("".concat(qb.escape("timestamp"), " = :timestamp"))
747
- .andWhere("".concat(qb.escape("name"), " = :name"))
748
- .setParameters(conditions)
749
- .execute()];
750
- case 3:
751
- _a.sent();
752
- _a.label = 4;
753
- case 4: return [2 /*return*/];
754
- }
755
- });
756
- });
757
- };
758
- MigrationExecutor.prototype.withQueryRunner = function (callback) {
759
- return tslib_1.__awaiter(this, void 0, void 0, function () {
760
- var queryRunner;
761
- return tslib_1.__generator(this, function (_a) {
762
- switch (_a.label) {
763
- case 0:
764
- queryRunner = this.queryRunner || this.connection.createQueryRunner();
765
- _a.label = 1;
766
- case 1:
767
- _a.trys.push([1, , 2, 5]);
768
- return [2 /*return*/, callback(queryRunner)];
769
- case 2:
770
- if (!!this.queryRunner) return [3 /*break*/, 4];
771
- return [4 /*yield*/, queryRunner.release()];
772
- case 3:
773
- _a.sent();
774
- _a.label = 4;
775
- case 4: return [7 /*endfinally*/];
776
- case 5: return [2 /*return*/];
777
- }
778
- });
779
- });
780
- };
781
- return MigrationExecutor;
782
- }());
475
+ async deleteExecutedMigration(queryRunner, migration) {
476
+ const conditions = {};
477
+ if (this.connection.driver.options.type === "mssql") {
478
+ //#region @backend
479
+ conditions["timestamp"] = new MssqlParameter_1.MssqlParameter(migration.timestamp, this.connection.driver.normalizeType({
480
+ type: this.connection.driver.mappedDataTypes
481
+ .migrationTimestamp,
482
+ }));
483
+ conditions["name"] = new MssqlParameter_1.MssqlParameter(migration.name, this.connection.driver.normalizeType({
484
+ type: this.connection.driver.mappedDataTypes.migrationName,
485
+ }));
486
+ //#endregion
487
+ }
488
+ else {
489
+ conditions["timestamp"] = migration.timestamp;
490
+ conditions["name"] = migration.name;
491
+ }
492
+ if (this.connection.driver.options.type === "mongodb") {
493
+ //#region @backend
494
+ const mongoRunner = queryRunner;
495
+ await mongoRunner.databaseConnection
496
+ .db(this.connection.driver.database)
497
+ .collection(this.migrationsTableName)
498
+ .deleteOne(conditions);
499
+ //#endregion
500
+ }
501
+ else {
502
+ const qb = queryRunner.manager.createQueryBuilder();
503
+ await qb
504
+ .delete()
505
+ .from(this.migrationsTable)
506
+ .where(`${qb.escape("timestamp")} = :timestamp`)
507
+ .andWhere(`${qb.escape("name")} = :name`)
508
+ .setParameters(conditions)
509
+ .execute();
510
+ }
511
+ }
512
+ async withQueryRunner(callback) {
513
+ const queryRunner = this.queryRunner || this.connection.createQueryRunner();
514
+ try {
515
+ return callback(queryRunner);
516
+ }
517
+ finally {
518
+ if (!this.queryRunner) {
519
+ await queryRunner.release();
520
+ }
521
+ }
522
+ }
523
+ }
783
524
  exports.MigrationExecutor = MigrationExecutor;
784
525
  //# sourceMappingURL=MigrationExecutor.js.map