typeorm 0.2.42-dev.93bf96e → 0.2.42-dev.9e844d9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/connection/BaseConnectionOptions.js.map +1 -1
- package/browser/connection/Connection.js +33 -24
- package/browser/connection/Connection.js.map +1 -1
- package/browser/connection/ConnectionOptionsReader.js +3 -1
- package/browser/connection/ConnectionOptionsReader.js.map +1 -1
- package/browser/driver/better-sqlite3/BetterSqlite3Driver.d.ts +14 -1
- package/browser/driver/better-sqlite3/BetterSqlite3Driver.js +87 -4
- package/browser/driver/better-sqlite3/BetterSqlite3Driver.js.map +1 -1
- package/browser/driver/better-sqlite3/BetterSqlite3QueryRunner.d.ts +10 -0
- package/browser/driver/better-sqlite3/BetterSqlite3QueryRunner.js +64 -1
- package/browser/driver/better-sqlite3/BetterSqlite3QueryRunner.js.map +1 -1
- package/browser/driver/capacitor/CapacitorQueryRunner.d.ts +8 -0
- package/browser/driver/capacitor/CapacitorQueryRunner.js +30 -0
- package/browser/driver/capacitor/CapacitorQueryRunner.js.map +1 -1
- package/browser/driver/cordova/CordovaQueryRunner.d.ts +8 -0
- package/browser/driver/cordova/CordovaQueryRunner.js +30 -0
- package/browser/driver/cordova/CordovaQueryRunner.js.map +1 -1
- package/browser/driver/expo/ExpoQueryRunner.d.ts +8 -0
- package/browser/driver/expo/ExpoQueryRunner.js +30 -0
- package/browser/driver/expo/ExpoQueryRunner.js.map +1 -1
- package/browser/driver/mongodb/MongoQueryRunner.d.ts +8 -0
- package/browser/driver/mongodb/MongoQueryRunner.js +20 -0
- package/browser/driver/mongodb/MongoQueryRunner.js.map +1 -1
- package/browser/driver/nativescript/NativescriptQueryRunner.d.ts +8 -0
- package/browser/driver/nativescript/NativescriptQueryRunner.js +30 -0
- package/browser/driver/nativescript/NativescriptQueryRunner.js.map +1 -1
- package/browser/driver/react-native/ReactNativeQueryRunner.d.ts +8 -0
- package/browser/driver/react-native/ReactNativeQueryRunner.js +30 -0
- package/browser/driver/react-native/ReactNativeQueryRunner.js.map +1 -1
- package/browser/driver/sqlite/SqliteDriver.d.ts +13 -0
- package/browser/driver/sqlite/SqliteDriver.js +84 -1
- package/browser/driver/sqlite/SqliteDriver.js.map +1 -1
- package/browser/driver/sqlite/SqliteQueryRunner.d.ts +8 -0
- package/browser/driver/sqlite/SqliteQueryRunner.js +30 -0
- package/browser/driver/sqlite/SqliteQueryRunner.js.map +1 -1
- package/browser/driver/sqlite-abstract/AbstractSqliteDriver.d.ts +13 -0
- package/browser/driver/sqlite-abstract/AbstractSqliteDriver.js +25 -2
- package/browser/driver/sqlite-abstract/AbstractSqliteDriver.js.map +1 -1
- package/browser/driver/sqlite-abstract/AbstractSqliteQueryRunner.d.ts +11 -1
- package/browser/driver/sqlite-abstract/AbstractSqliteQueryRunner.js +116 -55
- package/browser/driver/sqlite-abstract/AbstractSqliteQueryRunner.js.map +1 -1
- package/browser/driver/sqljs/SqljsQueryRunner.d.ts +8 -0
- package/browser/driver/sqljs/SqljsQueryRunner.js +30 -0
- package/browser/driver/sqljs/SqljsQueryRunner.js.map +1 -1
- package/browser/metadata-builder/EntityMetadataValidator.js +1 -1
- package/browser/metadata-builder/EntityMetadataValidator.js.map +1 -1
- package/browser/migration/MigrationExecutor.js +37 -25
- package/browser/migration/MigrationExecutor.js.map +1 -1
- package/browser/persistence/SubjectExecutor.d.ts +2 -0
- package/browser/persistence/SubjectExecutor.js +99 -7
- package/browser/persistence/SubjectExecutor.js.map +1 -1
- package/browser/persistence/tree/MaterializedPathSubjectExecutor.js +1 -1
- package/browser/persistence/tree/MaterializedPathSubjectExecutor.js.map +1 -1
- package/browser/query-builder/InsertQueryBuilder.js +9 -0
- package/browser/query-builder/InsertQueryBuilder.js.map +1 -1
- package/browser/query-builder/relation-id/RelationIdLoader.js +9 -9
- package/browser/query-builder/relation-id/RelationIdLoader.js.map +1 -1
- package/browser/query-builder/transformer/RawSqlResultsToEntityTransformer.d.ts +13 -0
- package/browser/query-builder/transformer/RawSqlResultsToEntityTransformer.js +94 -50
- package/browser/query-builder/transformer/RawSqlResultsToEntityTransformer.js.map +1 -1
- package/browser/query-runner/BaseQueryRunner.d.ts +8 -0
- package/browser/query-runner/BaseQueryRunner.js +20 -0
- package/browser/query-runner/BaseQueryRunner.js.map +1 -1
- package/browser/query-runner/QueryRunner.d.ts +8 -0
- package/browser/query-runner/QueryRunner.js.map +1 -1
- package/browser/schema-builder/RdbmsSchemaBuilder.js +36 -30
- package/browser/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
- package/browser/subscriber/Broadcaster.js +35 -31
- package/browser/subscriber/Broadcaster.js.map +1 -1
- package/browser/util/PathUtils.d.ts +10 -0
- package/browser/util/PathUtils.js +28 -0
- package/browser/util/PathUtils.js.map +1 -0
- package/connection/BaseConnectionOptions.js.map +1 -1
- package/connection/Connection.js +33 -24
- package/connection/Connection.js.map +1 -1
- package/connection/ConnectionOptionsReader.js +3 -1
- package/connection/ConnectionOptionsReader.js.map +1 -1
- package/driver/better-sqlite3/BetterSqlite3Driver.d.ts +14 -1
- package/driver/better-sqlite3/BetterSqlite3Driver.js +86 -3
- package/driver/better-sqlite3/BetterSqlite3Driver.js.map +1 -1
- package/driver/better-sqlite3/BetterSqlite3QueryRunner.d.ts +10 -0
- package/driver/better-sqlite3/BetterSqlite3QueryRunner.js +63 -0
- package/driver/better-sqlite3/BetterSqlite3QueryRunner.js.map +1 -1
- package/driver/capacitor/CapacitorQueryRunner.d.ts +8 -0
- package/driver/capacitor/CapacitorQueryRunner.js +30 -0
- package/driver/capacitor/CapacitorQueryRunner.js.map +1 -1
- package/driver/cordova/CordovaQueryRunner.d.ts +8 -0
- package/driver/cordova/CordovaQueryRunner.js +30 -0
- package/driver/cordova/CordovaQueryRunner.js.map +1 -1
- package/driver/expo/ExpoQueryRunner.d.ts +8 -0
- package/driver/expo/ExpoQueryRunner.js +30 -0
- package/driver/expo/ExpoQueryRunner.js.map +1 -1
- package/driver/mongodb/MongoQueryRunner.d.ts +8 -0
- package/driver/mongodb/MongoQueryRunner.js +20 -0
- package/driver/mongodb/MongoQueryRunner.js.map +1 -1
- package/driver/nativescript/NativescriptQueryRunner.d.ts +8 -0
- package/driver/nativescript/NativescriptQueryRunner.js +30 -0
- package/driver/nativescript/NativescriptQueryRunner.js.map +1 -1
- package/driver/react-native/ReactNativeQueryRunner.d.ts +8 -0
- package/driver/react-native/ReactNativeQueryRunner.js +30 -0
- package/driver/react-native/ReactNativeQueryRunner.js.map +1 -1
- package/driver/sqlite/SqliteDriver.d.ts +13 -0
- package/driver/sqlite/SqliteDriver.js +83 -0
- package/driver/sqlite/SqliteDriver.js.map +1 -1
- package/driver/sqlite/SqliteQueryRunner.d.ts +8 -0
- package/driver/sqlite/SqliteQueryRunner.js +30 -0
- package/driver/sqlite/SqliteQueryRunner.js.map +1 -1
- package/driver/sqlite-abstract/AbstractSqliteDriver.d.ts +13 -0
- package/driver/sqlite-abstract/AbstractSqliteDriver.js +25 -2
- package/driver/sqlite-abstract/AbstractSqliteDriver.js.map +1 -1
- package/driver/sqlite-abstract/AbstractSqliteQueryRunner.d.ts +11 -1
- package/driver/sqlite-abstract/AbstractSqliteQueryRunner.js +116 -55
- package/driver/sqlite-abstract/AbstractSqliteQueryRunner.js.map +1 -1
- package/driver/sqljs/SqljsQueryRunner.d.ts +8 -0
- package/driver/sqljs/SqljsQueryRunner.js +30 -0
- package/driver/sqljs/SqljsQueryRunner.js.map +1 -1
- package/metadata-builder/EntityMetadataValidator.js +1 -1
- package/metadata-builder/EntityMetadataValidator.js.map +1 -1
- package/migration/MigrationExecutor.js +37 -25
- package/migration/MigrationExecutor.js.map +1 -1
- package/package.json +1 -1
- package/persistence/SubjectExecutor.d.ts +2 -0
- package/persistence/SubjectExecutor.js +99 -7
- package/persistence/SubjectExecutor.js.map +1 -1
- package/persistence/tree/MaterializedPathSubjectExecutor.js +1 -1
- package/persistence/tree/MaterializedPathSubjectExecutor.js.map +1 -1
- package/query-builder/InsertQueryBuilder.js +9 -0
- package/query-builder/InsertQueryBuilder.js.map +1 -1
- package/query-builder/relation-id/RelationIdLoader.js +9 -9
- package/query-builder/relation-id/RelationIdLoader.js.map +1 -1
- package/query-builder/transformer/RawSqlResultsToEntityTransformer.d.ts +13 -0
- package/query-builder/transformer/RawSqlResultsToEntityTransformer.js +94 -50
- package/query-builder/transformer/RawSqlResultsToEntityTransformer.js.map +1 -1
- package/query-runner/BaseQueryRunner.d.ts +8 -0
- package/query-runner/BaseQueryRunner.js +20 -0
- package/query-runner/BaseQueryRunner.js.map +1 -1
- package/query-runner/QueryRunner.d.ts +8 -0
- package/query-runner/QueryRunner.js.map +1 -1
- package/schema-builder/RdbmsSchemaBuilder.js +36 -30
- package/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
- package/subscriber/Broadcaster.js +35 -31
- package/subscriber/Broadcaster.js.map +1 -1
- package/util/PathUtils.d.ts +10 -0
- package/util/PathUtils.js +34 -0
- package/util/PathUtils.js.map +1 -0
|
@@ -1 +1 @@
|
|
|
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,iBAAy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AAU,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,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":".."}
|
|
1
|
+
{"version":3,"sources":["../browser/src/subscriber/Broadcaster.ts"],"names":[],"mapp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E,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;oBAC9E,MAAM,CAAC,KAAK,EAAE,CAAC;gBACnB,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;SACN;IACL,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 // Calculate which subscribers are fitting for the given entity type\n const fittingSubscribers = this.queryRunner.connection.subscribers.filter(subscriber => this.isAllowedSubscriber(subscriber, metadata.target) && subscriber.afterLoad);\n\n if (metadata.relations.length || metadata.afterLoadListeners.length || fittingSubscribers.length) {\n // todo: check why need this?\n const nonPromiseEntities = entities.filter(entity => !(entity instanceof Promise));\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 nonPromiseEntities.forEach(entity => {\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)) return;\n\n const value = relation.getEntityValue(entity);\n if (value instanceof Object) this.broadcastLoadEvent(result, relation.inverseEntityMetadata, Array.isArray(value) ? value : [value]);\n });\n });\n }\n\n if (metadata.afterLoadListeners.length) {\n metadata.afterLoadListeners.forEach(listener => {\n nonPromiseEntities.forEach(entity => {\n if (listener.isAllowed(entity)) {\n const executionResult = listener.execute(entity);\n if (executionResult instanceof Promise) result.promises.push(executionResult);\n result.count++;\n }\n });\n });\n }\n\n fittingSubscribers.forEach(subscriber => {\n nonPromiseEntities.forEach(entity => {\n const executionResult = subscriber.afterLoad!(entity, {\n entity,\n metadata,\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n });\n if (executionResult instanceof Promise) result.promises.push(executionResult);\n result.count++;\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":".."}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function toPortablePath(filepath: string): string;
|
|
2
|
+
/**
|
|
3
|
+
* Create deterministic valid database name (class, database) of fixed length from any filepath. Equivalent paths for windows/posix systems should
|
|
4
|
+
* be equivalent to enable portability
|
|
5
|
+
*/
|
|
6
|
+
export declare function filepathToName(filepath: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Cross platform isAbsolute
|
|
9
|
+
*/
|
|
10
|
+
export declare function isAbsolute(filepath: string): boolean;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { hash } from "./StringUtils";
|
|
2
|
+
var WINDOWS_PATH_REGEXP = /^([a-zA-Z]:.*)$/;
|
|
3
|
+
var UNC_WINDOWS_PATH_REGEXP = /^\\\\(\.\\)?(.*)$/;
|
|
4
|
+
export function toPortablePath(filepath) {
|
|
5
|
+
if (process.platform !== "win32")
|
|
6
|
+
return filepath;
|
|
7
|
+
if (filepath.match(WINDOWS_PATH_REGEXP))
|
|
8
|
+
filepath = filepath.replace(WINDOWS_PATH_REGEXP, "/$1");
|
|
9
|
+
else if (filepath.match(UNC_WINDOWS_PATH_REGEXP))
|
|
10
|
+
filepath = filepath.replace(UNC_WINDOWS_PATH_REGEXP, function (match, p1, p2) { return "/unc/" + (p1 ? ".dot/" : "") + p2; });
|
|
11
|
+
return filepath.replace(/\\/g, "/");
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create deterministic valid database name (class, database) of fixed length from any filepath. Equivalent paths for windows/posix systems should
|
|
15
|
+
* be equivalent to enable portability
|
|
16
|
+
*/
|
|
17
|
+
export function filepathToName(filepath) {
|
|
18
|
+
var uniq = toPortablePath(filepath).toLowerCase();
|
|
19
|
+
return hash(uniq, { length: 63 });
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Cross platform isAbsolute
|
|
23
|
+
*/
|
|
24
|
+
export function isAbsolute(filepath) {
|
|
25
|
+
return !!filepath.match(/^(?:[a-z]:|[\\]|[\/])/i);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=PathUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../browser/src/util/PathUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,IAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAC9C,IAAM,uBAAuB,GAAG,mBAAmB,CAAC;AAEpD,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO;QAC9B,OAAO,QAAQ,CAAC;IAElB,IAAI,QAAQ,CAAC,KAAK,CAAC,mBAAmB,CAAC;QACrC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;SACrD,IAAI,QAAQ,CAAC,KAAK,CAAC,uBAAuB,CAAC;QAC9C,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,uBAAuB,EAAE,UAAC,KAAK,EAAE,EAAE,EAAE,EAAE,IAAK,OAAA,WAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAG,EAAI,EAAhC,CAAgC,CAAC,CAAC;IAE5G,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACtC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,IAAM,IAAI,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;IACpD,OAAO,IAAI,CAAC,IAAI,EAAE,EAAC,MAAM,EAAE,EAAE,EAAC,CAAC,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,QAAgB;IACzC,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;AACpD,CAAC","file":"PathUtils.js","sourcesContent":["import { hash } from \"./StringUtils\";\n\nconst WINDOWS_PATH_REGEXP = /^([a-zA-Z]:.*)$/;\nconst UNC_WINDOWS_PATH_REGEXP = /^\\\\\\\\(\\.\\\\)?(.*)$/;\n\nexport function toPortablePath(filepath: string): string {\n if (process.platform !== `win32`)\n return filepath;\n\n if (filepath.match(WINDOWS_PATH_REGEXP))\n filepath = filepath.replace(WINDOWS_PATH_REGEXP, `/$1`);\n else if (filepath.match(UNC_WINDOWS_PATH_REGEXP))\n filepath = filepath.replace(UNC_WINDOWS_PATH_REGEXP, (match, p1, p2) => `/unc/${p1 ? `.dot/` : ``}${p2}`);\n\n return filepath.replace(/\\\\/g, `/`);\n}\n\n/**\n * Create deterministic valid database name (class, database) of fixed length from any filepath. Equivalent paths for windows/posix systems should\n * be equivalent to enable portability\n */\nexport function filepathToName(filepath: string): string {\n const uniq = toPortablePath(filepath).toLowerCase();\n return hash(uniq, {length: 63});\n}\n\n/**\n * Cross platform isAbsolute\n */\nexport function isAbsolute(filepath: string): boolean {\n return !!filepath.match(/^(?:[a-z]:|[\\\\]|[\\/])/i);\n}\n"],"sourceRoot":".."}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/connection/BaseConnectionOptions.ts"],"names":[],"mappings":"","file":"BaseConnectionOptions.js","sourcesContent":["import {EntitySchema} from \"../entity-schema/EntitySchema\";\nimport {LoggerOptions} from \"../logger/LoggerOptions\";\nimport {NamingStrategyInterface} from \"../naming-strategy/NamingStrategyInterface\";\nimport {DatabaseType} from \"../driver/types/DatabaseType\";\nimport {Logger} from \"../logger/Logger\";\nimport {Connection} from \"./Connection\";\nimport {QueryResultCache} from \"../cache/QueryResultCache\";\n\n/**\n * BaseConnectionOptions is set of connection options shared by all database types.\n */\nexport interface BaseConnectionOptions {\n\n /**\n * Database type. This value is required.\n */\n readonly type: DatabaseType;\n\n /**\n * Connection name. If connection name is not given then it will be called \"default\".\n * Different connections must have different names.\n */\n readonly name?: string;\n\n /**\n * Entities to be loaded for this connection.\n * Accepts both entity classes and directories where from entities need to be loaded.\n * Directories support glob patterns.\n */\n readonly entities?: ((Function|string|EntitySchema<any>))[];\n\n /**\n * Subscribers to be loaded for this connection.\n * Accepts both subscriber classes and directories where from subscribers need to be loaded.\n * Directories support glob patterns.\n */\n readonly subscribers?: (Function|string)[];\n\n /**\n * Migrations to be loaded for this connection.\n * Accepts both migration classes and directories where from migrations need to be loaded.\n * Directories support glob patterns.\n */\n readonly migrations?: (Function|string)[];\n\n /**\n * Migrations table name, in case of different name from \"migrations\".\n * Accepts single string name.\n */\n readonly migrationsTableName?: string;\n\n /**\n * Transaction mode for migrations to run in\n */\n readonly migrationsTransactionMode?: \"all\" | \"none\" | \"each\";\n\n /**\n * Typeorm metadata table name, in case of different name from \"typeorm_metadata\".\n * Accepts single string name.\n */\n readonly metadataTableName?: string;\n\n /**\n * Naming strategy to be used to name tables and columns in the database.\n */\n readonly namingStrategy?: NamingStrategyInterface;\n\n /**\n * Logging options.\n */\n readonly logging?: LoggerOptions;\n\n /**\n * Logger instance used to log queries and events in the ORM.\n */\n readonly logger?: \"advanced-console\"|\"simple-console\"|\"file\"|\"debug\"|Logger;\n\n /**\n * Maximum number of milliseconds query should be executed before logger log a warning.\n */\n readonly maxQueryExecutionTime?: number;\n\n /**\n * Indicates if database schema should be auto created on every application launch.\n * Be careful with this option and don't use this in production - otherwise you can lose production data.\n * This option is useful during debug and development.\n * Alternative to it, you can use CLI and run schema:sync command.\n *\n * Note that for MongoDB database it does not create schema, because MongoDB is schemaless.\n * Instead, it syncs just by creating indices.\n */\n readonly synchronize?: boolean;\n\n /**\n * Indicates if migrations should be auto run on every application launch.\n * Alternative to it, you can use CLI and run migrations:run command.\n */\n readonly migrationsRun?: boolean;\n\n /**\n * Drops the schema each time connection is being established.\n * Be careful with this option and don't use this in production - otherwise you'll lose all production data.\n * This option is useful during debug and development.\n */\n readonly dropSchema?: boolean;\n\n /**\n * Prefix to use on all tables (collections) of this connection in the database.\n */\n readonly entityPrefix?: string;\n\n /**\n * When creating new Entity instances, skip all constructors when true.\n */\n readonly entitySkipConstructor?: boolean;\n\n /**\n * Extra connection options to be passed to the underlying driver.\n *\n * todo: deprecate this and move all database-specific types into hts own connection options object.\n */\n readonly extra?: any;\n\n /**\n * Allows to setup cache options.\n */\n readonly cache?: boolean|{\n\n /**\n * Type of caching.\n *\n * - \"database\" means cached values will be stored in the separate table in database. This is default value.\n * - \"redis\" means cached values will be stored inside redis. You must provide redis connection options.\n */\n readonly type?: \"database\" | \"redis\" | \"ioredis\" | \"ioredis/cluster\"; // todo: add mongodb and other cache providers as well in the future\n\n /**\n * Factory function for custom cache providers that implement QueryResultCache.\n */\n readonly provider?: (connection: Connection) => QueryResultCache;\n\n /**\n * Configurable table name for \"database\" type cache.\n * Default value is \"query-result-cache\"\n */\n readonly tableName?: string;\n\n /**\n * Used to provide redis connection options.\n */\n readonly options?: any;\n\n /**\n * If set to true then queries (using find methods and QueryBuilder's methods) will always be cached.\n */\n readonly alwaysEnabled?: boolean;\n\n /**\n * Time in milliseconds in which cache will expire.\n * This can be setup per-query.\n * Default value is 1000 which is equivalent to 1 second.\n */\n readonly duration?: number;\n\n /**\n * Used to specify if cache errors should be ignored, and pass through the call to the Database.\n */\n readonly ignoreErrors?: boolean;\n };\n\n /**\n * CLI settings.\n */\n readonly cli?: {\n\n /**\n * Directory where entities should be created by default.\n */\n readonly entitiesDir?: string;\n\n /**\n * Directory where migrations should be created by default.\n */\n readonly migrationsDir?: string;\n\n /**\n * Directory where subscribers should be created by default.\n */\n readonly subscribersDir?: string;\n\n };\n\n}\n"],"sourceRoot":".."}
|
|
1
|
+
{"version":3,"sources":["../../src/connection/BaseConnectionOptions.ts"],"names":[],"mappings":"","file":"BaseConnectionOptions.js","sourcesContent":["import {EntitySchema} from \"../entity-schema/EntitySchema\";\nimport {LoggerOptions} from \"../logger/LoggerOptions\";\nimport {NamingStrategyInterface} from \"../naming-strategy/NamingStrategyInterface\";\nimport {DatabaseType} from \"../driver/types/DatabaseType\";\nimport {Logger} from \"../logger/Logger\";\nimport {Connection} from \"./Connection\";\nimport {QueryResultCache} from \"../cache/QueryResultCache\";\n\n/**\n * BaseConnectionOptions is set of connection options shared by all database types.\n */\nexport interface BaseConnectionOptions {\n\n /**\n * Database type. This value is required.\n */\n readonly type: DatabaseType;\n\n /**\n * Connection name. If connection name is not given then it will be called \"default\".\n * Different connections must have different names.\n */\n readonly name?: string;\n\n /**\n * Entities to be loaded for this connection.\n * Accepts both entity classes and directories where from entities need to be loaded.\n * Directories support glob patterns.\n */\n readonly entities?: ((Function|string|EntitySchema<any>))[];\n\n /**\n * Subscribers to be loaded for this connection.\n * Accepts both subscriber classes and directories where from subscribers need to be loaded.\n * Directories support glob patterns.\n */\n readonly subscribers?: (Function|string)[];\n\n /**\n * Migrations to be loaded for this connection.\n * Accepts both migration classes and directories where from migrations need to be loaded.\n * Directories support glob patterns.\n */\n readonly migrations?: (Function|string)[];\n\n /**\n * Migrations table name, in case of different name from \"migrations\".\n * Accepts single string name.\n */\n readonly migrationsTableName?: string;\n\n /**\n * Transaction mode for migrations to run in\n */\n readonly migrationsTransactionMode?: \"all\" | \"none\" | \"each\";\n\n /**\n * Typeorm metadata table name, in case of different name from \"typeorm_metadata\".\n * Accepts single string name.\n */\n readonly metadataTableName?: string;\n\n /**\n * Naming strategy to be used to name tables and columns in the database.\n */\n readonly namingStrategy?: NamingStrategyInterface;\n\n /**\n * Logging options.\n */\n readonly logging?: LoggerOptions;\n\n /**\n * Logger instance used to log queries and events in the ORM.\n */\n readonly logger?: \"advanced-console\"|\"simple-console\"|\"file\"|\"debug\"|Logger;\n\n /**\n * Maximum number of milliseconds query should be executed before logger log a warning.\n */\n readonly maxQueryExecutionTime?: number;\n\n /**\n * Indicates if database schema should be auto created on every application launch.\n * Be careful with this option and don't use this in production - otherwise you can lose production data.\n * This option is useful during debug and development.\n * Alternative to it, you can use CLI and run schema:sync command.\n *\n * Note that for MongoDB database it does not create schema, because MongoDB is schemaless.\n * Instead, it syncs just by creating indices.\n */\n readonly synchronize?: boolean;\n\n /**\n * Indicates if migrations should be auto run on every application launch.\n * Alternative to it, you can use CLI and run migrations:run command.\n */\n readonly migrationsRun?: boolean;\n\n /**\n * Drops the schema each time connection is being established.\n * Be careful with this option and don't use this in production - otherwise you'll lose all production data.\n * This option is useful during debug and development.\n */\n readonly dropSchema?: boolean;\n\n /**\n * Prefix to use on all tables (collections) of this connection in the database.\n */\n readonly entityPrefix?: string;\n\n /**\n * When creating new Entity instances, skip all constructors when true.\n */\n readonly entitySkipConstructor?: boolean;\n\n /**\n * Extra connection options to be passed to the underlying driver.\n *\n * todo: deprecate this and move all database-specific types into hts own connection options object.\n */\n readonly extra?: any;\n\n /**\n * Holds reference to the baseDirectory where configuration file are expected\n * @internal\n */\n baseDirectory?: string;\n\n /**\n * Allows to setup cache options.\n */\n readonly cache?: boolean|{\n\n /**\n * Type of caching.\n *\n * - \"database\" means cached values will be stored in the separate table in database. This is default value.\n * - \"redis\" means cached values will be stored inside redis. You must provide redis connection options.\n */\n readonly type?: \"database\" | \"redis\" | \"ioredis\" | \"ioredis/cluster\"; // todo: add mongodb and other cache providers as well in the future\n\n /**\n * Factory function for custom cache providers that implement QueryResultCache.\n */\n readonly provider?: (connection: Connection) => QueryResultCache;\n\n /**\n * Configurable table name for \"database\" type cache.\n * Default value is \"query-result-cache\"\n */\n readonly tableName?: string;\n\n /**\n * Used to provide redis connection options.\n */\n readonly options?: any;\n\n /**\n * If set to true then queries (using find methods and QueryBuilder's methods) will always be cached.\n */\n readonly alwaysEnabled?: boolean;\n\n /**\n * Time in milliseconds in which cache will expire.\n * This can be setup per-query.\n * Default value is 1000 which is equivalent to 1 second.\n */\n readonly duration?: number;\n\n /**\n * Used to specify if cache errors should be ignored, and pass through the call to the Database.\n */\n readonly ignoreErrors?: boolean;\n };\n\n /**\n * CLI settings.\n */\n readonly cli?: {\n\n /**\n * Directory where entities should be created by default.\n */\n readonly entitiesDir?: string;\n\n /**\n * Directory where migrations should be created by default.\n */\n readonly migrationsDir?: string;\n\n /**\n * Directory where subscribers should be created by default.\n */\n readonly subscribersDir?: string;\n\n };\n\n}\n"],"sourceRoot":".."}
|
package/connection/Connection.js
CHANGED
|
@@ -21,6 +21,7 @@ var SqljsEntityManager_1 = require("../entity-manager/SqljsEntityManager");
|
|
|
21
21
|
var RelationLoader_1 = require("../query-builder/RelationLoader");
|
|
22
22
|
var EntitySchema_1 = require("../entity-schema/EntitySchema");
|
|
23
23
|
var SqlServerDriver_1 = require("../driver/sqlserver/SqlServerDriver");
|
|
24
|
+
var AbstractSqliteDriver_1 = require("../driver/sqlite-abstract/AbstractSqliteDriver");
|
|
24
25
|
var MysqlDriver_1 = require("../driver/mysql/MysqlDriver");
|
|
25
26
|
var ObjectUtils_1 = require("../util/ObjectUtils");
|
|
26
27
|
var AuroraDataApiDriver_1 = require("../driver/aurora-data-api/AuroraDataApiDriver");
|
|
@@ -236,50 +237,58 @@ var Connection = /** @class */ (function () {
|
|
|
236
237
|
queryRunner = this.createQueryRunner();
|
|
237
238
|
_b.label = 1;
|
|
238
239
|
case 1:
|
|
239
|
-
_b.trys.push([1, ,
|
|
240
|
-
if (!(this.driver instanceof SqlServerDriver_1.SqlServerDriver || this.driver instanceof MysqlDriver_1.MysqlDriver || this.driver instanceof AuroraDataApiDriver_1.AuroraDataApiDriver)) return [3 /*break*/,
|
|
241
|
-
databases_2 =
|
|
240
|
+
_b.trys.push([1, , 14, 16]);
|
|
241
|
+
if (!(this.driver instanceof SqlServerDriver_1.SqlServerDriver || this.driver instanceof MysqlDriver_1.MysqlDriver || this.driver instanceof AuroraDataApiDriver_1.AuroraDataApiDriver || this.driver instanceof AbstractSqliteDriver_1.AbstractSqliteDriver)) return [3 /*break*/, 11];
|
|
242
|
+
databases_2 = [];
|
|
242
243
|
this.entityMetadatas.forEach(function (metadata) {
|
|
243
244
|
if (metadata.database && databases_2.indexOf(metadata.database) === -1)
|
|
244
245
|
databases_2.push(metadata.database);
|
|
245
246
|
});
|
|
246
|
-
|
|
247
|
+
if (databases_2.length === 0 && this.driver.database) {
|
|
248
|
+
databases_2.push(this.driver.database);
|
|
249
|
+
}
|
|
250
|
+
;
|
|
251
|
+
if (!(databases_2.length === 0)) return [3 /*break*/, 3];
|
|
252
|
+
return [4 /*yield*/, queryRunner.clearDatabase()];
|
|
247
253
|
case 2:
|
|
248
|
-
_b.
|
|
249
|
-
|
|
250
|
-
_b.label = 3;
|
|
254
|
+
_b.sent();
|
|
255
|
+
return [3 /*break*/, 10];
|
|
251
256
|
case 3:
|
|
252
|
-
|
|
257
|
+
_b.trys.push([3, 8, 9, 10]);
|
|
258
|
+
databases_1 = (0, tslib_1.__values)(databases_2), databases_1_1 = databases_1.next();
|
|
259
|
+
_b.label = 4;
|
|
260
|
+
case 4:
|
|
261
|
+
if (!!databases_1_1.done) return [3 /*break*/, 7];
|
|
253
262
|
database = databases_1_1.value;
|
|
254
263
|
return [4 /*yield*/, queryRunner.clearDatabase(database)];
|
|
255
|
-
case 4:
|
|
256
|
-
_b.sent();
|
|
257
|
-
_b.label = 5;
|
|
258
264
|
case 5:
|
|
265
|
+
_b.sent();
|
|
266
|
+
_b.label = 6;
|
|
267
|
+
case 6:
|
|
259
268
|
databases_1_1 = databases_1.next();
|
|
260
|
-
return [3 /*break*/,
|
|
261
|
-
case
|
|
262
|
-
case
|
|
269
|
+
return [3 /*break*/, 4];
|
|
270
|
+
case 7: return [3 /*break*/, 10];
|
|
271
|
+
case 8:
|
|
263
272
|
e_1_1 = _b.sent();
|
|
264
273
|
e_1 = { error: e_1_1 };
|
|
265
|
-
return [3 /*break*/,
|
|
266
|
-
case
|
|
274
|
+
return [3 /*break*/, 10];
|
|
275
|
+
case 9:
|
|
267
276
|
try {
|
|
268
277
|
if (databases_1_1 && !databases_1_1.done && (_a = databases_1.return)) _a.call(databases_1);
|
|
269
278
|
}
|
|
270
279
|
finally { if (e_1) throw e_1.error; }
|
|
271
280
|
return [7 /*endfinally*/];
|
|
272
|
-
case
|
|
273
|
-
case
|
|
274
|
-
case
|
|
281
|
+
case 10: return [3 /*break*/, 13];
|
|
282
|
+
case 11: return [4 /*yield*/, queryRunner.clearDatabase()];
|
|
283
|
+
case 12:
|
|
275
284
|
_b.sent();
|
|
276
|
-
_b.label =
|
|
277
|
-
case
|
|
278
|
-
case
|
|
279
|
-
case
|
|
285
|
+
_b.label = 13;
|
|
286
|
+
case 13: return [3 /*break*/, 16];
|
|
287
|
+
case 14: return [4 /*yield*/, queryRunner.release()];
|
|
288
|
+
case 15:
|
|
280
289
|
_b.sent();
|
|
281
290
|
return [7 /*endfinally*/];
|
|
282
|
-
case
|
|
291
|
+
case 16: return [2 /*return*/];
|
|
283
292
|
}
|
|
284
293
|
});
|
|
285
294
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/connection/Connection.ts"],"names":[],"mappings":";;;;AAMA,kFAA+E;AAC/E,0FAAuF;AACvF,kGAA+F;AAK/F,oFAAiF;AAEjF,oEAAiE;AAGjE,6DAA0D;AAC1D,2EAAwE;AACxE,uFAAoF;AAEpF,4GAAyG;AACzG,+EAA4E;AAC5E,yDAAsD;AACtD,yEAAsE;AAEtE,0EAAuE;AACvE,yDAAsD;AACtD,4EAAyE;AAEzE,2EAAwE;AACxE,kEAA+D;AAC/D,8DAA2D;AAC3D,uEAAoE;AACpE,2DAAwD;AACxD,mDAAgD;AAEhD,qFAAkF;AAElF,sDAAqD;AAErD;;;;GAIG;AACH;IAuEI,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,oBAAY,OAA0B;QA7BtC;;WAEG;QACM,eAAU,GAAyB,EAAE,CAAC;QAE/C;;WAEG;QACM,gBAAW,GAAqC,EAAE,CAAC;QAE5D;;WAEG;QACM,oBAAe,GAAqB,EAAE,CAAC;QAiB5C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,SAAS,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,IAAI,6BAAa,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACpF,IAAI,CAAC,MAAM,GAAG,IAAI,6BAAa,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC/C,IAA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YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,UAAA,QAAQ,IAAI,OAAA,QAAQ,CAAC,SAAS,KAAK,MAAM,EAA7B,CAA6B,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;;;;;KAC7H;IACL,iBAAC;AAAD,CA9dA,AA8dC,IAAA;AA9dY,gCAAU","file":"Connection.js","sourcesContent":["import {Driver} from \"../driver/Driver\";\nimport {Repository} from \"../repository/Repository\";\nimport {EntitySubscriberInterface} from \"../subscriber/EntitySubscriberInterface\";\nimport {EntityTarget} from \"../common/EntityTarget\";\nimport {ObjectType} from \"../common/ObjectType\";\nimport {EntityManager} from \"../entity-manager/EntityManager\";\nimport {DefaultNamingStrategy} from \"../naming-strategy/DefaultNamingStrategy\";\nimport {CannotExecuteNotConnectedError} from \"../error/CannotExecuteNotConnectedError\";\nimport {CannotConnectAlreadyConnectedError} from \"../error/CannotConnectAlreadyConnectedError\";\nimport {TreeRepository} from \"../repository/TreeRepository\";\nimport {NamingStrategyInterface} from \"../naming-strategy/NamingStrategyInterface\";\nimport {EntityMetadata} from \"../metadata/EntityMetadata\";\nimport {Logger} from \"../logger/Logger\";\nimport {EntityMetadataNotFoundError} from \"../error/EntityMetadataNotFoundError\";\nimport {MigrationInterface} from \"../migration/MigrationInterface\";\nimport {MigrationExecutor} from \"../migration/MigrationExecutor\";\nimport {Migration} from \"../migration/Migration\";\nimport {MongoRepository} from \"../repository/MongoRepository\";\nimport {MongoDriver} from \"../driver/mongodb/MongoDriver\";\nimport {MongoEntityManager} from \"../entity-manager/MongoEntityManager\";\nimport {EntityMetadataValidator} from \"../metadata-builder/EntityMetadataValidator\";\nimport {ConnectionOptions} from \"./ConnectionOptions\";\nimport {QueryRunnerProviderAlreadyReleasedError} from \"../error/QueryRunnerProviderAlreadyReleasedError\";\nimport {EntityManagerFactory} from \"../entity-manager/EntityManagerFactory\";\nimport {DriverFactory} from \"../driver/DriverFactory\";\nimport {ConnectionMetadataBuilder} from \"./ConnectionMetadataBuilder\";\nimport {QueryRunner} from \"../query-runner/QueryRunner\";\nimport {SelectQueryBuilder} from \"../query-builder/SelectQueryBuilder\";\nimport {LoggerFactory} from \"../logger/LoggerFactory\";\nimport {QueryResultCacheFactory} from \"../cache/QueryResultCacheFactory\";\nimport {QueryResultCache} from \"../cache/QueryResultCache\";\nimport {SqljsEntityManager} from \"../entity-manager/SqljsEntityManager\";\nimport {RelationLoader} from \"../query-builder/RelationLoader\";\nimport {EntitySchema} from \"../entity-schema/EntitySchema\";\nimport {SqlServerDriver} from \"../driver/sqlserver/SqlServerDriver\";\nimport {MysqlDriver} from \"../driver/mysql/MysqlDriver\";\nimport {ObjectUtils} from \"../util/ObjectUtils\";\nimport {IsolationLevel} from \"../driver/types/IsolationLevel\";\nimport {AuroraDataApiDriver} from \"../driver/aurora-data-api/AuroraDataApiDriver\";\nimport {ReplicationMode} from \"../driver/types/ReplicationMode\";\nimport { TypeORMError } from \"../error/TypeORMError\";\n\n/**\n * Connection is a single database ORM connection to a specific database.\n * Its not required to be a database connection, depend on database type it can create connection pool.\n * You can have multiple connections to multiple databases in your application.\n */\nexport class Connection {\n\n // -------------------------------------------------------------------------\n // Public Readonly Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection name.\n */\n readonly name: string;\n\n /**\n * Connection options.\n */\n readonly options: ConnectionOptions;\n\n /**\n * Indicates if connection is initialized or not.\n */\n readonly isConnected: boolean;\n\n /**\n * Database driver used by this connection.\n */\n readonly driver: Driver;\n\n /**\n * EntityManager of this connection.\n */\n readonly manager: EntityManager;\n\n /**\n * Naming strategy used in the connection.\n */\n readonly namingStrategy: NamingStrategyInterface;\n\n /**\n * Name for the metadata table\n */\n readonly metadataTableName: string;\n\n /**\n * Logger used to log orm events.\n */\n readonly logger: Logger;\n\n /**\n * Migration instances that are registered for this connection.\n */\n readonly migrations: MigrationInterface[] = [];\n\n /**\n * Entity subscriber instances that are registered for this connection.\n */\n readonly subscribers: EntitySubscriberInterface<any>[] = [];\n\n /**\n * All entity metadatas that are registered for this connection.\n */\n readonly entityMetadatas: EntityMetadata[] = [];\n\n /**\n * Used to work with query result cache.\n */\n readonly queryResultCache?: QueryResultCache;\n\n /**\n * Used to load relations and work with lazy relations.\n */\n readonly relationLoader: RelationLoader;\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(options: ConnectionOptions) {\n this.name = options.name || \"default\";\n this.options = options;\n this.logger = new LoggerFactory().create(this.options.logger, this.options.logging);\n this.driver = new DriverFactory().create(this);\n this.manager = this.createEntityManager();\n this.namingStrategy = options.namingStrategy || new DefaultNamingStrategy();\n this.metadataTableName = options.metadataTableName || \"typeorm_metadata\";\n this.queryResultCache = options.cache ? new QueryResultCacheFactory(this).create() : undefined;\n this.relationLoader = new RelationLoader(this);\n this.isConnected = false;\n }\n\n // -------------------------------------------------------------------------\n // Public Accessors\n // -------------------------------------------------------------------------\n\n /**\n * Gets the mongodb entity manager that allows to perform mongodb-specific repository operations\n * with any entity in this connection.\n *\n * Available only in mongodb connections.\n */\n get mongoManager(): MongoEntityManager {\n if (!(this.manager instanceof MongoEntityManager))\n throw new TypeORMError(`MongoEntityManager is only available for MongoDB databases.`);\n\n return this.manager as MongoEntityManager;\n }\n\n /**\n * Gets a sql.js specific Entity Manager that allows to perform special load and save operations\n *\n * Available only in connection with the sqljs driver.\n */\n get sqljsManager(): SqljsEntityManager {\n if (!(this.manager instanceof SqljsEntityManager))\n throw new TypeORMError(`SqljsEntityManager is only available for Sqljs databases.`);\n\n return this.manager as SqljsEntityManager;\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Performs connection to the database.\n * This method should be called once on application bootstrap.\n * This method not necessarily creates database connection (depend on database type),\n * but it also can setup a connection pool with database to use.\n */\n async connect(): Promise<this> {\n if (this.isConnected)\n throw new CannotConnectAlreadyConnectedError(this.name);\n\n // connect to the database via its driver\n await this.driver.connect();\n\n // connect to the cache-specific database if cache is enabled\n if (this.queryResultCache)\n await this.queryResultCache.connect();\n\n // set connected status for the current connection\n ObjectUtils.assign(this, { isConnected: true });\n\n try {\n\n // build all metadatas registered in the current connection\n await this.buildMetadatas();\n\n await this.driver.afterConnect();\n\n // if option is set - drop schema once connection is done\n if (this.options.dropSchema)\n await this.dropDatabase();\n\n // if option is set - automatically synchronize a schema\n if (this.options.synchronize)\n await this.synchronize();\n\n // if option is set - automatically synchronize a schema\n if (this.options.migrationsRun)\n await this.runMigrations({ transaction: this.options.migrationsTransactionMode });\n\n } catch (error) {\n\n // if for some reason build metadata fail (for example validation error during entity metadata check)\n // connection needs to be closed\n await this.close();\n throw error;\n }\n\n return this;\n }\n\n /**\n * Closes connection with the database.\n * Once connection is closed, you cannot use repositories or perform any operations except opening connection again.\n */\n async close(): Promise<void> {\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n await this.driver.disconnect();\n\n // disconnect from the cache-specific database if cache was enabled\n if (this.queryResultCache)\n await this.queryResultCache.disconnect();\n\n ObjectUtils.assign(this, { isConnected: false });\n }\n\n /**\n * Creates database schema for all entities registered in this connection.\n * Can be used only after connection to the database is established.\n *\n * @param dropBeforeSync If set to true then it drops the database with all its tables and data\n */\n async synchronize(dropBeforeSync: boolean = false): Promise<void> {\n\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n if (dropBeforeSync)\n await this.dropDatabase();\n\n const schemaBuilder = this.driver.createSchemaBuilder();\n await schemaBuilder.build();\n }\n\n /**\n * Drops the database and all its data.\n * Be careful with this method on production since this method will erase all your database tables and their data.\n * Can be used only after connection to the database is established.\n */\n // TODO rename\n async dropDatabase(): Promise<void> {\n const queryRunner = this.createQueryRunner();\n try {\n if (this.driver instanceof SqlServerDriver || this.driver instanceof MysqlDriver || this.driver instanceof AuroraDataApiDriver) {\n const databases: string[] = this.driver.database ? [this.driver.database] : [];\n this.entityMetadatas.forEach(metadata => {\n if (metadata.database && databases.indexOf(metadata.database) === -1)\n databases.push(metadata.database);\n });\n\n for (const database of databases) {\n await queryRunner.clearDatabase(database);\n }\n } else {\n await queryRunner.clearDatabase();\n }\n } finally {\n await queryRunner.release();\n }\n }\n\n /**\n * Runs all pending migrations.\n * Can be used only after connection to the database is established.\n */\n async runMigrations(options?: { transaction?: \"all\" | \"none\" | \"each\" }): Promise<Migration[]> {\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n const migrationExecutor = new MigrationExecutor(this);\n migrationExecutor.transaction = (options && options.transaction) || \"all\";\n\n const successMigrations = await migrationExecutor.executePendingMigrations();\n return successMigrations;\n }\n\n /**\n * Reverts last executed migration.\n * Can be used only after connection to the database is established.\n */\n async undoLastMigration(options?: { transaction?: \"all\" | \"none\" | \"each\" }): Promise<void> {\n\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n const migrationExecutor = new MigrationExecutor(this);\n migrationExecutor.transaction = (options && options.transaction) || \"all\";\n\n await migrationExecutor.undoLastMigration();\n }\n\n /**\n * Lists all migrations and whether they have been run.\n * Returns true if there are pending migrations\n */\n async showMigrations(): Promise<boolean> {\n if (!this.isConnected) {\n throw new CannotExecuteNotConnectedError(this.name);\n }\n const migrationExecutor = new MigrationExecutor(this);\n return await migrationExecutor.showMigrations();\n }\n\n /**\n * Checks if entity metadata exist for the given entity class, target name or table name.\n */\n hasMetadata(target: EntityTarget<any>): boolean {\n return !!this.findMetadata(target);\n }\n\n /**\n * Gets entity metadata for the given entity class or schema name.\n */\n getMetadata(target: EntityTarget<any>): EntityMetadata {\n const metadata = this.findMetadata(target);\n if (!metadata)\n throw new EntityMetadataNotFoundError(target);\n\n return metadata;\n }\n\n /**\n * Gets repository for the given entity.\n */\n getRepository<Entity>(target: EntityTarget<Entity>): Repository<Entity> {\n return this.manager.getRepository(target);\n }\n\n /**\n * Gets tree repository for the given entity class or name.\n * Only tree-type entities can have a TreeRepository, like ones decorated with @Tree decorator.\n */\n getTreeRepository<Entity>(target: EntityTarget<Entity>): TreeRepository<Entity> {\n return this.manager.getTreeRepository(target);\n }\n\n /**\n * Gets mongodb-specific repository for the given entity class or name.\n * Works only if connection is mongodb-specific.\n */\n getMongoRepository<Entity>(target: EntityTarget<Entity>): MongoRepository<Entity> {\n if (!(this.driver instanceof MongoDriver))\n throw new TypeORMError(`You can use getMongoRepository only for MongoDB connections.`);\n\n return this.manager.getRepository(target) as any;\n }\n\n /**\n * Gets custom entity repository marked with @EntityRepository decorator.\n */\n getCustomRepository<T>(customRepository: ObjectType<T>): T {\n return this.manager.getCustomRepository(customRepository);\n }\n\n /**\n * Wraps given function execution (and all operations made there) into a transaction.\n * All database operations must be executed using provided entity manager.\n */\n async transaction<T>(runInTransaction: (entityManager: EntityManager) => Promise<T>): Promise<T>;\n async transaction<T>(isolationLevel: IsolationLevel, runInTransaction: (entityManager: EntityManager) => Promise<T>): Promise<T>;\n async transaction<T>(\n isolationOrRunInTransaction: IsolationLevel | ((entityManager: EntityManager) => Promise<T>),\n runInTransactionParam?: (entityManager: EntityManager) => Promise<T>\n ): Promise<any> {\n return this.manager.transaction(\n isolationOrRunInTransaction as any,\n runInTransactionParam as any\n );\n }\n\n /**\n * Executes raw SQL query and returns raw database results.\n */\n async query(query: string, parameters?: any[], queryRunner?: QueryRunner): Promise<any> {\n if (this instanceof MongoEntityManager)\n throw new TypeORMError(`Queries aren't supported by MongoDB.`);\n\n if (queryRunner && queryRunner.isReleased)\n throw new QueryRunnerProviderAlreadyReleasedError();\n\n const usedQueryRunner = queryRunner || this.createQueryRunner();\n\n try {\n return await usedQueryRunner.query(query, parameters); // await is needed here because we are using finally\n\n } finally {\n if (!queryRunner)\n await usedQueryRunner.release();\n }\n }\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder<Entity>(entityClass: EntityTarget<Entity>, alias: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity>;\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder(queryRunner?: QueryRunner): SelectQueryBuilder<any>;\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder<Entity>(entityOrRunner?: EntityTarget<Entity>|QueryRunner, alias?: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity> {\n if (this instanceof MongoEntityManager)\n throw new TypeORMError(`Query Builder is not supported by MongoDB.`);\n\n if (alias) {\n const metadata = this.getMetadata(entityOrRunner as EntityTarget<Entity>);\n return new SelectQueryBuilder(this, queryRunner)\n .select(alias)\n .from(metadata.target, alias);\n\n } else {\n return new SelectQueryBuilder(this, entityOrRunner as QueryRunner|undefined);\n }\n }\n\n /**\n * Creates a query runner used for perform queries on a single database connection.\n * Using query runners you can control your queries to execute using single database connection and\n * manually control your database transaction.\n *\n * Mode is used in replication mode and indicates whatever you want to connect\n * to master database or any of slave databases.\n * If you perform writes you must use master database,\n * if you perform reads you can use slave databases.\n */\n createQueryRunner(mode: ReplicationMode = \"master\"): QueryRunner {\n const queryRunner = this.driver.createQueryRunner(mode);\n const manager = this.createEntityManager(queryRunner);\n Object.assign(queryRunner, { manager: manager });\n return queryRunner;\n }\n\n /**\n * Gets entity metadata of the junction table (many-to-many table).\n */\n getManyToManyMetadata(entityTarget: EntityTarget<any>, relationPropertyPath: string) {\n const relationMetadata = this.getMetadata(entityTarget).findRelationWithPropertyPath(relationPropertyPath);\n if (!relationMetadata)\n throw new TypeORMError(`Relation \"${relationPropertyPath}\" was not found in ${entityTarget} entity.`);\n if (!relationMetadata.isManyToMany)\n throw new TypeORMError(`Relation \"${entityTarget}#${relationPropertyPath}\" does not have a many-to-many relationship.` +\n `You can use this method only on many-to-many relations.`);\n\n return relationMetadata.junctionEntityMetadata;\n }\n\n /**\n * Creates an Entity Manager for the current connection with the help of the EntityManagerFactory.\n */\n createEntityManager(queryRunner?: QueryRunner): EntityManager {\n return new EntityManagerFactory().create(this, queryRunner);\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Finds exist entity metadata by the given entity class, target name or table name.\n */\n protected findMetadata(target: EntityTarget<any>): EntityMetadata|undefined {\n return this.entityMetadatas.find(metadata => {\n if (metadata.target === target)\n return true;\n if (target instanceof EntitySchema) {\n return metadata.name === target.options.name;\n }\n if (typeof target === \"string\") {\n if (target.indexOf(\".\") !== -1) {\n return metadata.tablePath === target;\n } else {\n return metadata.name === target || metadata.tableName === target;\n }\n }\n\n return false;\n });\n }\n\n /**\n * Builds metadatas for all registered classes inside this connection.\n */\n protected async buildMetadatas(): Promise<void> {\n\n const connectionMetadataBuilder = new ConnectionMetadataBuilder(this);\n const entityMetadataValidator = new EntityMetadataValidator();\n\n // create subscribers instances if they are not disallowed from high-level (for example they can disallowed from migrations run process)\n const subscribers = await connectionMetadataBuilder.buildSubscribers(this.options.subscribers || []);\n ObjectUtils.assign(this, { subscribers: subscribers });\n\n // build entity metadatas\n const entityMetadatas = await connectionMetadataBuilder.buildEntityMetadatas(this.options.entities || []);\n ObjectUtils.assign(this, { entityMetadatas: entityMetadatas });\n\n // create migration instances\n const migrations = await connectionMetadataBuilder.buildMigrations(this.options.migrations || []);\n ObjectUtils.assign(this, { migrations: migrations });\n\n // validate all created entity metadatas to make sure user created entities are valid and correct\n entityMetadataValidator.validateMany(this.entityMetadatas.filter(metadata => metadata.tableType !== \"view\"), this.driver);\n }\n}\n"],"sourceRoot":".."}
|
|
1
|
+
{"version":3,"sources":["../../src/connection/Connection.ts"],"names":[],"mappings":";;;;AAMA,kFAA+E;AAC/E,0FAAuF;AACvF,kGAA+F;AAK/F,oFAAiF;AAEjF,oEAAiE;AAGjE,6DAA0D;AAC1D,2EAAwE;AACxE,uFAAoF;AAEpF,4GAAyG;AACzG,+EAA4E;AAC5E,yDAAsD;AACtD,yEAAsE;AAEtE,0EAAuE;AACvE,yDAAsD;AACtD,4EAAyE;AAEzE,2EAAwE;AACxE,kEAA+D;AAC/D,8DAA2D;AAC3D,uEAAoE;AACpE,uFAAoF;AACpF,2DAAwD;AACxD,mDAAgD;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C,CAAC;IACP,CAAC;IAED;;OAEG;IACa,mCAAc,GAA9B;;;;;;wBAEU,yBAAyB,GAAG,IAAI,qDAAyB,CAAC,IAAI,CAAC,CAAC;wBAChE,uBAAuB,GAAG,IAAI,iDAAuB,EAAE,CAAC;wBAG1C,qBAAM,yBAAyB,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC,EAAA;;wBAA9F,WAAW,GAAG,SAAgF;wBACpG,yBAAW,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAC;wBAG/B,qBAAM,yBAAyB,CAAC,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAA;;wBAAnG,eAAe,GAAG,SAAiF;wBACzG,yBAAW,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC,CAAC;wBAG5C,qBAAM,yBAAyB,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC,EAAA;;wBAA3F,UAAU,GAAG,SAA8E;wBACjG,yBAAW,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAC;wBAErD,iGAAiG;wBACjG,uBAAuB,CAAC,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,UAAA,QAAQ,IAAI,OAAA,QAAQ,CAAC,SAAS,KAAK,MAAM,EAA7B,CAA6B,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;;;;;KAC7H;IACL,iBAAC;AAAD,CAteA,AAseC,IAAA;AAteY,gCAAU","file":"Connection.js","sourcesContent":["import {Driver} from \"../driver/Driver\";\nimport {Repository} from \"../repository/Repository\";\nimport {EntitySubscriberInterface} from \"../subscriber/EntitySubscriberInterface\";\nimport {EntityTarget} from \"../common/EntityTarget\";\nimport {ObjectType} from \"../common/ObjectType\";\nimport {EntityManager} from \"../entity-manager/EntityManager\";\nimport {DefaultNamingStrategy} from \"../naming-strategy/DefaultNamingStrategy\";\nimport {CannotExecuteNotConnectedError} from \"../error/CannotExecuteNotConnectedError\";\nimport {CannotConnectAlreadyConnectedError} from \"../error/CannotConnectAlreadyConnectedError\";\nimport {TreeRepository} from \"../repository/TreeRepository\";\nimport {NamingStrategyInterface} from \"../naming-strategy/NamingStrategyInterface\";\nimport {EntityMetadata} from \"../metadata/EntityMetadata\";\nimport {Logger} from \"../logger/Logger\";\nimport {EntityMetadataNotFoundError} from \"../error/EntityMetadataNotFoundError\";\nimport {MigrationInterface} from \"../migration/MigrationInterface\";\nimport {MigrationExecutor} from \"../migration/MigrationExecutor\";\nimport {Migration} from \"../migration/Migration\";\nimport {MongoRepository} from \"../repository/MongoRepository\";\nimport {MongoDriver} from \"../driver/mongodb/MongoDriver\";\nimport {MongoEntityManager} from \"../entity-manager/MongoEntityManager\";\nimport {EntityMetadataValidator} from \"../metadata-builder/EntityMetadataValidator\";\nimport {ConnectionOptions} from \"./ConnectionOptions\";\nimport {QueryRunnerProviderAlreadyReleasedError} from \"../error/QueryRunnerProviderAlreadyReleasedError\";\nimport {EntityManagerFactory} from \"../entity-manager/EntityManagerFactory\";\nimport {DriverFactory} from \"../driver/DriverFactory\";\nimport {ConnectionMetadataBuilder} from \"./ConnectionMetadataBuilder\";\nimport {QueryRunner} from \"../query-runner/QueryRunner\";\nimport {SelectQueryBuilder} from \"../query-builder/SelectQueryBuilder\";\nimport {LoggerFactory} from \"../logger/LoggerFactory\";\nimport {QueryResultCacheFactory} from \"../cache/QueryResultCacheFactory\";\nimport {QueryResultCache} from \"../cache/QueryResultCache\";\nimport {SqljsEntityManager} from \"../entity-manager/SqljsEntityManager\";\nimport {RelationLoader} from \"../query-builder/RelationLoader\";\nimport {EntitySchema} from \"../entity-schema/EntitySchema\";\nimport {SqlServerDriver} from \"../driver/sqlserver/SqlServerDriver\";\nimport {AbstractSqliteDriver} from \"../driver/sqlite-abstract/AbstractSqliteDriver\";\nimport {MysqlDriver} from \"../driver/mysql/MysqlDriver\";\nimport {ObjectUtils} from \"../util/ObjectUtils\";\nimport {IsolationLevel} from \"../driver/types/IsolationLevel\";\nimport {AuroraDataApiDriver} from \"../driver/aurora-data-api/AuroraDataApiDriver\";\nimport {ReplicationMode} from \"../driver/types/ReplicationMode\";\nimport { TypeORMError } from \"../error/TypeORMError\";\n\n/**\n * Connection is a single database ORM connection to a specific database.\n * Its not required to be a database connection, depend on database type it can create connection pool.\n * You can have multiple connections to multiple databases in your application.\n */\nexport class Connection {\n\n // -------------------------------------------------------------------------\n // Public Readonly Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection name.\n */\n readonly name: string;\n\n /**\n * Connection options.\n */\n readonly options: ConnectionOptions;\n\n /**\n * Indicates if connection is initialized or not.\n */\n readonly isConnected: boolean;\n\n /**\n * Database driver used by this connection.\n */\n readonly driver: Driver;\n\n /**\n * EntityManager of this connection.\n */\n readonly manager: EntityManager;\n\n /**\n * Naming strategy used in the connection.\n */\n readonly namingStrategy: NamingStrategyInterface;\n\n /**\n * Name for the metadata table\n */\n readonly metadataTableName: string;\n\n /**\n * Logger used to log orm events.\n */\n readonly logger: Logger;\n\n /**\n * Migration instances that are registered for this connection.\n */\n readonly migrations: MigrationInterface[] = [];\n\n /**\n * Entity subscriber instances that are registered for this connection.\n */\n readonly subscribers: EntitySubscriberInterface<any>[] = [];\n\n /**\n * All entity metadatas that are registered for this connection.\n */\n readonly entityMetadatas: EntityMetadata[] = [];\n\n /**\n * Used to work with query result cache.\n */\n readonly queryResultCache?: QueryResultCache;\n\n /**\n * Used to load relations and work with lazy relations.\n */\n readonly relationLoader: RelationLoader;\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(options: ConnectionOptions) {\n this.name = options.name || \"default\";\n this.options = options;\n this.logger = new LoggerFactory().create(this.options.logger, this.options.logging);\n this.driver = new DriverFactory().create(this);\n this.manager = this.createEntityManager();\n this.namingStrategy = options.namingStrategy || new DefaultNamingStrategy();\n this.metadataTableName = options.metadataTableName || \"typeorm_metadata\";\n this.queryResultCache = options.cache ? new QueryResultCacheFactory(this).create() : undefined;\n this.relationLoader = new RelationLoader(this);\n this.isConnected = false;\n }\n\n // -------------------------------------------------------------------------\n // Public Accessors\n // -------------------------------------------------------------------------\n\n /**\n * Gets the mongodb entity manager that allows to perform mongodb-specific repository operations\n * with any entity in this connection.\n *\n * Available only in mongodb connections.\n */\n get mongoManager(): MongoEntityManager {\n if (!(this.manager instanceof MongoEntityManager))\n throw new TypeORMError(`MongoEntityManager is only available for MongoDB databases.`);\n\n return this.manager as MongoEntityManager;\n }\n\n /**\n * Gets a sql.js specific Entity Manager that allows to perform special load and save operations\n *\n * Available only in connection with the sqljs driver.\n */\n get sqljsManager(): SqljsEntityManager {\n if (!(this.manager instanceof SqljsEntityManager))\n throw new TypeORMError(`SqljsEntityManager is only available for Sqljs databases.`);\n\n return this.manager as SqljsEntityManager;\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Performs connection to the database.\n * This method should be called once on application bootstrap.\n * This method not necessarily creates database connection (depend on database type),\n * but it also can setup a connection pool with database to use.\n */\n async connect(): Promise<this> {\n if (this.isConnected)\n throw new CannotConnectAlreadyConnectedError(this.name);\n\n // connect to the database via its driver\n await this.driver.connect();\n\n // connect to the cache-specific database if cache is enabled\n if (this.queryResultCache)\n await this.queryResultCache.connect();\n\n // set connected status for the current connection\n ObjectUtils.assign(this, { isConnected: true });\n\n try {\n\n // build all metadatas registered in the current connection\n await this.buildMetadatas();\n\n await this.driver.afterConnect();\n\n // if option is set - drop schema once connection is done\n if (this.options.dropSchema)\n await this.dropDatabase();\n\n // if option is set - automatically synchronize a schema\n if (this.options.synchronize)\n await this.synchronize();\n\n // if option is set - automatically synchronize a schema\n if (this.options.migrationsRun)\n await this.runMigrations({ transaction: this.options.migrationsTransactionMode });\n\n } catch (error) {\n\n // if for some reason build metadata fail (for example validation error during entity metadata check)\n // connection needs to be closed\n await this.close();\n throw error;\n }\n\n return this;\n }\n\n /**\n * Closes connection with the database.\n * Once connection is closed, you cannot use repositories or perform any operations except opening connection again.\n */\n async close(): Promise<void> {\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n await this.driver.disconnect();\n\n // disconnect from the cache-specific database if cache was enabled\n if (this.queryResultCache)\n await this.queryResultCache.disconnect();\n\n ObjectUtils.assign(this, { isConnected: false });\n }\n\n /**\n * Creates database schema for all entities registered in this connection.\n * Can be used only after connection to the database is established.\n *\n * @param dropBeforeSync If set to true then it drops the database with all its tables and data\n */\n async synchronize(dropBeforeSync: boolean = false): Promise<void> {\n\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n if (dropBeforeSync)\n await this.dropDatabase();\n\n const schemaBuilder = this.driver.createSchemaBuilder();\n await schemaBuilder.build();\n }\n\n /**\n * Drops the database and all its data.\n * Be careful with this method on production since this method will erase all your database tables and their data.\n * Can be used only after connection to the database is established.\n */\n // TODO rename\n async dropDatabase(): Promise<void> {\n const queryRunner = this.createQueryRunner();\n try {\n if (this.driver instanceof SqlServerDriver || this.driver instanceof MysqlDriver || this.driver instanceof AuroraDataApiDriver || this.driver instanceof AbstractSqliteDriver) {\n const databases: string[] = [];\n this.entityMetadatas.forEach(metadata => {\n if (metadata.database && databases.indexOf(metadata.database) === -1)\n databases.push(metadata.database);\n });\n if (databases.length === 0 && this.driver.database) {\n databases.push(this.driver.database);\n };\n\n if (databases.length === 0) {\n await queryRunner.clearDatabase();\n }\n else {\n for (const database of databases) {\n await queryRunner.clearDatabase(database);\n }\n }\n } else {\n await queryRunner.clearDatabase();\n }\n } finally {\n await queryRunner.release();\n }\n }\n\n /**\n * Runs all pending migrations.\n * Can be used only after connection to the database is established.\n */\n async runMigrations(options?: { transaction?: \"all\" | \"none\" | \"each\" }): Promise<Migration[]> {\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n const migrationExecutor = new MigrationExecutor(this);\n migrationExecutor.transaction = (options && options.transaction) || \"all\";\n\n const successMigrations = await migrationExecutor.executePendingMigrations();\n return successMigrations;\n }\n\n /**\n * Reverts last executed migration.\n * Can be used only after connection to the database is established.\n */\n async undoLastMigration(options?: { transaction?: \"all\" | \"none\" | \"each\" }): Promise<void> {\n\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n const migrationExecutor = new MigrationExecutor(this);\n migrationExecutor.transaction = (options && options.transaction) || \"all\";\n\n await migrationExecutor.undoLastMigration();\n }\n\n /**\n * Lists all migrations and whether they have been run.\n * Returns true if there are pending migrations\n */\n async showMigrations(): Promise<boolean> {\n if (!this.isConnected) {\n throw new CannotExecuteNotConnectedError(this.name);\n }\n const migrationExecutor = new MigrationExecutor(this);\n return await migrationExecutor.showMigrations();\n }\n\n /**\n * Checks if entity metadata exist for the given entity class, target name or table name.\n */\n hasMetadata(target: EntityTarget<any>): boolean {\n return !!this.findMetadata(target);\n }\n\n /**\n * Gets entity metadata for the given entity class or schema name.\n */\n getMetadata(target: EntityTarget<any>): EntityMetadata {\n const metadata = this.findMetadata(target);\n if (!metadata)\n throw new EntityMetadataNotFoundError(target);\n\n return metadata;\n }\n\n /**\n * Gets repository for the given entity.\n */\n getRepository<Entity>(target: EntityTarget<Entity>): Repository<Entity> {\n return this.manager.getRepository(target);\n }\n\n /**\n * Gets tree repository for the given entity class or name.\n * Only tree-type entities can have a TreeRepository, like ones decorated with @Tree decorator.\n */\n getTreeRepository<Entity>(target: EntityTarget<Entity>): TreeRepository<Entity> {\n return this.manager.getTreeRepository(target);\n }\n\n /**\n * Gets mongodb-specific repository for the given entity class or name.\n * Works only if connection is mongodb-specific.\n */\n getMongoRepository<Entity>(target: EntityTarget<Entity>): MongoRepository<Entity> {\n if (!(this.driver instanceof MongoDriver))\n throw new TypeORMError(`You can use getMongoRepository only for MongoDB connections.`);\n\n return this.manager.getRepository(target) as any;\n }\n\n /**\n * Gets custom entity repository marked with @EntityRepository decorator.\n */\n getCustomRepository<T>(customRepository: ObjectType<T>): T {\n return this.manager.getCustomRepository(customRepository);\n }\n\n /**\n * Wraps given function execution (and all operations made there) into a transaction.\n * All database operations must be executed using provided entity manager.\n */\n async transaction<T>(runInTransaction: (entityManager: EntityManager) => Promise<T>): Promise<T>;\n async transaction<T>(isolationLevel: IsolationLevel, runInTransaction: (entityManager: EntityManager) => Promise<T>): Promise<T>;\n async transaction<T>(\n isolationOrRunInTransaction: IsolationLevel | ((entityManager: EntityManager) => Promise<T>),\n runInTransactionParam?: (entityManager: EntityManager) => Promise<T>\n ): Promise<any> {\n return this.manager.transaction(\n isolationOrRunInTransaction as any,\n runInTransactionParam as any\n );\n }\n\n /**\n * Executes raw SQL query and returns raw database results.\n */\n async query(query: string, parameters?: any[], queryRunner?: QueryRunner): Promise<any> {\n if (this instanceof MongoEntityManager)\n throw new TypeORMError(`Queries aren't supported by MongoDB.`);\n\n if (queryRunner && queryRunner.isReleased)\n throw new QueryRunnerProviderAlreadyReleasedError();\n\n const usedQueryRunner = queryRunner || this.createQueryRunner();\n\n try {\n return await usedQueryRunner.query(query, parameters); // await is needed here because we are using finally\n\n } finally {\n if (!queryRunner)\n await usedQueryRunner.release();\n }\n }\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder<Entity>(entityClass: EntityTarget<Entity>, alias: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity>;\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder(queryRunner?: QueryRunner): SelectQueryBuilder<any>;\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder<Entity>(entityOrRunner?: EntityTarget<Entity>|QueryRunner, alias?: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity> {\n if (this instanceof MongoEntityManager)\n throw new TypeORMError(`Query Builder is not supported by MongoDB.`);\n\n if (alias) {\n const metadata = this.getMetadata(entityOrRunner as EntityTarget<Entity>);\n return new SelectQueryBuilder(this, queryRunner)\n .select(alias)\n .from(metadata.target, alias);\n\n } else {\n return new SelectQueryBuilder(this, entityOrRunner as QueryRunner|undefined);\n }\n }\n\n /**\n * Creates a query runner used for perform queries on a single database connection.\n * Using query runners you can control your queries to execute using single database connection and\n * manually control your database transaction.\n *\n * Mode is used in replication mode and indicates whatever you want to connect\n * to master database or any of slave databases.\n * If you perform writes you must use master database,\n * if you perform reads you can use slave databases.\n */\n createQueryRunner(mode: ReplicationMode = \"master\"): QueryRunner {\n const queryRunner = this.driver.createQueryRunner(mode);\n const manager = this.createEntityManager(queryRunner);\n Object.assign(queryRunner, { manager: manager });\n return queryRunner;\n }\n\n /**\n * Gets entity metadata of the junction table (many-to-many table).\n */\n getManyToManyMetadata(entityTarget: EntityTarget<any>, relationPropertyPath: string) {\n const relationMetadata = this.getMetadata(entityTarget).findRelationWithPropertyPath(relationPropertyPath);\n if (!relationMetadata)\n throw new TypeORMError(`Relation \"${relationPropertyPath}\" was not found in ${entityTarget} entity.`);\n if (!relationMetadata.isManyToMany)\n throw new TypeORMError(`Relation \"${entityTarget}#${relationPropertyPath}\" does not have a many-to-many relationship.` +\n `You can use this method only on many-to-many relations.`);\n\n return relationMetadata.junctionEntityMetadata;\n }\n\n /**\n * Creates an Entity Manager for the current connection with the help of the EntityManagerFactory.\n */\n createEntityManager(queryRunner?: QueryRunner): EntityManager {\n return new EntityManagerFactory().create(this, queryRunner);\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Finds exist entity metadata by the given entity class, target name or table name.\n */\n protected findMetadata(target: EntityTarget<any>): EntityMetadata|undefined {\n return this.entityMetadatas.find(metadata => {\n if (metadata.target === target)\n return true;\n if (target instanceof EntitySchema) {\n return metadata.name === target.options.name;\n }\n if (typeof target === \"string\") {\n if (target.indexOf(\".\") !== -1) {\n return metadata.tablePath === target;\n } else {\n return metadata.name === target || metadata.tableName === target;\n }\n }\n\n return false;\n });\n }\n\n /**\n * Builds metadatas for all registered classes inside this connection.\n */\n protected async buildMetadatas(): Promise<void> {\n\n const connectionMetadataBuilder = new ConnectionMetadataBuilder(this);\n const entityMetadataValidator = new EntityMetadataValidator();\n\n // create subscribers instances if they are not disallowed from high-level (for example they can disallowed from migrations run process)\n const subscribers = await connectionMetadataBuilder.buildSubscribers(this.options.subscribers || []);\n ObjectUtils.assign(this, { subscribers: subscribers });\n\n // build entity metadatas\n const entityMetadatas = await connectionMetadataBuilder.buildEntityMetadatas(this.options.entities || []);\n ObjectUtils.assign(this, { entityMetadatas: entityMetadatas });\n\n // create migration instances\n const migrations = await connectionMetadataBuilder.buildMigrations(this.options.migrations || []);\n ObjectUtils.assign(this, { migrations: migrations });\n\n // validate all created entity metadatas to make sure user created entities are valid and correct\n entityMetadataValidator.validateMany(this.entityMetadatas.filter(metadata => metadata.tableType !== \"view\"), this.driver);\n }\n}\n"],"sourceRoot":".."}
|
|
@@ -9,6 +9,7 @@ var ConnectionOptionsEnvReader_1 = require("./options-reader/ConnectionOptionsEn
|
|
|
9
9
|
var ConnectionOptionsYmlReader_1 = require("./options-reader/ConnectionOptionsYmlReader");
|
|
10
10
|
var ConnectionOptionsXmlReader_1 = require("./options-reader/ConnectionOptionsXmlReader");
|
|
11
11
|
var error_1 = require("../error");
|
|
12
|
+
var PathUtils_1 = require("../util/PathUtils");
|
|
12
13
|
var ImportUtils_1 = require("../util/ImportUtils");
|
|
13
14
|
/**
|
|
14
15
|
* Reads connection options from the ormconfig.
|
|
@@ -172,6 +173,7 @@ var ConnectionOptionsReader = /** @class */ (function () {
|
|
|
172
173
|
if (!(Array.isArray(connectionOptions)))
|
|
173
174
|
connectionOptions = [connectionOptions];
|
|
174
175
|
connectionOptions.forEach(function (options) {
|
|
176
|
+
options.baseDirectory = _this.baseDirectory;
|
|
175
177
|
if (options.entities) {
|
|
176
178
|
var entities = options.entities.map(function (entity) {
|
|
177
179
|
if (typeof entity === "string" && entity.substr(0, 1) !== "/")
|
|
@@ -198,7 +200,7 @@ var ConnectionOptionsReader = /** @class */ (function () {
|
|
|
198
200
|
}
|
|
199
201
|
// make database path file in sqlite relative to package.json
|
|
200
202
|
if (options.type === "sqlite" || options.type === "better-sqlite3") {
|
|
201
|
-
if (typeof options.database === "string" &&
|
|
203
|
+
if (typeof options.database === "string" && !(0, PathUtils_1.isAbsolute)(options.database) &&
|
|
202
204
|
options.database.substr(0, 1) !== "/" && // unix absolute
|
|
203
205
|
options.database.substr(1, 2) !== ":\\" && // windows absolute
|
|
204
206
|
options.database !== ":memory:") {
|