typeorm 0.3.25-dev.a9c16ee → 0.3.25-dev.af9ecc0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +9 -9
  2. package/browser/driver/postgres/PostgresDriver.js +2 -1
  3. package/browser/driver/postgres/PostgresDriver.js.map +1 -1
  4. package/browser/driver/postgres/PostgresQueryRunner.js +8 -0
  5. package/browser/driver/postgres/PostgresQueryRunner.js.map +1 -1
  6. package/browser/entity-manager/EntityManager.d.ts +1 -1
  7. package/browser/entity-manager/EntityManager.js +1 -1
  8. package/browser/entity-manager/EntityManager.js.map +1 -1
  9. package/browser/error/InitializedRelationError.d.ts +1 -1
  10. package/browser/error/InitializedRelationError.js +1 -1
  11. package/browser/error/InitializedRelationError.js.map +1 -1
  12. package/browser/metadata/ColumnMetadata.d.ts +2 -2
  13. package/browser/metadata/ColumnMetadata.js +1 -1
  14. package/browser/metadata/ColumnMetadata.js.map +1 -1
  15. package/browser/metadata-builder/ClosureJunctionEntityMetadataBuilder.js +14 -0
  16. package/browser/metadata-builder/ClosureJunctionEntityMetadataBuilder.js.map +1 -1
  17. package/browser/query-builder/SelectQueryBuilder.js +21 -18
  18. package/browser/query-builder/SelectQueryBuilder.js.map +1 -1
  19. package/driver/postgres/PostgresDriver.js +2 -1
  20. package/driver/postgres/PostgresDriver.js.map +1 -1
  21. package/driver/postgres/PostgresQueryRunner.js +8 -0
  22. package/driver/postgres/PostgresQueryRunner.js.map +1 -1
  23. package/entity-manager/EntityManager.d.ts +1 -1
  24. package/entity-manager/EntityManager.js +1 -1
  25. package/entity-manager/EntityManager.js.map +1 -1
  26. package/error/InitializedRelationError.d.ts +1 -1
  27. package/error/InitializedRelationError.js +1 -1
  28. package/error/InitializedRelationError.js.map +1 -1
  29. package/metadata/ColumnMetadata.d.ts +2 -2
  30. package/metadata/ColumnMetadata.js +1 -1
  31. package/metadata/ColumnMetadata.js.map +1 -1
  32. package/metadata-builder/ClosureJunctionEntityMetadataBuilder.js +14 -0
  33. package/metadata-builder/ClosureJunctionEntityMetadataBuilder.js.map +1 -1
  34. package/package.json +1 -1
  35. package/query-builder/SelectQueryBuilder.js +21 -18
  36. package/query-builder/SelectQueryBuilder.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/metadata/ColumnMetadata.ts"],"names":[],"mappings":";;;AAOA,+CAA2C;AAE3C,2EAAuE;AACvE,qDAAiD;AACjD,6DAAyD;AAGzD;;GAEG;AACH,MAAa,cAAc;IAyUvB,wEAAwE;IACxE,cAAc;IACd,wEAAwE;IAExE,YAAY,OAUX;QAtVQ,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;;;;WAIG;QACH,sBAAiB,GAAY,KAAK,CAAA;QASlC;;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;QACH,iBAAY,GAAY,KAAK,CAAA;QAE7B;;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,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;AAz9BD,wCAy9BC","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\"\nimport { VirtualColumnOptions } from \"../decorator/options/VirtualColumnOptions\"\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 a virtual property. Virtual properties are not mapped to the entity.\n * This property is used in tandem the virtual column decorator.\n * @See https://typeorm.io/decorator-reference#virtualcolumn for more details.\n */\n isVirtualProperty: boolean = false\n\n /**\n * Query to be used to populate the column data. This query is used when generating the relational db script.\n * The query function is called with the current entities alias either defined by the Entity Decorator or automatically\n * @See https://typeorm.io/decorator-reference#virtualcolumn for more details.\n */\n query?: (alias: string) => string\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 * If this column is primary key then this specifies the name for it.\n */\n primaryKeyConstraintName?: string\n\n /**\n * If this column is foreign key then this specifies the name for it.\n */\n foreignKeyConstraintName?: string\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.primaryKeyConstraintName) {\n this.primaryKeyConstraintName =\n options.args.options.primaryKeyConstraintName\n }\n if (options.args.options.foreignKeyConstraintName) {\n this.foreignKeyConstraintName =\n options.args.options.foreignKeyConstraintName\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.isVirtualProperty = options.args.mode === \"virtual-property\"\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 (this.isVirtualProperty) {\n this.isInsert = false\n this.isUpdate = false\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 ((options.args.options as VirtualColumnOptions).query)\n this.query = (options.args.options as VirtualColumnOptions).query\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 if (this.relationMetadata.joinColumns.length > 1) {\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 } else {\n const value =\n this.relationMetadata.joinColumns[0].referencedColumn!.getEntityValue(\n entity[this.relationMetadata!.propertyName],\n )\n if (value) {\n return { [this.propertyName]: value }\n }\n }\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\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 (typeof columnValue?.equals === \"function\") {\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":["../../src/metadata/ColumnMetadata.ts"],"names":[],"mappings":";;;AAOA,+CAA2C;AAE3C,2EAAuE;AACvE,qDAAiD;AACjD,6DAAyD;AAGzD;;GAEG;AACH,MAAa,cAAc;IAyUvB,wEAAwE;IACxE,cAAc;IACd,wEAAwE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,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;AAz9BD,wCAy9BC","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\"\nimport { VirtualColumnOptions } from \"../decorator/options/VirtualColumnOptions\"\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 a virtual property. Virtual properties are not mapped to the entity.\n * This property is used in tandem the virtual column decorator.\n * @See https://typeorm.io/docs/Help/decorator-reference/#virtualcolumn for more details.\n */\n isVirtualProperty: boolean = false\n\n /**\n * Query to be used to populate the column data. This query is used when generating the relational db script.\n * The query function is called with the current entities alias either defined by the Entity Decorator or automatically\n * @See https://typeorm.io/docs/Help/decorator-reference/#virtualcolumn for more details.\n */\n query?: (alias: string) => string\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 * If this column is primary key then this specifies the name for it.\n */\n primaryKeyConstraintName?: string\n\n /**\n * If this column is foreign key then this specifies the name for it.\n */\n foreignKeyConstraintName?: string\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.primaryKeyConstraintName) {\n this.primaryKeyConstraintName =\n options.args.options.primaryKeyConstraintName\n }\n if (options.args.options.foreignKeyConstraintName) {\n this.foreignKeyConstraintName =\n options.args.options.foreignKeyConstraintName\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.isVirtualProperty = options.args.mode === \"virtual-property\"\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 (this.isVirtualProperty) {\n this.isInsert = false\n this.isUpdate = false\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 ((options.args.options as VirtualColumnOptions).query)\n this.query = (options.args.options as VirtualColumnOptions).query\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 if (this.relationMetadata.joinColumns.length > 1) {\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 } else {\n const value =\n this.relationMetadata.joinColumns[0].referencedColumn!.getEntityValue(\n entity[this.relationMetadata!.propertyName],\n )\n if (value) {\n return { [this.propertyName]: value }\n }\n }\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\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 (typeof columnValue?.equals === \"function\") {\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":".."}
