typeorm 0.2.42-dev.600bd4e → 0.2.42-dev.8f2ae71

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 (188) hide show
  1. package/browser/common/DeepPartial.d.ts +3 -3
  2. package/browser/common/DeepPartial.js.map +1 -1
  3. package/browser/decorator/listeners/AfterRecover.d.ts +4 -0
  4. package/browser/decorator/listeners/AfterRecover.js +16 -0
  5. package/browser/decorator/listeners/AfterRecover.js.map +1 -0
  6. package/browser/decorator/listeners/AfterSoftRemove.d.ts +4 -0
  7. package/browser/decorator/listeners/AfterSoftRemove.js +16 -0
  8. package/browser/decorator/listeners/AfterSoftRemove.js.map +1 -0
  9. package/browser/decorator/listeners/BeforeRecover.d.ts +4 -0
  10. package/browser/decorator/listeners/BeforeRecover.js +16 -0
  11. package/browser/decorator/listeners/BeforeRecover.js.map +1 -0
  12. package/browser/decorator/listeners/BeforeSoftRemove.d.ts +4 -0
  13. package/browser/decorator/listeners/BeforeSoftRemove.js +16 -0
  14. package/browser/decorator/listeners/BeforeSoftRemove.js.map +1 -0
  15. package/browser/driver/better-sqlite3/BetterSqlite3QueryRunner.d.ts +8 -0
  16. package/browser/driver/better-sqlite3/BetterSqlite3QueryRunner.js +30 -0
  17. package/browser/driver/better-sqlite3/BetterSqlite3QueryRunner.js.map +1 -1
  18. package/browser/driver/capacitor/CapacitorQueryRunner.d.ts +8 -0
  19. package/browser/driver/capacitor/CapacitorQueryRunner.js +30 -0
  20. package/browser/driver/capacitor/CapacitorQueryRunner.js.map +1 -1
  21. package/browser/driver/cordova/CordovaQueryRunner.d.ts +8 -0
  22. package/browser/driver/cordova/CordovaQueryRunner.js +30 -0
  23. package/browser/driver/cordova/CordovaQueryRunner.js.map +1 -1
  24. package/browser/driver/expo/ExpoQueryRunner.d.ts +8 -0
  25. package/browser/driver/expo/ExpoQueryRunner.js +30 -0
  26. package/browser/driver/expo/ExpoQueryRunner.js.map +1 -1
  27. package/browser/driver/mongodb/MongoQueryRunner.d.ts +8 -0
  28. package/browser/driver/mongodb/MongoQueryRunner.js +20 -0
  29. package/browser/driver/mongodb/MongoQueryRunner.js.map +1 -1
  30. package/browser/driver/nativescript/NativescriptQueryRunner.d.ts +8 -0
  31. package/browser/driver/nativescript/NativescriptQueryRunner.js +30 -0
  32. package/browser/driver/nativescript/NativescriptQueryRunner.js.map +1 -1
  33. package/browser/driver/react-native/ReactNativeQueryRunner.d.ts +8 -0
  34. package/browser/driver/react-native/ReactNativeQueryRunner.js +30 -0
  35. package/browser/driver/react-native/ReactNativeQueryRunner.js.map +1 -1
  36. package/browser/driver/sqlite/SqliteQueryRunner.d.ts +8 -0
  37. package/browser/driver/sqlite/SqliteQueryRunner.js +30 -0
  38. package/browser/driver/sqlite/SqliteQueryRunner.js.map +1 -1
  39. package/browser/driver/sqlite-abstract/AbstractSqliteQueryRunner.js +2 -2
  40. package/browser/driver/sqlite-abstract/AbstractSqliteQueryRunner.js.map +1 -1
  41. package/browser/driver/sqljs/SqljsQueryRunner.d.ts +8 -0
  42. package/browser/driver/sqljs/SqljsQueryRunner.js +30 -0
  43. package/browser/driver/sqljs/SqljsQueryRunner.js.map +1 -1
  44. package/browser/entity-manager/EntityManager.js.map +1 -1
  45. package/browser/entity-manager/MongoEntityManager.d.ts +2 -0
  46. package/browser/entity-manager/MongoEntityManager.js +35 -4
  47. package/browser/entity-manager/MongoEntityManager.js.map +1 -1
  48. package/browser/index.d.ts +4 -0
  49. package/browser/index.js +4 -0
  50. package/browser/index.js.map +1 -1
  51. package/browser/metadata/EntityMetadata.d.ts +16 -0
  52. package/browser/metadata/EntityMetadata.js +16 -0
  53. package/browser/metadata/EntityMetadata.js.map +1 -1
  54. package/browser/metadata/types/EventListenerTypes.d.ts +5 -1
  55. package/browser/metadata/types/EventListenerTypes.js +4 -0
  56. package/browser/metadata/types/EventListenerTypes.js.map +1 -1
  57. package/browser/metadata-builder/EntityMetadataBuilder.js +4 -0
  58. package/browser/metadata-builder/EntityMetadataBuilder.js.map +1 -1
  59. package/browser/metadata-builder/EntityMetadataValidator.js +1 -1
  60. package/browser/metadata-builder/EntityMetadataValidator.js.map +1 -1
  61. package/browser/migration/MigrationExecutor.js +37 -25
  62. package/browser/migration/MigrationExecutor.js.map +1 -1
  63. package/browser/persistence/SubjectExecutor.d.ts +4 -2
  64. package/browser/persistence/SubjectExecutor.js +105 -13
  65. package/browser/persistence/SubjectExecutor.js.map +1 -1
  66. package/browser/persistence/tree/MaterializedPathSubjectExecutor.js +1 -1
  67. package/browser/persistence/tree/MaterializedPathSubjectExecutor.js.map +1 -1
  68. package/browser/query-builder/InsertQueryBuilder.js +9 -0
  69. package/browser/query-builder/InsertQueryBuilder.js.map +1 -1
  70. package/browser/query-builder/SoftDeleteQueryBuilder.js +44 -30
  71. package/browser/query-builder/SoftDeleteQueryBuilder.js.map +1 -1
  72. package/browser/query-runner/BaseQueryRunner.d.ts +8 -0
  73. package/browser/query-runner/BaseQueryRunner.js +20 -0
  74. package/browser/query-runner/BaseQueryRunner.js.map +1 -1
  75. package/browser/query-runner/QueryRunner.d.ts +8 -0
  76. package/browser/query-runner/QueryRunner.js.map +1 -1
  77. package/browser/repository/TreeRepository.js +2 -1
  78. package/browser/repository/TreeRepository.js.map +1 -1
  79. package/browser/schema-builder/RdbmsSchemaBuilder.js +36 -30
  80. package/browser/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
  81. package/browser/subscriber/Broadcaster.d.ts +40 -0
  82. package/browser/subscriber/Broadcaster.js +156 -0
  83. package/browser/subscriber/Broadcaster.js.map +1 -1
  84. package/browser/subscriber/EntitySubscriberInterface.d.ts +18 -0
  85. package/browser/subscriber/EntitySubscriberInterface.js.map +1 -1
  86. package/browser/subscriber/event/RecoverEvent.d.ts +6 -0
  87. package/browser/subscriber/event/RecoverEvent.js +3 -0
  88. package/browser/subscriber/event/RecoverEvent.js.map +1 -0
  89. package/browser/subscriber/event/SoftRemoveEvent.d.ts +6 -0
  90. package/browser/subscriber/event/SoftRemoveEvent.js +3 -0
  91. package/browser/subscriber/event/SoftRemoveEvent.js.map +1 -0
  92. package/commands/MigrationShowCommand.js +3 -4
  93. package/commands/MigrationShowCommand.js.map +1 -1
  94. package/common/DeepPartial.d.ts +3 -3
  95. package/common/DeepPartial.js.map +1 -1
  96. package/decorator/listeners/AfterRecover.d.ts +4 -0
  97. package/decorator/listeners/AfterRecover.js +20 -0
  98. package/decorator/listeners/AfterRecover.js.map +1 -0
  99. package/decorator/listeners/AfterSoftRemove.d.ts +4 -0
  100. package/decorator/listeners/AfterSoftRemove.js +20 -0
  101. package/decorator/listeners/AfterSoftRemove.js.map +1 -0
  102. package/decorator/listeners/BeforeRecover.d.ts +4 -0
  103. package/decorator/listeners/BeforeRecover.js +20 -0
  104. package/decorator/listeners/BeforeRecover.js.map +1 -0
  105. package/decorator/listeners/BeforeSoftRemove.d.ts +4 -0
  106. package/decorator/listeners/BeforeSoftRemove.js +20 -0
  107. package/decorator/listeners/BeforeSoftRemove.js.map +1 -0
  108. package/driver/better-sqlite3/BetterSqlite3QueryRunner.d.ts +8 -0
  109. package/driver/better-sqlite3/BetterSqlite3QueryRunner.js +30 -0
  110. package/driver/better-sqlite3/BetterSqlite3QueryRunner.js.map +1 -1
  111. package/driver/capacitor/CapacitorQueryRunner.d.ts +8 -0
  112. package/driver/capacitor/CapacitorQueryRunner.js +30 -0
  113. package/driver/capacitor/CapacitorQueryRunner.js.map +1 -1
  114. package/driver/cordova/CordovaQueryRunner.d.ts +8 -0
  115. package/driver/cordova/CordovaQueryRunner.js +30 -0
  116. package/driver/cordova/CordovaQueryRunner.js.map +1 -1
  117. package/driver/expo/ExpoQueryRunner.d.ts +8 -0
  118. package/driver/expo/ExpoQueryRunner.js +30 -0
  119. package/driver/expo/ExpoQueryRunner.js.map +1 -1
  120. package/driver/mongodb/MongoQueryRunner.d.ts +8 -0
  121. package/driver/mongodb/MongoQueryRunner.js +20 -0
  122. package/driver/mongodb/MongoQueryRunner.js.map +1 -1
  123. package/driver/nativescript/NativescriptQueryRunner.d.ts +8 -0
  124. package/driver/nativescript/NativescriptQueryRunner.js +30 -0
  125. package/driver/nativescript/NativescriptQueryRunner.js.map +1 -1
  126. package/driver/react-native/ReactNativeQueryRunner.d.ts +8 -0
  127. package/driver/react-native/ReactNativeQueryRunner.js +30 -0
  128. package/driver/react-native/ReactNativeQueryRunner.js.map +1 -1
  129. package/driver/sqlite/SqliteQueryRunner.d.ts +8 -0
  130. package/driver/sqlite/SqliteQueryRunner.js +30 -0
  131. package/driver/sqlite/SqliteQueryRunner.js.map +1 -1
  132. package/driver/sqlite-abstract/AbstractSqliteQueryRunner.js +2 -2
  133. package/driver/sqlite-abstract/AbstractSqliteQueryRunner.js.map +1 -1
  134. package/driver/sqljs/SqljsQueryRunner.d.ts +8 -0
  135. package/driver/sqljs/SqljsQueryRunner.js +30 -0
  136. package/driver/sqljs/SqljsQueryRunner.js.map +1 -1
  137. package/entity-manager/EntityManager.js.map +1 -1
  138. package/entity-manager/MongoEntityManager.d.ts +2 -0
  139. package/entity-manager/MongoEntityManager.js +35 -4
  140. package/entity-manager/MongoEntityManager.js.map +1 -1
  141. package/index.d.ts +4 -0
  142. package/index.js +4 -0
  143. package/index.js.map +1 -1
  144. package/index.mjs +8 -0
  145. package/metadata/EntityMetadata.d.ts +16 -0
  146. package/metadata/EntityMetadata.js +16 -0
  147. package/metadata/EntityMetadata.js.map +1 -1
  148. package/metadata/types/EventListenerTypes.d.ts +5 -1
  149. package/metadata/types/EventListenerTypes.js +4 -0
  150. package/metadata/types/EventListenerTypes.js.map +1 -1
  151. package/metadata-builder/EntityMetadataBuilder.js +4 -0
  152. package/metadata-builder/EntityMetadataBuilder.js.map +1 -1
  153. package/metadata-builder/EntityMetadataValidator.js +1 -1
  154. package/metadata-builder/EntityMetadataValidator.js.map +1 -1
  155. package/migration/MigrationExecutor.js +37 -25
  156. package/migration/MigrationExecutor.js.map +1 -1
  157. package/package.json +1 -1
  158. package/persistence/SubjectExecutor.d.ts +4 -2
  159. package/persistence/SubjectExecutor.js +105 -13
  160. package/persistence/SubjectExecutor.js.map +1 -1
  161. package/persistence/tree/MaterializedPathSubjectExecutor.js +1 -1
  162. package/persistence/tree/MaterializedPathSubjectExecutor.js.map +1 -1
  163. package/query-builder/InsertQueryBuilder.js +9 -0
  164. package/query-builder/InsertQueryBuilder.js.map +1 -1
  165. package/query-builder/SoftDeleteQueryBuilder.js +44 -30
  166. package/query-builder/SoftDeleteQueryBuilder.js.map +1 -1
  167. package/query-runner/BaseQueryRunner.d.ts +8 -0
  168. package/query-runner/BaseQueryRunner.js +20 -0
  169. package/query-runner/BaseQueryRunner.js.map +1 -1
  170. package/query-runner/QueryRunner.d.ts +8 -0
  171. package/query-runner/QueryRunner.js.map +1 -1
  172. package/repository/TreeRepository.js +2 -1
  173. package/repository/TreeRepository.js.map +1 -1
  174. package/schema-builder/RdbmsSchemaBuilder.js +36 -30
  175. package/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
  176. package/subscriber/Broadcaster.d.ts +40 -0
  177. package/subscriber/Broadcaster.js +156 -0
  178. package/subscriber/Broadcaster.js.map +1 -1
  179. package/subscriber/EntitySubscriberInterface.d.ts +18 -0
  180. package/subscriber/EntitySubscriberInterface.js.map +1 -1
  181. package/subscriber/event/RecoverEvent.d.ts +6 -0
  182. package/subscriber/event/RecoverEvent.js +4 -0
  183. package/subscriber/event/RecoverEvent.js.map +1 -0
  184. package/subscriber/event/SoftRemoveEvent.d.ts +6 -0
  185. package/subscriber/event/SoftRemoveEvent.js +4 -0
  186. package/subscriber/event/SoftRemoveEvent.js.map +1 -0
  187. package/typeorm-class-transformer-shim.js +20 -0
  188. package/typeorm-model-shim.js +20 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/subscriber/Broadcaster.ts"],"names":[],"mappings":";AAIA,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAyBtD;;GAEG;AACH;IAEI,4EAA4E;IAC5E,cAAc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AAU,CAAC,WAAW,CAAC,OAAO,CAAC,UAAA,UAAU;oBACtD,IAAI,KAAI,CAAC,mBAAmB,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,SAAS,EAAE;wBAC/E,IAAM,eAAe,GAAG,UAAU,CAAC,SAAU,CAAC,MAAM,EAAE;4BAClD,UAAU,EAAE,KAAI,CAAC,WAAW,CAAC,UAAU;4BACvC,WAAW,EAAE,KAAI,CAAC,WAAW;4BAC7B,OAAO,EAAE,KAAI,CAAC,WAAW,CAAC,OAAO;4BACjC,MAAM,EAAE,MAAM;4BACd,QAAQ,EAAE,QAAQ;yBACrB,CAAC,CAAC;wBACH,IAAI,eAAe,YAAY,OAAO;4BAClC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;wBAC1C,MAAM,CAAC,KAAK,EAAE,CAAC;qBAClB;gBACL,CAAC,CAAC,CAAC;aACN;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAED,4EAA4E;IAC5E,oBAAoB;IACpB,4EAA4E;IAE5E;;;OAGG;IACO,yCAAmB,GAA7B,UAA8B,UAA0C,EAAE,MAAuB;QAC7F,OAAQ,CAAC,UAAU,CAAC,QAAQ;YACxB,CAAC,UAAU,CAAC,QAAQ,EAAE;YACtB,UAAU,CAAC,QAAQ,EAAE,KAAK,MAAM;YAChC,UAAU,CAAC,QAAQ,EAAE,KAAK,MAAM;YAChC,UAAU,CAAC,QAAQ,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC;IAEL,kBAAC;AAAD,CAvdA,AAudC,IAAA","file":"Broadcaster.js","sourcesContent":["import {EntitySubscriberInterface} from \"./EntitySubscriberInterface\";\nimport {ObjectLiteral} from \"../common/ObjectLiteral\";\nimport {QueryRunner} from \"../query-runner/QueryRunner\";\nimport {EntityMetadata} from \"../metadata/EntityMetadata\";\nimport {BroadcasterResult} from \"./BroadcasterResult\";\nimport {ColumnMetadata} from \"../metadata/ColumnMetadata\";\nimport {RelationMetadata} from \"../metadata/RelationMetadata\";\n\ninterface BroadcasterEvents {\n \"BeforeTransactionCommit\": () => void;\n \"AfterTransactionCommit\": () => void;\n \"BeforeTransactionStart\": () => void;\n \"AfterTransactionStart\": () => void;\n \"BeforeTransactionRollback\": () => void;\n \"AfterTransactionRollback\": () => void;\n\n \"BeforeUpdate\": (metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral, updatedColumns?: ColumnMetadata[], updatedRelations?: RelationMetadata[]) => void;\n \"AfterUpdate\": (metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral, updatedColumns?: ColumnMetadata[], updatedRelations?: RelationMetadata[]) => void;\n\n \"BeforeInsert\": (metadata: EntityMetadata, entity: ObjectLiteral | undefined) => void;\n \"AfterInsert\": (metadata: EntityMetadata, entity: ObjectLiteral | undefined) => void;\n\n \"BeforeRemove\": (metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral) => void;\n \"AfterRemove\": (metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral) => void;\n\n \"Load\": (metadata: EntityMetadata, entities: ObjectLiteral[]) => void;\n}\n\n\n/**\n * Broadcaster provides a helper methods to broadcast events to the subscribers.\n */\nexport class Broadcaster {\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(private queryRunner: QueryRunner) {\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n async broadcast<U extends keyof BroadcasterEvents>(event: U, ...args: Parameters<BroadcasterEvents[U]>): Promise<void> {\n const result = new BroadcasterResult();\n\n const broadcastFunction = this[`broadcast${event}Event` as keyof this];\n\n if (typeof broadcastFunction === \"function\") {\n (broadcastFunction as any).call(\n this,\n result,\n ...args\n );\n }\n\n await result.wait();\n }\n\n /**\n * Broadcasts \"BEFORE_INSERT\" event.\n * Before insert event is executed before entity is being inserted to the database for the first time.\n * All subscribers and entity listeners who listened to this event will be executed at this point.\n * Subscribers and entity listeners can return promises, it will wait until they are resolved.\n *\n * Note: this method has a performance-optimized code organization, do not change code structure.\n */\n broadcastBeforeInsertEvent(result: BroadcasterResult, metadata: EntityMetadata, entity: undefined | ObjectLiteral): void {\n\n if (entity && metadata.beforeInsertListeners.length) {\n metadata.beforeInsertListeners.forEach(listener => {\n if (listener.isAllowed(entity)) {\n const executionResult = listener.execute(entity);\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (this.isAllowedSubscriber(subscriber, metadata.target) && subscriber.beforeInsert) {\n const executionResult = subscriber.beforeInsert({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n entity: entity,\n metadata: metadata\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"BEFORE_UPDATE\" event.\n * Before update event is executed before entity is being updated in the database.\n * All subscribers and entity listeners who listened to this event will be executed at this point.\n * Subscribers and entity listeners can return promises, it will wait until they are resolved.\n *\n * Note: this method has a performance-optimized code organization, do not change code structure.\n */\n broadcastBeforeUpdateEvent(result: BroadcasterResult, metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral, updatedColumns?: ColumnMetadata[], updatedRelations?: RelationMetadata[]): void { // todo: send relations too?\n if (entity && metadata.beforeUpdateListeners.length) {\n metadata.beforeUpdateListeners.forEach(listener => {\n if (listener.isAllowed(entity)) {\n const executionResult = listener.execute(entity);\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (this.isAllowedSubscriber(subscriber, metadata.target) && subscriber.beforeUpdate) {\n const executionResult = subscriber.beforeUpdate({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n entity: entity,\n metadata: metadata,\n databaseEntity: databaseEntity,\n updatedColumns: updatedColumns || [],\n updatedRelations: updatedRelations || []\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"BEFORE_REMOVE\" event.\n * Before remove event is executed before entity is being removed from the database.\n * All subscribers and entity listeners who listened to this event will be executed at this point.\n * Subscribers and entity listeners can return promises, it will wait until they are resolved.\n *\n * Note: this method has a performance-optimized code organization, do not change code structure.\n */\n broadcastBeforeRemoveEvent(result: BroadcasterResult, metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral): void {\n if (entity && metadata.beforeRemoveListeners.length) {\n metadata.beforeRemoveListeners.forEach(listener => {\n if (listener.isAllowed(entity)) {\n const executionResult = listener.execute(entity);\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (this.isAllowedSubscriber(subscriber, metadata.target) && subscriber.beforeRemove) {\n const executionResult = subscriber.beforeRemove({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n entity: entity,\n metadata: metadata,\n databaseEntity: databaseEntity,\n entityId: metadata.getEntityIdMixedMap(databaseEntity)\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"AFTER_INSERT\" event.\n * After insert event is executed after entity is being persisted to the database for the first time.\n * All subscribers and entity listeners who listened to this event will be executed at this point.\n * Subscribers and entity listeners can return promises, it will wait until they are resolved.\n *\n * Note: this method has a performance-optimized code organization, do not change code structure.\n */\n broadcastAfterInsertEvent(result: BroadcasterResult, metadata: EntityMetadata, entity?: ObjectLiteral): void {\n\n if (entity && metadata.afterInsertListeners.length) {\n metadata.afterInsertListeners.forEach(listener => {\n if (listener.isAllowed(entity)) {\n const executionResult = listener.execute(entity);\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (this.isAllowedSubscriber(subscriber, metadata.target) && subscriber.afterInsert) {\n const executionResult = subscriber.afterInsert({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n entity: entity,\n metadata: metadata\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"BEFORE_TRANSACTION_START\" event.\n */\n broadcastBeforeTransactionStartEvent(result: BroadcasterResult): void {\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (subscriber.beforeTransactionStart) {\n const executionResult = subscriber.beforeTransactionStart({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"AFTER_TRANSACTION_START\" event.\n */\n broadcastAfterTransactionStartEvent(result: BroadcasterResult): void {\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (subscriber.afterTransactionStart) {\n const executionResult = subscriber.afterTransactionStart({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"BEFORE_TRANSACTION_COMMIT\" event.\n */\n broadcastBeforeTransactionCommitEvent(result: BroadcasterResult): void {\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (subscriber.beforeTransactionCommit) {\n const executionResult = subscriber.beforeTransactionCommit({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"AFTER_TRANSACTION_COMMIT\" event.\n */\n broadcastAfterTransactionCommitEvent(result: BroadcasterResult): void {\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (subscriber.afterTransactionCommit) {\n const executionResult = subscriber.afterTransactionCommit({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"BEFORE_TRANSACTION_ROLLBACK\" event.\n */\n broadcastBeforeTransactionRollbackEvent(result: BroadcasterResult): void {\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (subscriber.beforeTransactionRollback) {\n const executionResult = subscriber.beforeTransactionRollback({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"AFTER_TRANSACTION_ROLLBACK\" event.\n */\n broadcastAfterTransactionRollbackEvent(result: BroadcasterResult): void {\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (subscriber.afterTransactionRollback) {\n const executionResult = subscriber.afterTransactionRollback({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"AFTER_UPDATE\" event.\n * After update event is executed after entity is being updated in the database.\n * All subscribers and entity listeners who listened to this event will be executed at this point.\n * Subscribers and entity listeners can return promises, it will wait until they are resolved.\n *\n * Note: this method has a performance-optimized code organization, do not change code structure.\n */\n broadcastAfterUpdateEvent(result: BroadcasterResult, metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral, updatedColumns?: ColumnMetadata[], updatedRelations?: RelationMetadata[]): void {\n\n if (entity && metadata.afterUpdateListeners.length) {\n metadata.afterUpdateListeners.forEach(listener => {\n if (listener.isAllowed(entity)) {\n const executionResult = listener.execute(entity);\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (this.isAllowedSubscriber(subscriber, metadata.target) && subscriber.afterUpdate) {\n const executionResult = subscriber.afterUpdate({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n entity: entity,\n metadata: metadata,\n databaseEntity: databaseEntity,\n updatedColumns: updatedColumns || [],\n updatedRelations: updatedRelations || []\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"AFTER_REMOVE\" event.\n * After remove event is executed after entity is being removed from the database.\n * All subscribers and entity listeners who listened to this event will be executed at this point.\n * Subscribers and entity listeners can return promises, it will wait until they are resolved.\n *\n * Note: this method has a performance-optimized code organization, do not change code structure.\n */\n broadcastAfterRemoveEvent(result: BroadcasterResult, metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral): void {\n\n if (entity && metadata.afterRemoveListeners.length) {\n metadata.afterRemoveListeners.forEach(listener => {\n if (listener.isAllowed(entity)) {\n const executionResult = listener.execute(entity);\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (this.isAllowedSubscriber(subscriber, metadata.target) && subscriber.afterRemove) {\n const executionResult = subscriber.afterRemove({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n entity: entity,\n metadata: metadata,\n databaseEntity: databaseEntity,\n entityId: metadata.getEntityIdMixedMap(databaseEntity)\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * @deprecated Use `broadcastLoadForAllEvent`\n */\n broadcastLoadEventsForAll(result: BroadcasterResult, metadata: EntityMetadata, entities: ObjectLiteral[]): void {\n return this.broadcastLoadEvent(result, metadata, entities);\n }\n\n /**\n * Broadcasts \"AFTER_LOAD\" event for all given entities, and their sub-entities.\n * After load event is executed after entity has been loaded from the database.\n * All subscribers and entity listeners who listened to this event will be executed at this point.\n * Subscribers and entity listeners can return promises, it will wait until they are resolved.\n *\n * Note: this method has a performance-optimized code organization, do not change code structure.\n */\n broadcastLoadEvent(result: BroadcasterResult, metadata: EntityMetadata, entities: ObjectLiteral[]): void {\n entities.forEach(entity => {\n if (entity instanceof Promise) // todo: check why need this?\n return;\n\n // collect load events for all children entities that were loaded with the main entity\n if (metadata.relations.length) {\n metadata.relations.forEach(relation => {\n\n // in lazy relations we cannot simply access to entity property because it will cause a getter and a database query\n if (relation.isLazy && !entity.hasOwnProperty(relation.propertyName))\n return;\n\n const value = relation.getEntityValue(entity);\n if (value instanceof Object)\n this.broadcastLoadEvent(result, relation.inverseEntityMetadata, Array.isArray(value) ? value : [value]);\n });\n }\n\n if (metadata.afterLoadListeners.length) {\n metadata.afterLoadListeners.forEach(listener => {\n if (listener.isAllowed(entity)) {\n const executionResult = listener.execute(entity);\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (this.isAllowedSubscriber(subscriber, metadata.target) && subscriber.afterLoad) {\n const executionResult = subscriber.afterLoad!(entity, {\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n entity: entity,\n metadata: metadata\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n });\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Checks if subscriber's methods can be executed by checking if its don't listen to the particular entity,\n * or listens our entity.\n */\n protected isAllowedSubscriber(subscriber: EntitySubscriberInterface<any>, target: Function|string): boolean {\n return !subscriber.listenTo ||\n !subscriber.listenTo() ||\n subscriber.listenTo() === Object ||\n subscriber.listenTo() === target ||\n subscriber.listenTo().isPrototypeOf(target);\n }\n\n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../browser/src/subscriber/Broadcaster.ts"],"names":[],"mappings":";AAIA,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AA+BtD;;GAEG;AACH;IAEI,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,qBAAoB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAC5C,CAAC;IAED,4EAA4E;IAC5E,iBAAiB;IACjB,4EAA4E;IAEtE,+BAAS,GAAf,UAAmD,KAAQ;QAAE,cAAyC;aAAzC,UAAyC,EAAzC,qBAAyC,EAAzC,IAAyC;YAAzC,6BAAyC;;;;;;;;wBAC5F,MAAM,GAAG,IAAI,iBAAiB,EAAE,CAAC;wBAEjC,iBAAiB,GAAG,IAAI,CAAC,cAAY,KAAK,UAAqB,CAAC,CAAC;wBAEvE,IAAI,OAAO,iBAAiB,KAAK,UAAU,EAAE;4BACzC,CAAA,KAAC,iBAAyB,CAAA,CAAC,IAAI,0BAC3B,IAAI;gCACJ,MAAM,UACH,IAAI,WACT;yBACL;wBAED,qBAAM,MAAM,CAAC,IAAI,EAAE,EAAA;;wBAAnB,SAAmB,CAAC;;;;;KACvB;IAED;;;;;;;OAOG;IACH,gDAA0B,GAA1B,UAA2B,MAAyB,EAAE,QAAwB,EAAE,MAAiC;QAAjH,iBA6BC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,MAAM;4BACd,QAAQ,EAAE,QAAQ;yBACrB,CAAC,CAAC;wBACH,IAAI,eAAe,YAAY,OAAO;4BAClC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;wBAC1C,MAAM,CAAC,KAAK,EAAE,CAAC;qBAClB;gBACL,CAAC,CAAC,CAAC;aACN;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAED,4EAA4E;IAC5E,oBAAoB;IACpB,4EAA4E;IAE5E;;;OAGG;IACO,yCAAmB,GAA7B,UAA8B,UAA0C,EAAE,MAAuB;QAC7F,OAAQ,CAAC,UAAU,CAAC,QAAQ;YACxB,CAAC,UAAU,CAAC,QAAQ,EAAE;YACtB,UAAU,CAAC,QAAQ,EAAE,KAAK,MAAM;YAChC,UAAU,CAAC,QAAQ,EAAE,KAAK,MAAM;YAChC,UAAU,CAAC,QAAQ,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC;IAEL,kBAAC;AAAD,CAznBA,AAynBC,IAAA","file":"Broadcaster.js","sourcesContent":["import {EntitySubscriberInterface} from \"./EntitySubscriberInterface\";\nimport {ObjectLiteral} from \"../common/ObjectLiteral\";\nimport {QueryRunner} from \"../query-runner/QueryRunner\";\nimport {EntityMetadata} from \"../metadata/EntityMetadata\";\nimport {BroadcasterResult} from \"./BroadcasterResult\";\nimport {ColumnMetadata} from \"../metadata/ColumnMetadata\";\nimport {RelationMetadata} from \"../metadata/RelationMetadata\";\n\ninterface BroadcasterEvents {\n \"BeforeTransactionCommit\": () => void;\n \"AfterTransactionCommit\": () => void;\n \"BeforeTransactionStart\": () => void;\n \"AfterTransactionStart\": () => void;\n \"BeforeTransactionRollback\": () => void;\n \"AfterTransactionRollback\": () => void;\n\n \"BeforeUpdate\": (metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral, updatedColumns?: ColumnMetadata[], updatedRelations?: RelationMetadata[]) => void;\n \"AfterUpdate\": (metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral, updatedColumns?: ColumnMetadata[], updatedRelations?: RelationMetadata[]) => void;\n\n \"BeforeInsert\": (metadata: EntityMetadata, entity: ObjectLiteral | undefined) => void;\n \"AfterInsert\": (metadata: EntityMetadata, entity: ObjectLiteral | undefined) => void;\n\n \"BeforeRemove\": (metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral) => void;\n \"AfterRemove\": (metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral) => void;\n\n \"BeforeSoftRemove\": (metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral) => void;\n \"AfterSoftRemove\": (metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral) => void;\n\n \"BeforeRecover\": (metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral) => void;\n \"AfterRecover\": (metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral) => void;\n\n \"Load\": (metadata: EntityMetadata, entities: ObjectLiteral[]) => void;\n}\n\n\n/**\n * Broadcaster provides a helper methods to broadcast events to the subscribers.\n */\nexport class Broadcaster {\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(private queryRunner: QueryRunner) {\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n async broadcast<U extends keyof BroadcasterEvents>(event: U, ...args: Parameters<BroadcasterEvents[U]>): Promise<void> {\n const result = new BroadcasterResult();\n\n const broadcastFunction = this[`broadcast${event}Event` as keyof this];\n\n if (typeof broadcastFunction === \"function\") {\n (broadcastFunction as any).call(\n this,\n result,\n ...args\n );\n }\n\n await result.wait();\n }\n\n /**\n * Broadcasts \"BEFORE_INSERT\" event.\n * Before insert event is executed before entity is being inserted to the database for the first time.\n * All subscribers and entity listeners who listened to this event will be executed at this point.\n * Subscribers and entity listeners can return promises, it will wait until they are resolved.\n *\n * Note: this method has a performance-optimized code organization, do not change code structure.\n */\n broadcastBeforeInsertEvent(result: BroadcasterResult, metadata: EntityMetadata, entity: undefined | ObjectLiteral): void {\n\n if (entity && metadata.beforeInsertListeners.length) {\n metadata.beforeInsertListeners.forEach(listener => {\n if (listener.isAllowed(entity)) {\n const executionResult = listener.execute(entity);\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (this.isAllowedSubscriber(subscriber, metadata.target) && subscriber.beforeInsert) {\n const executionResult = subscriber.beforeInsert({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n entity: entity,\n metadata: metadata\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"BEFORE_UPDATE\" event.\n * Before update event is executed before entity is being updated in the database.\n * All subscribers and entity listeners who listened to this event will be executed at this point.\n * Subscribers and entity listeners can return promises, it will wait until they are resolved.\n *\n * Note: this method has a performance-optimized code organization, do not change code structure.\n */\n broadcastBeforeUpdateEvent(result: BroadcasterResult, metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral, updatedColumns?: ColumnMetadata[], updatedRelations?: RelationMetadata[]): void { // todo: send relations too?\n if (entity && metadata.beforeUpdateListeners.length) {\n metadata.beforeUpdateListeners.forEach(listener => {\n if (listener.isAllowed(entity)) {\n const executionResult = listener.execute(entity);\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (this.isAllowedSubscriber(subscriber, metadata.target) && subscriber.beforeUpdate) {\n const executionResult = subscriber.beforeUpdate({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n entity: entity,\n metadata: metadata,\n databaseEntity: databaseEntity,\n updatedColumns: updatedColumns || [],\n updatedRelations: updatedRelations || []\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"BEFORE_REMOVE\" event.\n * Before remove event is executed before entity is being removed from the database.\n * All subscribers and entity listeners who listened to this event will be executed at this point.\n * Subscribers and entity listeners can return promises, it will wait until they are resolved.\n *\n * Note: this method has a performance-optimized code organization, do not change code structure.\n */\n broadcastBeforeRemoveEvent(result: BroadcasterResult, metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral): void {\n if (entity && metadata.beforeRemoveListeners.length) {\n metadata.beforeRemoveListeners.forEach(listener => {\n if (listener.isAllowed(entity)) {\n const executionResult = listener.execute(entity);\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (this.isAllowedSubscriber(subscriber, metadata.target) && subscriber.beforeRemove) {\n const executionResult = subscriber.beforeRemove({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n entity: entity,\n metadata: metadata,\n databaseEntity: databaseEntity,\n entityId: metadata.getEntityIdMixedMap(databaseEntity)\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"BEFORE_SOFT_REMOVE\" event.\n * Before soft remove event is executed before entity is being soft removed from the database.\n * All subscribers and entity listeners who listened to this event will be executed at this point.\n * Subscribers and entity listeners can return promises, it will wait until they are resolved.\n *\n * Note: this method has a performance-optimized code organization, do not change code structure.\n */\n broadcastBeforeSoftRemoveEvent(result: BroadcasterResult, metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral): void {\n if (entity && metadata.beforeSoftRemoveListeners.length) {\n metadata.beforeSoftRemoveListeners.forEach(listener => {\n if (listener.isAllowed(entity)) {\n const executionResult = listener.execute(entity);\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (this.isAllowedSubscriber(subscriber, metadata.target) && subscriber.beforeSoftRemove) {\n const executionResult = subscriber.beforeSoftRemove({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n entity: entity,\n metadata: metadata,\n databaseEntity: databaseEntity,\n entityId: metadata.getEntityIdMixedMap(databaseEntity)\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"BEFORE_RECOVER\" event.\n * Before recover event is executed before entity is being recovered in the database.\n * All subscribers and entity listeners who listened to this event will be executed at this point.\n * Subscribers and entity listeners can return promises, it will wait until they are resolved.\n *\n * Note: this method has a performance-optimized code organization, do not change code structure.\n */\n broadcastBeforeRecoverEvent(result: BroadcasterResult, metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral): void {\n if (entity && metadata.beforeRecoverListeners.length) {\n metadata.beforeRecoverListeners.forEach(listener => {\n if (listener.isAllowed(entity)) {\n const executionResult = listener.execute(entity);\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (this.isAllowedSubscriber(subscriber, metadata.target) && subscriber.beforeRecover) {\n const executionResult = subscriber.beforeRecover({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n entity: entity,\n metadata: metadata,\n databaseEntity: databaseEntity,\n entityId: metadata.getEntityIdMixedMap(databaseEntity)\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"AFTER_INSERT\" event.\n * After insert event is executed after entity is being persisted to the database for the first time.\n * All subscribers and entity listeners who listened to this event will be executed at this point.\n * Subscribers and entity listeners can return promises, it will wait until they are resolved.\n *\n * Note: this method has a performance-optimized code organization, do not change code structure.\n */\n broadcastAfterInsertEvent(result: BroadcasterResult, metadata: EntityMetadata, entity?: ObjectLiteral): void {\n\n if (entity && metadata.afterInsertListeners.length) {\n metadata.afterInsertListeners.forEach(listener => {\n if (listener.isAllowed(entity)) {\n const executionResult = listener.execute(entity);\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (this.isAllowedSubscriber(subscriber, metadata.target) && subscriber.afterInsert) {\n const executionResult = subscriber.afterInsert({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n entity: entity,\n metadata: metadata\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"BEFORE_TRANSACTION_START\" event.\n */\n broadcastBeforeTransactionStartEvent(result: BroadcasterResult): void {\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (subscriber.beforeTransactionStart) {\n const executionResult = subscriber.beforeTransactionStart({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"AFTER_TRANSACTION_START\" event.\n */\n broadcastAfterTransactionStartEvent(result: BroadcasterResult): void {\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (subscriber.afterTransactionStart) {\n const executionResult = subscriber.afterTransactionStart({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"BEFORE_TRANSACTION_COMMIT\" event.\n */\n broadcastBeforeTransactionCommitEvent(result: BroadcasterResult): void {\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (subscriber.beforeTransactionCommit) {\n const executionResult = subscriber.beforeTransactionCommit({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"AFTER_TRANSACTION_COMMIT\" event.\n */\n broadcastAfterTransactionCommitEvent(result: BroadcasterResult): void {\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (subscriber.afterTransactionCommit) {\n const executionResult = subscriber.afterTransactionCommit({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"BEFORE_TRANSACTION_ROLLBACK\" event.\n */\n broadcastBeforeTransactionRollbackEvent(result: BroadcasterResult): void {\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (subscriber.beforeTransactionRollback) {\n const executionResult = subscriber.beforeTransactionRollback({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"AFTER_TRANSACTION_ROLLBACK\" event.\n */\n broadcastAfterTransactionRollbackEvent(result: BroadcasterResult): void {\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (subscriber.afterTransactionRollback) {\n const executionResult = subscriber.afterTransactionRollback({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"AFTER_UPDATE\" event.\n * After update event is executed after entity is being updated in the database.\n * All subscribers and entity listeners who listened to this event will be executed at this point.\n * Subscribers and entity listeners can return promises, it will wait until they are resolved.\n *\n * Note: this method has a performance-optimized code organization, do not change code structure.\n */\n broadcastAfterUpdateEvent(result: BroadcasterResult, metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral, updatedColumns?: ColumnMetadata[], updatedRelations?: RelationMetadata[]): void {\n\n if (entity && metadata.afterUpdateListeners.length) {\n metadata.afterUpdateListeners.forEach(listener => {\n if (listener.isAllowed(entity)) {\n const executionResult = listener.execute(entity);\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (this.isAllowedSubscriber(subscriber, metadata.target) && subscriber.afterUpdate) {\n const executionResult = subscriber.afterUpdate({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n entity: entity,\n metadata: metadata,\n databaseEntity: databaseEntity,\n updatedColumns: updatedColumns || [],\n updatedRelations: updatedRelations || []\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"AFTER_REMOVE\" event.\n * After remove event is executed after entity is being removed from the database.\n * All subscribers and entity listeners who listened to this event will be executed at this point.\n * Subscribers and entity listeners can return promises, it will wait until they are resolved.\n *\n * Note: this method has a performance-optimized code organization, do not change code structure.\n */\n broadcastAfterRemoveEvent(result: BroadcasterResult, metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral): void {\n\n if (entity && metadata.afterRemoveListeners.length) {\n metadata.afterRemoveListeners.forEach(listener => {\n if (listener.isAllowed(entity)) {\n const executionResult = listener.execute(entity);\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (this.isAllowedSubscriber(subscriber, metadata.target) && subscriber.afterRemove) {\n const executionResult = subscriber.afterRemove({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n entity: entity,\n metadata: metadata,\n databaseEntity: databaseEntity,\n entityId: metadata.getEntityIdMixedMap(databaseEntity)\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"AFTER_SOFT_REMOVE\" event.\n * After soft remove event is executed after entity is being soft removed from the database.\n * All subscribers and entity listeners who listened to this event will be executed at this point.\n * Subscribers and entity listeners can return promises, it will wait until they are resolved.\n *\n * Note: this method has a performance-optimized code organization, do not change code structure.\n */\n broadcastAfterSoftRemoveEvent(result: BroadcasterResult, metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral): void {\n\n if (entity && metadata.afterSoftRemoveListeners.length) {\n metadata.afterSoftRemoveListeners.forEach(listener => {\n if (listener.isAllowed(entity)) {\n const executionResult = listener.execute(entity);\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (this.isAllowedSubscriber(subscriber, metadata.target) && subscriber.afterSoftRemove) {\n const executionResult = subscriber.afterSoftRemove({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n entity: entity,\n metadata: metadata,\n databaseEntity: databaseEntity,\n entityId: metadata.getEntityIdMixedMap(databaseEntity)\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * Broadcasts \"AFTER_RECOVER\" event.\n * After recover event is executed after entity is being recovered in the database.\n * All subscribers and entity listeners who listened to this event will be executed at this point.\n * Subscribers and entity listeners can return promises, it will wait until they are resolved.\n *\n * Note: this method has a performance-optimized code organization, do not change code structure.\n */\n broadcastAfterRecoverEvent(result: BroadcasterResult, metadata: EntityMetadata, entity?: ObjectLiteral, databaseEntity?: ObjectLiteral): void {\n\n if (entity && metadata.afterRecoverListeners.length) {\n metadata.afterRecoverListeners.forEach(listener => {\n if (listener.isAllowed(entity)) {\n const executionResult = listener.execute(entity);\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (this.isAllowedSubscriber(subscriber, metadata.target) && subscriber.afterRecover) {\n const executionResult = subscriber.afterRecover({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n entity: entity,\n metadata: metadata,\n databaseEntity: databaseEntity,\n entityId: metadata.getEntityIdMixedMap(databaseEntity)\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n }\n\n /**\n * @deprecated Use `broadcastLoadForAllEvent`\n */\n broadcastLoadEventsForAll(result: BroadcasterResult, metadata: EntityMetadata, entities: ObjectLiteral[]): void {\n return this.broadcastLoadEvent(result, metadata, entities);\n }\n\n /**\n * Broadcasts \"AFTER_LOAD\" event for all given entities, and their sub-entities.\n * After load event is executed after entity has been loaded from the database.\n * All subscribers and entity listeners who listened to this event will be executed at this point.\n * Subscribers and entity listeners can return promises, it will wait until they are resolved.\n *\n * Note: this method has a performance-optimized code organization, do not change code structure.\n */\n broadcastLoadEvent(result: BroadcasterResult, metadata: EntityMetadata, entities: ObjectLiteral[]): void {\n entities.forEach(entity => {\n if (entity instanceof Promise) // todo: check why need this?\n return;\n\n // collect load events for all children entities that were loaded with the main entity\n if (metadata.relations.length) {\n metadata.relations.forEach(relation => {\n\n // in lazy relations we cannot simply access to entity property because it will cause a getter and a database query\n if (relation.isLazy && !entity.hasOwnProperty(relation.propertyName))\n return;\n\n const value = relation.getEntityValue(entity);\n if (value instanceof Object)\n this.broadcastLoadEvent(result, relation.inverseEntityMetadata, Array.isArray(value) ? value : [value]);\n });\n }\n\n if (metadata.afterLoadListeners.length) {\n metadata.afterLoadListeners.forEach(listener => {\n if (listener.isAllowed(entity)) {\n const executionResult = listener.execute(entity);\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach(subscriber => {\n if (this.isAllowedSubscriber(subscriber, metadata.target) && subscriber.afterLoad) {\n const executionResult = subscriber.afterLoad!(entity, {\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n entity: entity,\n metadata: metadata\n });\n if (executionResult instanceof Promise)\n result.promises.push(executionResult);\n result.count++;\n }\n });\n }\n });\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Checks if subscriber's methods can be executed by checking if its don't listen to the particular entity,\n * or listens our entity.\n */\n protected isAllowedSubscriber(subscriber: EntitySubscriberInterface<any>, target: Function|string): boolean {\n return !subscriber.listenTo ||\n !subscriber.listenTo() ||\n subscriber.listenTo() === Object ||\n subscriber.listenTo() === target ||\n subscriber.listenTo().isPrototypeOf(target);\n }\n\n}\n"],"sourceRoot":".."}
