typeorm 0.3.24-dev.2168441 → 0.3.24-dev.39a6562
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/error/index.d.ts +0 -1
- package/browser/error/index.js +0 -1
- package/browser/error/index.js.map +1 -1
- package/browser/persistence/SubjectDatabaseEntityLoader.d.ts +0 -8
- package/browser/persistence/SubjectDatabaseEntityLoader.js +11 -26
- package/browser/persistence/SubjectDatabaseEntityLoader.js.map +1 -1
- package/error/index.d.ts +0 -1
- package/error/index.js +0 -1
- package/error/index.js.map +1 -1
- package/index.mjs +0 -2
- package/package.json +1 -1
- package/persistence/SubjectDatabaseEntityLoader.d.ts +0 -8
- package/persistence/SubjectDatabaseEntityLoader.js +11 -26
- package/persistence/SubjectDatabaseEntityLoader.js.map +1 -1
- package/browser/error/NamingStrategyNotFoundError.d.ts +0 -7
- package/browser/error/NamingStrategyNotFoundError.js +0 -17
- package/browser/error/NamingStrategyNotFoundError.js.map +0 -1
- package/error/NamingStrategyNotFoundError.d.ts +0 -7
- package/error/NamingStrategyNotFoundError.js +0 -21
- package/error/NamingStrategyNotFoundError.js.map +0 -1
package/browser/error/index.d.ts
CHANGED
|
@@ -40,7 +40,6 @@ export * from "./OptimisticLockCanNotBeUsedError";
|
|
|
40
40
|
export * from "./MetadataWithSuchNameAlreadyExistsError";
|
|
41
41
|
export * from "./DriverOptionNotSetError";
|
|
42
42
|
export * from "./FindRelationsNotFoundError";
|
|
43
|
-
export * from "./NamingStrategyNotFoundError";
|
|
44
43
|
export * from "./PessimisticLockTransactionRequiredError";
|
|
45
44
|
export * from "./RepositoryNotTreeError";
|
|
46
45
|
export * from "./DataTypeNotSupportedError";
|
package/browser/error/index.js
CHANGED
|
@@ -40,7 +40,6 @@ export * from "./OptimisticLockCanNotBeUsedError";
|
|
|
40
40
|
export * from "./MetadataWithSuchNameAlreadyExistsError";
|
|
41
41
|
export * from "./DriverOptionNotSetError";
|
|
42
42
|
export * from "./FindRelationsNotFoundError";
|
|
43
|
-
export * from "./NamingStrategyNotFoundError";
|
|
44
43
|
export * from "./PessimisticLockTransactionRequiredError";
|
|
45
44
|
export * from "./RepositoryNotTreeError";
|
|
46
45
|
export * from "./DataTypeNotSupportedError";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../browser/src/error/index.ts"],"names":[],"mappings":"AAAA,cAAc,yCAAyC,CAAA;AACvD,cAAc,mCAAmC,CAAA;AACjD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,sCAAsC,CAAA;AACpD,cAAc,sCAAsC,CAAA;AACpD,cAAc,2BAA2B,CAAA;AACzC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,mCAAmC,CAAA;AACjD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,kCAAkC,CAAA;AAChD,cAAc,uBAAuB,CAAA;AACrC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,qBAAqB,CAAA;AACnC,cAAc,sCAAsC,CAAA;AACpD,cAAc,kCAAkC,CAAA;AAChD,cAAc,sCAAsC,CAAA;AACpD,cAAc,gDAAgD,CAAA;AAC9D,cAAc,2CAA2C,CAAA;AACzD,cAAc,uCAAuC,CAAA;AACrD,cAAc,0CAA0C,CAAA;AACxD,cAAc,gCAAgC,CAAA;AAC9C,cAAc,kCAAkC,CAAA;AAChD,cAAc,0BAA0B,CAAA;AACxC,cAAc,uCAAuC,CAAA;AACrD,cAAc,mCAAmC,CAAA;AACjD,cAAc,0BAA0B,CAAA;AACxC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,sBAAsB,CAAA;AACpC,cAAc,kCAAkC,CAAA;AAChD,cAAc,2CAA2C,CAAA;AACzD,cAAc,2BAA2B,CAAA;AACzC,cAAc,oCAAoC,CA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,cAAc,mCAAmC,CAAA;AACjD,cAAc,0CAA0C,CAAA;AACxD,cAAc,2BAA2B,CAAA;AACzC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2CAA2C,CAAA;AACzD,cAAc,0BAA0B,CAAA;AACxC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qCAAqC,CAAA;AACnD,cAAc,4CAA4C,CAAA;AAC1D,cAAc,2CAA2C,CAAA;AACzD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oCAAoC,CAAA;AAClD,cAAc,4BAA4B,CAAA;AAC1C,cAAc,mCAAmC,CAAA;AACjD,cAAc,uCAAuC,CAAA;AACrD,cAAc,kCAAkC,CAAA;AAChD,cAAc,2BAA2B,CAAA;AACzC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,yCAAyC,CAAA","file":"index.js","sourcesContent":["export * from \"./CannotReflectMethodParameterTypeError\"\nexport * from \"./AlreadyHasActiveConnectionError\"\nexport * from \"./SubjectWithoutIdentifierError\"\nexport * from \"./CannotConnectAlreadyConnectedError\"\nexport * from \"./LockNotSupportedOnGivenDriverError\"\nexport * from \"./ConnectionIsNotSetError\"\nexport * from \"./CannotCreateEntityIdMapError\"\nexport * from \"./MetadataAlreadyExistsError\"\nexport * from \"./CannotDetermineEntityError\"\nexport * from \"./UpdateValuesMissingError\"\nexport * from \"./TreeRepositoryNotSupportedError\"\nexport * from \"./CustomRepositoryNotFoundError\"\nexport * from \"./TransactionNotStartedError\"\nexport * from \"./TransactionAlreadyStartedError\"\nexport * from \"./EntityNotFoundError\"\nexport * from \"./EntityMetadataNotFoundError\"\nexport * from \"./MustBeEntityError\"\nexport * from \"./OptimisticLockVersionMismatchError\"\nexport * from \"./LimitOnUpdateNotSupportedError\"\nexport * from \"./PrimaryColumnCannotBeNullableError\"\nexport * from \"./CustomRepositoryCannotInheritRepositoryError\"\nexport * from \"./QueryRunnerProviderAlreadyReleasedError\"\nexport * from \"./CannotAttachTreeChildrenEntityError\"\nexport * from \"./CustomRepositoryDoesNotHaveEntityError\"\nexport * from \"./MissingDeleteDateColumnError\"\nexport * from \"./NoConnectionForRepositoryError\"\nexport * from \"./CircularRelationsError\"\nexport * from \"./ReturningStatementNotSupportedError\"\nexport * from \"./UsingJoinTableIsNotAllowedError\"\nexport * from \"./MissingJoinColumnError\"\nexport * from \"./MissingPrimaryColumnError\"\nexport * from \"./EntityPropertyNotFoundError\"\nexport * from \"./MissingDriverError\"\nexport * from \"./DriverPackageNotInstalledError\"\nexport * from \"./CannotGetEntityManagerNotConnectedError\"\nexport * from \"./ConnectionNotFoundError\"\nexport * from \"./NoVersionOrUpdateDateColumnError\"\nexport * from \"./InsertValuesMissingError\"\nexport * from \"./OptimisticLockCanNotBeUsedError\"\nexport * from \"./MetadataWithSuchNameAlreadyExistsError\"\nexport * from \"./DriverOptionNotSetError\"\nexport * from \"./FindRelationsNotFoundError\"\nexport * from \"./PessimisticLockTransactionRequiredError\"\nexport * from \"./RepositoryNotTreeError\"\nexport * from \"./DataTypeNotSupportedError\"\nexport * from \"./InitializedRelationError\"\nexport * from \"./MissingJoinTableError\"\nexport * from \"./QueryFailedError\"\nexport * from \"./NoNeedToReleaseEntityManagerError\"\nexport * from \"./UsingJoinColumnOnlyOnOneSideAllowedError\"\nexport * from \"./UsingJoinTableOnlyOnOneSideAllowedError\"\nexport * from \"./SubjectRemovedAndUpdatedError\"\nexport * from \"./PersistedEntityNotFoundError\"\nexport * from \"./UsingJoinColumnIsNotAllowedError\"\nexport * from \"./ColumnTypeUndefinedError\"\nexport * from \"./QueryRunnerAlreadyReleasedError\"\nexport * from \"./OffsetWithoutLimitNotSupportedError\"\nexport * from \"./CannotExecuteNotConnectedError\"\nexport * from \"./NoConnectionOptionError\"\nexport * from \"./TypeORMError\"\nexport * from \"./ForbiddenTransactionModeOverrideError\"\n"],"sourceRoot":".."}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Subject } from "./Subject";
|
|
2
|
-
import { ObjectLiteral } from "../common/ObjectLiteral";
|
|
3
2
|
import { QueryRunner } from "../query-runner/QueryRunner";
|
|
4
3
|
/**
|
|
5
4
|
* Loads database entities for all operate subjects which do not have database entity set.
|
|
@@ -18,13 +17,6 @@ export declare class SubjectDatabaseEntityLoader {
|
|
|
18
17
|
* This option is used for deletion.
|
|
19
18
|
*/
|
|
20
19
|
load(operationType: "save" | "remove" | "soft-remove" | "recover"): Promise<void>;
|
|
21
|
-
/**
|
|
22
|
-
* Finds subjects where entity like given subject's entity.
|
|
23
|
-
* Comparison made by entity id.
|
|
24
|
-
* Multiple subjects may be returned if duplicates are present in the subject array.
|
|
25
|
-
* This will likely result in the same row being updated multiple times during a transaction.
|
|
26
|
-
*/
|
|
27
|
-
protected findByPersistEntityLike(entityTarget: Function | string, entity: ObjectLiteral): Subject[];
|
|
28
20
|
/**
|
|
29
21
|
* Groups given Subject objects into groups separated by entity targets.
|
|
30
22
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OrmUtils } from "../util/OrmUtils";
|
|
1
2
|
/**
|
|
2
3
|
* Loads database entities for all operate subjects which do not have database entity set.
|
|
3
4
|
* All entities that we load database entities for are marked as updated or inserted.
|
|
@@ -88,17 +89,17 @@ export class SubjectDatabaseEntityLoader {
|
|
|
88
89
|
.whereInIds(allIds)
|
|
89
90
|
.getMany();
|
|
90
91
|
}
|
|
91
|
-
//
|
|
92
|
-
// and insert that entity into database entity of the found subjects
|
|
92
|
+
// Now when we have entities we need to find subject of each entity
|
|
93
|
+
// and insert that entity into database entity of the found subjects.
|
|
94
|
+
// A single entity can be applied to many subjects as there might be duplicates.
|
|
95
|
+
// This will likely result in the same row being updated multiple times during a transaction.
|
|
93
96
|
entities.forEach((entity) => {
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
subject.databaseEntity
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
? subject.metadata.getEntityIdMap(entity)
|
|
101
|
-
: undefined;
|
|
97
|
+
const entityId = allSubjects[0].metadata.getEntityIdMap(entity);
|
|
98
|
+
allSubjects.forEach((subject) => {
|
|
99
|
+
if (subject.databaseEntity)
|
|
100
|
+
return;
|
|
101
|
+
if (OrmUtils.compareIds(subject.identifier, entityId))
|
|
102
|
+
subject.databaseEntity = entity;
|
|
102
103
|
});
|
|
103
104
|
});
|
|
104
105
|
// this way we tell what subjects we tried to load database entities of
|
|
@@ -111,22 +112,6 @@ export class SubjectDatabaseEntityLoader {
|
|
|
111
112
|
// ---------------------------------------------------------------------
|
|
112
113
|
// Protected Methods
|
|
113
114
|
// ---------------------------------------------------------------------
|
|
114
|
-
/**
|
|
115
|
-
* Finds subjects where entity like given subject's entity.
|
|
116
|
-
* Comparison made by entity id.
|
|
117
|
-
* Multiple subjects may be returned if duplicates are present in the subject array.
|
|
118
|
-
* This will likely result in the same row being updated multiple times during a transaction.
|
|
119
|
-
*/
|
|
120
|
-
findByPersistEntityLike(entityTarget, entity) {
|
|
121
|
-
return this.subjects.filter((subject) => {
|
|
122
|
-
if (!subject.entity)
|
|
123
|
-
return false;
|
|
124
|
-
if (subject.entity === entity)
|
|
125
|
-
return true;
|
|
126
|
-
return (subject.metadata.target === entityTarget &&
|
|
127
|
-
subject.metadata.compareEntities(subject.entityWithFulfilledIds, entity));
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
115
|
/**
|
|
131
116
|
* Groups given Subject objects into groups separated by entity targets.
|
|
132
117
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../browser/src/persistence/SubjectDatabaseEntityLoader.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,MAAM,OAAO,2BAA2B;IACpC,wEAAwE;IACxE,cAAc;IACd,wEAAwE;IAExE,YACc,WAAwB,EACxB,QAAmB;QADnB,gBAAW,GAAX,WAAW,CAAa;QACxB,a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ACN,CAAC;IAED;;OAEG;IACO,oBAAoB;QAI1B,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,cAAc,EAAE,EAAE;YACnD,IAAI,KAAK,GAAG,MAAM,CAAC,IAAI,CACnB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,cAAc,CAAC,QAAQ,CAAC,MAAM,CAC7D,CAAA;YACD,IAAI,CAAC,KAAK,EAAE,CAAC;gBACT,KAAK,GAAG,EAAE,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAA;gBAChE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YACtB,CAAC;YACD,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;YACnC,OAAO,MAAM,CAAA;QACjB,CAAC,EAAE,EAA0D,CAAC,CAAA;IAClE,CAAC;CACJ","file":"SubjectDatabaseEntityLoader.js","sourcesContent":["import { Subject } from \"./Subject\"\nimport { ObjectLiteral } from \"../common/ObjectLiteral\"\nimport { QueryRunner } from \"../query-runner/QueryRunner\"\nimport { FindManyOptions } from \"../find-options/FindManyOptions\"\nimport { MongoRepository } from \"../repository/MongoRepository\"\n\n/**\n * Loads database entities for all operate subjects which do not have database entity set.\n * All entities that we load database entities for are marked as updated or inserted.\n * To understand which of them really needs to be inserted or updated we need to load\n * their original representations from the database.\n */\nexport class SubjectDatabaseEntityLoader {\n // ---------------------------------------------------------------------\n // Constructor\n // ---------------------------------------------------------------------\n\n constructor(\n protected queryRunner: QueryRunner,\n protected subjects: Subject[],\n ) {}\n\n // ---------------------------------------------------------------------\n // Public Methods\n // ---------------------------------------------------------------------\n\n /**\n * Loads database entities for all subjects.\n *\n * loadAllRelations flag is used to load all relation ids of the object, no matter if they present in subject entity or not.\n * This option is used for deletion.\n */\n async load(\n operationType: \"save\" | \"remove\" | \"soft-remove\" | \"recover\",\n ): Promise<void> {\n // we are grouping subjects by target to perform more optimized queries using WHERE IN operator\n // go through the groups and perform loading of database entities of each subject in the group\n const promises = this.groupByEntityTargets().map(\n async (subjectGroup) => {\n // prepare entity ids of the subjects we need to load\n const allIds: ObjectLiteral[] = []\n const allSubjects: Subject[] = []\n subjectGroup.subjects.forEach((subject) => {\n // we don't load if subject already has a database entity loaded\n if (subject.databaseEntity || !subject.identifier) return\n\n allIds.push(subject.identifier)\n allSubjects.push(subject)\n })\n\n // if there no ids found (means all entities are new and have generated ids) - then nothing to load there\n if (!allIds.length) return\n\n const loadRelationPropertyPaths: string[] = []\n\n // for the save, soft-remove and recover operation\n // extract all property paths of the relations we need to load relation ids for\n // this is for optimization purpose - this way we don't load relation ids for entities\n // whose relations are undefined, and since they are undefined its really pointless to\n // load something for them, since undefined properties are skipped by the orm\n if (\n operationType === \"save\" ||\n operationType === \"soft-remove\" ||\n operationType === \"recover\"\n ) {\n subjectGroup.subjects.forEach((subject) => {\n // gets all relation property paths that exist in the persisted entity.\n subject.metadata.relations.forEach((relation) => {\n const value = relation.getEntityValue(\n subject.entityWithFulfilledIds!,\n )\n if (value === undefined) return\n\n if (\n loadRelationPropertyPaths.indexOf(\n relation.propertyPath,\n ) === -1\n )\n loadRelationPropertyPaths.push(\n relation.propertyPath,\n )\n })\n })\n } else {\n // remove\n\n // for remove operation\n // we only need to load junction relation ids since only they are removed by cascades\n loadRelationPropertyPaths.push(\n ...subjectGroup.subjects[0].metadata.manyToManyRelations.map(\n (relation) => relation.propertyPath,\n ),\n )\n }\n\n const findOptions: FindManyOptions<any> = {\n loadEagerRelations: false,\n loadRelationIds: {\n relations: loadRelationPropertyPaths,\n disableMixedMap: true,\n },\n // the soft-deleted entities should be included in the loaded entities for recover operation\n withDeleted: true,\n }\n\n // load database entities for all given ids\n let entities: any[] = []\n if (\n this.queryRunner.connection.driver.options.type ===\n \"mongodb\"\n ) {\n const mongoRepo =\n this.queryRunner.manager.getRepository<ObjectLiteral>(\n subjectGroup.target,\n ) as MongoRepository<ObjectLiteral>\n entities = await mongoRepo.findByIds(allIds, findOptions)\n } else {\n entities = await this.queryRunner.manager\n .getRepository<ObjectLiteral>(subjectGroup.target)\n .createQueryBuilder()\n .setFindOptions(findOptions)\n .whereInIds(allIds)\n .getMany()\n }\n\n // now when we have entities we need to find subject of each entity\n // and insert that entity into database entity of the found subjects\n entities.forEach((entity) => {\n const subjects = this.findByPersistEntityLike(\n subjectGroup.target,\n entity,\n )\n subjects.forEach((subject) => {\n subject.databaseEntity = entity\n if (!subject.identifier)\n subject.identifier =\n subject.metadata.hasAllPrimaryKeys(entity)\n ? subject.metadata.getEntityIdMap(entity)\n : undefined\n })\n })\n\n // this way we tell what subjects we tried to load database entities of\n for (const subject of allSubjects) {\n subject.databaseEntityLoaded = true\n }\n },\n )\n\n await Promise.all(promises)\n }\n\n // ---------------------------------------------------------------------\n // Protected Methods\n // ---------------------------------------------------------------------\n\n /**\n * Finds subjects where entity like given subject's entity.\n * Comparison made by entity id.\n * Multiple subjects may be returned if duplicates are present in the subject array.\n * This will likely result in the same row being updated multiple times during a transaction.\n */\n protected findByPersistEntityLike(\n entityTarget: Function | string,\n entity: ObjectLiteral,\n ): Subject[] {\n return this.subjects.filter((subject) => {\n if (!subject.entity) return false\n\n if (subject.entity === entity) return true\n\n return (\n subject.metadata.target === entityTarget &&\n subject.metadata.compareEntities(\n subject.entityWithFulfilledIds!,\n entity,\n )\n )\n })\n }\n\n /**\n * Groups given Subject objects into groups separated by entity targets.\n */\n protected groupByEntityTargets(): {\n target: Function | string\n subjects: Subject[]\n }[] {\n return this.subjects.reduce((groups, operatedEntity) => {\n let group = groups.find(\n (group) => group.target === operatedEntity.metadata.target,\n )\n if (!group) {\n group = { target: operatedEntity.metadata.target, subjects: [] }\n groups.push(group)\n }\n group.subjects.push(operatedEntity)\n return groups\n }, [] as { target: Function | string; subjects: Subject[] }[])\n }\n}\n"],"sourceRoot":".."}
|
|
1
|
+
{"version":3,"sources":["../browser/src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D,IAAI,CAAC,KAAK,EAAE,CAAC;gBACT,KAAK,GAAG,EAAE,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAA;gBAChE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YACtB,CAAC;YACD,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;YACnC,OAAO,MAAM,CAAA;QACjB,CAAC,EAAE,EAA0D,CAAC,CAAA;IAClE,CAAC;CACJ","file":"SubjectDatabaseEntityLoader.js","sourcesContent":["import { Subject } from \"./Subject\"\nimport { ObjectLiteral } from \"../common/ObjectLiteral\"\nimport { QueryRunner } from \"../query-runner/QueryRunner\"\nimport { FindManyOptions } from \"../find-options/FindManyOptions\"\nimport { MongoRepository } from \"../repository/MongoRepository\"\nimport { OrmUtils } from \"../util/OrmUtils\"\n\n/**\n * Loads database entities for all operate subjects which do not have database entity set.\n * All entities that we load database entities for are marked as updated or inserted.\n * To understand which of them really needs to be inserted or updated we need to load\n * their original representations from the database.\n */\nexport class SubjectDatabaseEntityLoader {\n // ---------------------------------------------------------------------\n // Constructor\n // ---------------------------------------------------------------------\n\n constructor(\n protected queryRunner: QueryRunner,\n protected subjects: Subject[],\n ) {}\n\n // ---------------------------------------------------------------------\n // Public Methods\n // ---------------------------------------------------------------------\n\n /**\n * Loads database entities for all subjects.\n *\n * loadAllRelations flag is used to load all relation ids of the object, no matter if they present in subject entity or not.\n * This option is used for deletion.\n */\n async load(\n operationType: \"save\" | \"remove\" | \"soft-remove\" | \"recover\",\n ): Promise<void> {\n // we are grouping subjects by target to perform more optimized queries using WHERE IN operator\n // go through the groups and perform loading of database entities of each subject in the group\n const promises = this.groupByEntityTargets().map(\n async (subjectGroup) => {\n // prepare entity ids of the subjects we need to load\n const allIds: ObjectLiteral[] = []\n const allSubjects: Subject[] = []\n subjectGroup.subjects.forEach((subject) => {\n // we don't load if subject already has a database entity loaded\n if (subject.databaseEntity || !subject.identifier) return\n\n allIds.push(subject.identifier)\n allSubjects.push(subject)\n })\n\n // if there no ids found (means all entities are new and have generated ids) - then nothing to load there\n if (!allIds.length) return\n\n const loadRelationPropertyPaths: string[] = []\n\n // for the save, soft-remove and recover operation\n // extract all property paths of the relations we need to load relation ids for\n // this is for optimization purpose - this way we don't load relation ids for entities\n // whose relations are undefined, and since they are undefined its really pointless to\n // load something for them, since undefined properties are skipped by the orm\n if (\n operationType === \"save\" ||\n operationType === \"soft-remove\" ||\n operationType === \"recover\"\n ) {\n subjectGroup.subjects.forEach((subject) => {\n // gets all relation property paths that exist in the persisted entity.\n subject.metadata.relations.forEach((relation) => {\n const value = relation.getEntityValue(\n subject.entityWithFulfilledIds!,\n )\n if (value === undefined) return\n\n if (\n loadRelationPropertyPaths.indexOf(\n relation.propertyPath,\n ) === -1\n )\n loadRelationPropertyPaths.push(\n relation.propertyPath,\n )\n })\n })\n } else {\n // remove\n\n // for remove operation\n // we only need to load junction relation ids since only they are removed by cascades\n loadRelationPropertyPaths.push(\n ...subjectGroup.subjects[0].metadata.manyToManyRelations.map(\n (relation) => relation.propertyPath,\n ),\n )\n }\n\n const findOptions: FindManyOptions<any> = {\n loadEagerRelations: false,\n loadRelationIds: {\n relations: loadRelationPropertyPaths,\n disableMixedMap: true,\n },\n // the soft-deleted entities should be included in the loaded entities for recover operation\n withDeleted: true,\n }\n\n // load database entities for all given ids\n let entities: any[] = []\n if (\n this.queryRunner.connection.driver.options.type ===\n \"mongodb\"\n ) {\n const mongoRepo =\n this.queryRunner.manager.getRepository<ObjectLiteral>(\n subjectGroup.target,\n ) as MongoRepository<ObjectLiteral>\n entities = await mongoRepo.findByIds(allIds, findOptions)\n } else {\n entities = await this.queryRunner.manager\n .getRepository<ObjectLiteral>(subjectGroup.target)\n .createQueryBuilder()\n .setFindOptions(findOptions)\n .whereInIds(allIds)\n .getMany()\n }\n\n // Now when we have entities we need to find subject of each entity\n // and insert that entity into database entity of the found subjects.\n // A single entity can be applied to many subjects as there might be duplicates.\n // This will likely result in the same row being updated multiple times during a transaction.\n entities.forEach((entity) => {\n const entityId =\n allSubjects[0].metadata.getEntityIdMap(entity)\n allSubjects.forEach((subject) => {\n if (subject.databaseEntity) return\n if (OrmUtils.compareIds(subject.identifier, entityId))\n subject.databaseEntity = entity\n })\n })\n\n // this way we tell what subjects we tried to load database entities of\n for (const subject of allSubjects) {\n subject.databaseEntityLoaded = true\n }\n },\n )\n\n await Promise.all(promises)\n }\n\n // ---------------------------------------------------------------------\n // Protected Methods\n // ---------------------------------------------------------------------\n\n /**\n * Groups given Subject objects into groups separated by entity targets.\n */\n protected groupByEntityTargets(): {\n target: Function | string\n subjects: Subject[]\n }[] {\n return this.subjects.reduce((groups, operatedEntity) => {\n let group = groups.find(\n (group) => group.target === operatedEntity.metadata.target,\n )\n if (!group) {\n group = { target: operatedEntity.metadata.target, subjects: [] }\n groups.push(group)\n }\n group.subjects.push(operatedEntity)\n return groups\n }, [] as { target: Function | string; subjects: Subject[] }[])\n }\n}\n"],"sourceRoot":".."}
|
package/error/index.d.ts
CHANGED
|
@@ -40,7 +40,6 @@ export * from "./OptimisticLockCanNotBeUsedError";
|
|
|
40
40
|
export * from "./MetadataWithSuchNameAlreadyExistsError";
|
|
41
41
|
export * from "./DriverOptionNotSetError";
|
|
42
42
|
export * from "./FindRelationsNotFoundError";
|
|
43
|
-
export * from "./NamingStrategyNotFoundError";
|
|
44
43
|
export * from "./PessimisticLockTransactionRequiredError";
|
|
45
44
|
export * from "./RepositoryNotTreeError";
|
|
46
45
|
export * from "./DataTypeNotSupportedError";
|
package/error/index.js
CHANGED
|
@@ -43,7 +43,6 @@ tslib_1.__exportStar(require("./OptimisticLockCanNotBeUsedError"), exports);
|
|
|
43
43
|
tslib_1.__exportStar(require("./MetadataWithSuchNameAlreadyExistsError"), exports);
|
|
44
44
|
tslib_1.__exportStar(require("./DriverOptionNotSetError"), exports);
|
|
45
45
|
tslib_1.__exportStar(require("./FindRelationsNotFoundError"), exports);
|
|
46
|
-
tslib_1.__exportStar(require("./NamingStrategyNotFoundError"), exports);
|
|
47
46
|
tslib_1.__exportStar(require("./PessimisticLockTransactionRequiredError"), exports);
|
|
48
47
|
tslib_1.__exportStar(require("./RepositoryNotTreeError"), exports);
|
|
49
48
|
tslib_1.__exportStar(require("./DataTypeNotSupportedError"), exports);
|
package/error/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/error/index.ts"],"names":[],"mappings":";;;AAAA,kFAAuD;AACvD,4EAAiD;AACjD,0EAA+C;AAC/C,+EAAoD;AACpD,+EAAoD;AACpD,oEAAyC;AACzC,yEAA8C;AAC9C,uEAA4C;AAC5C,uEAA4C;AAC5C,qEAA0C;AAC1C,4EAAiD;AACjD,0EAA+C;AAC/C,uEAA4C;AAC5C,2EAAgD;AAChD,gEAAqC;AACrC,wEAA6C;AAC7C,8DAAmC;AACnC,+EAAoD;AACpD,2EAAgD;AAChD,+EAAoD;AACpD,yFAA8D;AAC9D,oFAAyD;AACzD,gFAAqD;AACrD,mFAAwD;AACxD,yEAA8C;AAC9C,2EAAgD;AAChD,mEAAwC;AACxC,gFAAqD;AACrD,4EAAiD;AACjD,mEAAwC;AACxC,sEAA2C;AAC3C,wEAA6C;AAC7C,+DAAoC;AACpC,2EAAgD;AAChD,oFAAyD;AACzD,oEAAyC;AACzC,6EAAkD;AAClD,qEAA0C;AAC1C,4EAAiD;AACjD,mFAAwD;AACxD,oEAAyC;AACzC,uEAA4C;AAC5C,
|
|
1
|
+
{"version":3,"sources":["../../src/error/index.ts"],"names":[],"mappings":";;;AAAA,kFAAuD;AACvD,4EAAiD;AACjD,0EAA+C;AAC/C,+EAAoD;AACpD,+EAAoD;AACpD,oEAAyC;AACzC,yEAA8C;AAC9C,uEAA4C;AAC5C,uEAA4C;AAC5C,qEAA0C;AAC1C,4EAAiD;AACjD,0EAA+C;AAC/C,uEAA4C;AAC5C,2EAAgD;AAChD,gEAAqC;AACrC,wEAA6C;AAC7C,8DAAmC;AACnC,+EAAoD;AACpD,2EAAgD;AAChD,+EAAoD;AACpD,yFAA8D;AAC9D,oFAAyD;AACzD,gFAAqD;AACrD,mFAAwD;AACxD,yEAA8C;AAC9C,2EAAgD;AAChD,mEAAwC;AACxC,gFAAqD;AACrD,4EAAiD;AACjD,mEAAwC;AACxC,sEAA2C;AAC3C,wEAA6C;AAC7C,+DAAoC;AACpC,2EAAgD;AAChD,oFAAyD;AACzD,oEAAyC;AACzC,6EAAkD;AAClD,qEAA0C;AAC1C,4EAAiD;AACjD,mFAAwD;AACxD,oEAAyC;AACzC,uEAA4C;AAC5C,oFAAyD;AACzD,mEAAwC;AACxC,sEAA2C;AAC3C,qEAA0C;AAC1C,kEAAuC;AACvC,6DAAkC;AAClC,8EAAmD;AACnD,qFAA0D;AAC1D,oFAAyD;AACzD,0EAA+C;AAC/C,yEAA8C;AAC9C,6EAAkD;AAClD,qEAA0C;AAC1C,4EAAiD;AACjD,gFAAqD;AACrD,2EAAgD;AAChD,oEAAyC;AACzC,yDAA8B;AAC9B,kFAAuD","file":"index.js","sourcesContent":["export * from \"./CannotReflectMethodParameterTypeError\"\nexport * from \"./AlreadyHasActiveConnectionError\"\nexport * from \"./SubjectWithoutIdentifierError\"\nexport * from \"./CannotConnectAlreadyConnectedError\"\nexport * from \"./LockNotSupportedOnGivenDriverError\"\nexport * from \"./ConnectionIsNotSetError\"\nexport * from \"./CannotCreateEntityIdMapError\"\nexport * from \"./MetadataAlreadyExistsError\"\nexport * from \"./CannotDetermineEntityError\"\nexport * from \"./UpdateValuesMissingError\"\nexport * from \"./TreeRepositoryNotSupportedError\"\nexport * from \"./CustomRepositoryNotFoundError\"\nexport * from \"./TransactionNotStartedError\"\nexport * from \"./TransactionAlreadyStartedError\"\nexport * from \"./EntityNotFoundError\"\nexport * from \"./EntityMetadataNotFoundError\"\nexport * from \"./MustBeEntityError\"\nexport * from \"./OptimisticLockVersionMismatchError\"\nexport * from \"./LimitOnUpdateNotSupportedError\"\nexport * from \"./PrimaryColumnCannotBeNullableError\"\nexport * from \"./CustomRepositoryCannotInheritRepositoryError\"\nexport * from \"./QueryRunnerProviderAlreadyReleasedError\"\nexport * from \"./CannotAttachTreeChildrenEntityError\"\nexport * from \"./CustomRepositoryDoesNotHaveEntityError\"\nexport * from \"./MissingDeleteDateColumnError\"\nexport * from \"./NoConnectionForRepositoryError\"\nexport * from \"./CircularRelationsError\"\nexport * from \"./ReturningStatementNotSupportedError\"\nexport * from \"./UsingJoinTableIsNotAllowedError\"\nexport * from \"./MissingJoinColumnError\"\nexport * from \"./MissingPrimaryColumnError\"\nexport * from \"./EntityPropertyNotFoundError\"\nexport * from \"./MissingDriverError\"\nexport * from \"./DriverPackageNotInstalledError\"\nexport * from \"./CannotGetEntityManagerNotConnectedError\"\nexport * from \"./ConnectionNotFoundError\"\nexport * from \"./NoVersionOrUpdateDateColumnError\"\nexport * from \"./InsertValuesMissingError\"\nexport * from \"./OptimisticLockCanNotBeUsedError\"\nexport * from \"./MetadataWithSuchNameAlreadyExistsError\"\nexport * from \"./DriverOptionNotSetError\"\nexport * from \"./FindRelationsNotFoundError\"\nexport * from \"./PessimisticLockTransactionRequiredError\"\nexport * from \"./RepositoryNotTreeError\"\nexport * from \"./DataTypeNotSupportedError\"\nexport * from \"./InitializedRelationError\"\nexport * from \"./MissingJoinTableError\"\nexport * from \"./QueryFailedError\"\nexport * from \"./NoNeedToReleaseEntityManagerError\"\nexport * from \"./UsingJoinColumnOnlyOnOneSideAllowedError\"\nexport * from \"./UsingJoinTableOnlyOnOneSideAllowedError\"\nexport * from \"./SubjectRemovedAndUpdatedError\"\nexport * from \"./PersistedEntityNotFoundError\"\nexport * from \"./UsingJoinColumnIsNotAllowedError\"\nexport * from \"./ColumnTypeUndefinedError\"\nexport * from \"./QueryRunnerAlreadyReleasedError\"\nexport * from \"./OffsetWithoutLimitNotSupportedError\"\nexport * from \"./CannotExecuteNotConnectedError\"\nexport * from \"./NoConnectionOptionError\"\nexport * from \"./TypeORMError\"\nexport * from \"./ForbiddenTransactionModeOverrideError\"\n"],"sourceRoot":".."}
|
package/index.mjs
CHANGED
|
@@ -84,7 +84,6 @@ const {
|
|
|
84
84
|
MetadataWithSuchNameAlreadyExistsError,
|
|
85
85
|
DriverOptionNotSetError,
|
|
86
86
|
FindRelationsNotFoundError,
|
|
87
|
-
NamingStrategyNotFoundError,
|
|
88
87
|
PessimisticLockTransactionRequiredError,
|
|
89
88
|
RepositoryNotTreeError,
|
|
90
89
|
DataTypeNotSupportedError,
|
|
@@ -295,7 +294,6 @@ export {
|
|
|
295
294
|
MetadataWithSuchNameAlreadyExistsError,
|
|
296
295
|
DriverOptionNotSetError,
|
|
297
296
|
FindRelationsNotFoundError,
|
|
298
|
-
NamingStrategyNotFoundError,
|
|
299
297
|
PessimisticLockTransactionRequiredError,
|
|
300
298
|
RepositoryNotTreeError,
|
|
301
299
|
DataTypeNotSupportedError,
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "name": "typeorm", "version": "0.3.24-dev.
|
|
1
|
+
{ "name": "typeorm", "version": "0.3.24-dev.39a6562", "description": "Data-Mapper ORM for TypeScript and ES2021+. Supports MySQL/MariaDB, PostgreSQL, MS SQL Server, Oracle, SAP HANA, SQLite, MongoDB databases.", "homepage": "https://typeorm.io", "bugs": { "url": "https://github.com/typeorm/typeorm/issues" }, "repository": { "type": "git", "url": "https://github.com/typeorm/typeorm.git" }, "funding": "https://opencollective.com/typeorm", "license": "MIT", "author": { "name": "Umed Khudoiberdiev", "email": "pleerock.me@gmail.com" }, "exports": { ".": { "types": "./index.d.ts", "node": { "import": "./index.mjs", "require": "./index.js", "types": "./index.d.ts" }, "browser": { "require": "./index.js", "import": "./browser/index.js", "default": "./index.js" } }, "./browser": { "types": "./index.d.ts", "default": "./browser/index.js" }, "./*.js": "./*.js", "./*": { "require": "./*.js", "import": "./*" } }, "main": "./index.js", "module": "./index.mjs", "browser": { "./browser/connection/ConnectionOptionsReader.js": "./browser/platform/BrowserConnectionOptionsReaderDummy.js", "./browser/connection/options-reader/ConnectionOptionsXmlReader.js": "./browser/platform/BrowserConnectionOptionsReaderDummy.js", "./browser/connection/options-reader/ConnectionOptionsYmlReader.js": "./browser/platform/BrowserConnectionOptionsReaderDummy.js", "./browser/driver/aurora-data-api/AuroraDataApiDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/better-sqlite3/BetterSqlite3Driver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/cockroachdb/CockroachDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/mongodb/MongoDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/mongodb/MongoQueryRunner.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/mongodb/bson.typings.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/mongodb/typings.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/mysql/MysqlDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/oracle/OracleDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/postgres/PostgresDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/sap/SapDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/sqlite/SqliteDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/sqlserver/SqlServerDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/entity-manager/MongoEntityManager.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/logger/FileLogger.js": "./browser/platform/BrowserFileLoggerDummy.js", "./browser/platform/PlatformTools.js": "./browser/platform/BrowserPlatformTools.js", "./browser/repository/MongoRepository.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/util/DirectoryExportedClassesLoader.js": "./browser/platform/BrowserDirectoryExportedClassesLoader.js", "./index.js": "./browser/index.js", "./index.mjs": "./browser/index.js" }, "types": "./index.d.ts", "bin": { "typeorm": "./cli.js", "typeorm-ts-node-commonjs": "./cli-ts-node-commonjs.js", "typeorm-ts-node-esm": "./cli-ts-node-esm.js" }, "scripts": { "changelog": "standard-changelog", "compile": "rimraf ./build && tsc", "format": "prettier --cache --write \"./**/*.ts\"", "format:ci": "prettier --check \"./**/*.ts\"", "lint": "eslint .", "pack": "gulp pack", "package": "gulp package", "pre-commit": "lint-staged", "prepare": "husky", "test": "npm run compile && npm run test:fast --", "test:ci": "mocha --bail", "test:fast": "mocha", "watch": "tsc --watch", "publish:preview": "pkg-pr-new publish './build/package' --pnpm --template='./sample/playground'" }, "dependencies": { "@sqltools/formatter": "^1.2.5", "ansis": "^3.17.0", "app-root-path": "^3.1.0", "buffer": "^6.0.3", "dayjs": "^1.11.13", "debug": "^4.4.0", "dedent": "^1.6.0", "dotenv": "^16.4.7", "glob": "^10.4.5", "sha.js": "^2.4.11", "sql-highlight": "^6.0.0", "tslib": "^2.8.1", "uuid": "^11.1.0", "yargs": "^17.7.2" }, "devDependencies": { "@eslint/js": "^9.22.0", "@sap/hana-client": "^2.24.21", "@tsconfig/node16": "^16.1.3", "@types/chai": "^4.3.20", "@types/chai-as-promised": "^7.1.8", "@types/debug": "^4.1.12", "@types/gulp-rename": "^2.0.6", "@types/gulp-sourcemaps": "^0.0.38", "@types/mocha": "^10.0.10", "@types/node": "^16.18.126", "@types/sha.js": "^2.4.4", "@types/sinon": "^10.0.20", "@types/sinon-chai": "^4.0.0", "@types/source-map-support": "^0.5.10", "@types/yargs": "^17.0.33", "better-sqlite3": "^8.7.0", "chai": "^4.5.0", "chai-as-promised": "^7.1.2", "class-transformer": "^0.5.1", "eslint": "^9.22.0", "globals": "^16.0.0", "gulp": "^4.0.2", "gulp-rename": "^2.0.0", "gulp-replace": "^1.1.4", "gulp-shell": "^0.8.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", "gulpclass": "^0.2.0", "hdb-pool": "^0.1.6", "husky": "^9.1.7", "lint-staged": "^15.5.2", "mocha": "^10.8.2", "mongodb": "^6.15.0", "mssql": "^11.0.1", "mysql": "^2.18.1", "mysql2": "^3.14.0", "nyc": "^17.1.0", "oracledb": "^6.8.0", "pg": "^8.14.1", "pg-query-stream": "^4.8.1", "pkg-pr-new": "^0.0.43", "prettier": "^2.8.8", "redis": "^4.7.0", "remap-istanbul": "^0.13.0", "rimraf": "^5.0.10", "sinon": "^15.2.0", "sinon-chai": "^3.7.0", "source-map-support": "^0.5.21", "sql.js": "^1.13.0", "sqlite3": "^5.1.7", "standard-changelog": "^6.0.0", "ts-node": "^10.9.2", "typescript": "^5.8.2", "typescript-eslint": "^8.27.0" }, "peerDependencies": { "@google-cloud/spanner": "^5.18.0 || ^6.0.0 || ^7.0.0", "@sap/hana-client": "^2.12.25", "better-sqlite3": "^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0", "hdb-pool": "^0.1.6", "ioredis": "^5.0.4", "mongodb": "^5.8.0 || ^6.0.0", "mssql": "^9.1.1 || ^10.0.1 || ^11.0.1", "mysql2": "^2.2.5 || ^3.0.1", "oracledb": "^6.3.0", "pg": "^8.5.1", "pg-native": "^3.0.0", "pg-query-stream": "^4.0.0", "redis": "^3.1.1 || ^4.0.0", "reflect-metadata": "^0.1.14 || ^0.2.0", "sql.js": "^1.4.0", "sqlite3": "^5.0.3", "ts-node": "^10.7.0", "typeorm-aurora-data-api-driver": "^2.0.0 || ^3.0.0" }, "peerDependenciesMeta": { "@google-cloud/spanner": { "optional": true }, "@sap/hana-client": { "optional": true }, "better-sqlite3": { "optional": true }, "hdb-pool": { "optional": true }, "ioredis": { "optional": true }, "mongodb": { "optional": true }, "mssql": { "optional": true }, "mysql2": { "optional": true }, "oracledb": { "optional": true }, "pg": { "optional": true }, "pg-native": { "optional": true }, "pg-query-stream": { "optional": true }, "redis": { "optional": true }, "sql.js": { "optional": true }, "sqlite3": { "optional": true }, "ts-node": { "optional": true }, "typeorm-aurora-data-api-driver": { "optional": true } }, "engines": { "node": ">=16.13.0" }, "collective": { "type": "opencollective", "url": "https://opencollective.com/typeorm", "logo": "https://opencollective.com/opencollective/logo.txt" }, "readmeFilename": "README.md", "tags": [ "orm", "typescript", "typescript-orm", "mariadb", "mariadb-orm", "mysql", "mysql-orm", "oracle", "oracle-orm", "postgresql", "postgresql-orm", "sap-hana", "sap-hana-orm", "spanner", "cloud-spanner", "cloud-spanner-orm", "sqlite", "sqlite-orm", "sql-server", "sql-server-orm" ] }
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Subject } from "./Subject";
|
|
2
|
-
import { ObjectLiteral } from "../common/ObjectLiteral";
|
|
3
2
|
import { QueryRunner } from "../query-runner/QueryRunner";
|
|
4
3
|
/**
|
|
5
4
|
* Loads database entities for all operate subjects which do not have database entity set.
|
|
@@ -18,13 +17,6 @@ export declare class SubjectDatabaseEntityLoader {
|
|
|
18
17
|
* This option is used for deletion.
|
|
19
18
|
*/
|
|
20
19
|
load(operationType: "save" | "remove" | "soft-remove" | "recover"): Promise<void>;
|
|
21
|
-
/**
|
|
22
|
-
* Finds subjects where entity like given subject's entity.
|
|
23
|
-
* Comparison made by entity id.
|
|
24
|
-
* Multiple subjects may be returned if duplicates are present in the subject array.
|
|
25
|
-
* This will likely result in the same row being updated multiple times during a transaction.
|
|
26
|
-
*/
|
|
27
|
-
protected findByPersistEntityLike(entityTarget: Function | string, entity: ObjectLiteral): Subject[];
|
|
28
20
|
/**
|
|
29
21
|
* Groups given Subject objects into groups separated by entity targets.
|
|
30
22
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SubjectDatabaseEntityLoader = void 0;
|
|
4
|
+
const OrmUtils_1 = require("../util/OrmUtils");
|
|
4
5
|
/**
|
|
5
6
|
* Loads database entities for all operate subjects which do not have database entity set.
|
|
6
7
|
* All entities that we load database entities for are marked as updated or inserted.
|
|
@@ -91,17 +92,17 @@ class SubjectDatabaseEntityLoader {
|
|
|
91
92
|
.whereInIds(allIds)
|
|
92
93
|
.getMany();
|
|
93
94
|
}
|
|
94
|
-
//
|
|
95
|
-
// and insert that entity into database entity of the found subjects
|
|
95
|
+
// Now when we have entities we need to find subject of each entity
|
|
96
|
+
// and insert that entity into database entity of the found subjects.
|
|
97
|
+
// A single entity can be applied to many subjects as there might be duplicates.
|
|
98
|
+
// This will likely result in the same row being updated multiple times during a transaction.
|
|
96
99
|
entities.forEach((entity) => {
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
subject.databaseEntity
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
? subject.metadata.getEntityIdMap(entity)
|
|
104
|
-
: undefined;
|
|
100
|
+
const entityId = allSubjects[0].metadata.getEntityIdMap(entity);
|
|
101
|
+
allSubjects.forEach((subject) => {
|
|
102
|
+
if (subject.databaseEntity)
|
|
103
|
+
return;
|
|
104
|
+
if (OrmUtils_1.OrmUtils.compareIds(subject.identifier, entityId))
|
|
105
|
+
subject.databaseEntity = entity;
|
|
105
106
|
});
|
|
106
107
|
});
|
|
107
108
|
// this way we tell what subjects we tried to load database entities of
|
|
@@ -114,22 +115,6 @@ class SubjectDatabaseEntityLoader {
|
|
|
114
115
|
// ---------------------------------------------------------------------
|
|
115
116
|
// Protected Methods
|
|
116
117
|
// ---------------------------------------------------------------------
|
|
117
|
-
/**
|
|
118
|
-
* Finds subjects where entity like given subject's entity.
|
|
119
|
-
* Comparison made by entity id.
|
|
120
|
-
* Multiple subjects may be returned if duplicates are present in the subject array.
|
|
121
|
-
* This will likely result in the same row being updated multiple times during a transaction.
|
|
122
|
-
*/
|
|
123
|
-
findByPersistEntityLike(entityTarget, entity) {
|
|
124
|
-
return this.subjects.filter((subject) => {
|
|
125
|
-
if (!subject.entity)
|
|
126
|
-
return false;
|
|
127
|
-
if (subject.entity === entity)
|
|
128
|
-
return true;
|
|
129
|
-
return (subject.metadata.target === entityTarget &&
|
|
130
|
-
subject.metadata.compareEntities(subject.entityWithFulfilledIds, entity));
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
118
|
/**
|
|
134
119
|
* Groups given Subject objects into groups separated by entity targets.
|
|
135
120
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/persistence/SubjectDatabaseEntityLoader.ts"],"names":[],"mappings":";;;AAMA;;;;;GAKG;AACH,MAAa,2BAA2B;IACpC,wEAAwE;IACxE,cAAc;IACd,wEAAwE;IAExE,YACc,WAAwB,EACxB,QAAmB;QADnB,gBAAW,GAAX,WAAW,CAAa;QACxB,aAAQ,GAAR,QAAQ,CAAW;IAC9B,CAAC;IAEJ,wEAAwE;IACxE,iBAAiB;IACjB,wEAAwE;IAExE;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CACN,aAA4D;QAE5D,+FAA+F;QAC/F,8FAA8F;QAC9F,MAAM,QAAQ,GAAG,IAAI,CAAC,oBAAoB,EAAE,CAAC,GAAG,CAC5C,KAAK,EAAE,YAAY,EAAE,EAAE;YACnB,qDAAqD;YACrD,MAAM,MAAM,GAAoB,EAAE,CAAA;YAClC,MAAM,WAAW,GAAc,EAAE,CAAA;YACjC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBACtC,gEAAgE;gBAChE,IAAI,OAAO,CAAC,cAAc,IAAI,CAAC,OAAO,CAAC,UAAU;oBAAE,OAAM;gBAEzD,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;gBAC/B,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YAC7B,CAAC,CAAC,CAAA;YAEF,yGAAyG;YACzG,IAAI,CAAC,MAAM,CAAC,MAAM;gBAAE,OAAM;YAE1B,MAAM,yBAAyB,GAAa,EAAE,CAAA;YAE9C,kDAAkD;YAClD,+EAA+E;YAC/E,sFAAsF;YACtF,sFAAs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AuB,CAC7B,YAA+B,EAC/B,MAAqB;QAErB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE;YACpC,IAAI,CAAC,OAAO,CAAC,MAAM;gBAAE,OAAO,KAAK,CAAA;YAEjC,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM;gBAAE,OAAO,IAAI,CAAA;YAE1C,OAAO,CACH,OAAO,CAAC,QAAQ,CAAC,MAAM,KAAK,YAAY;gBACxC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAC5B,OAAO,CAAC,sBAAuB,EAC/B,MAAM,CACT,CACJ,CAAA;QACL,CAAC,CAAC,CAAA;IACN,CAAC;IAED;;OAEG;IACO,oBAAoB;QAI1B,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,cAAc,EAAE,EAAE;YACnD,IAAI,KAAK,GAAG,MAAM,CAAC,IAAI,CACnB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,cAAc,CAAC,QAAQ,CAAC,MAAM,CAC7D,CAAA;YACD,IAAI,CAAC,KAAK,EAAE,CAAC;gBACT,KAAK,GAAG,EAAE,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAA;gBAChE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YACtB,CAAC;YACD,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;YACnC,OAAO,MAAM,CAAA;QACjB,CAAC,EAAE,EAA0D,CAAC,CAAA;IAClE,CAAC;CACJ;AA5LD,kEA4LC","file":"SubjectDatabaseEntityLoader.js","sourcesContent":["import { Subject } from \"./Subject\"\nimport { ObjectLiteral } from \"../common/ObjectLiteral\"\nimport { QueryRunner } from \"../query-runner/QueryRunner\"\nimport { FindManyOptions } from \"../find-options/FindManyOptions\"\nimport { MongoRepository } from \"../repository/MongoRepository\"\n\n/**\n * Loads database entities for all operate subjects which do not have database entity set.\n * All entities that we load database entities for are marked as updated or inserted.\n * To understand which of them really needs to be inserted or updated we need to load\n * their original representations from the database.\n */\nexport class SubjectDatabaseEntityLoader {\n // ---------------------------------------------------------------------\n // Constructor\n // ---------------------------------------------------------------------\n\n constructor(\n protected queryRunner: QueryRunner,\n protected subjects: Subject[],\n ) {}\n\n // ---------------------------------------------------------------------\n // Public Methods\n // ---------------------------------------------------------------------\n\n /**\n * Loads database entities for all subjects.\n *\n * loadAllRelations flag is used to load all relation ids of the object, no matter if they present in subject entity or not.\n * This option is used for deletion.\n */\n async load(\n operationType: \"save\" | \"remove\" | \"soft-remove\" | \"recover\",\n ): Promise<void> {\n // we are grouping subjects by target to perform more optimized queries using WHERE IN operator\n // go through the groups and perform loading of database entities of each subject in the group\n const promises = this.groupByEntityTargets().map(\n async (subjectGroup) => {\n // prepare entity ids of the subjects we need to load\n const allIds: ObjectLiteral[] = []\n const allSubjects: Subject[] = []\n subjectGroup.subjects.forEach((subject) => {\n // we don't load if subject already has a database entity loaded\n if (subject.databaseEntity || !subject.identifier) return\n\n allIds.push(subject.identifier)\n allSubjects.push(subject)\n })\n\n // if there no ids found (means all entities are new and have generated ids) - then nothing to load there\n if (!allIds.length) return\n\n const loadRelationPropertyPaths: string[] = []\n\n // for the save, soft-remove and recover operation\n // extract all property paths of the relations we need to load relation ids for\n // this is for optimization purpose - this way we don't load relation ids for entities\n // whose relations are undefined, and since they are undefined its really pointless to\n // load something for them, since undefined properties are skipped by the orm\n if (\n operationType === \"save\" ||\n operationType === \"soft-remove\" ||\n operationType === \"recover\"\n ) {\n subjectGroup.subjects.forEach((subject) => {\n // gets all relation property paths that exist in the persisted entity.\n subject.metadata.relations.forEach((relation) => {\n const value = relation.getEntityValue(\n subject.entityWithFulfilledIds!,\n )\n if (value === undefined) return\n\n if (\n loadRelationPropertyPaths.indexOf(\n relation.propertyPath,\n ) === -1\n )\n loadRelationPropertyPaths.push(\n relation.propertyPath,\n )\n })\n })\n } else {\n // remove\n\n // for remove operation\n // we only need to load junction relation ids since only they are removed by cascades\n loadRelationPropertyPaths.push(\n ...subjectGroup.subjects[0].metadata.manyToManyRelations.map(\n (relation) => relation.propertyPath,\n ),\n )\n }\n\n const findOptions: FindManyOptions<any> = {\n loadEagerRelations: false,\n loadRelationIds: {\n relations: loadRelationPropertyPaths,\n disableMixedMap: true,\n },\n // the soft-deleted entities should be included in the loaded entities for recover operation\n withDeleted: true,\n }\n\n // load database entities for all given ids\n let entities: any[] = []\n if (\n this.queryRunner.connection.driver.options.type ===\n \"mongodb\"\n ) {\n const mongoRepo =\n this.queryRunner.manager.getRepository<ObjectLiteral>(\n subjectGroup.target,\n ) as MongoRepository<ObjectLiteral>\n entities = await mongoRepo.findByIds(allIds, findOptions)\n } else {\n entities = await this.queryRunner.manager\n .getRepository<ObjectLiteral>(subjectGroup.target)\n .createQueryBuilder()\n .setFindOptions(findOptions)\n .whereInIds(allIds)\n .getMany()\n }\n\n // now when we have entities we need to find subject of each entity\n // and insert that entity into database entity of the found subjects\n entities.forEach((entity) => {\n const subjects = this.findByPersistEntityLike(\n subjectGroup.target,\n entity,\n )\n subjects.forEach((subject) => {\n subject.databaseEntity = entity\n if (!subject.identifier)\n subject.identifier =\n subject.metadata.hasAllPrimaryKeys(entity)\n ? subject.metadata.getEntityIdMap(entity)\n : undefined\n })\n })\n\n // this way we tell what subjects we tried to load database entities of\n for (const subject of allSubjects) {\n subject.databaseEntityLoaded = true\n }\n },\n )\n\n await Promise.all(promises)\n }\n\n // ---------------------------------------------------------------------\n // Protected Methods\n // ---------------------------------------------------------------------\n\n /**\n * Finds subjects where entity like given subject's entity.\n * Comparison made by entity id.\n * Multiple subjects may be returned if duplicates are present in the subject array.\n * This will likely result in the same row being updated multiple times during a transaction.\n */\n protected findByPersistEntityLike(\n entityTarget: Function | string,\n entity: ObjectLiteral,\n ): Subject[] {\n return this.subjects.filter((subject) => {\n if (!subject.entity) return false\n\n if (subject.entity === entity) return true\n\n return (\n subject.metadata.target === entityTarget &&\n subject.metadata.compareEntities(\n subject.entityWithFulfilledIds!,\n entity,\n )\n )\n })\n }\n\n /**\n * Groups given Subject objects into groups separated by entity targets.\n */\n protected groupByEntityTargets(): {\n target: Function | string\n subjects: Subject[]\n }[] {\n return this.subjects.reduce((groups, operatedEntity) => {\n let group = groups.find(\n (group) => group.target === operatedEntity.metadata.target,\n )\n if (!group) {\n group = { target: operatedEntity.metadata.target, subjects: [] }\n groups.push(group)\n }\n group.subjects.push(operatedEntity)\n return groups\n }, [] as { target: Function | string; subjects: Subject[] }[])\n }\n}\n"],"sourceRoot":".."}
|
|
1
|
+
{"version":3,"sources":["../../src/persistence/SubjectDatabaseEntityLoader.ts"],"names":[],"mappings":";;;AAKA,+CAA2C;AAE3C;;;;;GAKG;AACH,MAAa,2BAA2B;IACpC,wEAAwE;IACxE,cAAc;IACd,wEAAwE;IAExE,YACc,WAAwB,EACxB,QAAmB;QADnB,gBAAW,GAAX,WAAW,CAAa;QACxB,aAAQ,GAAR,QAAQ,CAAW;IAC9B,CAAC;IAEJ,wEAAwE;IACxE,iBAAiB;IACjB,wEAAwE;IAExE;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CACN,aAA4D;QAE5D,+FAA+F;QAC/F,8FAA8F;QAC9F,MAAM,QAAQ,GAAG,IAAI,CAAC,oBAAoB,EAAE,CAAC,GAAG,CAC5C,KAAK,EAAE,YAAY,EAAE,EAAE;YACnB,qDAAqD;YACrD,MAAM,MAAM,GAAoB,EAAE,CAAA;YAClC,MAAM,WAAW,GAAc,EAAE,CAAA;YACjC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBACtC,gEAAgE;gBAChE,IAAI,OAAO,CAAC,cAAc,IAAI,CAAC,OAAO,CAAC,UAAU;oBAAE,OAAM;gBAEzD,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;gBAC/B,WAAW,CA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L,CAAC,CACJ,CAAA;QAED,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IAC/B,CAAC;IAED,wEAAwE;IACxE,oBAAoB;IACpB,wEAAwE;IAExE;;OAEG;IACO,oBAAoB;QAI1B,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,cAAc,EAAE,EAAE;YACnD,IAAI,KAAK,GAAG,MAAM,CAAC,IAAI,CACnB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,cAAc,CAAC,QAAQ,CAAC,MAAM,CAC7D,CAAA;YACD,IAAI,CAAC,KAAK,EAAE,CAAC;gBACT,KAAK,GAAG,EAAE,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAA;gBAChE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YACtB,CAAC;YACD,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;YACnC,OAAO,MAAM,CAAA;QACjB,CAAC,EAAE,EAA0D,CAAC,CAAA;IAClE,CAAC;CACJ;AAhKD,kEAgKC","file":"SubjectDatabaseEntityLoader.js","sourcesContent":["import { Subject } from \"./Subject\"\nimport { ObjectLiteral } from \"../common/ObjectLiteral\"\nimport { QueryRunner } from \"../query-runner/QueryRunner\"\nimport { FindManyOptions } from \"../find-options/FindManyOptions\"\nimport { MongoRepository } from \"../repository/MongoRepository\"\nimport { OrmUtils } from \"../util/OrmUtils\"\n\n/**\n * Loads database entities for all operate subjects which do not have database entity set.\n * All entities that we load database entities for are marked as updated or inserted.\n * To understand which of them really needs to be inserted or updated we need to load\n * their original representations from the database.\n */\nexport class SubjectDatabaseEntityLoader {\n // ---------------------------------------------------------------------\n // Constructor\n // ---------------------------------------------------------------------\n\n constructor(\n protected queryRunner: QueryRunner,\n protected subjects: Subject[],\n ) {}\n\n // ---------------------------------------------------------------------\n // Public Methods\n // ---------------------------------------------------------------------\n\n /**\n * Loads database entities for all subjects.\n *\n * loadAllRelations flag is used to load all relation ids of the object, no matter if they present in subject entity or not.\n * This option is used for deletion.\n */\n async load(\n operationType: \"save\" | \"remove\" | \"soft-remove\" | \"recover\",\n ): Promise<void> {\n // we are grouping subjects by target to perform more optimized queries using WHERE IN operator\n // go through the groups and perform loading of database entities of each subject in the group\n const promises = this.groupByEntityTargets().map(\n async (subjectGroup) => {\n // prepare entity ids of the subjects we need to load\n const allIds: ObjectLiteral[] = []\n const allSubjects: Subject[] = []\n subjectGroup.subjects.forEach((subject) => {\n // we don't load if subject already has a database entity loaded\n if (subject.databaseEntity || !subject.identifier) return\n\n allIds.push(subject.identifier)\n allSubjects.push(subject)\n })\n\n // if there no ids found (means all entities are new and have generated ids) - then nothing to load there\n if (!allIds.length) return\n\n const loadRelationPropertyPaths: string[] = []\n\n // for the save, soft-remove and recover operation\n // extract all property paths of the relations we need to load relation ids for\n // this is for optimization purpose - this way we don't load relation ids for entities\n // whose relations are undefined, and since they are undefined its really pointless to\n // load something for them, since undefined properties are skipped by the orm\n if (\n operationType === \"save\" ||\n operationType === \"soft-remove\" ||\n operationType === \"recover\"\n ) {\n subjectGroup.subjects.forEach((subject) => {\n // gets all relation property paths that exist in the persisted entity.\n subject.metadata.relations.forEach((relation) => {\n const value = relation.getEntityValue(\n subject.entityWithFulfilledIds!,\n )\n if (value === undefined) return\n\n if (\n loadRelationPropertyPaths.indexOf(\n relation.propertyPath,\n ) === -1\n )\n loadRelationPropertyPaths.push(\n relation.propertyPath,\n )\n })\n })\n } else {\n // remove\n\n // for remove operation\n // we only need to load junction relation ids since only they are removed by cascades\n loadRelationPropertyPaths.push(\n ...subjectGroup.subjects[0].metadata.manyToManyRelations.map(\n (relation) => relation.propertyPath,\n ),\n )\n }\n\n const findOptions: FindManyOptions<any> = {\n loadEagerRelations: false,\n loadRelationIds: {\n relations: loadRelationPropertyPaths,\n disableMixedMap: true,\n },\n // the soft-deleted entities should be included in the loaded entities for recover operation\n withDeleted: true,\n }\n\n // load database entities for all given ids\n let entities: any[] = []\n if (\n this.queryRunner.connection.driver.options.type ===\n \"mongodb\"\n ) {\n const mongoRepo =\n this.queryRunner.manager.getRepository<ObjectLiteral>(\n subjectGroup.target,\n ) as MongoRepository<ObjectLiteral>\n entities = await mongoRepo.findByIds(allIds, findOptions)\n } else {\n entities = await this.queryRunner.manager\n .getRepository<ObjectLiteral>(subjectGroup.target)\n .createQueryBuilder()\n .setFindOptions(findOptions)\n .whereInIds(allIds)\n .getMany()\n }\n\n // Now when we have entities we need to find subject of each entity\n // and insert that entity into database entity of the found subjects.\n // A single entity can be applied to many subjects as there might be duplicates.\n // This will likely result in the same row being updated multiple times during a transaction.\n entities.forEach((entity) => {\n const entityId =\n allSubjects[0].metadata.getEntityIdMap(entity)\n allSubjects.forEach((subject) => {\n if (subject.databaseEntity) return\n if (OrmUtils.compareIds(subject.identifier, entityId))\n subject.databaseEntity = entity\n })\n })\n\n // this way we tell what subjects we tried to load database entities of\n for (const subject of allSubjects) {\n subject.databaseEntityLoaded = true\n }\n },\n )\n\n await Promise.all(promises)\n }\n\n // ---------------------------------------------------------------------\n // Protected Methods\n // ---------------------------------------------------------------------\n\n /**\n * Groups given Subject objects into groups separated by entity targets.\n */\n protected groupByEntityTargets(): {\n target: Function | string\n subjects: Subject[]\n }[] {\n return this.subjects.reduce((groups, operatedEntity) => {\n let group = groups.find(\n (group) => group.target === operatedEntity.metadata.target,\n )\n if (!group) {\n group = { target: operatedEntity.metadata.target, subjects: [] }\n groups.push(group)\n }\n group.subjects.push(operatedEntity)\n return groups\n }, [] as { target: Function | string; subjects: Subject[] }[])\n }\n}\n"],"sourceRoot":".."}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { TypeORMError } from "./TypeORMError";
|
|
2
|
-
/**
|
|
3
|
-
* Thrown when consumer tries to use naming strategy that does not exist.
|
|
4
|
-
*/
|
|
5
|
-
export declare class NamingStrategyNotFoundError extends TypeORMError {
|
|
6
|
-
constructor(strategyName: string | Function, connectionName: string);
|
|
7
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { TypeORMError } from "./TypeORMError";
|
|
2
|
-
/**
|
|
3
|
-
* Thrown when consumer tries to use naming strategy that does not exist.
|
|
4
|
-
*/
|
|
5
|
-
export class NamingStrategyNotFoundError extends TypeORMError {
|
|
6
|
-
constructor(strategyName, connectionName) {
|
|
7
|
-
super();
|
|
8
|
-
const name = typeof strategyName === "function"
|
|
9
|
-
? strategyName.name
|
|
10
|
-
: strategyName;
|
|
11
|
-
this.message =
|
|
12
|
-
`Naming strategy "${name}" was not found. Looks like this naming strategy does not ` +
|
|
13
|
-
`exist or it was not registered in current "${connectionName}" connection?`;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
//# sourceMappingURL=NamingStrategyNotFoundError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../browser/src/error/NamingStrategyNotFoundError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,YAAY;IACzD,YAAY,YAA+B,EAAE,cAAsB;QAC/D,KAAK,EAAE,CAAA;QAEP,MAAM,IAAI,GACN,OAAO,YAAY,KAAK,UAAU;YAC9B,CAAC,CAAE,YAAoB,CAAC,IAAI;YAC5B,CAAC,CAAC,YAAY,CAAA;QACtB,IAAI,CAAC,OAAO;YACR,oBAAoB,IAAI,4DAA4D;gBACpF,8CAA8C,cAAc,eAAe,CAAA;IACnF,CAAC;CACJ","file":"NamingStrategyNotFoundError.js","sourcesContent":["import { TypeORMError } from \"./TypeORMError\"\n\n/**\n * Thrown when consumer tries to use naming strategy that does not exist.\n */\nexport class NamingStrategyNotFoundError extends TypeORMError {\n constructor(strategyName: string | Function, connectionName: string) {\n super()\n\n const name =\n typeof strategyName === \"function\"\n ? (strategyName as any).name\n : strategyName\n this.message =\n `Naming strategy \"${name}\" was not found. Looks like this naming strategy does not ` +\n `exist or it was not registered in current \"${connectionName}\" connection?`\n }\n}\n"],"sourceRoot":".."}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { TypeORMError } from "./TypeORMError";
|
|
2
|
-
/**
|
|
3
|
-
* Thrown when consumer tries to use naming strategy that does not exist.
|
|
4
|
-
*/
|
|
5
|
-
export declare class NamingStrategyNotFoundError extends TypeORMError {
|
|
6
|
-
constructor(strategyName: string | Function, connectionName: string);
|
|
7
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NamingStrategyNotFoundError = void 0;
|
|
4
|
-
const TypeORMError_1 = require("./TypeORMError");
|
|
5
|
-
/**
|
|
6
|
-
* Thrown when consumer tries to use naming strategy that does not exist.
|
|
7
|
-
*/
|
|
8
|
-
class NamingStrategyNotFoundError extends TypeORMError_1.TypeORMError {
|
|
9
|
-
constructor(strategyName, connectionName) {
|
|
10
|
-
super();
|
|
11
|
-
const name = typeof strategyName === "function"
|
|
12
|
-
? strategyName.name
|
|
13
|
-
: strategyName;
|
|
14
|
-
this.message =
|
|
15
|
-
`Naming strategy "${name}" was not found. Looks like this naming strategy does not ` +
|
|
16
|
-
`exist or it was not registered in current "${connectionName}" connection?`;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.NamingStrategyNotFoundError = NamingStrategyNotFoundError;
|
|
20
|
-
|
|
21
|
-
//# sourceMappingURL=NamingStrategyNotFoundError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/error/NamingStrategyNotFoundError.ts"],"names":[],"mappings":";;;AAAA,iDAA6C;AAE7C;;GAEG;AACH,MAAa,2BAA4B,SAAQ,2BAAY;IACzD,YAAY,YAA+B,EAAE,cAAsB;QAC/D,KAAK,EAAE,CAAA;QAEP,MAAM,IAAI,GACN,OAAO,YAAY,KAAK,UAAU;YAC9B,CAAC,CAAE,YAAoB,CAAC,IAAI;YAC5B,CAAC,CAAC,YAAY,CAAA;QACtB,IAAI,CAAC,OAAO;YACR,oBAAoB,IAAI,4DAA4D;gBACpF,8CAA8C,cAAc,eAAe,CAAA;IACnF,CAAC;CACJ;AAZD,kEAYC","file":"NamingStrategyNotFoundError.js","sourcesContent":["import { TypeORMError } from \"./TypeORMError\"\n\n/**\n * Thrown when consumer tries to use naming strategy that does not exist.\n */\nexport class NamingStrategyNotFoundError extends TypeORMError {\n constructor(strategyName: string | Function, connectionName: string) {\n super()\n\n const name =\n typeof strategyName === \"function\"\n ? (strategyName as any).name\n : strategyName\n this.message =\n `Naming strategy \"${name}\" was not found. Looks like this naming strategy does not ` +\n `exist or it was not registered in current \"${connectionName}\" connection?`\n }\n}\n"],"sourceRoot":".."}
|