@@ -57,6 +57,13 @@ class ClosureJunctionEntityMetadataBuilder {
57
57
  primary: true,
58
58
  length: primaryColumn.length,
59
59
  type: primaryColumn.type,
60
+ unsigned: primaryColumn.unsigned,
61
+ width: primaryColumn.width,
62
+ precision: primaryColumn.precision,
63
+ scale: primaryColumn.scale,
64
+ zerofill: primaryColumn.zerofill,
65
+ charset: primaryColumn.charset,
66
+ collation: primaryColumn.collation,
60
67
  },
61
68
  },
62
69
  }));
@@ -77,6 +84,13 @@ class ClosureJunctionEntityMetadataBuilder {
77
84
  primary: true,
78
85
  length: primaryColumn.length,
79
86
  type: primaryColumn.type,
87
+ unsigned: primaryColumn.unsigned,
88
+ width: primaryColumn.width,
89
+ precision: primaryColumn.precision,
90
+ scale: primaryColumn.scale,
91
+ zerofill: primaryColumn.zerofill,
92
+ charset: primaryColumn.charset,
93
+ collation: primaryColumn.collation,
80
94
  },
81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AAC,IAAI,KAAK,OAAO;oBAC3C,CAAC,CAAC,WAAW;oBACb,CAAC,CAAC,SAAS;aACtB,CAAC;SACL,CAAA;QAED,OAAO,cAAc,CAAA;IACzB,CAAC;CACJ;AAvJD,oFAuJC","file":"ClosureJunctionEntityMetadataBuilder.js","sourcesContent":["import { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { ColumnMetadata } from \"../metadata/ColumnMetadata\"\nimport { ForeignKeyMetadata } from \"../metadata/ForeignKeyMetadata\"\nimport { DataSource } from \"../data-source/DataSource\"\nimport { IndexMetadata } from \"../metadata/IndexMetadata\"\n\n/**\n * Creates EntityMetadata for junction tables of the closure entities.\n * Closure junction tables are tables generated by closure entities.\n */\nexport class ClosureJunctionEntityMetadataBuilder {\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(private connection: DataSource) {}\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Builds EntityMetadata for the closure junction of the given closure entity.\n */\n build(parentClosureEntityMetadata: EntityMetadata) {\n // create entity metadata itself\n const entityMetadata = new EntityMetadata({\n parentClosureEntityMetadata: parentClosureEntityMetadata,\n connection: this.connection,\n args: {\n target: \"\",\n name:\n parentClosureEntityMetadata.treeOptions &&\n parentClosureEntityMetadata.treeOptions.closureTableName\n ? parentClosureEntityMetadata.treeOptions\n .closureTableName\n : parentClosureEntityMetadata.tableNameWithoutPrefix,\n type: \"closure-junction\",\n },\n })\n entityMetadata.build()\n\n // create ancestor and descendant columns for new closure junction table\n parentClosureEntityMetadata.primaryColumns.forEach((primaryColumn) => {\n entityMetadata.ownColumns.push(\n new ColumnMetadata({\n connection: this.connection,\n entityMetadata: entityMetadata,\n closureType: \"ancestor\",\n referencedColumn: primaryColumn,\n args: {\n target: \"\",\n mode: \"virtual\",\n propertyName:\n parentClosureEntityMetadata.treeOptions &&\n parentClosureEntityMetadata.treeOptions\n .ancestorColumnName\n ? parentClosureEntityMetadata.treeOptions.ancestorColumnName(\n primaryColumn,\n )\n : primaryColumn.propertyName + \"_ancestor\",\n options: {\n primary: true,\n length: primaryColumn.length,\n type: primaryColumn.type,\n },\n },\n }),\n )\n entityMetadata.ownColumns.push(\n new ColumnMetadata({\n connection: this.connection,\n entityMetadata: entityMetadata,\n closureType: \"descendant\",\n referencedColumn: primaryColumn,\n args: {\n target: \"\",\n mode: \"virtual\",\n propertyName:\n parentClosureEntityMetadata.treeOptions &&\n parentClosureEntityMetadata.treeOptions\n .descendantColumnName\n ? parentClosureEntityMetadata.treeOptions.descendantColumnName(\n primaryColumn,\n )\n : primaryColumn.propertyName + \"_descendant\",\n options: {\n primary: true,\n length: primaryColumn.length,\n type: primaryColumn.type,\n },\n },\n }),\n )\n })\n\n entityMetadata.ownIndices = [\n new IndexMetadata({\n entityMetadata: entityMetadata,\n columns: [entityMetadata.ownColumns[0]],\n args: {\n target: entityMetadata.target,\n synchronize: true,\n },\n }),\n new IndexMetadata({\n entityMetadata: entityMetadata,\n columns: [entityMetadata.ownColumns[1]],\n args: {\n target: entityMetadata.target,\n synchronize: true,\n },\n }),\n ]\n\n // if tree level column was defined by a closure entity then add it to the junction columns as well\n if (parentClosureEntityMetadata.treeLevelColumn) {\n entityMetadata.ownColumns.push(\n new ColumnMetadata({\n connection: this.connection,\n entityMetadata: entityMetadata,\n args: {\n target: \"\",\n mode: \"virtual\",\n propertyName: \"level\",\n options: {\n type: this.connection.driver.mappedDataTypes\n .treeLevel,\n },\n },\n }),\n )\n }\n\n // create junction table foreign keys\n // Note: CASCADE is not applied to mssql because it does not support multi cascade paths\n entityMetadata.foreignKeys = [\n new ForeignKeyMetadata({\n entityMetadata: entityMetadata,\n referencedEntityMetadata: parentClosureEntityMetadata,\n columns: [entityMetadata.ownColumns[0]],\n referencedColumns: parentClosureEntityMetadata.primaryColumns,\n onDelete:\n this.connection.driver.options.type === \"mssql\"\n ? \"NO ACTION\"\n : \"CASCADE\",\n }),\n new ForeignKeyMetadata({\n entityMetadata: entityMetadata,\n referencedEntityMetadata: parentClosureEntityMetadata,\n columns: [entityMetadata.ownColumns[1]],\n referencedColumns: parentClosureEntityMetadata.primaryColumns,\n onDelete:\n this.connection.driver.options.type === \"mssql\"\n ? \"NO ACTION\"\n : \"CASCADE\",\n }),\n ]\n\n return entityMetadata\n }\n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../../src/metadata-builder/ClosureJunctionEntityMetadataBuilder.ts"],"names":[],"mappings":";;;AAAA,+DAA2D;AAC3D,+DAA2D;AAC3D,uEAAmE;AAEnE,6DAAyD;AAEzD;;;GAGG;AACH,MAAa,oCAAoC;IAC7C,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAoB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAE9C,4EAA4E;IAC5E,iBAAiB;IACjB,4EAA4E;IAE5E;;OAEG;IACH,KAAK,CAAC,2BAA2C;QAC7C,gCAAgC;QAChC,MAAM,cAAc,GAAG,IAAI,+BAAc,CAAC;YACtC,2BAA2B,EAAE,2BAA2B;YACxD,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,IAAI,EAAE;gBACF,MAAM,EAAE,EAAE;gBACV,IAAI,EACA,2BAA2B,CAAC,WAAW;oBACvC,2BAA2B,CAAC,WAAW,CAAC,gBAAgB;oBACpD,CAAC,CAAC,2BAA2B,CAAC,WAAW;yBAClC,gBAAgB;oBACvB,CAAC,CAAC,2BAA2B,CAAC,sBAAsB;gBAC5D,IAAI,EAAE,kBAAkB;aAC3B;SACJ,CAAC,CAAA;QACF,cAAc,CAAC,KAAK,EAAE,CAAA;QAEtB,wEAAwE;QACxE,2BAA2B,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;YACjE,cAAc,CAAC,UAAU,CAAC,IAAI,CAC1B,IAAI,+BAAc,CAAC;gBACf,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,cAAc,EAAE,cAAc;gBAC9B,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AAe;6BACvC,SAAS;qBACjB;iBACJ;aACJ,CAAC,CACL,CAAA;QACL,CAAC;QAED,qCAAqC;QACrC,wFAAwF;QACxF,cAAc,CAAC,WAAW,GAAG;YACzB,IAAI,uCAAkB,CAAC;gBACnB,cAAc,EAAE,cAAc;gBAC9B,wBAAwB,EAAE,2BAA2B;gBACrD,OAAO,EAAE,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;gBACvC,iBAAiB,EAAE,2BAA2B,CAAC,cAAc;gBAC7D,QAAQ,EACJ,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,KAAK,OAAO;oBAC3C,CAAC,CAAC,WAAW;oBACb,CAAC,CAAC,SAAS;aACtB,CAAC;YACF,IAAI,uCAAkB,CAAC;gBACnB,cAAc,EAAE,cAAc;gBAC9B,wBAAwB,EAAE,2BAA2B;gBACrD,OAAO,EAAE,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;gBACvC,iBAAiB,EAAE,2BAA2B,CAAC,cAAc;gBAC7D,QAAQ,EACJ,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,KAAK,OAAO;oBAC3C,CAAC,CAAC,WAAW;oBACb,CAAC,CAAC,SAAS;aACtB,CAAC;SACL,CAAA;QAED,OAAO,cAAc,CAAA;IACzB,CAAC;CACJ;AArKD,oFAqKC","file":"ClosureJunctionEntityMetadataBuilder.js","sourcesContent":["import { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { ColumnMetadata } from \"../metadata/ColumnMetadata\"\nimport { ForeignKeyMetadata } from \"../metadata/ForeignKeyMetadata\"\nimport { DataSource } from \"../data-source/DataSource\"\nimport { IndexMetadata } from \"../metadata/IndexMetadata\"\n\n/**\n * Creates EntityMetadata for junction tables of the closure entities.\n * Closure junction tables are tables generated by closure entities.\n */\nexport class ClosureJunctionEntityMetadataBuilder {\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(private connection: DataSource) {}\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Builds EntityMetadata for the closure junction of the given closure entity.\n */\n build(parentClosureEntityMetadata: EntityMetadata) {\n // create entity metadata itself\n const entityMetadata = new EntityMetadata({\n parentClosureEntityMetadata: parentClosureEntityMetadata,\n connection: this.connection,\n args: {\n target: \"\",\n name:\n parentClosureEntityMetadata.treeOptions &&\n parentClosureEntityMetadata.treeOptions.closureTableName\n ? parentClosureEntityMetadata.treeOptions\n .closureTableName\n : parentClosureEntityMetadata.tableNameWithoutPrefix,\n type: \"closure-junction\",\n },\n })\n entityMetadata.build()\n\n // create ancestor and descendant columns for new closure junction table\n parentClosureEntityMetadata.primaryColumns.forEach((primaryColumn) => {\n entityMetadata.ownColumns.push(\n new ColumnMetadata({\n connection: this.connection,\n entityMetadata: entityMetadata,\n closureType: \"ancestor\",\n referencedColumn: primaryColumn,\n args: {\n target: \"\",\n mode: \"virtual\",\n propertyName:\n parentClosureEntityMetadata.treeOptions &&\n parentClosureEntityMetadata.treeOptions\n .ancestorColumnName\n ? parentClosureEntityMetadata.treeOptions.ancestorColumnName(\n primaryColumn,\n )\n : primaryColumn.propertyName + \"_ancestor\",\n options: {\n primary: true,\n length: primaryColumn.length,\n type: primaryColumn.type,\n unsigned: primaryColumn.unsigned,\n width: primaryColumn.width,\n precision: primaryColumn.precision,\n scale: primaryColumn.scale,\n zerofill: primaryColumn.zerofill,\n charset: primaryColumn.charset,\n collation: primaryColumn.collation,\n },\n },\n }),\n )\n entityMetadata.ownColumns.push(\n new ColumnMetadata({\n connection: this.connection,\n entityMetadata: entityMetadata,\n closureType: \"descendant\",\n referencedColumn: primaryColumn,\n args: {\n target: \"\",\n mode: \"virtual\",\n propertyName:\n parentClosureEntityMetadata.treeOptions &&\n parentClosureEntityMetadata.treeOptions\n .descendantColumnName\n ? parentClosureEntityMetadata.treeOptions.descendantColumnName(\n primaryColumn,\n )\n : primaryColumn.propertyName + \"_descendant\",\n options: {\n primary: true,\n length: primaryColumn.length,\n type: primaryColumn.type,\n unsigned: primaryColumn.unsigned,\n width: primaryColumn.width,\n precision: primaryColumn.precision,\n scale: primaryColumn.scale,\n zerofill: primaryColumn.zerofill,\n charset: primaryColumn.charset,\n collation: primaryColumn.collation,\n },\n },\n }),\n )\n })\n\n entityMetadata.ownIndices = [\n new IndexMetadata({\n entityMetadata: entityMetadata,\n columns: [entityMetadata.ownColumns[0]],\n args: {\n target: entityMetadata.target,\n synchronize: true,\n },\n }),\n new IndexMetadata({\n entityMetadata: entityMetadata,\n columns: [entityMetadata.ownColumns[1]],\n args: {\n target: entityMetadata.target,\n synchronize: true,\n },\n }),\n ]\n\n // if tree level column was defined by a closure entity then add it to the junction columns as well\n if (parentClosureEntityMetadata.treeLevelColumn) {\n entityMetadata.ownColumns.push(\n new ColumnMetadata({\n connection: this.connection,\n entityMetadata: entityMetadata,\n args: {\n target: \"\",\n mode: \"virtual\",\n propertyName: \"level\",\n options: {\n type: this.connection.driver.mappedDataTypes\n .treeLevel,\n },\n },\n }),\n )\n }\n\n // create junction table foreign keys\n // Note: CASCADE is not applied to mssql because it does not support multi cascade paths\n entityMetadata.foreignKeys = [\n new ForeignKeyMetadata({\n entityMetadata: entityMetadata,\n referencedEntityMetadata: parentClosureEntityMetadata,\n columns: [entityMetadata.ownColumns[0]],\n referencedColumns: parentClosureEntityMetadata.primaryColumns,\n onDelete:\n this.connection.driver.options.type === \"mssql\"\n ? \"NO ACTION\"\n : \"CASCADE\",\n }),\n new ForeignKeyMetadata({\n entityMetadata: entityMetadata,\n referencedEntityMetadata: parentClosureEntityMetadata,\n columns: [entityMetadata.ownColumns[1]],\n referencedColumns: parentClosureEntityMetadata.primaryColumns,\n onDelete:\n this.connection.driver.options.type === \"mssql\"\n ? \"NO ACTION\"\n : \"CASCADE\",\n }),\n ]\n\n return entityMetadata\n }\n}\n"],"sourceRoot":".."}
package/package.json CHANGED
@@ -1 +1 @@
1
- { "name": "typeorm", "version": "0.3.25-dev.a9c16ee", "description": "Data-Mapper ORM for TypeScript and ES2021+. Supports MySQL/MariaDB, PostgreSQL, MS SQL Server, Oracle, SAP HANA, SQLite, MongoDB databases.", "homepage": "https://typeorm.io", "bugs": { "url": "https://github.com/typeorm/typeorm/issues" }, "repository": { "type": "git", "url": "https://github.com/typeorm/typeorm.git" }, "funding": "https://opencollective.com/typeorm", "license": "MIT", "author": { "name": "Umed Khudoiberdiev", "email": "pleerock.me@gmail.com" }, "exports": { ".": { "types": "./index.d.ts", "node": { "import": "./index.mjs", "require": "./index.js", "types": "./index.d.ts" }, "browser": { "require": "./index.js", "import": "./browser/index.js", "default": "./index.js" } }, "./browser": { "types": "./index.d.ts", "default": "./browser/index.js" }, "./*.js": "./*.js", "./*": { "require": "./*.js", "import": "./*" } }, "main": "./index.js", "module": "./index.mjs", "browser": { "./browser/connection/ConnectionOptionsReader.js": "./browser/platform/BrowserConnectionOptionsReaderDummy.js", "./browser/connection/options-reader/ConnectionOptionsXmlReader.js": "./browser/platform/BrowserConnectionOptionsReaderDummy.js", "./browser/connection/options-reader/ConnectionOptionsYmlReader.js": "./browser/platform/BrowserConnectionOptionsReaderDummy.js", "./browser/driver/aurora-data-api/AuroraDataApiDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/better-sqlite3/BetterSqlite3Driver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/cockroachdb/CockroachDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/mongodb/MongoDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/mongodb/MongoQueryRunner.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/mongodb/bson.typings.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/mongodb/typings.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/mysql/MysqlDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/oracle/OracleDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/postgres/PostgresDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/sap/SapDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/sqlite/SqliteDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/sqlserver/SqlServerDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/entity-manager/MongoEntityManager.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/logger/FileLogger.js": "./browser/platform/BrowserFileLoggerDummy.js", "./browser/platform/PlatformTools.js": "./browser/platform/BrowserPlatformTools.js", "./browser/repository/MongoRepository.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/util/DirectoryExportedClassesLoader.js": "./browser/platform/BrowserDirectoryExportedClassesLoader.js", "./index.js": "./browser/index.js", "./index.mjs": "./browser/index.js" }, "types": "./index.d.ts", "bin": { "typeorm": "./cli.js", "typeorm-ts-node-commonjs": "./cli-ts-node-commonjs.js", "typeorm-ts-node-esm": "./cli-ts-node-esm.js" }, "scripts": { "changelog": "standard-changelog", "compile": "rimraf ./build && tsc", "format": "prettier --cache --write \"./**/*.ts\"", "format:ci": "prettier --check \"./**/*.ts\"", "lint": "eslint .", "pack": "gulp pack", "package": "gulp package", "pre-commit": "lint-staged", "prepare": "husky", "test": "npm run compile && npm run test:fast --", "test:ci": "mocha --bail", "test:fast": "mocha", "watch": "tsc --watch", "publish:preview": "pkg-pr-new publish './build/package' --pnpm --template='./sample/playground'" }, "dependencies": { "@sqltools/formatter": "^1.2.5", "ansis": "^3.17.0", "app-root-path": "^3.1.0", "buffer": "^6.0.3", "dayjs": "^1.11.13", "debug": "^4.4.0", "dedent": "^1.6.0", "dotenv": "^16.4.7", "glob": "^10.4.5", "sha.js": "^2.4.11", "sql-highlight": "^6.0.0", "tslib": "^2.8.1", "uuid": "^11.1.0", "yargs": "^17.7.2" }, "devDependencies": { "@eslint/js": "^9.22.0", "@sap/hana-client": "^2.24.21", "@tsconfig/node16": "^16.1.3", "@types/chai": "^4.3.20", "@types/chai-as-promised": "^7.1.8", "@types/debug": "^4.1.12", "@types/gulp-rename": "^2.0.6", "@types/gulp-sourcemaps": "^0.0.38", "@types/mocha": "^10.0.10", "@types/node": "^16.18.126", "@types/sha.js": "^2.4.4", "@types/sinon": "^10.0.20", "@types/sinon-chai": "^4.0.0", "@types/source-map-support": "^0.5.10", "@types/yargs": "^17.0.33", "better-sqlite3": "^8.7.0", "chai": "^4.5.0", "chai-as-promised": "^7.1.2", "class-transformer": "^0.5.1", "eslint": "^9.22.0", "globals": "^16.0.0", "gulp": "^4.0.2", "gulp-rename": "^2.0.0", "gulp-replace": "^1.1.4", "gulp-shell": "^0.8.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", "gulpclass": "^0.2.0", "hdb-pool": "^0.1.6", "husky": "^9.1.7", "lint-staged": "^15.5.2", "mocha": "^10.8.2", "mongodb": "^6.15.0", "mssql": "^11.0.1", "mysql": "^2.18.1", "mysql2": "^3.14.0", "nyc": "^17.1.0", "oracledb": "^6.8.0", "pg": "^8.14.1", "pg-query-stream": "^4.8.1", "pkg-pr-new": "^0.0.43", "prettier": "^2.8.8", "redis": "^4.7.0", "remap-istanbul": "^0.13.0", "rimraf": "^5.0.10", "sinon": "^15.2.0", "sinon-chai": "^3.7.0", "source-map-support": "^0.5.21", "sql.js": "^1.13.0", "sqlite3": "^5.1.7", "standard-changelog": "^6.0.0", "ts-node": "^10.9.2", "typescript": "^5.8.2", "typescript-eslint": "^8.27.0" }, "peerDependencies": { "@google-cloud/spanner": "^5.18.0 || ^6.0.0 || ^7.0.0", "@sap/hana-client": "^2.12.25", "better-sqlite3": "^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0", "hdb-pool": "^0.1.6", "ioredis": "^5.0.4", "mongodb": "^5.8.0 || ^6.0.0", "mssql": "^9.1.1 || ^10.0.1 || ^11.0.1", "mysql2": "^2.2.5 || ^3.0.1", "oracledb": "^6.3.0", "pg": "^8.5.1", "pg-native": "^3.0.0", "pg-query-stream": "^4.0.0", "redis": "^3.1.1 || ^4.0.0", "reflect-metadata": "^0.1.14 || ^0.2.0", "sql.js": "^1.4.0", "sqlite3": "^5.0.3", "ts-node": "^10.7.0", "typeorm-aurora-data-api-driver": "^2.0.0 || ^3.0.0" }, "peerDependenciesMeta": { "@google-cloud/spanner": { "optional": true }, "@sap/hana-client": { "optional": true }, "better-sqlite3": { "optional": true }, "hdb-pool": { "optional": true }, "ioredis": { "optional": true }, "mongodb": { "optional": true }, "mssql": { "optional": true }, "mysql2": { "optional": true }, "oracledb": { "optional": true }, "pg": { "optional": true }, "pg-native": { "optional": true }, "pg-query-stream": { "optional": true }, "redis": { "optional": true }, "sql.js": { "optional": true }, "sqlite3": { "optional": true }, "ts-node": { "optional": true }, "typeorm-aurora-data-api-driver": { "optional": true } }, "engines": { "node": ">=16.13.0" }, "collective": { "type": "opencollective", "url": "https://opencollective.com/typeorm", "logo": "https://opencollective.com/opencollective/logo.txt" }, "readmeFilename": "README.md", "tags": [ "orm", "typescript", "typescript-orm", "mariadb", "mariadb-orm", "mysql", "mysql-orm", "oracle", "oracle-orm", "postgresql", "postgresql-orm", "sap-hana", "sap-hana-orm", "spanner", "cloud-spanner", "cloud-spanner-orm", "sqlite", "sqlite-orm", "sql-server", "sql-server-orm" ] }
1
+ { "name": "typeorm", "version": "0.3.25-dev.af9ecc0", "description": "Data-Mapper ORM for TypeScript and ES2021+. Supports MySQL/MariaDB, PostgreSQL, MS SQL Server, Oracle, SAP HANA, SQLite, MongoDB databases.", "homepage": "https://typeorm.io", "bugs": { "url": "https://github.com/typeorm/typeorm/issues" }, "repository": { "type": "git", "url": "https://github.com/typeorm/typeorm.git" }, "funding": "https://opencollective.com/typeorm", "license": "MIT", "author": { "name": "Umed Khudoiberdiev", "email": "pleerock.me@gmail.com" }, "exports": { ".": { "types": "./index.d.ts", "node": { "import": "./index.mjs", "require": "./index.js", "types": "./index.d.ts" }, "browser": { "require": "./index.js", "import": "./browser/index.js", "default": "./index.js" } }, "./browser": { "types": "./index.d.ts", "default": "./browser/index.js" }, "./*.js": "./*.js", "./*": { "require": "./*.js", "import": "./*" } }, "main": "./index.js", "module": "./index.mjs", "browser": { "./browser/connection/ConnectionOptionsReader.js": "./browser/platform/BrowserConnectionOptionsReaderDummy.js", "./browser/connection/options-reader/ConnectionOptionsXmlReader.js": "./browser/platform/BrowserConnectionOptionsReaderDummy.js", "./browser/connection/options-reader/ConnectionOptionsYmlReader.js": "./browser/platform/BrowserConnectionOptionsReaderDummy.js", "./browser/driver/aurora-data-api/AuroraDataApiDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/better-sqlite3/BetterSqlite3Driver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/cockroachdb/CockroachDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/mongodb/MongoDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/mongodb/MongoQueryRunner.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/mongodb/bson.typings.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/mongodb/typings.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/mysql/MysqlDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/oracle/OracleDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/postgres/PostgresDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/sap/SapDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/sqlite/SqliteDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/sqlserver/SqlServerDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/entity-manager/MongoEntityManager.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/logger/FileLogger.js": "./browser/platform/BrowserFileLoggerDummy.js", "./browser/platform/PlatformTools.js": "./browser/platform/BrowserPlatformTools.js", "./browser/repository/MongoRepository.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/util/DirectoryExportedClassesLoader.js": "./browser/platform/BrowserDirectoryExportedClassesLoader.js", "./index.js": "./browser/index.js", "./index.mjs": "./browser/index.js" }, "types": "./index.d.ts", "bin": { "typeorm": "./cli.js", "typeorm-ts-node-commonjs": "./cli-ts-node-commonjs.js", "typeorm-ts-node-esm": "./cli-ts-node-esm.js" }, "scripts": { "changelog": "standard-changelog", "compile": "rimraf ./build && tsc", "docs:dev": "cd docs && npm run start", "format": "prettier --cache --write \"./**/*.ts\"", "format:ci": "prettier --check \"./**/*.ts\"", "lint": "eslint .", "pack": "gulp pack", "package": "gulp package", "pre-commit": "lint-staged", "prepare": "husky", "publish:preview": "pkg-pr-new publish './build/package' --pnpm --template='./sample/playground'", "test": "npm run compile && npm run test:fast --", "test:ci": "mocha --bail", "test:fast": "mocha", "watch": "tsc --watch" }, "dependencies": { "@sqltools/formatter": "^1.2.5", "ansis": "^3.17.0", "app-root-path": "^3.1.0", "buffer": "^6.0.3", "dayjs": "^1.11.13", "debug": "^4.4.0", "dedent": "^1.6.0", "dotenv": "^16.4.7", "glob": "^10.4.5", "sha.js": "^2.4.11", "sql-highlight": "^6.0.0", "tslib": "^2.8.1", "uuid": "^11.1.0", "yargs": "^17.7.2" }, "devDependencies": { "@eslint/js": "^9.28.0", "@sap/hana-client": "^2.24.21", "@tsconfig/node16": "^16.1.4", "@types/chai": "^4.3.20", "@types/chai-as-promised": "^7.1.8", "@types/debug": "^4.1.12", "@types/gulp-rename": "^2.0.6", "@types/gulp-sourcemaps": "^0.0.38", "@types/mocha": "^10.0.10", "@types/node": "^16.18.126", "@types/sha.js": "^2.4.4", "@types/sinon": "^10.0.20", "@types/sinon-chai": "^4.0.0", "@types/source-map-support": "^0.5.10", "@types/yargs": "^17.0.33", "better-sqlite3": "^8.7.0", "chai": "^4.5.0", "chai-as-promised": "^7.1.2", "class-transformer": "^0.5.1", "eslint": "^9.28.0", "globals": "^16.2.0", "gulp": "^4.0.2", "gulp-rename": "^2.0.0", "gulp-replace": "^1.1.4", "gulp-shell": "^0.8.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", "gulpclass": "^0.2.0", "hdb-pool": "^0.1.6", "husky": "^9.1.7", "lint-staged": "^15.5.2", "mocha": "^10.8.2", "mongodb": "^6.15.0", "mssql": "^11.0.1", "mysql": "^2.18.1", "mysql2": "^3.14.0", "nyc": "^17.1.0", "oracledb": "^6.8.0", "pg": "^8.14.1", "pg-query-stream": "^4.8.1", "pkg-pr-new": "^0.0.43", "prettier": "^2.8.8", "redis": "^4.7.0", "remap-istanbul": "^0.13.0", "rimraf": "^5.0.10", "sinon": "^15.2.0", "sinon-chai": "^3.7.0", "sort-package-json": "^2.15.1", "source-map-support": "^0.5.21", "sql.js": "^1.13.0", "sqlite3": "^5.1.7", "standard-changelog": "^6.0.0", "ts-node": "^10.9.2", "typescript": "^5.8.3", "typescript-eslint": "^8.33.1" }, "peerDependencies": { "@google-cloud/spanner": "^5.18.0 || ^6.0.0 || ^7.0.0", "@sap/hana-client": "^2.12.25", "better-sqlite3": "^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0", "hdb-pool": "^0.1.6", "ioredis": "^5.0.4", "mongodb": "^5.8.0 || ^6.0.0", "mssql": "^9.1.1 || ^10.0.1 || ^11.0.1", "mysql2": "^2.2.5 || ^3.0.1", "oracledb": "^6.3.0", "pg": "^8.5.1", "pg-native": "^3.0.0", "pg-query-stream": "^4.0.0", "redis": "^3.1.1 || ^4.0.0", "reflect-metadata": "^0.1.14 || ^0.2.0", "sql.js": "^1.4.0", "sqlite3": "^5.0.3", "ts-node": "^10.7.0", "typeorm-aurora-data-api-driver": "^2.0.0 || ^3.0.0" }, "peerDependenciesMeta": { "@google-cloud/spanner": { "optional": true }, "@sap/hana-client": { "optional": true }, "better-sqlite3": { "optional": true }, "hdb-pool": { "optional": true }, "ioredis": { "optional": true }, "mongodb": { "optional": true }, "mssql": { "optional": true }, "mysql2": { "optional": true }, "oracledb": { "optional": true }, "pg": { "optional": true }, "pg-native": { "optional": true }, "pg-query-stream": { "optional": true }, "redis": { "optional": true }, "sql.js": { "optional": true }, "sqlite3": { "optional": true }, "ts-node": { "optional": true }, "typeorm-aurora-data-api-driver": { "optional": true } }, "engines": { "node": ">=16.13.0" }, "collective": { "type": "opencollective", "url": "https://opencollective.com/typeorm", "logo": "https://opencollective.com/opencollective/logo.txt" }, "readmeFilename": "README.md", "tags": [ "orm", "typescript", "typescript-orm", "mariadb", "mariadb-orm", "mysql", "mysql-orm", "oracle", "oracle-orm", "postgresql", "postgresql-orm", "sap-hana", "sap-hana-orm", "spanner", "cloud-spanner", "cloud-spanner-orm", "sqlite", "sqlite-orm", "sql-server", "sql-server-orm" ] }
@@ -1337,12 +1337,15 @@ class SelectQueryBuilder extends QueryBuilder_1.QueryBuilder {
1337
1337
  // in the case if nothing is joined in the query builder we don't need to make two requests to get paginated results
1338
1338
  // we can use regular limit / offset, that's why we add offset and limit construction here based on skip and take values
1339
1339
  let offset = this.expressionMap.offset, limit = this.expressionMap.limit;
1340
- if (!offset &&
1341
- !limit &&
1340
+ if (offset === undefined &&
1341
+ limit === undefined &&
1342
1342
  this.expressionMap.joinAttributes.length === 0) {
1343
1343
  offset = this.expressionMap.skip;
1344
1344
  limit = this.expressionMap.take;
1345
1345
  }
1346
+ // Helper functions to check if values are set (including 0)
1347
+ const hasLimit = limit !== undefined && limit !== null;
1348
+ const hasOffset = offset !== undefined && offset !== null;
1346
1349
  if (this.connection.driver.options.type === "mssql") {
1347
1350
  // Due to a limitation in SQL Server's parser implementation it does not support using
1348
1351
  // OFFSET or FETCH NEXT without an ORDER BY clause being provided. In cases where the
@@ -1350,59 +1353,59 @@ class SelectQueryBuilder extends QueryBuilder_1.QueryBuilder {
1350
1353
  // have no effect on the query planner or on the order of the results returned.
1351
1354
  // https://dba.stackexchange.com/a/193799
1352
1355
  let prefix = "";
1353
- if ((limit || offset) &&
1356
+ if ((hasLimit || hasOffset) &&
1354
1357
  Object.keys(this.expressionMap.allOrderBys).length <= 0) {
1355
1358
  prefix = " ORDER BY (SELECT NULL)";
1356
1359
  }
1357
- if (limit && offset)
1360
+ if (hasLimit && hasOffset)
1358
1361
  return (prefix +
1359
1362
  " OFFSET " +
1360
1363
  offset +
1361
1364
  " ROWS FETCH NEXT " +
1362
1365
  limit +
1363
1366
  " ROWS ONLY");
1364
- if (limit)
1367
+ if (hasLimit)
1365
1368
  return (prefix + " OFFSET 0 ROWS FETCH NEXT " + limit + " ROWS ONLY");
1366
- if (offset)
1369
+ if (hasOffset)
1367
1370
  return prefix + " OFFSET " + offset + " ROWS";
1368
1371
  }
1369
1372
  else if (DriverUtils_1.DriverUtils.isMySQLFamily(this.connection.driver) ||
1370
1373
  this.connection.driver.options.type === "aurora-mysql" ||
1371
1374
  this.connection.driver.options.type === "sap" ||
1372
1375
  this.connection.driver.options.type === "spanner") {
1373
- if (limit && offset)
1376
+ if (hasLimit && hasOffset)
1374
1377
  return " LIMIT " + limit + " OFFSET " + offset;
1375
- if (limit)
1378
+ if (hasLimit)
1376
1379
  return " LIMIT " + limit;
1377
- if (offset)
1380
+ if (hasOffset)
1378
1381
  throw new OffsetWithoutLimitNotSupportedError_1.OffsetWithoutLimitNotSupportedError();
1379
1382
  }
1380
1383
  else if (DriverUtils_1.DriverUtils.isSQLiteFamily(this.connection.driver)) {
1381
- if (limit && offset)
1384
+ if (hasLimit && hasOffset)
1382
1385
  return " LIMIT " + limit + " OFFSET " + offset;
1383
- if (limit)
1386
+ if (hasLimit)
1384
1387
  return " LIMIT " + limit;
1385
- if (offset)
1388
+ if (hasOffset)
1386
1389
  return " LIMIT -1 OFFSET " + offset;
1387
1390
  }
1388
1391
  else if (this.connection.driver.options.type === "oracle") {
1389
- if (limit && offset)
1392
+ if (hasLimit && hasOffset)
1390
1393
  return (" OFFSET " +
1391
1394
  offset +
1392
1395
  " ROWS FETCH NEXT " +
1393
1396
  limit +
1394
1397
  " ROWS ONLY");
1395
- if (limit)
1398
+ if (hasLimit)
1396
1399
  return " FETCH NEXT " + limit + " ROWS ONLY";
1397
- if (offset)
1400
+ if (hasOffset)
1398
1401
  return " OFFSET " + offset + " ROWS";
1399
1402
  }
1400
1403
  else {
1401
- if (limit && offset)
1404
+ if (hasLimit && hasOffset)
1402
1405
  return " LIMIT " + limit + " OFFSET " + offset;
1403
- if (limit)
1406
+ if (hasLimit)
1404
1407
  return " LIMIT " + limit;
1405
- if (offset)
1408
+ if (hasOffset)
1406
1409
  return " OFFSET " + offset;
1407
1410
  }
1408
1411
  return "";