typeorm 0.2.39-dev.cf281ef → 0.2.39-dev.ef33cf4

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 (38) hide show
  1. package/README.md +36 -36
  2. package/browser/decorator/entity-view/ViewEntity.js +1 -0
  3. package/browser/decorator/entity-view/ViewEntity.js.map +1 -1
  4. package/browser/decorator/options/ViewEntityOptions.d.ts +5 -0
  5. package/browser/decorator/options/ViewEntityOptions.js.map +1 -1
  6. package/browser/metadata/EntityMetadata.d.ts +5 -0
  7. package/browser/metadata/EntityMetadata.js +1 -0
  8. package/browser/metadata/EntityMetadata.js.map +1 -1
  9. package/browser/metadata-args/TableMetadataArgs.d.ts +4 -0
  10. package/browser/metadata-args/TableMetadataArgs.js.map +1 -1
  11. package/browser/migration/MigrationExecutor.js +4 -0
  12. package/browser/migration/MigrationExecutor.js.map +1 -1
  13. package/browser/query-builder/transformer/RawSqlResultsToEntityTransformer.js +2 -8
  14. package/browser/query-builder/transformer/RawSqlResultsToEntityTransformer.js.map +1 -1
  15. package/browser/schema-builder/RdbmsSchemaBuilder.js +223 -148
  16. package/browser/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
  17. package/browser/schema-builder/util/ViewUtils.d.ts +7 -0
  18. package/browser/schema-builder/util/ViewUtils.js +25 -0
  19. package/browser/schema-builder/util/ViewUtils.js.map +1 -0
  20. package/decorator/entity-view/ViewEntity.js +1 -0
  21. package/decorator/entity-view/ViewEntity.js.map +1 -1
  22. package/decorator/options/ViewEntityOptions.d.ts +5 -0
  23. package/decorator/options/ViewEntityOptions.js.map +1 -1
  24. package/metadata/EntityMetadata.d.ts +5 -0
  25. package/metadata/EntityMetadata.js +1 -0
  26. package/metadata/EntityMetadata.js.map +1 -1
  27. package/metadata-args/TableMetadataArgs.d.ts +4 -0
  28. package/metadata-args/TableMetadataArgs.js.map +1 -1
  29. package/migration/MigrationExecutor.js +4 -0
  30. package/migration/MigrationExecutor.js.map +1 -1
  31. package/package.json +1 -1
  32. package/query-builder/transformer/RawSqlResultsToEntityTransformer.js +2 -8
  33. package/query-builder/transformer/RawSqlResultsToEntityTransformer.js.map +1 -1
  34. package/schema-builder/RdbmsSchemaBuilder.js +222 -147
  35. package/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
  36. package/schema-builder/util/ViewUtils.d.ts +7 -0
  37. package/schema-builder/util/ViewUtils.js +28 -0
  38. package/schema-builder/util/ViewUtils.js.map +1 -0
