typeorm 0.3.13-dev.f1330ad → 0.3.13-dev.f7f6817
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/driver/postgres/PostgresQueryRunner.js +1 -1
- package/browser/driver/postgres/PostgresQueryRunner.js.map +1 -1
- package/browser/driver/sqlite-abstract/AbstractSqliteDriver.js +0 -7
- package/browser/driver/sqlite-abstract/AbstractSqliteDriver.js.map +1 -1
- package/browser/entity-schema/EntitySchemaOptions.d.ts +4 -5
- package/browser/entity-schema/EntitySchemaOptions.js.map +1 -1
- package/browser/entity-schema/EntitySchemaTransformer.js +0 -13
- package/browser/entity-schema/EntitySchemaTransformer.js.map +1 -1
- package/browser/find-options/FindOperator.d.ts +0 -2
- package/browser/find-options/FindOperator.js +0 -13
- package/browser/find-options/FindOperator.js.map +1 -1
- package/browser/find-options/FindOptionsUtils.js +15 -45
- package/browser/find-options/FindOptionsUtils.js.map +1 -1
- package/browser/metadata/EmbeddedMetadata.js +3 -3
- package/browser/metadata/EmbeddedMetadata.js.map +1 -1
- package/browser/migration/MigrationExecutor.js +2 -8
- package/browser/migration/MigrationExecutor.js.map +1 -1
- package/browser/query-builder/JoinAttribute.d.ts +0 -4
- package/browser/query-builder/JoinAttribute.js +0 -4
- package/browser/query-builder/JoinAttribute.js.map +1 -1
- package/browser/query-builder/SelectQueryBuilder.d.ts +3 -4
- package/browser/query-builder/SelectQueryBuilder.js +8 -16
- package/browser/query-builder/SelectQueryBuilder.js.map +1 -1
- package/browser/util/StringUtils.js +3 -3
- package/browser/util/StringUtils.js.map +1 -1
- package/driver/postgres/PostgresQueryRunner.js +1 -1
- package/driver/postgres/PostgresQueryRunner.js.map +1 -1
- package/driver/sqlite-abstract/AbstractSqliteDriver.js +0 -7
- package/driver/sqlite-abstract/AbstractSqliteDriver.js.map +1 -1
- package/entity-schema/EntitySchemaOptions.d.ts +4 -5
- package/entity-schema/EntitySchemaOptions.js.map +1 -1
- package/entity-schema/EntitySchemaTransformer.js +0 -13
- package/entity-schema/EntitySchemaTransformer.js.map +1 -1
- package/find-options/FindOperator.d.ts +0 -2
- package/find-options/FindOperator.js +0 -13
- package/find-options/FindOperator.js.map +1 -1
- package/find-options/FindOptionsUtils.js +16 -46
- package/find-options/FindOptionsUtils.js.map +1 -1
- package/metadata/EmbeddedMetadata.js +3 -3
- package/metadata/EmbeddedMetadata.js.map +1 -1
- package/migration/MigrationExecutor.js +2 -8
- package/migration/MigrationExecutor.js.map +1 -1
- package/package.json +1 -1
- package/query-builder/JoinAttribute.d.ts +0 -4
- package/query-builder/JoinAttribute.js +0 -4
- package/query-builder/JoinAttribute.js.map +1 -1
- package/query-builder/SelectQueryBuilder.d.ts +3 -4
- package/query-builder/SelectQueryBuilder.js +8 -16
- package/query-builder/SelectQueryBuilder.js.map +1 -1
- package/util/StringUtils.js +3 -3
- package/util/StringUtils.js.map +1 -1
- package/browser/entity-schema/EntitySchemaInheritanceOptions.d.ts +0 -11
- package/browser/entity-schema/EntitySchemaInheritanceOptions.js +0 -3
- package/browser/entity-schema/EntitySchemaInheritanceOptions.js.map +0 -1
- package/entity-schema/EntitySchemaInheritanceOptions.d.ts +0 -11
- package/entity-schema/EntitySchemaInheritanceOptions.js +0 -4
- package/entity-schema/EntitySchemaInheritanceOptions.js.map +0 -1
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "name": "typeorm", "private": false, "version": "0.3.13-dev.
|
|
1
|
+
{ "name": "typeorm", "private": false, "version": "0.3.13-dev.f7f6817", "description": "Data-Mapper ORM for TypeScript, ES7, ES6, ES5. Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, MongoDB databases.", "license": "MIT", "readmeFilename": "README.md", "author": { "name": "Umed Khudoiberdiev", "email": "pleerock.me@gmail.com" }, "engines": { "node": ">= 12.9.0" }, "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", "types": "./index.d.ts", "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/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" }, "repository": { "type": "git", "url": "https://github.com/typeorm/typeorm.git" }, "bugs": { "url": "https://github.com/typeorm/typeorm/issues" }, "homepage": "https://typeorm.io", "tags": [ "orm", "typescript", "typescript-orm", "mysql", "mysql-orm", "postgresql", "postgresql-orm", "mariadb", "mariadb-orm", "spanner", "sqlite", "sqlite-orm", "sql-server", "sql-server-orm", "oracle", "oracle-orm", "cloud-spanner", "cloud-spanner-orm" ], "devDependencies": { "@types/app-root-path": "^1.2.4", "@types/chai": "^4.3.4", "@types/chai-as-promised": "^7.1.5", "@types/debug": "^4.1.7", "@types/js-yaml": "^4.0.5", "@types/mkdirp": "^1.0.2", "@types/mocha": "^10.0.1", "@types/node": "^18.13.0", "@types/sha.js": "^2.4.0", "@types/sinon": "^10.0.13", "@types/source-map-support": "^0.5.6", "@types/uuid": "^9.0.0", "@types/xml2js": "^0.4.11", "@types/yargs": "^17.0.22", "better-sqlite3": "^8.1.0", "chai": "^4.3.7", "chai-as-promised": "^7.1.1", "class-transformer": "^0.5.1", "conventional-changelog-angular": "^5.0.13", "conventional-changelog-cli": "^2.2.2", "del": "6.1.1", "gulp": "^4.0.2", "gulp-istanbul": "^1.1.3", "gulp-mocha": "^8.0.0", "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": "^8.0.3", "mocha": "^10.2.0", "mongodb": "^3.7.3", "mssql": "^9.1.1", "mysql": "^2.18.1", "mysql2": "^3.1.1", "pg": "^8.9.0", "pg-query-stream": "^4.3.0", "prettier": "^2.8.3", "redis": "^4.6.4", "remap-istanbul": "^0.13.0", "rimraf": "^4.1.2", "sinon": "^15.0.1", "sinon-chai": "^3.7.0", "source-map-support": "^0.5.21", "sql.js": "^1.8.0", "sqlite3": "^5.1.4", "ts-node": "^10.9.1", "typeorm-aurora-data-api-driver": "^2.4.4", "typescript": "^4.9.5" }, "peerDependencies": { "@google-cloud/spanner": "^5.18.0", "@sap/hana-client": "^2.12.25", "better-sqlite3": "^7.1.2 || ^8.0.0", "hdb-pool": "^0.1.6", "ioredis": "^5.0.4", "mongodb": "^3.6.0", "mssql": "^9.1.1", "mysql2": "^2.2.5 || ^3.0.1", "oracledb": "^5.1.0", "pg": "^8.5.1", "pg-native": "^3.0.0", "pg-query-stream": "^4.0.0", "redis": "^3.1.1 || ^4.0.0", "sql.js": "^1.4.0", "sqlite3": "^5.0.3", "ts-node": "^10.7.0", "typeorm-aurora-data-api-driver": "^2.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 } }, "dependencies": { "@sqltools/formatter": "^1.2.5", "app-root-path": "^3.1.0", "buffer": "^6.0.3", "chalk": "^4.1.2", "cli-highlight": "^2.1.11", "debug": "^4.3.4", "dotenv": "^16.0.3", "glob": "^8.1.0", "js-yaml": "^4.1.0", "mkdirp": "^2.1.3", "reflect-metadata": "^0.1.13", "sha.js": "^2.4.11", "tslib": "^2.5.0", "uuid": "^9.0.0", "xml2js": "^0.4.23", "yargs": "^17.6.2" }, "scripts": { "test": "rimraf ./build && tsc && mocha --file ./build/compiled/test/utils/test-setup.js --bail --recursive --timeout 60000 ./build/compiled/test", "test-fast": "mocha --file ./build/compiled/test/utils/test-setup.js --bail --recursive --timeout 60000 ./build/compiled/test", "compile": "rimraf ./build && tsc", "watch": "./node_modules/.bin/tsc -w", "package": "gulp package", "pack": "gulp pack", "lint": "prettier --check \"./src/**/*.ts\" \"./test/**/*.ts\" \"./sample/**/*.ts\"", "format": "prettier --write \"./src/**/*.ts\" \"./test/**/*.ts\" \"./sample/**/*.ts\"", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 2" }, "bin": { "typeorm": "./cli.js", "typeorm-ts-node-commonjs": "./cli-ts-node-commonjs.js", "typeorm-ts-node-esm": "./cli-ts-node-esm.js" }, "funding": "https://opencollective.com/typeorm", "collective": { "type": "opencollective", "url": "https://opencollective.com/typeorm", "logo": "https://opencollective.com/opencollective/logo.txt" }, "nyc": { "all": true, "cache": false, "exclude": [ "**/*.d.ts" ], "extension": [ ".ts" ], "include": [ "build/compiled/src/**", "src/**" ], "reporter": "json" } }
|
|
@@ -33,10 +33,6 @@ export declare class JoinAttribute {
|
|
|
33
33
|
* Indicates if user maps one or many objects from the join.
|
|
34
34
|
*/
|
|
35
35
|
isMappingMany?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Useful when the joined expression is a custom query to support mapping.
|
|
38
|
-
*/
|
|
39
|
-
mapAsEntity?: Function | string;
|
|
40
36
|
constructor(connection: DataSource, queryExpressionMap: QueryExpressionMap, joinAttribute?: JoinAttribute);
|
|
41
37
|
get isMany(): boolean;
|
|
42
38
|
isSelectedCache: boolean;
|
|
@@ -122,10 +122,6 @@ class JoinAttribute {
|
|
|
122
122
|
// entityOrProperty is Entity class
|
|
123
123
|
if (this.connection.hasMetadata(this.entityOrProperty))
|
|
124
124
|
return this.connection.getMetadata(this.entityOrProperty);
|
|
125
|
-
// Overriden mapping entity provided for leftJoinAndMapOne with custom query builder
|
|
126
|
-
if (this.mapAsEntity && this.connection.hasMetadata(this.mapAsEntity)) {
|
|
127
|
-
return this.connection.getMetadata(this.mapAsEntity);
|
|
128
|
-
}
|
|
129
125
|
return undefined;
|
|
130
126
|
/*if (typeof this.entityOrProperty === "string") { // entityOrProperty is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;SACvD;QAED,OAAO,SAAS,CAAA;QAEhB;;;;;;;;;;WAUG;IACP,CAAC;IAED;;OAEG;IACH,IAAI,aAAa;QACb,IAAI,CAAC,IAAI,CAAC,QAAQ;YACd,MAAM,IAAI,oBAAY,CAClB,sDAAsD,CACzD,CAAA;QAEL,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACxB,OAAO,yBAAW,CAAC,UAAU,CACzB,IAAI,CAAC,UAAU,CAAC,MAAM,EACtB,IAAI,CAAC,WAAY,EACjB,IAAI,CAAC,KAAK,CAAC,IAAI,CAClB,CAAA;SACJ;aAAM;YACH,OAAO,yBAAW,CAAC,UAAU,CACzB,IAAI,CAAC,UAAU,CAAC,MAAM,EACtB,IAAI,CAAC,KAAK,CAAC,IAAI,EACf,IAAI,CAAC,WAAY,CACpB,CAAA;SACJ;IACL,CAAC;IAED,IAAI,wBAAwB;QACxB,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,OAAO,SAAS,CAAA;QAEzC,OAAO,IAAI,CAAC,aAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC5C,CAAC;IAED,IAAI,yBAAyB;QACzB,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,OAAO,SAAS,CAAA;QAEzC,OAAO,IAAI,CAAC,aAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC5C,CAAC;CACJ;AAxPD,sCAwPC","file":"JoinAttribute.js","sourcesContent":["import { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { DataSource } from \"../data-source/DataSource\"\nimport { RelationMetadata } from \"../metadata/RelationMetadata\"\nimport { QueryBuilderUtils } from \"./QueryBuilderUtils\"\nimport { QueryExpressionMap } from \"./QueryExpressionMap\"\nimport { Alias } from \"./Alias\"\nimport { ObjectUtils } from \"../util/ObjectUtils\"\nimport { TypeORMError } from \"../error\"\nimport { DriverUtils } from \"../driver/DriverUtils\"\n\n/**\n * Stores all join attributes which will be used to build a JOIN query.\n */\nexport class JoinAttribute {\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Join direction.\n */\n direction: \"LEFT\" | \"INNER\"\n\n /**\n * Alias of the joined (destination) table.\n */\n alias: Alias\n\n /**\n * Joined table, entity target, or relation in \"post.category\" format.\n */\n entityOrProperty: Function | string\n\n /**\n * Extra condition applied to \"ON\" section of join.\n */\n condition?: string\n\n /**\n * Property + alias of the object where to joined data should be mapped.\n */\n mapToProperty?: string\n\n /**\n * Indicates if user maps one or many objects from the join.\n */\n isMappingMany?: boolean\n\n /**\n * Useful when the joined expression is a custom query to support mapping.\n */\n mapAsEntity?: Function | string\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(\n private connection: DataSource,\n private queryExpressionMap: QueryExpressionMap,\n joinAttribute?: JoinAttribute,\n ) {\n ObjectUtils.assign(this, joinAttribute || {})\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n get isMany(): boolean {\n if (this.isMappingMany !== undefined) return this.isMappingMany\n\n if (this.relation)\n return this.relation.isManyToMany || this.relation.isOneToMany\n\n return false\n }\n\n isSelectedCache: boolean\n isSelectedEvaluated: boolean = false\n /**\n * Indicates if this join is selected.\n */\n get isSelected(): boolean {\n if (!this.isSelectedEvaluated) {\n let getValue = () => {\n for (const select of this.queryExpressionMap.selects) {\n if (select.selection === this.alias.name) return true\n\n if (\n this.metadata &&\n !!this.metadata.columns.find(\n (column) =>\n select.selection ===\n this.alias.name + \".\" + column.propertyPath,\n )\n )\n return true\n }\n\n return false\n }\n this.isSelectedCache = getValue()\n this.isSelectedEvaluated = true\n }\n return this.isSelectedCache\n }\n\n /**\n * Name of the table which we should join.\n */\n get tablePath(): string {\n return this.metadata\n ? this.metadata.tablePath\n : (this.entityOrProperty as string)\n }\n\n /**\n * Alias of the parent of this join.\n * For example, if we join (\"post.category\", \"categoryAlias\") then \"post\" is a parent alias.\n * This value is extracted from entityOrProperty value.\n * This is available when join was made using \"post.category\" syntax.\n */\n get parentAlias(): string | undefined {\n if (!QueryBuilderUtils.isAliasProperty(this.entityOrProperty))\n return undefined\n\n return this.entityOrProperty.substr(\n 0,\n this.entityOrProperty.indexOf(\".\"),\n )\n }\n\n /**\n * Relation property name of the parent.\n * This is used to understand what is joined.\n * For example, if we join (\"post.category\", \"categoryAlias\") then \"category\" is a relation property.\n * This value is extracted from entityOrProperty value.\n * This is available when join was made using \"post.category\" syntax.\n */\n get relationPropertyPath(): string | undefined {\n if (!QueryBuilderUtils.isAliasProperty(this.entityOrProperty))\n return undefined\n\n return this.entityOrProperty.substr(\n this.entityOrProperty.indexOf(\".\") + 1,\n )\n }\n\n relationCache: RelationMetadata | undefined\n relationEvaluated: boolean = false\n /**\n * Relation of the parent.\n * This is used to understand what is joined.\n * This is available when join was made using \"post.category\" syntax.\n * Relation can be undefined if entityOrProperty is regular entity or custom table.\n */\n get relation(): RelationMetadata | undefined {\n if (!this.relationEvaluated) {\n let getValue = () => {\n if (!QueryBuilderUtils.isAliasProperty(this.entityOrProperty))\n return undefined\n\n const relationOwnerSelection =\n this.queryExpressionMap.findAliasByName(this.parentAlias!)\n let relation =\n relationOwnerSelection.metadata.findRelationWithPropertyPath(\n this.relationPropertyPath!,\n )\n\n if (relation) {\n return relation\n }\n\n if (relationOwnerSelection.metadata.parentEntityMetadata) {\n relation =\n relationOwnerSelection.metadata.parentEntityMetadata.findRelationWithPropertyPath(\n this.relationPropertyPath!,\n )\n if (relation) {\n return relation\n }\n }\n\n throw new TypeORMError(\n `Relation with property path ${this.relationPropertyPath} in entity was not found.`,\n )\n }\n this.relationCache = getValue.bind(this)()\n this.relationEvaluated = true\n }\n return this.relationCache\n }\n\n /**\n * Metadata of the joined entity.\n * If table without entity was joined, then it will return undefined.\n */\n get metadata(): EntityMetadata | undefined {\n // entityOrProperty is relation, e.g. \"post.category\"\n if (this.relation) return this.relation.inverseEntityMetadata\n\n // entityOrProperty is Entity class\n if (this.connection.hasMetadata(this.entityOrProperty))\n return this.connection.getMetadata(this.entityOrProperty)\n\n // Overriden mapping entity provided for leftJoinAndMapOne with custom query builder\n if (this.mapAsEntity && this.connection.hasMetadata(this.mapAsEntity)) {\n return this.connection.getMetadata(this.mapAsEntity)\n }\n\n return undefined\n\n /*if (typeof this.entityOrProperty === \"string\") { // entityOrProperty is a custom table\n\n // first try to find entity with such name, this is needed when entity does not have a target class,\n // and its target is a string name (scenario when plain old javascript is used or entity schema is loaded from files)\n const metadata = this.connection.entityMetadatas.find(metadata => metadata.name === this.entityOrProperty);\n if (metadata)\n return metadata;\n\n // check if we have entity with such table name, and use its metadata if found\n return this.connection.entityMetadatas.find(metadata => metadata.tableName === this.entityOrProperty);\n }*/\n }\n\n /**\n * Generates alias of junction table, whose ids we get.\n */\n get junctionAlias(): string {\n if (!this.relation)\n throw new TypeORMError(\n `Cannot get junction table for join without relation.`,\n )\n\n if (this.relation.isOwning) {\n return DriverUtils.buildAlias(\n this.connection.driver,\n this.parentAlias!,\n this.alias.name,\n )\n } else {\n return DriverUtils.buildAlias(\n this.connection.driver,\n this.alias.name,\n this.parentAlias!,\n )\n }\n }\n\n get mapToPropertyParentAlias(): string | undefined {\n if (!this.mapToProperty) return undefined\n\n return this.mapToProperty!.split(\".\")[0]\n }\n\n get mapToPropertyPropertyName(): string | undefined {\n if (!this.mapToProperty) return undefined\n\n return this.mapToProperty!.split(\".\")[1]\n }\n}\n"],"sourceRoot":".."}
|
|
1
|
+
{"version":3,"sources":["../../src/query-builder/JoinAttribute.ts"],"names":[],"mappings":";;;AAGA,2DAAuD;AAGvD,qDAAiD;AACjD,oCAAuC;AACvC,uDAAmD;AAEnD;;GAEG;AACH,MAAa,aAAa;IAmCtB,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YACY,UAAsB,EACtB,kBAAsC,EAC9C,aAA6B;QAFrB,eAAU,GAAV,UAAU,CAAY;QACtB,uBAAkB,G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C;IAED,IAAI,wBAAwB;QACxB,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,OAAO,SAAS,CAAA;QAEzC,OAAO,IAAI,CAAC,aAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC5C,CAAC;IAED,IAAI,yBAAyB;QACzB,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,OAAO,SAAS,CAAA;QAEzC,OAAO,IAAI,CAAC,aAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC5C,CAAC;CACJ;AA9OD,sCA8OC","file":"JoinAttribute.js","sourcesContent":["import { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { DataSource } from \"../data-source/DataSource\"\nimport { RelationMetadata } from \"../metadata/RelationMetadata\"\nimport { QueryBuilderUtils } from \"./QueryBuilderUtils\"\nimport { QueryExpressionMap } from \"./QueryExpressionMap\"\nimport { Alias } from \"./Alias\"\nimport { ObjectUtils } from \"../util/ObjectUtils\"\nimport { TypeORMError } from \"../error\"\nimport { DriverUtils } from \"../driver/DriverUtils\"\n\n/**\n * Stores all join attributes which will be used to build a JOIN query.\n */\nexport class JoinAttribute {\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Join direction.\n */\n direction: \"LEFT\" | \"INNER\"\n\n /**\n * Alias of the joined (destination) table.\n */\n alias: Alias\n\n /**\n * Joined table, entity target, or relation in \"post.category\" format.\n */\n entityOrProperty: Function | string\n\n /**\n * Extra condition applied to \"ON\" section of join.\n */\n condition?: string\n\n /**\n * Property + alias of the object where to joined data should be mapped.\n */\n mapToProperty?: string\n\n /**\n * Indicates if user maps one or many objects from the join.\n */\n isMappingMany?: boolean\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(\n private connection: DataSource,\n private queryExpressionMap: QueryExpressionMap,\n joinAttribute?: JoinAttribute,\n ) {\n ObjectUtils.assign(this, joinAttribute || {})\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n get isMany(): boolean {\n if (this.isMappingMany !== undefined) return this.isMappingMany\n\n if (this.relation)\n return this.relation.isManyToMany || this.relation.isOneToMany\n\n return false\n }\n\n isSelectedCache: boolean\n isSelectedEvaluated: boolean = false\n /**\n * Indicates if this join is selected.\n */\n get isSelected(): boolean {\n if (!this.isSelectedEvaluated) {\n let getValue = () => {\n for (const select of this.queryExpressionMap.selects) {\n if (select.selection === this.alias.name) return true\n\n if (\n this.metadata &&\n !!this.metadata.columns.find(\n (column) =>\n select.selection ===\n this.alias.name + \".\" + column.propertyPath,\n )\n )\n return true\n }\n\n return false\n }\n this.isSelectedCache = getValue()\n this.isSelectedEvaluated = true\n }\n return this.isSelectedCache\n }\n\n /**\n * Name of the table which we should join.\n */\n get tablePath(): string {\n return this.metadata\n ? this.metadata.tablePath\n : (this.entityOrProperty as string)\n }\n\n /**\n * Alias of the parent of this join.\n * For example, if we join (\"post.category\", \"categoryAlias\") then \"post\" is a parent alias.\n * This value is extracted from entityOrProperty value.\n * This is available when join was made using \"post.category\" syntax.\n */\n get parentAlias(): string | undefined {\n if (!QueryBuilderUtils.isAliasProperty(this.entityOrProperty))\n return undefined\n\n return this.entityOrProperty.substr(\n 0,\n this.entityOrProperty.indexOf(\".\"),\n )\n }\n\n /**\n * Relation property name of the parent.\n * This is used to understand what is joined.\n * For example, if we join (\"post.category\", \"categoryAlias\") then \"category\" is a relation property.\n * This value is extracted from entityOrProperty value.\n * This is available when join was made using \"post.category\" syntax.\n */\n get relationPropertyPath(): string | undefined {\n if (!QueryBuilderUtils.isAliasProperty(this.entityOrProperty))\n return undefined\n\n return this.entityOrProperty.substr(\n this.entityOrProperty.indexOf(\".\") + 1,\n )\n }\n\n relationCache: RelationMetadata | undefined\n relationEvaluated: boolean = false\n /**\n * Relation of the parent.\n * This is used to understand what is joined.\n * This is available when join was made using \"post.category\" syntax.\n * Relation can be undefined if entityOrProperty is regular entity or custom table.\n */\n get relation(): RelationMetadata | undefined {\n if (!this.relationEvaluated) {\n let getValue = () => {\n if (!QueryBuilderUtils.isAliasProperty(this.entityOrProperty))\n return undefined\n\n const relationOwnerSelection =\n this.queryExpressionMap.findAliasByName(this.parentAlias!)\n let relation =\n relationOwnerSelection.metadata.findRelationWithPropertyPath(\n this.relationPropertyPath!,\n )\n\n if (relation) {\n return relation\n }\n\n if (relationOwnerSelection.metadata.parentEntityMetadata) {\n relation =\n relationOwnerSelection.metadata.parentEntityMetadata.findRelationWithPropertyPath(\n this.relationPropertyPath!,\n )\n if (relation) {\n return relation\n }\n }\n\n throw new TypeORMError(\n `Relation with property path ${this.relationPropertyPath} in entity was not found.`,\n )\n }\n this.relationCache = getValue.bind(this)()\n this.relationEvaluated = true\n }\n return this.relationCache\n }\n\n /**\n * Metadata of the joined entity.\n * If table without entity was joined, then it will return undefined.\n */\n get metadata(): EntityMetadata | undefined {\n // entityOrProperty is relation, e.g. \"post.category\"\n if (this.relation) return this.relation.inverseEntityMetadata\n\n // entityOrProperty is Entity class\n if (this.connection.hasMetadata(this.entityOrProperty))\n return this.connection.getMetadata(this.entityOrProperty)\n\n return undefined\n\n /*if (typeof this.entityOrProperty === \"string\") { // entityOrProperty is a custom table\n\n // first try to find entity with such name, this is needed when entity does not have a target class,\n // and its target is a string name (scenario when plain old javascript is used or entity schema is loaded from files)\n const metadata = this.connection.entityMetadatas.find(metadata => metadata.name === this.entityOrProperty);\n if (metadata)\n return metadata;\n\n // check if we have entity with such table name, and use its metadata if found\n return this.connection.entityMetadatas.find(metadata => metadata.tableName === this.entityOrProperty);\n }*/\n }\n\n /**\n * Generates alias of junction table, whose ids we get.\n */\n get junctionAlias(): string {\n if (!this.relation)\n throw new TypeORMError(\n `Cannot get junction table for join without relation.`,\n )\n\n if (this.relation.isOwning) {\n return DriverUtils.buildAlias(\n this.connection.driver,\n this.parentAlias!,\n this.alias.name,\n )\n } else {\n return DriverUtils.buildAlias(\n this.connection.driver,\n this.alias.name,\n this.parentAlias!,\n )\n }\n }\n\n get mapToPropertyParentAlias(): string | undefined {\n if (!this.mapToProperty) return undefined\n\n return this.mapToProperty!.split(\".\")[0]\n }\n\n get mapToPropertyPropertyName(): string | undefined {\n if (!this.mapToProperty) return undefined\n\n return this.mapToProperty!.split(\".\")[1]\n }\n}\n"],"sourceRoot":".."}
|
|
@@ -258,7 +258,7 @@ export declare class SelectQueryBuilder<Entity extends ObjectLiteral> extends Qu
|
|
|
258
258
|
* You also need to specify an alias of the joined data.
|
|
259
259
|
* Optionally, you can add condition and parameters used in condition.
|
|
260
260
|
*/
|
|
261
|
-
innerJoinAndMapOne(mapToProperty: string, subQueryFactory: (qb: SelectQueryBuilder<any>) => SelectQueryBuilder<any>, alias: string, condition?: string, parameters?: ObjectLiteral
|
|
261
|
+
innerJoinAndMapOne(mapToProperty: string, subQueryFactory: (qb: SelectQueryBuilder<any>) => SelectQueryBuilder<any>, alias: string, condition?: string, parameters?: ObjectLiteral): this;
|
|
262
262
|
/**
|
|
263
263
|
* INNER JOINs entity's property, SELECTs the data returned by a join and MAPs all that data to some entity's property.
|
|
264
264
|
* This is extremely useful when you want to select some data and map it to some virtual property.
|
|
@@ -326,7 +326,7 @@ export declare class SelectQueryBuilder<Entity extends ObjectLiteral> extends Qu
|
|
|
326
326
|
* You also need to specify an alias of the joined data.
|
|
327
327
|
* Optionally, you can add condition and parameters used in condition.
|
|
328
328
|
*/
|
|
329
|
-
leftJoinAndMapOne(mapToProperty: string, subQueryFactory: (qb: SelectQueryBuilder<any>) => SelectQueryBuilder<any>, alias: string, condition?: string, parameters?: ObjectLiteral
|
|
329
|
+
leftJoinAndMapOne(mapToProperty: string, subQueryFactory: (qb: SelectQueryBuilder<any>) => SelectQueryBuilder<any>, alias: string, condition?: string, parameters?: ObjectLiteral): this;
|
|
330
330
|
/**
|
|
331
331
|
* LEFT JOINs entity's property, SELECTs the data returned by a join and MAPs all that data to some entity's property.
|
|
332
332
|
* This is extremely useful when you want to select some data and map it to some virtual property.
|
|
@@ -610,7 +610,7 @@ export declare class SelectQueryBuilder<Entity extends ObjectLiteral> extends Qu
|
|
|
610
610
|
* Sets extra options that can be used to configure how query builder works.
|
|
611
611
|
*/
|
|
612
612
|
setOption(option: SelectQueryBuilderOption): this;
|
|
613
|
-
protected join(direction: "INNER" | "LEFT", entityOrProperty: Function | string | ((qb: SelectQueryBuilder<any>) => SelectQueryBuilder<any>), aliasName: string, condition?: string, parameters?: ObjectLiteral, mapToProperty?: string, isMappingMany?: boolean
|
|
613
|
+
protected join(direction: "INNER" | "LEFT", entityOrProperty: Function | string | ((qb: SelectQueryBuilder<any>) => SelectQueryBuilder<any>), aliasName: string, condition?: string, parameters?: ObjectLiteral, mapToProperty?: string, isMappingMany?: boolean): void;
|
|
614
614
|
/**
|
|
615
615
|
* Creates "SELECT FROM" part of SQL query.
|
|
616
616
|
*/
|
|
@@ -658,7 +658,6 @@ export declare class SelectQueryBuilder<Entity extends ObjectLiteral> extends Qu
|
|
|
658
658
|
protected executeCountQuery(queryRunner: QueryRunner): Promise<number>;
|
|
659
659
|
protected executeExistsQuery(queryRunner: QueryRunner): Promise<boolean>;
|
|
660
660
|
protected applyFindOptions(): void;
|
|
661
|
-
concatRelationMetadata(relationMetadata: RelationMetadata): void;
|
|
662
661
|
/**
|
|
663
662
|
* Executes sql generated by query builder and returns object with raw results and entities created from them.
|
|
664
663
|
*/
|
|
@@ -21,11 +21,10 @@ const DriverUtils_1 = require("../driver/DriverUtils");
|
|
|
21
21
|
const EntityNotFoundError_1 = require("../error/EntityNotFoundError");
|
|
22
22
|
const error_1 = require("../error");
|
|
23
23
|
const FindOptionsUtils_1 = require("../find-options/FindOptionsUtils");
|
|
24
|
+
const ApplyValueTransformers_1 = require("../util/ApplyValueTransformers");
|
|
24
25
|
const OrmUtils_1 = require("../util/OrmUtils");
|
|
25
26
|
const EntityPropertyNotFoundError_1 = require("../error/EntityPropertyNotFoundError");
|
|
26
27
|
const InstanceChecker_1 = require("../util/InstanceChecker");
|
|
27
|
-
const FindOperator_1 = require("../find-options/FindOperator");
|
|
28
|
-
const ApplyValueTransformers_1 = require("../util/ApplyValueTransformers");
|
|
29
28
|
/**
|
|
30
29
|
* Allows to build complex sql queries in a fashion way and execute those queries.
|
|
31
30
|
*/
|
|
@@ -233,9 +232,9 @@ class SelectQueryBuilder extends QueryBuilder_1.QueryBuilder {
|
|
|
233
232
|
* You also need to specify an alias of the joined data.
|
|
234
233
|
* Optionally, you can add condition and parameters used in condition.
|
|
235
234
|
*/
|
|
236
|
-
innerJoinAndMapOne(mapToProperty, entityOrProperty, alias, condition, parameters
|
|
235
|
+
innerJoinAndMapOne(mapToProperty, entityOrProperty, alias, condition, parameters) {
|
|
237
236
|
this.addSelect(alias);
|
|
238
|
-
this.join("INNER", entityOrProperty, alias, condition, parameters, mapToProperty, false
|
|
237
|
+
this.join("INNER", entityOrProperty, alias, condition, parameters, mapToProperty, false);
|
|
239
238
|
return this;
|
|
240
239
|
}
|
|
241
240
|
/**
|
|
@@ -257,9 +256,9 @@ class SelectQueryBuilder extends QueryBuilder_1.QueryBuilder {
|
|
|
257
256
|
* You also need to specify an alias of the joined data.
|
|
258
257
|
* Optionally, you can add condition and parameters used in condition.
|
|
259
258
|
*/
|
|
260
|
-
leftJoinAndMapOne(mapToProperty, entityOrProperty, alias, condition, parameters
|
|
259
|
+
leftJoinAndMapOne(mapToProperty, entityOrProperty, alias, condition, parameters) {
|
|
261
260
|
this.addSelect(alias);
|
|
262
|
-
this.join("LEFT", entityOrProperty, alias, condition, parameters, mapToProperty, false
|
|
261
|
+
this.join("LEFT", entityOrProperty, alias, condition, parameters, mapToProperty, false);
|
|
263
262
|
return this;
|
|
264
263
|
}
|
|
265
264
|
/**
|
|
@@ -945,11 +944,10 @@ class SelectQueryBuilder extends QueryBuilder_1.QueryBuilder {
|
|
|
945
944
|
// -------------------------------------------------------------------------
|
|
946
945
|
// Protected Methods
|
|
947
946
|
// -------------------------------------------------------------------------
|
|
948
|
-
join(direction, entityOrProperty, aliasName, condition, parameters, mapToProperty, isMappingMany
|
|
947
|
+
join(direction, entityOrProperty, aliasName, condition, parameters, mapToProperty, isMappingMany) {
|
|
949
948
|
this.setParameters(parameters || {});
|
|
950
949
|
const joinAttribute = new JoinAttribute_1.JoinAttribute(this.connection, this.expressionMap);
|
|
951
950
|
joinAttribute.direction = direction;
|
|
952
|
-
joinAttribute.mapAsEntity = mapAsEntity;
|
|
953
951
|
joinAttribute.mapToProperty = mapToProperty;
|
|
954
952
|
joinAttribute.isMappingMany = isMappingMany;
|
|
955
953
|
joinAttribute.entityOrProperty = entityOrProperty; // relationName
|
|
@@ -1903,9 +1901,6 @@ class SelectQueryBuilder extends QueryBuilder_1.QueryBuilder {
|
|
|
1903
1901
|
// }
|
|
1904
1902
|
}
|
|
1905
1903
|
}
|
|
1906
|
-
concatRelationMetadata(relationMetadata) {
|
|
1907
|
-
this.relationMetadatas.push(relationMetadata);
|
|
1908
|
-
}
|
|
1909
1904
|
/**
|
|
1910
1905
|
* Executes sql generated by query builder and returns object with raw results and entities created from them.
|
|
1911
1906
|
*/
|
|
@@ -2258,7 +2253,7 @@ class SelectQueryBuilder extends QueryBuilder_1.QueryBuilder {
|
|
|
2258
2253
|
if (relationValue === true ||
|
|
2259
2254
|
typeof relationValue === "object") {
|
|
2260
2255
|
if (this.expressionMap.relationLoadStrategy === "query") {
|
|
2261
|
-
this.
|
|
2256
|
+
this.relationMetadatas.push(relation);
|
|
2262
2257
|
}
|
|
2263
2258
|
else {
|
|
2264
2259
|
// join
|
|
@@ -2446,10 +2441,7 @@ class SelectQueryBuilder extends QueryBuilder_1.QueryBuilder {
|
|
|
2446
2441
|
parameterValue = where[key].value;
|
|
2447
2442
|
}
|
|
2448
2443
|
if (column.transformer) {
|
|
2449
|
-
parameterValue
|
|
2450
|
-
? parameterValue.transformValue(column.transformer)
|
|
2451
|
-
: (parameterValue =
|
|
2452
|
-
ApplyValueTransformers_1.ApplyValueTransformers.transformTo(column.transformer, parameterValue));
|
|
2444
|
+
parameterValue = ApplyValueTransformers_1.ApplyValueTransformers.transformTo(column.transformer, parameterValue);
|
|
2453
2445
|
}
|
|
2454
2446
|
// if (parameterValue === null) {
|
|
2455
2447
|
// andConditions.push(`${aliasPath} IS NULL`);
|