typeorm 0.3.18-dev.dff2d53 → 0.3.18-dev.fbd45db

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +23 -23
  2. package/browser/driver/sqlserver/SqlServerConnectionCredentialsOptions.d.ts +2 -1
  3. package/browser/driver/sqlserver/SqlServerConnectionCredentialsOptions.js.map +1 -1
  4. package/browser/driver/sqlserver/SqlServerConnectionOptions.d.ts +5 -0
  5. package/browser/driver/sqlserver/SqlServerConnectionOptions.js.map +1 -1
  6. package/browser/driver/sqlserver/SqlServerQueryRunner.js +13 -0
  7. package/browser/driver/sqlserver/SqlServerQueryRunner.js.map +1 -1
  8. package/browser/driver/sqlserver/authentication/AzureActiveDirectoryDefaultAuthentication.d.ts +12 -0
  9. package/browser/driver/sqlserver/authentication/AzureActiveDirectoryDefaultAuthentication.js +3 -0
  10. package/browser/driver/sqlserver/authentication/AzureActiveDirectoryDefaultAuthentication.js.map +1 -0
  11. package/browser/index.d.ts +1 -0
  12. package/browser/index.js +1 -0
  13. package/browser/index.js.map +1 -1
  14. package/browser/persistence/Subject.js +2 -1
  15. package/browser/persistence/Subject.js.map +1 -1
  16. package/commands/CommandUtils.js +3 -1
  17. package/commands/CommandUtils.js.map +1 -1
  18. package/commands/InitCommand.js +1 -1
  19. package/commands/InitCommand.js.map +1 -1
  20. package/driver/sqlserver/SqlServerConnectionCredentialsOptions.d.ts +2 -1
  21. package/driver/sqlserver/SqlServerConnectionCredentialsOptions.js.map +1 -1
  22. package/driver/sqlserver/SqlServerConnectionOptions.d.ts +5 -0
  23. package/driver/sqlserver/SqlServerConnectionOptions.js.map +1 -1
  24. package/driver/sqlserver/SqlServerQueryRunner.js +13 -0
  25. package/driver/sqlserver/SqlServerQueryRunner.js.map +1 -1
  26. package/driver/sqlserver/authentication/AzureActiveDirectoryDefaultAuthentication.d.ts +12 -0
  27. package/driver/sqlserver/authentication/AzureActiveDirectoryDefaultAuthentication.js +4 -0
  28. package/driver/sqlserver/authentication/AzureActiveDirectoryDefaultAuthentication.js.map +1 -0
  29. package/index.d.ts +1 -0
  30. package/index.js +1 -0
  31. package/index.js.map +1 -1
  32. package/index.mjs +2 -0
  33. package/package.json +1 -1
  34. package/persistence/Subject.js +2 -1
  35. package/persistence/Subject.js.map +1 -1