package/README.md CHANGED
@@ -41,42 +41,42 @@ TypeORM is highly influenced by other ORMs, such as [Hibernate](http://hibernate
41
41
 
42
42
  ## Features
43
43
 
44
- * supports both [DataMapper](./docs/active-record-data-mapper.md#what-is-the-data-mapper-pattern) and [ActiveRecord](./docs/active-record-data-mapper.md#what-is-the-active-record-pattern) (your choice)
45
- * entities and columns
46
- * database-specific column types
47
- * entity manager
48
- * repositories and custom repositories
49
- * clean object relational model
50
- * associations (relations)
51
- * eager and lazy relations
52
- * uni-directional, bi-directional and self-referenced relations
53
- * supports multiple inheritance patterns
54
- * cascades
55
- * indices
56
- * transactions
57
- * migrations and automatic migrations generation
58
- * connection pooling
59
- * replication
60
- * using multiple database connections
61
- * working with multiple databases types
62
- * cross-database and cross-schema queries
63
- * elegant-syntax, flexible and powerful QueryBuilder
64
- * left and inner joins
65
- * proper pagination for queries using joins
66
- * query caching
67
- * streaming raw results
68
- * logging
69
- * listeners and subscribers (hooks)
70
- * supports closure table pattern
71
- * schema declaration in models or separate configuration files
72
- * connection configuration in json / xml / yml / env formats
73
- * supports MySQL / MariaDB / Postgres / CockroachDB / SQLite / Microsoft SQL Server / Oracle / SAP Hana / sql.js
74
- * supports MongoDB NoSQL database
75
- * works in NodeJS / Browser / Ionic / Cordova / React Native / NativeScript / Expo / Electron platforms
76
- * TypeScript and JavaScript support
77
- * produced code is performant, flexible, clean and maintainable
78
- * follows all possible best practices
79
- * CLI
44
+ * Supports both [DataMapper](./docs/active-record-data-mapper.md#what-is-the-data-mapper-pattern) and [ActiveRecord](./docs/active-record-data-mapper.md#what-is-the-active-record-pattern) (your choice).
45
+ * Entities and columns.
46
+ * Database-specific column types.
47
+ * Entity manager.
48
+ * Repositories and custom repositories.
49
+ * Clean object relational model.
50
+ * Associations (relations).
51
+ * Eager and lazy relations.
52
+ * Uni-directional, bi-directional and self-referenced relations.
53
+ * Supports multiple inheritance patterns.
54
+ * Cascades.
55
+ * Indices.
56
+ * Transactions.
57
+ * Migrations and automatic migrations generation.
58
+ * Connection pooling.
59
+ * Replication.
60
+ * Using multiple database connections.
61
+ * Working with multiple databases types.
62
+ * Cross-database and cross-schema queries.
63
+ * Elegant-syntax, flexible and powerful QueryBuilder.
64
+ * Left and inner joins.
65
+ * Proper pagination for queries using joins.
66
+ * Query caching.
67
+ * Streaming raw results.
68
+ * Logging.
69
+ * Listeners and subscribers (hooks).
70
+ * Supports closure table pattern.
71
+ * Schema declaration in models or separate configuration files.
72
+ * Connection configuration in json / xml / yml / env formats.
73
+ * Supports MySQL / MariaDB / Postgres / CockroachDB / SQLite / Microsoft SQL Server / Oracle / SAP Hana / sql.js.
74
+ * Supports MongoDB NoSQL database.
75
+ * Works in NodeJS / Browser / Ionic / Cordova / React Native / NativeScript / Expo / Electron platforms.
76
+ * TypeScript and JavaScript support.
77
+ * Produced code is performant, flexible, clean and maintainable.
78
+ * Follows all possible best practices.
79
+ * CLI.
80
80
 
81
81
  And more...
82
82
 
@@ -11,6 +11,7 @@ export function ViewEntity(nameOrOptions, maybeOptions) {
11
11
  target: target,
12
12
  name: name,
13
13
  expression: options.expression,
14
+ dependsOn: options.dependsOn ? new Set(options.dependsOn) : undefined,
14
15
  type: "view",
15
16
  database: options.database ? options.database : undefined,
16
17
  schema: options.schema ? options.schema : undefined,
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/decorator/entity-view/ViewEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,sBAAsB,EAAC,MAAM,eAAe,CAAC;AAgBrD;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,aAAwC,EAAE,YAAgC;IACjG,IAAM,OAAO,GAAG,CAAC,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAkC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;IAC9G,IAAM,IAAI,GAAG,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;IAE9E,OAAO,UAAU,MAAgB;QAC7B,sBAAsB,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC;YACjC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;YACzD,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;YACnD,WAAW,EAAE,OAAO,CAAC,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;YACzD,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY;SAClB,CAAC,CAAC;IAC5B,CAAC,CAAC;AACN,CAAC","file":"ViewEntity.js","sourcesContent":["import {getMetadataArgsStorage} from \"../../globals\";\nimport {TableMetadataArgs} from \"../../metadata-args/TableMetadataArgs\";\nimport {ViewEntityOptions} from \"../options/ViewEntityOptions\";\n\n/**\n * This decorator is used to mark classes that will be an entity view.\n * Database schema will be created for all classes decorated with it, and Repository can be retrieved and used for it.\n */\nexport function ViewEntity(options?: ViewEntityOptions): ClassDecorator;\n\n/**\n * This decorator is used to mark classes that will be an entity view.\n * Database schema will be created for all classes decorated with it, and Repository can be retrieved and used for it.\n */\nexport function ViewEntity(name?: string, options?: ViewEntityOptions): ClassDecorator;\n\n/**\n * This decorator is used to mark classes that will be an entity view.\n * Database schema will be created for all classes decorated with it, and Repository can be retrieved and used for it.\n */\nexport function ViewEntity(nameOrOptions?: string|ViewEntityOptions, maybeOptions?: ViewEntityOptions): ClassDecorator {\n const options = (typeof nameOrOptions === \"object\" ? nameOrOptions as ViewEntityOptions : maybeOptions) || {};\n const name = typeof nameOrOptions === \"string\" ? nameOrOptions : options.name;\n\n return function (target: Function) {\n getMetadataArgsStorage().tables.push({\n target: target,\n name: name,\n expression: options.expression,\n type: \"view\",\n database: options.database ? options.database : undefined,\n schema: options.schema ? options.schema : undefined,\n synchronize: options.synchronize === false ? false : true,\n materialized: !!options.materialized\n } as TableMetadataArgs);\n };\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/decorator/entity-view/ViewEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,sBAAsB,EAAC,MAAM,eAAe,CAAC;AAgBrD;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,aAAwC,EAAE,YAAgC;IACjG,IAAM,OAAO,GAAG,CAAC,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAkC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;IAC9G,IAAM,IAAI,GAAG,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;IAE9E,OAAO,UAAU,MAAgB;QAC7B,sBAAsB,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC;YACjC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS;YACrE,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;YACzD,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;YACnD,WAAW,EAAE,OAAO,CAAC,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;YACzD,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY;SAClB,CAAC,CAAC;IAC5B,CAAC,CAAC;AACN,CAAC","file":"ViewEntity.js","sourcesContent":["import {getMetadataArgsStorage} from \"../../globals\";\nimport {TableMetadataArgs} from \"../../metadata-args/TableMetadataArgs\";\nimport {ViewEntityOptions} from \"../options/ViewEntityOptions\";\n\n/**\n * This decorator is used to mark classes that will be an entity view.\n * Database schema will be created for all classes decorated with it, and Repository can be retrieved and used for it.\n */\nexport function ViewEntity(options?: ViewEntityOptions): ClassDecorator;\n\n/**\n * This decorator is used to mark classes that will be an entity view.\n * Database schema will be created for all classes decorated with it, and Repository can be retrieved and used for it.\n */\nexport function ViewEntity(name?: string, options?: ViewEntityOptions): ClassDecorator;\n\n/**\n * This decorator is used to mark classes that will be an entity view.\n * Database schema will be created for all classes decorated with it, and Repository can be retrieved and used for it.\n */\nexport function ViewEntity(nameOrOptions?: string|ViewEntityOptions, maybeOptions?: ViewEntityOptions): ClassDecorator {\n const options = (typeof nameOrOptions === \"object\" ? nameOrOptions as ViewEntityOptions : maybeOptions) || {};\n const name = typeof nameOrOptions === \"string\" ? nameOrOptions : options.name;\n\n return function (target: Function) {\n getMetadataArgsStorage().tables.push({\n target: target,\n name: name,\n expression: options.expression,\n dependsOn: options.dependsOn ? new Set(options.dependsOn) : undefined,\n type: \"view\",\n database: options.database ? options.database : undefined,\n schema: options.schema ? options.schema : undefined,\n synchronize: options.synchronize === false ? false : true,\n materialized: !!options.materialized\n } as TableMetadataArgs);\n };\n}\n"],"sourceRoot":"../.."}
@@ -31,4 +31,9 @@ export interface ViewEntityOptions {
31
31
  * It's supported by Postgres and Oracle.
32
32
  */
33
33
  materialized?: boolean;
34
+ /**
35
+ * View dependencies. In case the view depends on another view it can be listed here
36
+ * to ensure correct order of view migrations.
37
+ */
38
+ dependsOn?: (Function | string)[];
34
39
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/decorator/options/ViewEntityOptions.ts"],"names":[],"mappings":"","file":"ViewEntityOptions.js","sourcesContent":["/**\n * Describes all entity view's options.\n */\nimport {Connection, SelectQueryBuilder} from \"../..\";\n\nexport interface ViewEntityOptions {\n\n /**\n * View name.\n * If not specified then naming strategy will generate view name from class name.\n */\n name?: string;\n\n /**\n * View expression.\n */\n expression?: string|((connection: Connection) => SelectQueryBuilder<any>);\n\n /**\n * Database name. Used in Mysql and Sql Server.\n */\n database?: string;\n\n /**\n * Schema name. Used in Postgres and Sql Server.\n */\n schema?: string;\n\n /**\n * Indicates if schema synchronization is enabled or disabled for this entity.\n * If it will be set to false then schema sync will and migrations ignore this entity.\n * By default schema synchronization is enabled for all entities.\n */\n synchronize?: boolean;\n\n /**\n * Indicates if view should be materialized view.\n * It's supported by Postgres and Oracle.\n */\n materialized?: boolean;\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/decorator/options/ViewEntityOptions.ts"],"names":[],"mappings":"","file":"ViewEntityOptions.js","sourcesContent":["/**\n * Describes all entity view's options.\n */\nimport {Connection, SelectQueryBuilder} from \"../..\";\n\nexport interface ViewEntityOptions {\n\n /**\n * View name.\n * If not specified then naming strategy will generate view name from class name.\n */\n name?: string;\n\n /**\n * View expression.\n */\n expression?: string|((connection: Connection) => SelectQueryBuilder<any>);\n\n /**\n * Database name. Used in Mysql and Sql Server.\n */\n database?: string;\n\n /**\n * Schema name. Used in Postgres and Sql Server.\n */\n schema?: string;\n\n /**\n * Indicates if schema synchronization is enabled or disabled for this entity.\n * If it will be set to false then schema sync will and migrations ignore this entity.\n * By default schema synchronization is enabled for all entities.\n */\n synchronize?: boolean;\n\n /**\n * Indicates if view should be materialized view.\n * It's supported by Postgres and Oracle.\n */\n materialized?: boolean;\n\n /**\n * View dependencies. In case the view depends on another view it can be listed here\n * to ensure correct order of view migrations.\n */\n dependsOn?: (Function|string)[];\n}\n"],"sourceRoot":"../.."}
@@ -77,6 +77,11 @@ export declare class EntityMetadata {
77
77
  * Used in views
78
78
  */
79
79
  expression?: string | ((connection: Connection) => SelectQueryBuilder<any>);
80
+ /**
81
+ * View's dependencies.
82
+ * Used in views
83
+ */
84
+ dependsOn?: Set<Function | string>;
80
85
  /**
81
86
  * Enables Sqlite "WITHOUT ROWID" modifier for the "CREATE TABLE" statement
82
87
  */
@@ -234,6 +234,7 @@ var EntityMetadata = /** @class */ (function () {
234
234
  this.tableType = this.tableMetadataArgs.type;
235
235
  this.expression = this.tableMetadataArgs.expression;
236
236
  this.withoutRowid = this.tableMetadataArgs.withoutRowid;
237
+ this.dependsOn = this.tableMetadataArgs.dependsOn;
237
238
  }
238
239
  // -------------------------------------------------------------------------
239
240
  // Public Methods
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/metadata/EntityMetadata.ts"],"names":[],"mappings":";AAGA,OAAO,EAAC,4BAA4B,EAAC,MAAM,uCAAuC,CAAC;AAInF,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAC,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAgB5C;;GAEG;AACH;IA8cI,wEAAwE;IACxE,cAAc;IACd,wEAAwE;IAExE,wBAAY,OAOX;QA1bD;;WAEG;QACH,yBAAoB,GAAqB,EAAE,CAAC;QAE5C;;;;WAIG;QACH,oBAAe,GAAe,EAAE,CAAC;QAEjC;;WAEG;QACH,cAAS,GAAc,SAAS,CAAC;QA2BjC;;WAEG;QACH,iBAAY,GAAa,KAAK,CAAC;QA8B/B;;WAEG;QACH,gBAAW,GAAY,IAAI,CAAC;QA4B5B;;WAEG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C,OAAO,CAAC,UAAA,QAAQ,IAAI,OAAA,QAAQ,CAAC,SAAS,CAAC,GAAG,EAAE,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,EAAvE,CAAuE,CAAC,CAAC;QAC5G,OAAO,GAAG,CAAC;IACf,CAAC;IACL,qBAAC;AAAD,CA70BA,AA60BC,IAAA","file":"EntityMetadata.js","sourcesContent":["import {QueryRunner, SelectQueryBuilder} from \"..\";\nimport {ObjectLiteral} from \"../common/ObjectLiteral\";\nimport {Connection} from \"../connection/Connection\";\nimport {CannotCreateEntityIdMapError} from \"../error/CannotCreateEntityIdMapError\";\nimport {OrderByCondition} from \"../find-options/OrderByCondition\";\nimport {TableMetadataArgs} from \"../metadata-args/TableMetadataArgs\";\nimport {TreeMetadataArgs} from \"../metadata-args/TreeMetadataArgs\";\nimport {OrmUtils} from \"../util/OrmUtils\";\nimport {shorten} from \"../util/StringUtils\";\nimport {CheckMetadata} from \"./CheckMetadata\";\nimport {ColumnMetadata} from \"./ColumnMetadata\";\nimport {EmbeddedMetadata} from \"./EmbeddedMetadata\";\nimport {EntityListenerMetadata} from \"./EntityListenerMetadata\";\nimport {ExclusionMetadata} from \"./ExclusionMetadata\";\nimport {ForeignKeyMetadata} from \"./ForeignKeyMetadata\";\nimport {IndexMetadata} from \"./IndexMetadata\";\nimport {RelationCountMetadata} from \"./RelationCountMetadata\";\nimport {RelationIdMetadata} from \"./RelationIdMetadata\";\nimport {RelationMetadata} from \"./RelationMetadata\";\nimport {TableType} from \"./types/TableTypes\";\nimport {TreeType} from \"./types/TreeTypes\";\nimport {UniqueMetadata} from \"./UniqueMetadata\";\nimport {ClosureTreeOptions} from \"./types/ClosureTreeOptions\";\n\n/**\n * Contains all entity metadata.\n */\nexport class EntityMetadata {\n\n // -------------------------------------------------------------------------\n // Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection where this entity metadata is created.\n */\n connection: Connection;\n\n /**\n * Metadata arguments used to build this entity metadata.\n */\n tableMetadataArgs: TableMetadataArgs;\n\n /**\n * If entity's table is a closure-typed table, then this entity will have a closure junction table metadata.\n */\n closureJunctionTable: EntityMetadata;\n\n /**\n * If this is entity metadata for a junction closure table then its owner closure table metadata will be set here.\n */\n parentClosureEntityMetadata: EntityMetadata;\n\n /**\n * Parent's entity metadata. Used in inheritance patterns.\n */\n parentEntityMetadata: EntityMetadata;\n\n /**\n * Children entity metadatas. Used in inheritance patterns.\n */\n childEntityMetadatas: EntityMetadata[] = [];\n\n /**\n * All \"inheritance tree\" from a target entity.\n * For example for target Post < ContentModel < Unit it will be an array of [Post, ContentModel, Unit].\n * It also contains child entities for single table inheritance.\n */\n inheritanceTree: Function[] = [];\n\n /**\n * Table type. Tables can be closure, junction, etc.\n */\n tableType: TableType = \"regular\";\n\n /**\n * Target class to which this entity metadata is bind.\n * Note, that when using table inheritance patterns target can be different rather then table's target.\n * For virtual tables which lack of real entity (like junction tables) target is equal to their table name.\n */\n target: Function|string;\n\n /**\n * Gets the name of the target.\n */\n targetName: string;\n\n /**\n * Entity's name.\n * Equal to entity target class's name if target is set to table.\n * If target class is not then then it equals to table name.\n */\n name: string;\n\n /**\n * View's expression.\n * Used in views\n */\n expression?: string|((connection: Connection) => SelectQueryBuilder<any>);\n\n /**\n * Enables Sqlite \"WITHOUT ROWID\" modifier for the \"CREATE TABLE\" statement\n */\n withoutRowid?: boolean = false;\n\n /**\n * Original user-given table name (taken from schema or @Entity(tableName) decorator).\n * If user haven't specified a table name this property will be undefined.\n */\n givenTableName?: string;\n\n /**\n * Entity table name in the database.\n * This is final table name of the entity.\n * This name already passed naming strategy, and generated based on\n * multiple criteria, including user table name and global table prefix.\n */\n tableName: string;\n\n /**\n * Entity table path. Contains database name, schema name and table name.\n * E.g. myDB.mySchema.myTable\n */\n tablePath: string;\n\n /**\n * Gets the table name without global table prefix.\n * When querying table you need a table name with prefix, but in some scenarios,\n * for example when you want to name a junction table that contains names of two other tables,\n * you may want a table name without prefix.\n */\n tableNameWithoutPrefix: string;\n\n /**\n * Indicates if schema will be synchronized for this entity or not.\n */\n synchronize: boolean = true;\n\n /**\n * Table's database engine type (like \"InnoDB\", \"MyISAM\", etc).\n */\n engine?: string;\n\n /**\n * Database name.\n */\n database?: string;\n\n /**\n * Schema name. Used in Postgres and Sql Server.\n */\n schema?: string;\n\n /**\n * Specifies a default order by used for queries from this table when no explicit order by is specified.\n */\n orderBy?: OrderByCondition;\n\n /**\n * If this entity metadata's table using one of the inheritance patterns,\n * then this will contain what pattern it uses.\n */\n inheritancePattern?: \"STI\"/*|\"CTI\"*/;\n\n /**\n * Checks if there any non-nullable column exist in this entity.\n */\n hasNonNullableRelations: boolean = false;\n\n /**\n * Indicates if this entity metadata of a junction table, or not.\n * Junction table is a table created by many-to-many relationship.\n *\n * Its also possible to understand if entity is junction via tableType.\n */\n isJunction: boolean = false;\n\n /**\n * Indicates if the entity should be instantiated using the constructor\n * or via allocating a new object via `Object.create()`.\n */\n isAlwaysUsingConstructor: boolean = true;\n\n /**\n * Indicates if this entity is a tree, what type of tree it is.\n */\n treeType?: TreeType;\n\n /**\n * Indicates if this entity is a tree, what options of tree it has.\n */\n treeOptions?: ClosureTreeOptions;\n\n /**\n * Checks if this table is a junction table of the closure table.\n * This type is for tables that contain junction metadata of the closure tables.\n */\n isClosureJunction: boolean = false;\n\n /**\n * Checks if entity's table has multiple primary columns.\n */\n hasMultiplePrimaryKeys: boolean = false;\n\n /**\n * Indicates if this entity metadata has uuid generated columns.\n */\n hasUUIDGeneratedColumns: boolean = false;\n\n /**\n * If this entity metadata is a child table of some table, it should have a discriminator value.\n * Used to store a value in a discriminator column.\n */\n discriminatorValue?: string;\n\n /**\n * Entity's column metadatas defined by user.\n */\n ownColumns: ColumnMetadata[] = [];\n\n /**\n * Columns of the entity, including columns that are coming from the embeddeds of this entity.\n */\n columns: ColumnMetadata[] = [];\n\n /**\n * Ancestor columns used only in closure junction tables.\n */\n ancestorColumns: ColumnMetadata[] = [];\n\n /**\n * Descendant columns used only in closure junction tables.\n */\n descendantColumns: ColumnMetadata[] = [];\n\n /**\n * All columns except for virtual columns.\n */\n nonVirtualColumns: ColumnMetadata[] = [];\n\n /**\n * In the case if this entity metadata is junction table's entity metadata,\n * this will contain all referenced columns of owner entity.\n */\n ownerColumns: ColumnMetadata[] = [];\n\n /**\n * In the case if this entity metadata is junction table's entity metadata,\n * this will contain all referenced columns of inverse entity.\n */\n inverseColumns: ColumnMetadata[] = [];\n\n /**\n * Gets the column with generated flag.\n */\n generatedColumns: ColumnMetadata[] = [];\n\n /**\n * Gets the object id column used with mongodb database.\n */\n objectIdColumn?: ColumnMetadata;\n\n /**\n * Gets entity column which contains a create date value.\n */\n createDateColumn?: ColumnMetadata;\n\n /**\n * Gets entity column which contains an update date value.\n */\n updateDateColumn?: ColumnMetadata;\n\n /**\n * Gets entity column which contains a delete date value.\n */\n deleteDateColumn?: ColumnMetadata;\n\n /**\n * Gets entity column which contains an entity version.\n */\n versionColumn?: ColumnMetadata;\n\n /**\n * Gets the discriminator column used to store entity identificator in single-table inheritance tables.\n */\n discriminatorColumn?: ColumnMetadata;\n\n /**\n * Special column that stores tree level in tree entities.\n */\n treeLevelColumn?: ColumnMetadata;\n\n /**\n * Nested set's left value column.\n * Used only in tree entities with nested set pattern applied.\n */\n nestedSetLeftColumn?: ColumnMetadata;\n\n /**\n * Nested set's right value column.\n * Used only in tree entities with nested set pattern applied.\n */\n nestedSetRightColumn?: ColumnMetadata;\n\n /**\n * Materialized path column.\n * Used only in tree entities with materialized path pattern applied.\n */\n materializedPathColumn?: ColumnMetadata;\n\n /**\n * Gets the primary columns.\n */\n primaryColumns: ColumnMetadata[] = [];\n\n /**\n * Entity's relation metadatas.\n */\n ownRelations: RelationMetadata[] = [];\n\n /**\n * Relations of the entity, including relations that are coming from the embeddeds of this entity.\n */\n relations: RelationMetadata[] = [];\n\n /**\n * List of eager relations this metadata has.\n */\n eagerRelations: RelationMetadata[] = [];\n\n /**\n * List of eager relations this metadata has.\n */\n lazyRelations: RelationMetadata[] = [];\n\n /**\n * Gets only one-to-one relations of the entity.\n */\n oneToOneRelations: RelationMetadata[] = [];\n\n /**\n * Gets only owner one-to-one relations of the entity.\n */\n ownerOneToOneRelations: RelationMetadata[] = [];\n\n /**\n * Gets only one-to-many relations of the entity.\n */\n oneToManyRelations: RelationMetadata[] = [];\n\n /**\n * Gets only many-to-one relations of the entity.\n */\n manyToOneRelations: RelationMetadata[] = [];\n\n /**\n * Gets only many-to-many relations of the entity.\n */\n manyToManyRelations: RelationMetadata[] = [];\n\n /**\n * Gets only owner many-to-many relations of the entity.\n */\n ownerManyToManyRelations: RelationMetadata[] = [];\n\n /**\n * Gets only owner one-to-one and many-to-one relations.\n */\n relationsWithJoinColumns: RelationMetadata[] = [];\n\n /**\n * Tree parent relation. Used only in tree-tables.\n */\n treeParentRelation?: RelationMetadata;\n\n /**\n * Tree children relation. Used only in tree-tables.\n */\n treeChildrenRelation?: RelationMetadata;\n\n /**\n * Entity's relation id metadatas.\n */\n relationIds: RelationIdMetadata[] = [];\n\n /**\n * Entity's relation id metadatas.\n */\n relationCounts: RelationCountMetadata[] = [];\n\n /**\n * Entity's foreign key metadatas.\n */\n foreignKeys: ForeignKeyMetadata[] = [];\n\n /**\n * Entity's embedded metadatas.\n */\n embeddeds: EmbeddedMetadata[] = [];\n\n /**\n * All embeddeds - embeddeds from this entity metadata and from all child embeddeds, etc.\n */\n allEmbeddeds: EmbeddedMetadata[] = [];\n\n /**\n * Entity's own indices.\n */\n ownIndices: IndexMetadata[] = [];\n\n /**\n * Entity's index metadatas.\n */\n indices: IndexMetadata[] = [];\n\n /**\n * Entity's unique metadatas.\n */\n uniques: UniqueMetadata[] = [];\n\n /**\n * Entity's own uniques.\n */\n ownUniques: UniqueMetadata[] = [];\n\n /**\n * Entity's check metadatas.\n */\n checks: CheckMetadata[] = [];\n\n /**\n * Entity's exclusion metadatas.\n */\n exclusions: ExclusionMetadata[] = [];\n\n /**\n * Entity's own listener metadatas.\n */\n ownListeners: EntityListenerMetadata[] = [];\n\n /**\n * Entity listener metadatas.\n */\n listeners: EntityListenerMetadata[] = [];\n\n /**\n * Listener metadatas with \"AFTER LOAD\" type.\n */\n afterLoadListeners: EntityListenerMetadata[] = [];\n\n /**\n * Listener metadatas with \"AFTER INSERT\" type.\n */\n beforeInsertListeners: EntityListenerMetadata[] = [];\n\n /**\n * Listener metadatas with \"AFTER INSERT\" type.\n */\n afterInsertListeners: EntityListenerMetadata[] = [];\n\n /**\n * Listener metadatas with \"AFTER UPDATE\" type.\n */\n beforeUpdateListeners: EntityListenerMetadata[] = [];\n\n /**\n * Listener metadatas with \"AFTER UPDATE\" type.\n */\n afterUpdateListeners: EntityListenerMetadata[] = [];\n\n /**\n * Listener metadatas with \"AFTER REMOVE\" type.\n */\n beforeRemoveListeners: EntityListenerMetadata[] = [];\n\n /**\n * Listener metadatas with \"AFTER REMOVE\" type.\n */\n afterRemoveListeners: EntityListenerMetadata[] = [];\n\n /**\n * Map of columns and relations of the entity.\n *\n * example: Post{ id: number, name: string, counterEmbed: { count: number }, category: Category }.\n * This method will create following object:\n * { id: \"id\", counterEmbed: { count: \"counterEmbed.count\" }, category: \"category\" }\n */\n propertiesMap: ObjectLiteral;\n\n // ---------------------------------------------------------------------\n // Constructor\n // ---------------------------------------------------------------------\n\n constructor(options: {\n connection: Connection,\n inheritanceTree?: Function[],\n inheritancePattern?: \"STI\"/*|\"CTI\"*/,\n tableTree?: TreeMetadataArgs,\n parentClosureEntityMetadata?: EntityMetadata,\n args: TableMetadataArgs\n }) {\n this.connection = options.connection;\n this.inheritanceTree = options.inheritanceTree || [];\n this.inheritancePattern = options.inheritancePattern;\n this.treeType = options.tableTree ? options.tableTree.type : undefined;\n this.treeOptions = options.tableTree ? options.tableTree.options : undefined;\n this.parentClosureEntityMetadata = options.parentClosureEntityMetadata!;\n this.tableMetadataArgs = options.args;\n this.target = this.tableMetadataArgs.target;\n this.tableType = this.tableMetadataArgs.type;\n this.expression = this.tableMetadataArgs.expression;\n this.withoutRowid = this.tableMetadataArgs.withoutRowid;\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Creates a new entity.\n */\n create(queryRunner?: QueryRunner, options?: { fromDeserializer?: boolean }): any {\n // if target is set to a function (e.g. class) that can be created then create it\n let ret: any;\n if (this.target instanceof Function) {\n if (!options?.fromDeserializer || this.isAlwaysUsingConstructor) {\n ret = new (<any> this.target)();\n } else {\n ret = Object.create(this.target.prototype);\n }\n\n this.lazyRelations.forEach(relation => this.connection.relationLoader.enableLazyLoad(relation, ret, queryRunner));\n return ret;\n }\n\n // otherwise simply return a new empty object\n const newObject = {};\n this.lazyRelations.forEach(relation => this.connection.relationLoader.enableLazyLoad(relation, newObject, queryRunner));\n return newObject;\n }\n\n /**\n * Checks if given entity has an id.\n */\n hasId(entity: ObjectLiteral): boolean {\n if (!entity)\n return false;\n\n return this.primaryColumns.every(primaryColumn => {\n const value = primaryColumn.getEntityValue(entity);\n return value !== null && value !== undefined && value !== \"\";\n });\n }\n\n /**\n * Checks if given entity / object contains ALL primary keys entity must have.\n * Returns true if it contains all of them, false if at least one of them is not defined.\n */\n hasAllPrimaryKeys(entity: ObjectLiteral): boolean {\n return this.primaryColumns.every(primaryColumn => {\n const value = primaryColumn.getEntityValue(entity);\n return value !== null && value !== undefined;\n });\n }\n\n /**\n * Ensures that given object is an entity id map.\n * If given id is an object then it means its already id map.\n * If given id isn't an object then it means its a value of the id column\n * and it creates a new id map with this value and name of the primary column.\n */\n ensureEntityIdMap(id: any): ObjectLiteral {\n if (id instanceof Object)\n return id;\n\n if (this.hasMultiplePrimaryKeys)\n throw new CannotCreateEntityIdMapError(this, id);\n\n return this.primaryColumns[0].createValueMap(id);\n }\n\n /**\n * Gets primary keys of the entity and returns them in a literal object.\n * For example, for Post{ id: 1, title: \"hello\" } where id is primary it will return { id: 1 }\n * For multiple primary keys it returns multiple keys in object.\n * For primary keys inside embeds it returns complex object literal with keys in them.\n */\n getEntityIdMap(entity: ObjectLiteral|undefined): ObjectLiteral|undefined {\n if (!entity)\n return undefined;\n\n return EntityMetadata.getValueMap(entity, this.primaryColumns, { skipNulls: true });\n }\n\n /**\n * Creates a \"mixed id map\".\n * If entity has multiple primary keys (ids) then it will return just regular id map, like what getEntityIdMap returns.\n * But if entity has a single primary key then it will return just value of the id column of the entity, just value.\n * This is called mixed id map.\n */\n getEntityIdMixedMap(entity: ObjectLiteral|undefined): ObjectLiteral|undefined {\n if (!entity)\n return entity;\n\n const idMap = this.getEntityIdMap(entity);\n if (this.hasMultiplePrimaryKeys) {\n return idMap;\n\n } else if (idMap) {\n return this.primaryColumns[0].getEntityValue(idMap); // todo: what about parent primary column?\n }\n\n return idMap;\n }\n\n /**\n * Compares two different entities by their ids.\n * Returns true if they match, false otherwise.\n */\n compareEntities(firstEntity: ObjectLiteral, secondEntity: ObjectLiteral): boolean {\n\n const firstEntityIdMap = this.getEntityIdMap(firstEntity);\n if (!firstEntityIdMap) return false;\n\n const secondEntityIdMap = this.getEntityIdMap(secondEntity);\n if (!secondEntityIdMap) return false;\n\n return OrmUtils.compareIds(firstEntityIdMap, secondEntityIdMap);\n }\n\n /**\n * Finds column with a given property name.\n */\n findColumnWithPropertyName(propertyName: string): ColumnMetadata|undefined {\n return this.columns.find(column => column.propertyName === propertyName);\n }\n\n /**\n * Finds column with a given database name.\n */\n findColumnWithDatabaseName(databaseName: string): ColumnMetadata|undefined {\n return this.columns.find(column => column.databaseName === databaseName);\n }\n\n /**\n * Checks if there is a column or relationship with a given property path.\n */\n hasColumnWithPropertyPath(propertyPath: string): boolean {\n const hasColumn = this.columns.some(column => column.propertyPath === propertyPath);\n return hasColumn || this.hasRelationWithPropertyPath(propertyPath);\n }\n\n /**\n * Finds column with a given property path.\n */\n findColumnWithPropertyPath(propertyPath: string): ColumnMetadata|undefined {\n const column = this.columns.find(column => column.propertyPath === propertyPath);\n if (column)\n return column;\n\n // in the case if column with property path was not found, try to find a relation with such property path\n // if we find relation and it has a single join column then its the column user was seeking\n const relation = this.relations.find(relation => relation.propertyPath === propertyPath);\n if (relation && relation.joinColumns.length === 1)\n return relation.joinColumns[0];\n\n return undefined;\n }\n\n /**\n * Finds columns with a given property path.\n * Property path can match a relation, and relations can contain multiple columns.\n */\n findColumnsWithPropertyPath(propertyPath: string): ColumnMetadata[] {\n const column = this.columns.find(column => column.propertyPath === propertyPath);\n if (column)\n return [column];\n\n // in the case if column with property path was not found, try to find a relation with such property path\n // if we find relation and it has a single join column then its the column user was seeking\n const relation = this.findRelationWithPropertyPath(propertyPath);\n if (relation && relation.joinColumns)\n return relation.joinColumns;\n\n return [];\n }\n\n /**\n * Checks if there is a relation with the given property path.\n */\n hasRelationWithPropertyPath(propertyPath: string): boolean {\n return this.relations.some(relation => relation.propertyPath === propertyPath);\n }\n\n /**\n * Finds relation with the given property path.\n */\n findRelationWithPropertyPath(propertyPath: string): RelationMetadata|undefined {\n return this.relations.find(relation => relation.propertyPath === propertyPath);\n }\n\n /**\n * Checks if there is an embedded with a given property path.\n */\n hasEmbeddedWithPropertyPath(propertyPath: string): boolean {\n return this.allEmbeddeds.some(embedded => embedded.propertyPath === propertyPath);\n }\n\n /**\n * Finds embedded with a given property path.\n */\n findEmbeddedWithPropertyPath(propertyPath: string): EmbeddedMetadata|undefined {\n return this.allEmbeddeds.find(embedded => embedded.propertyPath === propertyPath);\n }\n\n /**\n * Iterates through entity and finds and extracts all values from relations in the entity.\n * If relation value is an array its being flattened.\n */\n extractRelationValuesFromEntity(entity: ObjectLiteral, relations: RelationMetadata[]): [RelationMetadata, any, EntityMetadata][] {\n const relationsAndValues: [RelationMetadata, any, EntityMetadata][] = [];\n relations.forEach(relation => {\n const value = relation.getEntityValue(entity);\n if (Array.isArray(value)) {\n value.forEach(subValue => relationsAndValues.push([relation, subValue, this.getInverseEntityMetadata(subValue, relation)]));\n } else if (value) {\n relationsAndValues.push([relation, value, this.getInverseEntityMetadata(value, relation)]);\n }\n });\n return relationsAndValues;\n }\n\n private getInverseEntityMetadata(value: any, relation: RelationMetadata): EntityMetadata {\n const childEntityMetadata = relation.inverseEntityMetadata.childEntityMetadatas.find(metadata =>\n metadata.target === value.constructor\n );\n return childEntityMetadata ? childEntityMetadata : relation.inverseEntityMetadata;\n }\n\n // -------------------------------------------------------------------------\n // Public Static Methods\n // -------------------------------------------------------------------------\n\n /**\n * Creates a property paths for a given entity.\n *\n * @deprecated\n */\n static createPropertyPath(metadata: EntityMetadata, entity: ObjectLiteral, prefix: string = \"\") {\n const paths: string[] = [];\n Object.keys(entity).forEach(key => {\n\n // check for function is needed in the cases when createPropertyPath used on values containg a function as a value\n // example: .update().set({ name: () => `SUBSTR('', 1, 2)` })\n const parentPath = prefix ? prefix + \".\" + key : key;\n if (metadata.hasEmbeddedWithPropertyPath(parentPath)) {\n const subPaths = this.createPropertyPath(metadata, entity[key], parentPath);\n paths.push(...subPaths);\n } else {\n const path = prefix ? prefix + \".\" + key : key;\n paths.push(path);\n }\n });\n return paths;\n }\n\n /**\n * Finds difference between two entity id maps.\n * Returns items that exist in the first array and absent in the second array.\n */\n static difference(firstIdMaps: ObjectLiteral[], secondIdMaps: ObjectLiteral[]): ObjectLiteral[] {\n return firstIdMaps.filter(firstIdMap => {\n return !secondIdMaps.find(secondIdMap => OrmUtils.compareIds(firstIdMap, secondIdMap));\n });\n }\n\n /**\n * Creates value map from the given values and columns.\n * Examples of usages are primary columns map and join columns map.\n */\n static getValueMap(entity: ObjectLiteral, columns: ColumnMetadata[], options?: { skipNulls?: boolean }): ObjectLiteral|undefined {\n return columns.reduce((map, column) => {\n const value = column.getEntityValueMap(entity, options);\n\n // make sure that none of the values of the columns are not missing\n if (map === undefined || value === null || value === undefined)\n return undefined;\n\n return OrmUtils.mergeDeep(map, value);\n }, {} as ObjectLiteral|undefined);\n }\n\n // ---------------------------------------------------------------------\n // Public Builder Methods\n // ---------------------------------------------------------------------\n\n build() {\n const namingStrategy = this.connection.namingStrategy;\n const entityPrefix = this.connection.options.entityPrefix;\n const entitySkipConstructor = this.connection.options.entitySkipConstructor;\n\n this.engine = this.tableMetadataArgs.engine;\n this.database = this.tableMetadataArgs.type === \"entity-child\" && this.parentEntityMetadata ? this.parentEntityMetadata.database : this.tableMetadataArgs.database;\n if (this.tableMetadataArgs.schema) {\n this.schema = this.tableMetadataArgs.schema;\n }\n else if ((this.tableMetadataArgs.type === \"entity-child\") && this.parentEntityMetadata) {\n this.schema = this.parentEntityMetadata.schema;\n } else if (this.connection.options?.hasOwnProperty(\"schema\")) {\n this.schema = (this.connection.options as any).schema;\n }\n this.givenTableName = this.tableMetadataArgs.type === \"entity-child\" && this.parentEntityMetadata ? this.parentEntityMetadata.givenTableName : this.tableMetadataArgs.name;\n this.synchronize = this.tableMetadataArgs.synchronize === false ? false : true;\n this.targetName = this.tableMetadataArgs.target instanceof Function ? (this.tableMetadataArgs.target as any).name : this.tableMetadataArgs.target;\n if (this.tableMetadataArgs.type === \"closure-junction\") {\n this.tableNameWithoutPrefix = namingStrategy.closureJunctionTableName(this.givenTableName!);\n } else if (this.tableMetadataArgs.type === \"entity-child\" && this.parentEntityMetadata) {\n this.tableNameWithoutPrefix = namingStrategy.tableName(this.parentEntityMetadata.targetName, this.parentEntityMetadata.givenTableName);\n } else {\n this.tableNameWithoutPrefix = namingStrategy.tableName(this.targetName, this.givenTableName);\n\n if (this.connection.driver.maxAliasLength && this.connection.driver.maxAliasLength > 0 && this.tableNameWithoutPrefix.length > this.connection.driver.maxAliasLength) {\n this.tableNameWithoutPrefix = shorten(this.tableNameWithoutPrefix, { separator: \"_\", segmentLength: 3 });\n }\n }\n this.tableName = entityPrefix ? namingStrategy.prefixTableName(entityPrefix, this.tableNameWithoutPrefix) : this.tableNameWithoutPrefix;\n this.target = this.target ? this.target : this.tableName;\n this.name = this.targetName ? this.targetName : this.tableName;\n this.expression = this.tableMetadataArgs.expression;\n this.withoutRowid = this.tableMetadataArgs.withoutRowid === true ? true : false;\n this.tablePath = this.connection.driver.buildTableName(this.tableName, this.schema, this.database);\n this.orderBy = (this.tableMetadataArgs.orderBy instanceof Function) ? this.tableMetadataArgs.orderBy(this.propertiesMap) : this.tableMetadataArgs.orderBy; // todo: is propertiesMap available here? Looks like its not\n\n if (entitySkipConstructor !== undefined) {\n this.isAlwaysUsingConstructor = !entitySkipConstructor;\n }\n\n this.isJunction = this.tableMetadataArgs.type === \"closure-junction\" || this.tableMetadataArgs.type === \"junction\";\n this.isClosureJunction = this.tableMetadataArgs.type === \"closure-junction\";\n }\n\n /**\n * Registers a new column in the entity and recomputes all depend properties.\n */\n registerColumn(column: ColumnMetadata) {\n if (this.ownColumns.indexOf(column) !== -1)\n return;\n\n this.ownColumns.push(column);\n this.columns = this.embeddeds.reduce((columns, embedded) => columns.concat(embedded.columnsFromTree), this.ownColumns);\n this.primaryColumns = this.columns.filter(column => column.isPrimary);\n this.hasMultiplePrimaryKeys = this.primaryColumns.length > 1;\n this.hasUUIDGeneratedColumns = this.columns.filter(column => column.isGenerated || column.generationStrategy === \"uuid\").length > 0;\n this.propertiesMap = this.createPropertiesMap();\n if (this.childEntityMetadatas)\n this.childEntityMetadatas.forEach(entityMetadata => entityMetadata.registerColumn(column));\n }\n\n /**\n * Creates a special object - all columns and relations of the object (plus columns and relations from embeds)\n * in a special format - { propertyName: propertyName }.\n *\n * example: Post{ id: number, name: string, counterEmbed: { count: number }, category: Category }.\n * This method will create following object:\n * { id: \"id\", counterEmbed: { count: \"counterEmbed.count\" }, category: \"category\" }\n */\n createPropertiesMap(): { [name: string]: string|any } {\n const map: { [name: string]: string|any } = {};\n this.columns.forEach(column => OrmUtils.mergeDeep(map, column.createValueMap(column.propertyPath)));\n this.relations.forEach(relation => OrmUtils.mergeDeep(map, relation.createValueMap(relation.propertyPath)));\n return map;\n }\n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../browser/src/metadata/EntityMetadata.ts"],"names":[],"mappings":";AAGA,OAAO,EAAC,4BAA4B,EAAC,MAAM,uCAAuC,CAAC;AAInF,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AAC,mBAAmB,EAAE,CAAC;QAChD,IAAI,IAAI,CAAC,oBAAoB;YACzB,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,UAAA,cAAc,IAAI,OAAA,cAAc,CAAC,cAAc,CAAC,MAAM,CAAC,EAArC,CAAqC,CAAC,CAAC;IACnG,CAAC;IAED;;;;;;;OAOG;IACH,4CAAmB,GAAnB;QACI,IAAM,GAAG,GAAmC,EAAE,CAAC;QAC/C,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,UAAA,MAAM,IAAI,OAAA,QAAQ,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,EAAnE,CAAmE,CAAC,CAAC;QACpG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAA,QAAQ,IAAI,OAAA,QAAQ,CAAC,SAAS,CAAC,GAAG,EAAE,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,EAAvE,CAAuE,CAAC,CAAC;QAC5G,OAAO,GAAG,CAAC;IACf,CAAC;IACL,qBAAC;AAAD,CAp1BA,AAo1BC,IAAA","file":"EntityMetadata.js","sourcesContent":["import {QueryRunner, SelectQueryBuilder} from \"..\";\nimport {ObjectLiteral} from \"../common/ObjectLiteral\";\nimport {Connection} from \"../connection/Connection\";\nimport {CannotCreateEntityIdMapError} from \"../error/CannotCreateEntityIdMapError\";\nimport {OrderByCondition} from \"../find-options/OrderByCondition\";\nimport {TableMetadataArgs} from \"../metadata-args/TableMetadataArgs\";\nimport {TreeMetadataArgs} from \"../metadata-args/TreeMetadataArgs\";\nimport {OrmUtils} from \"../util/OrmUtils\";\nimport {shorten} from \"../util/StringUtils\";\nimport {CheckMetadata} from \"./CheckMetadata\";\nimport {ColumnMetadata} from \"./ColumnMetadata\";\nimport {EmbeddedMetadata} from \"./EmbeddedMetadata\";\nimport {EntityListenerMetadata} from \"./EntityListenerMetadata\";\nimport {ExclusionMetadata} from \"./ExclusionMetadata\";\nimport {ForeignKeyMetadata} from \"./ForeignKeyMetadata\";\nimport {IndexMetadata} from \"./IndexMetadata\";\nimport {RelationCountMetadata} from \"./RelationCountMetadata\";\nimport {RelationIdMetadata} from \"./RelationIdMetadata\";\nimport {RelationMetadata} from \"./RelationMetadata\";\nimport {TableType} from \"./types/TableTypes\";\nimport {TreeType} from \"./types/TreeTypes\";\nimport {UniqueMetadata} from \"./UniqueMetadata\";\nimport {ClosureTreeOptions} from \"./types/ClosureTreeOptions\";\n\n/**\n * Contains all entity metadata.\n */\nexport class EntityMetadata {\n\n // -------------------------------------------------------------------------\n // Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection where this entity metadata is created.\n */\n connection: Connection;\n\n /**\n * Metadata arguments used to build this entity metadata.\n */\n tableMetadataArgs: TableMetadataArgs;\n\n /**\n * If entity's table is a closure-typed table, then this entity will have a closure junction table metadata.\n */\n closureJunctionTable: EntityMetadata;\n\n /**\n * If this is entity metadata for a junction closure table then its owner closure table metadata will be set here.\n */\n parentClosureEntityMetadata: EntityMetadata;\n\n /**\n * Parent's entity metadata. Used in inheritance patterns.\n */\n parentEntityMetadata: EntityMetadata;\n\n /**\n * Children entity metadatas. Used in inheritance patterns.\n */\n childEntityMetadatas: EntityMetadata[] = [];\n\n /**\n * All \"inheritance tree\" from a target entity.\n * For example for target Post < ContentModel < Unit it will be an array of [Post, ContentModel, Unit].\n * It also contains child entities for single table inheritance.\n */\n inheritanceTree: Function[] = [];\n\n /**\n * Table type. Tables can be closure, junction, etc.\n */\n tableType: TableType = \"regular\";\n\n /**\n * Target class to which this entity metadata is bind.\n * Note, that when using table inheritance patterns target can be different rather then table's target.\n * For virtual tables which lack of real entity (like junction tables) target is equal to their table name.\n */\n target: Function|string;\n\n /**\n * Gets the name of the target.\n */\n targetName: string;\n\n /**\n * Entity's name.\n * Equal to entity target class's name if target is set to table.\n * If target class is not then then it equals to table name.\n */\n name: string;\n\n /**\n * View's expression.\n * Used in views\n */\n expression?: string|((connection: Connection) => SelectQueryBuilder<any>);\n\n /**\n * View's dependencies.\n * Used in views\n */\n dependsOn?: Set<Function|string>;\n\n /**\n * Enables Sqlite \"WITHOUT ROWID\" modifier for the \"CREATE TABLE\" statement\n */\n withoutRowid?: boolean = false;\n\n /**\n * Original user-given table name (taken from schema or @Entity(tableName) decorator).\n * If user haven't specified a table name this property will be undefined.\n */\n givenTableName?: string;\n\n /**\n * Entity table name in the database.\n * This is final table name of the entity.\n * This name already passed naming strategy, and generated based on\n * multiple criteria, including user table name and global table prefix.\n */\n tableName: string;\n\n /**\n * Entity table path. Contains database name, schema name and table name.\n * E.g. myDB.mySchema.myTable\n */\n tablePath: string;\n\n /**\n * Gets the table name without global table prefix.\n * When querying table you need a table name with prefix, but in some scenarios,\n * for example when you want to name a junction table that contains names of two other tables,\n * you may want a table name without prefix.\n */\n tableNameWithoutPrefix: string;\n\n /**\n * Indicates if schema will be synchronized for this entity or not.\n */\n synchronize: boolean = true;\n\n /**\n * Table's database engine type (like \"InnoDB\", \"MyISAM\", etc).\n */\n engine?: string;\n\n /**\n * Database name.\n */\n database?: string;\n\n /**\n * Schema name. Used in Postgres and Sql Server.\n */\n schema?: string;\n\n /**\n * Specifies a default order by used for queries from this table when no explicit order by is specified.\n */\n orderBy?: OrderByCondition;\n\n /**\n * If this entity metadata's table using one of the inheritance patterns,\n * then this will contain what pattern it uses.\n */\n inheritancePattern?: \"STI\"/*|\"CTI\"*/;\n\n /**\n * Checks if there any non-nullable column exist in this entity.\n */\n hasNonNullableRelations: boolean = false;\n\n /**\n * Indicates if this entity metadata of a junction table, or not.\n * Junction table is a table created by many-to-many relationship.\n *\n * Its also possible to understand if entity is junction via tableType.\n */\n isJunction: boolean = false;\n\n /**\n * Indicates if the entity should be instantiated using the constructor\n * or via allocating a new object via `Object.create()`.\n */\n isAlwaysUsingConstructor: boolean = true;\n\n /**\n * Indicates if this entity is a tree, what type of tree it is.\n */\n treeType?: TreeType;\n\n /**\n * Indicates if this entity is a tree, what options of tree it has.\n */\n treeOptions?: ClosureTreeOptions;\n\n /**\n * Checks if this table is a junction table of the closure table.\n * This type is for tables that contain junction metadata of the closure tables.\n */\n isClosureJunction: boolean = false;\n\n /**\n * Checks if entity's table has multiple primary columns.\n */\n hasMultiplePrimaryKeys: boolean = false;\n\n /**\n * Indicates if this entity metadata has uuid generated columns.\n */\n hasUUIDGeneratedColumns: boolean = false;\n\n /**\n * If this entity metadata is a child table of some table, it should have a discriminator value.\n * Used to store a value in a discriminator column.\n */\n discriminatorValue?: string;\n\n /**\n * Entity's column metadatas defined by user.\n */\n ownColumns: ColumnMetadata[] = [];\n\n /**\n * Columns of the entity, including columns that are coming from the embeddeds of this entity.\n */\n columns: ColumnMetadata[] = [];\n\n /**\n * Ancestor columns used only in closure junction tables.\n */\n ancestorColumns: ColumnMetadata[] = [];\n\n /**\n * Descendant columns used only in closure junction tables.\n */\n descendantColumns: ColumnMetadata[] = [];\n\n /**\n * All columns except for virtual columns.\n */\n nonVirtualColumns: ColumnMetadata[] = [];\n\n /**\n * In the case if this entity metadata is junction table's entity metadata,\n * this will contain all referenced columns of owner entity.\n */\n ownerColumns: ColumnMetadata[] = [];\n\n /**\n * In the case if this entity metadata is junction table's entity metadata,\n * this will contain all referenced columns of inverse entity.\n */\n inverseColumns: ColumnMetadata[] = [];\n\n /**\n * Gets the column with generated flag.\n */\n generatedColumns: ColumnMetadata[] = [];\n\n /**\n * Gets the object id column used with mongodb database.\n */\n objectIdColumn?: ColumnMetadata;\n\n /**\n * Gets entity column which contains a create date value.\n */\n createDateColumn?: ColumnMetadata;\n\n /**\n * Gets entity column which contains an update date value.\n */\n updateDateColumn?: ColumnMetadata;\n\n /**\n * Gets entity column which contains a delete date value.\n */\n deleteDateColumn?: ColumnMetadata;\n\n /**\n * Gets entity column which contains an entity version.\n */\n versionColumn?: ColumnMetadata;\n\n /**\n * Gets the discriminator column used to store entity identificator in single-table inheritance tables.\n */\n discriminatorColumn?: ColumnMetadata;\n\n /**\n * Special column that stores tree level in tree entities.\n */\n treeLevelColumn?: ColumnMetadata;\n\n /**\n * Nested set's left value column.\n * Used only in tree entities with nested set pattern applied.\n */\n nestedSetLeftColumn?: ColumnMetadata;\n\n /**\n * Nested set's right value column.\n * Used only in tree entities with nested set pattern applied.\n */\n nestedSetRightColumn?: ColumnMetadata;\n\n /**\n * Materialized path column.\n * Used only in tree entities with materialized path pattern applied.\n */\n materializedPathColumn?: ColumnMetadata;\n\n /**\n * Gets the primary columns.\n */\n primaryColumns: ColumnMetadata[] = [];\n\n /**\n * Entity's relation metadatas.\n */\n ownRelations: RelationMetadata[] = [];\n\n /**\n * Relations of the entity, including relations that are coming from the embeddeds of this entity.\n */\n relations: RelationMetadata[] = [];\n\n /**\n * List of eager relations this metadata has.\n */\n eagerRelations: RelationMetadata[] = [];\n\n /**\n * List of eager relations this metadata has.\n */\n lazyRelations: RelationMetadata[] = [];\n\n /**\n * Gets only one-to-one relations of the entity.\n */\n oneToOneRelations: RelationMetadata[] = [];\n\n /**\n * Gets only owner one-to-one relations of the entity.\n */\n ownerOneToOneRelations: RelationMetadata[] = [];\n\n /**\n * Gets only one-to-many relations of the entity.\n */\n oneToManyRelations: RelationMetadata[] = [];\n\n /**\n * Gets only many-to-one relations of the entity.\n */\n manyToOneRelations: RelationMetadata[] = [];\n\n /**\n * Gets only many-to-many relations of the entity.\n */\n manyToManyRelations: RelationMetadata[] = [];\n\n /**\n * Gets only owner many-to-many relations of the entity.\n */\n ownerManyToManyRelations: RelationMetadata[] = [];\n\n /**\n * Gets only owner one-to-one and many-to-one relations.\n */\n relationsWithJoinColumns: RelationMetadata[] = [];\n\n /**\n * Tree parent relation. Used only in tree-tables.\n */\n treeParentRelation?: RelationMetadata;\n\n /**\n * Tree children relation. Used only in tree-tables.\n */\n treeChildrenRelation?: RelationMetadata;\n\n /**\n * Entity's relation id metadatas.\n */\n relationIds: RelationIdMetadata[] = [];\n\n /**\n * Entity's relation id metadatas.\n */\n relationCounts: RelationCountMetadata[] = [];\n\n /**\n * Entity's foreign key metadatas.\n */\n foreignKeys: ForeignKeyMetadata[] = [];\n\n /**\n * Entity's embedded metadatas.\n */\n embeddeds: EmbeddedMetadata[] = [];\n\n /**\n * All embeddeds - embeddeds from this entity metadata and from all child embeddeds, etc.\n */\n allEmbeddeds: EmbeddedMetadata[] = [];\n\n /**\n * Entity's own indices.\n */\n ownIndices: IndexMetadata[] = [];\n\n /**\n * Entity's index metadatas.\n */\n indices: IndexMetadata[] = [];\n\n /**\n * Entity's unique metadatas.\n */\n uniques: UniqueMetadata[] = [];\n\n /**\n * Entity's own uniques.\n */\n ownUniques: UniqueMetadata[] = [];\n\n /**\n * Entity's check metadatas.\n */\n checks: CheckMetadata[] = [];\n\n /**\n * Entity's exclusion metadatas.\n */\n exclusions: ExclusionMetadata[] = [];\n\n /**\n * Entity's own listener metadatas.\n */\n ownListeners: EntityListenerMetadata[] = [];\n\n /**\n * Entity listener metadatas.\n */\n listeners: EntityListenerMetadata[] = [];\n\n /**\n * Listener metadatas with \"AFTER LOAD\" type.\n */\n afterLoadListeners: EntityListenerMetadata[] = [];\n\n /**\n * Listener metadatas with \"AFTER INSERT\" type.\n */\n beforeInsertListeners: EntityListenerMetadata[] = [];\n\n /**\n * Listener metadatas with \"AFTER INSERT\" type.\n */\n afterInsertListeners: EntityListenerMetadata[] = [];\n\n /**\n * Listener metadatas with \"AFTER UPDATE\" type.\n */\n beforeUpdateListeners: EntityListenerMetadata[] = [];\n\n /**\n * Listener metadatas with \"AFTER UPDATE\" type.\n */\n afterUpdateListeners: EntityListenerMetadata[] = [];\n\n /**\n * Listener metadatas with \"AFTER REMOVE\" type.\n */\n beforeRemoveListeners: EntityListenerMetadata[] = [];\n\n /**\n * Listener metadatas with \"AFTER REMOVE\" type.\n */\n afterRemoveListeners: EntityListenerMetadata[] = [];\n\n /**\n * Map of columns and relations of the entity.\n *\n * example: Post{ id: number, name: string, counterEmbed: { count: number }, category: Category }.\n * This method will create following object:\n * { id: \"id\", counterEmbed: { count: \"counterEmbed.count\" }, category: \"category\" }\n */\n propertiesMap: ObjectLiteral;\n\n // ---------------------------------------------------------------------\n // Constructor\n // ---------------------------------------------------------------------\n\n constructor(options: {\n connection: Connection,\n inheritanceTree?: Function[],\n inheritancePattern?: \"STI\"/*|\"CTI\"*/,\n tableTree?: TreeMetadataArgs,\n parentClosureEntityMetadata?: EntityMetadata,\n args: TableMetadataArgs\n }) {\n this.connection = options.connection;\n this.inheritanceTree = options.inheritanceTree || [];\n this.inheritancePattern = options.inheritancePattern;\n this.treeType = options.tableTree ? options.tableTree.type : undefined;\n this.treeOptions = options.tableTree ? options.tableTree.options : undefined;\n this.parentClosureEntityMetadata = options.parentClosureEntityMetadata!;\n this.tableMetadataArgs = options.args;\n this.target = this.tableMetadataArgs.target;\n this.tableType = this.tableMetadataArgs.type;\n this.expression = this.tableMetadataArgs.expression;\n this.withoutRowid = this.tableMetadataArgs.withoutRowid;\n this.dependsOn = this.tableMetadataArgs.dependsOn;\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Creates a new entity.\n */\n create(queryRunner?: QueryRunner, options?: { fromDeserializer?: boolean }): any {\n // if target is set to a function (e.g. class) that can be created then create it\n let ret: any;\n if (this.target instanceof Function) {\n if (!options?.fromDeserializer || this.isAlwaysUsingConstructor) {\n ret = new (<any> this.target)();\n } else {\n ret = Object.create(this.target.prototype);\n }\n\n this.lazyRelations.forEach(relation => this.connection.relationLoader.enableLazyLoad(relation, ret, queryRunner));\n return ret;\n }\n\n // otherwise simply return a new empty object\n const newObject = {};\n this.lazyRelations.forEach(relation => this.connection.relationLoader.enableLazyLoad(relation, newObject, queryRunner));\n return newObject;\n }\n\n /**\n * Checks if given entity has an id.\n */\n hasId(entity: ObjectLiteral): boolean {\n if (!entity)\n return false;\n\n return this.primaryColumns.every(primaryColumn => {\n const value = primaryColumn.getEntityValue(entity);\n return value !== null && value !== undefined && value !== \"\";\n });\n }\n\n /**\n * Checks if given entity / object contains ALL primary keys entity must have.\n * Returns true if it contains all of them, false if at least one of them is not defined.\n */\n hasAllPrimaryKeys(entity: ObjectLiteral): boolean {\n return this.primaryColumns.every(primaryColumn => {\n const value = primaryColumn.getEntityValue(entity);\n return value !== null && value !== undefined;\n });\n }\n\n /**\n * Ensures that given object is an entity id map.\n * If given id is an object then it means its already id map.\n * If given id isn't an object then it means its a value of the id column\n * and it creates a new id map with this value and name of the primary column.\n */\n ensureEntityIdMap(id: any): ObjectLiteral {\n if (id instanceof Object)\n return id;\n\n if (this.hasMultiplePrimaryKeys)\n throw new CannotCreateEntityIdMapError(this, id);\n\n return this.primaryColumns[0].createValueMap(id);\n }\n\n /**\n * Gets primary keys of the entity and returns them in a literal object.\n * For example, for Post{ id: 1, title: \"hello\" } where id is primary it will return { id: 1 }\n * For multiple primary keys it returns multiple keys in object.\n * For primary keys inside embeds it returns complex object literal with keys in them.\n */\n getEntityIdMap(entity: ObjectLiteral|undefined): ObjectLiteral|undefined {\n if (!entity)\n return undefined;\n\n return EntityMetadata.getValueMap(entity, this.primaryColumns, { skipNulls: true });\n }\n\n /**\n * Creates a \"mixed id map\".\n * If entity has multiple primary keys (ids) then it will return just regular id map, like what getEntityIdMap returns.\n * But if entity has a single primary key then it will return just value of the id column of the entity, just value.\n * This is called mixed id map.\n */\n getEntityIdMixedMap(entity: ObjectLiteral|undefined): ObjectLiteral|undefined {\n if (!entity)\n return entity;\n\n const idMap = this.getEntityIdMap(entity);\n if (this.hasMultiplePrimaryKeys) {\n return idMap;\n\n } else if (idMap) {\n return this.primaryColumns[0].getEntityValue(idMap); // todo: what about parent primary column?\n }\n\n return idMap;\n }\n\n /**\n * Compares two different entities by their ids.\n * Returns true if they match, false otherwise.\n */\n compareEntities(firstEntity: ObjectLiteral, secondEntity: ObjectLiteral): boolean {\n\n const firstEntityIdMap = this.getEntityIdMap(firstEntity);\n if (!firstEntityIdMap) return false;\n\n const secondEntityIdMap = this.getEntityIdMap(secondEntity);\n if (!secondEntityIdMap) return false;\n\n return OrmUtils.compareIds(firstEntityIdMap, secondEntityIdMap);\n }\n\n /**\n * Finds column with a given property name.\n */\n findColumnWithPropertyName(propertyName: string): ColumnMetadata|undefined {\n return this.columns.find(column => column.propertyName === propertyName);\n }\n\n /**\n * Finds column with a given database name.\n */\n findColumnWithDatabaseName(databaseName: string): ColumnMetadata|undefined {\n return this.columns.find(column => column.databaseName === databaseName);\n }\n\n /**\n * Checks if there is a column or relationship with a given property path.\n */\n hasColumnWithPropertyPath(propertyPath: string): boolean {\n const hasColumn = this.columns.some(column => column.propertyPath === propertyPath);\n return hasColumn || this.hasRelationWithPropertyPath(propertyPath);\n }\n\n /**\n * Finds column with a given property path.\n */\n findColumnWithPropertyPath(propertyPath: string): ColumnMetadata|undefined {\n const column = this.columns.find(column => column.propertyPath === propertyPath);\n if (column)\n return column;\n\n // in the case if column with property path was not found, try to find a relation with such property path\n // if we find relation and it has a single join column then its the column user was seeking\n const relation = this.relations.find(relation => relation.propertyPath === propertyPath);\n if (relation && relation.joinColumns.length === 1)\n return relation.joinColumns[0];\n\n return undefined;\n }\n\n /**\n * Finds columns with a given property path.\n * Property path can match a relation, and relations can contain multiple columns.\n */\n findColumnsWithPropertyPath(propertyPath: string): ColumnMetadata[] {\n const column = this.columns.find(column => column.propertyPath === propertyPath);\n if (column)\n return [column];\n\n // in the case if column with property path was not found, try to find a relation with such property path\n // if we find relation and it has a single join column then its the column user was seeking\n const relation = this.findRelationWithPropertyPath(propertyPath);\n if (relation && relation.joinColumns)\n return relation.joinColumns;\n\n return [];\n }\n\n /**\n * Checks if there is a relation with the given property path.\n */\n hasRelationWithPropertyPath(propertyPath: string): boolean {\n return this.relations.some(relation => relation.propertyPath === propertyPath);\n }\n\n /**\n * Finds relation with the given property path.\n */\n findRelationWithPropertyPath(propertyPath: string): RelationMetadata|undefined {\n return this.relations.find(relation => relation.propertyPath === propertyPath);\n }\n\n /**\n * Checks if there is an embedded with a given property path.\n */\n hasEmbeddedWithPropertyPath(propertyPath: string): boolean {\n return this.allEmbeddeds.some(embedded => embedded.propertyPath === propertyPath);\n }\n\n /**\n * Finds embedded with a given property path.\n */\n findEmbeddedWithPropertyPath(propertyPath: string): EmbeddedMetadata|undefined {\n return this.allEmbeddeds.find(embedded => embedded.propertyPath === propertyPath);\n }\n\n /**\n * Iterates through entity and finds and extracts all values from relations in the entity.\n * If relation value is an array its being flattened.\n */\n extractRelationValuesFromEntity(entity: ObjectLiteral, relations: RelationMetadata[]): [RelationMetadata, any, EntityMetadata][] {\n const relationsAndValues: [RelationMetadata, any, EntityMetadata][] = [];\n relations.forEach(relation => {\n const value = relation.getEntityValue(entity);\n if (Array.isArray(value)) {\n value.forEach(subValue => relationsAndValues.push([relation, subValue, this.getInverseEntityMetadata(subValue, relation)]));\n } else if (value) {\n relationsAndValues.push([relation, value, this.getInverseEntityMetadata(value, relation)]);\n }\n });\n return relationsAndValues;\n }\n\n private getInverseEntityMetadata(value: any, relation: RelationMetadata): EntityMetadata {\n const childEntityMetadata = relation.inverseEntityMetadata.childEntityMetadatas.find(metadata =>\n metadata.target === value.constructor\n );\n return childEntityMetadata ? childEntityMetadata : relation.inverseEntityMetadata;\n }\n\n // -------------------------------------------------------------------------\n // Public Static Methods\n // -------------------------------------------------------------------------\n\n /**\n * Creates a property paths for a given entity.\n *\n * @deprecated\n */\n static createPropertyPath(metadata: EntityMetadata, entity: ObjectLiteral, prefix: string = \"\") {\n const paths: string[] = [];\n Object.keys(entity).forEach(key => {\n\n // check for function is needed in the cases when createPropertyPath used on values containg a function as a value\n // example: .update().set({ name: () => `SUBSTR('', 1, 2)` })\n const parentPath = prefix ? prefix + \".\" + key : key;\n if (metadata.hasEmbeddedWithPropertyPath(parentPath)) {\n const subPaths = this.createPropertyPath(metadata, entity[key], parentPath);\n paths.push(...subPaths);\n } else {\n const path = prefix ? prefix + \".\" + key : key;\n paths.push(path);\n }\n });\n return paths;\n }\n\n /**\n * Finds difference between two entity id maps.\n * Returns items that exist in the first array and absent in the second array.\n */\n static difference(firstIdMaps: ObjectLiteral[], secondIdMaps: ObjectLiteral[]): ObjectLiteral[] {\n return firstIdMaps.filter(firstIdMap => {\n return !secondIdMaps.find(secondIdMap => OrmUtils.compareIds(firstIdMap, secondIdMap));\n });\n }\n\n /**\n * Creates value map from the given values and columns.\n * Examples of usages are primary columns map and join columns map.\n */\n static getValueMap(entity: ObjectLiteral, columns: ColumnMetadata[], options?: { skipNulls?: boolean }): ObjectLiteral|undefined {\n return columns.reduce((map, column) => {\n const value = column.getEntityValueMap(entity, options);\n\n // make sure that none of the values of the columns are not missing\n if (map === undefined || value === null || value === undefined)\n return undefined;\n\n return OrmUtils.mergeDeep(map, value);\n }, {} as ObjectLiteral|undefined);\n }\n\n // ---------------------------------------------------------------------\n // Public Builder Methods\n // ---------------------------------------------------------------------\n\n build() {\n const namingStrategy = this.connection.namingStrategy;\n const entityPrefix = this.connection.options.entityPrefix;\n const entitySkipConstructor = this.connection.options.entitySkipConstructor;\n\n this.engine = this.tableMetadataArgs.engine;\n this.database = this.tableMetadataArgs.type === \"entity-child\" && this.parentEntityMetadata ? this.parentEntityMetadata.database : this.tableMetadataArgs.database;\n if (this.tableMetadataArgs.schema) {\n this.schema = this.tableMetadataArgs.schema;\n }\n else if ((this.tableMetadataArgs.type === \"entity-child\") && this.parentEntityMetadata) {\n this.schema = this.parentEntityMetadata.schema;\n } else if (this.connection.options?.hasOwnProperty(\"schema\")) {\n this.schema = (this.connection.options as any).schema;\n }\n this.givenTableName = this.tableMetadataArgs.type === \"entity-child\" && this.parentEntityMetadata ? this.parentEntityMetadata.givenTableName : this.tableMetadataArgs.name;\n this.synchronize = this.tableMetadataArgs.synchronize === false ? false : true;\n this.targetName = this.tableMetadataArgs.target instanceof Function ? (this.tableMetadataArgs.target as any).name : this.tableMetadataArgs.target;\n if (this.tableMetadataArgs.type === \"closure-junction\") {\n this.tableNameWithoutPrefix = namingStrategy.closureJunctionTableName(this.givenTableName!);\n } else if (this.tableMetadataArgs.type === \"entity-child\" && this.parentEntityMetadata) {\n this.tableNameWithoutPrefix = namingStrategy.tableName(this.parentEntityMetadata.targetName, this.parentEntityMetadata.givenTableName);\n } else {\n this.tableNameWithoutPrefix = namingStrategy.tableName(this.targetName, this.givenTableName);\n\n if (this.connection.driver.maxAliasLength && this.connection.driver.maxAliasLength > 0 && this.tableNameWithoutPrefix.length > this.connection.driver.maxAliasLength) {\n this.tableNameWithoutPrefix = shorten(this.tableNameWithoutPrefix, { separator: \"_\", segmentLength: 3 });\n }\n }\n this.tableName = entityPrefix ? namingStrategy.prefixTableName(entityPrefix, this.tableNameWithoutPrefix) : this.tableNameWithoutPrefix;\n this.target = this.target ? this.target : this.tableName;\n this.name = this.targetName ? this.targetName : this.tableName;\n this.expression = this.tableMetadataArgs.expression;\n this.withoutRowid = this.tableMetadataArgs.withoutRowid === true ? true : false;\n this.tablePath = this.connection.driver.buildTableName(this.tableName, this.schema, this.database);\n this.orderBy = (this.tableMetadataArgs.orderBy instanceof Function) ? this.tableMetadataArgs.orderBy(this.propertiesMap) : this.tableMetadataArgs.orderBy; // todo: is propertiesMap available here? Looks like its not\n\n if (entitySkipConstructor !== undefined) {\n this.isAlwaysUsingConstructor = !entitySkipConstructor;\n }\n\n this.isJunction = this.tableMetadataArgs.type === \"closure-junction\" || this.tableMetadataArgs.type === \"junction\";\n this.isClosureJunction = this.tableMetadataArgs.type === \"closure-junction\";\n }\n\n /**\n * Registers a new column in the entity and recomputes all depend properties.\n */\n registerColumn(column: ColumnMetadata) {\n if (this.ownColumns.indexOf(column) !== -1)\n return;\n\n this.ownColumns.push(column);\n this.columns = this.embeddeds.reduce((columns, embedded) => columns.concat(embedded.columnsFromTree), this.ownColumns);\n this.primaryColumns = this.columns.filter(column => column.isPrimary);\n this.hasMultiplePrimaryKeys = this.primaryColumns.length > 1;\n this.hasUUIDGeneratedColumns = this.columns.filter(column => column.isGenerated || column.generationStrategy === \"uuid\").length > 0;\n this.propertiesMap = this.createPropertiesMap();\n if (this.childEntityMetadatas)\n this.childEntityMetadatas.forEach(entityMetadata => entityMetadata.registerColumn(column));\n }\n\n /**\n * Creates a special object - all columns and relations of the object (plus columns and relations from embeds)\n * in a special format - { propertyName: propertyName }.\n *\n * example: Post{ id: number, name: string, counterEmbed: { count: number }, category: Category }.\n * This method will create following object:\n * { id: \"id\", counterEmbed: { count: \"counterEmbed.count\" }, category: \"category\" }\n */\n createPropertiesMap(): { [name: string]: string|any } {\n const map: { [name: string]: string|any } = {};\n this.columns.forEach(column => OrmUtils.mergeDeep(map, column.createValueMap(column.propertyPath)));\n this.relations.forEach(relation => OrmUtils.mergeDeep(map, relation.createValueMap(relation.propertyPath)));\n return map;\n }\n}\n"],"sourceRoot":".."}
@@ -45,6 +45,10 @@ export interface TableMetadataArgs {
45
45
  * View expression.
46
46
  */
47
47
  expression?: string | ((connection: Connection) => SelectQueryBuilder<any>);
48
+ /**
49
+ * View dependencies.
50
+ */
51
+ dependsOn?: Set<Function | string>;
48
52
  /**
49
53
  * Indicates if view is materialized
50
54
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/metadata-args/TableMetadataArgs.ts"],"names":[],"mappings":"","file":"TableMetadataArgs.js","sourcesContent":["import {Connection, SelectQueryBuilder} from \"..\";\nimport {OrderByCondition} from \"../find-options/OrderByCondition\";\nimport {TableType} from \"../metadata/types/TableTypes\";\n\n/**\n * Arguments for TableMetadata class, helps to construct an TableMetadata object.\n */\nexport interface TableMetadataArgs {\n\n /**\n * Class to which table is applied.\n * Function target is a table defined in the class.\n * String target is a table defined in a json schema.\n */\n target: Function|string;\n\n /**\n * Table's name. If name is not set then table's name will be generated from target's name.\n */\n name?: string;\n\n /**\n * Table type. Tables can be abstract, closure, junction, embedded, etc.\n */\n type: TableType;\n\n /**\n * Specifies a default order by used for queries from this table when no explicit order by is specified.\n */\n orderBy?: OrderByCondition|((object: any) => OrderByCondition|any);\n\n /**\n * Table's database engine type (like \"InnoDB\", \"MyISAM\", etc).\n */\n engine?: string;\n\n /**\n * Database name. Used in MySql and Sql Server.\n */\n database?: string;\n\n /**\n * Schema name. Used in Postgres and Sql Server.\n */\n schema?: string;\n\n /**\n * Indicates if schema synchronization is enabled or disabled for this entity.\n * If it will be set to false then schema sync will and migrations ignore this entity.\n * By default schema synchronization is enabled for all entities.\n */\n synchronize?: boolean;\n\n /**\n * View expression.\n */\n expression?: string|((connection: Connection) => SelectQueryBuilder<any>);\n\n /**\n * Indicates if view is materialized\n */\n materialized?: boolean;\n\n /**\n * If set to 'true' this option disables Sqlite's default behaviour of secretly creating\n * an integer primary key column named 'rowid' on table creation. \n */\n withoutRowid?: boolean; \n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../browser/src/metadata-args/TableMetadataArgs.ts"],"names":[],"mappings":"","file":"TableMetadataArgs.js","sourcesContent":["import {Connection, SelectQueryBuilder} from \"..\";\nimport {OrderByCondition} from \"../find-options/OrderByCondition\";\nimport {TableType} from \"../metadata/types/TableTypes\";\n\n/**\n * Arguments for TableMetadata class, helps to construct an TableMetadata object.\n */\nexport interface TableMetadataArgs {\n\n /**\n * Class to which table is applied.\n * Function target is a table defined in the class.\n * String target is a table defined in a json schema.\n */\n target: Function|string;\n\n /**\n * Table's name. If name is not set then table's name will be generated from target's name.\n */\n name?: string;\n\n /**\n * Table type. Tables can be abstract, closure, junction, embedded, etc.\n */\n type: TableType;\n\n /**\n * Specifies a default order by used for queries from this table when no explicit order by is specified.\n */\n orderBy?: OrderByCondition|((object: any) => OrderByCondition|any);\n\n /**\n * Table's database engine type (like \"InnoDB\", \"MyISAM\", etc).\n */\n engine?: string;\n\n /**\n * Database name. Used in MySql and Sql Server.\n */\n database?: string;\n\n /**\n * Schema name. Used in Postgres and Sql Server.\n */\n schema?: string;\n\n /**\n * Indicates if schema synchronization is enabled or disabled for this entity.\n * If it will be set to false then schema sync will and migrations ignore this entity.\n * By default schema synchronization is enabled for all entities.\n */\n synchronize?: boolean;\n\n /**\n * View expression.\n */\n expression?: string|((connection: Connection) => SelectQueryBuilder<any>);\n\n /**\n * View dependencies.\n */\n dependsOn?: Set<Function|string>;\n\n /**\n * Indicates if view is materialized\n */\n materialized?: boolean;\n\n /**\n * If set to 'true' this option disables Sqlite's default behaviour of secretly creating\n * an integer primary key column named 'rowid' on table creation.\n */\n withoutRowid?: boolean;\n}\n"],"sourceRoot":".."}
@@ -267,6 +267,10 @@ var MigrationExecutor = /** @class */ (function () {
267
267
  transactionStartedByUs = true;
268
268
  _c.label = 2;
269
269
  case 2: return [4 /*yield*/, migration.instance.up(queryRunner)
270
+ .catch(function (error) {
271
+ _this.connection.logger.logMigration("Migration \"" + migration.name + "\" has been failed, error: " + (error === null || error === void 0 ? void 0 : error.message));
272
+ throw error;
273
+ })
270
274
  .then(function () { return __awaiter(_this, void 0, void 0, function () {
271
275
  return __generator(this, function (_a) {
272
276
  switch (_a.label) {