@@ -5,6 +5,8 @@ import { UpdateEvent } from "./event/UpdateEvent";
5
5
  import { RemoveEvent } from "./event/RemoveEvent";
6
6
  import { InsertEvent } from "./event/InsertEvent";
7
7
  import { LoadEvent } from "./event/LoadEvent";
8
+ import { SoftRemoveEvent } from "./event/SoftRemoveEvent";
9
+ import { RecoverEvent } from "./event/RecoverEvent";
8
10
  /**
9
11
  * Classes that implement this interface are subscribers that subscribe for the specific events in the ORM.
10
12
  */
@@ -43,10 +45,26 @@ export interface EntitySubscriberInterface<Entity = any> {
43
45
  * Called before entity is removed from the database.
44
46
  */
45
47
  beforeRemove?(event: RemoveEvent<Entity>): Promise<any> | void;
48
+ /**
49
+ * Called before entity is soft removed from the database.
50
+ */
51
+ beforeSoftRemove?(event: SoftRemoveEvent<Entity>): Promise<any> | void;
52
+ /**
53
+ * Called before entity is recovered in the database.
54
+ */
55
+ beforeRecover?(event: RecoverEvent<Entity>): Promise<any> | void;
46
56
  /**
47
57
  * Called after entity is removed from the database.
48
58
  */
49
59
  afterRemove?(event: RemoveEvent<Entity>): Promise<any> | void;
60
+ /**
61
+ * Called after entity is soft removed from the database.
62
+ */
63
+ afterSoftRemove?(event: SoftRemoveEvent<Entity>): Promise<any> | void;
64
+ /**
65
+ * Called after entity is recovered in the database.
66
+ */
67
+ afterRecover?(event: RecoverEvent<Entity>): Promise<any> | void;
50
68
  /**
51
69
  * Called before transaction is started.
52
70
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/subscriber/EntitySubscriberInterface.ts"],"names":[],"mappings":"","file":"EntitySubscriberInterface.js","sourcesContent":["import { TransactionCommitEvent } from \"./event/TransactionCommitEvent\";\nimport { TransactionRollbackEvent } from \"./event/TransactionRollbackEvent\";\nimport { TransactionStartEvent } from \"./event/TransactionStartEvent\";\nimport {UpdateEvent} from \"./event/UpdateEvent\";\nimport {RemoveEvent} from \"./event/RemoveEvent\";\nimport {InsertEvent} from \"./event/InsertEvent\";\nimport {LoadEvent} from \"./event/LoadEvent\";\n\n/**\n * Classes that implement this interface are subscribers that subscribe for the specific events in the ORM.\n */\nexport interface EntitySubscriberInterface<Entity = any> {\n\n /**\n * Returns the class of the entity to which events will listen.\n * If this method is omitted, then subscriber will listen to events of all entities.\n */\n listenTo?(): Function | string;\n\n /**\n * Called after entity is loaded from the database.\n *\n * For backward compatibility this signature is slightly different from the\n * others. `event` was added later but is always provided (it is only\n * optional in the signature so that its introduction does not break\n * compilation for existing subscribers).\n */\n afterLoad?(entity: Entity, event?: LoadEvent<Entity>): Promise<any>|void;\n\n /**\n * Called before entity is inserted to the database.\n */\n beforeInsert?(event: InsertEvent<Entity>): Promise<any>|void;\n\n /**\n * Called after entity is inserted to the database.\n */\n afterInsert?(event: InsertEvent<Entity>): Promise<any>|void;\n\n /**\n * Called before entity is updated in the database.\n */\n beforeUpdate?(event: UpdateEvent<Entity>): Promise<any>|void;\n\n /**\n * Called after entity is updated in the database.\n */\n afterUpdate?(event: UpdateEvent<Entity>): Promise<any>|void;\n\n /**\n * Called before entity is removed from the database.\n */\n beforeRemove?(event: RemoveEvent<Entity>): Promise<any>|void;\n\n /**\n * Called after entity is removed from the database.\n */\n afterRemove?(event: RemoveEvent<Entity>): Promise<any>|void;\n\n /**\n * Called before transaction is started.\n */\n beforeTransactionStart?(event: TransactionStartEvent): Promise<any>|void;\n\n /**\n * Called after transaction is started.\n */\n afterTransactionStart?(event: TransactionStartEvent): Promise<any>|void;\n\n /**\n * Called before transaction is committed.\n */\n beforeTransactionCommit?(event: TransactionCommitEvent): Promise<any>|void;\n\n /**\n * Called after transaction is committed.\n */\n afterTransactionCommit?(event: TransactionCommitEvent): Promise<any>|void;\n\n /**\n * Called before transaction rollback.\n */\n beforeTransactionRollback?(event: TransactionRollbackEvent): Promise<any>|void;\n\n /**\n * Called after transaction rollback.\n */\n afterTransactionRollback?(event: TransactionRollbackEvent): Promise<any>|void;\n\n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../browser/src/subscriber/EntitySubscriberInterface.ts"],"names":[],"mappings":"","file":"EntitySubscriberInterface.js","sourcesContent":["import { TransactionCommitEvent } from \"./event/TransactionCommitEvent\";\nimport { TransactionRollbackEvent } from \"./event/TransactionRollbackEvent\";\nimport { TransactionStartEvent } from \"./event/TransactionStartEvent\";\nimport {UpdateEvent} from \"./event/UpdateEvent\";\nimport {RemoveEvent} from \"./event/RemoveEvent\";\nimport {InsertEvent} from \"./event/InsertEvent\";\nimport {LoadEvent} from \"./event/LoadEvent\";\nimport { SoftRemoveEvent } from \"./event/SoftRemoveEvent\";\nimport { RecoverEvent } from \"./event/RecoverEvent\";\n\n/**\n * Classes that implement this interface are subscribers that subscribe for the specific events in the ORM.\n */\nexport interface EntitySubscriberInterface<Entity = any> {\n\n /**\n * Returns the class of the entity to which events will listen.\n * If this method is omitted, then subscriber will listen to events of all entities.\n */\n listenTo?(): Function | string;\n\n /**\n * Called after entity is loaded from the database.\n *\n * For backward compatibility this signature is slightly different from the\n * others. `event` was added later but is always provided (it is only\n * optional in the signature so that its introduction does not break\n * compilation for existing subscribers).\n */\n afterLoad?(entity: Entity, event?: LoadEvent<Entity>): Promise<any>|void;\n\n /**\n * Called before entity is inserted to the database.\n */\n beforeInsert?(event: InsertEvent<Entity>): Promise<any>|void;\n\n /**\n * Called after entity is inserted to the database.\n */\n afterInsert?(event: InsertEvent<Entity>): Promise<any>|void;\n\n /**\n * Called before entity is updated in the database.\n */\n beforeUpdate?(event: UpdateEvent<Entity>): Promise<any>|void;\n\n /**\n * Called after entity is updated in the database.\n */\n afterUpdate?(event: UpdateEvent<Entity>): Promise<any>|void;\n\n /**\n * Called before entity is removed from the database.\n */\n beforeRemove?(event: RemoveEvent<Entity>): Promise<any>|void;\n\n /**\n * Called before entity is soft removed from the database.\n */\n beforeSoftRemove?(event: SoftRemoveEvent<Entity>): Promise<any>|void;\n\n /**\n * Called before entity is recovered in the database.\n */\n beforeRecover?(event: RecoverEvent<Entity>): Promise<any>|void;\n\n /**\n * Called after entity is removed from the database.\n */\n afterRemove?(event: RemoveEvent<Entity>): Promise<any>|void;\n\n /**\n * Called after entity is soft removed from the database.\n */\n afterSoftRemove?(event: SoftRemoveEvent<Entity>): Promise<any>|void;\n\n /**\n * Called after entity is recovered in the database.\n */\n afterRecover?(event: RecoverEvent<Entity>): Promise<any>|void;\n\n /**\n * Called before transaction is started.\n */\n beforeTransactionStart?(event: TransactionStartEvent): Promise<any>|void;\n\n /**\n * Called after transaction is started.\n */\n afterTransactionStart?(event: TransactionStartEvent): Promise<any>|void;\n\n /**\n * Called before transaction is committed.\n */\n beforeTransactionCommit?(event: TransactionCommitEvent): Promise<any>|void;\n\n /**\n * Called after transaction is committed.\n */\n afterTransactionCommit?(event: TransactionCommitEvent): Promise<any>|void;\n\n /**\n * Called before transaction rollback.\n */\n beforeTransactionRollback?(event: TransactionRollbackEvent): Promise<any>|void;\n\n /**\n * Called after transaction rollback.\n */\n afterTransactionRollback?(event: TransactionRollbackEvent): Promise<any>|void;\n\n}\n"],"sourceRoot":".."}
@@ -0,0 +1,6 @@
1
+ import { RemoveEvent } from "./RemoveEvent";
2
+ /**
3
+ * RecoverEvent is an object that broadcaster sends to the entity subscriber when entity is being recovered in the database.
4
+ */
5
+ export interface RecoverEvent<Entity> extends RemoveEvent<Entity> {
6
+ }
@@ -0,0 +1,3 @@
1
+ export {};
2
+
3
+ //# sourceMappingURL=RecoverEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../browser/src/subscriber/event/RecoverEvent.ts"],"names":[],"mappings":"","file":"RecoverEvent.js","sourcesContent":["import { RemoveEvent } from \"./RemoveEvent\";\n\n/**\n * RecoverEvent is an object that broadcaster sends to the entity subscriber when entity is being recovered in the database.\n */\nexport interface RecoverEvent<Entity> extends RemoveEvent<Entity> {}\n"],"sourceRoot":"../.."}
@@ -0,0 +1,6 @@
1
+ import { RemoveEvent } from "./RemoveEvent";
2
+ /**
3
+ * SoftRemoveEvent is an object that broadcaster sends to the entity subscriber when entity is being soft removed to the database.
4
+ */
5
+ export interface SoftRemoveEvent<Entity> extends RemoveEvent<Entity> {
6
+ }
@@ -0,0 +1,3 @@
1
+ export {};
2
+
3
+ //# sourceMappingURL=SoftRemoveEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../browser/src/subscriber/event/SoftRemoveEvent.ts"],"names":[],"mappings":"","file":"SoftRemoveEvent.js","sourcesContent":["import { RemoveEvent } from \"./RemoveEvent\";\n\n/**\n * SoftRemoveEvent is an object that broadcaster sends to the entity subscriber when entity is being soft removed to the database.\n */\nexport interface SoftRemoveEvent<Entity> extends RemoveEvent<Entity> {}\n"],"sourceRoot":"../.."}
@@ -29,7 +29,7 @@ var MigrationShowCommand = /** @class */ (function () {
29
29
  };
30
30
  MigrationShowCommand.prototype.handler = function (args) {
31
31
  return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
32
- var connection, connectionOptionsReader, connectionOptions, unappliedMigrations, err_1;
32
+ var connection, connectionOptionsReader, connectionOptions, err_1;
33
33
  return (0, tslib_1.__generator)(this, function (_a) {
34
34
  switch (_a.label) {
35
35
  case 0:
@@ -56,12 +56,11 @@ var MigrationShowCommand = /** @class */ (function () {
56
56
  connection = _a.sent();
57
57
  return [4 /*yield*/, connection.showMigrations()];
58
58
  case 4:
59
- unappliedMigrations = _a.sent();
59
+ _a.sent();
60
60
  return [4 /*yield*/, connection.close()];
61
61
  case 5:
62
62
  _a.sent();
63
- // return error code if there are unapplied migrations for CI
64
- process.exit(unappliedMigrations ? 1 : 0);
63
+ process.exit(0);
65
64
  return [3 /*break*/, 9];
66
65
  case 6:
67
66
  err_1 = _a.sent();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commands/MigrationShowCommand.ts"],"names":[],"mappings":";;;;AAAA,sCAA4C;AAC5C,iFAA8E;AAE9E,4DAAmC;AAEnC,2DAA0D;AAE1D;;GAEG;AACH;IAAA;QAEE,YAAO,GAAG,gBAAgB,CAAC;QAC3B,aAAQ,GAAG,2DAA2D,CAAC;IA6CzE,CAAC;IA3CC,sCAAO,GAAP,UAAQ,IAAgB;QACtB,OAAO,IAAI;aACR,MAAM,CAAC,YAAY,EAAE;YACpB,KAAK,EAAE,GAAG;YACV,OAAO,EAAE,SAAS;YAClB,QAAQ,EAAE,8CAA8C;SACzD,CAAC;aACD,MAAM,CAAC,QAAQ,EAAE;YAChB,KAAK,EAAE,GAAG;YACV,OAAO,EAAE,WAAW;YACpB,QAAQ,EAAE,iDAAiD;SAC5D,CAAC,CAA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["import {createConnection} from \"../globals\";\nimport {ConnectionOptionsReader} from \"../connection/ConnectionOptionsReader\";\nimport {Connection} from \"../connection/Connection\";\nimport * as process from \"process\";\nimport * as yargs from \"yargs\";\nimport { PlatformTools } from \"../platform/PlatformTools\";\n\n/**\n * Runs migration command.\n */\nexport class MigrationShowCommand implements yargs.CommandModule {\n\n command = \"migration:show\";\n describe = \"Show all migrations and whether they have been run or not\";\n\n builder(args: yargs.Argv) {\n return args\n .option(\"connection\", {\n alias: \"c\",\n default: \"default\",\n describe: \"Name of the connection on which run a query.\"\n })\n .option(\"config\", {\n alias: \"f\",\n default: \"ormconfig\",\n describe: \"Name of the file with connection configuration.\"\n });\n }\n\n async handler(args: yargs.Arguments) {\n let connection: Connection|undefined = undefined;\n try {\n const connectionOptionsReader = new ConnectionOptionsReader({\n root: process.cwd(),\n configName: args.config as any\n });\n const connectionOptions = await connectionOptionsReader.get(args.connection as any);\n Object.assign(connectionOptions, {\n subscribers: [],\n synchronize: false,\n migrationsRun: false,\n dropSchema: false,\n logging: [\"query\", \"error\", \"schema\"]\n });\n connection = await createConnection(connectionOptions);\n const unappliedMigrations = await connection.showMigrations();\n await connection.close();\n\n // return error code if there are unapplied migrations for CI\n process.exit(unappliedMigrations ? 1 : 0);\n\n } catch (err) {\n if (connection) await (connection as Connection).close();\n PlatformTools.logCmdErr(\"Error during migration show:\", err);\n process.exit(1);\n }\n }\n\n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../../src/commands/MigrationShowCommand.ts"],"names":[],"mappings":";;;;AAAA,sCAA4C;AAC5C,iFAA8E;AAE9E,4DAAmC;AAEnC,2DAA0D;AAE1D;;GAEG;AACH;IAAA;QAEE,YAAO,GAAG,gBAAgB,CAAC;QAC3B,aAAQ,GAAG,2DAA2D,CAAC;IA4CzE,CAAC;IA1CC,sCAAO,GAAP,UAAQ,IAAgB;QACtB,OAAO,IAAI;aACR,MAAM,CAAC,YAAY,EAAE;YACpB,KAAK,EAAE,GAAG;YACV,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CAAC;;;;;;KAEnB;IAEH,2BAAC;AAAD,CA/CA,AA+CC,IAAA;AA/CY,oDAAoB","file":"MigrationShowCommand.js","sourcesContent":["import {createConnection} from \"../globals\";\nimport {ConnectionOptionsReader} from \"../connection/ConnectionOptionsReader\";\nimport {Connection} from \"../connection/Connection\";\nimport * as process from \"process\";\nimport * as yargs from \"yargs\";\nimport { PlatformTools } from \"../platform/PlatformTools\";\n\n/**\n * Runs migration command.\n */\nexport class MigrationShowCommand implements yargs.CommandModule {\n\n command = \"migration:show\";\n describe = \"Show all migrations and whether they have been run or not\";\n\n builder(args: yargs.Argv) {\n return args\n .option(\"connection\", {\n alias: \"c\",\n default: \"default\",\n describe: \"Name of the connection on which run a query.\"\n })\n .option(\"config\", {\n alias: \"f\",\n default: \"ormconfig\",\n describe: \"Name of the file with connection configuration.\"\n });\n }\n\n async handler(args: yargs.Arguments) {\n let connection: Connection|undefined = undefined;\n try {\n const connectionOptionsReader = new ConnectionOptionsReader({\n root: process.cwd(),\n configName: args.config as any\n });\n const connectionOptions = await connectionOptionsReader.get(args.connection as any);\n Object.assign(connectionOptions, {\n subscribers: [],\n synchronize: false,\n migrationsRun: false,\n dropSchema: false,\n logging: [\"query\", \"error\", \"schema\"]\n });\n connection = await createConnection(connectionOptions);\n await connection.showMigrations();\n await connection.close();\n\n process.exit(0);\n\n } catch (err) {\n if (connection) await (connection as Connection).close();\n PlatformTools.logCmdErr(\"Error during migration show:\", err);\n process.exit(1);\n }\n }\n\n}\n"],"sourceRoot":".."}
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Same as Partial<T> but goes deeper and makes Partial<T> all its properties and sub-properties.
3
3
  */
4
- export declare type DeepPartial<T> = {
5
- [P in keyof T]?: T[P] extends Array<infer U> ? Array<DeepPartial<U>> : T[P] extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : DeepPartial<T[P]> | T[P];
6
- };
4
+ export declare type DeepPartial<T> = T extends object ? {
5
+ [P in keyof T]?: DeepPartial<T[P]>;
6
+ } : T;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/common/DeepPartial.ts"],"names":[],"mappings":"","file":"DeepPartial.js","sourcesContent":["/**\n * Same as Partial<T> but goes deeper and makes Partial<T> all its properties and sub-properties.\n */\nexport type DeepPartial<T> = {\n [P in keyof T]?:\n T[P] extends Array<infer U> ? Array<DeepPartial<U>> :\n T[P] extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> :\n DeepPartial<T[P]> | T[P]\n};\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../../src/common/DeepPartial.ts"],"names":[],"mappings":"","file":"DeepPartial.js","sourcesContent":["/**\n * Same as Partial<T> but goes deeper and makes Partial<T> all its properties and sub-properties.\n */\nexport type DeepPartial<T> = T extends object ? {\n [P in keyof T]?: DeepPartial<T[P]>;\n} : T;\n"],"sourceRoot":".."}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Calls a method on which this decorator is applied before this entity soft removal.
3
+ */
4
+ export declare function AfterRecover(): PropertyDecorator;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AfterRecover = void 0;
4
+ var globals_1 = require("../../globals");
5
+ var EventListenerTypes_1 = require("../../metadata/types/EventListenerTypes");
6
+ /**
7
+ * Calls a method on which this decorator is applied before this entity soft removal.
8
+ */
9
+ function AfterRecover() {
10
+ return function (object, propertyName) {
11
+ (0, globals_1.getMetadataArgsStorage)().entityListeners.push({
12
+ target: object.constructor,
13
+ propertyName: propertyName,
14
+ type: EventListenerTypes_1.EventListenerTypes.AFTER_RECOVER
15
+ });
16
+ };
17
+ }
18
+ exports.AfterRecover = AfterRecover;
19
+
20
+ //# sourceMappingURL=AfterRecover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/decorator/listeners/AfterRecover.ts"],"names":[],"mappings":";;;AAAA,yCAAqD;AACrD,8EAA2E;AAG3E;;GAEG;AACH,SAAgB,YAAY;IACxB,OAAO,UAAU,MAAc,EAAE,YAAoB;QAEjD,IAAA,gCAAsB,GAAE,CAAC,eAAe,CAAC,IAAI,CAAC;YAC1C,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,IAAI,EAAE,uCAAkB,CAAC,aAAa;SACX,CAAC,CAAC;IACrC,CAAC,CAAC;AACN,CAAC;AATD,oCASC","file":"AfterRecover.js","sourcesContent":["import {getMetadataArgsStorage} from \"../../globals\";\nimport {EventListenerTypes} from \"../../metadata/types/EventListenerTypes\";\nimport {EntityListenerMetadataArgs} from \"../../metadata-args/EntityListenerMetadataArgs\";\n\n/**\n * Calls a method on which this decorator is applied before this entity soft removal.\n */\nexport function AfterRecover(): PropertyDecorator {\n return function (object: Object, propertyName: string) {\n\n getMetadataArgsStorage().entityListeners.push({\n target: object.constructor,\n propertyName: propertyName,\n type: EventListenerTypes.AFTER_RECOVER\n } as EntityListenerMetadataArgs);\n };\n}\n"],"sourceRoot":"../.."}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Calls a method on which this decorator is applied before this entity soft removal.
3
+ */
4
+ export declare function AfterSoftRemove(): PropertyDecorator;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AfterSoftRemove = void 0;
4
+ var globals_1 = require("../../globals");
5
+ var EventListenerTypes_1 = require("../../metadata/types/EventListenerTypes");
6
+ /**
7
+ * Calls a method on which this decorator is applied before this entity soft removal.
8
+ */
9
+ function AfterSoftRemove() {
10
+ return function (object, propertyName) {
11
+ (0, globals_1.getMetadataArgsStorage)().entityListeners.push({
12
+ target: object.constructor,
13
+ propertyName: propertyName,
14
+ type: EventListenerTypes_1.EventListenerTypes.AFTER_SOFT_REMOVE
15
+ });
16
+ };
17
+ }
18
+ exports.AfterSoftRemove = AfterSoftRemove;
19
+
20
+ //# sourceMappingURL=AfterSoftRemove.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/decorator/listeners/AfterSoftRemove.ts"],"names":[],"mappings":";;;AAAA,yCAAqD;AACrD,8EAA2E;AAG3E;;GAEG;AACH,SAAgB,eAAe;IAC3B,OAAO,UAAU,MAAc,EAAE,YAAoB;QAEjD,IAAA,gCAAsB,GAAE,CAAC,eAAe,CAAC,IAAI,CAAC;YAC1C,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,IAAI,EAAE,uCAAkB,CAAC,iBAAiB;SACf,CAAC,CAAC;IACrC,CAAC,CAAC;AACN,CAAC;AATD,0CASC","file":"AfterSoftRemove.js","sourcesContent":["import {getMetadataArgsStorage} from \"../../globals\";\nimport {EventListenerTypes} from \"../../metadata/types/EventListenerTypes\";\nimport {EntityListenerMetadataArgs} from \"../../metadata-args/EntityListenerMetadataArgs\";\n\n/**\n * Calls a method on which this decorator is applied before this entity soft removal.\n */\nexport function AfterSoftRemove(): PropertyDecorator {\n return function (object: Object, propertyName: string) {\n\n getMetadataArgsStorage().entityListeners.push({\n target: object.constructor,\n propertyName: propertyName,\n type: EventListenerTypes.AFTER_SOFT_REMOVE\n } as EntityListenerMetadataArgs);\n };\n}\n"],"sourceRoot":"../.."}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Calls a method on which this decorator is applied before this entity soft removal.
3
+ */
4
+ export declare function BeforeRecover(): PropertyDecorator;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BeforeRecover = void 0;
4
+ var globals_1 = require("../../globals");
5
+ var EventListenerTypes_1 = require("../../metadata/types/EventListenerTypes");
6
+ /**
7
+ * Calls a method on which this decorator is applied before this entity soft removal.
8
+ */
9
+ function BeforeRecover() {
10
+ return function (object, propertyName) {
11
+ (0, globals_1.getMetadataArgsStorage)().entityListeners.push({
12
+ target: object.constructor,
13
+ propertyName: propertyName,
14
+ type: EventListenerTypes_1.EventListenerTypes.BEFORE_RECOVER
15
+ });
16
+ };
17
+ }
18
+ exports.BeforeRecover = BeforeRecover;
19
+
20
+ //# sourceMappingURL=BeforeRecover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/decorator/listeners/BeforeRecover.ts"],"names":[],"mappings":";;;AAAA,yCAAqD;AACrD,8EAA2E;AAG3E;;GAEG;AACH,SAAgB,aAAa;IACzB,OAAO,UAAU,MAAc,EAAE,YAAoB;QAEjD,IAAA,gCAAsB,GAAE,CAAC,eAAe,CAAC,IAAI,CAAC;YAC1C,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,IAAI,EAAE,uCAAkB,CAAC,cAAc;SACZ,CAAC,CAAC;IACrC,CAAC,CAAC;AACN,CAAC;AATD,sCASC","file":"BeforeRecover.js","sourcesContent":["import {getMetadataArgsStorage} from \"../../globals\";\nimport {EventListenerTypes} from \"../../metadata/types/EventListenerTypes\";\nimport {EntityListenerMetadataArgs} from \"../../metadata-args/EntityListenerMetadataArgs\";\n\n/**\n * Calls a method on which this decorator is applied before this entity soft removal.\n */\nexport function BeforeRecover(): PropertyDecorator {\n return function (object: Object, propertyName: string) {\n\n getMetadataArgsStorage().entityListeners.push({\n target: object.constructor,\n propertyName: propertyName,\n type: EventListenerTypes.BEFORE_RECOVER\n } as EntityListenerMetadataArgs);\n };\n}\n"],"sourceRoot":"../.."}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Calls a method on which this decorator is applied before this entity soft removal.
3
+ */
4
+ export declare function BeforeSoftRemove(): PropertyDecorator;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BeforeSoftRemove = void 0;
4
+ var globals_1 = require("../../globals");
5
+ var EventListenerTypes_1 = require("../../metadata/types/EventListenerTypes");
6
+ /**
7
+ * Calls a method on which this decorator is applied before this entity soft removal.
8
+ */
9
+ function BeforeSoftRemove() {
10
+ return function (object, propertyName) {
11
+ (0, globals_1.getMetadataArgsStorage)().entityListeners.push({
12
+ target: object.constructor,
13
+ propertyName: propertyName,
14
+ type: EventListenerTypes_1.EventListenerTypes.BEFORE_SOFT_REMOVE
15
+ });
16
+ };
17
+ }
18
+ exports.BeforeSoftRemove = BeforeSoftRemove;
19
+
20
+ //# sourceMappingURL=BeforeSoftRemove.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/decorator/listeners/BeforeSoftRemove.ts"],"names":[],"mappings":";;;AAAA,yCAAqD;AACrD,8EAA2E;AAG3E;;GAEG;AACH,SAAgB,gBAAgB;IAC5B,OAAO,UAAU,MAAc,EAAE,YAAoB;QAEjD,IAAA,gCAAsB,GAAE,CAAC,eAAe,CAAC,IAAI,CAAC;YAC1C,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,IAAI,EAAE,uCAAkB,CAAC,kBAAkB;SAChB,CAAC,CAAC;IACrC,CAAC,CAAC;AACN,CAAC;AATD,4CASC","file":"BeforeSoftRemove.js","sourcesContent":["import {getMetadataArgsStorage} from \"../../globals\";\nimport {EventListenerTypes} from \"../../metadata/types/EventListenerTypes\";\nimport {EntityListenerMetadataArgs} from \"../../metadata-args/EntityListenerMetadataArgs\";\n\n/**\n * Calls a method on which this decorator is applied before this entity soft removal.\n */\nexport function BeforeSoftRemove(): PropertyDecorator {\n return function (object: Object, propertyName: string) {\n\n getMetadataArgsStorage().entityListeners.push({\n target: object.constructor,\n propertyName: propertyName,\n type: EventListenerTypes.BEFORE_SOFT_REMOVE\n } as EntityListenerMetadataArgs);\n };\n}\n"],"sourceRoot":"../.."}
@@ -15,6 +15,14 @@ export declare class BetterSqlite3QueryRunner extends AbstractSqliteQueryRunner
15
15
  private cacheSize;
16
16
  private stmtCache;
17
17
  private getStmt;
18
+ /**
19
+ * Called before migrations are run.
20
+ */
21
+ beforeMigration(): Promise<void>;
22
+ /**
23
+ * Called after migrations are run.
24
+ */
25
+ afterMigration(): Promise<void>;
18
26
  /**
19
27
  * Executes a given SQL query.
20
28
  */
@@ -60,6 +60,36 @@ var BetterSqlite3QueryRunner = /** @class */ (function (_super) {
60
60
  });
61
61
  });
62
62
  };
63
+ /**
64
+ * Called before migrations are run.
65
+ */
66
+ BetterSqlite3QueryRunner.prototype.beforeMigration = function () {
67
+ return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
68
+ return (0, tslib_1.__generator)(this, function (_a) {
69
+ switch (_a.label) {
70
+ case 0: return [4 /*yield*/, this.query("PRAGMA foreign_keys = OFF")];
71
+ case 1:
72
+ _a.sent();
73
+ return [2 /*return*/];
74
+ }
75
+ });
76
+ });
77
+ };
78
+ /**
79
+ * Called after migrations are run.
80
+ */
81
+ BetterSqlite3QueryRunner.prototype.afterMigration = function () {
82
+ return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
83
+ return (0, tslib_1.__generator)(this, function (_a) {
84
+ switch (_a.label) {
85
+ case 0: return [4 /*yield*/, this.query("PRAGMA foreign_keys = ON")];
86
+ case 1:
87
+ _a.sent();
88
+ return [2 /*return*/];
89
+ }
90
+ });
91
+ });
92
+ };
63
93
  /**
64
94
  * Executes a given SQL query.
65
95
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/driver/better-sqlite3/BetterSqlite3QueryRunner.ts"],"names":[],"mappings":";;;;AAAA,+FAA8F;AAC9F,iEAAgE;AAChE,0FAAyF;AACzF,4DAA2D;AAE3D,8DAA6D;AAE7D;;;;;GAKG;AACH;IAA8C,yDAAyB;IAOnE,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,kCAAY,MAA2B;QAAvC,YACI,iBAAO,SASV;QAGO,eAAS,GAAG,IAAI,GAAG,EAAe,CAAC;QAXvC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,KAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QACpC,KAAI,CAAC,WAAW,GAAG,IAAI,yBAAW,CAAC,KAAI,CAAC,CAAC;QACzC,IAAI,OAAO,KAAI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,IAAI,IAAI,EAAE,CAAC;4BAC3B,kBAAkB,GAAG,YAAY,GAAG,cAAc,CAAC;4BACzD,IAAI,qBAAqB,IAAI,kBAAkB,GAAG,qBAAqB;gCACnE,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,kBAAkB,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;4BAEhF,IAAI,CAAC,mBAAmB,EAAE;gCACtB,sBAAO,MAAM,CAAC,GAAG,EAAC;6BACrB;4BAED,sBAAO,MAAM,EAAC;yBACjB;wBAAC,OAAO,GAAG,EAAE;4BACV,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;4BAC9D,MAAM,IAAI,mCAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;yBACtD;;;;;KACJ;IACL,+BAAC;AAAD,CAvGA,AAuGC,CAvG6C,qDAAyB,GAuGtE;AAvGY,4DAAwB","file":"BetterSqlite3QueryRunner.js","sourcesContent":["import { QueryRunnerAlreadyReleasedError } from \"../../error/QueryRunnerAlreadyReleasedError\";\nimport { QueryFailedError } from \"../../error/QueryFailedError\";\nimport { AbstractSqliteQueryRunner } from \"../sqlite-abstract/AbstractSqliteQueryRunner\";\nimport { Broadcaster } from \"../../subscriber/Broadcaster\";\nimport { BetterSqlite3Driver } from \"./BetterSqlite3Driver\";\nimport { QueryResult } from \"../../query-runner/QueryResult\";\n\n/**\n * Runs queries on a single sqlite database connection.\n *\n * Does not support compose primary keys with autoincrement field.\n * todo: need to throw exception for this case.\n */\nexport class BetterSqlite3QueryRunner extends AbstractSqliteQueryRunner {\n\n /**\n * Database driver used by connection.\n */\n driver: BetterSqlite3Driver;\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(driver: BetterSqlite3Driver) {\n super();\n this.driver = driver;\n this.connection = driver.connection;\n this.broadcaster = new Broadcaster(this);\n if (typeof this.driver.options.statementCacheSize === \"number\") {\n this.cacheSize = this.driver.options.statementCacheSize;\n } else {\n this.cacheSize = 100;\n }\n }\n\n private cacheSize: number;\n private stmtCache = new Map<string, any>();\n\n private async getStmt(query: string) {\n if (this.cacheSize > 0) {\n let stmt = this.stmtCache.get(query);\n if (!stmt) {\n const databaseConnection = await this.connect();\n stmt = databaseConnection.prepare(query);\n this.stmtCache.set(query, stmt);\n while (this.stmtCache.size > this.cacheSize) {\n // since es6 map keeps the insertion order,\n // it comes to be FIFO cache\n const key = this.stmtCache.keys().next().value;\n this.stmtCache.delete(key);\n }\n }\n return stmt;\n } else {\n const databaseConnection = await this.connect();\n return databaseConnection.prepare(query);\n }\n }\n\n /**\n * Executes a given SQL query.\n */\n async query(query: string, parameters?: any[], useStructuredResult = false): Promise<any> {\n if (this.isReleased)\n throw new QueryRunnerAlreadyReleasedError();\n\n const connection = this.driver.connection;\n\n parameters = parameters || [];\n for (let i = 0; i < parameters.length; i++) {\n // in \"where\" clauses the parameters are not escaped by the driver\n if (typeof parameters[i] === \"boolean\")\n parameters[i] = +parameters[i];\n }\n\n this.driver.connection.logger.logQuery(query, parameters, this);\n const queryStartTime = +new Date();\n\n const stmt = await this.getStmt(query);\n\n try {\n const result = new QueryResult();\n\n if (stmt.reader) {\n const raw = stmt.all.apply(stmt, parameters);\n\n result.raw = raw;\n\n if (Array.isArray(raw)) {\n result.records = raw;\n }\n\n } else {\n const raw = stmt.run.apply(stmt, parameters);\n result.affected = raw.changes;\n result.raw = raw.lastInsertRowid;\n }\n\n // log slow queries if maxQueryExecution time is set\n const maxQueryExecutionTime = this.driver.options.maxQueryExecutionTime;\n const queryEndTime = +new Date();\n const queryExecutionTime = queryEndTime - queryStartTime;\n if (maxQueryExecutionTime && queryExecutionTime > maxQueryExecutionTime)\n connection.logger.logQuerySlow(queryExecutionTime, query, parameters, this);\n\n if (!useStructuredResult) {\n return result.raw;\n }\n\n return result;\n } catch (err) {\n connection.logger.logQueryError(err, query, parameters, this);\n throw new QueryFailedError(query, parameters, err);\n }\n }\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../../src/driver/better-sqlite3/BetterSqlite3QueryRunner.ts"],"names":[],"mappings":";;;;AAAA,+FAA8F;AAC9F,iEAAgE;AAChE,0FAAyF;AACzF,4DAA2D;AAE3D,8DAA6D;AAE7D;;;;;GAKG;AACH;IAA8C,yDAAyB;IAOnE,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,kCAAY,MAA2B;QAAvC,YACI,iBAAO,SASV;QAGO,eAAS,GAAG,IAAI,GAAG,EAAe,CAAC;QAXvC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,KAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QACpC,KAAI,CAAC,WAAW,GAAG,IAAI,yBAAW,CAAC,KAAI,CAAC,CAAC;QACzC,IAAI,OAAO,KAAI,CAAC,MAAM,CAAC,OAAO,CAAC,kBAAkB,KAAK,QAAQ,EAAE;YAC5D,KAAI,CAAC,SAAS,GAAG,KAAI,CAAC,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC;SAC3D;aAAM;YACH,KAAI,CAAC,SAAS,GAAG,GAAG,CAAC;SACxB;;IACL,CAAC;IAKa,0CAAO,GAArB,UAAsB,KAAa;;;;;;6BAC3B,CAAA,IAAI,CAAC,SAAS,GAAG,CAAC,CAAA,EAAlB,wBAAkB;wBACd,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;6BACjC,CAAC,IAAI,EAAL,wBAAK;wBACsB,qBAAM,IAAI,CAAC,OAAO,EAAE,EAAA;;wBAAzC,kBAAkB,GAAG,SAAoB;wBAC/C,IAAI,GAAG,kBAAkB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;wBACzC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;wBAChC,OAAO,IAAI,CAAC,SAA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KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;4BAC9D,MAAM,IAAI,mCAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;yBACtD;;;;;KACJ;IACL,+BAAC;AAAD,CArHA,AAqHC,CArH6C,qDAAyB,GAqHtE;AArHY,4DAAwB","file":"BetterSqlite3QueryRunner.js","sourcesContent":["import { QueryRunnerAlreadyReleasedError } from \"../../error/QueryRunnerAlreadyReleasedError\";\nimport { QueryFailedError } from \"../../error/QueryFailedError\";\nimport { AbstractSqliteQueryRunner } from \"../sqlite-abstract/AbstractSqliteQueryRunner\";\nimport { Broadcaster } from \"../../subscriber/Broadcaster\";\nimport { BetterSqlite3Driver } from \"./BetterSqlite3Driver\";\nimport { QueryResult } from \"../../query-runner/QueryResult\";\n\n/**\n * Runs queries on a single sqlite database connection.\n *\n * Does not support compose primary keys with autoincrement field.\n * todo: need to throw exception for this case.\n */\nexport class BetterSqlite3QueryRunner extends AbstractSqliteQueryRunner {\n\n /**\n * Database driver used by connection.\n */\n driver: BetterSqlite3Driver;\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(driver: BetterSqlite3Driver) {\n super();\n this.driver = driver;\n this.connection = driver.connection;\n this.broadcaster = new Broadcaster(this);\n if (typeof this.driver.options.statementCacheSize === \"number\") {\n this.cacheSize = this.driver.options.statementCacheSize;\n } else {\n this.cacheSize = 100;\n }\n }\n\n private cacheSize: number;\n private stmtCache = new Map<string, any>();\n\n private async getStmt(query: string) {\n if (this.cacheSize > 0) {\n let stmt = this.stmtCache.get(query);\n if (!stmt) {\n const databaseConnection = await this.connect();\n stmt = databaseConnection.prepare(query);\n this.stmtCache.set(query, stmt);\n while (this.stmtCache.size > this.cacheSize) {\n // since es6 map keeps the insertion order,\n // it comes to be FIFO cache\n const key = this.stmtCache.keys().next().value;\n this.stmtCache.delete(key);\n }\n }\n return stmt;\n } else {\n const databaseConnection = await this.connect();\n return databaseConnection.prepare(query);\n }\n }\n\n /**\n * Called before migrations are run.\n */\n async beforeMigration(): Promise<void> {\n await this.query(`PRAGMA foreign_keys = OFF`);\n }\n\n /**\n * Called after migrations are run.\n */\n async afterMigration(): Promise<void> {\n await this.query(`PRAGMA foreign_keys = ON`);\n }\n\n /**\n * Executes a given SQL query.\n */\n async query(query: string, parameters?: any[], useStructuredResult = false): Promise<any> {\n if (this.isReleased)\n throw new QueryRunnerAlreadyReleasedError();\n\n const connection = this.driver.connection;\n\n parameters = parameters || [];\n for (let i = 0; i < parameters.length; i++) {\n // in \"where\" clauses the parameters are not escaped by the driver\n if (typeof parameters[i] === \"boolean\")\n parameters[i] = +parameters[i];\n }\n\n this.driver.connection.logger.logQuery(query, parameters, this);\n const queryStartTime = +new Date();\n\n const stmt = await this.getStmt(query);\n\n try {\n const result = new QueryResult();\n\n if (stmt.reader) {\n const raw = stmt.all.apply(stmt, parameters);\n\n result.raw = raw;\n\n if (Array.isArray(raw)) {\n result.records = raw;\n }\n\n } else {\n const raw = stmt.run.apply(stmt, parameters);\n result.affected = raw.changes;\n result.raw = raw.lastInsertRowid;\n }\n\n // log slow queries if maxQueryExecution time is set\n const maxQueryExecutionTime = this.driver.options.maxQueryExecutionTime;\n const queryEndTime = +new Date();\n const queryExecutionTime = queryEndTime - queryStartTime;\n if (maxQueryExecutionTime && queryExecutionTime > maxQueryExecutionTime)\n connection.logger.logQuerySlow(queryExecutionTime, query, parameters, this);\n\n if (!useStructuredResult) {\n return result.raw;\n }\n\n return result;\n } catch (err) {\n connection.logger.logQueryError(err, query, parameters, this);\n throw new QueryFailedError(query, parameters, err);\n }\n }\n}\n"],"sourceRoot":"../.."}
@@ -10,6 +10,14 @@ export declare class CapacitorQueryRunner extends AbstractSqliteQueryRunner {
10
10
  */
11
11
  driver: CapacitorDriver;
12
12
  constructor(driver: CapacitorDriver);
13
+ /**
14
+ * Called before migrations are run.
15
+ */
16
+ beforeMigration(): Promise<void>;
17
+ /**
18
+ * Called after migrations are run.
19
+ */
20
+ afterMigration(): Promise<void>;
13
21
  executeSet(set: {
14
22
  statement: string;
15
23
  values?: any[];