@@ -0,0 +1,12 @@
1
+ export interface AzureActiveDirectoryDefaultAuthentication {
2
+ /**
3
+ * This uses DefaultAzureCredential from @azure/identity to try multiple methods of authentication
4
+ */
5
+ type: "azure-active-directory-default";
6
+ options: {
7
+ /**
8
+ * The clientId of the user you want to log in with, mapped to the managedIdentityClientId in tedious
9
+ */
10
+ clientId?: string;
11
+ };
12
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+
4
+ //# sourceMappingURL=AzureActiveDirectoryDefaultAuthentication.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/driver/sqlserver/authentication/AzureActiveDirectoryDefaultAuthentication.ts"],"names":[],"mappings":"","file":"AzureActiveDirectoryDefaultAuthentication.js","sourcesContent":["export interface AzureActiveDirectoryDefaultAuthentication {\n /**\n * This uses DefaultAzureCredential from @azure/identity to try multiple methods of authentication\n */\n type: \"azure-active-directory-default\"\n options: {\n /**\n * The clientId of the user you want to log in with, mapped to the managedIdentityClientId in tedious\n */\n clientId?: string\n }\n}\n"],"sourceRoot":"../../.."}
package/index.d.ts CHANGED
@@ -114,6 +114,7 @@ export * from "./schema-builder/table/TableForeignKey";
114
114
  export * from "./schema-builder/table/TableIndex";
115
115
  export * from "./schema-builder/table/TableUnique";
116
116
  export * from "./schema-builder/table/Table";
117
+ export * from "./schema-builder/view/View";
117
118
  export * from "./schema-builder/options/TableCheckOptions";
118
119
  export * from "./schema-builder/options/TableColumnOptions";
119
120
  export * from "./schema-builder/options/TableExclusionOptions";
package/index.js CHANGED
@@ -121,6 +121,7 @@ tslib_1.__exportStar(require("./schema-builder/table/TableForeignKey"), exports)
121
121
  tslib_1.__exportStar(require("./schema-builder/table/TableIndex"), exports);
122
122
  tslib_1.__exportStar(require("./schema-builder/table/TableUnique"), exports);
123
123
  tslib_1.__exportStar(require("./schema-builder/table/Table"), exports);
124
+ tslib_1.__exportStar(require("./schema-builder/view/View"), exports);
124
125
  tslib_1.__exportStar(require("./schema-builder/options/TableCheckOptions"), exports);
125
126
  tslib_1.__exportStar(require("./schema-builder/options/TableColumnOptions"), exports);
126
127
  tslib_1.__exportStar(require("./schema-builder/options/TableExclusionOptions"), exports);
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA;GACG;AACH,4BAAyB;AAEzB,4EAA4E;AAC5E,wBAAwB;AACxB,4EAA4E;AAE5E,oDAAyB;AACzB,sDAA2B;AAC3B,gEAAqC;AACrC,8DAAmC;AACnC,iEAAsC;AACtC,6DAAkC;AAClC,+DAAoC;AACpC,gEAAqC;AACrC,kDAAuB;AACvB,qEAA0C;AAC1C,+EAAoD;AACpD,+EAAoD;AACpD,qFAA0D;AAC1D,4EAAiD;AACjD,+EAAoD;AACpD,4EAAiD;AACjD,4EAAiD;AACjD,yEAA8C;AAC9C,6EAAkD;AAClD,4EAAiD;AACjD,0EAA+C;AAC/C,4EAAiD;AACjD,gFAAqD;AACrD,6EAAkD;AAClD,4EAAiD;AACjD,6EAAkD;AAClD,6EAAkD;AAClD,iFAAsD;AACtD,8EAAmD;AACnD,6EAAkD;AAClD,gFAAqD;AACrD,4EAAiD;AACjD,2EAAgD;AAChD,gFAAqD;AACrD,+EAAoD;AACpD,8EAAmD;AACnD,4EAAiD;AACjD,+EAAoD;AACpD,2EAAgD;AAChD,0EAA+C;AAC/C,2EAAgD;AAChD,0EAA+C;AAC/C,0EAA+C;AAC/C,yEAA8C;AAC9C,8EAAmD;AACnD,2EAAgD;AAChD,oEAAyC;AACzC,yEAA8C;AAC9C,8EAAmD;AACnD,6E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5C,wGAAA,UAAU,OAAA;AACnB,sDAAoD;AAA3C,wGAAA,UAAU,OAAA;AACnB,oEAAkE;AAAzD,sHAAA,iBAAiB,OAAA;AAG1B,6DAA2D;AAAlD,4GAAA,YAAY,OAAA;AACrB,yEAAuE;AAA9D,wHAAA,kBAAkB,OAAA;AAC3B,yEAAuE;AAA9D,wHAAA,kBAAkB,OAAA;AAC3B,yEAAuE;AAA9D,wHAAA,kBAAkB,OAAA;AAC3B,yEAAuE;AAA9D,wHAAA,kBAAkB,OAAA;AAC3B,6EAA2E;AAAlE,4HAAA,oBAAoB,OAAA;AAC7B,qDAAmD;AAA1C,oGAAA,QAAQ,OAAA;AACjB,2DAAyD;AAAhD,0GAAA,WAAW,OAAA;AAGpB,oEAAkE;AAAzD,4GAAA,YAAY,OAAA;AACrB,oEAAkE;AAAzD,4GAAA,YAAY,OAAA;AACrB,oEAAkE;AAAzD,4GAAA,YAAY,OAAA;AACrB,0DAAwD;AAA/C,0GAAA,WAAW,OAAA;AAEpB,0EAAwE;AAA/D,wHAAA,kBAAkB,OAAA;AAC3B,mDAAiD;AAAxC,sGAAA,SAAS,OAAA;AAClB,mEAAiE;AAAxD,sHAAA,iBAAiB,OAAA;AAE1B,iFAA+E;AAAtE,8HAAA,qBAAqB,OAAA;AAE9B,2FAAyF;AAAhF,wIAAA,0BAA0B,OAAA;AAWnC,6DAA2D;AAAlD,4GAAA,YAAY,OAAA;AAIrB,uGAAqG;AAA5F,sJAAA,iCAAiC,OAAA;AAE1C,2EAAyE;AAAhE,0HAAA,mBAAmB,OAAA;AAC5B,0DAAwD;AAA/C,kHAAA,eAAe,OAAA;AACxB,kEAAgE;AAAvD,0HAAA,mBAAmB,OAAA","file":"index.js","sourcesContent":["/*!\n */\nimport \"reflect-metadata\"\n\n// -------------------------------------------------------------------------\n// Commonly Used exports\n// -------------------------------------------------------------------------\n\nexport * from \"./globals\"\nexport * from \"./container\"\nexport * from \"./common/EntityTarget\"\nexport * from \"./common/ObjectType\"\nexport * from \"./common/ObjectLiteral\"\nexport * from \"./common/MixedList\"\nexport * from \"./common/DeepPartial\"\nexport * from \"./common/RelationType\"\nexport * from \"./error\"\nexport * from \"./decorator/columns/Column\"\nexport * from \"./decorator/columns/CreateDateColumn\"\nexport * from \"./decorator/columns/DeleteDateColumn\"\nexport * from \"./decorator/columns/PrimaryGeneratedColumn\"\nexport * from \"./decorator/columns/PrimaryColumn\"\nexport * from \"./decorator/columns/UpdateDateColumn\"\nexport * from \"./decorator/columns/VersionColumn\"\nexport * from \"./decorator/columns/VirtualColumn\"\nexport * from \"./decorator/columns/ViewColumn\"\nexport * from \"./decorator/columns/ObjectIdColumn\"\nexport * from \"./decorator/listeners/AfterInsert\"\nexport * from \"./decorator/listeners/AfterLoad\"\nexport * from \"./decorator/listeners/AfterRemove\"\nexport * from \"./decorator/listeners/AfterSoftRemove\"\nexport * from \"./decorator/listeners/AfterRecover\"\nexport * from \"./decorator/listeners/AfterUpdate\"\nexport * from \"./decorator/listeners/BeforeInsert\"\nexport * from \"./decorator/listeners/BeforeRemove\"\nexport * from \"./decorator/listeners/BeforeSoftRemove\"\nexport * from \"./decorator/listeners/BeforeRecover\"\nexport * from \"./decorator/listeners/BeforeUpdate\"\nexport * from \"./decorator/listeners/EventSubscriber\"\nexport * from \"./decorator/options/ColumnOptions\"\nexport * from \"./decorator/options/IndexOptions\"\nexport * from \"./decorator/options/JoinColumnOptions\"\nexport * from \"./decorator/options/JoinTableOptions\"\nexport * from \"./decorator/options/RelationOptions\"\nexport * from \"./decorator/options/EntityOptions\"\nexport * from \"./decorator/options/ValueTransformer\"\nexport * from \"./decorator/relations/JoinColumn\"\nexport * from \"./decorator/relations/JoinTable\"\nexport * from \"./decorator/relations/ManyToMany\"\nexport * from \"./decorator/relations/ManyToOne\"\nexport * from \"./decorator/relations/OneToMany\"\nexport * from \"./decorator/relations/OneToOne\"\nexport * from \"./decorator/relations/RelationCount\"\nexport * from \"./decorator/relations/RelationId\"\nexport * from \"./decorator/entity/Entity\"\nexport * from \"./decorator/entity/ChildEntity\"\nexport * from \"./decorator/entity/TableInheritance\"\nexport * from \"./decorator/entity-view/ViewEntity\"\nexport * from \"./decorator/tree/TreeLevelColumn\"\nexport * from \"./decorator/tree/TreeParent\"\nexport * from \"./decorator/tree/TreeChildren\"\nexport * from \"./decorator/tree/Tree\"\nexport * from \"./decorator/Index\"\nexport * from \"./decorator/Unique\"\nexport * from \"./decorator/Check\"\nexport * from \"./decorator/Exclusion\"\nexport * from \"./decorator/Generated\"\nexport * from \"./decorator/EntityRepository\"\nexport * from \"./find-options/operator/And\"\nexport * from \"./find-options/operator/Any\"\nexport * from \"./find-options/operator/ArrayContainedBy\"\nexport * from \"./find-options/operator/ArrayContains\"\nexport * from \"./find-options/operator/ArrayOverlap\"\nexport * from \"./find-options/operator/Between\"\nexport * from \"./find-options/operator/Equal\"\nexport * from \"./find-options/operator/In\"\nexport * from \"./find-options/operator/IsNull\"\nexport * from \"./find-options/operator/LessThan\"\nexport * from \"./find-options/operator/LessThanOrEqual\"\nexport * from \"./find-options/operator/ILike\"\nexport * from \"./find-options/operator/Like\"\nexport * from \"./find-options/operator/MoreThan\"\nexport * from \"./find-options/operator/MoreThanOrEqual\"\nexport * from \"./find-options/operator/Not\"\nexport * from \"./find-options/operator/Raw\"\nexport * from \"./find-options/operator/JsonContains\"\nexport * from \"./find-options/EqualOperator\"\nexport * from \"./find-options/FindManyOptions\"\nexport * from \"./find-options/FindOneOptions\"\nexport * from \"./find-options/FindOperator\"\nexport * from \"./find-options/FindOperatorType\"\nexport * from \"./find-options/FindOptionsOrder\"\nexport * from \"./find-options/FindOptionsRelations\"\nexport * from \"./find-options/FindOptionsSelect\"\nexport * from \"./find-options/FindOptionsUtils\"\nexport * from \"./find-options/FindOptionsWhere\"\nexport * from \"./find-options/FindTreeOptions\"\nexport * from \"./find-options/JoinOptions\"\nexport * from \"./find-options/OrderByCondition\"\nexport * from \"./logger/AbstractLogger\"\nexport * from \"./logger/Logger\"\nexport * from \"./logger/LoggerOptions\"\nexport * from \"./logger/AdvancedConsoleLogger\"\nexport * from \"./logger/SimpleConsoleLogger\"\nexport * from \"./logger/FileLogger\"\nexport * from \"./metadata/EntityMetadata\"\nexport * from \"./entity-manager/EntityManager\"\nexport * from \"./repository/AbstractRepository\"\nexport * from \"./repository/Repository\"\nexport * from \"./repository/BaseEntity\"\nexport * from \"./repository/TreeRepository\"\nexport * from \"./repository/MongoRepository\"\nexport * from \"./repository/RemoveOptions\"\nexport * from \"./repository/SaveOptions\"\nexport * from \"./schema-builder/table/TableCheck\"\nexport * from \"./schema-builder/table/TableColumn\"\nexport * from \"./schema-builder/table/TableExclusion\"\nexport * from \"./schema-builder/table/TableForeignKey\"\nexport * from \"./schema-builder/table/TableIndex\"\nexport * from \"./schema-builder/table/TableUnique\"\nexport * from \"./schema-builder/table/Table\"\nexport * from \"./schema-builder/options/TableCheckOptions\"\nexport * from \"./schema-builder/options/TableColumnOptions\"\nexport * from \"./schema-builder/options/TableExclusionOptions\"\nexport * from \"./schema-builder/options/TableForeignKeyOptions\"\nexport * from \"./schema-builder/options/TableIndexOptions\"\nexport * from \"./schema-builder/options/TableOptions\"\nexport * from \"./schema-builder/options/TableUniqueOptions\"\nexport * from \"./schema-builder/options/ViewOptions\"\nexport * from \"./driver/mongodb/typings\"\nexport * from \"./driver/types/DatabaseType\"\nexport * from \"./driver/types/GeoJsonTypes\"\nexport * from \"./driver/types/ReplicationMode\"\nexport * from \"./driver/sqlserver/MssqlParameter\"\n\n// export * from \"./data-source\";\n\nexport { ConnectionOptionsReader } from \"./connection/ConnectionOptionsReader\"\nexport { ConnectionOptions } from \"./connection/ConnectionOptions\"\nexport { DataSource } from \"./data-source/DataSource\"\nexport { Connection } from \"./connection/Connection\"\nexport { ConnectionManager } from \"./connection/ConnectionManager\"\nexport { DataSourceOptions } from \"./data-source/DataSourceOptions\"\nexport { Driver } from \"./driver/Driver\"\nexport { QueryBuilder } from \"./query-builder/QueryBuilder\"\nexport { SelectQueryBuilder } from \"./query-builder/SelectQueryBuilder\"\nexport { DeleteQueryBuilder } from \"./query-builder/DeleteQueryBuilder\"\nexport { InsertQueryBuilder } from \"./query-builder/InsertQueryBuilder\"\nexport { UpdateQueryBuilder } from \"./query-builder/UpdateQueryBuilder\"\nexport { RelationQueryBuilder } from \"./query-builder/RelationQueryBuilder\"\nexport { Brackets } from \"./query-builder/Brackets\"\nexport { NotBrackets } from \"./query-builder/NotBrackets\"\nexport { WhereExpressionBuilder } from \"./query-builder/WhereExpressionBuilder\"\nexport { WhereExpression } from \"./query-builder/WhereExpressionBuilder\"\nexport { InsertResult } from \"./query-builder/result/InsertResult\"\nexport { UpdateResult } from \"./query-builder/result/UpdateResult\"\nexport { DeleteResult } from \"./query-builder/result/DeleteResult\"\nexport { QueryResult } from \"./query-runner/QueryResult\"\nexport { QueryRunner } from \"./query-runner/QueryRunner\"\nexport { MongoEntityManager } from \"./entity-manager/MongoEntityManager\"\nexport { Migration } from \"./migration/Migration\"\nexport { MigrationExecutor } from \"./migration/MigrationExecutor\"\nexport { MigrationInterface } from \"./migration/MigrationInterface\"\nexport { DefaultNamingStrategy } from \"./naming-strategy/DefaultNamingStrategy\"\nexport { NamingStrategyInterface } from \"./naming-strategy/NamingStrategyInterface\"\nexport { LegacyOracleNamingStrategy } from \"./naming-strategy/LegacyOracleNamingStrategy\"\nexport { InsertEvent } from \"./subscriber/event/InsertEvent\"\nexport { LoadEvent } from \"./subscriber/event/LoadEvent\"\nexport { UpdateEvent } from \"./subscriber/event/UpdateEvent\"\nexport { RemoveEvent } from \"./subscriber/event/RemoveEvent\"\nexport { SoftRemoveEvent } from \"./subscriber/event/SoftRemoveEvent\"\nexport { RecoverEvent } from \"./subscriber/event/RecoverEvent\"\nexport { TransactionCommitEvent } from \"./subscriber/event/TransactionCommitEvent\"\nexport { TransactionRollbackEvent } from \"./subscriber/event/TransactionRollbackEvent\"\nexport { TransactionStartEvent } from \"./subscriber/event/TransactionStartEvent\"\nexport { EntitySubscriberInterface } from \"./subscriber/EntitySubscriberInterface\"\nexport { EntitySchema } from \"./entity-schema/EntitySchema\"\nexport { EntitySchemaColumnOptions } from \"./entity-schema/EntitySchemaColumnOptions\"\nexport { EntitySchemaIndexOptions } from \"./entity-schema/EntitySchemaIndexOptions\"\nexport { EntitySchemaRelationOptions } from \"./entity-schema/EntitySchemaRelationOptions\"\nexport { EntitySchemaEmbeddedColumnOptions } from \"./entity-schema/EntitySchemaEmbeddedColumnOptions\"\nexport { ColumnType } from \"./driver/types/ColumnTypes\"\nexport { EntitySchemaOptions } from \"./entity-schema/EntitySchemaOptions\"\nexport { InstanceChecker } from \"./util/InstanceChecker\"\nexport { TreeRepositoryUtils } from \"./util/TreeRepositoryUtils\"\n"],"sourceRoot":"."}
1
+ {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA;GACG;AACH,4BAAyB;AAEzB,4EAA4E;AAC5E,wBAAwB;AACxB,4EAA4E;AAE5E,oDAAyB;AACzB,sDAA2B;AAC3B,gEAAqC;AACrC,8DAAmC;AACnC,iEAAsC;AACtC,6DAAkC;AAClC,+DAAoC;AACpC,gEAAqC;AACrC,kDAAuB;AACvB,qEAA0C;AAC1C,+EAAoD;AACpD,+EAAoD;AACpD,qFAA0D;AAC1D,4EAAiD;AACjD,+EAAoD;AACpD,4EAAiD;AACjD,4EAAiD;AACjD,yEAA8C;AAC9C,6EAAkD;AAClD,4EAAiD;AACjD,0EAA+C;AAC/C,4EAAiD;AACjD,gFAAqD;AACrD,6EAAkD;AAClD,4EAAiD;AACjD,6EAAkD;AAClD,6EAAkD;AAClD,iFAAsD;AACtD,8EAAmD;AACnD,6EAAkD;AAClD,gFAAqD;AACrD,4EAAiD;AACjD,2EAAgD;AAChD,gFAAqD;AACrD,+EAAoD;AACpD,8EAAmD;AACnD,4EAAiD;AACjD,+EAAoD;AACpD,2EAAgD;AAChD,0EAA+C;AAC/C,2EAAgD;AAChD,0EAA+C;AAC/C,0EAA+C;AAC/C,yEA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,yEAA8C;AAC9C,4EAAiD;AAEjD,iCAAiC;AAEjC,gFAA8E;AAArE,kIAAA,uBAAuB,OAAA;AAEhC,uDAAqD;AAA5C,wGAAA,UAAU,OAAA;AACnB,sDAAoD;AAA3C,wGAAA,UAAU,OAAA;AACnB,oEAAkE;AAAzD,sHAAA,iBAAiB,OAAA;AAG1B,6DAA2D;AAAlD,4GAAA,YAAY,OAAA;AACrB,yEAAuE;AAA9D,wHAAA,kBAAkB,OAAA;AAC3B,yEAAuE;AAA9D,wHAAA,kBAAkB,OAAA;AAC3B,yEAAuE;AAA9D,wHAAA,kBAAkB,OAAA;AAC3B,yEAAuE;AAA9D,wHAAA,kBAAkB,OAAA;AAC3B,6EAA2E;AAAlE,4HAAA,oBAAoB,OAAA;AAC7B,qDAAmD;AAA1C,oGAAA,QAAQ,OAAA;AACjB,2DAAyD;AAAhD,0GAAA,WAAW,OAAA;AAGpB,oEAAkE;AAAzD,4GAAA,YAAY,OAAA;AACrB,oEAAkE;AAAzD,4GAAA,YAAY,OAAA;AACrB,oEAAkE;AAAzD,4GAAA,YAAY,OAAA;AACrB,0DAAwD;AAA/C,0GAAA,WAAW,OAAA;AAEpB,0EAAwE;AAA/D,wHAAA,kBAAkB,OAAA;AAC3B,mDAAiD;AAAxC,sGAAA,SAAS,OAAA;AAClB,mEAAiE;AAAxD,sHAAA,iBAAiB,OAAA;AAE1B,iFAA+E;AAAtE,8HAAA,qBAAqB,OAAA;AAE9B,2FAAyF;AAAhF,wIAAA,0BAA0B,OAAA;AAWnC,6DAA2D;AAAlD,4GAAA,YAAY,OAAA;AAIrB,uGAAqG;AAA5F,sJAAA,iCAAiC,OAAA;AAE1C,2EAAyE;AAAhE,0HAAA,mBAAmB,OAAA;AAC5B,0DAAwD;AAA/C,kHAAA,eAAe,OAAA;AACxB,kEAAgE;AAAvD,0HAAA,mBAAmB,OAAA","file":"index.js","sourcesContent":["/*!\n */\nimport \"reflect-metadata\"\n\n// -------------------------------------------------------------------------\n// Commonly Used exports\n// -------------------------------------------------------------------------\n\nexport * from \"./globals\"\nexport * from \"./container\"\nexport * from \"./common/EntityTarget\"\nexport * from \"./common/ObjectType\"\nexport * from \"./common/ObjectLiteral\"\nexport * from \"./common/MixedList\"\nexport * from \"./common/DeepPartial\"\nexport * from \"./common/RelationType\"\nexport * from \"./error\"\nexport * from \"./decorator/columns/Column\"\nexport * from \"./decorator/columns/CreateDateColumn\"\nexport * from \"./decorator/columns/DeleteDateColumn\"\nexport * from \"./decorator/columns/PrimaryGeneratedColumn\"\nexport * from \"./decorator/columns/PrimaryColumn\"\nexport * from \"./decorator/columns/UpdateDateColumn\"\nexport * from \"./decorator/columns/VersionColumn\"\nexport * from \"./decorator/columns/VirtualColumn\"\nexport * from \"./decorator/columns/ViewColumn\"\nexport * from \"./decorator/columns/ObjectIdColumn\"\nexport * from \"./decorator/listeners/AfterInsert\"\nexport * from \"./decorator/listeners/AfterLoad\"\nexport * from \"./decorator/listeners/AfterRemove\"\nexport * from \"./decorator/listeners/AfterSoftRemove\"\nexport * from \"./decorator/listeners/AfterRecover\"\nexport * from \"./decorator/listeners/AfterUpdate\"\nexport * from \"./decorator/listeners/BeforeInsert\"\nexport * from \"./decorator/listeners/BeforeRemove\"\nexport * from \"./decorator/listeners/BeforeSoftRemove\"\nexport * from \"./decorator/listeners/BeforeRecover\"\nexport * from \"./decorator/listeners/BeforeUpdate\"\nexport * from \"./decorator/listeners/EventSubscriber\"\nexport * from \"./decorator/options/ColumnOptions\"\nexport * from \"./decorator/options/IndexOptions\"\nexport * from \"./decorator/options/JoinColumnOptions\"\nexport * from \"./decorator/options/JoinTableOptions\"\nexport * from \"./decorator/options/RelationOptions\"\nexport * from \"./decorator/options/EntityOptions\"\nexport * from \"./decorator/options/ValueTransformer\"\nexport * from \"./decorator/relations/JoinColumn\"\nexport * from \"./decorator/relations/JoinTable\"\nexport * from \"./decorator/relations/ManyToMany\"\nexport * from \"./decorator/relations/ManyToOne\"\nexport * from \"./decorator/relations/OneToMany\"\nexport * from \"./decorator/relations/OneToOne\"\nexport * from \"./decorator/relations/RelationCount\"\nexport * from \"./decorator/relations/RelationId\"\nexport * from \"./decorator/entity/Entity\"\nexport * from \"./decorator/entity/ChildEntity\"\nexport * from \"./decorator/entity/TableInheritance\"\nexport * from \"./decorator/entity-view/ViewEntity\"\nexport * from \"./decorator/tree/TreeLevelColumn\"\nexport * from \"./decorator/tree/TreeParent\"\nexport * from \"./decorator/tree/TreeChildren\"\nexport * from \"./decorator/tree/Tree\"\nexport * from \"./decorator/Index\"\nexport * from \"./decorator/Unique\"\nexport * from \"./decorator/Check\"\nexport * from \"./decorator/Exclusion\"\nexport * from \"./decorator/Generated\"\nexport * from \"./decorator/EntityRepository\"\nexport * from \"./find-options/operator/And\"\nexport * from \"./find-options/operator/Any\"\nexport * from \"./find-options/operator/ArrayContainedBy\"\nexport * from \"./find-options/operator/ArrayContains\"\nexport * from \"./find-options/operator/ArrayOverlap\"\nexport * from \"./find-options/operator/Between\"\nexport * from \"./find-options/operator/Equal\"\nexport * from \"./find-options/operator/In\"\nexport * from \"./find-options/operator/IsNull\"\nexport * from \"./find-options/operator/LessThan\"\nexport * from \"./find-options/operator/LessThanOrEqual\"\nexport * from \"./find-options/operator/ILike\"\nexport * from \"./find-options/operator/Like\"\nexport * from \"./find-options/operator/MoreThan\"\nexport * from \"./find-options/operator/MoreThanOrEqual\"\nexport * from \"./find-options/operator/Not\"\nexport * from \"./find-options/operator/Raw\"\nexport * from \"./find-options/operator/JsonContains\"\nexport * from \"./find-options/EqualOperator\"\nexport * from \"./find-options/FindManyOptions\"\nexport * from \"./find-options/FindOneOptions\"\nexport * from \"./find-options/FindOperator\"\nexport * from \"./find-options/FindOperatorType\"\nexport * from \"./find-options/FindOptionsOrder\"\nexport * from \"./find-options/FindOptionsRelations\"\nexport * from \"./find-options/FindOptionsSelect\"\nexport * from \"./find-options/FindOptionsUtils\"\nexport * from \"./find-options/FindOptionsWhere\"\nexport * from \"./find-options/FindTreeOptions\"\nexport * from \"./find-options/JoinOptions\"\nexport * from \"./find-options/OrderByCondition\"\nexport * from \"./logger/AbstractLogger\"\nexport * from \"./logger/Logger\"\nexport * from \"./logger/LoggerOptions\"\nexport * from \"./logger/AdvancedConsoleLogger\"\nexport * from \"./logger/SimpleConsoleLogger\"\nexport * from \"./logger/FileLogger\"\nexport * from \"./metadata/EntityMetadata\"\nexport * from \"./entity-manager/EntityManager\"\nexport * from \"./repository/AbstractRepository\"\nexport * from \"./repository/Repository\"\nexport * from \"./repository/BaseEntity\"\nexport * from \"./repository/TreeRepository\"\nexport * from \"./repository/MongoRepository\"\nexport * from \"./repository/RemoveOptions\"\nexport * from \"./repository/SaveOptions\"\nexport * from \"./schema-builder/table/TableCheck\"\nexport * from \"./schema-builder/table/TableColumn\"\nexport * from \"./schema-builder/table/TableExclusion\"\nexport * from \"./schema-builder/table/TableForeignKey\"\nexport * from \"./schema-builder/table/TableIndex\"\nexport * from \"./schema-builder/table/TableUnique\"\nexport * from \"./schema-builder/table/Table\"\nexport * from \"./schema-builder/view/View\"\nexport * from \"./schema-builder/options/TableCheckOptions\"\nexport * from \"./schema-builder/options/TableColumnOptions\"\nexport * from \"./schema-builder/options/TableExclusionOptions\"\nexport * from \"./schema-builder/options/TableForeignKeyOptions\"\nexport * from \"./schema-builder/options/TableIndexOptions\"\nexport * from \"./schema-builder/options/TableOptions\"\nexport * from \"./schema-builder/options/TableUniqueOptions\"\nexport * from \"./schema-builder/options/ViewOptions\"\nexport * from \"./driver/mongodb/typings\"\nexport * from \"./driver/types/DatabaseType\"\nexport * from \"./driver/types/GeoJsonTypes\"\nexport * from \"./driver/types/ReplicationMode\"\nexport * from \"./driver/sqlserver/MssqlParameter\"\n\n// export * from \"./data-source\";\n\nexport { ConnectionOptionsReader } from \"./connection/ConnectionOptionsReader\"\nexport { ConnectionOptions } from \"./connection/ConnectionOptions\"\nexport { DataSource } from \"./data-source/DataSource\"\nexport { Connection } from \"./connection/Connection\"\nexport { ConnectionManager } from \"./connection/ConnectionManager\"\nexport { DataSourceOptions } from \"./data-source/DataSourceOptions\"\nexport { Driver } from \"./driver/Driver\"\nexport { QueryBuilder } from \"./query-builder/QueryBuilder\"\nexport { SelectQueryBuilder } from \"./query-builder/SelectQueryBuilder\"\nexport { DeleteQueryBuilder } from \"./query-builder/DeleteQueryBuilder\"\nexport { InsertQueryBuilder } from \"./query-builder/InsertQueryBuilder\"\nexport { UpdateQueryBuilder } from \"./query-builder/UpdateQueryBuilder\"\nexport { RelationQueryBuilder } from \"./query-builder/RelationQueryBuilder\"\nexport { Brackets } from \"./query-builder/Brackets\"\nexport { NotBrackets } from \"./query-builder/NotBrackets\"\nexport { WhereExpressionBuilder } from \"./query-builder/WhereExpressionBuilder\"\nexport { WhereExpression } from \"./query-builder/WhereExpressionBuilder\"\nexport { InsertResult } from \"./query-builder/result/InsertResult\"\nexport { UpdateResult } from \"./query-builder/result/UpdateResult\"\nexport { DeleteResult } from \"./query-builder/result/DeleteResult\"\nexport { QueryResult } from \"./query-runner/QueryResult\"\nexport { QueryRunner } from \"./query-runner/QueryRunner\"\nexport { MongoEntityManager } from \"./entity-manager/MongoEntityManager\"\nexport { Migration } from \"./migration/Migration\"\nexport { MigrationExecutor } from \"./migration/MigrationExecutor\"\nexport { MigrationInterface } from \"./migration/MigrationInterface\"\nexport { DefaultNamingStrategy } from \"./naming-strategy/DefaultNamingStrategy\"\nexport { NamingStrategyInterface } from \"./naming-strategy/NamingStrategyInterface\"\nexport { LegacyOracleNamingStrategy } from \"./naming-strategy/LegacyOracleNamingStrategy\"\nexport { InsertEvent } from \"./subscriber/event/InsertEvent\"\nexport { LoadEvent } from \"./subscriber/event/LoadEvent\"\nexport { UpdateEvent } from \"./subscriber/event/UpdateEvent\"\nexport { RemoveEvent } from \"./subscriber/event/RemoveEvent\"\nexport { SoftRemoveEvent } from \"./subscriber/event/SoftRemoveEvent\"\nexport { RecoverEvent } from \"./subscriber/event/RecoverEvent\"\nexport { TransactionCommitEvent } from \"./subscriber/event/TransactionCommitEvent\"\nexport { TransactionRollbackEvent } from \"./subscriber/event/TransactionRollbackEvent\"\nexport { TransactionStartEvent } from \"./subscriber/event/TransactionStartEvent\"\nexport { EntitySubscriberInterface } from \"./subscriber/EntitySubscriberInterface\"\nexport { EntitySchema } from \"./entity-schema/EntitySchema\"\nexport { EntitySchemaColumnOptions } from \"./entity-schema/EntitySchemaColumnOptions\"\nexport { EntitySchemaIndexOptions } from \"./entity-schema/EntitySchemaIndexOptions\"\nexport { EntitySchemaRelationOptions } from \"./entity-schema/EntitySchemaRelationOptions\"\nexport { EntitySchemaEmbeddedColumnOptions } from \"./entity-schema/EntitySchemaEmbeddedColumnOptions\"\nexport { ColumnType } from \"./driver/types/ColumnTypes\"\nexport { EntitySchemaOptions } from \"./entity-schema/EntitySchemaOptions\"\nexport { InstanceChecker } from \"./util/InstanceChecker\"\nexport { TreeRepositoryUtils } from \"./util/TreeRepositoryUtils\"\n"],"sourceRoot":"."}
package/index.mjs CHANGED
@@ -187,6 +187,7 @@ const {
187
187
  TableIndex,
188
188
  TableUnique,
189
189
  Table,
190
+ View,
190
191
  Binary,
191
192
  BSON,
192
193
  BSONRegExp,
@@ -394,6 +395,7 @@ export {
394
395
  TableIndex,
395
396
  TableUnique,
396
397
  Table,
398
+ View,
397
399
  Binary,
398
400
  BSON,
399
401
  BSONRegExp,
package/package.json CHANGED
@@ -1 +1 @@
1
- { "name": "typeorm", "private": false, "version": "0.3.18-dev.dff2d53", "description": "Data-Mapper ORM for TypeScript, ES7, ES6, ES5. Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, MongoDB databases.", "license": "MIT", "readmeFilename": "README.md", "author": { "name": "Umed Khudoiberdiev", "email": "pleerock.me@gmail.com" }, "engines": { "node": ">= 12.9.0" }, "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", "types": "./index.d.ts", "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/typings.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/mongodb/bson.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" }, "repository": { "type": "git", "url": "https://github.com/typeorm/typeorm.git" }, "bugs": { "url": "https://github.com/typeorm/typeorm/issues" }, "homepage": "https://typeorm.io", "tags": [ "orm", "typescript", "typescript-orm", "mysql", "mysql-orm", "postgresql", "postgresql-orm", "mariadb", "mariadb-orm", "spanner", "sqlite", "sqlite-orm", "sql-server", "sql-server-orm", "oracle", "oracle-orm", "cloud-spanner", "cloud-spanner-orm" ], "devDependencies": { "@types/app-root-path": "^1.2.4", "@types/chai": "^4.3.4", "@types/chai-as-promised": "^7.1.5", "@types/debug": "^4.1.7", "@types/mkdirp": "^1.0.2", "@types/mocha": "^10.0.1", "@types/node": "^18.13.0", "@types/sha.js": "^2.4.0", "@types/sinon": "^10.0.13", "@types/source-map-support": "^0.5.6", "@types/uuid": "^9.0.0", "@types/yargs": "^17.0.22", "better-sqlite3": "^8.1.0", "chai": "^4.3.7", "chai-as-promised": "^7.1.1", "class-transformer": "^0.5.1", "conventional-changelog-angular": "^5.0.13", "conventional-changelog-cli": "^2.2.2", "del": "6.1.1", "gulp": "^4.0.2", "gulp-istanbul": "^1.1.3", "gulp-mocha": "^8.0.0", "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", "husky": "^8.0.3", "mocha": "^10.2.0", "mongodb": "^5.2.0", "mssql": "^9.1.1", "mysql": "^2.18.1", "mysql2": "^3.1.1", "pg": "^8.9.0", "pg-query-stream": "^4.3.0", "prettier": "^2.8.3", "redis": "^4.6.4", "remap-istanbul": "^0.13.0", "rimraf": "^4.1.2", "sinon": "^15.0.1", "sinon-chai": "^3.7.0", "source-map-support": "^0.5.21", "sql.js": "^1.8.0", "sqlite3": "^5.1.4", "ts-node": "^10.9.1", "typeorm-aurora-data-api-driver": "^2.4.4", "typescript": "^4.9.5" }, "peerDependencies": { "@google-cloud/spanner": "^5.18.0", "@sap/hana-client": "^2.12.25", "better-sqlite3": "^7.1.2 || ^8.0.0", "hdb-pool": "^0.1.6", "ioredis": "^5.0.4", "mongodb": "^5.2.0", "mssql": "^9.1.1", "mysql2": "^2.2.5 || ^3.0.1", "oracledb": "^5.1.0", "pg": "^8.5.1", "pg-native": "^3.0.0", "pg-query-stream": "^4.0.0", "redis": "^3.1.1 || ^4.0.0", "sql.js": "^1.4.0", "sqlite3": "^5.0.3", "ts-node": "^10.7.0", "typeorm-aurora-data-api-driver": "^2.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 } }, "dependencies": { "@sqltools/formatter": "^1.2.5", "app-root-path": "^3.1.0", "buffer": "^6.0.3", "chalk": "^4.1.2", "cli-highlight": "^2.1.11", "date-fns": "^2.29.3", "debug": "^4.3.4", "dotenv": "^16.0.3", "glob": "^8.1.0", "mkdirp": "^2.1.3", "reflect-metadata": "^0.1.13", "sha.js": "^2.4.11", "tslib": "^2.5.0", "uuid": "^9.0.0", "yargs": "^17.6.2" }, "scripts": { "test": "rimraf ./build && tsc && mocha --file ./build/compiled/test/utils/test-setup.js --bail --recursive --timeout 90000 ./build/compiled/test", "test-fast": "mocha --file ./build/compiled/test/utils/test-setup.js --bail --recursive --timeout 90000 ./build/compiled/test", "compile": "rimraf ./build && tsc", "watch": "./node_modules/.bin/tsc -w", "package": "gulp package", "pack": "gulp pack", "lint": "prettier --check \"./src/**/*.ts\" \"./test/**/*.ts\" \"./sample/**/*.ts\"", "format": "prettier --write --end-of-line auto \"./src/**/*.ts\" \"./test/**/*.ts\" \"./sample/**/*.ts\"", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 2" }, "bin": { "typeorm": "./cli.js", "typeorm-ts-node-commonjs": "./cli-ts-node-commonjs.js", "typeorm-ts-node-esm": "./cli-ts-node-esm.js" }, "funding": "https://opencollective.com/typeorm", "collective": { "type": "opencollective", "url": "https://opencollective.com/typeorm", "logo": "https://opencollective.com/opencollective/logo.txt" }, "nyc": { "all": true, "cache": false, "exclude": [ "**/*.d.ts" ], "extension": [ ".ts" ], "include": [ "build/compiled/src/**", "src/**" ], "reporter": "json" } }
1
+ { "name": "typeorm", "private": false, "version": "0.3.18-dev.fbd45db", "description": "Data-Mapper ORM for TypeScript, ES7, ES6, ES5. Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, MongoDB databases.", "license": "MIT", "readmeFilename": "README.md", "author": { "name": "Umed Khudoiberdiev", "email": "pleerock.me@gmail.com" }, "engines": { "node": ">= 12.9.0" }, "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", "types": "./index.d.ts", "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/typings.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/mongodb/bson.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" }, "repository": { "type": "git", "url": "https://github.com/typeorm/typeorm.git" }, "bugs": { "url": "https://github.com/typeorm/typeorm/issues" }, "homepage": "https://typeorm.io", "tags": [ "orm", "typescript", "typescript-orm", "mysql", "mysql-orm", "postgresql", "postgresql-orm", "mariadb", "mariadb-orm", "spanner", "sqlite", "sqlite-orm", "sql-server", "sql-server-orm", "oracle", "oracle-orm", "cloud-spanner", "cloud-spanner-orm" ], "devDependencies": { "@types/app-root-path": "^1.2.4", "@types/chai": "^4.3.4", "@types/chai-as-promised": "^7.1.5", "@types/debug": "^4.1.7", "@types/mkdirp": "^1.0.2", "@types/mocha": "^10.0.1", "@types/node": "^18.13.0", "@types/sha.js": "^2.4.0", "@types/sinon": "^10.0.13", "@types/source-map-support": "^0.5.6", "@types/uuid": "^9.0.0", "@types/yargs": "^17.0.22", "better-sqlite3": "^8.1.0", "chai": "^4.3.7", "chai-as-promised": "^7.1.1", "class-transformer": "^0.5.1", "conventional-changelog-angular": "^5.0.13", "conventional-changelog-cli": "^2.2.2", "del": "6.1.1", "gulp": "^4.0.2", "gulp-istanbul": "^1.1.3", "gulp-mocha": "^8.0.0", "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", "husky": "^8.0.3", "mocha": "^10.2.0", "mongodb": "^5.2.0", "mssql": "^9.1.1", "mysql": "^2.18.1", "mysql2": "^3.1.1", "pg": "^8.9.0", "pg-query-stream": "^4.3.0", "prettier": "^2.8.3", "redis": "^4.6.4", "remap-istanbul": "^0.13.0", "rimraf": "^4.1.2", "sinon": "^15.0.1", "sinon-chai": "^3.7.0", "source-map-support": "^0.5.21", "sql.js": "^1.8.0", "sqlite3": "^5.1.4", "ts-node": "^10.9.1", "typeorm-aurora-data-api-driver": "^2.4.4", "typescript": "^4.9.5" }, "peerDependencies": { "@google-cloud/spanner": "^5.18.0", "@sap/hana-client": "^2.12.25", "better-sqlite3": "^7.1.2 || ^8.0.0", "hdb-pool": "^0.1.6", "ioredis": "^5.0.4", "mongodb": "^5.2.0", "mssql": "^9.1.1", "mysql2": "^2.2.5 || ^3.0.1", "oracledb": "^5.1.0", "pg": "^8.5.1", "pg-native": "^3.0.0", "pg-query-stream": "^4.0.0", "redis": "^3.1.1 || ^4.0.0", "sql.js": "^1.4.0", "sqlite3": "^5.0.3", "ts-node": "^10.7.0", "typeorm-aurora-data-api-driver": "^2.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 } }, "dependencies": { "@sqltools/formatter": "^1.2.5", "app-root-path": "^3.1.0", "buffer": "^6.0.3", "chalk": "^4.1.2", "cli-highlight": "^2.1.11", "date-fns": "^2.29.3", "debug": "^4.3.4", "dotenv": "^16.0.3", "glob": "^8.1.0", "mkdirp": "^2.1.3", "reflect-metadata": "^0.1.13", "sha.js": "^2.4.11", "tslib": "^2.5.0", "uuid": "^9.0.0", "yargs": "^17.6.2" }, "scripts": { "test": "rimraf ./build && tsc && mocha --file ./build/compiled/test/utils/test-setup.js --bail --recursive --timeout 90000 ./build/compiled/test", "test-fast": "mocha --file ./build/compiled/test/utils/test-setup.js --bail --recursive --timeout 90000 ./build/compiled/test", "compile": "rimraf ./build && tsc", "watch": "./node_modules/.bin/tsc -w", "package": "gulp package", "pack": "gulp pack", "lint": "prettier --check \"./src/**/*.ts\" \"./test/**/*.ts\" \"./sample/**/*.ts\"", "format": "prettier --write --end-of-line auto \"./src/**/*.ts\" \"./test/**/*.ts\" \"./sample/**/*.ts\"", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 2" }, "bin": { "typeorm": "./cli.js", "typeorm-ts-node-commonjs": "./cli-ts-node-commonjs.js", "typeorm-ts-node-esm": "./cli-ts-node-esm.js" }, "funding": "https://opencollective.com/typeorm", "collective": { "type": "opencollective", "url": "https://opencollective.com/typeorm", "logo": "https://opencollective.com/opencollective/logo.txt" }, "nyc": { "all": true, "cache": false, "exclude": [ "**/*.d.ts" ], "extension": [ ".ts" ], "include": [ "build/compiled/src/**", "src/**" ], "reporter": "json" } }
@@ -118,7 +118,8 @@ class Subject {
118
118
  (this.databaseEntityLoaded === false ||
119
119
  (this.databaseEntityLoaded && this.databaseEntity)) &&
120
120
  // ((this.entity && this.databaseEntity) || (!this.entity && !this.databaseEntity)) &&
121
- this.changeMaps.length > 0);
121
+ // ensure there are one or more changes for updatable columns
122
+ this.changeMaps.some((change) => !change.column || change.column.isUpdate));
122
123
  }
123
124
  /**
124
125
  * Checks if this subject must be soft-removed into the database.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/persistence/Subject.ts"],"names":[],"mappings":";;;AAGA,+CAA2C;AAG3C,qDAAiD;AACjD,6DAAyD;AAEzD;;;;;;;;;GASG;AACH,MAAa,OAAO;IAoHhB,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAY,OAWX;QAlIQ,mBAAa,GAAG,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;QAW9C;;;;;WAKG;QACH,eAAU,GAA8B,SAAS,CAAA;QAEjD;;WAEG;QACH,2BAAsB,GAA8B,SAAS,CAAA;QAqB7D;;;WAGG;QACH,yBAAoB,GAAY,KAAK,CAAA;QAErC;;WAEG;QACH,eAAU,GAAuB,EAAE,CAAA;QAenC;;;WAGG;QACH,kBAAa,GAAY,KAAK,CAAA;QAE9B;;;WAGG;QACH,iBAAY,GAAY,KAAK,CAAA;QAE7B;;;WAGG;QACH,kBAAa,GAAY,KAAK,CAAA;QAE9B;;;WAGG;QACH,qBAAgB,GAAY,KAAK,CAAA;QAEjC;;;WAGG;QACH,mBAAc,GAAY,KAAK,CAAA;QAE/B;;WAEG;QACH,wBAAmB,GAGb,EAAE,CAAA;QAER;;WAEG;QACH,gBAAW,GAAqB,EAAE,C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\"../metadata/EntityMetadata\"\nimport { SubjectChangeMap } from \"./SubjectChangeMap\"\nimport { OrmUtils } from \"../util/OrmUtils\"\nimport { RelationMetadata } from \"../metadata/RelationMetadata\"\nimport { ColumnMetadata } from \"../metadata/ColumnMetadata\"\nimport { ObjectUtils } from \"../util/ObjectUtils\"\nimport { InstanceChecker } from \"../util/InstanceChecker\"\n\n/**\n * Subject is a subject of persistence.\n * It holds information about each entity that needs to be persisted:\n * - what entity should be persisted\n * - what is database representation of the persisted entity\n * - what entity metadata of the persisted entity\n * - what is allowed to with persisted entity (insert/update/remove)\n *\n * Having this collection of subjects we can perform database queries.\n */\nexport class Subject {\n readonly \"@instanceof\" = Symbol.for(\"Subject\")\n\n // -------------------------------------------------------------------------\n // Properties\n // -------------------------------------------------------------------------\n\n /**\n * Entity metadata of the subject entity.\n */\n metadata: EntityMetadata\n\n /**\n * Subject identifier.\n * This identifier is not limited to table entity primary columns.\n * This can be entity id or ids as well as some unique entity properties, like name or title.\n * Insert / Update / Remove operation will be executed by a given identifier.\n */\n identifier: ObjectLiteral | undefined = undefined\n\n /**\n * Copy of entity but with relational ids fulfilled.\n */\n entityWithFulfilledIds: ObjectLiteral | undefined = undefined\n\n /**\n * If subject was created by cascades this property will contain subject\n * from where this subject was created.\n */\n parentSubject?: Subject\n\n /**\n * Gets entity sent to the persistence (e.g. changed entity).\n * If entity is not set then this subject is created only for the entity loaded from the database,\n * or this subject is used for the junction operation (junction operations are relying only on identifier).\n */\n entity?: ObjectLiteral\n\n /**\n * Database entity.\n * THIS IS NOT RAW ENTITY DATA, its a real entity.\n */\n databaseEntity?: ObjectLiteral\n\n /**\n * Indicates if database entity was loaded.\n * No matter if it was found or not, it indicates the fact of loading.\n */\n databaseEntityLoaded: boolean = false\n\n /**\n * Changes needs to be applied in the database for the given subject.\n */\n changeMaps: SubjectChangeMap[] = []\n\n /**\n * Generated values returned by a database (for example generated id or default values).\n * Used in insert and update operations.\n * Has entity-like structure (not just column database name and values).\n */\n generatedMap?: ObjectLiteral\n\n /**\n * Inserted values with updated values of special and default columns.\n * Has entity-like structure (not just column database name and values).\n */\n insertedValueSet?: ObjectLiteral\n\n /**\n * Indicates if this subject can be inserted into the database.\n * This means that this subject either is newly persisted, either can be inserted by cascades.\n */\n canBeInserted: boolean = false\n\n /**\n * Indicates if this subject can be updated in the database.\n * This means that this subject either was persisted, either can be updated by cascades.\n */\n canBeUpdated: boolean = false\n\n /**\n * Indicates if this subject MUST be removed from the database.\n * This means that this subject either was removed, either was removed by cascades.\n */\n mustBeRemoved: boolean = false\n\n /**\n * Indicates if this subject can be soft-removed from the database.\n * This means that this subject either was soft-removed, either was soft-removed by cascades.\n */\n canBeSoftRemoved: boolean = false\n\n /**\n * Indicates if this subject can be recovered from the database.\n * This means that this subject either was recovered, either was recovered by cascades.\n */\n canBeRecovered: boolean = false\n\n /**\n * Relations updated by the change maps.\n */\n updatedRelationMaps: {\n relation: RelationMetadata\n value: ObjectLiteral\n }[] = []\n\n /**\n * List of updated columns\n */\n diffColumns: ColumnMetadata[] = []\n\n /**\n * List of updated relations\n */\n diffRelations: RelationMetadata[] = []\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(options: {\n metadata: EntityMetadata\n parentSubject?: Subject\n entity?: ObjectLiteral\n canBeInserted?: boolean\n canBeUpdated?: boolean\n mustBeRemoved?: boolean\n canBeSoftRemoved?: boolean\n canBeRecovered?: boolean\n identifier?: ObjectLiteral\n changeMaps?: SubjectChangeMap[]\n }) {\n this.metadata = options.metadata\n this.entity = options.entity\n this.parentSubject = options.parentSubject\n if (options.canBeInserted !== undefined)\n this.canBeInserted = options.canBeInserted\n if (options.canBeUpdated !== undefined)\n this.canBeUpdated = options.canBeUpdated\n if (options.mustBeRemoved !== undefined)\n this.mustBeRemoved = options.mustBeRemoved\n if (options.canBeSoftRemoved !== undefined)\n this.canBeSoftRemoved = options.canBeSoftRemoved\n if (options.canBeRecovered !== undefined)\n this.canBeRecovered = options.canBeRecovered\n if (options.identifier !== undefined)\n this.identifier = options.identifier\n if (options.changeMaps !== undefined)\n this.changeMaps.push(...options.changeMaps)\n\n this.recompute()\n }\n\n // -------------------------------------------------------------------------\n // Accessors\n // -------------------------------------------------------------------------\n\n /**\n * Checks if this subject must be inserted into the database.\n * Subject can be inserted into the database if it is allowed to be inserted (explicitly persisted or by cascades)\n * and if it does not have database entity set.\n */\n get mustBeInserted() {\n return this.canBeInserted && !this.databaseEntity\n }\n\n /**\n * Checks if this subject must be updated into the database.\n * Subject can be updated in the database if it is allowed to be updated (explicitly persisted or by cascades)\n * and if it does have differentiated columns or relations.\n */\n get mustBeUpdated() {\n return (\n this.canBeUpdated &&\n this.identifier &&\n (this.databaseEntityLoaded === false ||\n (this.databaseEntityLoaded && this.databaseEntity)) &&\n // ((this.entity && this.databaseEntity) || (!this.entity && !this.databaseEntity)) &&\n this.changeMaps.length > 0\n )\n }\n\n /**\n * Checks if this subject must be soft-removed into the database.\n * Subject can be updated in the database if it is allowed to be soft-removed (explicitly persisted or by cascades)\n * and if it does have differentiated columns or relations.\n */\n get mustBeSoftRemoved() {\n return (\n this.canBeSoftRemoved &&\n this.identifier &&\n (this.databaseEntityLoaded === false ||\n (this.databaseEntityLoaded && this.databaseEntity))\n )\n }\n\n /**\n * Checks if this subject must be recovered into the database.\n * Subject can be updated in the database if it is allowed to be recovered (explicitly persisted or by cascades)\n * and if it does have differentiated columns or relations.\n */\n get mustBeRecovered() {\n return (\n this.canBeRecovered &&\n this.identifier &&\n (this.databaseEntityLoaded === false ||\n (this.databaseEntityLoaded && this.databaseEntity))\n )\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Creates a value set needs to be inserted / updated in the database.\n * Value set is based on the entity and change maps of the subject.\n * Important note: this method pops data from this subject's change maps.\n */\n createValueSetAndPopChangeMap(): ObjectLiteral {\n const changeMapsWithoutValues: SubjectChangeMap[] = []\n const changeSet = this.changeMaps.reduce((updateMap, changeMap) => {\n let value = changeMap.value\n if (InstanceChecker.isSubject(value)) {\n // referenced columns can refer on values both which were just inserted and which were present in the model\n // if entity was just inserted valueSets must contain all values from the entity and values just inserted in the database\n // so, here we check if we have a value set then we simply use it as value to get our reference column values\n // otherwise simply use an entity which cannot be just inserted at the moment and have all necessary data\n value = value.insertedValueSet\n ? value.insertedValueSet\n : value.entity\n }\n // value = changeMap.valueFactory ? changeMap.valueFactory(value) : changeMap.column.createValueMap(value);\n\n let valueMap: ObjectLiteral | undefined\n if (this.metadata.isJunction && changeMap.column) {\n valueMap = changeMap.column.createValueMap(\n changeMap.column.referencedColumn!.getEntityValue(value),\n )\n } else if (changeMap.column) {\n valueMap = changeMap.column.createValueMap(value)\n } else if (changeMap.relation) {\n // value can be a related object, for example: post.question = { id: 1 }\n // or value can be a null or direct relation id, e.g. post.question = 1\n // if its a direction relation id then we just set it to the valueMap,\n // however if its an object then we need to extract its relation id map and set it to the valueMap\n if (ObjectUtils.isObject(value) && !Buffer.isBuffer(value)) {\n // get relation id, e.g. referenced column name and its value,\n // for example: { id: 1 } which then will be set to relation, e.g. post.category = { id: 1 }\n const relationId =\n changeMap.relation!.getRelationIdMap(value)\n\n // but relation id can be empty, for example in the case when you insert a new post with category\n // and both post and category are newly inserted objects (by cascades) and in this case category will not have id\n // this means we need to insert post without question id and update post's questionId once question be inserted\n // that's why we create a new changeMap operation for future updation of the post entity\n if (relationId === undefined) {\n changeMapsWithoutValues.push(changeMap)\n this.canBeUpdated = true\n return updateMap\n }\n valueMap = changeMap.relation!.createValueMap(relationId)\n this.updatedRelationMaps.push({\n relation: changeMap.relation,\n value: relationId,\n })\n } else {\n // value can be \"null\" or direct relation id here\n valueMap = changeMap.relation!.createValueMap(value)\n this.updatedRelationMaps.push({\n relation: changeMap.relation,\n value: value,\n })\n }\n }\n\n OrmUtils.mergeDeep(updateMap, valueMap)\n return updateMap\n }, {} as ObjectLiteral)\n this.changeMaps = changeMapsWithoutValues\n return changeSet\n }\n\n /**\n * Recomputes entityWithFulfilledIds and identifier when entity changes.\n */\n recompute(): void {\n if (this.entity) {\n this.entityWithFulfilledIds = Object.assign({}, this.entity)\n if (this.parentSubject) {\n this.metadata.primaryColumns.forEach((primaryColumn) => {\n if (\n primaryColumn.relationMetadata &&\n primaryColumn.relationMetadata.inverseEntityMetadata ===\n this.parentSubject!.metadata\n ) {\n const value =\n primaryColumn.referencedColumn!.getEntityValue(\n this.parentSubject!.entity!,\n )\n primaryColumn.setEntityValue(\n this.entityWithFulfilledIds!,\n value,\n )\n }\n })\n }\n this.identifier = this.metadata.getEntityIdMap(\n this.entityWithFulfilledIds,\n )\n } else if (this.databaseEntity) {\n this.identifier = this.metadata.getEntityIdMap(this.databaseEntity)\n }\n }\n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../../src/persistence/Subject.ts"],"names":[],"mappings":";;;AAGA,+CAA2C;AAG3C,qDAAiD;AACjD,6DAAyD;AAEzD;;;;;;;;;GASG;AACH,MAAa,OAAO;IAoHhB,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAY,OAWX;QAlIQ,mBAAa,GAAG,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;QAW9C;;;;;WAKG;QACH,eAAU,GAA8B,SAAS,CAAA;QAEjD;;WAEG;QACH,2BAAsB,GAA8B,SAAS,CAAA;QAqB7D;;;WAGG;QACH,yBAAoB,GAAY,KAAK,CAAA;QAErC;;WAEG;QACH,eAAU,GAAuB,EAAE,CAAA;QAenC;;;WAGG;QACH,kBAAa,GAAY,KAAK,CAAA;QAE9B;;;WAGG;QACH,iBAAY,GAAY,KAAK,CAAA;QAE7B;;;WAGG;QACH,kBAAa,GAAY,KAAK,CAAA;QAE9B;;;WAGG;QACH,qBAAgB,GAAY,KAAK,CAAA;QAEjC;;;WAGG;QACH,mBAAc,GAAY,KAAK,CAAA;QAE/B;;WAEG;QACH,wBAAmB,GAGb,EAAE,CAAA;QAER;;WAEG;QACH,gBAAW,GAAq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,CAAA;SACtE;IACL,CAAC;CACJ;AA7TD,0BA6TC","file":"Subject.js","sourcesContent":["import { ObjectLiteral } from \"../common/ObjectLiteral\"\nimport { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { SubjectChangeMap } from \"./SubjectChangeMap\"\nimport { OrmUtils } from \"../util/OrmUtils\"\nimport { RelationMetadata } from \"../metadata/RelationMetadata\"\nimport { ColumnMetadata } from \"../metadata/ColumnMetadata\"\nimport { ObjectUtils } from \"../util/ObjectUtils\"\nimport { InstanceChecker } from \"../util/InstanceChecker\"\n\n/**\n * Subject is a subject of persistence.\n * It holds information about each entity that needs to be persisted:\n * - what entity should be persisted\n * - what is database representation of the persisted entity\n * - what entity metadata of the persisted entity\n * - what is allowed to with persisted entity (insert/update/remove)\n *\n * Having this collection of subjects we can perform database queries.\n */\nexport class Subject {\n readonly \"@instanceof\" = Symbol.for(\"Subject\")\n\n // -------------------------------------------------------------------------\n // Properties\n // -------------------------------------------------------------------------\n\n /**\n * Entity metadata of the subject entity.\n */\n metadata: EntityMetadata\n\n /**\n * Subject identifier.\n * This identifier is not limited to table entity primary columns.\n * This can be entity id or ids as well as some unique entity properties, like name or title.\n * Insert / Update / Remove operation will be executed by a given identifier.\n */\n identifier: ObjectLiteral | undefined = undefined\n\n /**\n * Copy of entity but with relational ids fulfilled.\n */\n entityWithFulfilledIds: ObjectLiteral | undefined = undefined\n\n /**\n * If subject was created by cascades this property will contain subject\n * from where this subject was created.\n */\n parentSubject?: Subject\n\n /**\n * Gets entity sent to the persistence (e.g. changed entity).\n * If entity is not set then this subject is created only for the entity loaded from the database,\n * or this subject is used for the junction operation (junction operations are relying only on identifier).\n */\n entity?: ObjectLiteral\n\n /**\n * Database entity.\n * THIS IS NOT RAW ENTITY DATA, its a real entity.\n */\n databaseEntity?: ObjectLiteral\n\n /**\n * Indicates if database entity was loaded.\n * No matter if it was found or not, it indicates the fact of loading.\n */\n databaseEntityLoaded: boolean = false\n\n /**\n * Changes needs to be applied in the database for the given subject.\n */\n changeMaps: SubjectChangeMap[] = []\n\n /**\n * Generated values returned by a database (for example generated id or default values).\n * Used in insert and update operations.\n * Has entity-like structure (not just column database name and values).\n */\n generatedMap?: ObjectLiteral\n\n /**\n * Inserted values with updated values of special and default columns.\n * Has entity-like structure (not just column database name and values).\n */\n insertedValueSet?: ObjectLiteral\n\n /**\n * Indicates if this subject can be inserted into the database.\n * This means that this subject either is newly persisted, either can be inserted by cascades.\n */\n canBeInserted: boolean = false\n\n /**\n * Indicates if this subject can be updated in the database.\n * This means that this subject either was persisted, either can be updated by cascades.\n */\n canBeUpdated: boolean = false\n\n /**\n * Indicates if this subject MUST be removed from the database.\n * This means that this subject either was removed, either was removed by cascades.\n */\n mustBeRemoved: boolean = false\n\n /**\n * Indicates if this subject can be soft-removed from the database.\n * This means that this subject either was soft-removed, either was soft-removed by cascades.\n */\n canBeSoftRemoved: boolean = false\n\n /**\n * Indicates if this subject can be recovered from the database.\n * This means that this subject either was recovered, either was recovered by cascades.\n */\n canBeRecovered: boolean = false\n\n /**\n * Relations updated by the change maps.\n */\n updatedRelationMaps: {\n relation: RelationMetadata\n value: ObjectLiteral\n }[] = []\n\n /**\n * List of updated columns\n */\n diffColumns: ColumnMetadata[] = []\n\n /**\n * List of updated relations\n */\n diffRelations: RelationMetadata[] = []\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(options: {\n metadata: EntityMetadata\n parentSubject?: Subject\n entity?: ObjectLiteral\n canBeInserted?: boolean\n canBeUpdated?: boolean\n mustBeRemoved?: boolean\n canBeSoftRemoved?: boolean\n canBeRecovered?: boolean\n identifier?: ObjectLiteral\n changeMaps?: SubjectChangeMap[]\n }) {\n this.metadata = options.metadata\n this.entity = options.entity\n this.parentSubject = options.parentSubject\n if (options.canBeInserted !== undefined)\n this.canBeInserted = options.canBeInserted\n if (options.canBeUpdated !== undefined)\n this.canBeUpdated = options.canBeUpdated\n if (options.mustBeRemoved !== undefined)\n this.mustBeRemoved = options.mustBeRemoved\n if (options.canBeSoftRemoved !== undefined)\n this.canBeSoftRemoved = options.canBeSoftRemoved\n if (options.canBeRecovered !== undefined)\n this.canBeRecovered = options.canBeRecovered\n if (options.identifier !== undefined)\n this.identifier = options.identifier\n if (options.changeMaps !== undefined)\n this.changeMaps.push(...options.changeMaps)\n\n this.recompute()\n }\n\n // -------------------------------------------------------------------------\n // Accessors\n // -------------------------------------------------------------------------\n\n /**\n * Checks if this subject must be inserted into the database.\n * Subject can be inserted into the database if it is allowed to be inserted (explicitly persisted or by cascades)\n * and if it does not have database entity set.\n */\n get mustBeInserted() {\n return this.canBeInserted && !this.databaseEntity\n }\n\n /**\n * Checks if this subject must be updated into the database.\n * Subject can be updated in the database if it is allowed to be updated (explicitly persisted or by cascades)\n * and if it does have differentiated columns or relations.\n */\n get mustBeUpdated() {\n return (\n this.canBeUpdated &&\n this.identifier &&\n (this.databaseEntityLoaded === false ||\n (this.databaseEntityLoaded && this.databaseEntity)) &&\n // ((this.entity && this.databaseEntity) || (!this.entity && !this.databaseEntity)) &&\n // ensure there are one or more changes for updatable columns\n this.changeMaps.some(\n (change) => !change.column || change.column.isUpdate,\n )\n )\n }\n\n /**\n * Checks if this subject must be soft-removed into the database.\n * Subject can be updated in the database if it is allowed to be soft-removed (explicitly persisted or by cascades)\n * and if it does have differentiated columns or relations.\n */\n get mustBeSoftRemoved() {\n return (\n this.canBeSoftRemoved &&\n this.identifier &&\n (this.databaseEntityLoaded === false ||\n (this.databaseEntityLoaded && this.databaseEntity))\n )\n }\n\n /**\n * Checks if this subject must be recovered into the database.\n * Subject can be updated in the database if it is allowed to be recovered (explicitly persisted or by cascades)\n * and if it does have differentiated columns or relations.\n */\n get mustBeRecovered() {\n return (\n this.canBeRecovered &&\n this.identifier &&\n (this.databaseEntityLoaded === false ||\n (this.databaseEntityLoaded && this.databaseEntity))\n )\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Creates a value set needs to be inserted / updated in the database.\n * Value set is based on the entity and change maps of the subject.\n * Important note: this method pops data from this subject's change maps.\n */\n createValueSetAndPopChangeMap(): ObjectLiteral {\n const changeMapsWithoutValues: SubjectChangeMap[] = []\n const changeSet = this.changeMaps.reduce((updateMap, changeMap) => {\n let value = changeMap.value\n if (InstanceChecker.isSubject(value)) {\n // referenced columns can refer on values both which were just inserted and which were present in the model\n // if entity was just inserted valueSets must contain all values from the entity and values just inserted in the database\n // so, here we check if we have a value set then we simply use it as value to get our reference column values\n // otherwise simply use an entity which cannot be just inserted at the moment and have all necessary data\n value = value.insertedValueSet\n ? value.insertedValueSet\n : value.entity\n }\n // value = changeMap.valueFactory ? changeMap.valueFactory(value) : changeMap.column.createValueMap(value);\n\n let valueMap: ObjectLiteral | undefined\n if (this.metadata.isJunction && changeMap.column) {\n valueMap = changeMap.column.createValueMap(\n changeMap.column.referencedColumn!.getEntityValue(value),\n )\n } else if (changeMap.column) {\n valueMap = changeMap.column.createValueMap(value)\n } else if (changeMap.relation) {\n // value can be a related object, for example: post.question = { id: 1 }\n // or value can be a null or direct relation id, e.g. post.question = 1\n // if its a direction relation id then we just set it to the valueMap,\n // however if its an object then we need to extract its relation id map and set it to the valueMap\n if (ObjectUtils.isObject(value) && !Buffer.isBuffer(value)) {\n // get relation id, e.g. referenced column name and its value,\n // for example: { id: 1 } which then will be set to relation, e.g. post.category = { id: 1 }\n const relationId =\n changeMap.relation!.getRelationIdMap(value)\n\n // but relation id can be empty, for example in the case when you insert a new post with category\n // and both post and category are newly inserted objects (by cascades) and in this case category will not have id\n // this means we need to insert post without question id and update post's questionId once question be inserted\n // that's why we create a new changeMap operation for future updation of the post entity\n if (relationId === undefined) {\n changeMapsWithoutValues.push(changeMap)\n this.canBeUpdated = true\n return updateMap\n }\n valueMap = changeMap.relation!.createValueMap(relationId)\n this.updatedRelationMaps.push({\n relation: changeMap.relation,\n value: relationId,\n })\n } else {\n // value can be \"null\" or direct relation id here\n valueMap = changeMap.relation!.createValueMap(value)\n this.updatedRelationMaps.push({\n relation: changeMap.relation,\n value: value,\n })\n }\n }\n\n OrmUtils.mergeDeep(updateMap, valueMap)\n return updateMap\n }, {} as ObjectLiteral)\n this.changeMaps = changeMapsWithoutValues\n return changeSet\n }\n\n /**\n * Recomputes entityWithFulfilledIds and identifier when entity changes.\n */\n recompute(): void {\n if (this.entity) {\n this.entityWithFulfilledIds = Object.assign({}, this.entity)\n if (this.parentSubject) {\n this.metadata.primaryColumns.forEach((primaryColumn) => {\n if (\n primaryColumn.relationMetadata &&\n primaryColumn.relationMetadata.inverseEntityMetadata ===\n this.parentSubject!.metadata\n ) {\n const value =\n primaryColumn.referencedColumn!.getEntityValue(\n this.parentSubject!.entity!,\n )\n primaryColumn.setEntityValue(\n this.entityWithFulfilledIds!,\n value,\n )\n }\n })\n }\n this.identifier = this.metadata.getEntityIdMap(\n this.entityWithFulfilledIds,\n )\n } else if (this.databaseEntity) {\n this.identifier = this.metadata.getEntityIdMap(this.databaseEntity)\n }\n }\n}\n"],"sourceRoot":".."}