typeorm 0.3.23-dev.fe71a0c → 0.3.23
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/common/PrimitiveCriteria.d.ts +2 -0
- package/browser/common/PrimitiveCriteria.js +3 -0
- package/browser/common/PrimitiveCriteria.js.map +1 -0
- package/browser/data-source/BaseDataSourceOptions.d.ts +1 -1
- package/browser/data-source/BaseDataSourceOptions.js.map +1 -1
- package/browser/data-source/DataSource.js +2 -1
- package/browser/data-source/DataSource.js.map +1 -1
- package/browser/driver/cockroachdb/CockroachQueryRunner.d.ts +8 -8
- package/browser/driver/cockroachdb/CockroachQueryRunner.js +16 -16
- package/browser/driver/cockroachdb/CockroachQueryRunner.js.map +1 -1
- package/browser/driver/cordova/CordovaQueryRunner.js +6 -6
- package/browser/driver/cordova/CordovaQueryRunner.js.map +1 -1
- package/browser/driver/expo/ExpoQueryRunner.js +5 -4
- package/browser/driver/expo/ExpoQueryRunner.js.map +1 -1
- package/browser/driver/mysql/MysqlQueryRunner.d.ts +7 -7
- package/browser/driver/mysql/MysqlQueryRunner.js +16 -16
- package/browser/driver/mysql/MysqlQueryRunner.js.map +1 -1
- package/browser/driver/nativescript/NativescriptQueryRunner.js +4 -4
- package/browser/driver/nativescript/NativescriptQueryRunner.js.map +1 -1
- package/browser/driver/oracle/OracleQueryRunner.d.ts +7 -7
- package/browser/driver/oracle/OracleQueryRunner.js +13 -13
- package/browser/driver/oracle/OracleQueryRunner.js.map +1 -1
- package/browser/driver/postgres/PostgresQueryRunner.js +2 -2
- package/browser/driver/postgres/PostgresQueryRunner.js.map +1 -1
- package/browser/driver/react-native/ReactNativeQueryRunner.js +53 -46
- package/browser/driver/react-native/ReactNativeQueryRunner.js.map +1 -1
- package/browser/driver/sap/SapQueryRunner.d.ts +1 -1
- package/browser/driver/sap/SapQueryRunner.js +46 -23
- package/browser/driver/sap/SapQueryRunner.js.map +1 -1
- package/browser/driver/spanner/SpannerQueryRunner.js +6 -6
- package/browser/driver/spanner/SpannerQueryRunner.js.map +1 -1
- package/browser/driver/sqlite/SqliteQueryRunner.js +9 -9
- package/browser/driver/sqlite/SqliteQueryRunner.js.map +1 -1
- package/browser/driver/sqljs/SqljsQueryRunner.js +5 -5
- package/browser/driver/sqljs/SqljsQueryRunner.js.map +1 -1
- package/browser/driver/sqlserver/SqlServerQueryRunner.d.ts +1 -1
- package/browser/driver/sqlserver/SqlServerQueryRunner.js +7 -7
- package/browser/driver/sqlserver/SqlServerQueryRunner.js.map +1 -1
- package/browser/entity-manager/EntityManager.js +9 -32
- package/browser/entity-manager/EntityManager.js.map +1 -1
- package/browser/index.d.ts +1 -0
- package/browser/index.js +1 -0
- package/browser/index.js.map +1 -1
- package/browser/logger/AbstractLogger.d.ts +1 -1
- package/browser/logger/AbstractLogger.js +5 -1
- package/browser/logger/AbstractLogger.js.map +1 -1
- package/browser/logger/FormattedConsoleLogger.d.ts +13 -0
- package/browser/logger/FormattedConsoleLogger.js +55 -0
- package/browser/logger/FormattedConsoleLogger.js.map +1 -0
- package/browser/logger/Logger.d.ts +1 -0
- package/browser/logger/Logger.js.map +1 -1
- package/browser/logger/LoggerFactory.d.ts +1 -1
- package/browser/logger/LoggerFactory.js +3 -0
- package/browser/logger/LoggerFactory.js.map +1 -1
- package/browser/persistence/SubjectChangedColumnsComputer.js +23 -9
- package/browser/persistence/SubjectChangedColumnsComputer.js.map +1 -1
- package/browser/platform/PlatformTools.d.ts +5 -0
- package/browser/platform/PlatformTools.js +16 -0
- package/browser/platform/PlatformTools.js.map +1 -1
- package/browser/repository/Repository.d.ts +4 -4
- package/browser/repository/Repository.js.map +1 -1
- package/browser/subscriber/Broadcaster.d.ts +6 -6
- package/browser/subscriber/Broadcaster.js +1 -1
- package/browser/subscriber/Broadcaster.js.map +1 -1
- package/browser/util/OrmUtils.d.ts +18 -4
- package/browser/util/OrmUtils.js +97 -69
- package/browser/util/OrmUtils.js.map +1 -1
- package/common/PrimitiveCriteria.d.ts +2 -0
- package/common/PrimitiveCriteria.js +4 -0
- package/common/PrimitiveCriteria.js.map +1 -0
- package/data-source/BaseDataSourceOptions.d.ts +1 -1
- package/data-source/BaseDataSourceOptions.js.map +1 -1
- package/data-source/DataSource.js +2 -1
- package/data-source/DataSource.js.map +1 -1
- package/driver/cockroachdb/CockroachQueryRunner.d.ts +8 -8
- package/driver/cockroachdb/CockroachQueryRunner.js +16 -16
- package/driver/cockroachdb/CockroachQueryRunner.js.map +1 -1
- package/driver/cordova/CordovaQueryRunner.js +6 -6
- package/driver/cordova/CordovaQueryRunner.js.map +1 -1
- package/driver/expo/ExpoQueryRunner.js +5 -4
- package/driver/expo/ExpoQueryRunner.js.map +1 -1
- package/driver/mysql/MysqlQueryRunner.d.ts +7 -7
- package/driver/mysql/MysqlQueryRunner.js +16 -16
- package/driver/mysql/MysqlQueryRunner.js.map +1 -1
- package/driver/nativescript/NativescriptQueryRunner.js +4 -4
- package/driver/nativescript/NativescriptQueryRunner.js.map +1 -1
- package/driver/oracle/OracleQueryRunner.d.ts +7 -7
- package/driver/oracle/OracleQueryRunner.js +13 -13
- package/driver/oracle/OracleQueryRunner.js.map +1 -1
- package/driver/postgres/PostgresQueryRunner.js +2 -2
- package/driver/postgres/PostgresQueryRunner.js.map +1 -1
- package/driver/react-native/ReactNativeQueryRunner.js +53 -46
- package/driver/react-native/ReactNativeQueryRunner.js.map +1 -1
- package/driver/sap/SapQueryRunner.d.ts +1 -1
- package/driver/sap/SapQueryRunner.js +46 -23
- package/driver/sap/SapQueryRunner.js.map +1 -1
- package/driver/spanner/SpannerQueryRunner.js +6 -6
- package/driver/spanner/SpannerQueryRunner.js.map +1 -1
- package/driver/sqlite/SqliteQueryRunner.js +9 -9
- package/driver/sqlite/SqliteQueryRunner.js.map +1 -1
- package/driver/sqljs/SqljsQueryRunner.js +5 -5
- package/driver/sqljs/SqljsQueryRunner.js.map +1 -1
- package/driver/sqlserver/SqlServerQueryRunner.d.ts +1 -1
- package/driver/sqlserver/SqlServerQueryRunner.js +7 -7
- package/driver/sqlserver/SqlServerQueryRunner.js.map +1 -1
- package/entity-manager/EntityManager.js +9 -32
- package/entity-manager/EntityManager.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/index.mjs +2 -0
- package/logger/AbstractLogger.d.ts +1 -1
- package/logger/AbstractLogger.js +5 -1
- package/logger/AbstractLogger.js.map +1 -1
- package/logger/FormattedConsoleLogger.d.ts +13 -0
- package/logger/FormattedConsoleLogger.js +59 -0
- package/logger/FormattedConsoleLogger.js.map +1 -0
- package/logger/Logger.d.ts +1 -0
- package/logger/Logger.js.map +1 -1
- package/logger/LoggerFactory.d.ts +1 -1
- package/logger/LoggerFactory.js +3 -0
- package/logger/LoggerFactory.js.map +1 -1
- package/package.json +262 -1
- package/persistence/SubjectChangedColumnsComputer.js +23 -9
- package/persistence/SubjectChangedColumnsComputer.js.map +1 -1
- package/platform/PlatformTools.d.ts +5 -0
- package/platform/PlatformTools.js +16 -0
- package/platform/PlatformTools.js.map +1 -1
- package/repository/Repository.d.ts +4 -4
- package/repository/Repository.js.map +1 -1
- package/subscriber/Broadcaster.d.ts +6 -6
- package/subscriber/Broadcaster.js +1 -1
- package/subscriber/Broadcaster.js.map +1 -1
- package/util/OrmUtils.d.ts +18 -4
- package/util/OrmUtils.js +97 -69
- package/util/OrmUtils.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/subscriber/Broadcaster.ts"],"names":[],"mappings":";;;AAIA,2DAAuD;AAGvD,qDAAiD;AAyEjD;;GAEG;AACH,MAAa,WAAW;IACpB,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAoB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAEhD,4EAA4E;IAC5E,iBAAiB;IACjB,4EAA4E;IAE5E,KAAK,CAAC,SAAS,CACX,KAAQ,EACR,GAAG,IAAsC;QAEzC,M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AU,CAAC,QAAQ,EAAE,KAAK,MAAM;YAChC,UAAU,CAAC,QAAQ,EAAE,KAAK,MAAM;YAChC,UAAU,CAAC,QAAQ,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,CAC9C,CAAA;IACL,CAAC;CACJ;AAxzBD,kCAwzBC","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\"\nimport { ObjectUtils } from \"../util/ObjectUtils\"\n\ninterface BroadcasterEvents {\n BeforeQuery: () => void\n AfterQuery: () => void\n\n BeforeTransactionCommit: () => void\n AfterTransactionCommit: () => void\n BeforeTransactionStart: () => void\n AfterTransactionStart: () => void\n BeforeTransactionRollback: () => void\n AfterTransactionRollback: () => void\n\n BeforeUpdate: (\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n updatedColumns?: ColumnMetadata[],\n updatedRelations?: RelationMetadata[],\n ) => void\n AfterUpdate: (\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n updatedColumns?: ColumnMetadata[],\n updatedRelations?: RelationMetadata[],\n ) => void\n\n BeforeInsert: (\n metadata: EntityMetadata,\n entity: ObjectLiteral | undefined,\n ) => void\n AfterInsert: (\n metadata: EntityMetadata,\n entity: ObjectLiteral | undefined,\n ) => void\n\n BeforeRemove: (\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n ) => void\n AfterRemove: (\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n ) => void\n\n BeforeSoftRemove: (\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n ) => void\n AfterSoftRemove: (\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n ) => void\n\n BeforeRecover: (\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n ) => void\n AfterRecover: (\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n ) => void\n\n Load: (metadata: EntityMetadata, entities: ObjectLiteral[]) => void\n}\n\n/**\n * Broadcaster provides a helper methods to broadcast events to the subscribers.\n */\nexport class Broadcaster {\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(private queryRunner: QueryRunner) {}\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n async broadcast<U extends keyof BroadcasterEvents>(\n event: U,\n ...args: Parameters<BroadcasterEvents[U]>\n ): 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(this, result, ...args)\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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entity: undefined | ObjectLiteral,\n ): void {\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 (\n this.isAllowedSubscriber(subscriber, metadata.target) &&\n subscriber.beforeInsert\n ) {\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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n updatedColumns?: ColumnMetadata[],\n updatedRelations?: RelationMetadata[],\n ): void {\n // 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 (\n this.isAllowedSubscriber(subscriber, metadata.target) &&\n subscriber.beforeUpdate\n ) {\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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n identifier?: ObjectLiteral,\n ): 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 (\n this.isAllowedSubscriber(subscriber, metadata.target) &&\n subscriber.beforeRemove\n ) {\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(\n databaseEntity ?? identifier,\n ),\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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n identifier?: ObjectLiteral,\n ): 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 (\n this.isAllowedSubscriber(subscriber, metadata.target) &&\n subscriber.beforeSoftRemove\n ) {\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(\n databaseEntity ?? identifier,\n ),\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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n identifier?: ObjectLiteral,\n ): 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 (\n this.isAllowedSubscriber(subscriber, metadata.target) &&\n subscriber.beforeRecover\n ) {\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(\n databaseEntity ?? identifier,\n ),\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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n identifier?: ObjectLiteral,\n ): void {\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 (\n this.isAllowedSubscriber(subscriber, metadata.target) &&\n subscriber.afterInsert\n ) {\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 entityId: metadata.getEntityIdMixedMap(identifier),\n })\n if (executionResult instanceof Promise)\n result.promises.push(executionResult)\n result.count++\n }\n })\n }\n }\n\n /**\n * Broadcasts \"BEFORE_QUERY\" event.\n */\n broadcastBeforeQueryEvent(\n result: BroadcasterResult,\n query: string,\n parameters: undefined | any[],\n ): void {\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach((subscriber) => {\n if (subscriber.beforeQuery) {\n const executionResult = subscriber.beforeQuery({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n query: query,\n parameters: parameters,\n })\n if (executionResult instanceof Promise)\n result.promises.push(executionResult)\n result.count++\n }\n })\n }\n }\n\n /**\n * Broadcasts \"AFTER_QUERY\" event.\n */\n broadcastAfterQueryEvent(\n result: BroadcasterResult,\n query: string,\n parameters: undefined | any[],\n success: boolean,\n executionTime: undefined | number,\n rawResults: undefined | any,\n error: undefined | any,\n ): void {\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach((subscriber) => {\n if (subscriber.afterQuery) {\n const executionResult = subscriber.afterQuery({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n query: query,\n parameters: parameters,\n success: success,\n executionTime: executionTime,\n rawResults: rawResults,\n error: error,\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 =\n 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 {\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n },\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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n updatedColumns?: ColumnMetadata[],\n updatedRelations?: RelationMetadata[],\n ): void {\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 (\n this.isAllowedSubscriber(subscriber, metadata.target) &&\n subscriber.afterUpdate\n ) {\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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n identifier?: ObjectLiteral,\n ): void {\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 (\n this.isAllowedSubscriber(subscriber, metadata.target) &&\n subscriber.afterRemove\n ) {\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(\n databaseEntity ?? identifier,\n ),\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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n identifier?: ObjectLiteral,\n ): void {\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 (\n this.isAllowedSubscriber(subscriber, metadata.target) &&\n subscriber.afterSoftRemove\n ) {\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(\n databaseEntity ?? identifier,\n ),\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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n identifier?: ObjectLiteral,\n ): void {\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 (\n this.isAllowedSubscriber(subscriber, metadata.target) &&\n subscriber.afterRecover\n ) {\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(\n databaseEntity ?? identifier,\n ),\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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entities: ObjectLiteral[],\n ): 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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entities: ObjectLiteral[],\n ): void {\n // Calculate which subscribers are fitting for the given entity type\n const fittingSubscribers =\n this.queryRunner.connection.subscribers.filter(\n (subscriber) =>\n this.isAllowedSubscriber(subscriber, metadata.target) &&\n subscriber.afterLoad,\n )\n\n if (\n metadata.relations.length ||\n metadata.afterLoadListeners.length ||\n fittingSubscribers.length\n ) {\n // todo: check why need this?\n const nonPromiseEntities = entities.filter(\n (entity) => !(entity instanceof Promise),\n )\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 (\n relation.isLazy &&\n !entity.hasOwnProperty(relation.propertyName)\n )\n return\n\n const value = relation.getEntityValue(entity)\n if (ObjectUtils.isObject(value))\n this.broadcastLoadEvent(\n result,\n relation.inverseEntityMetadata,\n Array.isArray(value) ? value : [value],\n )\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)\n 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)\n 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(\n subscriber: EntitySubscriberInterface<any>,\n target: Function | string,\n ): boolean {\n return (\n !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":["../../src/subscriber/Broadcaster.ts"],"names":[],"mappings":";;;AAKA,qDAAiD;AACjD,2DAAuD;AAiFvD;;GAEG;AACH,MAAa,WAAW;IACpB,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAoB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAEhD,4EAA4E;IAC5E,iBAAiB;IACjB,4EAA4E;IAE5E,KAAK,CAAC,SAAS,CACX,KAAQ,EACR,GAAG,IAAsC;QAE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B,UAAU,CAAC,QAAQ,EAAE,KAAK,MAAM;YAChC,UAAU,CAAC,QAAQ,EAAE,KAAK,MAAM;YAChC,UAAU,CAAC,QAAQ,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,CAC9C,CAAA;IACL,CAAC;CACJ;AAxzBD,kCAwzBC","file":"Broadcaster.js","sourcesContent":["import { ObjectLiteral } from \"../common/ObjectLiteral\"\nimport { ColumnMetadata } from \"../metadata/ColumnMetadata\"\nimport { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { RelationMetadata } from \"../metadata/RelationMetadata\"\nimport { QueryRunner } from \"../query-runner/QueryRunner\"\nimport { ObjectUtils } from \"../util/ObjectUtils\"\nimport { BroadcasterResult } from \"./BroadcasterResult\"\nimport { EntitySubscriberInterface } from \"./EntitySubscriberInterface\"\n\ninterface BroadcasterEvents {\n BeforeQuery: (query: string, parameters: any[] | undefined) => void\n AfterQuery: (\n query: string,\n parameters: any[] | undefined,\n success: boolean,\n executionTime: number | undefined,\n rawResults: any | undefined,\n error: any | undefined,\n ) => void\n\n BeforeTransactionCommit: () => void\n AfterTransactionCommit: () => void\n BeforeTransactionStart: () => void\n AfterTransactionStart: () => void\n BeforeTransactionRollback: () => void\n AfterTransactionRollback: () => void\n\n BeforeUpdate: (\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n updatedColumns?: ColumnMetadata[],\n updatedRelations?: RelationMetadata[],\n ) => void\n AfterUpdate: (\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n updatedColumns?: ColumnMetadata[],\n updatedRelations?: RelationMetadata[],\n ) => void\n\n BeforeInsert: (\n metadata: EntityMetadata,\n entity: ObjectLiteral | undefined,\n ) => void\n AfterInsert: (\n metadata: EntityMetadata,\n entity: ObjectLiteral | undefined,\n ) => void\n\n BeforeRemove: (\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n ) => void\n AfterRemove: (\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n ) => void\n\n BeforeSoftRemove: (\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n ) => void\n AfterSoftRemove: (\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n ) => void\n\n BeforeRecover: (\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n ) => void\n AfterRecover: (\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n ) => void\n\n Load: (metadata: EntityMetadata, entities: ObjectLiteral[]) => void\n}\n\n/**\n * Broadcaster provides a helper methods to broadcast events to the subscribers.\n */\nexport class Broadcaster {\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(private queryRunner: QueryRunner) {}\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n async broadcast<U extends keyof BroadcasterEvents>(\n event: U,\n ...args: Parameters<BroadcasterEvents[U]>\n ): 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(this, result, ...args)\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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entity: undefined | ObjectLiteral,\n ): void {\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 (\n this.isAllowedSubscriber(subscriber, metadata.target) &&\n subscriber.beforeInsert\n ) {\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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n updatedColumns?: ColumnMetadata[],\n updatedRelations?: RelationMetadata[],\n ): void {\n // 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 (\n this.isAllowedSubscriber(subscriber, metadata.target) &&\n subscriber.beforeUpdate\n ) {\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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n identifier?: ObjectLiteral,\n ): 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 (\n this.isAllowedSubscriber(subscriber, metadata.target) &&\n subscriber.beforeRemove\n ) {\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(\n databaseEntity ?? identifier,\n ),\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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n identifier?: ObjectLiteral,\n ): 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 (\n this.isAllowedSubscriber(subscriber, metadata.target) &&\n subscriber.beforeSoftRemove\n ) {\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(\n databaseEntity ?? identifier,\n ),\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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n identifier?: ObjectLiteral,\n ): 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 (\n this.isAllowedSubscriber(subscriber, metadata.target) &&\n subscriber.beforeRecover\n ) {\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(\n databaseEntity ?? identifier,\n ),\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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n identifier?: ObjectLiteral,\n ): void {\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 (\n this.isAllowedSubscriber(subscriber, metadata.target) &&\n subscriber.afterInsert\n ) {\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 entityId: metadata.getEntityIdMixedMap(identifier),\n })\n if (executionResult instanceof Promise)\n result.promises.push(executionResult)\n result.count++\n }\n })\n }\n }\n\n /**\n * Broadcasts \"BEFORE_QUERY\" event.\n */\n broadcastBeforeQueryEvent(\n result: BroadcasterResult,\n query: string,\n parameters: undefined | any[],\n ): void {\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach((subscriber) => {\n if (subscriber.beforeQuery) {\n const executionResult = subscriber.beforeQuery({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n query: query,\n parameters: parameters,\n })\n if (executionResult instanceof Promise)\n result.promises.push(executionResult)\n result.count++\n }\n })\n }\n }\n\n /**\n * Broadcasts \"AFTER_QUERY\" event.\n */\n broadcastAfterQueryEvent(\n result: BroadcasterResult,\n query: string,\n parameters: undefined | any[],\n success: boolean,\n executionTime: undefined | number,\n rawResults: undefined | any,\n error: undefined | any,\n ): void {\n if (this.queryRunner.connection.subscribers.length) {\n this.queryRunner.connection.subscribers.forEach((subscriber) => {\n if (subscriber.afterQuery) {\n const executionResult = subscriber.afterQuery({\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n query: query,\n parameters: parameters,\n success: success,\n executionTime: executionTime,\n rawResults: rawResults,\n error: error,\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 =\n 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 {\n connection: this.queryRunner.connection,\n queryRunner: this.queryRunner,\n manager: this.queryRunner.manager,\n },\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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n updatedColumns?: ColumnMetadata[],\n updatedRelations?: RelationMetadata[],\n ): void {\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 (\n this.isAllowedSubscriber(subscriber, metadata.target) &&\n subscriber.afterUpdate\n ) {\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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n identifier?: ObjectLiteral,\n ): void {\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 (\n this.isAllowedSubscriber(subscriber, metadata.target) &&\n subscriber.afterRemove\n ) {\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(\n databaseEntity ?? identifier,\n ),\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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n identifier?: ObjectLiteral,\n ): void {\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 (\n this.isAllowedSubscriber(subscriber, metadata.target) &&\n subscriber.afterSoftRemove\n ) {\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(\n databaseEntity ?? identifier,\n ),\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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entity?: ObjectLiteral,\n databaseEntity?: ObjectLiteral,\n identifier?: ObjectLiteral,\n ): void {\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 (\n this.isAllowedSubscriber(subscriber, metadata.target) &&\n subscriber.afterRecover\n ) {\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(\n databaseEntity ?? identifier,\n ),\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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entities: ObjectLiteral[],\n ): 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(\n result: BroadcasterResult,\n metadata: EntityMetadata,\n entities: ObjectLiteral[],\n ): void {\n // Calculate which subscribers are fitting for the given entity type\n const fittingSubscribers =\n this.queryRunner.connection.subscribers.filter(\n (subscriber) =>\n this.isAllowedSubscriber(subscriber, metadata.target) &&\n subscriber.afterLoad,\n )\n\n if (\n metadata.relations.length ||\n metadata.afterLoadListeners.length ||\n fittingSubscribers.length\n ) {\n // todo: check why need this?\n const nonPromiseEntities = entities.filter(\n (entity) => !(entity instanceof Promise),\n )\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 (\n relation.isLazy &&\n !entity.hasOwnProperty(relation.propertyName)\n )\n return\n\n const value = relation.getEntityValue(entity)\n if (ObjectUtils.isObject(value))\n this.broadcastLoadEvent(\n result,\n relation.inverseEntityMetadata,\n Array.isArray(value) ? value : [value],\n )\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)\n 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)\n 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(\n subscriber: EntitySubscriberInterface<any>,\n target: Function | string,\n ): boolean {\n return (\n !subscriber.listenTo ||\n !subscriber.listenTo() ||\n subscriber.listenTo() === Object ||\n subscriber.listenTo() === target ||\n subscriber.listenTo().isPrototypeOf(target)\n )\n }\n}\n"],"sourceRoot":".."}
|
package/util/OrmUtils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ObjectLiteral } from "../common/ObjectLiteral";
|
|
2
|
+
import { PrimitiveCriteria, SinglePrimitiveCriteria } from "../common/PrimitiveCriteria";
|
|
2
3
|
export declare class OrmUtils {
|
|
3
4
|
/**
|
|
4
5
|
* Chunks array into pieces.
|
|
@@ -11,10 +12,6 @@ export declare class OrmUtils {
|
|
|
11
12
|
}[];
|
|
12
13
|
static uniq<T>(array: T[], criteria?: (item: T) => any): T[];
|
|
13
14
|
static uniq<T, K extends keyof T>(array: T[], property: K): T[];
|
|
14
|
-
private static isPlainObject;
|
|
15
|
-
private static mergeArrayKey;
|
|
16
|
-
private static mergeObjectKey;
|
|
17
|
-
private static merge;
|
|
18
15
|
/**
|
|
19
16
|
* Deep Object.assign.
|
|
20
17
|
*/
|
|
@@ -54,5 +51,22 @@ export declare class OrmUtils {
|
|
|
54
51
|
* is not present.
|
|
55
52
|
*/
|
|
56
53
|
static parseSqlCheckExpression(sql: string, columnName: string): string[] | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Checks if given criteria is null or empty.
|
|
56
|
+
*/
|
|
57
|
+
static isCriteriaNullOrEmpty(criteria: unknown): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Checks if given criteria is a primitive value.
|
|
60
|
+
* Primitive values are strings, numbers and dates.
|
|
61
|
+
*/
|
|
62
|
+
static isSinglePrimitiveCriteria(criteria: unknown): criteria is SinglePrimitiveCriteria;
|
|
63
|
+
/**
|
|
64
|
+
* Checks if given criteria is a primitive value or an array of primitive values.
|
|
65
|
+
*/
|
|
66
|
+
static isPrimitiveCriteria(criteria: unknown): criteria is PrimitiveCriteria;
|
|
57
67
|
private static compare2Objects;
|
|
68
|
+
private static isPlainObject;
|
|
69
|
+
private static mergeArrayKey;
|
|
70
|
+
private static mergeObjectKey;
|
|
71
|
+
private static merge;
|
|
58
72
|
}
|
package/util/OrmUtils.js
CHANGED
|
@@ -50,75 +50,6 @@ class OrmUtils {
|
|
|
50
50
|
return uniqueArray;
|
|
51
51
|
}, []);
|
|
52
52
|
}
|
|
53
|
-
// Checks if it's an object made by Object.create(null), {} or new Object()
|
|
54
|
-
static isPlainObject(item) {
|
|
55
|
-
if (item === null || item === undefined) {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
return !item.constructor || item.constructor === Object;
|
|
59
|
-
}
|
|
60
|
-
static mergeArrayKey(target, key, value, memo) {
|
|
61
|
-
// Have we seen this before? Prevent infinite recursion.
|
|
62
|
-
if (memo.has(value)) {
|
|
63
|
-
target[key] = memo.get(value);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
if (value instanceof Promise) {
|
|
67
|
-
// Skip promises entirely.
|
|
68
|
-
// This is a hold-over from the old code & is because we don't want to pull in
|
|
69
|
-
// the lazy fields. Ideally we'd remove these promises via another function first
|
|
70
|
-
// but for now we have to do it here.
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
if (!this.isPlainObject(value) && !Array.isArray(value)) {
|
|
74
|
-
target[key] = value;
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
if (!target[key]) {
|
|
78
|
-
target[key] = Array.isArray(value) ? [] : {};
|
|
79
|
-
}
|
|
80
|
-
memo.set(value, target[key]);
|
|
81
|
-
this.merge(target[key], value, memo);
|
|
82
|
-
memo.delete(value);
|
|
83
|
-
}
|
|
84
|
-
static mergeObjectKey(target, key, value, memo) {
|
|
85
|
-
// Have we seen this before? Prevent infinite recursion.
|
|
86
|
-
if (memo.has(value)) {
|
|
87
|
-
Object.assign(target, { [key]: memo.get(value) });
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
if (value instanceof Promise) {
|
|
91
|
-
// Skip promises entirely.
|
|
92
|
-
// This is a hold-over from the old code & is because we don't want to pull in
|
|
93
|
-
// the lazy fields. Ideally we'd remove these promises via another function first
|
|
94
|
-
// but for now we have to do it here.
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
if (!this.isPlainObject(value) && !Array.isArray(value)) {
|
|
98
|
-
Object.assign(target, { [key]: value });
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
if (!target[key]) {
|
|
102
|
-
Object.assign(target, { [key]: Array.isArray(value) ? [] : {} });
|
|
103
|
-
}
|
|
104
|
-
memo.set(value, target[key]);
|
|
105
|
-
this.merge(target[key], value, memo);
|
|
106
|
-
memo.delete(value);
|
|
107
|
-
}
|
|
108
|
-
static merge(target, source, memo = new Map()) {
|
|
109
|
-
if (this.isPlainObject(target) && this.isPlainObject(source)) {
|
|
110
|
-
for (const key of Object.keys(source)) {
|
|
111
|
-
if (key === "__proto__")
|
|
112
|
-
continue;
|
|
113
|
-
this.mergeObjectKey(target, key, source[key], memo);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
if (Array.isArray(target) && Array.isArray(source)) {
|
|
117
|
-
for (let key = 0; key < source.length; key++) {
|
|
118
|
-
this.mergeArrayKey(target, key, source[key], memo);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
53
|
/**
|
|
123
54
|
* Deep Object.assign.
|
|
124
55
|
*/
|
|
@@ -326,6 +257,34 @@ class OrmUtils {
|
|
|
326
257
|
}
|
|
327
258
|
return undefined;
|
|
328
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* Checks if given criteria is null or empty.
|
|
262
|
+
*/
|
|
263
|
+
static isCriteriaNullOrEmpty(criteria) {
|
|
264
|
+
return (criteria === undefined ||
|
|
265
|
+
criteria === null ||
|
|
266
|
+
criteria === "" ||
|
|
267
|
+
(Array.isArray(criteria) && criteria.length === 0) ||
|
|
268
|
+
(this.isPlainObject(criteria) && Object.keys(criteria).length === 0));
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Checks if given criteria is a primitive value.
|
|
272
|
+
* Primitive values are strings, numbers and dates.
|
|
273
|
+
*/
|
|
274
|
+
static isSinglePrimitiveCriteria(criteria) {
|
|
275
|
+
return (typeof criteria === "string" ||
|
|
276
|
+
typeof criteria === "number" ||
|
|
277
|
+
criteria instanceof Date);
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Checks if given criteria is a primitive value or an array of primitive values.
|
|
281
|
+
*/
|
|
282
|
+
static isPrimitiveCriteria(criteria) {
|
|
283
|
+
if (Array.isArray(criteria)) {
|
|
284
|
+
return criteria.every((value) => this.isSinglePrimitiveCriteria(value));
|
|
285
|
+
}
|
|
286
|
+
return this.isSinglePrimitiveCriteria(criteria);
|
|
287
|
+
}
|
|
329
288
|
// -------------------------------------------------------------------------
|
|
330
289
|
// Private methods
|
|
331
290
|
// -------------------------------------------------------------------------
|
|
@@ -409,6 +368,75 @@ class OrmUtils {
|
|
|
409
368
|
}
|
|
410
369
|
return true;
|
|
411
370
|
}
|
|
371
|
+
// Checks if it's an object made by Object.create(null), {} or new Object()
|
|
372
|
+
static isPlainObject(item) {
|
|
373
|
+
if (item === null || item === undefined) {
|
|
374
|
+
return false;
|
|
375
|
+
}
|
|
376
|
+
return !item.constructor || item.constructor === Object;
|
|
377
|
+
}
|
|
378
|
+
static mergeArrayKey(target, key, value, memo) {
|
|
379
|
+
// Have we seen this before? Prevent infinite recursion.
|
|
380
|
+
if (memo.has(value)) {
|
|
381
|
+
target[key] = memo.get(value);
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
if (value instanceof Promise) {
|
|
385
|
+
// Skip promises entirely.
|
|
386
|
+
// This is a hold-over from the old code & is because we don't want to pull in
|
|
387
|
+
// the lazy fields. Ideally we'd remove these promises via another function first
|
|
388
|
+
// but for now we have to do it here.
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
if (!this.isPlainObject(value) && !Array.isArray(value)) {
|
|
392
|
+
target[key] = value;
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
if (!target[key]) {
|
|
396
|
+
target[key] = Array.isArray(value) ? [] : {};
|
|
397
|
+
}
|
|
398
|
+
memo.set(value, target[key]);
|
|
399
|
+
this.merge(target[key], value, memo);
|
|
400
|
+
memo.delete(value);
|
|
401
|
+
}
|
|
402
|
+
static mergeObjectKey(target, key, value, memo) {
|
|
403
|
+
// Have we seen this before? Prevent infinite recursion.
|
|
404
|
+
if (memo.has(value)) {
|
|
405
|
+
Object.assign(target, { [key]: memo.get(value) });
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
if (value instanceof Promise) {
|
|
409
|
+
// Skip promises entirely.
|
|
410
|
+
// This is a hold-over from the old code & is because we don't want to pull in
|
|
411
|
+
// the lazy fields. Ideally we'd remove these promises via another function first
|
|
412
|
+
// but for now we have to do it here.
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
if (!this.isPlainObject(value) && !Array.isArray(value)) {
|
|
416
|
+
Object.assign(target, { [key]: value });
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
if (!target[key]) {
|
|
420
|
+
Object.assign(target, { [key]: Array.isArray(value) ? [] : {} });
|
|
421
|
+
}
|
|
422
|
+
memo.set(value, target[key]);
|
|
423
|
+
this.merge(target[key], value, memo);
|
|
424
|
+
memo.delete(value);
|
|
425
|
+
}
|
|
426
|
+
static merge(target, source, memo = new Map()) {
|
|
427
|
+
if (this.isPlainObject(target) && this.isPlainObject(source)) {
|
|
428
|
+
for (const key of Object.keys(source)) {
|
|
429
|
+
if (key === "__proto__")
|
|
430
|
+
continue;
|
|
431
|
+
this.mergeObjectKey(target, key, source[key], memo);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
if (Array.isArray(target) && Array.isArray(source)) {
|
|
435
|
+
for (let key = 0; key < source.length; key++) {
|
|
436
|
+
this.mergeArrayKey(target, key, source[key], memo);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
412
440
|
}
|
|
413
441
|
exports.OrmUtils = OrmUtils;
|
|
414
442
|
|