typeorm 0.2.39 → 0.2.40-dev.0cc8fbb
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/README.md +0 -3
- package/browser/decorator/columns/PrimaryGeneratedColumn.d.ts +1 -0
- package/browser/decorator/columns/PrimaryGeneratedColumn.js +1 -1
- package/browser/decorator/columns/PrimaryGeneratedColumn.js.map +1 -1
- package/browser/decorator/options/ColumnCommonOptions.d.ts +1 -1
- package/browser/decorator/options/ColumnCommonOptions.js.map +1 -1
- package/browser/driver/Driver.d.ts +5 -0
- package/browser/driver/Driver.js.map +1 -1
- package/browser/driver/aurora-data-api/AuroraDataApiDriver.d.ts +4 -0
- package/browser/driver/aurora-data-api/AuroraDataApiDriver.js +4 -0
- package/browser/driver/aurora-data-api/AuroraDataApiDriver.js.map +1 -1
- package/browser/driver/cockroachdb/CockroachDriver.d.ts +4 -0
- package/browser/driver/cockroachdb/CockroachDriver.js +4 -0
- package/browser/driver/cockroachdb/CockroachDriver.js.map +1 -1
- package/browser/driver/mysql/MysqlDriver.d.ts +4 -0
- package/browser/driver/mysql/MysqlDriver.js +10 -3
- package/browser/driver/mysql/MysqlDriver.js.map +1 -1
- package/browser/driver/postgres/PostgresDriver.d.ts +4 -0
- package/browser/driver/postgres/PostgresDriver.js +4 -0
- package/browser/driver/postgres/PostgresDriver.js.map +1 -1
- package/browser/driver/postgres/PostgresQueryRunner.js +19 -8
- package/browser/driver/postgres/PostgresQueryRunner.js.map +1 -1
- package/browser/driver/sqlite-abstract/AbstractSqliteDriver.d.ts +4 -0
- package/browser/driver/sqlite-abstract/AbstractSqliteDriver.js +4 -0
- package/browser/driver/sqlite-abstract/AbstractSqliteDriver.js.map +1 -1
- package/browser/driver/types/UpsertType.d.ts +1 -0
- package/browser/driver/types/UpsertType.js +3 -0
- package/browser/driver/types/UpsertType.js.map +1 -0
- package/browser/entity-manager/EntityManager.d.ts +2 -0
- package/browser/entity-manager/EntityManager.js +42 -1
- package/browser/entity-manager/EntityManager.js.map +1 -1
- package/browser/metadata/EntityMetadata.d.ts +4 -0
- package/browser/metadata/EntityMetadata.js +14 -0
- package/browser/metadata/EntityMetadata.js.map +1 -1
- package/browser/query-builder/InsertQueryBuilder.js +8 -2
- package/browser/query-builder/InsertQueryBuilder.js.map +1 -1
- package/browser/repository/BaseEntity.d.ts +7 -0
- package/browser/repository/BaseEntity.js +8 -0
- package/browser/repository/BaseEntity.js.map +1 -1
- package/browser/repository/Repository.d.ts +7 -0
- package/browser/repository/Repository.js +8 -0
- package/browser/repository/Repository.js.map +1 -1
- package/browser/repository/UpsertOptions.d.ts +6 -0
- package/browser/repository/UpsertOptions.js +3 -0
- package/browser/repository/UpsertOptions.js.map +1 -0
- package/browser/schema-builder/options/TableColumnOptions.d.ts +1 -1
- package/browser/schema-builder/options/TableColumnOptions.js.map +1 -1
- package/browser/schema-builder/table/TableColumn.d.ts +1 -1
- package/browser/schema-builder/table/TableColumn.js.map +1 -1
- package/browser/util/OrmUtils.d.ts +1 -0
- package/browser/util/OrmUtils.js +11 -0
- package/browser/util/OrmUtils.js.map +1 -1
- package/decorator/columns/PrimaryGeneratedColumn.d.ts +1 -0
- package/decorator/columns/PrimaryGeneratedColumn.js +1 -1
- package/decorator/columns/PrimaryGeneratedColumn.js.map +1 -1
- package/decorator/options/ColumnCommonOptions.d.ts +1 -1
- package/decorator/options/ColumnCommonOptions.js.map +1 -1
- package/driver/Driver.d.ts +5 -0
- package/driver/Driver.js.map +1 -1
- package/driver/aurora-data-api/AuroraDataApiDriver.d.ts +4 -0
- package/driver/aurora-data-api/AuroraDataApiDriver.js +4 -0
- package/driver/aurora-data-api/AuroraDataApiDriver.js.map +1 -1
- package/driver/cockroachdb/CockroachDriver.d.ts +4 -0
- package/driver/cockroachdb/CockroachDriver.js +4 -0
- package/driver/cockroachdb/CockroachDriver.js.map +1 -1
- package/driver/mysql/MysqlDriver.d.ts +4 -0
- package/driver/mysql/MysqlDriver.js +10 -3
- package/driver/mysql/MysqlDriver.js.map +1 -1
- package/driver/postgres/PostgresDriver.d.ts +4 -0
- package/driver/postgres/PostgresDriver.js +4 -0
- package/driver/postgres/PostgresDriver.js.map +1 -1
- package/driver/postgres/PostgresQueryRunner.js +19 -8
- package/driver/postgres/PostgresQueryRunner.js.map +1 -1
- package/driver/sqlite-abstract/AbstractSqliteDriver.d.ts +4 -0
- package/driver/sqlite-abstract/AbstractSqliteDriver.js +4 -0
- package/driver/sqlite-abstract/AbstractSqliteDriver.js.map +1 -1
- package/driver/types/UpsertType.d.ts +1 -0
- package/driver/types/UpsertType.js +4 -0
- package/driver/types/UpsertType.js.map +1 -0
- package/entity-manager/EntityManager.d.ts +2 -0
- package/entity-manager/EntityManager.js +41 -0
- package/entity-manager/EntityManager.js.map +1 -1
- package/metadata/EntityMetadata.d.ts +4 -0
- package/metadata/EntityMetadata.js +14 -0
- package/metadata/EntityMetadata.js.map +1 -1
- package/package.json +1 -239
- package/query-builder/InsertQueryBuilder.js +11 -5
- package/query-builder/InsertQueryBuilder.js.map +1 -1
- package/repository/BaseEntity.d.ts +7 -0
- package/repository/BaseEntity.js +8 -0
- package/repository/BaseEntity.js.map +1 -1
- package/repository/Repository.d.ts +7 -0
- package/repository/Repository.js +8 -0
- package/repository/Repository.js.map +1 -1
- package/repository/UpsertOptions.d.ts +6 -0
- package/repository/UpsertOptions.js +4 -0
- package/repository/UpsertOptions.js.map +1 -0
- package/schema-builder/options/TableColumnOptions.d.ts +1 -1
- package/schema-builder/options/TableColumnOptions.js.map +1 -1
- package/schema-builder/table/TableColumn.d.ts +1 -1
- package/schema-builder/table/TableColumn.js.map +1 -1
- package/util/OrmUtils.d.ts +1 -0
- package/util/OrmUtils.js +11 -0
- package/util/OrmUtils.js.map +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../browser/src/repository/UpsertOptions.ts"],"names":[],"mappings":"","file":"UpsertOptions.js","sourcesContent":["/**\n * Special options passed to Repository#upsert\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport interface UpsertOptions<Entity> {\n conflictPaths: string[]\n}\n"],"sourceRoot":".."}
|
|
@@ -29,7 +29,7 @@ export interface TableColumnOptions {
|
|
|
29
29
|
/**
|
|
30
30
|
* Specifies generation strategy if this column will use auto increment.
|
|
31
31
|
*/
|
|
32
|
-
generationStrategy?: "uuid" | "increment" | "rowid";
|
|
32
|
+
generationStrategy?: "uuid" | "increment" | "rowid" | "identity";
|
|
33
33
|
/**
|
|
34
34
|
* Indicates if column is a primary key.
|
|
35
35
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../browser/src/schema-builder/options/TableColumnOptions.ts"],"names":[],"mappings":"","file":"TableColumnOptions.js","sourcesContent":["\n/**\n * Table's column options.\n */\nexport interface TableColumnOptions {\n\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Column name.\n */\n name: string;\n\n /**\n * Column type.\n */\n type: string;\n\n /**\n * Column's default value.\n */\n default?: any;\n\n /**\n * ON UPDATE trigger. Works only for MySQL.\n */\n onUpdate?: string;\n\n /**\n * Indicates if column is NULL, or is NOT NULL in the database.\n */\n isNullable?: boolean;\n\n /**\n * Indicates if column is auto-generated sequence.\n */\n isGenerated?: boolean;\n\n /**\n * Specifies generation strategy if this column will use auto increment.\n */\n generationStrategy?: \"uuid\"|\"increment\"|\"rowid\";\n\n /**\n * Indicates if column is a primary key.\n */\n isPrimary?: boolean;\n\n /**\n * Indicates if column has unique value.\n */\n isUnique?: boolean;\n\n /**\n * Indicates if column stores array.\n */\n isArray?: boolean;\n\n /**\n * Column's comment.\n */\n comment?: string;\n\n /**\n * Column type's length. Used only on some column types.\n * For example type = \"string\" and length = \"100\" means that ORM will create a column with type varchar(100).\n */\n length?: string;\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 * Defines column character set.\n */\n charset?: string;\n\n /**\n * Defines column collation.\n */\n collation?: 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|null;\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 * Array of possible enumerated values.\n */\n enum?: string[];\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 * 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"],"sourceRoot":"../.."}
|
|
1
|
+
{"version":3,"sources":["../browser/src/schema-builder/options/TableColumnOptions.ts"],"names":[],"mappings":"","file":"TableColumnOptions.js","sourcesContent":["\n/**\n * Table's column options.\n */\nexport interface TableColumnOptions {\n\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Column name.\n */\n name: string;\n\n /**\n * Column type.\n */\n type: string;\n\n /**\n * Column's default value.\n */\n default?: any;\n\n /**\n * ON UPDATE trigger. Works only for MySQL.\n */\n onUpdate?: string;\n\n /**\n * Indicates if column is NULL, or is NOT NULL in the database.\n */\n isNullable?: boolean;\n\n /**\n * Indicates if column is auto-generated sequence.\n */\n isGenerated?: boolean;\n\n /**\n * Specifies generation strategy if this column will use auto increment.\n */\n generationStrategy?: \"uuid\"|\"increment\"|\"rowid\"|\"identity\";\n\n /**\n * Indicates if column is a primary key.\n */\n isPrimary?: boolean;\n\n /**\n * Indicates if column has unique value.\n */\n isUnique?: boolean;\n\n /**\n * Indicates if column stores array.\n */\n isArray?: boolean;\n\n /**\n * Column's comment.\n */\n comment?: string;\n\n /**\n * Column type's length. Used only on some column types.\n * For example type = \"string\" and length = \"100\" means that ORM will create a column with type varchar(100).\n */\n length?: string;\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 * Defines column character set.\n */\n charset?: string;\n\n /**\n * Defines column collation.\n */\n collation?: 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|null;\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 * Array of possible enumerated values.\n */\n enum?: string[];\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 * 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"],"sourceRoot":"../.."}
|
|
@@ -31,7 +31,7 @@ export declare class TableColumn {
|
|
|
31
31
|
* Specifies generation strategy if this column will use auto increment.
|
|
32
32
|
* `rowid` option supported only in CockroachDB.
|
|
33
33
|
*/
|
|
34
|
-
generationStrategy?: "uuid" | "increment" | "rowid";
|
|
34
|
+
generationStrategy?: "uuid" | "increment" | "rowid" | "identity";
|
|
35
35
|
/**
|
|
36
36
|
* Indicates if column is a primary key.
|
|
37
37
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../browser/src/schema-builder/table/TableColumn.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH;IAyII,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,qBAAY,OAA4B;QAnHxC;;WAEG;QACH,eAAU,GAAY,KAAK,CAAC;QAE5B;;WAEG;QACH,gBAAW,GAAY,KAAK,CAAC;QAQ7B;;WAEG;QACH,cAAS,GAAY,KAAK,CAAC;QAE3B;;WAEG;QACH,aAAQ,GAAY,KAAK,CAAC;QAE1B;;WAEG;QACH,YAAO,GAAY,KAAK,CAAC;QAOzB;;;WAGG;QACH,WAAM,GAAW,EAAE,CAAC;QA8BpB;;;WAGG;QACH,aAAQ,GAAY,KAAK,CAAC;QAE1B;;WAEG;QACH,aAAQ,GAAY,KAAK,CAAC;QAqCtB,IAAI,OAAO,EAAE;YACT,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YACzB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC;YAC/B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC;YACnC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;YAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;YAC/B,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;YACnC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;YACnC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;YAC3B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,KAAK,CAAC;YAC1C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ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AAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;YAC3C,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;YAC3C,IAAI,EAAE,IAAI,CAAC,IAAI;SAClB,CAAC,CAAC;IACP,CAAC;IAEL,kBAAC;AAAD,CAhNA,AAgNC,IAAA","file":"TableColumn.js","sourcesContent":["import {TableColumnOptions} from \"../options/TableColumnOptions\";\n\n/**\n * Table's columns in the database represented in this class.\n */\nexport class TableColumn {\n\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Column name.\n */\n name: string;\n\n /**\n * Column type.\n */\n type: string;\n\n /**\n * Column's default value.\n */\n default?: any;\n\n /**\n * ON UPDATE trigger. Works only for MySQL.\n */\n onUpdate?: string;\n\n /**\n * Indicates if column is NULL, or is NOT NULL in the database.\n */\n isNullable: boolean = false;\n\n /**\n * Indicates if column is auto-generated sequence.\n */\n isGenerated: boolean = false;\n\n /**\n * Specifies generation strategy if this column will use auto increment.\n * `rowid` option supported only in CockroachDB.\n */\n generationStrategy?: \"uuid\"|\"increment\"|\"rowid\";\n\n /**\n * Indicates if column is a primary key.\n */\n isPrimary: boolean = false;\n\n /**\n * Indicates if column has unique value.\n */\n isUnique: boolean = false;\n\n /**\n * Indicates if column stores array.\n */\n isArray: boolean = false;\n\n /**\n * Column's comment.\n */\n comment?: string;\n\n /**\n * Column type's length. Used only on some column types.\n * For example type = \"string\" and length = \"100\" means that ORM will create a column with type varchar(100).\n */\n length: string = \"\";\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 * Defines column character set.\n */\n charset?: string;\n\n /**\n * Defines column collation.\n */\n collation?: 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|null;\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 = 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 enum?: string[];\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 * 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?: TableColumnOptions) {\n if (options) {\n this.name = options.name;\n this.type = options.type || \"\";\n this.length = options.length || \"\";\n this.width = options.width;\n this.charset = options.charset;\n this.collation = options.collation;\n this.precision = options.precision;\n this.scale = options.scale;\n this.zerofill = options.zerofill || false;\n this.unsigned = this.zerofill ? true : (options.unsigned || false);\n this.default = options.default;\n this.onUpdate = options.onUpdate;\n this.isNullable = options.isNullable || false;\n this.isGenerated = options.isGenerated || false;\n this.generationStrategy = options.generationStrategy;\n this.isPrimary = options.isPrimary || false;\n this.isUnique = options.isUnique || false;\n this.isArray = options.isArray || false;\n this.comment = options.comment;\n this.enum = options.enum;\n this.enumName = options.enumName;\n this.asExpression = options.asExpression;\n this.generatedType = options.generatedType;\n this.spatialFeatureType = options.spatialFeatureType;\n this.srid = options.srid;\n }\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Clones this column to a new column with exact same properties as this column has.\n */\n clone(): TableColumn {\n return new TableColumn(<TableColumnOptions>{\n name: this.name,\n type: this.type,\n length: this.length,\n width: this.width,\n charset: this.charset,\n collation: this.collation,\n precision: this.precision,\n scale: this.scale,\n zerofill: this.zerofill,\n unsigned: this.unsigned,\n enum: this.enum,\n enumName: this.enumName,\n asExpression: this.asExpression,\n generatedType: this.generatedType,\n default: this.default,\n onUpdate: this.onUpdate,\n isNullable: this.isNullable,\n isGenerated: this.isGenerated,\n generationStrategy: this.generationStrategy,\n isPrimary: this.isPrimary,\n isUnique: this.isUnique,\n isArray: this.isArray,\n comment: this.comment,\n spatialFeatureType: this.spatialFeatureType,\n srid: this.srid\n });\n }\n\n}\n"],"sourceRoot":"../.."}
|
|
1
|
+
{"version":3,"sources":["../browser/src/schema-builder/table/TableColumn.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH;IAyII,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,qBAAY,OAA4B;QAnHxC;;WAEG;QACH,eAAU,GAAY,KAAK,CAAC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AAQ;YACvB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;YAC3C,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;YAC3C,IAAI,EAAE,IAAI,CAAC,IAAI;SAClB,CAAC,CAAC;IACP,CAAC;IAEL,kBAAC;AAAD,CAhNA,AAgNC,IAAA","file":"TableColumn.js","sourcesContent":["import {TableColumnOptions} from \"../options/TableColumnOptions\";\n\n/**\n * Table's columns in the database represented in this class.\n */\nexport class TableColumn {\n\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Column name.\n */\n name: string;\n\n /**\n * Column type.\n */\n type: string;\n\n /**\n * Column's default value.\n */\n default?: any;\n\n /**\n * ON UPDATE trigger. Works only for MySQL.\n */\n onUpdate?: string;\n\n /**\n * Indicates if column is NULL, or is NOT NULL in the database.\n */\n isNullable: boolean = false;\n\n /**\n * Indicates if column is auto-generated sequence.\n */\n isGenerated: boolean = false;\n\n /**\n * Specifies generation strategy if this column will use auto increment.\n * `rowid` option supported only in CockroachDB.\n */\n generationStrategy?: \"uuid\"|\"increment\"|\"rowid\"|\"identity\";\n\n /**\n * Indicates if column is a primary key.\n */\n isPrimary: boolean = false;\n\n /**\n * Indicates if column has unique value.\n */\n isUnique: boolean = false;\n\n /**\n * Indicates if column stores array.\n */\n isArray: boolean = false;\n\n /**\n * Column's comment.\n */\n comment?: string;\n\n /**\n * Column type's length. Used only on some column types.\n * For example type = \"string\" and length = \"100\" means that ORM will create a column with type varchar(100).\n */\n length: string = \"\";\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 * Defines column character set.\n */\n charset?: string;\n\n /**\n * Defines column collation.\n */\n collation?: 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|null;\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 = 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 enum?: string[];\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 * 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?: TableColumnOptions) {\n if (options) {\n this.name = options.name;\n this.type = options.type || \"\";\n this.length = options.length || \"\";\n this.width = options.width;\n this.charset = options.charset;\n this.collation = options.collation;\n this.precision = options.precision;\n this.scale = options.scale;\n this.zerofill = options.zerofill || false;\n this.unsigned = this.zerofill ? true : (options.unsigned || false);\n this.default = options.default;\n this.onUpdate = options.onUpdate;\n this.isNullable = options.isNullable || false;\n this.isGenerated = options.isGenerated || false;\n this.generationStrategy = options.generationStrategy;\n this.isPrimary = options.isPrimary || false;\n this.isUnique = options.isUnique || false;\n this.isArray = options.isArray || false;\n this.comment = options.comment;\n this.enum = options.enum;\n this.enumName = options.enumName;\n this.asExpression = options.asExpression;\n this.generatedType = options.generatedType;\n this.spatialFeatureType = options.spatialFeatureType;\n this.srid = options.srid;\n }\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Clones this column to a new column with exact same properties as this column has.\n */\n clone(): TableColumn {\n return new TableColumn(<TableColumnOptions>{\n name: this.name,\n type: this.type,\n length: this.length,\n width: this.width,\n charset: this.charset,\n collation: this.collation,\n precision: this.precision,\n scale: this.scale,\n zerofill: this.zerofill,\n unsigned: this.unsigned,\n enum: this.enum,\n enumName: this.enumName,\n asExpression: this.asExpression,\n generatedType: this.generatedType,\n default: this.default,\n onUpdate: this.onUpdate,\n isNullable: this.isNullable,\n isGenerated: this.isGenerated,\n generationStrategy: this.generationStrategy,\n isPrimary: this.isPrimary,\n isUnique: this.isUnique,\n isArray: this.isArray,\n comment: this.comment,\n spatialFeatureType: this.spatialFeatureType,\n srid: this.srid\n });\n }\n\n}\n"],"sourceRoot":"../.."}
|
package/browser/util/OrmUtils.js
CHANGED
|
@@ -226,6 +226,17 @@ var OrmUtils = /** @class */ (function () {
|
|
|
226
226
|
return arr2.indexOf(element) !== -1;
|
|
227
227
|
});
|
|
228
228
|
};
|
|
229
|
+
OrmUtils.areMutuallyExclusive = function () {
|
|
230
|
+
var lists = [];
|
|
231
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
232
|
+
lists[_i] = arguments[_i];
|
|
233
|
+
}
|
|
234
|
+
var haveSharedObjects = lists.some(function (list) {
|
|
235
|
+
var otherLists = lists.filter(function (otherList) { return otherList !== list; });
|
|
236
|
+
return list.some(function (item) { return otherLists.some(function (otherList) { return otherList.includes(item); }); });
|
|
237
|
+
});
|
|
238
|
+
return !haveSharedObjects;
|
|
239
|
+
};
|
|
229
240
|
// -------------------------------------------------------------------------
|
|
230
241
|
// Private methods
|
|
231
242
|
// -------------------------------------------------------------------------
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../browser/src/util/OrmUtils.ts"],"names":[],"mappings":";AAEA;IAAA;IAiVA,CAAC;IA/UG,4EAA4E;IAC5E,iBAAiB;IACjB,4EAA4E;IAE5E;;OAEG;IACI,cAAK,GAAZ,UAAgB,KAAU,EAAE,IAAY;QACpC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,EAAE,UAAC,CAAC,EAAE,CAAC;YAC1D,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;IACP,CAAC;IAEM,+BAAsB,GAA7B,UAAiC,eAA+B;QAC5D,OAAO;YACH,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,UAAC,GAAG,IAAe,OAAA,OAAO,GAAG,KAAK,QAAQ,EAAvB,CAAuB,CAAC;YACpE,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,UAAC,GAAG,IAAoB,OAAA,OAAO,GAAG,KAAK,QAAQ,EAAvB,CAAuB,CAAC;SAC5E,CAAC;IACN,CAAC;IAEM,gBAAO,GAAd,UAAqB,KAAU,EAAE,gBAAgC;QAC7D,OAAO,KAAK,CAAC,MAAM,CAAC,UAAC,YAAY,EAAE,KAAK;YACpC,IAAM,GAAG,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;YACpC,IAAI,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,EAAE,KAAK,GAAG,EAAZ,CAAY,CAAC,CAAC;YACnD,IAAI,CAAC,OAAO,EAAE;gBACV,OAAO,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,KAA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CAAC,CAAC,CAAC,CAAC,EAAE;gBAClC,OAAO,KAAK,CAAC;aAChB;SACJ;QAED,KAAK,CAAC,IAAI,CAAC,EAAE;YACT,IAAI,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE;gBAC7C,OAAO,KAAK,CAAC;aAChB;iBACI,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;gBAClC,OAAO,KAAK,CAAC;aAChB;YAED,QAAQ,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;gBACnB,KAAK,QAAQ,CAAC;gBACd,KAAK,UAAU;oBAEX,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;oBAClB,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;oBAEnB,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;wBAC1D,OAAO,KAAK,CAAC;qBAChB;oBAED,SAAS,CAAC,GAAG,EAAE,CAAC;oBAChB,UAAU,CAAC,GAAG,EAAE,CAAC;oBACjB,MAAM;gBAEV;oBACI,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;wBACf,OAAO,KAAK,CAAC;qBAChB;oBACD,MAAM;aACb;SACJ;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAEL,eAAC;AAAD,CAjVA,AAiVC,IAAA","file":"OrmUtils.js","sourcesContent":["import {ObjectLiteral} from \"../common/ObjectLiteral\";\n\nexport class OrmUtils {\n\n // -------------------------------------------------------------------------\n // Public methods\n // -------------------------------------------------------------------------\n\n /**\n * Chunks array into pieces.\n */\n static chunk<T>(array: T[], size: number): T[][] {\n return Array.from(Array(Math.ceil(array.length / size)), (_, i) => {\n return array.slice(i * size, i * size + size);\n });\n }\n\n static splitClassesAndStrings<T>(clsesAndStrings: (string | T)[]): [T[], string[]] {\n return [\n (clsesAndStrings).filter((cls): cls is T => typeof cls !== \"string\"),\n (clsesAndStrings).filter((str): str is string => typeof str === \"string\"),\n ];\n }\n\n static groupBy<T, R>(array: T[], propertyCallback: (item: T) => R): { id: R, items: T[] }[] {\n return array.reduce((groupedArray, value) => {\n const key = propertyCallback(value);\n let grouped = groupedArray.find(i => i.id === key);\n if (!grouped) {\n grouped = { id: key, items: [] };\n groupedArray.push(grouped);\n }\n grouped.items.push(value);\n return groupedArray;\n }, [] as Array<{ id: R, items: T[] }>);\n }\n\n static uniq<T>(array: T[], criteria?: (item: T) => any): T[];\n static uniq<T, K extends keyof T>(array: T[], property: K): T[];\n static uniq<T, K extends keyof T>(array: T[], criteriaOrProperty?: ((item: T) => any) | K): T[] {\n return array.reduce((uniqueArray, item) => {\n let found: boolean = false;\n if (criteriaOrProperty instanceof Function) {\n const itemValue = criteriaOrProperty(item);\n found = !!uniqueArray.find(uniqueItem => criteriaOrProperty(uniqueItem) === itemValue);\n\n } else if (typeof criteriaOrProperty === \"string\") {\n found = !!uniqueArray.find(uniqueItem => uniqueItem[criteriaOrProperty] === item[criteriaOrProperty]);\n\n } else {\n found = uniqueArray.indexOf(item) !== -1;\n }\n\n if (!found)\n uniqueArray.push(item);\n\n return uniqueArray;\n }, [] as T[]);\n }\n\n // Checks if it's an object made by Object.create(null), {} or new Object()\n private static isPlainObject(item: any) {\n if (item === null || item === undefined) {\n return false;\n }\n\n return !item.constructor || item.constructor === Object;\n }\n\n private static mergeArrayKey(target: any, key: number, value: any, memo: Map<any, any>) {\n // Have we seen this before? Prevent infinite recursion.\n if (memo.has(value)) {\n target[key] = memo.get(value);\n return;\n }\n\n if (value instanceof Promise) {\n // Skip promises entirely.\n // This is a hold-over from the old code & is because we don't want to pull in\n // the lazy fields. Ideally we'd remove these promises via another function first\n // but for now we have to do it here.\n return;\n }\n\n\n if (!this.isPlainObject(value) && !Array.isArray(value)) {\n target[key] = value;\n return;\n }\n\n if (!target[key]) {\n target[key] = Array.isArray(value) ? [] : {};\n }\n\n memo.set(value, target[key]);\n this.merge(target[key], value, memo);\n memo.delete(value);\n }\n\n private static mergeObjectKey(target: any, key: string, value: any, memo: Map<any, any>) {\n // Have we seen this before? Prevent infinite recursion.\n if (memo.has(value)) {\n Object.assign(target, { [key]: memo.get(value) });\n return;\n }\n\n if (value instanceof Promise) {\n // Skip promises entirely.\n // This is a hold-over from the old code & is because we don't want to pull in\n // the lazy fields. Ideally we'd remove these promises via another function first\n // but for now we have to do it here.\n return;\n }\n\n if (!this.isPlainObject(value) && !Array.isArray(value)) {\n Object.assign(target, { [key]: value });\n return;\n }\n\n if (!target[key]) {\n Object.assign(target, { [key]: Array.isArray(value) ? [] : {} });\n }\n\n memo.set(value, target[key]);\n this.merge(target[key], value, memo);\n memo.delete(value);\n }\n\n private static merge(target: any, source: any, memo: Map<any, any> = new Map()): any {\n if (this.isPlainObject(target) && this.isPlainObject(source)) {\n for (const key of Object.keys(source)) {\n this.mergeObjectKey(target, key, source[key], memo);\n }\n }\n\n if (Array.isArray(target) && Array.isArray(source)) {\n for (let key = 0; key < source.length; key++) {\n this.mergeArrayKey(target, key, source[key], memo);\n }\n }\n }\n\n /**\n * Deep Object.assign.\n */\n static mergeDeep(target: any, ...sources: any[]): any {\n if (!sources.length) {\n return target;\n }\n\n for (const source of sources) {\n OrmUtils.merge(target, source);\n }\n\n return target;\n }\n\n /**\n * Deep compare objects.\n *\n * @see http://stackoverflow.com/a/1144249\n */\n static deepCompare(...args: any[]): boolean {\n let i: any, l: any, leftChain: any, rightChain: any;\n\n if (arguments.length < 1) {\n return true; // Die silently? Don't know how to handle such case, please help...\n // throw \"Need two or more arguments to compare\";\n }\n\n for (i = 1, l = arguments.length; i < l; i++) {\n\n leftChain = []; // Todo: this can be cached\n rightChain = [];\n\n if (!this.compare2Objects(leftChain, rightChain, arguments[0], arguments[i])) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Check if two entity-id-maps are the same\n */\n static compareIds(firstId: ObjectLiteral|undefined, secondId: ObjectLiteral|undefined): boolean {\n if (firstId === undefined || firstId === null || secondId === undefined || secondId === null)\n return false;\n\n // Optimized version for the common case\n if (\n ((typeof firstId.id === \"string\" && typeof secondId.id === \"string\") ||\n (typeof firstId.id === \"number\" && typeof secondId.id === \"number\")) &&\n Object.keys(firstId).length === 1 &&\n Object.keys(secondId).length === 1\n ) {\n return firstId.id === secondId.id;\n }\n\n return OrmUtils.deepCompare(firstId, secondId);\n }\n\n /**\n * Transforms given value into boolean value.\n */\n static toBoolean(value: any): boolean {\n if (typeof value === \"boolean\")\n return value;\n\n if (typeof value === \"string\")\n return value === \"true\" || value === \"1\";\n\n if (typeof value === \"number\")\n return value > 0;\n\n return false;\n }\n\n /**\n * Composes an object from the given array of keys and values.\n */\n static zipObject(keys: any[], values: any[]): ObjectLiteral {\n return keys.reduce((object, column, index) => {\n object[column] = values[index];\n return object;\n }, {} as ObjectLiteral);\n }\n\n /**\n * Compares two arrays.\n */\n static isArraysEqual(arr1: any[], arr2: any[]): boolean {\n if (arr1.length !== arr2.length) return false;\n return arr1.every(element => {\n return arr2.indexOf(element) !== -1;\n });\n }\n\n // -------------------------------------------------------------------------\n // Private methods\n // -------------------------------------------------------------------------\n\n private static compare2Objects(leftChain: any, rightChain: any, x: any, y: any) {\n let p;\n\n // remember that NaN === NaN returns false\n // and isNaN(undefined) returns true\n if (Number.isNaN(x) && Number.isNaN(y))\n return true;\n\n // Compare primitives and functions.\n // Check if both arguments link to the same object.\n // Especially useful on the step where we compare prototypes\n if (x === y)\n return true;\n\n // Unequal, but either is null or undefined (use case: jsonb comparasion)\n // PR #3776, todo: add tests\n if (x === null || y === null || x === undefined || y === undefined)\n return false;\n\n // Fix the buffer compare bug.\n // See: https://github.com/typeorm/typeorm/issues/3654\n if ((typeof x.equals === \"function\" || x.equals instanceof Function) && x.equals(y))\n return true;\n\n // Works in case when functions are created in constructor.\n // Comparing dates is a common scenario. Another built-ins?\n // We can even handle functions passed across iframes\n if ((typeof x === \"function\" && typeof y === \"function\") ||\n (x instanceof Date && y instanceof Date) ||\n (x instanceof RegExp && y instanceof RegExp) ||\n (x instanceof String && y instanceof String) ||\n (x instanceof Number && y instanceof Number))\n return x.toString() === y.toString();\n\n // At last checking prototypes as good as we can\n if (!(x instanceof Object && y instanceof Object))\n return false;\n\n if (x.isPrototypeOf(y) || y.isPrototypeOf(x))\n return false;\n\n if (x.constructor !== y.constructor)\n return false;\n\n if (x.prototype !== y.prototype)\n return false;\n\n // Check for infinitive linking loops\n if (leftChain.indexOf(x) > -1 || rightChain.indexOf(y) > -1)\n return false;\n\n // Quick checking of one object being a subset of another.\n // todo: cache the structure of arguments[0] for performance\n for (p in y) {\n if (y.hasOwnProperty(p) !== x.hasOwnProperty(p)) {\n return false;\n }\n else if (typeof y[p] !== typeof x[p]) {\n return false;\n }\n }\n\n for (p in x) {\n if (y.hasOwnProperty(p) !== x.hasOwnProperty(p)) {\n return false;\n }\n else if (typeof y[p] !== typeof x[p]) {\n return false;\n }\n\n switch (typeof (x[p])) {\n case \"object\":\n case \"function\":\n\n leftChain.push(x);\n rightChain.push(y);\n\n if (!this.compare2Objects(leftChain, rightChain, x[p], y[p])) {\n return false;\n }\n\n leftChain.pop();\n rightChain.pop();\n break;\n\n default:\n if (x[p] !== y[p]) {\n return false;\n }\n break;\n }\n }\n\n return true;\n }\n\n}\n"],"sourceRoot":".."}
|
|
1
|
+
{"version":3,"sources":["../browser/src/util/OrmUtils.ts"],"names":[],"mappings":";AAEA;IAAA;IAyVA,CAAC;IAvVG,4EAA4E;IAC5E,iBAAiB;IACjB,4EAA4E;IAE5E;;OAEG;IACI,cAAK,GAAZ,UAAgB,KAAU,EAAE,IAAY;QACpC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CA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\n // -------------------------------------------------------------------------\n // Public methods\n // -------------------------------------------------------------------------\n\n /**\n * Chunks array into pieces.\n */\n static chunk<T>(array: T[], size: number): T[][] {\n return Array.from(Array(Math.ceil(array.length / size)), (_, i) => {\n return array.slice(i * size, i * size + size);\n });\n }\n\n static splitClassesAndStrings<T>(clsesAndStrings: (string | T)[]): [T[], string[]] {\n return [\n (clsesAndStrings).filter((cls): cls is T => typeof cls !== \"string\"),\n (clsesAndStrings).filter((str): str is string => typeof str === \"string\"),\n ];\n }\n\n static groupBy<T, R>(array: T[], propertyCallback: (item: T) => R): { id: R, items: T[] }[] {\n return array.reduce((groupedArray, value) => {\n const key = propertyCallback(value);\n let grouped = groupedArray.find(i => i.id === key);\n if (!grouped) {\n grouped = { id: key, items: [] };\n groupedArray.push(grouped);\n }\n grouped.items.push(value);\n return groupedArray;\n }, [] as Array<{ id: R, items: T[] }>);\n }\n\n static uniq<T>(array: T[], criteria?: (item: T) => any): T[];\n static uniq<T, K extends keyof T>(array: T[], property: K): T[];\n static uniq<T, K extends keyof T>(array: T[], criteriaOrProperty?: ((item: T) => any) | K): T[] {\n return array.reduce((uniqueArray, item) => {\n let found: boolean = false;\n if (criteriaOrProperty instanceof Function) {\n const itemValue = criteriaOrProperty(item);\n found = !!uniqueArray.find(uniqueItem => criteriaOrProperty(uniqueItem) === itemValue);\n\n } else if (typeof criteriaOrProperty === \"string\") {\n found = !!uniqueArray.find(uniqueItem => uniqueItem[criteriaOrProperty] === item[criteriaOrProperty]);\n\n } else {\n found = uniqueArray.indexOf(item) !== -1;\n }\n\n if (!found)\n uniqueArray.push(item);\n\n return uniqueArray;\n }, [] as T[]);\n }\n\n // Checks if it's an object made by Object.create(null), {} or new Object()\n private static isPlainObject(item: any) {\n if (item === null || item === undefined) {\n return false;\n }\n\n return !item.constructor || item.constructor === Object;\n }\n\n private static mergeArrayKey(target: any, key: number, value: any, memo: Map<any, any>) {\n // Have we seen this before? Prevent infinite recursion.\n if (memo.has(value)) {\n target[key] = memo.get(value);\n return;\n }\n\n if (value instanceof Promise) {\n // Skip promises entirely.\n // This is a hold-over from the old code & is because we don't want to pull in\n // the lazy fields. Ideally we'd remove these promises via another function first\n // but for now we have to do it here.\n return;\n }\n\n\n if (!this.isPlainObject(value) && !Array.isArray(value)) {\n target[key] = value;\n return;\n }\n\n if (!target[key]) {\n target[key] = Array.isArray(value) ? [] : {};\n }\n\n memo.set(value, target[key]);\n this.merge(target[key], value, memo);\n memo.delete(value);\n }\n\n private static mergeObjectKey(target: any, key: string, value: any, memo: Map<any, any>) {\n // Have we seen this before? Prevent infinite recursion.\n if (memo.has(value)) {\n Object.assign(target, { [key]: memo.get(value) });\n return;\n }\n\n if (value instanceof Promise) {\n // Skip promises entirely.\n // This is a hold-over from the old code & is because we don't want to pull in\n // the lazy fields. Ideally we'd remove these promises via another function first\n // but for now we have to do it here.\n return;\n }\n\n if (!this.isPlainObject(value) && !Array.isArray(value)) {\n Object.assign(target, { [key]: value });\n return;\n }\n\n if (!target[key]) {\n Object.assign(target, { [key]: Array.isArray(value) ? [] : {} });\n }\n\n memo.set(value, target[key]);\n this.merge(target[key], value, memo);\n memo.delete(value);\n }\n\n private static merge(target: any, source: any, memo: Map<any, any> = new Map()): any {\n if (this.isPlainObject(target) && this.isPlainObject(source)) {\n for (const key of Object.keys(source)) {\n this.mergeObjectKey(target, key, source[key], memo);\n }\n }\n\n if (Array.isArray(target) && Array.isArray(source)) {\n for (let key = 0; key < source.length; key++) {\n this.mergeArrayKey(target, key, source[key], memo);\n }\n }\n }\n\n /**\n * Deep Object.assign.\n */\n static mergeDeep(target: any, ...sources: any[]): any {\n if (!sources.length) {\n return target;\n }\n\n for (const source of sources) {\n OrmUtils.merge(target, source);\n }\n\n return target;\n }\n\n /**\n * Deep compare objects.\n *\n * @see http://stackoverflow.com/a/1144249\n */\n static deepCompare(...args: any[]): boolean {\n let i: any, l: any, leftChain: any, rightChain: any;\n\n if (arguments.length < 1) {\n return true; // Die silently? Don't know how to handle such case, please help...\n // throw \"Need two or more arguments to compare\";\n }\n\n for (i = 1, l = arguments.length; i < l; i++) {\n\n leftChain = []; // Todo: this can be cached\n rightChain = [];\n\n if (!this.compare2Objects(leftChain, rightChain, arguments[0], arguments[i])) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Check if two entity-id-maps are the same\n */\n static compareIds(firstId: ObjectLiteral|undefined, secondId: ObjectLiteral|undefined): boolean {\n if (firstId === undefined || firstId === null || secondId === undefined || secondId === null)\n return false;\n\n // Optimized version for the common case\n if (\n ((typeof firstId.id === \"string\" && typeof secondId.id === \"string\") ||\n (typeof firstId.id === \"number\" && typeof secondId.id === \"number\")) &&\n Object.keys(firstId).length === 1 &&\n Object.keys(secondId).length === 1\n ) {\n return firstId.id === secondId.id;\n }\n\n return OrmUtils.deepCompare(firstId, secondId);\n }\n\n /**\n * Transforms given value into boolean value.\n */\n static toBoolean(value: any): boolean {\n if (typeof value === \"boolean\")\n return value;\n\n if (typeof value === \"string\")\n return value === \"true\" || value === \"1\";\n\n if (typeof value === \"number\")\n return value > 0;\n\n return false;\n }\n\n /**\n * Composes an object from the given array of keys and values.\n */\n static zipObject(keys: any[], values: any[]): ObjectLiteral {\n return keys.reduce((object, column, index) => {\n object[column] = values[index];\n return object;\n }, {} as ObjectLiteral);\n }\n\n /**\n * Compares two arrays.\n */\n static isArraysEqual(arr1: any[], arr2: any[]): boolean {\n if (arr1.length !== arr2.length) return false;\n return arr1.every(element => {\n return arr2.indexOf(element) !== -1;\n });\n }\n\n static areMutuallyExclusive<T>(...lists: T[][]): boolean {\n const haveSharedObjects = lists.some(list => {\n const otherLists = lists.filter(otherList => otherList !== list);\n return list.some(item => otherLists.some(otherList => otherList.includes(item)));\n });\n return !haveSharedObjects;\n }\n\n // -------------------------------------------------------------------------\n // Private methods\n // -------------------------------------------------------------------------\n\n private static compare2Objects(leftChain: any, rightChain: any, x: any, y: any) {\n let p;\n\n // remember that NaN === NaN returns false\n // and isNaN(undefined) returns true\n if (Number.isNaN(x) && Number.isNaN(y))\n return true;\n\n // Compare primitives and functions.\n // Check if both arguments link to the same object.\n // Especially useful on the step where we compare prototypes\n if (x === y)\n return true;\n\n // Unequal, but either is null or undefined (use case: jsonb comparasion)\n // PR #3776, todo: add tests\n if (x === null || y === null || x === undefined || y === undefined)\n return false;\n\n // Fix the buffer compare bug.\n // See: https://github.com/typeorm/typeorm/issues/3654\n if ((typeof x.equals === \"function\" || x.equals instanceof Function) && x.equals(y))\n return true;\n\n // Works in case when functions are created in constructor.\n // Comparing dates is a common scenario. Another built-ins?\n // We can even handle functions passed across iframes\n if ((typeof x === \"function\" && typeof y === \"function\") ||\n (x instanceof Date && y instanceof Date) ||\n (x instanceof RegExp && y instanceof RegExp) ||\n (x instanceof String && y instanceof String) ||\n (x instanceof Number && y instanceof Number))\n return x.toString() === y.toString();\n\n // At last checking prototypes as good as we can\n if (!(x instanceof Object && y instanceof Object))\n return false;\n\n if (x.isPrototypeOf(y) || y.isPrototypeOf(x))\n return false;\n\n if (x.constructor !== y.constructor)\n return false;\n\n if (x.prototype !== y.prototype)\n return false;\n\n // Check for infinitive linking loops\n if (leftChain.indexOf(x) > -1 || rightChain.indexOf(y) > -1)\n return false;\n\n // Quick checking of one object being a subset of another.\n // todo: cache the structure of arguments[0] for performance\n for (p in y) {\n if (y.hasOwnProperty(p) !== x.hasOwnProperty(p)) {\n return false;\n }\n else if (typeof y[p] !== typeof x[p]) {\n return false;\n }\n }\n\n for (p in x) {\n if (y.hasOwnProperty(p) !== x.hasOwnProperty(p)) {\n return false;\n }\n else if (typeof y[p] !== typeof x[p]) {\n return false;\n }\n\n switch (typeof (x[p])) {\n case \"object\":\n case \"function\":\n\n leftChain.push(x);\n rightChain.push(y);\n\n if (!this.compare2Objects(leftChain, rightChain, x[p], y[p])) {\n return false;\n }\n\n leftChain.pop();\n rightChain.pop();\n break;\n\n default:\n if (x[p] !== y[p]) {\n return false;\n }\n break;\n }\n }\n\n return true;\n }\n\n}\n"],"sourceRoot":".."}
|
|
@@ -20,3 +20,4 @@ export declare function PrimaryGeneratedColumn(strategy: "uuid", options?: Prima
|
|
|
20
20
|
* Column decorator is used to mark a specific class property as a table column.
|
|
21
21
|
*/
|
|
22
22
|
export declare function PrimaryGeneratedColumn(strategy: "rowid", options?: PrimaryGeneratedColumnUUIDOptions): PropertyDecorator;
|
|
23
|
+
export declare function PrimaryGeneratedColumn(strategy: "identity", options?: PrimaryGeneratedColumnUUIDOptions): PropertyDecorator;
|
|
@@ -27,7 +27,7 @@ function PrimaryGeneratedColumn(strategyOrOptions, maybeOptions) {
|
|
|
27
27
|
return function (object, propertyName) {
|
|
28
28
|
// if column type is not explicitly set then determine it based on generation strategy
|
|
29
29
|
if (!options.type) {
|
|
30
|
-
if (strategy === "increment") {
|
|
30
|
+
if (strategy === "increment" || strategy === "identity") {
|
|
31
31
|
options.type = Number;
|
|
32
32
|
}
|
|
33
33
|
else if (strategy === "uuid") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/decorator/columns/PrimaryGeneratedColumn.ts"],"names":[],"mappings":";;;AAAA,yCAAqD;
|
|
1
|
+
{"version":3,"sources":["../../src/decorator/columns/PrimaryGeneratedColumn.ts"],"names":[],"mappings":";;;AAAA,yCAAqD;AAiCrD;;;;GAIG;AACH,SAAgB,sBAAsB,CAAC,iBAAgI,EAChI,YAAqF;IAExH,uBAAuB;IACvB,IAAM,OAAO,GAAkB,EAAE,CAAC;IAClC,IAAI,QAA+C,CAAC;IACpD,IAAI,iBAAiB,EAAE;QACnB,IAAI,OAAO,iBAAiB,KAAK,QAAQ;YACrC,QAAQ,GAAG,iBAA0D,CAAC;QAE1E,IAAI,iBAAiB,YAAY,MAAM,EAAE;YACrC,QAAQ,GAAG,WAAW,CAAC;YACvB,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;SAC7C;KACJ;SAAM;QACH,QAAQ,GAAG,WAAW,CAAC;KAC1B;IACD,IAAI,YAAY,YAAY,MAAM;QAC9B,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAEzC,OAAO,UAAU,MAAc,EAAE,YAAoB;QAEjD,sFAAsF;QACtF,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;YACf,IAAI,QAAQ,KAAK,WAAW,IAAI,QAAQ,KAAK,UAAU,EAAE;gBACrD,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC;aACzB;iBAAM,IAAI,QAAQ,KAAK,MAAM,EAAE;gBAC5B,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC;aACzB;iBAAM,IAAI,QAAQ,KAAK,OAAO,EAAE;gBAC7B,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC;aACxB;SACJ;QAED,2DAA2D;QAC3D,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;QAEvB,gCAAgC;QAChC,IAAA,gCAAsB,GAAE,CAAC,OAAO,CAAC,IAAI,CAAC;YAClC,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,OAAO;SACnB,CAAC,CAAC;QAEH,mCAAmC;QACnC,IAAA,gCAAsB,GAAE,CAAC,WAAW,CAAC,IAAI,CAAC;YACtC,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,QAAQ,EAAE,QAAQ;SACI,CAAC,CAAC;IAChC,CAAC,CAAC;AACN,CAAC;AAnDD,wDAmDC","file":"PrimaryGeneratedColumn.js","sourcesContent":["import {getMetadataArgsStorage} from \"../../globals\";\nimport {PrimaryGeneratedColumnNumericOptions} from \"../options/PrimaryGeneratedColumnNumericOptions\";\nimport {PrimaryGeneratedColumnUUIDOptions} from \"../options/PrimaryGeneratedColumnUUIDOptions\";\nimport {GeneratedMetadataArgs} from \"../../metadata-args/GeneratedMetadataArgs\";\nimport { ColumnOptions } from \"../options/ColumnOptions\";\n\n/**\n * Column decorator is used to mark a specific class property as a table column.\n */\nexport function PrimaryGeneratedColumn(): PropertyDecorator;\n\n/**\n * Column decorator is used to mark a specific class property as a table column.\n */\nexport function PrimaryGeneratedColumn(options: PrimaryGeneratedColumnNumericOptions): PropertyDecorator;\n\n/**\n * Column decorator is used to mark a specific class property as a table column.\n */\nexport function PrimaryGeneratedColumn(strategy: \"increment\", options?: PrimaryGeneratedColumnNumericOptions): PropertyDecorator;\n\n/**\n * Column decorator is used to mark a specific class property as a table column.\n */\nexport function PrimaryGeneratedColumn(strategy: \"uuid\", options?: PrimaryGeneratedColumnUUIDOptions): PropertyDecorator;\n\n/**\n * Column decorator is used to mark a specific class property as a table column.\n */\nexport function PrimaryGeneratedColumn(strategy: \"rowid\", options?: PrimaryGeneratedColumnUUIDOptions): PropertyDecorator;\n\nexport function PrimaryGeneratedColumn(strategy: \"identity\", options?: PrimaryGeneratedColumnUUIDOptions): PropertyDecorator;\n\n/**\n * Column decorator is used to mark a specific class property as a table column.\n * Only properties decorated with this decorator will be persisted to the database when entity be saved.\n * This column creates an integer PRIMARY COLUMN with generated set to true.\n */\nexport function PrimaryGeneratedColumn(strategyOrOptions?: \"increment\"|\"uuid\"|\"rowid\"|\"identity\"|PrimaryGeneratedColumnNumericOptions|PrimaryGeneratedColumnUUIDOptions,\n maybeOptions?: PrimaryGeneratedColumnNumericOptions|PrimaryGeneratedColumnUUIDOptions): PropertyDecorator {\n\n // normalize parameters\n const options: ColumnOptions = {};\n let strategy: \"increment\"|\"uuid\"|\"rowid\"|\"identity\";\n if (strategyOrOptions) {\n if (typeof strategyOrOptions === \"string\")\n strategy = strategyOrOptions as \"increment\"|\"uuid\"|\"rowid\"|\"identity\";\n\n if (strategyOrOptions instanceof Object) {\n strategy = \"increment\";\n Object.assign(options, strategyOrOptions);\n }\n } else {\n strategy = \"increment\";\n }\n if (maybeOptions instanceof Object)\n Object.assign(options, maybeOptions);\n\n return function (object: Object, propertyName: string) {\n\n // if column type is not explicitly set then determine it based on generation strategy\n if (!options.type) {\n if (strategy === \"increment\" || strategy === \"identity\") {\n options.type = Number;\n } else if (strategy === \"uuid\") {\n options.type = \"uuid\";\n } else if (strategy === \"rowid\") {\n options.type = \"int\";\n }\n }\n\n // explicitly set a primary and generated to column options\n options.primary = true;\n\n // register column metadata args\n getMetadataArgsStorage().columns.push({\n target: object.constructor,\n propertyName: propertyName,\n mode: \"regular\",\n options: options\n });\n\n // register generated metadata args\n getMetadataArgsStorage().generations.push({\n target: object.constructor,\n propertyName: propertyName,\n strategy: strategy\n } as GeneratedMetadataArgs);\n };\n}\n"],"sourceRoot":"../.."}
|
|
@@ -21,7 +21,7 @@ export interface ColumnCommonOptions {
|
|
|
21
21
|
* Specifies if this column will use auto increment (sequence, generated identity, rowid).
|
|
22
22
|
* Note that in some databases only one column in entity can be marked as generated, and it must be a primary column.
|
|
23
23
|
*/
|
|
24
|
-
generated?: boolean | "increment" | "uuid" | "rowid";
|
|
24
|
+
generated?: boolean | "increment" | "uuid" | "rowid" | "identity";
|
|
25
25
|
/**
|
|
26
26
|
* Specifies if column's value must be unique or not.
|
|
27
27
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/decorator/options/ColumnCommonOptions.ts"],"names":[],"mappings":"","file":"ColumnCommonOptions.js","sourcesContent":["import {ValueTransformer} from \"./ValueTransformer\";\n\n/**\n * Column options specific to all column types.\n */\nexport interface ColumnCommonOptions {\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 * Column name in the database.\n */\n name?: string;\n\n /**\n * Indicates if this column is a primary key.\n * Same can be achieved when @PrimaryColumn decorator is used.\n */\n primary?: boolean;\n\n /**\n * Specifies if this column will use auto increment (sequence, generated identity, rowid).\n * Note that in some databases only one column in entity can be marked as generated, and it must be a primary column.\n */\n generated?: boolean|\"increment\"|\"uuid\"|\"rowid\";\n\n /**\n * Specifies if column's value must be unique or not.\n */\n unique?: boolean;\n\n /**\n * Indicates if column's value can be set to NULL.\n */\n nullable?: boolean;\n\n /**\n * Default database value.\n * Note that default value is not supported when column type is 'json' of mysql.\n */\n default?: any;\n\n /**\n * ON UPDATE trigger. Works only for MySQL.\n */\n onUpdate?: string;\n\n /**\n * Column comment. Not supported by all database types.\n */\n comment?: 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}\n"],"sourceRoot":"../.."}
|
|
1
|
+
{"version":3,"sources":["../../src/decorator/options/ColumnCommonOptions.ts"],"names":[],"mappings":"","file":"ColumnCommonOptions.js","sourcesContent":["import {ValueTransformer} from \"./ValueTransformer\";\n\n/**\n * Column options specific to all column types.\n */\nexport interface ColumnCommonOptions {\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 * Column name in the database.\n */\n name?: string;\n\n /**\n * Indicates if this column is a primary key.\n * Same can be achieved when @PrimaryColumn decorator is used.\n */\n primary?: boolean;\n\n /**\n * Specifies if this column will use auto increment (sequence, generated identity, rowid).\n * Note that in some databases only one column in entity can be marked as generated, and it must be a primary column.\n */\n generated?: boolean|\"increment\"|\"uuid\"|\"rowid\"|\"identity\";\n\n /**\n * Specifies if column's value must be unique or not.\n */\n unique?: boolean;\n\n /**\n * Indicates if column's value can be set to NULL.\n */\n nullable?: boolean;\n\n /**\n * Default database value.\n * Note that default value is not supported when column type is 'json' of mysql.\n */\n default?: any;\n\n /**\n * ON UPDATE trigger. Works only for MySQL.\n */\n onUpdate?: string;\n\n /**\n * Column comment. Not supported by all database types.\n */\n comment?: 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}\n"],"sourceRoot":"../.."}
|
package/driver/Driver.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { ReplicationMode } from "./types/ReplicationMode";
|
|
|
12
12
|
import { Table } from "../schema-builder/table/Table";
|
|
13
13
|
import { View } from "../schema-builder/view/View";
|
|
14
14
|
import { TableForeignKey } from "../schema-builder/table/TableForeignKey";
|
|
15
|
+
import { UpsertType } from "./types/UpsertType";
|
|
15
16
|
/**
|
|
16
17
|
* Driver organizes TypeORM communication with specific database management system.
|
|
17
18
|
*/
|
|
@@ -42,6 +43,10 @@ export interface Driver {
|
|
|
42
43
|
* Gets list of supported column data types by a driver.
|
|
43
44
|
*/
|
|
44
45
|
supportedDataTypes: ColumnType[];
|
|
46
|
+
/**
|
|
47
|
+
* Returns type of upsert supported by driver if any
|
|
48
|
+
*/
|
|
49
|
+
supportedUpsertType?: UpsertType;
|
|
45
50
|
/**
|
|
46
51
|
* Default values of length, precision and scale depends on column data type.
|
|
47
52
|
* Used in the cases when length/precision/scale is not specified by user.
|
package/driver/Driver.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/driver/Driver.ts"],"names":[],"mappings":"","file":"Driver.js","sourcesContent":["import {QueryRunner} from \"../query-runner/QueryRunner\";\nimport {ColumnMetadata} from \"../metadata/ColumnMetadata\";\nimport {ObjectLiteral} from \"../common/ObjectLiteral\";\nimport {ColumnType} from \"./types/ColumnTypes\";\nimport {MappedColumnTypes} from \"./types/MappedColumnTypes\";\nimport {SchemaBuilder} from \"../schema-builder/SchemaBuilder\";\nimport {DataTypeDefaults} from \"./types/DataTypeDefaults\";\nimport {BaseConnectionOptions} from \"../connection/BaseConnectionOptions\";\nimport {TableColumn} from \"../schema-builder/table/TableColumn\";\nimport {EntityMetadata} from \"../metadata/EntityMetadata\";\nimport {ReplicationMode} from \"./types/ReplicationMode\";\nimport { Table } from \"../schema-builder/table/Table\";\nimport { View } from \"../schema-builder/view/View\";\nimport { TableForeignKey } from \"../schema-builder/table/TableForeignKey\";\n\n/**\n * Driver organizes TypeORM communication with specific database management system.\n */\nexport interface Driver {\n\n /**\n * Connection options.\n */\n options: BaseConnectionOptions;\n\n /**\n * Database name used to perform all write queries.\n *\n * todo: probably move into query runner.\n */\n database?: string;\n\n /**\n * Schema name used to perform all write queries.\n */\n schema?: string;\n\n /**\n * Indicates if replication is enabled.\n */\n isReplicated: boolean;\n\n /**\n * Indicates if tree tables are supported by this driver.\n */\n treeSupport: boolean;\n\n /**\n * Gets list of supported column data types by a driver.\n */\n supportedDataTypes: ColumnType[];\n\n /**\n * Default values of length, precision and scale depends on column data type.\n * Used in the cases when length/precision/scale is not specified by user.\n */\n dataTypeDefaults: DataTypeDefaults;\n\n /**\n * Gets list of spatial column data types.\n */\n spatialTypes: ColumnType[];\n\n /**\n * Gets list of column data types that support length by a driver.\n */\n withLengthColumnTypes: ColumnType[];\n\n /**\n * Gets list of column data types that support precision by a driver.\n */\n withPrecisionColumnTypes: ColumnType[];\n\n /**\n * Gets list of column data types that support scale by a driver.\n */\n withScaleColumnTypes: ColumnType[];\n\n /**\n * Orm has special columns and we need to know what database column types should be for those types.\n * Column types are driver dependant.\n */\n mappedDataTypes: MappedColumnTypes;\n\n /**\n * Max length allowed by the DBMS for aliases (execution of queries).\n */\n maxAliasLength?: number;\n\n /**\n * Performs connection to the database.\n * Depend on driver type it may create a connection pool.\n */\n connect(): Promise<void>;\n\n /**\n * Makes any action after connection (e.g. create extensions in Postgres driver).\n */\n afterConnect(): Promise<void>;\n\n /**\n * Closes connection with database and releases all resources.\n */\n disconnect(): Promise<void>;\n\n /**\n * Synchronizes database schema (creates tables, indices, etc).\n */\n createSchemaBuilder(): SchemaBuilder;\n\n /**\n * Creates a query runner used for common queries.\n */\n createQueryRunner(mode: ReplicationMode): QueryRunner;\n\n /**\n * Replaces parameters in the given sql with special escaping character\n * and an array of parameter names to be passed to a query.\n */\n escapeQueryWithParameters(sql: string, parameters: ObjectLiteral, nativeParameters: ObjectLiteral): [string, any[]];\n\n /**\n * Escapes a table name, column name or an alias.\n *\n * todo: probably escape should be able to handle dots in the names and automatically escape them\n */\n escape(name: string): string;\n\n /**\n * Build full table name with database name, schema name and table name.\n * E.g. myDB.mySchema.myTable\n */\n buildTableName(tableName: string, schema?: string, database?: string): string;\n\n /**\n * Parse a target table name or other types and return a normalized table definition.\n */\n parseTableName(target: EntityMetadata | Table | View | TableForeignKey | string): { tableName: string, schema?: string, database?: string };\n\n /**\n * Prepares given value to a value to be persisted, based on its column type and metadata.\n */\n preparePersistentValue(value: any, column: ColumnMetadata): any;\n\n /**\n * Prepares given value to a value to be persisted, based on its column type.\n */\n prepareHydratedValue(value: any, column: ColumnMetadata): any;\n\n /**\n * Transforms type of the given column to a database column type.\n */\n normalizeType(column: { type?: ColumnType|string, length?: number|string, precision?: number|null, scale?: number, isArray?: boolean }): string;\n\n /**\n * Normalizes \"default\" value of the column.\n */\n normalizeDefault(columnMetadata: ColumnMetadata): string | undefined;\n\n /**\n * Normalizes \"isUnique\" value of the column.\n */\n normalizeIsUnique(column: ColumnMetadata): boolean;\n\n /**\n * Calculates column length taking into account the default length values.\n */\n getColumnLength(column: ColumnMetadata): string;\n\n /**\n * Normalizes \"default\" value of the column.\n */\n createFullType(column: TableColumn): string;\n\n /**\n * Obtains a new database connection to a master server.\n * Used for replication.\n * If replication is not setup then returns default connection's database connection.\n */\n obtainMasterConnection(): Promise<any>;\n\n /**\n * Obtains a new database connection to a slave server.\n * Used for replication.\n * If replication is not setup then returns master (default) connection's database connection.\n */\n obtainSlaveConnection(): Promise<any>;\n\n /**\n * Creates generated map of values generated or returned by database after INSERT query.\n */\n createGeneratedMap(metadata: EntityMetadata, insertResult: any, entityIndex?: number, entityNum?: number): ObjectLiteral|undefined;\n\n /**\n * Differentiate columns of this table and columns from the given column metadatas columns\n * and returns only changed.\n */\n findChangedColumns(tableColumns: TableColumn[], columnMetadatas: ColumnMetadata[]): ColumnMetadata[];\n\n /**\n * Returns true if driver supports RETURNING / OUTPUT statement.\n */\n isReturningSqlSupported(): boolean;\n\n /**\n * Returns true if driver supports uuid values generation on its own.\n */\n isUUIDGenerationSupported(): boolean;\n\n /**\n * Returns true if driver supports fulltext indices.\n */\n isFullTextColumnTypeSupported(): boolean;\n\n /**\n * Creates an escaped parameter.\n */\n createParameter(parameterName: string, index: number): string;\n\n}\n"],"sourceRoot":".."}
|
|
1
|
+
{"version":3,"sources":["../../src/driver/Driver.ts"],"names":[],"mappings":"","file":"Driver.js","sourcesContent":["import {QueryRunner} from \"../query-runner/QueryRunner\";\nimport {ColumnMetadata} from \"../metadata/ColumnMetadata\";\nimport {ObjectLiteral} from \"../common/ObjectLiteral\";\nimport {ColumnType} from \"./types/ColumnTypes\";\nimport {MappedColumnTypes} from \"./types/MappedColumnTypes\";\nimport {SchemaBuilder} from \"../schema-builder/SchemaBuilder\";\nimport {DataTypeDefaults} from \"./types/DataTypeDefaults\";\nimport {BaseConnectionOptions} from \"../connection/BaseConnectionOptions\";\nimport {TableColumn} from \"../schema-builder/table/TableColumn\";\nimport {EntityMetadata} from \"../metadata/EntityMetadata\";\nimport {ReplicationMode} from \"./types/ReplicationMode\";\nimport { Table } from \"../schema-builder/table/Table\";\nimport { View } from \"../schema-builder/view/View\";\nimport { TableForeignKey } from \"../schema-builder/table/TableForeignKey\";\nimport { UpsertType } from \"./types/UpsertType\";\n\n/**\n * Driver organizes TypeORM communication with specific database management system.\n */\nexport interface Driver {\n\n /**\n * Connection options.\n */\n options: BaseConnectionOptions;\n\n /**\n * Database name used to perform all write queries.\n *\n * todo: probably move into query runner.\n */\n database?: string;\n\n /**\n * Schema name used to perform all write queries.\n */\n schema?: string;\n\n /**\n * Indicates if replication is enabled.\n */\n isReplicated: boolean;\n\n /**\n * Indicates if tree tables are supported by this driver.\n */\n treeSupport: boolean;\n\n /**\n * Gets list of supported column data types by a driver.\n */\n supportedDataTypes: ColumnType[];\n\n /**\n * Returns type of upsert supported by driver if any\n */\n supportedUpsertType?: UpsertType;\n\n /**\n * Default values of length, precision and scale depends on column data type.\n * Used in the cases when length/precision/scale is not specified by user.\n */\n dataTypeDefaults: DataTypeDefaults;\n\n /**\n * Gets list of spatial column data types.\n */\n spatialTypes: ColumnType[];\n\n /**\n * Gets list of column data types that support length by a driver.\n */\n withLengthColumnTypes: ColumnType[];\n\n /**\n * Gets list of column data types that support precision by a driver.\n */\n withPrecisionColumnTypes: ColumnType[];\n\n /**\n * Gets list of column data types that support scale by a driver.\n */\n withScaleColumnTypes: ColumnType[];\n\n /**\n * Orm has special columns and we need to know what database column types should be for those types.\n * Column types are driver dependant.\n */\n mappedDataTypes: MappedColumnTypes;\n\n /**\n * Max length allowed by the DBMS for aliases (execution of queries).\n */\n maxAliasLength?: number;\n\n /**\n * Performs connection to the database.\n * Depend on driver type it may create a connection pool.\n */\n connect(): Promise<void>;\n\n /**\n * Makes any action after connection (e.g. create extensions in Postgres driver).\n */\n afterConnect(): Promise<void>;\n\n /**\n * Closes connection with database and releases all resources.\n */\n disconnect(): Promise<void>;\n\n /**\n * Synchronizes database schema (creates tables, indices, etc).\n */\n createSchemaBuilder(): SchemaBuilder;\n\n /**\n * Creates a query runner used for common queries.\n */\n createQueryRunner(mode: ReplicationMode): QueryRunner;\n\n /**\n * Replaces parameters in the given sql with special escaping character\n * and an array of parameter names to be passed to a query.\n */\n escapeQueryWithParameters(sql: string, parameters: ObjectLiteral, nativeParameters: ObjectLiteral): [string, any[]];\n\n /**\n * Escapes a table name, column name or an alias.\n *\n * todo: probably escape should be able to handle dots in the names and automatically escape them\n */\n escape(name: string): string;\n\n /**\n * Build full table name with database name, schema name and table name.\n * E.g. myDB.mySchema.myTable\n */\n buildTableName(tableName: string, schema?: string, database?: string): string;\n\n /**\n * Parse a target table name or other types and return a normalized table definition.\n */\n parseTableName(target: EntityMetadata | Table | View | TableForeignKey | string): { tableName: string, schema?: string, database?: string };\n\n /**\n * Prepares given value to a value to be persisted, based on its column type and metadata.\n */\n preparePersistentValue(value: any, column: ColumnMetadata): any;\n\n /**\n * Prepares given value to a value to be persisted, based on its column type.\n */\n prepareHydratedValue(value: any, column: ColumnMetadata): any;\n\n /**\n * Transforms type of the given column to a database column type.\n */\n normalizeType(column: { type?: ColumnType|string, length?: number|string, precision?: number|null, scale?: number, isArray?: boolean }): string;\n\n /**\n * Normalizes \"default\" value of the column.\n */\n normalizeDefault(columnMetadata: ColumnMetadata): string | undefined;\n\n /**\n * Normalizes \"isUnique\" value of the column.\n */\n normalizeIsUnique(column: ColumnMetadata): boolean;\n\n /**\n * Calculates column length taking into account the default length values.\n */\n getColumnLength(column: ColumnMetadata): string;\n\n /**\n * Normalizes \"default\" value of the column.\n */\n createFullType(column: TableColumn): string;\n\n /**\n * Obtains a new database connection to a master server.\n * Used for replication.\n * If replication is not setup then returns default connection's database connection.\n */\n obtainMasterConnection(): Promise<any>;\n\n /**\n * Obtains a new database connection to a slave server.\n * Used for replication.\n * If replication is not setup then returns master (default) connection's database connection.\n */\n obtainSlaveConnection(): Promise<any>;\n\n /**\n * Creates generated map of values generated or returned by database after INSERT query.\n */\n createGeneratedMap(metadata: EntityMetadata, insertResult: any, entityIndex?: number, entityNum?: number): ObjectLiteral|undefined;\n\n /**\n * Differentiate columns of this table and columns from the given column metadatas columns\n * and returns only changed.\n */\n findChangedColumns(tableColumns: TableColumn[], columnMetadatas: ColumnMetadata[]): ColumnMetadata[];\n\n /**\n * Returns true if driver supports RETURNING / OUTPUT statement.\n */\n isReturningSqlSupported(): boolean;\n\n /**\n * Returns true if driver supports uuid values generation on its own.\n */\n isUUIDGenerationSupported(): boolean;\n\n /**\n * Returns true if driver supports fulltext indices.\n */\n isFullTextColumnTypeSupported(): boolean;\n\n /**\n * Creates an escaped parameter.\n */\n createParameter(parameterName: string, index: number): string;\n\n}\n"],"sourceRoot":".."}
|
|
@@ -61,6 +61,10 @@ export declare class AuroraDataApiDriver implements Driver {
|
|
|
61
61
|
* @see https://dev.mysql.com/doc/refman/8.0/en/data-types.html
|
|
62
62
|
*/
|
|
63
63
|
supportedDataTypes: ColumnType[];
|
|
64
|
+
/**
|
|
65
|
+
* Returns type of upsert supported by driver if any
|
|
66
|
+
*/
|
|
67
|
+
readonly supportedUpsertType = "on-duplicate-key-update";
|
|
64
68
|
/**
|
|
65
69
|
* Gets list of spatial column data types.
|
|
66
70
|
*/
|
|
@@ -93,6 +93,10 @@ var AuroraDataApiDriver = /** @class */ (function () {
|
|
|
93
93
|
"multipolygon",
|
|
94
94
|
"geometrycollection"
|
|
95
95
|
];
|
|
96
|
+
/**
|
|
97
|
+
* Returns type of upsert supported by driver if any
|
|
98
|
+
*/
|
|
99
|
+
this.supportedUpsertType = "on-duplicate-key-update";
|
|
96
100
|
/**
|
|
97
101
|
* Gets list of spatial column data types.
|
|
98
102
|
*/
|