typeorm 0.3.26-dev.1ea3a5e → 0.3.26-dev.66ee307

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.
@@ -286,6 +286,7 @@ export class QueryExpressionMap {
286
286
  map.offset = this.offset;
287
287
  map.skip = this.skip;
288
288
  map.take = this.take;
289
+ map.useIndex = this.useIndex;
289
290
  map.lockMode = this.lockMode;
290
291
  map.onLocked = this.onLocked;
291
292
  map.lockVersion = this.lockVersion;
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/query-builder/QueryExpressionMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAG/B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAG/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAA;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAA;AAOhF,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAKvC;;GAEG;AACH,MAAM,OAAO,kBAAkB;IA4U3B,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAsB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;QA/U5C,4EAA4E;QAC5E,oBAAoB;QACpB,4EAA4E;QAE5E;;WAEG;QACH,yBAAoB,GAAqB,MAAM,CAAA;QAE/C;;WAEG;QACH,gBAAW,GAAY,KAAK,CAAA;QAO5B;;WAEG;QACH,YAAO,GAAY,EAAE,CAAA;QAErB;;WAEG;QACH,cAAS,GAOS,QAAQ,CAAA;QAE1B;;WAEG;QACH,YAAO,GAAkB,EAAE,CAAA;QAE3B;;WAEG;QACH,qBAAgB,GAAW,CAAC,CAAA;QAE5B;;WAEG;QACH,mBAAc,GAAY,KAAK,CAAA;QAE/B;;WAEG;QACH,qBAAgB,GAAa,EAAE,CAAA;QAkB/B;;WAEG;QACH,0BAAqB,GAAqB,EAAE,CA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a,GAAG,IAAI,CAAC,aAAa,CAAA;QACtC,GAAG,CAAC,oBAAoB,GAAG,IAAI,CAAC,oBAAoB,CAAA;QACpD,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAA;QAChB,GAAG,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAA;QACtC,GAAG,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAA;QACtC,GAAG,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAA;QACpC,GAAG,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAA;QACtC,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAA;QACxC,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAA;QAChC,GAAG,CAAC,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAA;QAC/D,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAC1B,GAAG,CAAC,sBAAsB,GAAG,IAAI,CAAC,sBAAsB,CAAC,GAAG,CACxD,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YACb,KAAK,EAAE,UAAU,CAAC,KAAK;YACvB,YAAY,EACR,OAAO,UAAU,CAAC,YAAY,KAAK,QAAQ;gBACvC,CAAC,CAAC,UAAU,CAAC,YAAY;gBACzB,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,KAAK,EAAE;YACzC,OAAO,EAAE,UAAU,CAAC,OAAO;SAC9B,CAAC,CACL,CAAA;QACD,OAAO,GAAG,CAAA;IACd,CAAC;CACJ","file":"QueryExpressionMap.js","sourcesContent":["import { Alias } from \"./Alias\"\nimport { ObjectLiteral } from \"../common/ObjectLiteral\"\nimport { OrderByCondition } from \"../find-options/OrderByCondition\"\nimport { JoinAttribute } from \"./JoinAttribute\"\nimport { QueryBuilder } from \"./QueryBuilder\"\nimport { QueryBuilderCteOptions } from \"./QueryBuilderCte\"\nimport { RelationIdAttribute } from \"./relation-id/RelationIdAttribute\"\nimport { RelationCountAttribute } from \"./relation-count/RelationCountAttribute\"\nimport { DataSource } from \"../data-source/DataSource\"\nimport { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { SelectQuery } from \"./SelectQuery\"\nimport { ColumnMetadata } from \"../metadata/ColumnMetadata\"\nimport { RelationMetadata } from \"../metadata/RelationMetadata\"\nimport { SelectQueryBuilderOption } from \"./SelectQueryBuilderOption\"\nimport { TypeORMError } from \"../error\"\nimport { WhereClause } from \"./WhereClause\"\nimport { UpsertType } from \"../driver/types/UpsertType\"\nimport { CockroachConnectionOptions } from \"../driver/cockroachdb/CockroachConnectionOptions\"\n\n/**\n * Contains all properties of the QueryBuilder that needs to be build a final query.\n */\nexport class QueryExpressionMap {\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Strategy to load relations.\n */\n relationLoadStrategy: \"join\" | \"query\" = \"join\"\n\n /**\n * Indicates if QueryBuilder used to select entities and not a raw results.\n */\n queryEntity: boolean = false\n\n /**\n * Main alias is a main selection object selected by QueryBuilder.\n */\n mainAlias?: Alias\n\n /**\n * All aliases (including main alias) used in the query.\n */\n aliases: Alias[] = []\n\n /**\n * Represents query type. QueryBuilder is able to build SELECT, UPDATE and DELETE queries.\n */\n queryType:\n | \"select\"\n | \"update\"\n | \"delete\"\n | \"insert\"\n | \"relation\"\n | \"soft-delete\"\n | \"restore\" = \"select\"\n\n /**\n * Data needs to be SELECT-ed.\n */\n selects: SelectQuery[] = []\n\n /**\n * Max execution time in millisecond.\n */\n maxExecutionTime: number = 0\n\n /**\n * Whether SELECT is DISTINCT.\n */\n selectDistinct: boolean = false\n\n /**\n * SELECT DISTINCT ON query (postgres).\n */\n selectDistinctOn: string[] = []\n\n /**\n * FROM-s to be selected.\n */\n // froms: { target: string, alias: string }[] = [];\n\n /**\n * If update query was used, it needs \"update set\" - properties which will be updated by this query.\n * If insert query was used, it needs \"insert set\" - values that needs to be inserted.\n */\n valuesSet?: ObjectLiteral | ObjectLiteral[]\n\n /**\n * Optional returning (or output) clause for insert, update or delete queries.\n */\n returning: string | string[]\n\n /**\n * Extra returning columns to be added to the returning statement if driver supports it.\n */\n extraReturningColumns: ColumnMetadata[] = []\n\n /**\n * Optional on conflict statement used in insertion query in postgres.\n */\n onConflict: string = \"\"\n\n /**\n * Optional on ignore statement used in insertion query in databases.\n */\n onIgnore: boolean = false\n\n /**\n * Optional on update statement used in insertion query in databases.\n */\n onUpdate: {\n conflict?: string | string[]\n columns?: string[]\n overwrite?: string[]\n skipUpdateIfNoValuesChanged?: boolean\n indexPredicate?: string\n upsertType?: UpsertType\n overwriteCondition?: WhereClause[]\n }\n\n /**\n * JOIN queries.\n */\n joinAttributes: JoinAttribute[] = []\n\n /**\n * RelationId queries.\n */\n relationIdAttributes: RelationIdAttribute[] = []\n\n /**\n * Relation count queries.\n */\n relationCountAttributes: RelationCountAttribute[] = []\n\n /**\n * WHERE queries.\n */\n wheres: WhereClause[] = []\n\n /**\n * HAVING queries.\n */\n havings: { type: \"simple\" | \"and\" | \"or\"; condition: string }[] = []\n\n /**\n * ORDER BY queries.\n */\n orderBys: OrderByCondition = {}\n\n /**\n * GROUP BY queries.\n */\n groupBys: string[] = []\n\n /**\n * LIMIT query.\n */\n limit?: number\n\n /**\n * OFFSET query.\n */\n offset?: number\n\n /**\n * Number of rows to skip of result using pagination.\n */\n skip?: number\n\n /**\n * Number of rows to take using pagination.\n */\n take?: number\n\n /**\n * Use certain index for the query.\n *\n * SELECT * FROM table_name USE INDEX (col1_index, col2_index) WHERE col1=1 AND col2=2 AND col3=3;\n */\n useIndex?: string\n\n /**\n * Locking mode.\n */\n lockMode?:\n | \"optimistic\"\n | \"pessimistic_read\"\n | \"pessimistic_write\"\n | \"dirty_read\"\n /*\n \"pessimistic_partial_write\" and \"pessimistic_write_or_fail\" are deprecated and\n will be removed in a future version.\n\n Use onLocked instead.\n */\n | \"pessimistic_partial_write\"\n | \"pessimistic_write_or_fail\"\n | \"for_no_key_update\"\n | \"for_key_share\"\n\n /**\n * Current version of the entity, used for locking.\n */\n lockVersion?: number | Date\n\n /**\n * Tables to be specified in the \"FOR UPDATE OF\" clause, referred by their alias\n */\n lockTables?: string[]\n\n /**\n * Modify behavior when encountering locked rows. NOWAIT or SKIP LOCKED\n */\n onLocked?: \"nowait\" | \"skip_locked\"\n\n /**\n * Indicates if soft-deleted rows should be included in entity result.\n * By default the soft-deleted rows are not included.\n */\n withDeleted: boolean = false\n\n /**\n * Parameters used to be escaped in final query.\n */\n parameters: ObjectLiteral = {}\n\n /**\n * Indicates if alias, table names and column names will be escaped by driver, or not.\n *\n * todo: rename to isQuotingDisabled, also think if it should be named \"escaping\"\n */\n disableEscaping: boolean = true\n\n /**\n * Indicates if virtual columns should be included in entity result.\n *\n * todo: what to do with it? is it properly used? what about persistence?\n */\n enableRelationIdValues: boolean = false\n\n /**\n * Extra where condition appended to the end of original where conditions with AND keyword.\n * Original condition will be wrapped into brackets.\n */\n extraAppendedAndWhereCondition: string = \"\"\n\n /**\n * Indicates if query builder creates a subquery.\n */\n subQuery: boolean = false\n\n /**\n * Indicates if property names are prefixed with alias names during property replacement.\n * By default this is enabled, however we need this because aliases are not supported in UPDATE and DELETE queries,\n * but user can use them in WHERE expressions.\n */\n aliasNamePrefixingEnabled: boolean = true\n\n /**\n * Indicates if query result cache is enabled or not.\n * It is undefined by default to avoid overriding the `alwaysEnabled` config\n */\n cache?: boolean\n\n /**\n * Time in milliseconds in which cache will expire.\n * If not set then global caching time will be used.\n */\n cacheDuration: number\n\n /**\n * Cache id.\n * Used to identifier your cache queries.\n */\n cacheId: string\n\n /**\n * Options that define QueryBuilder behaviour.\n */\n options: SelectQueryBuilderOption[] = []\n\n /**\n * Property path of relation to work with.\n * Used in relational query builder.\n */\n relationPropertyPath: string\n\n /**\n * Entity (target) which relations will be updated.\n */\n of: any | any[]\n\n /**\n * List of columns where data should be inserted.\n * Used in INSERT query.\n */\n insertColumns: string[] = []\n\n /**\n * Used if user wants to update or delete a specific entities.\n */\n whereEntities: ObjectLiteral[] = []\n\n /**\n * Indicates if entity must be updated after insertion / updation.\n * This may produce extra query or use RETURNING / OUTPUT statement (depend on database).\n */\n updateEntity: boolean = true\n\n /**\n * Indicates if listeners and subscribers must be called before and after query execution.\n */\n callListeners: boolean = true\n\n /**\n * Indicates if query must be wrapped into transaction.\n */\n useTransaction: boolean = false\n\n /**\n * Indicates if query should be time travel query\n * https://www.cockroachlabs.com/docs/stable/as-of-system-time.html\n */\n timeTravel?: boolean | string\n\n /**\n * Extra parameters.\n *\n * @deprecated Use standard parameters instead\n */\n nativeParameters: ObjectLiteral = {}\n\n /**\n * Query Comment to include extra information for debugging or other purposes.\n */\n comment?: string\n\n /**\n * Items from an entity that have been locally generated & are recorded here for later use.\n * Examples include the UUID generation when the database does not natively support it.\n * These are included in the entity index order.\n */\n locallyGenerated: { [key: number]: ObjectLiteral } = {}\n\n commonTableExpressions: {\n queryBuilder: QueryBuilder<any> | string\n alias: string\n options: QueryBuilderCteOptions\n }[] = []\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(protected connection: DataSource) {\n if (connection.options.relationLoadStrategy) {\n this.relationLoadStrategy = connection.options.relationLoadStrategy\n }\n\n this.timeTravel =\n (connection.options as CockroachConnectionOptions)\n ?.timeTravelQueries || false\n }\n\n // -------------------------------------------------------------------------\n // Accessors\n // -------------------------------------------------------------------------\n\n /**\n * Get all ORDER BY queries - if order by is specified by user then it uses them,\n * otherwise it uses default entity order by if it was set.\n */\n get allOrderBys() {\n if (\n !Object.keys(this.orderBys).length &&\n this.mainAlias!.hasMetadata &&\n this.options.indexOf(\"disable-global-order\") === -1\n ) {\n const entityOrderBy = this.mainAlias!.metadata.orderBy || {}\n return Object.keys(entityOrderBy).reduce((orderBy, key) => {\n orderBy[this.mainAlias!.name + \".\" + key] = entityOrderBy[key]\n return orderBy\n }, {} as OrderByCondition)\n }\n\n return this.orderBys\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Creates a main alias and adds it to the current expression map.\n */\n setMainAlias(alias: Alias): Alias {\n // if main alias is already set then remove it from the array\n // if (this.mainAlias)\n // this.aliases.splice(this.aliases.indexOf(this.mainAlias));\n\n // set new main alias\n this.mainAlias = alias\n\n return alias\n }\n\n /**\n * Creates a new alias and adds it to the current expression map.\n */\n createAlias(options: {\n type: \"from\" | \"select\" | \"join\" | \"other\"\n name?: string\n target?: Function | string\n tablePath?: string\n subQuery?: string\n metadata?: EntityMetadata\n }): Alias {\n let aliasName = options.name\n if (!aliasName && options.tablePath) aliasName = options.tablePath\n if (!aliasName && typeof options.target === \"function\")\n aliasName = options.target.name\n if (!aliasName && typeof options.target === \"string\")\n aliasName = options.target\n\n const alias = new Alias()\n alias.type = options.type\n if (aliasName) alias.name = aliasName\n if (options.metadata) alias.metadata = options.metadata\n if (options.target && !alias.hasMetadata)\n alias.metadata = this.connection.getMetadata(options.target)\n if (options.tablePath) alias.tablePath = options.tablePath\n if (options.subQuery) alias.subQuery = options.subQuery\n\n this.aliases.push(alias)\n return alias\n }\n\n /**\n * Finds alias with the given name.\n * If alias was not found it throw an exception.\n */\n findAliasByName(aliasName: string): Alias {\n const alias = this.aliases.find((alias) => alias.name === aliasName)\n if (!alias)\n throw new TypeORMError(\n `\"${aliasName}\" alias was not found. Maybe you forgot to join it?`,\n )\n\n return alias\n }\n\n findColumnByAliasExpression(\n aliasExpression: string,\n ): ColumnMetadata | undefined {\n const [aliasName, propertyPath] = aliasExpression.split(\".\")\n const alias = this.findAliasByName(aliasName)\n return alias.metadata.findColumnWithPropertyName(propertyPath)\n }\n\n /**\n * Gets relation metadata of the relation this query builder works with.\n *\n * todo: add proper exceptions\n */\n get relationMetadata(): RelationMetadata {\n if (!this.mainAlias)\n throw new TypeORMError(`Entity to work with is not specified!`) // todo: better message\n\n const relationMetadata =\n this.mainAlias.metadata.findRelationWithPropertyPath(\n this.relationPropertyPath,\n )\n if (!relationMetadata)\n throw new TypeORMError(\n `Relation ${this.relationPropertyPath} was not found in entity ${this.mainAlias.name}`,\n ) // todo: better message\n\n return relationMetadata\n }\n\n /**\n * Copies all properties of the current QueryExpressionMap into a new one.\n * Useful when QueryBuilder needs to create a copy of itself.\n */\n clone(): QueryExpressionMap {\n const map = new QueryExpressionMap(this.connection)\n map.queryType = this.queryType\n map.selects = this.selects.map((select) => select)\n map.maxExecutionTime = this.maxExecutionTime\n map.selectDistinct = this.selectDistinct\n map.selectDistinctOn = this.selectDistinctOn\n this.aliases.forEach((alias) => map.aliases.push(new Alias(alias)))\n map.relationLoadStrategy = this.relationLoadStrategy\n map.mainAlias = this.mainAlias\n map.valuesSet = this.valuesSet\n map.returning = this.returning\n map.onConflict = this.onConflict\n map.onIgnore = this.onIgnore\n map.onUpdate = this.onUpdate\n map.joinAttributes = this.joinAttributes.map(\n (join) => new JoinAttribute(this.connection, this, join),\n )\n map.relationIdAttributes = this.relationIdAttributes.map(\n (relationId) => new RelationIdAttribute(this, relationId),\n )\n map.relationCountAttributes = this.relationCountAttributes.map(\n (relationCount) => new RelationCountAttribute(this, relationCount),\n )\n map.wheres = this.wheres.map((where) => ({ ...where }))\n map.havings = this.havings.map((having) => ({ ...having }))\n map.orderBys = Object.assign({}, this.orderBys)\n map.groupBys = this.groupBys.map((groupBy) => groupBy)\n map.limit = this.limit\n map.offset = this.offset\n map.skip = this.skip\n map.take = this.take\n map.lockMode = this.lockMode\n map.onLocked = this.onLocked\n map.lockVersion = this.lockVersion\n map.lockTables = this.lockTables\n map.withDeleted = this.withDeleted\n map.parameters = Object.assign({}, this.parameters)\n map.disableEscaping = this.disableEscaping\n map.enableRelationIdValues = this.enableRelationIdValues\n map.extraAppendedAndWhereCondition = this.extraAppendedAndWhereCondition\n map.subQuery = this.subQuery\n map.aliasNamePrefixingEnabled = this.aliasNamePrefixingEnabled\n map.cache = this.cache\n map.cacheId = this.cacheId\n map.cacheDuration = this.cacheDuration\n map.relationPropertyPath = this.relationPropertyPath\n map.of = this.of\n map.insertColumns = this.insertColumns\n map.whereEntities = this.whereEntities\n map.updateEntity = this.updateEntity\n map.callListeners = this.callListeners\n map.useTransaction = this.useTransaction\n map.timeTravel = this.timeTravel\n map.nativeParameters = Object.assign({}, this.nativeParameters)\n map.comment = this.comment\n map.commonTableExpressions = this.commonTableExpressions.map(\n (cteOptions) => ({\n alias: cteOptions.alias,\n queryBuilder:\n typeof cteOptions.queryBuilder === \"string\"\n ? cteOptions.queryBuilder\n : cteOptions.queryBuilder.clone(),\n options: cteOptions.options,\n }),\n )\n return map\n }\n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../browser/src/query-builder/QueryExpressionMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAG/B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAG/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAA;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAA;AAOhF,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAKvC;;GAEG;AACH,MAAM,OAAO,kBAAkB;IA4U3B,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAsB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;QA/U5C,4EAA4E;QAC5E,oBAAoB;QACpB,4EAA4E;QAE5E;;WAEG;QACH,yBAAoB,GAAqB,MAAM,CAAA;QAE/C;;WAEG;QACH,gBAAW,GAAY,KAAK,CAAA;QAO5B;;WAEG;QACH,YAAO,GAAY,EAAE,CAAA;QAErB;;WAEG;QACH,cAAS,GAOS,QAAQ,CAAA;QAE1B;;WAEG;QACH,YAAO,GAAkB,EAAE,CAAA;QAE3B;;WAEG;QACH,qBAAgB,GAAW,CAAC,CAAA;QAE5B;;WAEG;QACH,mBAAc,GAAY,KAAK,CAAA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../common/ObjectLiteral\"\nimport { OrderByCondition } from \"../find-options/OrderByCondition\"\nimport { JoinAttribute } from \"./JoinAttribute\"\nimport { QueryBuilder } from \"./QueryBuilder\"\nimport { QueryBuilderCteOptions } from \"./QueryBuilderCte\"\nimport { RelationIdAttribute } from \"./relation-id/RelationIdAttribute\"\nimport { RelationCountAttribute } from \"./relation-count/RelationCountAttribute\"\nimport { DataSource } from \"../data-source/DataSource\"\nimport { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { SelectQuery } from \"./SelectQuery\"\nimport { ColumnMetadata } from \"../metadata/ColumnMetadata\"\nimport { RelationMetadata } from \"../metadata/RelationMetadata\"\nimport { SelectQueryBuilderOption } from \"./SelectQueryBuilderOption\"\nimport { TypeORMError } from \"../error\"\nimport { WhereClause } from \"./WhereClause\"\nimport { UpsertType } from \"../driver/types/UpsertType\"\nimport { CockroachConnectionOptions } from \"../driver/cockroachdb/CockroachConnectionOptions\"\n\n/**\n * Contains all properties of the QueryBuilder that needs to be build a final query.\n */\nexport class QueryExpressionMap {\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Strategy to load relations.\n */\n relationLoadStrategy: \"join\" | \"query\" = \"join\"\n\n /**\n * Indicates if QueryBuilder used to select entities and not a raw results.\n */\n queryEntity: boolean = false\n\n /**\n * Main alias is a main selection object selected by QueryBuilder.\n */\n mainAlias?: Alias\n\n /**\n * All aliases (including main alias) used in the query.\n */\n aliases: Alias[] = []\n\n /**\n * Represents query type. QueryBuilder is able to build SELECT, UPDATE and DELETE queries.\n */\n queryType:\n | \"select\"\n | \"update\"\n | \"delete\"\n | \"insert\"\n | \"relation\"\n | \"soft-delete\"\n | \"restore\" = \"select\"\n\n /**\n * Data needs to be SELECT-ed.\n */\n selects: SelectQuery[] = []\n\n /**\n * Max execution time in millisecond.\n */\n maxExecutionTime: number = 0\n\n /**\n * Whether SELECT is DISTINCT.\n */\n selectDistinct: boolean = false\n\n /**\n * SELECT DISTINCT ON query (postgres).\n */\n selectDistinctOn: string[] = []\n\n /**\n * FROM-s to be selected.\n */\n // froms: { target: string, alias: string }[] = [];\n\n /**\n * If update query was used, it needs \"update set\" - properties which will be updated by this query.\n * If insert query was used, it needs \"insert set\" - values that needs to be inserted.\n */\n valuesSet?: ObjectLiteral | ObjectLiteral[]\n\n /**\n * Optional returning (or output) clause for insert, update or delete queries.\n */\n returning: string | string[]\n\n /**\n * Extra returning columns to be added to the returning statement if driver supports it.\n */\n extraReturningColumns: ColumnMetadata[] = []\n\n /**\n * Optional on conflict statement used in insertion query in postgres.\n */\n onConflict: string = \"\"\n\n /**\n * Optional on ignore statement used in insertion query in databases.\n */\n onIgnore: boolean = false\n\n /**\n * Optional on update statement used in insertion query in databases.\n */\n onUpdate: {\n conflict?: string | string[]\n columns?: string[]\n overwrite?: string[]\n skipUpdateIfNoValuesChanged?: boolean\n indexPredicate?: string\n upsertType?: UpsertType\n overwriteCondition?: WhereClause[]\n }\n\n /**\n * JOIN queries.\n */\n joinAttributes: JoinAttribute[] = []\n\n /**\n * RelationId queries.\n */\n relationIdAttributes: RelationIdAttribute[] = []\n\n /**\n * Relation count queries.\n */\n relationCountAttributes: RelationCountAttribute[] = []\n\n /**\n * WHERE queries.\n */\n wheres: WhereClause[] = []\n\n /**\n * HAVING queries.\n */\n havings: { type: \"simple\" | \"and\" | \"or\"; condition: string }[] = []\n\n /**\n * ORDER BY queries.\n */\n orderBys: OrderByCondition = {}\n\n /**\n * GROUP BY queries.\n */\n groupBys: string[] = []\n\n /**\n * LIMIT query.\n */\n limit?: number\n\n /**\n * OFFSET query.\n */\n offset?: number\n\n /**\n * Number of rows to skip of result using pagination.\n */\n skip?: number\n\n /**\n * Number of rows to take using pagination.\n */\n take?: number\n\n /**\n * Use certain index for the query.\n *\n * SELECT * FROM table_name USE INDEX (col1_index, col2_index) WHERE col1=1 AND col2=2 AND col3=3;\n */\n useIndex?: string\n\n /**\n * Locking mode.\n */\n lockMode?:\n | \"optimistic\"\n | \"pessimistic_read\"\n | \"pessimistic_write\"\n | \"dirty_read\"\n /*\n \"pessimistic_partial_write\" and \"pessimistic_write_or_fail\" are deprecated and\n will be removed in a future version.\n\n Use onLocked instead.\n */\n | \"pessimistic_partial_write\"\n | \"pessimistic_write_or_fail\"\n | \"for_no_key_update\"\n | \"for_key_share\"\n\n /**\n * Current version of the entity, used for locking.\n */\n lockVersion?: number | Date\n\n /**\n * Tables to be specified in the \"FOR UPDATE OF\" clause, referred by their alias\n */\n lockTables?: string[]\n\n /**\n * Modify behavior when encountering locked rows. NOWAIT or SKIP LOCKED\n */\n onLocked?: \"nowait\" | \"skip_locked\"\n\n /**\n * Indicates if soft-deleted rows should be included in entity result.\n * By default the soft-deleted rows are not included.\n */\n withDeleted: boolean = false\n\n /**\n * Parameters used to be escaped in final query.\n */\n parameters: ObjectLiteral = {}\n\n /**\n * Indicates if alias, table names and column names will be escaped by driver, or not.\n *\n * todo: rename to isQuotingDisabled, also think if it should be named \"escaping\"\n */\n disableEscaping: boolean = true\n\n /**\n * Indicates if virtual columns should be included in entity result.\n *\n * todo: what to do with it? is it properly used? what about persistence?\n */\n enableRelationIdValues: boolean = false\n\n /**\n * Extra where condition appended to the end of original where conditions with AND keyword.\n * Original condition will be wrapped into brackets.\n */\n extraAppendedAndWhereCondition: string = \"\"\n\n /**\n * Indicates if query builder creates a subquery.\n */\n subQuery: boolean = false\n\n /**\n * Indicates if property names are prefixed with alias names during property replacement.\n * By default this is enabled, however we need this because aliases are not supported in UPDATE and DELETE queries,\n * but user can use them in WHERE expressions.\n */\n aliasNamePrefixingEnabled: boolean = true\n\n /**\n * Indicates if query result cache is enabled or not.\n * It is undefined by default to avoid overriding the `alwaysEnabled` config\n */\n cache?: boolean\n\n /**\n * Time in milliseconds in which cache will expire.\n * If not set then global caching time will be used.\n */\n cacheDuration: number\n\n /**\n * Cache id.\n * Used to identifier your cache queries.\n */\n cacheId: string\n\n /**\n * Options that define QueryBuilder behaviour.\n */\n options: SelectQueryBuilderOption[] = []\n\n /**\n * Property path of relation to work with.\n * Used in relational query builder.\n */\n relationPropertyPath: string\n\n /**\n * Entity (target) which relations will be updated.\n */\n of: any | any[]\n\n /**\n * List of columns where data should be inserted.\n * Used in INSERT query.\n */\n insertColumns: string[] = []\n\n /**\n * Used if user wants to update or delete a specific entities.\n */\n whereEntities: ObjectLiteral[] = []\n\n /**\n * Indicates if entity must be updated after insertion / updation.\n * This may produce extra query or use RETURNING / OUTPUT statement (depend on database).\n */\n updateEntity: boolean = true\n\n /**\n * Indicates if listeners and subscribers must be called before and after query execution.\n */\n callListeners: boolean = true\n\n /**\n * Indicates if query must be wrapped into transaction.\n */\n useTransaction: boolean = false\n\n /**\n * Indicates if query should be time travel query\n * https://www.cockroachlabs.com/docs/stable/as-of-system-time.html\n */\n timeTravel?: boolean | string\n\n /**\n * Extra parameters.\n *\n * @deprecated Use standard parameters instead\n */\n nativeParameters: ObjectLiteral = {}\n\n /**\n * Query Comment to include extra information for debugging or other purposes.\n */\n comment?: string\n\n /**\n * Items from an entity that have been locally generated & are recorded here for later use.\n * Examples include the UUID generation when the database does not natively support it.\n * These are included in the entity index order.\n */\n locallyGenerated: { [key: number]: ObjectLiteral } = {}\n\n commonTableExpressions: {\n queryBuilder: QueryBuilder<any> | string\n alias: string\n options: QueryBuilderCteOptions\n }[] = []\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(protected connection: DataSource) {\n if (connection.options.relationLoadStrategy) {\n this.relationLoadStrategy = connection.options.relationLoadStrategy\n }\n\n this.timeTravel =\n (connection.options as CockroachConnectionOptions)\n ?.timeTravelQueries || false\n }\n\n // -------------------------------------------------------------------------\n // Accessors\n // -------------------------------------------------------------------------\n\n /**\n * Get all ORDER BY queries - if order by is specified by user then it uses them,\n * otherwise it uses default entity order by if it was set.\n */\n get allOrderBys() {\n if (\n !Object.keys(this.orderBys).length &&\n this.mainAlias!.hasMetadata &&\n this.options.indexOf(\"disable-global-order\") === -1\n ) {\n const entityOrderBy = this.mainAlias!.metadata.orderBy || {}\n return Object.keys(entityOrderBy).reduce((orderBy, key) => {\n orderBy[this.mainAlias!.name + \".\" + key] = entityOrderBy[key]\n return orderBy\n }, {} as OrderByCondition)\n }\n\n return this.orderBys\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Creates a main alias and adds it to the current expression map.\n */\n setMainAlias(alias: Alias): Alias {\n // if main alias is already set then remove it from the array\n // if (this.mainAlias)\n // this.aliases.splice(this.aliases.indexOf(this.mainAlias));\n\n // set new main alias\n this.mainAlias = alias\n\n return alias\n }\n\n /**\n * Creates a new alias and adds it to the current expression map.\n */\n createAlias(options: {\n type: \"from\" | \"select\" | \"join\" | \"other\"\n name?: string\n target?: Function | string\n tablePath?: string\n subQuery?: string\n metadata?: EntityMetadata\n }): Alias {\n let aliasName = options.name\n if (!aliasName && options.tablePath) aliasName = options.tablePath\n if (!aliasName && typeof options.target === \"function\")\n aliasName = options.target.name\n if (!aliasName && typeof options.target === \"string\")\n aliasName = options.target\n\n const alias = new Alias()\n alias.type = options.type\n if (aliasName) alias.name = aliasName\n if (options.metadata) alias.metadata = options.metadata\n if (options.target && !alias.hasMetadata)\n alias.metadata = this.connection.getMetadata(options.target)\n if (options.tablePath) alias.tablePath = options.tablePath\n if (options.subQuery) alias.subQuery = options.subQuery\n\n this.aliases.push(alias)\n return alias\n }\n\n /**\n * Finds alias with the given name.\n * If alias was not found it throw an exception.\n */\n findAliasByName(aliasName: string): Alias {\n const alias = this.aliases.find((alias) => alias.name === aliasName)\n if (!alias)\n throw new TypeORMError(\n `\"${aliasName}\" alias was not found. Maybe you forgot to join it?`,\n )\n\n return alias\n }\n\n findColumnByAliasExpression(\n aliasExpression: string,\n ): ColumnMetadata | undefined {\n const [aliasName, propertyPath] = aliasExpression.split(\".\")\n const alias = this.findAliasByName(aliasName)\n return alias.metadata.findColumnWithPropertyName(propertyPath)\n }\n\n /**\n * Gets relation metadata of the relation this query builder works with.\n *\n * todo: add proper exceptions\n */\n get relationMetadata(): RelationMetadata {\n if (!this.mainAlias)\n throw new TypeORMError(`Entity to work with is not specified!`) // todo: better message\n\n const relationMetadata =\n this.mainAlias.metadata.findRelationWithPropertyPath(\n this.relationPropertyPath,\n )\n if (!relationMetadata)\n throw new TypeORMError(\n `Relation ${this.relationPropertyPath} was not found in entity ${this.mainAlias.name}`,\n ) // todo: better message\n\n return relationMetadata\n }\n\n /**\n * Copies all properties of the current QueryExpressionMap into a new one.\n * Useful when QueryBuilder needs to create a copy of itself.\n */\n clone(): QueryExpressionMap {\n const map = new QueryExpressionMap(this.connection)\n map.queryType = this.queryType\n map.selects = this.selects.map((select) => select)\n map.maxExecutionTime = this.maxExecutionTime\n map.selectDistinct = this.selectDistinct\n map.selectDistinctOn = this.selectDistinctOn\n this.aliases.forEach((alias) => map.aliases.push(new Alias(alias)))\n map.relationLoadStrategy = this.relationLoadStrategy\n map.mainAlias = this.mainAlias\n map.valuesSet = this.valuesSet\n map.returning = this.returning\n map.onConflict = this.onConflict\n map.onIgnore = this.onIgnore\n map.onUpdate = this.onUpdate\n map.joinAttributes = this.joinAttributes.map(\n (join) => new JoinAttribute(this.connection, this, join),\n )\n map.relationIdAttributes = this.relationIdAttributes.map(\n (relationId) => new RelationIdAttribute(this, relationId),\n )\n map.relationCountAttributes = this.relationCountAttributes.map(\n (relationCount) => new RelationCountAttribute(this, relationCount),\n )\n map.wheres = this.wheres.map((where) => ({ ...where }))\n map.havings = this.havings.map((having) => ({ ...having }))\n map.orderBys = Object.assign({}, this.orderBys)\n map.groupBys = this.groupBys.map((groupBy) => groupBy)\n map.limit = this.limit\n map.offset = this.offset\n map.skip = this.skip\n map.take = this.take\n map.useIndex = this.useIndex\n map.lockMode = this.lockMode\n map.onLocked = this.onLocked\n map.lockVersion = this.lockVersion\n map.lockTables = this.lockTables\n map.withDeleted = this.withDeleted\n map.parameters = Object.assign({}, this.parameters)\n map.disableEscaping = this.disableEscaping\n map.enableRelationIdValues = this.enableRelationIdValues\n map.extraAppendedAndWhereCondition = this.extraAppendedAndWhereCondition\n map.subQuery = this.subQuery\n map.aliasNamePrefixingEnabled = this.aliasNamePrefixingEnabled\n map.cache = this.cache\n map.cacheId = this.cacheId\n map.cacheDuration = this.cacheDuration\n map.relationPropertyPath = this.relationPropertyPath\n map.of = this.of\n map.insertColumns = this.insertColumns\n map.whereEntities = this.whereEntities\n map.updateEntity = this.updateEntity\n map.callListeners = this.callListeners\n map.useTransaction = this.useTransaction\n map.timeTravel = this.timeTravel\n map.nativeParameters = Object.assign({}, this.nativeParameters)\n map.comment = this.comment\n map.commonTableExpressions = this.commonTableExpressions.map(\n (cteOptions) => ({\n alias: cteOptions.alias,\n queryBuilder:\n typeof cteOptions.queryBuilder === \"string\"\n ? cteOptions.queryBuilder\n : cteOptions.queryBuilder.clone(),\n options: cteOptions.options,\n }),\n )\n return map\n }\n}\n"],"sourceRoot":".."}
package/package.json CHANGED
@@ -1 +1 @@
1
- { "name": "typeorm", "version": "0.3.26-dev.1ea3a5e", "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": { "types": "./index.d.ts", "import": "./index.mjs", "require": "./index.js" }, "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", "typecheck": "tsc --noEmit", "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.29.0", "@sap/hana-client": "^2.25.22", "@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.29.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", "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", "reflect-metadata": "^0.2.2", "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.34.1" }, "peerDependencies": { "@google-cloud/spanner": "^5.18.0 || ^6.0.0 || ^7.0.0", "@sap/hana-client": "^2.14.22", "better-sqlite3": "^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0", "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 }, "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.26-dev.66ee307", "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": { "types": "./index.d.ts", "import": "./index.mjs", "require": "./index.js" }, "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", "typecheck": "tsc --noEmit", "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.29.0", "@sap/hana-client": "^2.25.22", "@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.29.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", "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", "reflect-metadata": "^0.2.2", "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.34.1" }, "peerDependencies": { "@google-cloud/spanner": "^5.18.0 || ^6.0.0 || ^7.0.0", "@sap/hana-client": "^2.14.22", "better-sqlite3": "^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0", "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 }, "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" ] }
@@ -289,6 +289,7 @@ class QueryExpressionMap {
289
289
  map.offset = this.offset;
290
290
  map.skip = this.skip;
291
291
  map.take = this.take;
292
+ map.useIndex = this.useIndex;
292
293
  map.lockMode = this.lockMode;
293
294
  map.onLocked = this.onLocked;
294
295
  map.lockVersion = this.lockVersion;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/query-builder/QueryExpressionMap.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAG/B,mDAA+C;AAG/C,2EAAuE;AACvE,oFAAgF;AAOhF,oCAAuC;AAKvC;;GAEG;AACH,MAAa,kBAAkB;IA4U3B,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAsB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;QA/U5C,4EAA4E;QAC5E,oBAAoB;QACpB,4EAA4E;QAE5E;;WAEG;QACH,yBAAoB,GAAqB,MAAM,CAAA;QAE/C;;WAEG;QACH,gBAAW,GAAY,KAAK,CAAA;QAO5B;;WAEG;QACH,YAAO,GAAY,EAAE,CAAA;QAErB;;WAEG;QACH,cAAS,GAOS,QAAQ,CAAA;QAE1B;;WAEG;QACH,YAAO,GAAkB,EAAE,CAAA;QAE3B;;WAEG;QACH,qBAAgB,GAAW,CAAC,CAAA;QAE5B;;WAEG;QACH,mBAAc,GAAY,KAAK,CAAA;QAE/B;;WAEG;QACH,qBAAgB,GAAa,EAAE,CAAA;QAkB/B;;WAEG;QACH,0BAAqB,GAAqB,EAAE,CAAA;QAE5C;;WAEG;QACH,eAAU,GAAW,EAAE,CAAA;QAEvB;;WAEG;QACH,aAAQ,GAAY,KAAK,CAAA;QAezB;;WAEG;QACH,mBAAc,GAAoB,EAAE,CAAA;QAEpC;;WAEG;QACH,yBAAoB,GAA0B,EAAE,CAAA;QAEhD;;WAEG;QACH,4BAAuB,GAA6B,EAAE,CAAA;QAEtD;;WAEG;QACH,WAAM,GAAkB,EAAE,CAAA;QAE1B;;WAEG;QACH,YAAO,GAA2D,EAAE,CAAA;QAEpE;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AAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAA;QACtC,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAA;QACxC,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAA;QAChC,GAAG,CAAC,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAA;QAC/D,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAC1B,GAAG,CAAC,sBAAsB,GAAG,IAAI,CAAC,sBAAsB,CAAC,GAAG,CACxD,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YACb,KAAK,EAAE,UAAU,CAAC,KAAK;YACvB,YAAY,EACR,OAAO,UAAU,CAAC,YAAY,KAAK,QAAQ;gBACvC,CAAC,CAAC,UAAU,CAAC,YAAY;gBACzB,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,KAAK,EAAE;YACzC,OAAO,EAAE,UAAU,CAAC,OAAO;SAC9B,CAAC,CACL,CAAA;QACD,OAAO,GAAG,CAAA;IACd,CAAC;CACJ;AAthBD,gDAshBC","file":"QueryExpressionMap.js","sourcesContent":["import { Alias } from \"./Alias\"\nimport { ObjectLiteral } from \"../common/ObjectLiteral\"\nimport { OrderByCondition } from \"../find-options/OrderByCondition\"\nimport { JoinAttribute } from \"./JoinAttribute\"\nimport { QueryBuilder } from \"./QueryBuilder\"\nimport { QueryBuilderCteOptions } from \"./QueryBuilderCte\"\nimport { RelationIdAttribute } from \"./relation-id/RelationIdAttribute\"\nimport { RelationCountAttribute } from \"./relation-count/RelationCountAttribute\"\nimport { DataSource } from \"../data-source/DataSource\"\nimport { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { SelectQuery } from \"./SelectQuery\"\nimport { ColumnMetadata } from \"../metadata/ColumnMetadata\"\nimport { RelationMetadata } from \"../metadata/RelationMetadata\"\nimport { SelectQueryBuilderOption } from \"./SelectQueryBuilderOption\"\nimport { TypeORMError } from \"../error\"\nimport { WhereClause } from \"./WhereClause\"\nimport { UpsertType } from \"../driver/types/UpsertType\"\nimport { CockroachConnectionOptions } from \"../driver/cockroachdb/CockroachConnectionOptions\"\n\n/**\n * Contains all properties of the QueryBuilder that needs to be build a final query.\n */\nexport class QueryExpressionMap {\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Strategy to load relations.\n */\n relationLoadStrategy: \"join\" | \"query\" = \"join\"\n\n /**\n * Indicates if QueryBuilder used to select entities and not a raw results.\n */\n queryEntity: boolean = false\n\n /**\n * Main alias is a main selection object selected by QueryBuilder.\n */\n mainAlias?: Alias\n\n /**\n * All aliases (including main alias) used in the query.\n */\n aliases: Alias[] = []\n\n /**\n * Represents query type. QueryBuilder is able to build SELECT, UPDATE and DELETE queries.\n */\n queryType:\n | \"select\"\n | \"update\"\n | \"delete\"\n | \"insert\"\n | \"relation\"\n | \"soft-delete\"\n | \"restore\" = \"select\"\n\n /**\n * Data needs to be SELECT-ed.\n */\n selects: SelectQuery[] = []\n\n /**\n * Max execution time in millisecond.\n */\n maxExecutionTime: number = 0\n\n /**\n * Whether SELECT is DISTINCT.\n */\n selectDistinct: boolean = false\n\n /**\n * SELECT DISTINCT ON query (postgres).\n */\n selectDistinctOn: string[] = []\n\n /**\n * FROM-s to be selected.\n */\n // froms: { target: string, alias: string }[] = [];\n\n /**\n * If update query was used, it needs \"update set\" - properties which will be updated by this query.\n * If insert query was used, it needs \"insert set\" - values that needs to be inserted.\n */\n valuesSet?: ObjectLiteral | ObjectLiteral[]\n\n /**\n * Optional returning (or output) clause for insert, update or delete queries.\n */\n returning: string | string[]\n\n /**\n * Extra returning columns to be added to the returning statement if driver supports it.\n */\n extraReturningColumns: ColumnMetadata[] = []\n\n /**\n * Optional on conflict statement used in insertion query in postgres.\n */\n onConflict: string = \"\"\n\n /**\n * Optional on ignore statement used in insertion query in databases.\n */\n onIgnore: boolean = false\n\n /**\n * Optional on update statement used in insertion query in databases.\n */\n onUpdate: {\n conflict?: string | string[]\n columns?: string[]\n overwrite?: string[]\n skipUpdateIfNoValuesChanged?: boolean\n indexPredicate?: string\n upsertType?: UpsertType\n overwriteCondition?: WhereClause[]\n }\n\n /**\n * JOIN queries.\n */\n joinAttributes: JoinAttribute[] = []\n\n /**\n * RelationId queries.\n */\n relationIdAttributes: RelationIdAttribute[] = []\n\n /**\n * Relation count queries.\n */\n relationCountAttributes: RelationCountAttribute[] = []\n\n /**\n * WHERE queries.\n */\n wheres: WhereClause[] = []\n\n /**\n * HAVING queries.\n */\n havings: { type: \"simple\" | \"and\" | \"or\"; condition: string }[] = []\n\n /**\n * ORDER BY queries.\n */\n orderBys: OrderByCondition = {}\n\n /**\n * GROUP BY queries.\n */\n groupBys: string[] = []\n\n /**\n * LIMIT query.\n */\n limit?: number\n\n /**\n * OFFSET query.\n */\n offset?: number\n\n /**\n * Number of rows to skip of result using pagination.\n */\n skip?: number\n\n /**\n * Number of rows to take using pagination.\n */\n take?: number\n\n /**\n * Use certain index for the query.\n *\n * SELECT * FROM table_name USE INDEX (col1_index, col2_index) WHERE col1=1 AND col2=2 AND col3=3;\n */\n useIndex?: string\n\n /**\n * Locking mode.\n */\n lockMode?:\n | \"optimistic\"\n | \"pessimistic_read\"\n | \"pessimistic_write\"\n | \"dirty_read\"\n /*\n \"pessimistic_partial_write\" and \"pessimistic_write_or_fail\" are deprecated and\n will be removed in a future version.\n\n Use onLocked instead.\n */\n | \"pessimistic_partial_write\"\n | \"pessimistic_write_or_fail\"\n | \"for_no_key_update\"\n | \"for_key_share\"\n\n /**\n * Current version of the entity, used for locking.\n */\n lockVersion?: number | Date\n\n /**\n * Tables to be specified in the \"FOR UPDATE OF\" clause, referred by their alias\n */\n lockTables?: string[]\n\n /**\n * Modify behavior when encountering locked rows. NOWAIT or SKIP LOCKED\n */\n onLocked?: \"nowait\" | \"skip_locked\"\n\n /**\n * Indicates if soft-deleted rows should be included in entity result.\n * By default the soft-deleted rows are not included.\n */\n withDeleted: boolean = false\n\n /**\n * Parameters used to be escaped in final query.\n */\n parameters: ObjectLiteral = {}\n\n /**\n * Indicates if alias, table names and column names will be escaped by driver, or not.\n *\n * todo: rename to isQuotingDisabled, also think if it should be named \"escaping\"\n */\n disableEscaping: boolean = true\n\n /**\n * Indicates if virtual columns should be included in entity result.\n *\n * todo: what to do with it? is it properly used? what about persistence?\n */\n enableRelationIdValues: boolean = false\n\n /**\n * Extra where condition appended to the end of original where conditions with AND keyword.\n * Original condition will be wrapped into brackets.\n */\n extraAppendedAndWhereCondition: string = \"\"\n\n /**\n * Indicates if query builder creates a subquery.\n */\n subQuery: boolean = false\n\n /**\n * Indicates if property names are prefixed with alias names during property replacement.\n * By default this is enabled, however we need this because aliases are not supported in UPDATE and DELETE queries,\n * but user can use them in WHERE expressions.\n */\n aliasNamePrefixingEnabled: boolean = true\n\n /**\n * Indicates if query result cache is enabled or not.\n * It is undefined by default to avoid overriding the `alwaysEnabled` config\n */\n cache?: boolean\n\n /**\n * Time in milliseconds in which cache will expire.\n * If not set then global caching time will be used.\n */\n cacheDuration: number\n\n /**\n * Cache id.\n * Used to identifier your cache queries.\n */\n cacheId: string\n\n /**\n * Options that define QueryBuilder behaviour.\n */\n options: SelectQueryBuilderOption[] = []\n\n /**\n * Property path of relation to work with.\n * Used in relational query builder.\n */\n relationPropertyPath: string\n\n /**\n * Entity (target) which relations will be updated.\n */\n of: any | any[]\n\n /**\n * List of columns where data should be inserted.\n * Used in INSERT query.\n */\n insertColumns: string[] = []\n\n /**\n * Used if user wants to update or delete a specific entities.\n */\n whereEntities: ObjectLiteral[] = []\n\n /**\n * Indicates if entity must be updated after insertion / updation.\n * This may produce extra query or use RETURNING / OUTPUT statement (depend on database).\n */\n updateEntity: boolean = true\n\n /**\n * Indicates if listeners and subscribers must be called before and after query execution.\n */\n callListeners: boolean = true\n\n /**\n * Indicates if query must be wrapped into transaction.\n */\n useTransaction: boolean = false\n\n /**\n * Indicates if query should be time travel query\n * https://www.cockroachlabs.com/docs/stable/as-of-system-time.html\n */\n timeTravel?: boolean | string\n\n /**\n * Extra parameters.\n *\n * @deprecated Use standard parameters instead\n */\n nativeParameters: ObjectLiteral = {}\n\n /**\n * Query Comment to include extra information for debugging or other purposes.\n */\n comment?: string\n\n /**\n * Items from an entity that have been locally generated & are recorded here for later use.\n * Examples include the UUID generation when the database does not natively support it.\n * These are included in the entity index order.\n */\n locallyGenerated: { [key: number]: ObjectLiteral } = {}\n\n commonTableExpressions: {\n queryBuilder: QueryBuilder<any> | string\n alias: string\n options: QueryBuilderCteOptions\n }[] = []\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(protected connection: DataSource) {\n if (connection.options.relationLoadStrategy) {\n this.relationLoadStrategy = connection.options.relationLoadStrategy\n }\n\n this.timeTravel =\n (connection.options as CockroachConnectionOptions)\n ?.timeTravelQueries || false\n }\n\n // -------------------------------------------------------------------------\n // Accessors\n // -------------------------------------------------------------------------\n\n /**\n * Get all ORDER BY queries - if order by is specified by user then it uses them,\n * otherwise it uses default entity order by if it was set.\n */\n get allOrderBys() {\n if (\n !Object.keys(this.orderBys).length &&\n this.mainAlias!.hasMetadata &&\n this.options.indexOf(\"disable-global-order\") === -1\n ) {\n const entityOrderBy = this.mainAlias!.metadata.orderBy || {}\n return Object.keys(entityOrderBy).reduce((orderBy, key) => {\n orderBy[this.mainAlias!.name + \".\" + key] = entityOrderBy[key]\n return orderBy\n }, {} as OrderByCondition)\n }\n\n return this.orderBys\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Creates a main alias and adds it to the current expression map.\n */\n setMainAlias(alias: Alias): Alias {\n // if main alias is already set then remove it from the array\n // if (this.mainAlias)\n // this.aliases.splice(this.aliases.indexOf(this.mainAlias));\n\n // set new main alias\n this.mainAlias = alias\n\n return alias\n }\n\n /**\n * Creates a new alias and adds it to the current expression map.\n */\n createAlias(options: {\n type: \"from\" | \"select\" | \"join\" | \"other\"\n name?: string\n target?: Function | string\n tablePath?: string\n subQuery?: string\n metadata?: EntityMetadata\n }): Alias {\n let aliasName = options.name\n if (!aliasName && options.tablePath) aliasName = options.tablePath\n if (!aliasName && typeof options.target === \"function\")\n aliasName = options.target.name\n if (!aliasName && typeof options.target === \"string\")\n aliasName = options.target\n\n const alias = new Alias()\n alias.type = options.type\n if (aliasName) alias.name = aliasName\n if (options.metadata) alias.metadata = options.metadata\n if (options.target && !alias.hasMetadata)\n alias.metadata = this.connection.getMetadata(options.target)\n if (options.tablePath) alias.tablePath = options.tablePath\n if (options.subQuery) alias.subQuery = options.subQuery\n\n this.aliases.push(alias)\n return alias\n }\n\n /**\n * Finds alias with the given name.\n * If alias was not found it throw an exception.\n */\n findAliasByName(aliasName: string): Alias {\n const alias = this.aliases.find((alias) => alias.name === aliasName)\n if (!alias)\n throw new TypeORMError(\n `\"${aliasName}\" alias was not found. Maybe you forgot to join it?`,\n )\n\n return alias\n }\n\n findColumnByAliasExpression(\n aliasExpression: string,\n ): ColumnMetadata | undefined {\n const [aliasName, propertyPath] = aliasExpression.split(\".\")\n const alias = this.findAliasByName(aliasName)\n return alias.metadata.findColumnWithPropertyName(propertyPath)\n }\n\n /**\n * Gets relation metadata of the relation this query builder works with.\n *\n * todo: add proper exceptions\n */\n get relationMetadata(): RelationMetadata {\n if (!this.mainAlias)\n throw new TypeORMError(`Entity to work with is not specified!`) // todo: better message\n\n const relationMetadata =\n this.mainAlias.metadata.findRelationWithPropertyPath(\n this.relationPropertyPath,\n )\n if (!relationMetadata)\n throw new TypeORMError(\n `Relation ${this.relationPropertyPath} was not found in entity ${this.mainAlias.name}`,\n ) // todo: better message\n\n return relationMetadata\n }\n\n /**\n * Copies all properties of the current QueryExpressionMap into a new one.\n * Useful when QueryBuilder needs to create a copy of itself.\n */\n clone(): QueryExpressionMap {\n const map = new QueryExpressionMap(this.connection)\n map.queryType = this.queryType\n map.selects = this.selects.map((select) => select)\n map.maxExecutionTime = this.maxExecutionTime\n map.selectDistinct = this.selectDistinct\n map.selectDistinctOn = this.selectDistinctOn\n this.aliases.forEach((alias) => map.aliases.push(new Alias(alias)))\n map.relationLoadStrategy = this.relationLoadStrategy\n map.mainAlias = this.mainAlias\n map.valuesSet = this.valuesSet\n map.returning = this.returning\n map.onConflict = this.onConflict\n map.onIgnore = this.onIgnore\n map.onUpdate = this.onUpdate\n map.joinAttributes = this.joinAttributes.map(\n (join) => new JoinAttribute(this.connection, this, join),\n )\n map.relationIdAttributes = this.relationIdAttributes.map(\n (relationId) => new RelationIdAttribute(this, relationId),\n )\n map.relationCountAttributes = this.relationCountAttributes.map(\n (relationCount) => new RelationCountAttribute(this, relationCount),\n )\n map.wheres = this.wheres.map((where) => ({ ...where }))\n map.havings = this.havings.map((having) => ({ ...having }))\n map.orderBys = Object.assign({}, this.orderBys)\n map.groupBys = this.groupBys.map((groupBy) => groupBy)\n map.limit = this.limit\n map.offset = this.offset\n map.skip = this.skip\n map.take = this.take\n map.lockMode = this.lockMode\n map.onLocked = this.onLocked\n map.lockVersion = this.lockVersion\n map.lockTables = this.lockTables\n map.withDeleted = this.withDeleted\n map.parameters = Object.assign({}, this.parameters)\n map.disableEscaping = this.disableEscaping\n map.enableRelationIdValues = this.enableRelationIdValues\n map.extraAppendedAndWhereCondition = this.extraAppendedAndWhereCondition\n map.subQuery = this.subQuery\n map.aliasNamePrefixingEnabled = this.aliasNamePrefixingEnabled\n map.cache = this.cache\n map.cacheId = this.cacheId\n map.cacheDuration = this.cacheDuration\n map.relationPropertyPath = this.relationPropertyPath\n map.of = this.of\n map.insertColumns = this.insertColumns\n map.whereEntities = this.whereEntities\n map.updateEntity = this.updateEntity\n map.callListeners = this.callListeners\n map.useTransaction = this.useTransaction\n map.timeTravel = this.timeTravel\n map.nativeParameters = Object.assign({}, this.nativeParameters)\n map.comment = this.comment\n map.commonTableExpressions = this.commonTableExpressions.map(\n (cteOptions) => ({\n alias: cteOptions.alias,\n queryBuilder:\n typeof cteOptions.queryBuilder === \"string\"\n ? cteOptions.queryBuilder\n : cteOptions.queryBuilder.clone(),\n options: cteOptions.options,\n }),\n )\n return map\n }\n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../../src/query-builder/QueryExpressionMap.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAG/B,mDAA+C;AAG/C,2EAAuE;AACvE,oFAAgF;AAOhF,oCAAuC;AAKvC;;GAEG;AACH,MAAa,kBAAkB;IA4U3B,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAsB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;QA/U5C,4EAA4E;QAC5E,oBAAoB;QACpB,4EAA4E;QAE5E;;WAEG;QACH,yBAAoB,GAAqB,MAAM,CAAA;QAE/C;;WAEG;QACH,gBAAW,GAAY,KAAK,CAAA;QAO5B;;WAEG;QACH,YAAO,GAAY,EAAE,CAAA;QAErB;;WAEG;QACH,cAAS,GAOS,QAAQ,CAAA;QAE1B;;WAEG;QACH,YAAO,GAAkB,EAAE,CAAA;QAE3B;;WAEG;QACH,qBAAgB,GAAW,CAAC,CAAA;QAE5B;;WAEG;QACH,mBAAc,GAAY,KAAK,CAAA;QAE/B;;WAEG;QACH,qBAAgB,GAAa,EAAE,CAAA;QAkB/B;;WAEG;QACH,0BAAqB,GAAqB,EAAE,CAAA;QAE5C;;WAEG;QACH,eAAU,GAAW,EAAE,CAAA;QAEvB;;WAEG;QACH,aAAQ,GAAY,KAAK,CAAA;QAezB;;WAEG;QACH,mBAAc,GAAoB,EAAE,CAAA;QAEpC;;WAEG;QACH,yBAAoB,GAA0B,EAAE,CAAA;QAEhD;;WAEG;QACH,4BAAuB,GAA6B,EAAE,CAAA;QAEtD;;WAEG;QACH,WAAM,GAAkB,EAAE,CAAA;QAE1B;;WAEG;QACH,YAAO,GAA2D,EAAE,CAAA;QAEpE;;WAEG;QACH,aAAQ,GAAqB,EAAE,CAAA;QAE/B;;WAEG;QACH,aAAQ,GAAa,EAA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IAAI,CAAC,aAAa,CAAA;QACtC,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAA;QACxC,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAA;QAChC,GAAG,CAAC,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAA;QAC/D,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAC1B,GAAG,CAAC,sBAAsB,GAAG,IAAI,CAAC,sBAAsB,CAAC,GAAG,CACxD,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YACb,KAAK,EAAE,UAAU,CAAC,KAAK;YACvB,YAAY,EACR,OAAO,UAAU,CAAC,YAAY,KAAK,QAAQ;gBACvC,CAAC,CAAC,UAAU,CAAC,YAAY;gBACzB,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,KAAK,EAAE;YACzC,OAAO,EAAE,UAAU,CAAC,OAAO;SAC9B,CAAC,CACL,CAAA;QACD,OAAO,GAAG,CAAA;IACd,CAAC;CACJ;AAvhBD,gDAuhBC","file":"QueryExpressionMap.js","sourcesContent":["import { Alias } from \"./Alias\"\nimport { ObjectLiteral } from \"../common/ObjectLiteral\"\nimport { OrderByCondition } from \"../find-options/OrderByCondition\"\nimport { JoinAttribute } from \"./JoinAttribute\"\nimport { QueryBuilder } from \"./QueryBuilder\"\nimport { QueryBuilderCteOptions } from \"./QueryBuilderCte\"\nimport { RelationIdAttribute } from \"./relation-id/RelationIdAttribute\"\nimport { RelationCountAttribute } from \"./relation-count/RelationCountAttribute\"\nimport { DataSource } from \"../data-source/DataSource\"\nimport { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { SelectQuery } from \"./SelectQuery\"\nimport { ColumnMetadata } from \"../metadata/ColumnMetadata\"\nimport { RelationMetadata } from \"../metadata/RelationMetadata\"\nimport { SelectQueryBuilderOption } from \"./SelectQueryBuilderOption\"\nimport { TypeORMError } from \"../error\"\nimport { WhereClause } from \"./WhereClause\"\nimport { UpsertType } from \"../driver/types/UpsertType\"\nimport { CockroachConnectionOptions } from \"../driver/cockroachdb/CockroachConnectionOptions\"\n\n/**\n * Contains all properties of the QueryBuilder that needs to be build a final query.\n */\nexport class QueryExpressionMap {\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Strategy to load relations.\n */\n relationLoadStrategy: \"join\" | \"query\" = \"join\"\n\n /**\n * Indicates if QueryBuilder used to select entities and not a raw results.\n */\n queryEntity: boolean = false\n\n /**\n * Main alias is a main selection object selected by QueryBuilder.\n */\n mainAlias?: Alias\n\n /**\n * All aliases (including main alias) used in the query.\n */\n aliases: Alias[] = []\n\n /**\n * Represents query type. QueryBuilder is able to build SELECT, UPDATE and DELETE queries.\n */\n queryType:\n | \"select\"\n | \"update\"\n | \"delete\"\n | \"insert\"\n | \"relation\"\n | \"soft-delete\"\n | \"restore\" = \"select\"\n\n /**\n * Data needs to be SELECT-ed.\n */\n selects: SelectQuery[] = []\n\n /**\n * Max execution time in millisecond.\n */\n maxExecutionTime: number = 0\n\n /**\n * Whether SELECT is DISTINCT.\n */\n selectDistinct: boolean = false\n\n /**\n * SELECT DISTINCT ON query (postgres).\n */\n selectDistinctOn: string[] = []\n\n /**\n * FROM-s to be selected.\n */\n // froms: { target: string, alias: string }[] = [];\n\n /**\n * If update query was used, it needs \"update set\" - properties which will be updated by this query.\n * If insert query was used, it needs \"insert set\" - values that needs to be inserted.\n */\n valuesSet?: ObjectLiteral | ObjectLiteral[]\n\n /**\n * Optional returning (or output) clause for insert, update or delete queries.\n */\n returning: string | string[]\n\n /**\n * Extra returning columns to be added to the returning statement if driver supports it.\n */\n extraReturningColumns: ColumnMetadata[] = []\n\n /**\n * Optional on conflict statement used in insertion query in postgres.\n */\n onConflict: string = \"\"\n\n /**\n * Optional on ignore statement used in insertion query in databases.\n */\n onIgnore: boolean = false\n\n /**\n * Optional on update statement used in insertion query in databases.\n */\n onUpdate: {\n conflict?: string | string[]\n columns?: string[]\n overwrite?: string[]\n skipUpdateIfNoValuesChanged?: boolean\n indexPredicate?: string\n upsertType?: UpsertType\n overwriteCondition?: WhereClause[]\n }\n\n /**\n * JOIN queries.\n */\n joinAttributes: JoinAttribute[] = []\n\n /**\n * RelationId queries.\n */\n relationIdAttributes: RelationIdAttribute[] = []\n\n /**\n * Relation count queries.\n */\n relationCountAttributes: RelationCountAttribute[] = []\n\n /**\n * WHERE queries.\n */\n wheres: WhereClause[] = []\n\n /**\n * HAVING queries.\n */\n havings: { type: \"simple\" | \"and\" | \"or\"; condition: string }[] = []\n\n /**\n * ORDER BY queries.\n */\n orderBys: OrderByCondition = {}\n\n /**\n * GROUP BY queries.\n */\n groupBys: string[] = []\n\n /**\n * LIMIT query.\n */\n limit?: number\n\n /**\n * OFFSET query.\n */\n offset?: number\n\n /**\n * Number of rows to skip of result using pagination.\n */\n skip?: number\n\n /**\n * Number of rows to take using pagination.\n */\n take?: number\n\n /**\n * Use certain index for the query.\n *\n * SELECT * FROM table_name USE INDEX (col1_index, col2_index) WHERE col1=1 AND col2=2 AND col3=3;\n */\n useIndex?: string\n\n /**\n * Locking mode.\n */\n lockMode?:\n | \"optimistic\"\n | \"pessimistic_read\"\n | \"pessimistic_write\"\n | \"dirty_read\"\n /*\n \"pessimistic_partial_write\" and \"pessimistic_write_or_fail\" are deprecated and\n will be removed in a future version.\n\n Use onLocked instead.\n */\n | \"pessimistic_partial_write\"\n | \"pessimistic_write_or_fail\"\n | \"for_no_key_update\"\n | \"for_key_share\"\n\n /**\n * Current version of the entity, used for locking.\n */\n lockVersion?: number | Date\n\n /**\n * Tables to be specified in the \"FOR UPDATE OF\" clause, referred by their alias\n */\n lockTables?: string[]\n\n /**\n * Modify behavior when encountering locked rows. NOWAIT or SKIP LOCKED\n */\n onLocked?: \"nowait\" | \"skip_locked\"\n\n /**\n * Indicates if soft-deleted rows should be included in entity result.\n * By default the soft-deleted rows are not included.\n */\n withDeleted: boolean = false\n\n /**\n * Parameters used to be escaped in final query.\n */\n parameters: ObjectLiteral = {}\n\n /**\n * Indicates if alias, table names and column names will be escaped by driver, or not.\n *\n * todo: rename to isQuotingDisabled, also think if it should be named \"escaping\"\n */\n disableEscaping: boolean = true\n\n /**\n * Indicates if virtual columns should be included in entity result.\n *\n * todo: what to do with it? is it properly used? what about persistence?\n */\n enableRelationIdValues: boolean = false\n\n /**\n * Extra where condition appended to the end of original where conditions with AND keyword.\n * Original condition will be wrapped into brackets.\n */\n extraAppendedAndWhereCondition: string = \"\"\n\n /**\n * Indicates if query builder creates a subquery.\n */\n subQuery: boolean = false\n\n /**\n * Indicates if property names are prefixed with alias names during property replacement.\n * By default this is enabled, however we need this because aliases are not supported in UPDATE and DELETE queries,\n * but user can use them in WHERE expressions.\n */\n aliasNamePrefixingEnabled: boolean = true\n\n /**\n * Indicates if query result cache is enabled or not.\n * It is undefined by default to avoid overriding the `alwaysEnabled` config\n */\n cache?: boolean\n\n /**\n * Time in milliseconds in which cache will expire.\n * If not set then global caching time will be used.\n */\n cacheDuration: number\n\n /**\n * Cache id.\n * Used to identifier your cache queries.\n */\n cacheId: string\n\n /**\n * Options that define QueryBuilder behaviour.\n */\n options: SelectQueryBuilderOption[] = []\n\n /**\n * Property path of relation to work with.\n * Used in relational query builder.\n */\n relationPropertyPath: string\n\n /**\n * Entity (target) which relations will be updated.\n */\n of: any | any[]\n\n /**\n * List of columns where data should be inserted.\n * Used in INSERT query.\n */\n insertColumns: string[] = []\n\n /**\n * Used if user wants to update or delete a specific entities.\n */\n whereEntities: ObjectLiteral[] = []\n\n /**\n * Indicates if entity must be updated after insertion / updation.\n * This may produce extra query or use RETURNING / OUTPUT statement (depend on database).\n */\n updateEntity: boolean = true\n\n /**\n * Indicates if listeners and subscribers must be called before and after query execution.\n */\n callListeners: boolean = true\n\n /**\n * Indicates if query must be wrapped into transaction.\n */\n useTransaction: boolean = false\n\n /**\n * Indicates if query should be time travel query\n * https://www.cockroachlabs.com/docs/stable/as-of-system-time.html\n */\n timeTravel?: boolean | string\n\n /**\n * Extra parameters.\n *\n * @deprecated Use standard parameters instead\n */\n nativeParameters: ObjectLiteral = {}\n\n /**\n * Query Comment to include extra information for debugging or other purposes.\n */\n comment?: string\n\n /**\n * Items from an entity that have been locally generated & are recorded here for later use.\n * Examples include the UUID generation when the database does not natively support it.\n * These are included in the entity index order.\n */\n locallyGenerated: { [key: number]: ObjectLiteral } = {}\n\n commonTableExpressions: {\n queryBuilder: QueryBuilder<any> | string\n alias: string\n options: QueryBuilderCteOptions\n }[] = []\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(protected connection: DataSource) {\n if (connection.options.relationLoadStrategy) {\n this.relationLoadStrategy = connection.options.relationLoadStrategy\n }\n\n this.timeTravel =\n (connection.options as CockroachConnectionOptions)\n ?.timeTravelQueries || false\n }\n\n // -------------------------------------------------------------------------\n // Accessors\n // -------------------------------------------------------------------------\n\n /**\n * Get all ORDER BY queries - if order by is specified by user then it uses them,\n * otherwise it uses default entity order by if it was set.\n */\n get allOrderBys() {\n if (\n !Object.keys(this.orderBys).length &&\n this.mainAlias!.hasMetadata &&\n this.options.indexOf(\"disable-global-order\") === -1\n ) {\n const entityOrderBy = this.mainAlias!.metadata.orderBy || {}\n return Object.keys(entityOrderBy).reduce((orderBy, key) => {\n orderBy[this.mainAlias!.name + \".\" + key] = entityOrderBy[key]\n return orderBy\n }, {} as OrderByCondition)\n }\n\n return this.orderBys\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Creates a main alias and adds it to the current expression map.\n */\n setMainAlias(alias: Alias): Alias {\n // if main alias is already set then remove it from the array\n // if (this.mainAlias)\n // this.aliases.splice(this.aliases.indexOf(this.mainAlias));\n\n // set new main alias\n this.mainAlias = alias\n\n return alias\n }\n\n /**\n * Creates a new alias and adds it to the current expression map.\n */\n createAlias(options: {\n type: \"from\" | \"select\" | \"join\" | \"other\"\n name?: string\n target?: Function | string\n tablePath?: string\n subQuery?: string\n metadata?: EntityMetadata\n }): Alias {\n let aliasName = options.name\n if (!aliasName && options.tablePath) aliasName = options.tablePath\n if (!aliasName && typeof options.target === \"function\")\n aliasName = options.target.name\n if (!aliasName && typeof options.target === \"string\")\n aliasName = options.target\n\n const alias = new Alias()\n alias.type = options.type\n if (aliasName) alias.name = aliasName\n if (options.metadata) alias.metadata = options.metadata\n if (options.target && !alias.hasMetadata)\n alias.metadata = this.connection.getMetadata(options.target)\n if (options.tablePath) alias.tablePath = options.tablePath\n if (options.subQuery) alias.subQuery = options.subQuery\n\n this.aliases.push(alias)\n return alias\n }\n\n /**\n * Finds alias with the given name.\n * If alias was not found it throw an exception.\n */\n findAliasByName(aliasName: string): Alias {\n const alias = this.aliases.find((alias) => alias.name === aliasName)\n if (!alias)\n throw new TypeORMError(\n `\"${aliasName}\" alias was not found. Maybe you forgot to join it?`,\n )\n\n return alias\n }\n\n findColumnByAliasExpression(\n aliasExpression: string,\n ): ColumnMetadata | undefined {\n const [aliasName, propertyPath] = aliasExpression.split(\".\")\n const alias = this.findAliasByName(aliasName)\n return alias.metadata.findColumnWithPropertyName(propertyPath)\n }\n\n /**\n * Gets relation metadata of the relation this query builder works with.\n *\n * todo: add proper exceptions\n */\n get relationMetadata(): RelationMetadata {\n if (!this.mainAlias)\n throw new TypeORMError(`Entity to work with is not specified!`) // todo: better message\n\n const relationMetadata =\n this.mainAlias.metadata.findRelationWithPropertyPath(\n this.relationPropertyPath,\n )\n if (!relationMetadata)\n throw new TypeORMError(\n `Relation ${this.relationPropertyPath} was not found in entity ${this.mainAlias.name}`,\n ) // todo: better message\n\n return relationMetadata\n }\n\n /**\n * Copies all properties of the current QueryExpressionMap into a new one.\n * Useful when QueryBuilder needs to create a copy of itself.\n */\n clone(): QueryExpressionMap {\n const map = new QueryExpressionMap(this.connection)\n map.queryType = this.queryType\n map.selects = this.selects.map((select) => select)\n map.maxExecutionTime = this.maxExecutionTime\n map.selectDistinct = this.selectDistinct\n map.selectDistinctOn = this.selectDistinctOn\n this.aliases.forEach((alias) => map.aliases.push(new Alias(alias)))\n map.relationLoadStrategy = this.relationLoadStrategy\n map.mainAlias = this.mainAlias\n map.valuesSet = this.valuesSet\n map.returning = this.returning\n map.onConflict = this.onConflict\n map.onIgnore = this.onIgnore\n map.onUpdate = this.onUpdate\n map.joinAttributes = this.joinAttributes.map(\n (join) => new JoinAttribute(this.connection, this, join),\n )\n map.relationIdAttributes = this.relationIdAttributes.map(\n (relationId) => new RelationIdAttribute(this, relationId),\n )\n map.relationCountAttributes = this.relationCountAttributes.map(\n (relationCount) => new RelationCountAttribute(this, relationCount),\n )\n map.wheres = this.wheres.map((where) => ({ ...where }))\n map.havings = this.havings.map((having) => ({ ...having }))\n map.orderBys = Object.assign({}, this.orderBys)\n map.groupBys = this.groupBys.map((groupBy) => groupBy)\n map.limit = this.limit\n map.offset = this.offset\n map.skip = this.skip\n map.take = this.take\n map.useIndex = this.useIndex\n map.lockMode = this.lockMode\n map.onLocked = this.onLocked\n map.lockVersion = this.lockVersion\n map.lockTables = this.lockTables\n map.withDeleted = this.withDeleted\n map.parameters = Object.assign({}, this.parameters)\n map.disableEscaping = this.disableEscaping\n map.enableRelationIdValues = this.enableRelationIdValues\n map.extraAppendedAndWhereCondition = this.extraAppendedAndWhereCondition\n map.subQuery = this.subQuery\n map.aliasNamePrefixingEnabled = this.aliasNamePrefixingEnabled\n map.cache = this.cache\n map.cacheId = this.cacheId\n map.cacheDuration = this.cacheDuration\n map.relationPropertyPath = this.relationPropertyPath\n map.of = this.of\n map.insertColumns = this.insertColumns\n map.whereEntities = this.whereEntities\n map.updateEntity = this.updateEntity\n map.callListeners = this.callListeners\n map.useTransaction = this.useTransaction\n map.timeTravel = this.timeTravel\n map.nativeParameters = Object.assign({}, this.nativeParameters)\n map.comment = this.comment\n map.commonTableExpressions = this.commonTableExpressions.map(\n (cteOptions) => ({\n alias: cteOptions.alias,\n queryBuilder:\n typeof cteOptions.queryBuilder === \"string\"\n ? cteOptions.queryBuilder\n : cteOptions.queryBuilder.clone(),\n options: cteOptions.options,\n }),\n )\n return map\n }\n}\n"],"sourceRoot":".."}