typeorm 0.3.6-dev.62518ae → 0.3.6-dev.7dfb69f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/cache/RedisQueryResultCache.js +3 -0
- package/browser/cache/RedisQueryResultCache.js.map +1 -1
- package/browser/decorator/options/ColumnOptions.d.ts +2 -2
- package/browser/decorator/options/ColumnOptions.js.map +1 -1
- package/browser/driver/cockroachdb/CockroachDriver.js +4 -1
- package/browser/driver/cockroachdb/CockroachDriver.js.map +1 -1
- package/browser/driver/cockroachdb/CockroachQueryRunner.js +133 -11
- package/browser/driver/cockroachdb/CockroachQueryRunner.js.map +1 -1
- package/browser/driver/mysql/MysqlDriver.d.ts +1 -0
- package/browser/driver/mysql/MysqlDriver.js +94 -23
- package/browser/driver/mysql/MysqlDriver.js.map +1 -1
- package/browser/driver/mysql/MysqlQueryRunner.js +203 -24
- package/browser/driver/mysql/MysqlQueryRunner.js.map +1 -1
- package/browser/driver/oracle/OracleDriver.js +79 -15
- package/browser/driver/oracle/OracleDriver.js.map +1 -1
- package/browser/driver/oracle/OracleQueryRunner.js +118 -21
- package/browser/driver/oracle/OracleQueryRunner.js.map +1 -1
- package/browser/driver/postgres/PostgresDriver.js +95 -18
- package/browser/driver/postgres/PostgresDriver.js.map +1 -1
- package/browser/driver/postgres/PostgresQueryRunner.js +60 -38
- package/browser/driver/postgres/PostgresQueryRunner.js.map +1 -1
- package/browser/driver/spanner/SpannerDriver.d.ts +1 -0
- package/browser/driver/spanner/SpannerDriver.js +52 -13
- package/browser/driver/spanner/SpannerDriver.js.map +1 -1
- package/browser/driver/spanner/SpannerQueryRunner.js +129 -43
- package/browser/driver/spanner/SpannerQueryRunner.js.map +1 -1
- package/browser/driver/sqlite-abstract/AbstractSqliteDriver.js +21 -16
- package/browser/driver/sqlite-abstract/AbstractSqliteDriver.js.map +1 -1
- package/browser/driver/sqlite-abstract/AbstractSqliteQueryRunner.js +165 -20
- package/browser/driver/sqlite-abstract/AbstractSqliteQueryRunner.js.map +1 -1
- package/browser/driver/sqlserver/SqlServerDriver.d.ts +3 -1
- package/browser/driver/sqlserver/SqlServerDriver.js +99 -26
- package/browser/driver/sqlserver/SqlServerDriver.js.map +1 -1
- package/browser/driver/sqlserver/SqlServerQueryRunner.js +153 -17
- package/browser/driver/sqlserver/SqlServerQueryRunner.js.map +1 -1
- package/browser/entity-schema/EntitySchemaColumnOptions.d.ts +2 -2
- package/browser/entity-schema/EntitySchemaColumnOptions.js.map +1 -1
- package/browser/metadata/ColumnMetadata.d.ts +2 -2
- package/browser/metadata/ColumnMetadata.js.map +1 -1
- package/browser/metadata-builder/EntityMetadataValidator.js +8 -0
- package/browser/metadata-builder/EntityMetadataValidator.js.map +1 -1
- package/browser/query-runner/BaseQueryRunner.d.ts +10 -0
- package/browser/query-runner/BaseQueryRunner.js +25 -1
- package/browser/query-runner/BaseQueryRunner.js.map +1 -1
- package/browser/schema-builder/RdbmsSchemaBuilder.d.ts +6 -2
- package/browser/schema-builder/RdbmsSchemaBuilder.js +11 -5
- package/browser/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
- package/browser/schema-builder/options/TableColumnOptions.d.ts +2 -2
- package/browser/schema-builder/options/TableColumnOptions.js.map +1 -1
- package/browser/schema-builder/table/TableColumn.d.ts +2 -2
- package/browser/schema-builder/table/TableColumn.js.map +1 -1
- package/cache/RedisQueryResultCache.js +3 -0
- package/cache/RedisQueryResultCache.js.map +1 -1
- package/decorator/options/ColumnOptions.d.ts +2 -2
- package/decorator/options/ColumnOptions.js.map +1 -1
- package/driver/cockroachdb/CockroachDriver.js +4 -1
- package/driver/cockroachdb/CockroachDriver.js.map +1 -1
- package/driver/cockroachdb/CockroachQueryRunner.js +133 -11
- package/driver/cockroachdb/CockroachQueryRunner.js.map +1 -1
- package/driver/mysql/MysqlDriver.d.ts +1 -0
- package/driver/mysql/MysqlDriver.js +94 -23
- package/driver/mysql/MysqlDriver.js.map +1 -1
- package/driver/mysql/MysqlQueryRunner.js +203 -24
- package/driver/mysql/MysqlQueryRunner.js.map +1 -1
- package/driver/oracle/OracleDriver.js +79 -15
- package/driver/oracle/OracleDriver.js.map +1 -1
- package/driver/oracle/OracleQueryRunner.js +118 -21
- package/driver/oracle/OracleQueryRunner.js.map +1 -1
- package/driver/postgres/PostgresDriver.js +95 -18
- package/driver/postgres/PostgresDriver.js.map +1 -1
- package/driver/postgres/PostgresQueryRunner.js +60 -38
- package/driver/postgres/PostgresQueryRunner.js.map +1 -1
- package/driver/spanner/SpannerDriver.d.ts +1 -0
- package/driver/spanner/SpannerDriver.js +52 -13
- package/driver/spanner/SpannerDriver.js.map +1 -1
- package/driver/spanner/SpannerQueryRunner.js +129 -43
- package/driver/spanner/SpannerQueryRunner.js.map +1 -1
- package/driver/sqlite-abstract/AbstractSqliteDriver.js +21 -16
- package/driver/sqlite-abstract/AbstractSqliteDriver.js.map +1 -1
- package/driver/sqlite-abstract/AbstractSqliteQueryRunner.js +165 -20
- package/driver/sqlite-abstract/AbstractSqliteQueryRunner.js.map +1 -1
- package/driver/sqlserver/SqlServerDriver.d.ts +3 -1
- package/driver/sqlserver/SqlServerDriver.js +99 -26
- package/driver/sqlserver/SqlServerDriver.js.map +1 -1
- package/driver/sqlserver/SqlServerQueryRunner.js +153 -17
- package/driver/sqlserver/SqlServerQueryRunner.js.map +1 -1
- package/entity-schema/EntitySchemaColumnOptions.d.ts +2 -2
- package/entity-schema/EntitySchemaColumnOptions.js.map +1 -1
- package/metadata/ColumnMetadata.d.ts +2 -2
- package/metadata/ColumnMetadata.js.map +1 -1
- package/metadata-builder/EntityMetadataValidator.js +8 -0
- package/metadata-builder/EntityMetadataValidator.js.map +1 -1
- package/package.json +1 -1
- package/query-runner/BaseQueryRunner.d.ts +10 -0
- package/query-runner/BaseQueryRunner.js +25 -1
- package/query-runner/BaseQueryRunner.js.map +1 -1
- package/schema-builder/RdbmsSchemaBuilder.d.ts +6 -2
- package/schema-builder/RdbmsSchemaBuilder.js +11 -5
- package/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
- package/schema-builder/options/TableColumnOptions.d.ts +2 -2
- package/schema-builder/options/TableColumnOptions.js.map +1 -1
- package/schema-builder/table/TableColumn.d.ts +2 -2
- package/schema-builder/table/TableColumn.js.map +1 -1
|
@@ -140,11 +140,11 @@ export interface EntitySchemaColumnOptions extends SpatialColumnOptions {
|
|
|
140
140
|
*/
|
|
141
141
|
enum?: any[] | Object;
|
|
142
142
|
/**
|
|
143
|
-
* Generated column expression.
|
|
143
|
+
* Generated column expression.
|
|
144
144
|
*/
|
|
145
145
|
asExpression?: string;
|
|
146
146
|
/**
|
|
147
|
-
* Generated column type.
|
|
147
|
+
* Generated column type.
|
|
148
148
|
*/
|
|
149
149
|
generatedType?: "VIRTUAL" | "STORED";
|
|
150
150
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../browser/src/entity-schema/EntitySchemaColumnOptions.ts"],"names":[],"mappings":"","file":"EntitySchemaColumnOptions.js","sourcesContent":["import { ColumnType } from \"../driver/types/ColumnTypes\"\nimport { ValueTransformer } from \"../decorator/options/ValueTransformer\"\nimport { SpatialColumnOptions } from \"../decorator/options/SpatialColumnOptions\"\n\nexport interface EntitySchemaColumnOptions extends SpatialColumnOptions {\n /**\n * Indicates if this column is a primary column.\n */\n primary?: boolean\n\n /**\n * Indicates if this column is of type ObjectID\n */\n objectId?: boolean\n\n /**\n * Indicates if this column is a created date column.\n */\n createDate?: boolean\n\n /**\n * Indicates if this column is an update date column.\n */\n updateDate?: boolean\n\n /**\n * Indicates if this column is a delete date column.\n */\n deleteDate?: boolean\n\n /**\n * Indicates if this column is a version column.\n */\n version?: boolean\n\n /**\n * Indicates if this column is a treeChildrenCount column.\n */\n treeChildrenCount?: boolean\n\n /**\n * Indicates if this column is a treeLevel column.\n */\n treeLevel?: boolean\n\n /**\n * Column type. Must be one of the value from the ColumnTypes class.\n */\n type: ColumnType\n\n /**\n * Column name in the database.\n */\n name?: string\n\n /**\n * Column type's length. For example type = \"string\" and length = 100 means that ORM will create a column with\n * type varchar(100).\n */\n length?: string | number\n\n /**\n * Column type's display width. Used only on some column types in MySQL.\n * For example, INT(4) specifies an INT with a display width of four digits.\n */\n width?: number\n\n /**\n * Indicates if column's value can be set to NULL.\n */\n nullable?: boolean\n\n /**\n * Indicates if column value is not updated by \"save\" operation.\n * It means you'll be able to write this value only when you first time insert the object.\n * Default value is \"false\".\n *\n * @deprecated Please use the `update` option instead. Careful, it takes\n * the opposite value to readonly.\n *\n */\n readonly?: boolean\n\n /**\n * Indicates if column value is updated by \"save\" operation.\n * If false you'll be able to write this value only when you first time insert the object.\n * Default value is \"true\".\n */\n update?: boolean\n\n /**\n * Indicates if column is always selected by QueryBuilder and find operations.\n * Default value is \"true\".\n */\n select?: boolean\n\n /**\n * Indicates if column is inserted by default.\n * Default value is \"true\".\n */\n insert?: boolean\n\n /**\n * Specifies if this column will use AUTO_INCREMENT or not (e.g. generated number).\n */\n generated?: true | \"increment\" | \"uuid\" | \"rowid\"\n\n /**\n * Specifies if column's value must be unique or not.\n */\n unique?: boolean\n\n /**\n * Extra column definition. Should be used only in emergency situations. Note that if you'll use this property\n * auto schema generation will not work properly anymore. Avoid using it.\n */\n columnDefinition?: string\n\n /**\n * Column comment.\n */\n comment?: string\n\n /**\n * Default database value.\n */\n default?: any\n\n /**\n * ON UPDATE trigger. Works only for MySQL.\n */\n onUpdate?: string\n\n /**\n * The precision for a decimal (exact numeric) column (applies only for decimal column), which is the maximum\n * number of digits that are stored for the values.\n */\n precision?: number\n\n /**\n * The scale for a decimal (exact numeric) column (applies only for decimal column), which represents the number\n * of digits to the right of the decimal point and must not be greater than precision.\n */\n scale?: number\n\n /**\n * Puts ZEROFILL attribute on to numeric column. Works only for MySQL.\n * If you specify ZEROFILL for a numeric column, MySQL automatically adds the UNSIGNED attribute to the column\n */\n zerofill?: boolean\n\n /**\n * Puts UNSIGNED attribute on to numeric column. Works only for MySQL.\n */\n unsigned?: boolean\n\n /**\n * Defines a column character set.\n * Not supported by all database types.\n */\n charset?: string\n\n /**\n * Defines a column collation.\n */\n collation?: string\n\n /**\n * Array of possible enumerated values.\n */\n enum?: any[] | Object\n\n /**\n * Generated column expression
|
|
1
|
+
{"version":3,"sources":["../browser/src/entity-schema/EntitySchemaColumnOptions.ts"],"names":[],"mappings":"","file":"EntitySchemaColumnOptions.js","sourcesContent":["import { ColumnType } from \"../driver/types/ColumnTypes\"\nimport { ValueTransformer } from \"../decorator/options/ValueTransformer\"\nimport { SpatialColumnOptions } from \"../decorator/options/SpatialColumnOptions\"\n\nexport interface EntitySchemaColumnOptions extends SpatialColumnOptions {\n /**\n * Indicates if this column is a primary column.\n */\n primary?: boolean\n\n /**\n * Indicates if this column is of type ObjectID\n */\n objectId?: boolean\n\n /**\n * Indicates if this column is a created date column.\n */\n createDate?: boolean\n\n /**\n * Indicates if this column is an update date column.\n */\n updateDate?: boolean\n\n /**\n * Indicates if this column is a delete date column.\n */\n deleteDate?: boolean\n\n /**\n * Indicates if this column is a version column.\n */\n version?: boolean\n\n /**\n * Indicates if this column is a treeChildrenCount column.\n */\n treeChildrenCount?: boolean\n\n /**\n * Indicates if this column is a treeLevel column.\n */\n treeLevel?: boolean\n\n /**\n * Column type. Must be one of the value from the ColumnTypes class.\n */\n type: ColumnType\n\n /**\n * Column name in the database.\n */\n name?: string\n\n /**\n * Column type's length. For example type = \"string\" and length = 100 means that ORM will create a column with\n * type varchar(100).\n */\n length?: string | number\n\n /**\n * Column type's display width. Used only on some column types in MySQL.\n * For example, INT(4) specifies an INT with a display width of four digits.\n */\n width?: number\n\n /**\n * Indicates if column's value can be set to NULL.\n */\n nullable?: boolean\n\n /**\n * Indicates if column value is not updated by \"save\" operation.\n * It means you'll be able to write this value only when you first time insert the object.\n * Default value is \"false\".\n *\n * @deprecated Please use the `update` option instead. Careful, it takes\n * the opposite value to readonly.\n *\n */\n readonly?: boolean\n\n /**\n * Indicates if column value is updated by \"save\" operation.\n * If false you'll be able to write this value only when you first time insert the object.\n * Default value is \"true\".\n */\n update?: boolean\n\n /**\n * Indicates if column is always selected by QueryBuilder and find operations.\n * Default value is \"true\".\n */\n select?: boolean\n\n /**\n * Indicates if column is inserted by default.\n * Default value is \"true\".\n */\n insert?: boolean\n\n /**\n * Specifies if this column will use AUTO_INCREMENT or not (e.g. generated number).\n */\n generated?: true | \"increment\" | \"uuid\" | \"rowid\"\n\n /**\n * Specifies if column's value must be unique or not.\n */\n unique?: boolean\n\n /**\n * Extra column definition. Should be used only in emergency situations. Note that if you'll use this property\n * auto schema generation will not work properly anymore. Avoid using it.\n */\n columnDefinition?: string\n\n /**\n * Column comment.\n */\n comment?: string\n\n /**\n * Default database value.\n */\n default?: any\n\n /**\n * ON UPDATE trigger. Works only for MySQL.\n */\n onUpdate?: string\n\n /**\n * The precision for a decimal (exact numeric) column (applies only for decimal column), which is the maximum\n * number of digits that are stored for the values.\n */\n precision?: number\n\n /**\n * The scale for a decimal (exact numeric) column (applies only for decimal column), which represents the number\n * of digits to the right of the decimal point and must not be greater than precision.\n */\n scale?: number\n\n /**\n * Puts ZEROFILL attribute on to numeric column. Works only for MySQL.\n * If you specify ZEROFILL for a numeric column, MySQL automatically adds the UNSIGNED attribute to the column\n */\n zerofill?: boolean\n\n /**\n * Puts UNSIGNED attribute on to numeric column. Works only for MySQL.\n */\n unsigned?: boolean\n\n /**\n * Defines a column character set.\n * Not supported by all database types.\n */\n charset?: string\n\n /**\n * Defines a column collation.\n */\n collation?: string\n\n /**\n * Array of possible enumerated values.\n */\n enum?: any[] | Object\n\n /**\n * Generated column expression.\n */\n asExpression?: string\n\n /**\n * Generated column type.\n */\n generatedType?: \"VIRTUAL\" | \"STORED\"\n\n /**\n * Return type of HSTORE column.\n * Returns value as string or as object.\n */\n hstoreType?: \"object\" | \"string\"\n\n /**\n * Indicates if this column is an array.\n * Can be simply set to true or array length can be specified.\n * Supported only by postgres.\n */\n array?: boolean\n\n /**\n * Specifies a value transformer that is to be used to (un)marshal\n * this column when reading or writing to the database.\n */\n transformer?: ValueTransformer | ValueTransformer[]\n}\n"],"sourceRoot":".."}
|
|
@@ -132,11 +132,11 @@ export declare class ColumnMetadata {
|
|
|
132
132
|
*/
|
|
133
133
|
enumName?: string;
|
|
134
134
|
/**
|
|
135
|
-
* Generated column expression.
|
|
135
|
+
* Generated column expression.
|
|
136
136
|
*/
|
|
137
137
|
asExpression?: string;
|
|
138
138
|
/**
|
|
139
|
-
* Generated column type.
|
|
139
|
+
* Generated column type.
|
|
140
140
|
*/
|
|
141
141
|
generatedType?: "VIRTUAL" | "STORED";
|
|
142
142
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../browser/src/metadata/ColumnMetadata.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAEzD;;GAEG;AACH,MAAM,OAAO,cAAc;IAiTvB,wEAAwE;IACxE,cAAc;IACd,wEAAwE;IAExE,YAAY,OAUX;QA9TQ,mBAAa,GAAG,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;QAyCrD;;WAEG;QACH,WAAM,GAAW,EAAE,CAAA;QAiBnB;;WAEG;QACH,cAAS,GAAY,KAAK,CAAA;QAE1B;;WAEG;QACH,gBAAW,GAAY,KAAK,CAAA;QAE5B;;WAEG;QACH,eAAU,GAAY,KAAK,CAAA;QAE3B;;WAEG;QACH,aAAQ,GAAY,IAAI,CAAA;QAExB;;WAEG;QACH,aAAQ,GAAY,IAAI,CAAA;QAExB;;WAEG;QACH,aAAQ,GAAY,IAAI,CAAA;QA+CxB;;;WAGG;QACH,aAAQ,GAAY,KAAK,CAAA;QAEzB;;WAEG;QACH,aAAQ,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ACtB,OAAO,UAAU,CAAC,cAAc,CAAC,UAAU,CACvC,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,iBAAiB,EACtB,aAAa,CAChB,CAAA;IACL,CAAC;CACJ","file":"ColumnMetadata.js","sourcesContent":["import { ColumnType } from \"../driver/types/ColumnTypes\"\nimport { EntityMetadata } from \"./EntityMetadata\"\nimport { EmbeddedMetadata } from \"./EmbeddedMetadata\"\nimport { RelationMetadata } from \"./RelationMetadata\"\nimport { ObjectLiteral } from \"../common/ObjectLiteral\"\nimport { ColumnMetadataArgs } from \"../metadata-args/ColumnMetadataArgs\"\nimport { DataSource } from \"../data-source/DataSource\"\nimport { OrmUtils } from \"../util/OrmUtils\"\nimport { ValueTransformer } from \"../decorator/options/ValueTransformer\"\nimport { ApplyValueTransformers } from \"../util/ApplyValueTransformers\"\nimport { ObjectUtils } from \"../util/ObjectUtils\"\nimport { InstanceChecker } from \"../util/InstanceChecker\"\n\n/**\n * This metadata contains all information about entity's column.\n */\nexport class ColumnMetadata {\n readonly \"@instanceof\" = Symbol.for(\"ColumnMetadata\")\n\n // ---------------------------------------------------------------------\n // Public Properties\n // ---------------------------------------------------------------------\n\n /**\n * Target class where column decorator is used.\n * This may not be always equal to entity metadata (for example embeds or inheritance cases).\n */\n target: Function | string\n\n /**\n * Entity metadata where this column metadata is.\n *\n * For example for @Column() name: string in Post, entityMetadata will be metadata of Post entity.\n */\n entityMetadata: EntityMetadata\n\n /**\n * Embedded metadata where this column metadata is.\n * If this column is not in embed then this property value is undefined.\n */\n embeddedMetadata?: EmbeddedMetadata\n\n /**\n * If column is a foreign key of some relation then this relation's metadata will be there.\n * If this column does not have a foreign key then this property value is undefined.\n */\n relationMetadata?: RelationMetadata\n\n /**\n * Class's property name on which this column is applied.\n */\n propertyName: string\n\n /**\n * The database type of the column.\n */\n type: ColumnType\n\n /**\n * Type's length in the database.\n */\n length: string = \"\"\n\n /**\n * Type's display width in the database.\n */\n width?: number\n\n /**\n * Defines column character set.\n */\n charset?: string\n\n /**\n * Defines column collation.\n */\n collation?: string\n\n /**\n * Indicates if this column is a primary key.\n */\n isPrimary: boolean = false\n\n /**\n * Indicates if this column is generated (auto increment or generated other way).\n */\n isGenerated: boolean = false\n\n /**\n * Indicates if column can contain nulls or not.\n */\n isNullable: boolean = false\n\n /**\n * Indicates if column is selected by query builder or not.\n */\n isSelect: boolean = true\n\n /**\n * Indicates if column is inserted by default or not.\n */\n isInsert: boolean = true\n\n /**\n * Indicates if column allows updates or not.\n */\n isUpdate: boolean = true\n\n /**\n * Specifies generation strategy if this column will use auto increment.\n */\n generationStrategy?: \"uuid\" | \"increment\" | \"rowid\"\n\n /**\n * Identity column type. Supports only in Postgres 10+.\n */\n generatedIdentity?: \"ALWAYS\" | \"BY DEFAULT\"\n\n /**\n * Column comment.\n * This feature is not supported by all databases.\n */\n comment?: string\n\n /**\n * Default database value.\n */\n default?:\n | number\n | boolean\n | string\n | null\n | (number | boolean | string)[]\n | Record<string, object>\n | (() => string)\n\n /**\n * ON UPDATE trigger. Works only for MySQL.\n */\n onUpdate?: string\n\n /**\n * The precision for a decimal (exact numeric) column (applies only for decimal column),\n * which is the maximum number of digits that are stored for the values.\n */\n precision?: number | null\n\n /**\n * The scale for a decimal (exact numeric) column (applies only for decimal column),\n * which represents the number of digits to the right of the decimal point and must not be greater than precision.\n */\n scale?: number\n\n /**\n * Puts ZEROFILL attribute on to numeric column. Works only for MySQL.\n * If you specify ZEROFILL for a numeric column, MySQL automatically adds the UNSIGNED attribute to the column\n */\n zerofill: boolean = false\n\n /**\n * Puts UNSIGNED attribute on to numeric column. Works only for MySQL.\n */\n unsigned: boolean = false\n\n /**\n * Array of possible enumerated values.\n *\n * `postgres` and `mysql` store enum values as strings but we want to keep support\n * for numeric and heterogeneous based typescript enums, so we need (string|number)[]\n */\n enum?: (string | number)[]\n\n /**\n * Exact name of enum\n */\n enumName?: string\n\n /**\n * Generated column expression. Supports only in MySQL.\n */\n asExpression?: string\n\n /**\n * Generated column type. Supports only in MySQL.\n */\n generatedType?: \"VIRTUAL\" | \"STORED\"\n\n /**\n * Return type of HSTORE column.\n * Returns value as string or as object.\n */\n hstoreType?: \"object\" | \"string\"\n\n /**\n * Indicates if this column is an array.\n */\n isArray: boolean = false\n\n /**\n * Gets full path to this column property (including column property name).\n * Full path is relevant when column is used in embeds (one or multiple nested).\n * For example it will return \"counters.subcounters.likes\".\n * If property is not in embeds then it returns just property name of the column.\n */\n propertyPath: string\n\n /**\n * Same as property path, but dots are replaced with '_'.\n * Used in query builder statements.\n */\n propertyAliasName: string\n\n /**\n * Gets full path to this column database name (including column database name).\n * Full path is relevant when column is used in embeds (one or multiple nested).\n * For example it will return \"counters.subcounters.likes\".\n * If property is not in embeds then it returns just database name of the column.\n */\n databasePath: string\n\n /**\n * Complete column name in the database including its embedded prefixes.\n */\n databaseName: string\n\n /**\n * Database name in the database without embedded prefixes applied.\n */\n databaseNameWithoutPrefixes: string\n\n /**\n * Database name set by entity metadata builder, not yet passed naming strategy process and without embedded prefixes.\n */\n givenDatabaseName?: string\n\n /**\n * Indicates if column is virtual. Virtual columns are not mapped to the entity.\n */\n isVirtual: boolean = false\n\n /**\n * Indicates if column is discriminator. Discriminator columns are not mapped to the entity.\n */\n isDiscriminator: boolean = false\n\n /**\n * Indicates if column is tree-level column. Tree-level columns are used in closure entities.\n */\n isTreeLevel: boolean = false\n\n /**\n * Indicates if this column contains an entity creation date.\n */\n isCreateDate: boolean = false\n\n /**\n * Indicates if this column contains an entity update date.\n */\n isUpdateDate: boolean = false\n\n /**\n * Indicates if this column contains an entity delete date.\n */\n isDeleteDate: boolean = false\n\n /**\n * Indicates if this column contains an entity version.\n */\n isVersion: boolean = false\n\n /**\n * Indicates if this column contains an object id.\n */\n isObjectId: boolean = false\n\n /**\n * If this column is foreign key then it references some other column,\n * and this property will contain reference to this column.\n */\n referencedColumn: ColumnMetadata | undefined\n\n /**\n * Specifies a value transformer that is to be used to (un)marshal\n * this column when reading or writing to the database.\n */\n transformer?: ValueTransformer | ValueTransformer[]\n\n /**\n * Column type in the case if this column is in the closure table.\n * Column can be ancestor or descendant in the closure tables.\n */\n closureType?: \"ancestor\" | \"descendant\"\n\n /**\n * Indicates if this column is nested set's left column.\n * Used only in tree entities with nested-set type.\n */\n isNestedSetLeft: boolean = false\n\n /**\n * Indicates if this column is nested set's right column.\n * Used only in tree entities with nested-set type.\n */\n isNestedSetRight: boolean = false\n\n /**\n * Indicates if this column is materialized path's path column.\n * Used only in tree entities with materialized path type.\n */\n isMaterializedPath: boolean = false\n\n /**\n * Spatial Feature Type (Geometry, Point, Polygon, etc.)\n */\n spatialFeatureType?: string\n\n /**\n * SRID (Spatial Reference ID (EPSG code))\n */\n srid?: number\n\n // ---------------------------------------------------------------------\n // Constructor\n // ---------------------------------------------------------------------\n\n constructor(options: {\n connection: DataSource\n entityMetadata: EntityMetadata\n embeddedMetadata?: EmbeddedMetadata\n referencedColumn?: ColumnMetadata\n args: ColumnMetadataArgs\n closureType?: \"ancestor\" | \"descendant\"\n nestedSetLeft?: boolean\n nestedSetRight?: boolean\n materializedPath?: boolean\n }) {\n this.entityMetadata = options.entityMetadata\n this.embeddedMetadata = options.embeddedMetadata!\n this.referencedColumn = options.referencedColumn\n if (options.args.target) this.target = options.args.target\n if (options.args.propertyName)\n this.propertyName = options.args.propertyName\n if (options.args.options.name)\n this.givenDatabaseName = options.args.options.name\n if (options.args.options.type) this.type = options.args.options.type\n if (options.args.options.length)\n this.length = options.args.options.length\n ? options.args.options.length.toString()\n : \"\"\n if (options.args.options.width) this.width = options.args.options.width\n if (options.args.options.charset)\n this.charset = options.args.options.charset\n if (options.args.options.collation)\n this.collation = options.args.options.collation\n if (options.args.options.primary)\n this.isPrimary = options.args.options.primary\n if (options.args.options.default === null)\n // to make sure default: null is the same as nullable: true\n this.isNullable = true\n if (options.args.options.nullable !== undefined)\n this.isNullable = options.args.options.nullable\n if (options.args.options.select !== undefined)\n this.isSelect = options.args.options.select\n if (options.args.options.insert !== undefined)\n this.isInsert = options.args.options.insert\n if (options.args.options.update !== undefined)\n this.isUpdate = options.args.options.update\n if (options.args.options.readonly !== undefined)\n this.isUpdate = !options.args.options.readonly\n if (options.args.options.comment)\n this.comment = options.args.options.comment\n if (options.args.options.default !== undefined)\n this.default = options.args.options.default\n if (options.args.options.onUpdate)\n this.onUpdate = options.args.options.onUpdate\n if (options.args.options.generatedIdentity)\n this.generatedIdentity = options.args.options.generatedIdentity\n if (\n options.args.options.scale !== null &&\n options.args.options.scale !== undefined\n )\n this.scale = options.args.options.scale\n if (options.args.options.zerofill) {\n this.zerofill = options.args.options.zerofill\n this.unsigned = true // if you specify ZEROFILL for a numeric column, MySQL automatically adds the UNSIGNED attribute to the column\n }\n if (options.args.options.unsigned)\n this.unsigned = options.args.options.unsigned\n if (options.args.options.precision !== null)\n this.precision = options.args.options.precision\n if (options.args.options.enum) {\n if (\n ObjectUtils.isObject(options.args.options.enum) &&\n !Array.isArray(options.args.options.enum)\n ) {\n this.enum = Object.keys(options.args.options.enum)\n // remove numeric keys - typescript numeric enum types generate them\n // From the documentation: “declaration merging” means that the compiler merges two separate declarations\n // declared with the same name into a single definition. This concept is often used to merge enum with namespace\n // where in namespace we define e.g. utility methods for creating enum. This is well known in other languages\n // like Java (enum methods). Here in case if enum have function, we need to remove it from metadata, otherwise\n // generated SQL statements contains string representation of that function which leads into syntax error\n // at database side.\n .filter(\n (key) =>\n isNaN(+key) &&\n typeof (options.args.options.enum as ObjectLiteral)[\n key\n ] !== \"function\",\n )\n .map(\n (key) =>\n (options.args.options.enum as ObjectLiteral)[key],\n )\n } else {\n this.enum = options.args.options.enum\n }\n }\n if (options.args.options.enumName) {\n this.enumName = options.args.options.enumName\n }\n if (options.args.options.asExpression) {\n this.asExpression = options.args.options.asExpression\n this.generatedType = options.args.options.generatedType\n ? options.args.options.generatedType\n : \"VIRTUAL\"\n }\n if (options.args.options.hstoreType)\n this.hstoreType = options.args.options.hstoreType\n if (options.args.options.array)\n this.isArray = options.args.options.array\n if (options.args.mode) {\n this.isVirtual = options.args.mode === \"virtual\"\n this.isTreeLevel = options.args.mode === \"treeLevel\"\n this.isCreateDate = options.args.mode === \"createDate\"\n this.isUpdateDate = options.args.mode === \"updateDate\"\n this.isDeleteDate = options.args.mode === \"deleteDate\"\n this.isVersion = options.args.mode === \"version\"\n this.isObjectId = options.args.mode === \"objectId\"\n }\n if (options.args.options.transformer)\n this.transformer = options.args.options.transformer\n if (options.args.options.spatialFeatureType)\n this.spatialFeatureType = options.args.options.spatialFeatureType\n if (options.args.options.srid !== undefined)\n this.srid = options.args.options.srid\n if (this.isTreeLevel)\n this.type = options.connection.driver.mappedDataTypes.treeLevel\n if (this.isCreateDate) {\n if (!this.type)\n this.type = options.connection.driver.mappedDataTypes.createDate\n if (!this.default)\n this.default = () =>\n options.connection.driver.mappedDataTypes.createDateDefault\n // skip precision if it was explicitly set to \"null\" in column options. Otherwise use default precision if it exist.\n if (\n this.precision === undefined &&\n options.args.options.precision === undefined &&\n options.connection.driver.mappedDataTypes.createDatePrecision\n )\n this.precision =\n options.connection.driver.mappedDataTypes.createDatePrecision\n }\n if (this.isUpdateDate) {\n if (!this.type)\n this.type = options.connection.driver.mappedDataTypes.updateDate\n if (!this.default)\n this.default = () =>\n options.connection.driver.mappedDataTypes.updateDateDefault\n if (!this.onUpdate)\n this.onUpdate =\n options.connection.driver.mappedDataTypes.updateDateDefault\n // skip precision if it was explicitly set to \"null\" in column options. Otherwise use default precision if it exist.\n if (\n this.precision === undefined &&\n options.args.options.precision === undefined &&\n options.connection.driver.mappedDataTypes.updateDatePrecision\n )\n this.precision =\n options.connection.driver.mappedDataTypes.updateDatePrecision\n }\n if (this.isDeleteDate) {\n if (!this.type)\n this.type = options.connection.driver.mappedDataTypes.deleteDate\n if (!this.isNullable)\n this.isNullable =\n options.connection.driver.mappedDataTypes.deleteDateNullable\n // skip precision if it was explicitly set to \"null\" in column options. Otherwise use default precision if it exist.\n if (\n this.precision === undefined &&\n options.args.options.precision === undefined &&\n options.connection.driver.mappedDataTypes.deleteDatePrecision\n )\n this.precision =\n options.connection.driver.mappedDataTypes.deleteDatePrecision\n }\n if (this.isVersion)\n this.type = options.connection.driver.mappedDataTypes.version\n if (options.closureType) this.closureType = options.closureType\n if (options.nestedSetLeft) this.isNestedSetLeft = options.nestedSetLeft\n if (options.nestedSetRight)\n this.isNestedSetRight = options.nestedSetRight\n if (options.materializedPath)\n this.isMaterializedPath = options.materializedPath\n }\n\n // ---------------------------------------------------------------------\n // Public Methods\n // ---------------------------------------------------------------------\n\n /**\n * Creates entity id map from the given entity ids array.\n */\n createValueMap(value: any, useDatabaseName = false) {\n // extract column value from embeds of entity if column is in embedded\n if (this.embeddedMetadata) {\n // example: post[data][information][counters].id where \"data\", \"information\" and \"counters\" are embeddeds\n // we need to get value of \"id\" column from the post real entity object and return it in a\n // { data: { information: { counters: { id: ... } } } } format\n\n // first step - we extract all parent properties of the entity relative to this column, e.g. [data, information, counters]\n const propertyNames = [...this.embeddedMetadata.parentPropertyNames]\n\n // now need to access post[data][information][counters] to get column value from the counters\n // and on each step we need to create complex literal object, e.g. first { data },\n // then { data: { information } }, then { data: { information: { counters } } },\n // then { data: { information: { counters: [this.propertyName]: entity[data][information][counters][this.propertyName] } } }\n // this recursive function helps doing that\n const extractEmbeddedColumnValue = (\n propertyNames: string[],\n map: ObjectLiteral,\n ): any => {\n const propertyName = propertyNames.shift()\n if (propertyName) {\n map[propertyName] = {}\n extractEmbeddedColumnValue(propertyNames, map[propertyName])\n return map\n }\n\n // this is bugfix for #720 when increment number is bigint we need to make sure its a string\n if (\n (this.generationStrategy === \"increment\" ||\n this.generationStrategy === \"rowid\") &&\n this.type === \"bigint\" &&\n value !== null\n )\n value = String(value)\n\n map[useDatabaseName ? this.databaseName : this.propertyName] =\n value\n return map\n }\n return extractEmbeddedColumnValue(propertyNames, {})\n } else {\n // no embeds - no problems. Simply return column property name and its value of the entity\n\n // this is bugfix for #720 when increment number is bigint we need to make sure its a string\n if (\n (this.generationStrategy === \"increment\" ||\n this.generationStrategy === \"rowid\") &&\n this.type === \"bigint\" &&\n value !== null\n )\n value = String(value)\n\n return {\n [useDatabaseName ? this.databaseName : this.propertyName]:\n value,\n }\n }\n }\n\n /**\n * Extracts column value and returns its column name with this value in a literal object.\n * If column is in embedded (or recursive embedded) it returns complex literal object.\n *\n * Examples what this method can return depend if this column is in embeds.\n * { id: 1 } or { title: \"hello\" }, { counters: { code: 1 } }, { data: { information: { counters: { code: 1 } } } }\n */\n getEntityValueMap(\n entity: ObjectLiteral,\n options?: { skipNulls?: boolean },\n ): ObjectLiteral | undefined {\n const returnNulls = false // options && options.skipNulls === false ? false : true; // todo: remove if current will not bring problems, uncomment if it will.\n\n // extract column value from embeds of entity if column is in embedded\n if (this.embeddedMetadata) {\n // example: post[data][information][counters].id where \"data\", \"information\" and \"counters\" are embeddeds\n // we need to get value of \"id\" column from the post real entity object and return it in a\n // { data: { information: { counters: { id: ... } } } } format\n\n // first step - we extract all parent properties of the entity relative to this column, e.g. [data, information, counters]\n const propertyNames = [...this.embeddedMetadata.parentPropertyNames]\n const isEmbeddedArray = this.embeddedMetadata.isArray\n\n // now need to access post[data][information][counters] to get column value from the counters\n // and on each step we need to create complex literal object, e.g. first { data },\n // then { data: { information } }, then { data: { information: { counters } } },\n // then { data: { information: { counters: [this.propertyName]: entity[data][information][counters][this.propertyName] } } }\n // this recursive function helps doing that\n const extractEmbeddedColumnValue = (\n propertyNames: string[],\n value: ObjectLiteral,\n ): ObjectLiteral => {\n if (value === undefined) {\n return {}\n }\n\n const propertyName = propertyNames.shift()\n\n if (propertyName) {\n const submap = extractEmbeddedColumnValue(\n propertyNames,\n value[propertyName],\n )\n if (Object.keys(submap).length > 0) {\n return { [propertyName]: submap }\n }\n return {}\n }\n\n if (isEmbeddedArray && Array.isArray(value)) {\n return value.map((v) => ({\n [this.propertyName]: v[this.propertyName],\n }))\n }\n\n if (\n value[this.propertyName] !== undefined &&\n (returnNulls === false || value[this.propertyName] !== null)\n ) {\n return { [this.propertyName]: value[this.propertyName] }\n }\n\n return {}\n }\n const map = extractEmbeddedColumnValue(propertyNames, entity)\n\n return Object.keys(map).length > 0 ? map : undefined\n } else {\n // no embeds - no problems. Simply return column property name and its value of the entity\n /**\n * Object.getOwnPropertyDescriptor checks if the relation is lazy, in which case value is a Promise\n * DO NOT use `entity[\n this.relationMetadata.propertyName] instanceof Promise`, which will invoke property getter and make unwanted DB request\n * refer: https://github.com/typeorm/typeorm/pull/8676#issuecomment-1049906331\n */\n if (\n this.relationMetadata &&\n !Object.getOwnPropertyDescriptor(\n entity,\n this.relationMetadata.propertyName,\n )?.get &&\n entity[this.relationMetadata.propertyName] &&\n ObjectUtils.isObject(entity[this.relationMetadata.propertyName])\n ) {\n const map = this.relationMetadata.joinColumns.reduce(\n (map, joinColumn) => {\n const value =\n joinColumn.referencedColumn!.getEntityValueMap(\n entity[this.relationMetadata!.propertyName],\n )\n if (value === undefined) return map\n return OrmUtils.mergeDeep(map, value)\n },\n {},\n )\n if (Object.keys(map).length > 0)\n return { [this.propertyName]: map }\n\n return undefined\n } else {\n if (\n entity[this.propertyName] !== undefined &&\n (returnNulls === false ||\n entity[this.propertyName] !== null)\n )\n return { [this.propertyName]: entity[this.propertyName] }\n\n return undefined\n }\n }\n }\n\n /**\n * Extracts column value from the given entity.\n * If column is in embedded (or recursive embedded) it extracts its value from there.\n */\n getEntityValue(\n entity: ObjectLiteral,\n transform: boolean = false,\n ): any | undefined {\n if (entity === undefined || entity === null) return undefined\n\n // extract column value from embeddeds of entity if column is in embedded\n let value: any = undefined\n if (this.embeddedMetadata) {\n // example: post[data][information][counters].id where \"data\", \"information\" and \"counters\" are embeddeds\n // we need to get value of \"id\" column from the post real entity object\n\n // first step - we extract all parent properties of the entity relative to this column, e.g. [data, information, counters]\n const propertyNames = [...this.embeddedMetadata.parentPropertyNames]\n const isEmbeddedArray = this.embeddedMetadata.isArray\n\n // next we need to access post[data][information][counters][this.propertyName] to get column value from the counters\n // this recursive function takes array of generated property names and gets the post[data][information][counters] embed\n const extractEmbeddedColumnValue = (\n propertyNames: string[],\n value: ObjectLiteral,\n ): any => {\n const propertyName = propertyNames.shift()\n return propertyName && value\n ? extractEmbeddedColumnValue(\n propertyNames,\n value[propertyName],\n )\n : value\n }\n\n // once we get nested embed object we get its column, e.g. post[data][information][counters][this.propertyName]\n const embeddedObject = extractEmbeddedColumnValue(\n propertyNames,\n entity,\n )\n if (embeddedObject) {\n if (this.relationMetadata && this.referencedColumn) {\n const relatedEntity =\n this.relationMetadata.getEntityValue(embeddedObject)\n if (\n relatedEntity &&\n ObjectUtils.isObject(relatedEntity) &&\n !InstanceChecker.isFindOperator(relatedEntity) &&\n !Buffer.isBuffer(relatedEntity)\n ) {\n value =\n this.referencedColumn.getEntityValue(relatedEntity)\n } else if (\n embeddedObject[this.propertyName] &&\n ObjectUtils.isObject(\n embeddedObject[this.propertyName],\n ) &&\n !InstanceChecker.isFindOperator(\n embeddedObject[this.propertyName],\n ) &&\n !Buffer.isBuffer(embeddedObject[this.propertyName]) &&\n !(embeddedObject[this.propertyName] instanceof Date)\n ) {\n value = this.referencedColumn.getEntityValue(\n embeddedObject[this.propertyName],\n )\n } else {\n value = embeddedObject[this.propertyName]\n }\n } else if (this.referencedColumn) {\n value = this.referencedColumn.getEntityValue(\n embeddedObject[this.propertyName],\n )\n } else if (isEmbeddedArray && Array.isArray(embeddedObject)) {\n value = embeddedObject.map((o) => o[this.propertyName])\n } else {\n value = embeddedObject[this.propertyName]\n }\n }\n } else {\n // no embeds - no problems. Simply return column name by property name of the entity\n if (this.relationMetadata && this.referencedColumn) {\n const relatedEntity =\n this.relationMetadata.getEntityValue(entity)\n if (\n relatedEntity &&\n ObjectUtils.isObject(relatedEntity) &&\n !InstanceChecker.isFindOperator(relatedEntity) &&\n !(typeof relatedEntity === \"function\") &&\n !Buffer.isBuffer(relatedEntity)\n ) {\n value = this.referencedColumn.getEntityValue(relatedEntity)\n } else if (\n entity[this.propertyName] &&\n ObjectUtils.isObject(entity[this.propertyName]) &&\n !InstanceChecker.isFindOperator(\n entity[this.propertyName],\n ) &&\n !(typeof entity[this.propertyName] === \"function\") &&\n !Buffer.isBuffer(entity[this.propertyName]) &&\n !(entity[this.propertyName] instanceof Date)\n ) {\n value = this.referencedColumn.getEntityValue(\n entity[this.propertyName],\n )\n } else {\n value = entity[this.propertyName]\n }\n } else if (this.referencedColumn) {\n value = this.referencedColumn.getEntityValue(\n entity[this.propertyName],\n )\n } else {\n value = entity[this.propertyName]\n }\n }\n\n if (transform && this.transformer)\n value = ApplyValueTransformers.transformTo(this.transformer, value)\n\n return value\n }\n\n /**\n * Sets given entity's column value.\n * Using of this method helps to set entity relation's value of the lazy and non-lazy relations.\n */\n setEntityValue(entity: ObjectLiteral, value: any): void {\n if (this.embeddedMetadata) {\n // first step - we extract all parent properties of the entity relative to this column, e.g. [data, information, counters]\n const extractEmbeddedColumnValue = (\n embeddedMetadatas: EmbeddedMetadata[],\n map: ObjectLiteral,\n ): any => {\n // if (!object[embeddedMetadata.propertyName])\n // object[embeddedMetadata.propertyName] = embeddedMetadata.create();\n\n const embeddedMetadata = embeddedMetadatas.shift()\n if (embeddedMetadata) {\n if (!map[embeddedMetadata.propertyName])\n map[embeddedMetadata.propertyName] =\n embeddedMetadata.create()\n\n extractEmbeddedColumnValue(\n embeddedMetadatas,\n map[embeddedMetadata.propertyName],\n )\n return map\n }\n map[this.propertyName] = value\n return map\n }\n return extractEmbeddedColumnValue(\n [...this.embeddedMetadata.embeddedMetadataTree],\n entity,\n )\n } else {\n // we write a deep object in this entity only if the column is virtual\n // because if its not virtual it means the user defined a real column for this relation\n // also we don't do it if column is inside a junction table\n if (\n !this.entityMetadata.isJunction &&\n this.isVirtual &&\n this.referencedColumn &&\n this.referencedColumn.propertyName !== this.propertyName\n ) {\n if (!(this.propertyName in entity)) {\n entity[this.propertyName] = {}\n }\n\n entity[this.propertyName][this.referencedColumn.propertyName] =\n value\n } else {\n entity[this.propertyName] = value\n }\n }\n }\n\n /**\n * Compares given entity's column value with a given value.\n */\n compareEntityValue(entity: any, valueToCompareWith: any) {\n const columnValue = this.getEntityValue(entity)\n if (ObjectUtils.isObject(columnValue)) {\n return columnValue.equals(valueToCompareWith)\n }\n return columnValue === valueToCompareWith\n }\n\n // ---------------------------------------------------------------------\n // Builder Methods\n // ---------------------------------------------------------------------\n\n build(connection: DataSource): this {\n this.propertyPath = this.buildPropertyPath()\n this.propertyAliasName = this.propertyPath.replace(\".\", \"_\")\n this.databaseName = this.buildDatabaseName(connection)\n this.databasePath = this.buildDatabasePath()\n this.databaseNameWithoutPrefixes = connection.namingStrategy.columnName(\n this.propertyName,\n this.givenDatabaseName,\n [],\n )\n return this\n }\n\n protected buildPropertyPath(): string {\n let path = \"\"\n if (\n this.embeddedMetadata &&\n this.embeddedMetadata.parentPropertyNames.length\n )\n path = this.embeddedMetadata.parentPropertyNames.join(\".\") + \".\"\n\n path += this.propertyName\n\n // we add reference column to property path only if this column is virtual\n // because if its not virtual it means user defined a real column for this relation\n // also we don't do it if column is inside a junction table\n if (\n !this.entityMetadata.isJunction &&\n this.isVirtual &&\n this.referencedColumn &&\n this.referencedColumn.propertyName !== this.propertyName\n )\n path += \".\" + this.referencedColumn.propertyName\n\n return path\n }\n\n protected buildDatabasePath(): string {\n let path = \"\"\n if (\n this.embeddedMetadata &&\n this.embeddedMetadata.parentPropertyNames.length\n )\n path = this.embeddedMetadata.parentPropertyNames.join(\".\") + \".\"\n\n path += this.databaseName\n\n // we add reference column to property path only if this column is virtual\n // because if its not virtual it means user defined a real column for this relation\n // also we don't do it if column is inside a junction table\n if (\n !this.entityMetadata.isJunction &&\n this.isVirtual &&\n this.referencedColumn &&\n this.referencedColumn.databaseName !== this.databaseName\n )\n path += \".\" + this.referencedColumn.databaseName\n\n return path\n }\n\n protected buildDatabaseName(connection: DataSource): string {\n let propertyNames = this.embeddedMetadata\n ? this.embeddedMetadata.parentPrefixes\n : []\n if (connection.driver.options.type === \"mongodb\")\n // we don't need to include embedded name for the mongodb column names\n propertyNames = []\n return connection.namingStrategy.columnName(\n this.propertyName,\n this.givenDatabaseName,\n propertyNames,\n )\n }\n}\n"],"sourceRoot":".."}
|
|
1
|
+
{"version":3,"sources":["../browser/src/metadata/ColumnMetadata.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAEzD;;GAEG;AACH,MAAM,OAAO,cAAc;IAiTvB,wEAAwE;IACxE,cAAc;IACd,wEAAwE;IAExE,YAAY,OAUX;QA9TQ,mBAAa,GAAG,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;QAyCrD;;WAEG;QACH,WAAM,GAAW,EAAE,CAAA;QAiBnB;;WAEG;QACH,cAAS,GAAY,KAAK,CAAA;QAE1B;;WAEG;QACH,gBAAW,GAAY,KAAK,CAAA;QAE5B;;WAEG;QACH,eAAU,GAAY,KAAK,CAAA;QAE3B;;WAEG;QACH,aAAQ,GAAY,IAAI,CAAA;QAExB;;WAEG;QACH,aAAQ,GAAY,IAAI,CAAA;QAExB;;WAEG;QACH,aAAQ,GAAY,IAAI,CAAA;QA+CxB;;;WAGG;QACH,aAAQ,GAAY,KAAK,CAAA;QAEzB;;WAEG;QACH,aAAQ,GAAY,KAAK,CAAA;QA+BzB;;WAEG;QACH,YAAO,GAAY,KAAK,CAAA;QAuCxB;;WAEG;QACH,cAAS,GAAY,KAAK,CAAA;QAE1B;;WAEG;QACH,oBAAe,GAAY,KAAK,CAAA;QAEhC;;WAEG;QACH,gBAAW,GAAY,KAAK,CAAA;QAE5B;;WAEG;QACH,iBAAY,GAAY,KAAK,CAAA;QAE7B;;WAEG;QACH,iBAAY,GAAY,KAAK,CAAA;QAE7B;;WAEG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AAG,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAA;QAEpD,OAAO,IAAI,CAAA;IACf,CAAC;IAES,iBAAiB;QACvB,IAAI,IAAI,GAAG,EAAE,CAAA;QACb,IACI,IAAI,CAAC,gBAAgB;YACrB,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,MAAM;YAEhD,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAA;QAEpE,IAAI,IAAI,IAAI,CAAC,YAAY,CAAA;QAEzB,0EAA0E;QAC1E,mFAAmF;QACnF,2DAA2D;QAC3D,IACI,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU;YAC/B,IAAI,CAAC,SAAS;YACd,IAAI,CAAC,gBAAgB;YACrB,IAAI,CAAC,gBAAgB,CAAC,YAAY,KAAK,IAAI,CAAC,YAAY;YAExD,IAAI,IAAI,GAAG,GAAG,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAA;QAEpD,OAAO,IAAI,CAAA;IACf,CAAC;IAES,iBAAiB,CAAC,UAAsB;QAC9C,IAAI,aAAa,GAAG,IAAI,CAAC,gBAAgB;YACrC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,cAAc;YACtC,CAAC,CAAC,EAAE,CAAA;QACR,IAAI,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS;YAC5C,sEAAsE;YACtE,aAAa,GAAG,EAAE,CAAA;QACtB,OAAO,UAAU,CAAC,cAAc,CAAC,UAAU,CACvC,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,iBAAiB,EACtB,aAAa,CAChB,CAAA;IACL,CAAC;CACJ","file":"ColumnMetadata.js","sourcesContent":["import { ColumnType } from \"../driver/types/ColumnTypes\"\nimport { EntityMetadata } from \"./EntityMetadata\"\nimport { EmbeddedMetadata } from \"./EmbeddedMetadata\"\nimport { RelationMetadata } from \"./RelationMetadata\"\nimport { ObjectLiteral } from \"../common/ObjectLiteral\"\nimport { ColumnMetadataArgs } from \"../metadata-args/ColumnMetadataArgs\"\nimport { DataSource } from \"../data-source/DataSource\"\nimport { OrmUtils } from \"../util/OrmUtils\"\nimport { ValueTransformer } from \"../decorator/options/ValueTransformer\"\nimport { ApplyValueTransformers } from \"../util/ApplyValueTransformers\"\nimport { ObjectUtils } from \"../util/ObjectUtils\"\nimport { InstanceChecker } from \"../util/InstanceChecker\"\n\n/**\n * This metadata contains all information about entity's column.\n */\nexport class ColumnMetadata {\n readonly \"@instanceof\" = Symbol.for(\"ColumnMetadata\")\n\n // ---------------------------------------------------------------------\n // Public Properties\n // ---------------------------------------------------------------------\n\n /**\n * Target class where column decorator is used.\n * This may not be always equal to entity metadata (for example embeds or inheritance cases).\n */\n target: Function | string\n\n /**\n * Entity metadata where this column metadata is.\n *\n * For example for @Column() name: string in Post, entityMetadata will be metadata of Post entity.\n */\n entityMetadata: EntityMetadata\n\n /**\n * Embedded metadata where this column metadata is.\n * If this column is not in embed then this property value is undefined.\n */\n embeddedMetadata?: EmbeddedMetadata\n\n /**\n * If column is a foreign key of some relation then this relation's metadata will be there.\n * If this column does not have a foreign key then this property value is undefined.\n */\n relationMetadata?: RelationMetadata\n\n /**\n * Class's property name on which this column is applied.\n */\n propertyName: string\n\n /**\n * The database type of the column.\n */\n type: ColumnType\n\n /**\n * Type's length in the database.\n */\n length: string = \"\"\n\n /**\n * Type's display width in the database.\n */\n width?: number\n\n /**\n * Defines column character set.\n */\n charset?: string\n\n /**\n * Defines column collation.\n */\n collation?: string\n\n /**\n * Indicates if this column is a primary key.\n */\n isPrimary: boolean = false\n\n /**\n * Indicates if this column is generated (auto increment or generated other way).\n */\n isGenerated: boolean = false\n\n /**\n * Indicates if column can contain nulls or not.\n */\n isNullable: boolean = false\n\n /**\n * Indicates if column is selected by query builder or not.\n */\n isSelect: boolean = true\n\n /**\n * Indicates if column is inserted by default or not.\n */\n isInsert: boolean = true\n\n /**\n * Indicates if column allows updates or not.\n */\n isUpdate: boolean = true\n\n /**\n * Specifies generation strategy if this column will use auto increment.\n */\n generationStrategy?: \"uuid\" | \"increment\" | \"rowid\"\n\n /**\n * Identity column type. Supports only in Postgres 10+.\n */\n generatedIdentity?: \"ALWAYS\" | \"BY DEFAULT\"\n\n /**\n * Column comment.\n * This feature is not supported by all databases.\n */\n comment?: string\n\n /**\n * Default database value.\n */\n default?:\n | number\n | boolean\n | string\n | null\n | (number | boolean | string)[]\n | Record<string, object>\n | (() => string)\n\n /**\n * ON UPDATE trigger. Works only for MySQL.\n */\n onUpdate?: string\n\n /**\n * The precision for a decimal (exact numeric) column (applies only for decimal column),\n * which is the maximum number of digits that are stored for the values.\n */\n precision?: number | null\n\n /**\n * The scale for a decimal (exact numeric) column (applies only for decimal column),\n * which represents the number of digits to the right of the decimal point and must not be greater than precision.\n */\n scale?: number\n\n /**\n * Puts ZEROFILL attribute on to numeric column. Works only for MySQL.\n * If you specify ZEROFILL for a numeric column, MySQL automatically adds the UNSIGNED attribute to the column\n */\n zerofill: boolean = false\n\n /**\n * Puts UNSIGNED attribute on to numeric column. Works only for MySQL.\n */\n unsigned: boolean = false\n\n /**\n * Array of possible enumerated values.\n *\n * `postgres` and `mysql` store enum values as strings but we want to keep support\n * for numeric and heterogeneous based typescript enums, so we need (string|number)[]\n */\n enum?: (string | number)[]\n\n /**\n * Exact name of enum\n */\n enumName?: string\n\n /**\n * Generated column expression.\n */\n asExpression?: string\n\n /**\n * Generated column type.\n */\n generatedType?: \"VIRTUAL\" | \"STORED\"\n\n /**\n * Return type of HSTORE column.\n * Returns value as string or as object.\n */\n hstoreType?: \"object\" | \"string\"\n\n /**\n * Indicates if this column is an array.\n */\n isArray: boolean = false\n\n /**\n * Gets full path to this column property (including column property name).\n * Full path is relevant when column is used in embeds (one or multiple nested).\n * For example it will return \"counters.subcounters.likes\".\n * If property is not in embeds then it returns just property name of the column.\n */\n propertyPath: string\n\n /**\n * Same as property path, but dots are replaced with '_'.\n * Used in query builder statements.\n */\n propertyAliasName: string\n\n /**\n * Gets full path to this column database name (including column database name).\n * Full path is relevant when column is used in embeds (one or multiple nested).\n * For example it will return \"counters.subcounters.likes\".\n * If property is not in embeds then it returns just database name of the column.\n */\n databasePath: string\n\n /**\n * Complete column name in the database including its embedded prefixes.\n */\n databaseName: string\n\n /**\n * Database name in the database without embedded prefixes applied.\n */\n databaseNameWithoutPrefixes: string\n\n /**\n * Database name set by entity metadata builder, not yet passed naming strategy process and without embedded prefixes.\n */\n givenDatabaseName?: string\n\n /**\n * Indicates if column is virtual. Virtual columns are not mapped to the entity.\n */\n isVirtual: boolean = false\n\n /**\n * Indicates if column is discriminator. Discriminator columns are not mapped to the entity.\n */\n isDiscriminator: boolean = false\n\n /**\n * Indicates if column is tree-level column. Tree-level columns are used in closure entities.\n */\n isTreeLevel: boolean = false\n\n /**\n * Indicates if this column contains an entity creation date.\n */\n isCreateDate: boolean = false\n\n /**\n * Indicates if this column contains an entity update date.\n */\n isUpdateDate: boolean = false\n\n /**\n * Indicates if this column contains an entity delete date.\n */\n isDeleteDate: boolean = false\n\n /**\n * Indicates if this column contains an entity version.\n */\n isVersion: boolean = false\n\n /**\n * Indicates if this column contains an object id.\n */\n isObjectId: boolean = false\n\n /**\n * If this column is foreign key then it references some other column,\n * and this property will contain reference to this column.\n */\n referencedColumn: ColumnMetadata | undefined\n\n /**\n * Specifies a value transformer that is to be used to (un)marshal\n * this column when reading or writing to the database.\n */\n transformer?: ValueTransformer | ValueTransformer[]\n\n /**\n * Column type in the case if this column is in the closure table.\n * Column can be ancestor or descendant in the closure tables.\n */\n closureType?: \"ancestor\" | \"descendant\"\n\n /**\n * Indicates if this column is nested set's left column.\n * Used only in tree entities with nested-set type.\n */\n isNestedSetLeft: boolean = false\n\n /**\n * Indicates if this column is nested set's right column.\n * Used only in tree entities with nested-set type.\n */\n isNestedSetRight: boolean = false\n\n /**\n * Indicates if this column is materialized path's path column.\n * Used only in tree entities with materialized path type.\n */\n isMaterializedPath: boolean = false\n\n /**\n * Spatial Feature Type (Geometry, Point, Polygon, etc.)\n */\n spatialFeatureType?: string\n\n /**\n * SRID (Spatial Reference ID (EPSG code))\n */\n srid?: number\n\n // ---------------------------------------------------------------------\n // Constructor\n // ---------------------------------------------------------------------\n\n constructor(options: {\n connection: DataSource\n entityMetadata: EntityMetadata\n embeddedMetadata?: EmbeddedMetadata\n referencedColumn?: ColumnMetadata\n args: ColumnMetadataArgs\n closureType?: \"ancestor\" | \"descendant\"\n nestedSetLeft?: boolean\n nestedSetRight?: boolean\n materializedPath?: boolean\n }) {\n this.entityMetadata = options.entityMetadata\n this.embeddedMetadata = options.embeddedMetadata!\n this.referencedColumn = options.referencedColumn\n if (options.args.target) this.target = options.args.target\n if (options.args.propertyName)\n this.propertyName = options.args.propertyName\n if (options.args.options.name)\n this.givenDatabaseName = options.args.options.name\n if (options.args.options.type) this.type = options.args.options.type\n if (options.args.options.length)\n this.length = options.args.options.length\n ? options.args.options.length.toString()\n : \"\"\n if (options.args.options.width) this.width = options.args.options.width\n if (options.args.options.charset)\n this.charset = options.args.options.charset\n if (options.args.options.collation)\n this.collation = options.args.options.collation\n if (options.args.options.primary)\n this.isPrimary = options.args.options.primary\n if (options.args.options.default === null)\n // to make sure default: null is the same as nullable: true\n this.isNullable = true\n if (options.args.options.nullable !== undefined)\n this.isNullable = options.args.options.nullable\n if (options.args.options.select !== undefined)\n this.isSelect = options.args.options.select\n if (options.args.options.insert !== undefined)\n this.isInsert = options.args.options.insert\n if (options.args.options.update !== undefined)\n this.isUpdate = options.args.options.update\n if (options.args.options.readonly !== undefined)\n this.isUpdate = !options.args.options.readonly\n if (options.args.options.comment)\n this.comment = options.args.options.comment\n if (options.args.options.default !== undefined)\n this.default = options.args.options.default\n if (options.args.options.onUpdate)\n this.onUpdate = options.args.options.onUpdate\n if (options.args.options.generatedIdentity)\n this.generatedIdentity = options.args.options.generatedIdentity\n if (\n options.args.options.scale !== null &&\n options.args.options.scale !== undefined\n )\n this.scale = options.args.options.scale\n if (options.args.options.zerofill) {\n this.zerofill = options.args.options.zerofill\n this.unsigned = true // if you specify ZEROFILL for a numeric column, MySQL automatically adds the UNSIGNED attribute to the column\n }\n if (options.args.options.unsigned)\n this.unsigned = options.args.options.unsigned\n if (options.args.options.precision !== null)\n this.precision = options.args.options.precision\n if (options.args.options.enum) {\n if (\n ObjectUtils.isObject(options.args.options.enum) &&\n !Array.isArray(options.args.options.enum)\n ) {\n this.enum = Object.keys(options.args.options.enum)\n // remove numeric keys - typescript numeric enum types generate them\n // From the documentation: “declaration merging” means that the compiler merges two separate declarations\n // declared with the same name into a single definition. This concept is often used to merge enum with namespace\n // where in namespace we define e.g. utility methods for creating enum. This is well known in other languages\n // like Java (enum methods). Here in case if enum have function, we need to remove it from metadata, otherwise\n // generated SQL statements contains string representation of that function which leads into syntax error\n // at database side.\n .filter(\n (key) =>\n isNaN(+key) &&\n typeof (options.args.options.enum as ObjectLiteral)[\n key\n ] !== \"function\",\n )\n .map(\n (key) =>\n (options.args.options.enum as ObjectLiteral)[key],\n )\n } else {\n this.enum = options.args.options.enum\n }\n }\n if (options.args.options.enumName) {\n this.enumName = options.args.options.enumName\n }\n if (options.args.options.asExpression) {\n this.asExpression = options.args.options.asExpression\n this.generatedType = options.args.options.generatedType\n ? options.args.options.generatedType\n : \"VIRTUAL\"\n }\n if (options.args.options.hstoreType)\n this.hstoreType = options.args.options.hstoreType\n if (options.args.options.array)\n this.isArray = options.args.options.array\n if (options.args.mode) {\n this.isVirtual = options.args.mode === \"virtual\"\n this.isTreeLevel = options.args.mode === \"treeLevel\"\n this.isCreateDate = options.args.mode === \"createDate\"\n this.isUpdateDate = options.args.mode === \"updateDate\"\n this.isDeleteDate = options.args.mode === \"deleteDate\"\n this.isVersion = options.args.mode === \"version\"\n this.isObjectId = options.args.mode === \"objectId\"\n }\n if (options.args.options.transformer)\n this.transformer = options.args.options.transformer\n if (options.args.options.spatialFeatureType)\n this.spatialFeatureType = options.args.options.spatialFeatureType\n if (options.args.options.srid !== undefined)\n this.srid = options.args.options.srid\n if (this.isTreeLevel)\n this.type = options.connection.driver.mappedDataTypes.treeLevel\n if (this.isCreateDate) {\n if (!this.type)\n this.type = options.connection.driver.mappedDataTypes.createDate\n if (!this.default)\n this.default = () =>\n options.connection.driver.mappedDataTypes.createDateDefault\n // skip precision if it was explicitly set to \"null\" in column options. Otherwise use default precision if it exist.\n if (\n this.precision === undefined &&\n options.args.options.precision === undefined &&\n options.connection.driver.mappedDataTypes.createDatePrecision\n )\n this.precision =\n options.connection.driver.mappedDataTypes.createDatePrecision\n }\n if (this.isUpdateDate) {\n if (!this.type)\n this.type = options.connection.driver.mappedDataTypes.updateDate\n if (!this.default)\n this.default = () =>\n options.connection.driver.mappedDataTypes.updateDateDefault\n if (!this.onUpdate)\n this.onUpdate =\n options.connection.driver.mappedDataTypes.updateDateDefault\n // skip precision if it was explicitly set to \"null\" in column options. Otherwise use default precision if it exist.\n if (\n this.precision === undefined &&\n options.args.options.precision === undefined &&\n options.connection.driver.mappedDataTypes.updateDatePrecision\n )\n this.precision =\n options.connection.driver.mappedDataTypes.updateDatePrecision\n }\n if (this.isDeleteDate) {\n if (!this.type)\n this.type = options.connection.driver.mappedDataTypes.deleteDate\n if (!this.isNullable)\n this.isNullable =\n options.connection.driver.mappedDataTypes.deleteDateNullable\n // skip precision if it was explicitly set to \"null\" in column options. Otherwise use default precision if it exist.\n if (\n this.precision === undefined &&\n options.args.options.precision === undefined &&\n options.connection.driver.mappedDataTypes.deleteDatePrecision\n )\n this.precision =\n options.connection.driver.mappedDataTypes.deleteDatePrecision\n }\n if (this.isVersion)\n this.type = options.connection.driver.mappedDataTypes.version\n if (options.closureType) this.closureType = options.closureType\n if (options.nestedSetLeft) this.isNestedSetLeft = options.nestedSetLeft\n if (options.nestedSetRight)\n this.isNestedSetRight = options.nestedSetRight\n if (options.materializedPath)\n this.isMaterializedPath = options.materializedPath\n }\n\n // ---------------------------------------------------------------------\n // Public Methods\n // ---------------------------------------------------------------------\n\n /**\n * Creates entity id map from the given entity ids array.\n */\n createValueMap(value: any, useDatabaseName = false) {\n // extract column value from embeds of entity if column is in embedded\n if (this.embeddedMetadata) {\n // example: post[data][information][counters].id where \"data\", \"information\" and \"counters\" are embeddeds\n // we need to get value of \"id\" column from the post real entity object and return it in a\n // { data: { information: { counters: { id: ... } } } } format\n\n // first step - we extract all parent properties of the entity relative to this column, e.g. [data, information, counters]\n const propertyNames = [...this.embeddedMetadata.parentPropertyNames]\n\n // now need to access post[data][information][counters] to get column value from the counters\n // and on each step we need to create complex literal object, e.g. first { data },\n // then { data: { information } }, then { data: { information: { counters } } },\n // then { data: { information: { counters: [this.propertyName]: entity[data][information][counters][this.propertyName] } } }\n // this recursive function helps doing that\n const extractEmbeddedColumnValue = (\n propertyNames: string[],\n map: ObjectLiteral,\n ): any => {\n const propertyName = propertyNames.shift()\n if (propertyName) {\n map[propertyName] = {}\n extractEmbeddedColumnValue(propertyNames, map[propertyName])\n return map\n }\n\n // this is bugfix for #720 when increment number is bigint we need to make sure its a string\n if (\n (this.generationStrategy === \"increment\" ||\n this.generationStrategy === \"rowid\") &&\n this.type === \"bigint\" &&\n value !== null\n )\n value = String(value)\n\n map[useDatabaseName ? this.databaseName : this.propertyName] =\n value\n return map\n }\n return extractEmbeddedColumnValue(propertyNames, {})\n } else {\n // no embeds - no problems. Simply return column property name and its value of the entity\n\n // this is bugfix for #720 when increment number is bigint we need to make sure its a string\n if (\n (this.generationStrategy === \"increment\" ||\n this.generationStrategy === \"rowid\") &&\n this.type === \"bigint\" &&\n value !== null\n )\n value = String(value)\n\n return {\n [useDatabaseName ? this.databaseName : this.propertyName]:\n value,\n }\n }\n }\n\n /**\n * Extracts column value and returns its column name with this value in a literal object.\n * If column is in embedded (or recursive embedded) it returns complex literal object.\n *\n * Examples what this method can return depend if this column is in embeds.\n * { id: 1 } or { title: \"hello\" }, { counters: { code: 1 } }, { data: { information: { counters: { code: 1 } } } }\n */\n getEntityValueMap(\n entity: ObjectLiteral,\n options?: { skipNulls?: boolean },\n ): ObjectLiteral | undefined {\n const returnNulls = false // options && options.skipNulls === false ? false : true; // todo: remove if current will not bring problems, uncomment if it will.\n\n // extract column value from embeds of entity if column is in embedded\n if (this.embeddedMetadata) {\n // example: post[data][information][counters].id where \"data\", \"information\" and \"counters\" are embeddeds\n // we need to get value of \"id\" column from the post real entity object and return it in a\n // { data: { information: { counters: { id: ... } } } } format\n\n // first step - we extract all parent properties of the entity relative to this column, e.g. [data, information, counters]\n const propertyNames = [...this.embeddedMetadata.parentPropertyNames]\n const isEmbeddedArray = this.embeddedMetadata.isArray\n\n // now need to access post[data][information][counters] to get column value from the counters\n // and on each step we need to create complex literal object, e.g. first { data },\n // then { data: { information } }, then { data: { information: { counters } } },\n // then { data: { information: { counters: [this.propertyName]: entity[data][information][counters][this.propertyName] } } }\n // this recursive function helps doing that\n const extractEmbeddedColumnValue = (\n propertyNames: string[],\n value: ObjectLiteral,\n ): ObjectLiteral => {\n if (value === undefined) {\n return {}\n }\n\n const propertyName = propertyNames.shift()\n\n if (propertyName) {\n const submap = extractEmbeddedColumnValue(\n propertyNames,\n value[propertyName],\n )\n if (Object.keys(submap).length > 0) {\n return { [propertyName]: submap }\n }\n return {}\n }\n\n if (isEmbeddedArray && Array.isArray(value)) {\n return value.map((v) => ({\n [this.propertyName]: v[this.propertyName],\n }))\n }\n\n if (\n value[this.propertyName] !== undefined &&\n (returnNulls === false || value[this.propertyName] !== null)\n ) {\n return { [this.propertyName]: value[this.propertyName] }\n }\n\n return {}\n }\n const map = extractEmbeddedColumnValue(propertyNames, entity)\n\n return Object.keys(map).length > 0 ? map : undefined\n } else {\n // no embeds - no problems. Simply return column property name and its value of the entity\n /**\n * Object.getOwnPropertyDescriptor checks if the relation is lazy, in which case value is a Promise\n * DO NOT use `entity[\n this.relationMetadata.propertyName] instanceof Promise`, which will invoke property getter and make unwanted DB request\n * refer: https://github.com/typeorm/typeorm/pull/8676#issuecomment-1049906331\n */\n if (\n this.relationMetadata &&\n !Object.getOwnPropertyDescriptor(\n entity,\n this.relationMetadata.propertyName,\n )?.get &&\n entity[this.relationMetadata.propertyName] &&\n ObjectUtils.isObject(entity[this.relationMetadata.propertyName])\n ) {\n const map = this.relationMetadata.joinColumns.reduce(\n (map, joinColumn) => {\n const value =\n joinColumn.referencedColumn!.getEntityValueMap(\n entity[this.relationMetadata!.propertyName],\n )\n if (value === undefined) return map\n return OrmUtils.mergeDeep(map, value)\n },\n {},\n )\n if (Object.keys(map).length > 0)\n return { [this.propertyName]: map }\n\n return undefined\n } else {\n if (\n entity[this.propertyName] !== undefined &&\n (returnNulls === false ||\n entity[this.propertyName] !== null)\n )\n return { [this.propertyName]: entity[this.propertyName] }\n\n return undefined\n }\n }\n }\n\n /**\n * Extracts column value from the given entity.\n * If column is in embedded (or recursive embedded) it extracts its value from there.\n */\n getEntityValue(\n entity: ObjectLiteral,\n transform: boolean = false,\n ): any | undefined {\n if (entity === undefined || entity === null) return undefined\n\n // extract column value from embeddeds of entity if column is in embedded\n let value: any = undefined\n if (this.embeddedMetadata) {\n // example: post[data][information][counters].id where \"data\", \"information\" and \"counters\" are embeddeds\n // we need to get value of \"id\" column from the post real entity object\n\n // first step - we extract all parent properties of the entity relative to this column, e.g. [data, information, counters]\n const propertyNames = [...this.embeddedMetadata.parentPropertyNames]\n const isEmbeddedArray = this.embeddedMetadata.isArray\n\n // next we need to access post[data][information][counters][this.propertyName] to get column value from the counters\n // this recursive function takes array of generated property names and gets the post[data][information][counters] embed\n const extractEmbeddedColumnValue = (\n propertyNames: string[],\n value: ObjectLiteral,\n ): any => {\n const propertyName = propertyNames.shift()\n return propertyName && value\n ? extractEmbeddedColumnValue(\n propertyNames,\n value[propertyName],\n )\n : value\n }\n\n // once we get nested embed object we get its column, e.g. post[data][information][counters][this.propertyName]\n const embeddedObject = extractEmbeddedColumnValue(\n propertyNames,\n entity,\n )\n if (embeddedObject) {\n if (this.relationMetadata && this.referencedColumn) {\n const relatedEntity =\n this.relationMetadata.getEntityValue(embeddedObject)\n if (\n relatedEntity &&\n ObjectUtils.isObject(relatedEntity) &&\n !InstanceChecker.isFindOperator(relatedEntity) &&\n !Buffer.isBuffer(relatedEntity)\n ) {\n value =\n this.referencedColumn.getEntityValue(relatedEntity)\n } else if (\n embeddedObject[this.propertyName] &&\n ObjectUtils.isObject(\n embeddedObject[this.propertyName],\n ) &&\n !InstanceChecker.isFindOperator(\n embeddedObject[this.propertyName],\n ) &&\n !Buffer.isBuffer(embeddedObject[this.propertyName]) &&\n !(embeddedObject[this.propertyName] instanceof Date)\n ) {\n value = this.referencedColumn.getEntityValue(\n embeddedObject[this.propertyName],\n )\n } else {\n value = embeddedObject[this.propertyName]\n }\n } else if (this.referencedColumn) {\n value = this.referencedColumn.getEntityValue(\n embeddedObject[this.propertyName],\n )\n } else if (isEmbeddedArray && Array.isArray(embeddedObject)) {\n value = embeddedObject.map((o) => o[this.propertyName])\n } else {\n value = embeddedObject[this.propertyName]\n }\n }\n } else {\n // no embeds - no problems. Simply return column name by property name of the entity\n if (this.relationMetadata && this.referencedColumn) {\n const relatedEntity =\n this.relationMetadata.getEntityValue(entity)\n if (\n relatedEntity &&\n ObjectUtils.isObject(relatedEntity) &&\n !InstanceChecker.isFindOperator(relatedEntity) &&\n !(typeof relatedEntity === \"function\") &&\n !Buffer.isBuffer(relatedEntity)\n ) {\n value = this.referencedColumn.getEntityValue(relatedEntity)\n } else if (\n entity[this.propertyName] &&\n ObjectUtils.isObject(entity[this.propertyName]) &&\n !InstanceChecker.isFindOperator(\n entity[this.propertyName],\n ) &&\n !(typeof entity[this.propertyName] === \"function\") &&\n !Buffer.isBuffer(entity[this.propertyName]) &&\n !(entity[this.propertyName] instanceof Date)\n ) {\n value = this.referencedColumn.getEntityValue(\n entity[this.propertyName],\n )\n } else {\n value = entity[this.propertyName]\n }\n } else if (this.referencedColumn) {\n value = this.referencedColumn.getEntityValue(\n entity[this.propertyName],\n )\n } else {\n value = entity[this.propertyName]\n }\n }\n\n if (transform && this.transformer)\n value = ApplyValueTransformers.transformTo(this.transformer, value)\n\n return value\n }\n\n /**\n * Sets given entity's column value.\n * Using of this method helps to set entity relation's value of the lazy and non-lazy relations.\n */\n setEntityValue(entity: ObjectLiteral, value: any): void {\n if (this.embeddedMetadata) {\n // first step - we extract all parent properties of the entity relative to this column, e.g. [data, information, counters]\n const extractEmbeddedColumnValue = (\n embeddedMetadatas: EmbeddedMetadata[],\n map: ObjectLiteral,\n ): any => {\n // if (!object[embeddedMetadata.propertyName])\n // object[embeddedMetadata.propertyName] = embeddedMetadata.create();\n\n const embeddedMetadata = embeddedMetadatas.shift()\n if (embeddedMetadata) {\n if (!map[embeddedMetadata.propertyName])\n map[embeddedMetadata.propertyName] =\n embeddedMetadata.create()\n\n extractEmbeddedColumnValue(\n embeddedMetadatas,\n map[embeddedMetadata.propertyName],\n )\n return map\n }\n map[this.propertyName] = value\n return map\n }\n return extractEmbeddedColumnValue(\n [...this.embeddedMetadata.embeddedMetadataTree],\n entity,\n )\n } else {\n // we write a deep object in this entity only if the column is virtual\n // because if its not virtual it means the user defined a real column for this relation\n // also we don't do it if column is inside a junction table\n if (\n !this.entityMetadata.isJunction &&\n this.isVirtual &&\n this.referencedColumn &&\n this.referencedColumn.propertyName !== this.propertyName\n ) {\n if (!(this.propertyName in entity)) {\n entity[this.propertyName] = {}\n }\n\n entity[this.propertyName][this.referencedColumn.propertyName] =\n value\n } else {\n entity[this.propertyName] = value\n }\n }\n }\n\n /**\n * Compares given entity's column value with a given value.\n */\n compareEntityValue(entity: any, valueToCompareWith: any) {\n const columnValue = this.getEntityValue(entity)\n if (ObjectUtils.isObject(columnValue)) {\n return columnValue.equals(valueToCompareWith)\n }\n return columnValue === valueToCompareWith\n }\n\n // ---------------------------------------------------------------------\n // Builder Methods\n // ---------------------------------------------------------------------\n\n build(connection: DataSource): this {\n this.propertyPath = this.buildPropertyPath()\n this.propertyAliasName = this.propertyPath.replace(\".\", \"_\")\n this.databaseName = this.buildDatabaseName(connection)\n this.databasePath = this.buildDatabasePath()\n this.databaseNameWithoutPrefixes = connection.namingStrategy.columnName(\n this.propertyName,\n this.givenDatabaseName,\n [],\n )\n return this\n }\n\n protected buildPropertyPath(): string {\n let path = \"\"\n if (\n this.embeddedMetadata &&\n this.embeddedMetadata.parentPropertyNames.length\n )\n path = this.embeddedMetadata.parentPropertyNames.join(\".\") + \".\"\n\n path += this.propertyName\n\n // we add reference column to property path only if this column is virtual\n // because if its not virtual it means user defined a real column for this relation\n // also we don't do it if column is inside a junction table\n if (\n !this.entityMetadata.isJunction &&\n this.isVirtual &&\n this.referencedColumn &&\n this.referencedColumn.propertyName !== this.propertyName\n )\n path += \".\" + this.referencedColumn.propertyName\n\n return path\n }\n\n protected buildDatabasePath(): string {\n let path = \"\"\n if (\n this.embeddedMetadata &&\n this.embeddedMetadata.parentPropertyNames.length\n )\n path = this.embeddedMetadata.parentPropertyNames.join(\".\") + \".\"\n\n path += this.databaseName\n\n // we add reference column to property path only if this column is virtual\n // because if its not virtual it means user defined a real column for this relation\n // also we don't do it if column is inside a junction table\n if (\n !this.entityMetadata.isJunction &&\n this.isVirtual &&\n this.referencedColumn &&\n this.referencedColumn.databaseName !== this.databaseName\n )\n path += \".\" + this.referencedColumn.databaseName\n\n return path\n }\n\n protected buildDatabaseName(connection: DataSource): string {\n let propertyNames = this.embeddedMetadata\n ? this.embeddedMetadata.parentPrefixes\n : []\n if (connection.driver.options.type === \"mongodb\")\n // we don't need to include embedded name for the mongodb column names\n propertyNames = []\n return connection.namingStrategy.columnName(\n this.propertyName,\n this.givenDatabaseName,\n propertyNames,\n )\n }\n}\n"],"sourceRoot":".."}
|
|
@@ -100,6 +100,14 @@ export class EntityMetadataValidator {
|
|
|
100
100
|
if (charsetColumns.length > 1)
|
|
101
101
|
throw new TypeORMError(`Character set specifying is not supported in Sql Server`);
|
|
102
102
|
}
|
|
103
|
+
// Postgres supports only STORED generated columns.
|
|
104
|
+
if (driver.options.type === "postgres") {
|
|
105
|
+
const virtualColumn = entityMetadata.columns.find((column) => column.asExpression &&
|
|
106
|
+
(!column.generatedType ||
|
|
107
|
+
column.generatedType === "VIRTUAL"));
|
|
108
|
+
if (virtualColumn)
|
|
109
|
+
throw new TypeORMError(`Column "${virtualColumn.propertyName}" of Entity "${entityMetadata.name}" is defined as VIRTUAL, but Postgres supports only STORED generated columns.`);
|
|
110
|
+
}
|
|
103
111
|
// check if relations are all without initialized properties
|
|
104
112
|
const entityInstance = entityMetadata.create(undefined, {
|
|
105
113
|
fromDeserializer: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../browser/src/metadata-builder/EntityMetadataValidator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAA;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAA;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAA;AAE9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAA;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEnD,mEAAmE;AACnE,6FAA6F;AAC7F,sEAAsE;AACtE,mGAAmG;AACnG,2GAA2G;AAC3G,6DAA6D;AAC7D,uEAAuE;AACvE,iFAAiF;AAEjF,2FAA2F;AAC3F,wHAAwH;AACxH,gIAAgI;AAChI,mGAAmG;AACnG,8EAA8E;AAC9E,8CAA8C;AAC9C,yDAAyD;AAEzD;;GAEG;AACH,MAAM,OAAO,uBAAuB;IAChC,4EAA4E;IAC5E,iBAAiB;IACjB,4EAA4E;IAE5E;;OAEG;IACH,YAAY,CAAC,eAAiC,EAAE,MAAc;QAC1D,eAAe,CAAC,OA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ACI,QAAQ,CAAC,eAAe;oBACxB,QAAQ,CAAC,eAAe,CAAC,OAAO;oBAEhC,MAAM,IAAI,YAAY,CAClB,2CAA2C;wBACvC,GAAG,cAAc,CAAC,UAAU,IAAI,QAAQ,CAAC,YAAY,gDAAgD;wBACrG,GAAG,QAAQ,CAAC,qBAAqB,CAAC,UAAU,IAAI,QAAQ,CAAC,eAAe,CAAC,YAAY,kCAAkC;wBACvH,sDAAsD,CAC7D,CAAA;YACT,CAAC,CAAC,CAAA;QACN,CAAC,CAAC,CAAA;IACN,CAAC;CACJ","file":"EntityMetadataValidator.js","sourcesContent":["import { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { MissingPrimaryColumnError } from \"../error/MissingPrimaryColumnError\"\nimport { CircularRelationsError } from \"../error/CircularRelationsError\"\nimport { DepGraph } from \"../util/DepGraph\"\nimport { Driver } from \"../driver/Driver\"\nimport { DataTypeNotSupportedError } from \"../error/DataTypeNotSupportedError\"\nimport { ColumnType } from \"../driver/types/ColumnTypes\"\nimport { NoConnectionOptionError } from \"../error/NoConnectionOptionError\"\nimport { InitializedRelationError } from \"../error/InitializedRelationError\"\nimport { TypeORMError } from \"../error\"\nimport { DriverUtils } from \"../driver/DriverUtils\"\n\n/// todo: add check if there are multiple tables with the same name\n/// todo: add checks when generated column / table names are too long for the specific driver\n// todo: type in function validation, inverse side function validation\n// todo: check on build for duplicate names, since naming checking was removed from MetadataStorage\n// todo: duplicate name checking for: table, relation, column, index, naming strategy, join tables/columns?\n// todo: check if multiple tree parent metadatas in validator\n// todo: tree decorators can be used only on closure table (validation)\n// todo: throw error if parent tree metadata was not specified in a closure table\n\n// todo: MetadataArgsStorage: type in function validation, inverse side function validation\n// todo: MetadataArgsStorage: check on build for duplicate names, since naming checking was removed from MetadataStorage\n// todo: MetadataArgsStorage: duplicate name checking for: table, relation, column, index, naming strategy, join tables/columns?\n// todo: MetadataArgsStorage: check for duplicate targets too since this check has been removed too\n// todo: check if relation decorator contains primary: true and nullable: true\n// todo: check column length, precision. scale\n// todo: MySQL index can be unique or spatial or fulltext\n\n/**\n * Validates built entity metadatas.\n */\nexport class EntityMetadataValidator {\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Validates all given entity metadatas.\n */\n validateMany(entityMetadatas: EntityMetadata[], driver: Driver) {\n entityMetadatas.forEach((entityMetadata) =>\n this.validate(entityMetadata, entityMetadatas, driver),\n )\n this.validateDependencies(entityMetadatas)\n this.validateEagerRelations(entityMetadatas)\n }\n\n /**\n * Validates given entity metadata.\n */\n validate(\n entityMetadata: EntityMetadata,\n allEntityMetadatas: EntityMetadata[],\n driver: Driver,\n ) {\n // check if table metadata has an id\n if (!entityMetadata.primaryColumns.length && !entityMetadata.isJunction)\n throw new MissingPrimaryColumnError(entityMetadata)\n\n // validate if table is using inheritance it has a discriminator\n // also validate if discriminator values are not empty and not repeated\n if (\n entityMetadata.inheritancePattern === \"STI\" ||\n entityMetadata.tableType === \"entity-child\"\n ) {\n if (!entityMetadata.discriminatorColumn)\n throw new TypeORMError(\n `Entity ${entityMetadata.name} using single-table inheritance, it should also have a discriminator column. Did you forget to put discriminator column options?`,\n )\n\n if (typeof entityMetadata.discriminatorValue === \"undefined\")\n throw new TypeORMError(\n `Entity ${entityMetadata.name} has an undefined discriminator value. Discriminator value should be defined.`,\n )\n\n const sameDiscriminatorValueEntityMetadata =\n allEntityMetadatas.find((metadata) => {\n return (\n metadata !== entityMetadata &&\n (metadata.inheritancePattern === \"STI\" ||\n metadata.tableType === \"entity-child\") &&\n metadata.tableName === entityMetadata.tableName &&\n metadata.discriminatorValue ===\n entityMetadata.discriminatorValue &&\n metadata.inheritanceTree.some(\n (parent) =>\n entityMetadata.inheritanceTree.indexOf(\n parent,\n ) !== -1,\n )\n )\n })\n if (sameDiscriminatorValueEntityMetadata)\n throw new TypeORMError(\n `Entities ${entityMetadata.name} and ${sameDiscriminatorValueEntityMetadata.name} have the same discriminator values. Make sure they are different while using the @ChildEntity decorator.`,\n )\n }\n\n entityMetadata.relationCounts.forEach((relationCount) => {\n if (\n relationCount.relation.isManyToOne ||\n relationCount.relation.isOneToOne\n )\n throw new TypeORMError(\n `Relation count can not be implemented on ManyToOne or OneToOne relations.`,\n )\n })\n\n if (!(driver.options.type === \"mongodb\")) {\n entityMetadata.columns.forEach((column) => {\n const normalizedColumn = driver.normalizeType(\n column,\n ) as ColumnType\n if (driver.supportedDataTypes.indexOf(normalizedColumn) === -1)\n throw new DataTypeNotSupportedError(\n column,\n normalizedColumn,\n driver.options.type,\n )\n if (\n column.length &&\n driver.withLengthColumnTypes.indexOf(normalizedColumn) ===\n -1\n )\n throw new TypeORMError(\n `Column ${column.propertyName} of Entity ${entityMetadata.name} does not support length property.`,\n )\n if (column.type === \"enum\" && !column.enum && !column.enumName)\n throw new TypeORMError(\n `Column \"${column.propertyName}\" of Entity \"${entityMetadata.name}\" is defined as enum, but missing \"enum\" or \"enumName\" properties.`,\n )\n })\n }\n\n if (\n DriverUtils.isMySQLFamily(driver) ||\n driver.options.type === \"aurora-mysql\"\n ) {\n const generatedColumns = entityMetadata.columns.filter(\n (column) =>\n column.isGenerated && column.generationStrategy !== \"uuid\",\n )\n if (generatedColumns.length > 1)\n throw new TypeORMError(\n `Error in ${entityMetadata.name} entity. There can be only one auto-increment column in MySql table.`,\n )\n }\n\n // for mysql we are able to not define a default selected database, instead all entities can have their database\n // defined in their decorators. To make everything work either all entities must have database define and we\n // can live without database set in the connection options, either database in the connection options must be set\n if (DriverUtils.isMySQLFamily(driver)) {\n const metadatasWithDatabase = allEntityMetadatas.filter(\n (metadata) => metadata.database,\n )\n if (metadatasWithDatabase.length === 0 && !driver.database)\n throw new NoConnectionOptionError(\"database\")\n }\n\n if (driver.options.type === \"mssql\") {\n const charsetColumns = entityMetadata.columns.filter(\n (column) => column.charset,\n )\n if (charsetColumns.length > 1)\n throw new TypeORMError(\n `Character set specifying is not supported in Sql Server`,\n )\n }\n\n // check if relations are all without initialized properties\n const entityInstance = entityMetadata.create(undefined, {\n fromDeserializer: true,\n })\n entityMetadata.relations.forEach((relation) => {\n if (relation.isManyToMany || relation.isOneToMany) {\n // we skip relations for which persistence is disabled since initialization in them cannot harm somehow\n if (relation.persistenceEnabled === false) return\n\n // get entity relation value and check if its an array\n const relationInitializedValue =\n relation.getEntityValue(entityInstance)\n if (Array.isArray(relationInitializedValue))\n throw new InitializedRelationError(relation)\n }\n })\n\n // validate relations\n entityMetadata.relations.forEach((relation) => {\n // check join tables:\n // using JoinTable is possible only on one side of the many-to-many relation\n // todo(dima): fix\n // if (relation.joinTable) {\n // if (!relation.isManyToMany)\n // throw new UsingJoinTableIsNotAllowedError(entityMetadata, relation);\n // // if there is inverse side of the relation, then check if it does not have join table too\n // if (relation.hasInverseSide && relation.inverseRelation.joinTable)\n // throw new UsingJoinTableOnlyOnOneSideAllowedError(entityMetadata, relation);\n // }\n // check join columns:\n // using JoinColumn is possible only on one side of the relation and on one-to-one, many-to-one relation types\n // first check if relation is one-to-one or many-to-one\n // todo(dima): fix\n /*if (relation.joinColumn) {\n\n // join column can be applied only on one-to-one and many-to-one relations\n if (!relation.isOneToOne && !relation.isManyToOne)\n throw new UsingJoinColumnIsNotAllowedError(entityMetadata, relation);\n\n // if there is inverse side of the relation, then check if it does not have join table too\n if (relation.hasInverseSide && relation.inverseRelation.joinColumn && relation.isOneToOne)\n throw new UsingJoinColumnOnlyOnOneSideAllowedError(entityMetadata, relation);\n\n // check if join column really has referenced column\n if (relation.joinColumn && !relation.joinColumn.referencedColumn)\n throw new TypeORMError(`Join column does not have referenced column set`);\n\n }\n\n // if its a one-to-one relation and JoinColumn is missing on both sides of the relation\n // or its one-side relation without JoinColumn we should give an error\n if (!relation.joinColumn && relation.isOneToOne && (!relation.hasInverseSide || !relation.inverseRelation.joinColumn))\n throw new MissingJoinColumnError(entityMetadata, relation);*/\n // if its a many-to-many relation and JoinTable is missing on both sides of the relation\n // or its one-side relation without JoinTable we should give an error\n // todo(dima): fix it\n // if (!relation.joinTable && relation.isManyToMany && (!relation.hasInverseSide || !relation.inverseRelation.joinTable))\n // throw new MissingJoinTableError(entityMetadata, relation);\n // todo: validate if its one-to-one and side which does not have join column MUST have inverse side\n // todo: validate if its many-to-many and side which does not have join table MUST have inverse side\n // todo: if there is a relation, and inverse side is specified only on one side, shall we give error\n // todo: with message like: \"Inverse side is specified only on one side of the relationship. Specify on other side too to prevent confusion\".\n // todo: add validation if there two entities with the same target, and show error message with description of the problem (maybe file was renamed/moved but left in output directory)\n // todo: check if there are multiple columns on the same column applied.\n // todo: check column type if is missing in relational databases (throw new TypeORMError(`Column type of ${type} cannot be determined.`);)\n // todo: include driver-specific checks. for example in mongodb empty prefixes are not allowed\n // todo: if multiple columns with same name - throw exception, including cases when columns are in embeds with same prefixes or without prefix at all\n // todo: if multiple primary key used, at least one of them must be unique or @Index decorator must be set on entity\n // todo: check if entity with duplicate names, some decorators exist\n })\n\n // make sure cascade remove is not set for both sides of relationships (can be set in OneToOne decorators)\n entityMetadata.relations.forEach((relation) => {\n const isCircularCascadeRemove =\n relation.isCascadeRemove &&\n relation.inverseRelation &&\n relation.inverseRelation!.isCascadeRemove\n if (isCircularCascadeRemove)\n throw new TypeORMError(\n `Relation ${entityMetadata.name}#${\n relation.propertyName\n } and ${relation.inverseRelation!.entityMetadata.name}#${\n relation.inverseRelation!.propertyName\n } both has cascade remove set. ` +\n `This may lead to unexpected circular removals. Please set cascade remove only from one side of relationship.`,\n )\n }) // todo: maybe better just deny removal from one to one relation without join column?\n\n entityMetadata.eagerRelations.forEach((relation) => {})\n }\n\n /**\n * Validates dependencies of the entity metadatas.\n */\n protected validateDependencies(entityMetadatas: EntityMetadata[]) {\n const graph = new DepGraph()\n entityMetadatas.forEach((entityMetadata) => {\n graph.addNode(entityMetadata.name)\n })\n entityMetadatas.forEach((entityMetadata) => {\n entityMetadata.relationsWithJoinColumns\n .filter((relation) => !relation.isNullable)\n .forEach((relation) => {\n graph.addDependency(\n entityMetadata.name,\n relation.inverseEntityMetadata.name,\n )\n })\n })\n try {\n graph.overallOrder()\n } catch (err) {\n throw new CircularRelationsError(\n err.toString().replace(\"Error: Dependency Cycle Found: \", \"\"),\n )\n }\n }\n\n /**\n * Validates eager relations to prevent circular dependency in them.\n */\n protected validateEagerRelations(entityMetadatas: EntityMetadata[]) {\n entityMetadatas.forEach((entityMetadata) => {\n entityMetadata.eagerRelations.forEach((relation) => {\n if (\n relation.inverseRelation &&\n relation.inverseRelation.isEager\n )\n throw new TypeORMError(\n `Circular eager relations are disallowed. ` +\n `${entityMetadata.targetName}#${relation.propertyPath} contains \"eager: true\", and its inverse side ` +\n `${relation.inverseEntityMetadata.targetName}#${relation.inverseRelation.propertyPath} contains \"eager: true\" as well.` +\n ` Remove \"eager: true\" from one side of the relation.`,\n )\n })\n })\n }\n}\n"],"sourceRoot":".."}
|
|
1
|
+
{"version":3,"sources":["../browser/src/metadata-builder/EntityMetadataValidator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAA;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAA;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAA;AAE9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAA;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEnD,mEAAmE;AACnE,6FAA6F;AAC7F,sEAAsE;AACtE,mGAAmG;AACnG,2GAA2G;AAC3G,6DAA6D;AAC7D,uEAAuE;AACvE,iFAAiF;AAEjF,2FAA2F;AAC3F,wHAAwH;AACxH,gIAAgI;AAChI,mGAAmG;AACnG,8EAA8E;AAC9E,8CAA8C;AAC9C,yD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,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;gBAClB,KAAK,CAAC,aAAa,CACf,cAAc,CAAC,IAAI,EACnB,QAAQ,CAAC,qBAAqB,CAAC,IAAI,CACtC,CAAA;YACL,CAAC,CAAC,CAAA;QACV,CAAC,CAAC,CAAA;QACF,IAAI;YACA,KAAK,CAAC,YAAY,EAAE,CAAA;SACvB;QAAC,OAAO,GAAG,EAAE;YACV,MAAM,IAAI,sBAAsB,CAC5B,GAAG,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,iCAAiC,EAAE,EAAE,CAAC,CAChE,CAAA;SACJ;IACL,CAAC;IAED;;OAEG;IACO,sBAAsB,CAAC,eAAiC;QAC9D,eAAe,CAAC,OAAO,CAAC,CAAC,cAAc,EAAE,EAAE;YACvC,cAAc,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;gBAC/C,IACI,QAAQ,CAAC,eAAe;oBACxB,QAAQ,CAAC,eAAe,CAAC,OAAO;oBAEhC,MAAM,IAAI,YAAY,CAClB,2CAA2C;wBACvC,GAAG,cAAc,CAAC,UAAU,IAAI,QAAQ,CAAC,YAAY,gDAAgD;wBACrG,GAAG,QAAQ,CAAC,qBAAqB,CAAC,UAAU,IAAI,QAAQ,CAAC,eAAe,CAAC,YAAY,kCAAkC;wBACvH,sDAAsD,CAC7D,CAAA;YACT,CAAC,CAAC,CAAA;QACN,CAAC,CAAC,CAAA;IACN,CAAC;CACJ","file":"EntityMetadataValidator.js","sourcesContent":["import { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { MissingPrimaryColumnError } from \"../error/MissingPrimaryColumnError\"\nimport { CircularRelationsError } from \"../error/CircularRelationsError\"\nimport { DepGraph } from \"../util/DepGraph\"\nimport { Driver } from \"../driver/Driver\"\nimport { DataTypeNotSupportedError } from \"../error/DataTypeNotSupportedError\"\nimport { ColumnType } from \"../driver/types/ColumnTypes\"\nimport { NoConnectionOptionError } from \"../error/NoConnectionOptionError\"\nimport { InitializedRelationError } from \"../error/InitializedRelationError\"\nimport { TypeORMError } from \"../error\"\nimport { DriverUtils } from \"../driver/DriverUtils\"\n\n/// todo: add check if there are multiple tables with the same name\n/// todo: add checks when generated column / table names are too long for the specific driver\n// todo: type in function validation, inverse side function validation\n// todo: check on build for duplicate names, since naming checking was removed from MetadataStorage\n// todo: duplicate name checking for: table, relation, column, index, naming strategy, join tables/columns?\n// todo: check if multiple tree parent metadatas in validator\n// todo: tree decorators can be used only on closure table (validation)\n// todo: throw error if parent tree metadata was not specified in a closure table\n\n// todo: MetadataArgsStorage: type in function validation, inverse side function validation\n// todo: MetadataArgsStorage: check on build for duplicate names, since naming checking was removed from MetadataStorage\n// todo: MetadataArgsStorage: duplicate name checking for: table, relation, column, index, naming strategy, join tables/columns?\n// todo: MetadataArgsStorage: check for duplicate targets too since this check has been removed too\n// todo: check if relation decorator contains primary: true and nullable: true\n// todo: check column length, precision. scale\n// todo: MySQL index can be unique or spatial or fulltext\n\n/**\n * Validates built entity metadatas.\n */\nexport class EntityMetadataValidator {\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Validates all given entity metadatas.\n */\n validateMany(entityMetadatas: EntityMetadata[], driver: Driver) {\n entityMetadatas.forEach((entityMetadata) =>\n this.validate(entityMetadata, entityMetadatas, driver),\n )\n this.validateDependencies(entityMetadatas)\n this.validateEagerRelations(entityMetadatas)\n }\n\n /**\n * Validates given entity metadata.\n */\n validate(\n entityMetadata: EntityMetadata,\n allEntityMetadatas: EntityMetadata[],\n driver: Driver,\n ) {\n // check if table metadata has an id\n if (!entityMetadata.primaryColumns.length && !entityMetadata.isJunction)\n throw new MissingPrimaryColumnError(entityMetadata)\n\n // validate if table is using inheritance it has a discriminator\n // also validate if discriminator values are not empty and not repeated\n if (\n entityMetadata.inheritancePattern === \"STI\" ||\n entityMetadata.tableType === \"entity-child\"\n ) {\n if (!entityMetadata.discriminatorColumn)\n throw new TypeORMError(\n `Entity ${entityMetadata.name} using single-table inheritance, it should also have a discriminator column. Did you forget to put discriminator column options?`,\n )\n\n if (typeof entityMetadata.discriminatorValue === \"undefined\")\n throw new TypeORMError(\n `Entity ${entityMetadata.name} has an undefined discriminator value. Discriminator value should be defined.`,\n )\n\n const sameDiscriminatorValueEntityMetadata =\n allEntityMetadatas.find((metadata) => {\n return (\n metadata !== entityMetadata &&\n (metadata.inheritancePattern === \"STI\" ||\n metadata.tableType === \"entity-child\") &&\n metadata.tableName === entityMetadata.tableName &&\n metadata.discriminatorValue ===\n entityMetadata.discriminatorValue &&\n metadata.inheritanceTree.some(\n (parent) =>\n entityMetadata.inheritanceTree.indexOf(\n parent,\n ) !== -1,\n )\n )\n })\n if (sameDiscriminatorValueEntityMetadata)\n throw new TypeORMError(\n `Entities ${entityMetadata.name} and ${sameDiscriminatorValueEntityMetadata.name} have the same discriminator values. Make sure they are different while using the @ChildEntity decorator.`,\n )\n }\n\n entityMetadata.relationCounts.forEach((relationCount) => {\n if (\n relationCount.relation.isManyToOne ||\n relationCount.relation.isOneToOne\n )\n throw new TypeORMError(\n `Relation count can not be implemented on ManyToOne or OneToOne relations.`,\n )\n })\n\n if (!(driver.options.type === \"mongodb\")) {\n entityMetadata.columns.forEach((column) => {\n const normalizedColumn = driver.normalizeType(\n column,\n ) as ColumnType\n if (driver.supportedDataTypes.indexOf(normalizedColumn) === -1)\n throw new DataTypeNotSupportedError(\n column,\n normalizedColumn,\n driver.options.type,\n )\n if (\n column.length &&\n driver.withLengthColumnTypes.indexOf(normalizedColumn) ===\n -1\n )\n throw new TypeORMError(\n `Column ${column.propertyName} of Entity ${entityMetadata.name} does not support length property.`,\n )\n if (column.type === \"enum\" && !column.enum && !column.enumName)\n throw new TypeORMError(\n `Column \"${column.propertyName}\" of Entity \"${entityMetadata.name}\" is defined as enum, but missing \"enum\" or \"enumName\" properties.`,\n )\n })\n }\n\n if (\n DriverUtils.isMySQLFamily(driver) ||\n driver.options.type === \"aurora-mysql\"\n ) {\n const generatedColumns = entityMetadata.columns.filter(\n (column) =>\n column.isGenerated && column.generationStrategy !== \"uuid\",\n )\n if (generatedColumns.length > 1)\n throw new TypeORMError(\n `Error in ${entityMetadata.name} entity. There can be only one auto-increment column in MySql table.`,\n )\n }\n\n // for mysql we are able to not define a default selected database, instead all entities can have their database\n // defined in their decorators. To make everything work either all entities must have database define and we\n // can live without database set in the connection options, either database in the connection options must be set\n if (DriverUtils.isMySQLFamily(driver)) {\n const metadatasWithDatabase = allEntityMetadatas.filter(\n (metadata) => metadata.database,\n )\n if (metadatasWithDatabase.length === 0 && !driver.database)\n throw new NoConnectionOptionError(\"database\")\n }\n\n if (driver.options.type === \"mssql\") {\n const charsetColumns = entityMetadata.columns.filter(\n (column) => column.charset,\n )\n if (charsetColumns.length > 1)\n throw new TypeORMError(\n `Character set specifying is not supported in Sql Server`,\n )\n }\n\n // Postgres supports only STORED generated columns.\n if (driver.options.type === \"postgres\") {\n const virtualColumn = entityMetadata.columns.find(\n (column) =>\n column.asExpression &&\n (!column.generatedType ||\n column.generatedType === \"VIRTUAL\"),\n )\n if (virtualColumn)\n throw new TypeORMError(\n `Column \"${virtualColumn.propertyName}\" of Entity \"${entityMetadata.name}\" is defined as VIRTUAL, but Postgres supports only STORED generated columns.`,\n )\n }\n\n // check if relations are all without initialized properties\n const entityInstance = entityMetadata.create(undefined, {\n fromDeserializer: true,\n })\n entityMetadata.relations.forEach((relation) => {\n if (relation.isManyToMany || relation.isOneToMany) {\n // we skip relations for which persistence is disabled since initialization in them cannot harm somehow\n if (relation.persistenceEnabled === false) return\n\n // get entity relation value and check if its an array\n const relationInitializedValue =\n relation.getEntityValue(entityInstance)\n if (Array.isArray(relationInitializedValue))\n throw new InitializedRelationError(relation)\n }\n })\n\n // validate relations\n entityMetadata.relations.forEach((relation) => {\n // check join tables:\n // using JoinTable is possible only on one side of the many-to-many relation\n // todo(dima): fix\n // if (relation.joinTable) {\n // if (!relation.isManyToMany)\n // throw new UsingJoinTableIsNotAllowedError(entityMetadata, relation);\n // // if there is inverse side of the relation, then check if it does not have join table too\n // if (relation.hasInverseSide && relation.inverseRelation.joinTable)\n // throw new UsingJoinTableOnlyOnOneSideAllowedError(entityMetadata, relation);\n // }\n // check join columns:\n // using JoinColumn is possible only on one side of the relation and on one-to-one, many-to-one relation types\n // first check if relation is one-to-one or many-to-one\n // todo(dima): fix\n /*if (relation.joinColumn) {\n\n // join column can be applied only on one-to-one and many-to-one relations\n if (!relation.isOneToOne && !relation.isManyToOne)\n throw new UsingJoinColumnIsNotAllowedError(entityMetadata, relation);\n\n // if there is inverse side of the relation, then check if it does not have join table too\n if (relation.hasInverseSide && relation.inverseRelation.joinColumn && relation.isOneToOne)\n throw new UsingJoinColumnOnlyOnOneSideAllowedError(entityMetadata, relation);\n\n // check if join column really has referenced column\n if (relation.joinColumn && !relation.joinColumn.referencedColumn)\n throw new TypeORMError(`Join column does not have referenced column set`);\n\n }\n\n // if its a one-to-one relation and JoinColumn is missing on both sides of the relation\n // or its one-side relation without JoinColumn we should give an error\n if (!relation.joinColumn && relation.isOneToOne && (!relation.hasInverseSide || !relation.inverseRelation.joinColumn))\n throw new MissingJoinColumnError(entityMetadata, relation);*/\n // if its a many-to-many relation and JoinTable is missing on both sides of the relation\n // or its one-side relation without JoinTable we should give an error\n // todo(dima): fix it\n // if (!relation.joinTable && relation.isManyToMany && (!relation.hasInverseSide || !relation.inverseRelation.joinTable))\n // throw new MissingJoinTableError(entityMetadata, relation);\n // todo: validate if its one-to-one and side which does not have join column MUST have inverse side\n // todo: validate if its many-to-many and side which does not have join table MUST have inverse side\n // todo: if there is a relation, and inverse side is specified only on one side, shall we give error\n // todo: with message like: \"Inverse side is specified only on one side of the relationship. Specify on other side too to prevent confusion\".\n // todo: add validation if there two entities with the same target, and show error message with description of the problem (maybe file was renamed/moved but left in output directory)\n // todo: check if there are multiple columns on the same column applied.\n // todo: check column type if is missing in relational databases (throw new TypeORMError(`Column type of ${type} cannot be determined.`);)\n // todo: include driver-specific checks. for example in mongodb empty prefixes are not allowed\n // todo: if multiple columns with same name - throw exception, including cases when columns are in embeds with same prefixes or without prefix at all\n // todo: if multiple primary key used, at least one of them must be unique or @Index decorator must be set on entity\n // todo: check if entity with duplicate names, some decorators exist\n })\n\n // make sure cascade remove is not set for both sides of relationships (can be set in OneToOne decorators)\n entityMetadata.relations.forEach((relation) => {\n const isCircularCascadeRemove =\n relation.isCascadeRemove &&\n relation.inverseRelation &&\n relation.inverseRelation!.isCascadeRemove\n if (isCircularCascadeRemove)\n throw new TypeORMError(\n `Relation ${entityMetadata.name}#${\n relation.propertyName\n } and ${relation.inverseRelation!.entityMetadata.name}#${\n relation.inverseRelation!.propertyName\n } both has cascade remove set. ` +\n `This may lead to unexpected circular removals. Please set cascade remove only from one side of relationship.`,\n )\n }) // todo: maybe better just deny removal from one to one relation without join column?\n\n entityMetadata.eagerRelations.forEach((relation) => {})\n }\n\n /**\n * Validates dependencies of the entity metadatas.\n */\n protected validateDependencies(entityMetadatas: EntityMetadata[]) {\n const graph = new DepGraph()\n entityMetadatas.forEach((entityMetadata) => {\n graph.addNode(entityMetadata.name)\n })\n entityMetadatas.forEach((entityMetadata) => {\n entityMetadata.relationsWithJoinColumns\n .filter((relation) => !relation.isNullable)\n .forEach((relation) => {\n graph.addDependency(\n entityMetadata.name,\n relation.inverseEntityMetadata.name,\n )\n })\n })\n try {\n graph.overallOrder()\n } catch (err) {\n throw new CircularRelationsError(\n err.toString().replace(\"Error: Dependency Cycle Found: \", \"\"),\n )\n }\n }\n\n /**\n * Validates eager relations to prevent circular dependency in them.\n */\n protected validateEagerRelations(entityMetadatas: EntityMetadata[]) {\n entityMetadatas.forEach((entityMetadata) => {\n entityMetadata.eagerRelations.forEach((relation) => {\n if (\n relation.inverseRelation &&\n relation.inverseRelation.isEager\n )\n throw new TypeORMError(\n `Circular eager relations are disallowed. ` +\n `${entityMetadata.targetName}#${relation.propertyPath} contains \"eager: true\", and its inverse side ` +\n `${relation.inverseEntityMetadata.targetName}#${relation.inverseRelation.propertyPath} contains \"eager: true\" as well.` +\n ` Remove \"eager: true\" from one side of the relation.`,\n )\n })\n })\n }\n}\n"],"sourceRoot":".."}
|
|
@@ -143,6 +143,16 @@ export declare abstract class BaseQueryRunner {
|
|
|
143
143
|
protected replaceCachedTable(table: Table, changedTable: Table): void;
|
|
144
144
|
protected getTablePath(target: EntityMetadata | Table | View | TableForeignKey | string): string;
|
|
145
145
|
protected getTypeormMetadataTableName(): string;
|
|
146
|
+
/**
|
|
147
|
+
* Generates SQL query to select record from typeorm metadata table.
|
|
148
|
+
*/
|
|
149
|
+
protected selectTypeormMetadataSql({ database, schema, table, type, name, }: {
|
|
150
|
+
database?: string;
|
|
151
|
+
schema?: string;
|
|
152
|
+
table?: string;
|
|
153
|
+
type: MetadataTableType;
|
|
154
|
+
name: string;
|
|
155
|
+
}): Query;
|
|
146
156
|
/**
|
|
147
157
|
* Generates SQL query to insert a record into typeorm metadata table.
|
|
148
158
|
*/
|
|
@@ -223,6 +223,30 @@ export class BaseQueryRunner {
|
|
|
223
223
|
const options = this.connection.driver.options;
|
|
224
224
|
return this.connection.driver.buildTableName(this.connection.metadataTableName, options.schema, options.database);
|
|
225
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* Generates SQL query to select record from typeorm metadata table.
|
|
228
|
+
*/
|
|
229
|
+
selectTypeormMetadataSql({ database, schema, table, type, name, }) {
|
|
230
|
+
const qb = this.connection.createQueryBuilder();
|
|
231
|
+
const selectQb = qb
|
|
232
|
+
.select()
|
|
233
|
+
.from(this.getTypeormMetadataTableName(), "t")
|
|
234
|
+
.where(`${qb.escape("type")} = :type`, { type })
|
|
235
|
+
.andWhere(`${qb.escape("name")} = :name`, { name });
|
|
236
|
+
if (database) {
|
|
237
|
+
selectQb.andWhere(`${qb.escape("database")} = :database`, {
|
|
238
|
+
database,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
if (schema) {
|
|
242
|
+
selectQb.andWhere(`${qb.escape("schema")} = :schema`, { schema });
|
|
243
|
+
}
|
|
244
|
+
if (table) {
|
|
245
|
+
selectQb.andWhere(`${qb.escape("table")} = :table`, { table });
|
|
246
|
+
}
|
|
247
|
+
const [query, parameters] = selectQb.getQueryAndParameters();
|
|
248
|
+
return new Query(query, parameters);
|
|
249
|
+
}
|
|
226
250
|
/**
|
|
227
251
|
* Generates SQL query to insert a record into typeorm metadata table.
|
|
228
252
|
*/
|
|
@@ -303,7 +327,7 @@ export class BaseQueryRunner {
|
|
|
303
327
|
oldColumn.width !== newColumn.width || // MySQL only
|
|
304
328
|
oldColumn.zerofill !== newColumn.zerofill || // MySQL only
|
|
305
329
|
oldColumn.unsigned !== newColumn.unsigned || // MySQL only
|
|
306
|
-
oldColumn.asExpression !== newColumn.asExpression ||
|
|
330
|
+
oldColumn.asExpression !== newColumn.asExpression ||
|
|
307
331
|
(checkDefault && oldColumn.default !== newColumn.default) ||
|
|
308
332
|
oldColumn.onUpdate !== newColumn.onUpdate || // MySQL only
|
|
309
333
|
oldColumn.isNullable !== newColumn.isNullable ||
|