taon-typeorm 18.0.18 → 18.0.20
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/assets/shared/shared_folder_info.txt +1 -1
- package/browser/README.md +24 -24
- package/browser/esm2022/lib/typeorm/driver/cordova/CordovaDriver.mjs +1 -1
- package/browser/esm2022/lib/typeorm/driver/cordova/CordovaQueryRunner.mjs +1 -1
- package/browser/esm2022/lib/typeorm/driver/nativescript/NativescriptDriver.mjs +1 -1
- package/browser/esm2022/lib/typeorm/driver/nativescript/NativescriptQueryRunner.mjs +1 -1
- package/browser/esm2022/lib/typeorm/driver/react-native/ReactNativeDriver.mjs +1 -1
- package/browser/esm2022/lib/typeorm/driver/react-native/ReactNativeQueryRunner.mjs +1 -1
- package/browser/esm2022/lib/typeorm/driver/sqljs/SqljsDriver.mjs +1 -1
- package/browser/esm2022/lib/typeorm/driver/sqljs/SqljsQueryRunner.mjs +1 -1
- package/browser/esm2022/lib/typeorm/index.mjs +1 -3
- package/browser/fesm2022/taon-typeorm.mjs.map +1 -1
- package/client/README.md +24 -24
- package/client/esm2022/lib/typeorm/driver/cordova/CordovaDriver.mjs +1 -1
- package/client/esm2022/lib/typeorm/driver/cordova/CordovaQueryRunner.mjs +1 -1
- package/client/esm2022/lib/typeorm/driver/nativescript/NativescriptDriver.mjs +1 -1
- package/client/esm2022/lib/typeorm/driver/nativescript/NativescriptQueryRunner.mjs +1 -1
- package/client/esm2022/lib/typeorm/driver/react-native/ReactNativeDriver.mjs +1 -1
- package/client/esm2022/lib/typeorm/driver/react-native/ReactNativeQueryRunner.mjs +1 -1
- package/client/esm2022/lib/typeorm/driver/sqljs/SqljsDriver.mjs +1 -1
- package/client/esm2022/lib/typeorm/driver/sqljs/SqljsQueryRunner.mjs +1 -1
- package/client/esm2022/lib/typeorm/index.mjs +1 -3
- package/client/fesm2022/taon-typeorm.mjs.map +1 -1
- package/index.js +15 -2
- package/index.js.map +1 -1
- package/lib/build-info._auto-generated_.js.map +1 -1
- package/lib/index._auto-generated_.d.ts +1 -0
- package/lib/index._auto-generated_.js.map +1 -1
- package/lib/index.js +15 -2
- package/lib/index.js.map +1 -1
- package/lib/typeorm/cache/DbQueryResultCache.js +178 -231
- package/lib/typeorm/cache/DbQueryResultCache.js.map +1 -1
- package/lib/typeorm/cache/QueryResultCache.js.map +1 -1
- package/lib/typeorm/cache/QueryResultCacheFactory.js +11 -11
- package/lib/typeorm/cache/QueryResultCacheFactory.js.map +1 -1
- package/lib/typeorm/cache/QueryResultCacheOptions.js.map +1 -1
- package/lib/typeorm/cache/RedisQueryResultCache.js +121 -149
- package/lib/typeorm/cache/RedisQueryResultCache.js.map +1 -1
- package/lib/typeorm/cli-ts-node-commonjs.js.map +1 -1
- package/lib/typeorm/cli-ts-node-esm.js +7 -5
- package/lib/typeorm/cli-ts-node-esm.js.map +1 -1
- package/lib/typeorm/cli.d.ts +1 -1
- package/lib/typeorm/cli.js +15 -16
- package/lib/typeorm/cli.js.map +1 -1
- package/lib/typeorm/commands/CacheClearCommand.js +37 -65
- package/lib/typeorm/commands/CacheClearCommand.js.map +1 -1
- package/lib/typeorm/commands/CommandUtils.js +57 -112
- package/lib/typeorm/commands/CommandUtils.js.map +1 -1
- package/lib/typeorm/commands/EntityCreateCommand.js +35 -47
- package/lib/typeorm/commands/EntityCreateCommand.js.map +1 -1
- package/lib/typeorm/commands/InitCommand.js +397 -168
- package/lib/typeorm/commands/InitCommand.js.map +1 -1
- package/lib/typeorm/commands/MigrationCreateCommand.js +58 -52
- package/lib/typeorm/commands/MigrationCreateCommand.js.map +1 -1
- package/lib/typeorm/commands/MigrationGenerateCommand.js +141 -138
- package/lib/typeorm/commands/MigrationGenerateCommand.js.map +1 -1
- package/lib/typeorm/commands/MigrationRevertCommand.js +49 -77
- package/lib/typeorm/commands/MigrationRevertCommand.js.map +1 -1
- package/lib/typeorm/commands/MigrationRunCommand.js +52 -82
- package/lib/typeorm/commands/MigrationRunCommand.js.map +1 -1
- package/lib/typeorm/commands/MigrationShowCommand.js +32 -60
- package/lib/typeorm/commands/MigrationShowCommand.js.map +1 -1
- package/lib/typeorm/commands/QueryCommand.js +47 -83
- package/lib/typeorm/commands/QueryCommand.js.map +1 -1
- package/lib/typeorm/commands/SchemaDropCommand.js +33 -61
- package/lib/typeorm/commands/SchemaDropCommand.js.map +1 -1
- package/lib/typeorm/commands/SchemaLogCommand.js +57 -81
- package/lib/typeorm/commands/SchemaLogCommand.js.map +1 -1
- package/lib/typeorm/commands/SchemaSyncCommand.js +33 -61
- package/lib/typeorm/commands/SchemaSyncCommand.js.map +1 -1
- package/lib/typeorm/commands/SubscriberCreateCommand.js +35 -47
- package/lib/typeorm/commands/SubscriberCreateCommand.js.map +1 -1
- package/lib/typeorm/commands/VersionCommand.js +38 -54
- package/lib/typeorm/commands/VersionCommand.js.map +1 -1
- package/lib/typeorm/common/DeepPartial.js.map +1 -1
- package/lib/typeorm/common/EntityTarget.js.map +1 -1
- package/lib/typeorm/common/MixedList.js.map +1 -1
- package/lib/typeorm/common/NonNever.js.map +1 -1
- package/lib/typeorm/common/ObjectLiteral.js.map +1 -1
- package/lib/typeorm/common/ObjectType.js.map +1 -1
- package/lib/typeorm/common/RelationType.js.map +1 -1
- package/lib/typeorm/connection/BaseConnectionOptions.js.map +1 -1
- package/lib/typeorm/connection/Connection.js +3 -9
- package/lib/typeorm/connection/Connection.js.map +1 -1
- package/lib/typeorm/connection/ConnectionManager.js +23 -31
- package/lib/typeorm/connection/ConnectionManager.js.map +1 -1
- package/lib/typeorm/connection/ConnectionMetadataBuilder.js +48 -78
- package/lib/typeorm/connection/ConnectionMetadataBuilder.js.map +1 -1
- package/lib/typeorm/connection/ConnectionOptions.js.map +1 -1
- package/lib/typeorm/connection/ConnectionOptionsReader.js +146 -214
- package/lib/typeorm/connection/ConnectionOptionsReader.js.map +1 -1
- package/lib/typeorm/connection/options-reader/ConnectionOptionsEnvReader.js +50 -58
- package/lib/typeorm/connection/options-reader/ConnectionOptionsEnvReader.js.map +1 -1
- package/lib/typeorm/connection/options-reader/ConnectionOptionsXmlReader.js +45 -58
- package/lib/typeorm/connection/options-reader/ConnectionOptionsXmlReader.js.map +1 -1
- package/lib/typeorm/connection/options-reader/ConnectionOptionsYmlReader.js +14 -23
- package/lib/typeorm/connection/options-reader/ConnectionOptionsYmlReader.js.map +1 -1
- package/lib/typeorm/constants.js.map +1 -1
- package/lib/typeorm/container.js +9 -12
- package/lib/typeorm/container.js.map +1 -1
- package/lib/typeorm/data-source/BaseDataSourceOptions.js.map +1 -1
- package/lib/typeorm/data-source/DataSource.js +320 -478
- package/lib/typeorm/data-source/DataSource.js.map +1 -1
- package/lib/typeorm/data-source/DataSourceOptions.js.map +1 -1
- package/lib/typeorm/data-source/index.js +16 -3
- package/lib/typeorm/data-source/index.js.map +1 -1
- package/lib/typeorm/decorator/Check.js +5 -5
- package/lib/typeorm/decorator/Check.js.map +1 -1
- package/lib/typeorm/decorator/EntityRepository.js +1 -1
- package/lib/typeorm/decorator/EntityRepository.js.map +1 -1
- package/lib/typeorm/decorator/Exclusion.js +5 -5
- package/lib/typeorm/decorator/Exclusion.js.map +1 -1
- package/lib/typeorm/decorator/Generated.js +2 -3
- package/lib/typeorm/decorator/Generated.js.map +1 -1
- package/lib/typeorm/decorator/Index.js +5 -5
- package/lib/typeorm/decorator/Index.js.map +1 -1
- package/lib/typeorm/decorator/Unique.js +8 -8
- package/lib/typeorm/decorator/Unique.js.map +1 -1
- package/lib/typeorm/decorator/columns/Column.js +4 -4
- package/lib/typeorm/decorator/columns/Column.js.map +1 -1
- package/lib/typeorm/decorator/columns/CreateDateColumn.js +1 -1
- package/lib/typeorm/decorator/columns/CreateDateColumn.js.map +1 -1
- package/lib/typeorm/decorator/columns/DeleteDateColumn.js +1 -1
- package/lib/typeorm/decorator/columns/DeleteDateColumn.js.map +1 -1
- package/lib/typeorm/decorator/columns/ObjectIdColumn.js +1 -1
- package/lib/typeorm/decorator/columns/ObjectIdColumn.js.map +1 -1
- package/lib/typeorm/decorator/columns/PrimaryColumn.js +5 -5
- package/lib/typeorm/decorator/columns/PrimaryColumn.js.map +1 -1
- package/lib/typeorm/decorator/columns/PrimaryGeneratedColumn.js +4 -4
- package/lib/typeorm/decorator/columns/PrimaryGeneratedColumn.js.map +1 -1
- package/lib/typeorm/decorator/columns/UpdateDateColumn.js +1 -1
- package/lib/typeorm/decorator/columns/UpdateDateColumn.js.map +1 -1
- package/lib/typeorm/decorator/columns/VersionColumn.js +1 -1
- package/lib/typeorm/decorator/columns/VersionColumn.js.map +1 -1
- package/lib/typeorm/decorator/columns/ViewColumn.js +1 -1
- package/lib/typeorm/decorator/columns/ViewColumn.js.map +1 -1
- package/lib/typeorm/decorator/columns/VirtualColumn.js +5 -5
- package/lib/typeorm/decorator/columns/VirtualColumn.js.map +1 -1
- package/lib/typeorm/decorator/entity/ChildEntity.js +1 -1
- package/lib/typeorm/decorator/entity/ChildEntity.js.map +1 -1
- package/lib/typeorm/decorator/entity/Entity.js +4 -4
- package/lib/typeorm/decorator/entity/Entity.js.map +1 -1
- package/lib/typeorm/decorator/entity/TableInheritance.js +1 -1
- package/lib/typeorm/decorator/entity/TableInheritance.js.map +1 -1
- package/lib/typeorm/decorator/entity-view/ViewEntity.js +4 -4
- package/lib/typeorm/decorator/entity-view/ViewEntity.js.map +1 -1
- package/lib/typeorm/decorator/listeners/AfterInsert.js +2 -2
- package/lib/typeorm/decorator/listeners/AfterInsert.js.map +1 -1
- package/lib/typeorm/decorator/listeners/AfterLoad.js +2 -2
- package/lib/typeorm/decorator/listeners/AfterLoad.js.map +1 -1
- package/lib/typeorm/decorator/listeners/AfterRecover.js +2 -2
- package/lib/typeorm/decorator/listeners/AfterRecover.js.map +1 -1
- package/lib/typeorm/decorator/listeners/AfterRemove.js +2 -2
- package/lib/typeorm/decorator/listeners/AfterRemove.js.map +1 -1
- package/lib/typeorm/decorator/listeners/AfterSoftRemove.js +2 -2
- package/lib/typeorm/decorator/listeners/AfterSoftRemove.js.map +1 -1
- package/lib/typeorm/decorator/listeners/AfterUpdate.js +2 -2
- package/lib/typeorm/decorator/listeners/AfterUpdate.js.map +1 -1
- package/lib/typeorm/decorator/listeners/BeforeInsert.js +2 -2
- package/lib/typeorm/decorator/listeners/BeforeInsert.js.map +1 -1
- package/lib/typeorm/decorator/listeners/BeforeRecover.js +2 -2
- package/lib/typeorm/decorator/listeners/BeforeRecover.js.map +1 -1
- package/lib/typeorm/decorator/listeners/BeforeRemove.js +2 -2
- package/lib/typeorm/decorator/listeners/BeforeRemove.js.map +1 -1
- package/lib/typeorm/decorator/listeners/BeforeSoftRemove.js +2 -2
- package/lib/typeorm/decorator/listeners/BeforeSoftRemove.js.map +1 -1
- package/lib/typeorm/decorator/listeners/BeforeUpdate.js +2 -2
- package/lib/typeorm/decorator/listeners/BeforeUpdate.js.map +1 -1
- package/lib/typeorm/decorator/listeners/EventSubscriber.js +1 -1
- package/lib/typeorm/decorator/listeners/EventSubscriber.js.map +1 -1
- package/lib/typeorm/decorator/options/ColumnCommonOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/ColumnEmbeddedOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/ColumnEnumOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/ColumnHstoreOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/ColumnNumericOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/ColumnOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/ColumnWithLengthOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/ColumnWithWidthOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/EntityOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/IndexOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/JoinColumnOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/JoinTableMultipleColumnsOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/JoinTableOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/PrimaryGeneratedColumnIdentityOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/PrimaryGeneratedColumnNumericOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/PrimaryGeneratedColumnUUIDOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/RelationOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/SpatialColumnOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/TransactionOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/UniqueOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/ValueTransformer.js.map +1 -1
- package/lib/typeorm/decorator/options/ViewColumnOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/ViewEntityOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/VirtualColumnOptions.js.map +1 -1
- package/lib/typeorm/decorator/relations/JoinColumn.js +3 -3
- package/lib/typeorm/decorator/relations/JoinColumn.js.map +1 -1
- package/lib/typeorm/decorator/relations/JoinTable.js +1 -1
- package/lib/typeorm/decorator/relations/JoinTable.js.map +1 -1
- package/lib/typeorm/decorator/relations/ManyToMany.js +5 -5
- package/lib/typeorm/decorator/relations/ManyToMany.js.map +1 -1
- package/lib/typeorm/decorator/relations/ManyToOne.js +5 -5
- package/lib/typeorm/decorator/relations/ManyToOne.js.map +1 -1
- package/lib/typeorm/decorator/relations/OneToMany.js +3 -3
- package/lib/typeorm/decorator/relations/OneToMany.js.map +1 -1
- package/lib/typeorm/decorator/relations/OneToOne.js +5 -5
- package/lib/typeorm/decorator/relations/OneToOne.js.map +1 -1
- package/lib/typeorm/decorator/relations/RelationCount.js +1 -1
- package/lib/typeorm/decorator/relations/RelationCount.js.map +1 -1
- package/lib/typeorm/decorator/relations/RelationId.js +1 -1
- package/lib/typeorm/decorator/relations/RelationId.js.map +1 -1
- package/lib/typeorm/decorator/tree/Tree.js +1 -1
- package/lib/typeorm/decorator/tree/Tree.js.map +1 -1
- package/lib/typeorm/decorator/tree/TreeChildren.js +4 -4
- package/lib/typeorm/decorator/tree/TreeChildren.js.map +1 -1
- package/lib/typeorm/decorator/tree/TreeLevelColumn.js +1 -1
- package/lib/typeorm/decorator/tree/TreeLevelColumn.js.map +1 -1
- package/lib/typeorm/decorator/tree/TreeParent.js +4 -4
- package/lib/typeorm/decorator/tree/TreeParent.js.map +1 -1
- package/lib/typeorm/driver/Driver.js.map +1 -1
- package/lib/typeorm/driver/DriverFactory.js +24 -27
- package/lib/typeorm/driver/DriverFactory.js.map +1 -1
- package/lib/typeorm/driver/DriverUtils.js +78 -126
- package/lib/typeorm/driver/DriverUtils.js.map +1 -1
- package/lib/typeorm/driver/Query.js +6 -5
- package/lib/typeorm/driver/Query.js.map +1 -1
- package/lib/typeorm/driver/SqlInMemory.js +4 -7
- package/lib/typeorm/driver/SqlInMemory.js.map +1 -1
- package/lib/typeorm/driver/aurora-mysql/AuroraMysqlConnection.js +9 -12
- package/lib/typeorm/driver/aurora-mysql/AuroraMysqlConnection.js.map +1 -1
- package/lib/typeorm/driver/aurora-mysql/AuroraMysqlConnectionCredentialsOptions.js.map +1 -1
- package/lib/typeorm/driver/aurora-mysql/AuroraMysqlConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/aurora-mysql/AuroraMysqlDriver.js +392 -399
- package/lib/typeorm/driver/aurora-mysql/AuroraMysqlDriver.js.map +1 -1
- package/lib/typeorm/driver/aurora-mysql/AuroraMysqlQueryRunner.js +1320 -2084
- package/lib/typeorm/driver/aurora-mysql/AuroraMysqlQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/aurora-postgres/AuroraPostgresConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/aurora-postgres/AuroraPostgresDriver.js +50 -78
- package/lib/typeorm/driver/aurora-postgres/AuroraPostgresDriver.js.map +1 -1
- package/lib/typeorm/driver/aurora-postgres/AuroraPostgresQueryRunner.js +89 -160
- package/lib/typeorm/driver/aurora-postgres/AuroraPostgresQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/better-sqlite3/BetterSqlite3ConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/better-sqlite3/BetterSqlite3Driver.js +78 -152
- package/lib/typeorm/driver/better-sqlite3/BetterSqlite3Driver.js.map +1 -1
- package/lib/typeorm/driver/better-sqlite3/BetterSqlite3QueryRunner.js +96 -155
- package/lib/typeorm/driver/better-sqlite3/BetterSqlite3QueryRunner.js.map +1 -1
- package/lib/typeorm/driver/capacitor/CapacitorConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/capacitor/CapacitorDriver.js +44 -89
- package/lib/typeorm/driver/capacitor/CapacitorDriver.js.map +1 -1
- package/lib/typeorm/driver/capacitor/CapacitorQueryRunner.js +70 -122
- package/lib/typeorm/driver/capacitor/CapacitorQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/cockroachdb/CockroachConnectionCredentialsOptions.js.map +1 -1
- package/lib/typeorm/driver/cockroachdb/CockroachConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/cockroachdb/CockroachDriver.js +368 -404
- package/lib/typeorm/driver/cockroachdb/CockroachDriver.js.map +1 -1
- package/lib/typeorm/driver/cockroachdb/CockroachQueryRunner.js +1752 -2862
- package/lib/typeorm/driver/cockroachdb/CockroachQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/cordova/CordovaConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/cordova/CordovaDriver.js +36 -58
- package/lib/typeorm/driver/cordova/CordovaDriver.js.map +1 -1
- package/lib/typeorm/driver/cordova/CordovaQueryRunner.js +86 -164
- package/lib/typeorm/driver/cordova/CordovaQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/expo/ExpoConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/expo/ExpoDriver.js +34 -44
- package/lib/typeorm/driver/expo/ExpoDriver.js.map +1 -1
- package/lib/typeorm/driver/expo/ExpoQueryRunner.js +114 -204
- package/lib/typeorm/driver/expo/ExpoQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/mongodb/MongoConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/mongodb/MongoDriver.js +269 -243
- package/lib/typeorm/driver/mongodb/MongoDriver.js.map +1 -1
- package/lib/typeorm/driver/mongodb/MongoQueryRunner.js +357 -793
- package/lib/typeorm/driver/mongodb/MongoQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/mongodb/typings.js.map +1 -1
- package/lib/typeorm/driver/mysql/MysqlConnectionCredentialsOptions.js.map +1 -1
- package/lib/typeorm/driver/mysql/MysqlConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/mysql/MysqlDriver.js +475 -480
- package/lib/typeorm/driver/mysql/MysqlDriver.js.map +1 -1
- package/lib/typeorm/driver/mysql/MysqlQueryRunner.js +1692 -2466
- package/lib/typeorm/driver/mysql/MysqlQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/nativescript/NativescriptConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/nativescript/NativescriptDriver.js +46 -50
- package/lib/typeorm/driver/nativescript/NativescriptDriver.js.map +1 -1
- package/lib/typeorm/driver/nativescript/NativescriptQueryRunner.js +62 -101
- package/lib/typeorm/driver/nativescript/NativescriptQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/oracle/OracleConnectionCredentialsOptions.js.map +1 -1
- package/lib/typeorm/driver/oracle/OracleConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/oracle/OracleDriver.js +345 -377
- package/lib/typeorm/driver/oracle/OracleDriver.js.map +1 -1
- package/lib/typeorm/driver/oracle/OracleQueryRunner.js +1484 -2384
- package/lib/typeorm/driver/oracle/OracleQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/postgres/PostgresConnectionCredentialsOptions.js.map +1 -1
- package/lib/typeorm/driver/postgres/PostgresConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/postgres/PostgresDriver.js +574 -690
- package/lib/typeorm/driver/postgres/PostgresDriver.js.map +1 -1
- package/lib/typeorm/driver/postgres/PostgresQueryRunner.js +2153 -3379
- package/lib/typeorm/driver/postgres/PostgresQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/react-native/ReactNativeConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/react-native/ReactNativeDriver.js +34 -44
- package/lib/typeorm/driver/react-native/ReactNativeDriver.js.map +1 -1
- package/lib/typeorm/driver/react-native/ReactNativeQueryRunner.js +60 -94
- package/lib/typeorm/driver/react-native/ReactNativeQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/sap/SapConnectionCredentialsOptions.js.map +1 -1
- package/lib/typeorm/driver/sap/SapConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/sap/SapDriver.js +310 -305
- package/lib/typeorm/driver/sap/SapDriver.js.map +1 -1
- package/lib/typeorm/driver/sap/SapQueryRunner.js +1635 -2561
- package/lib/typeorm/driver/sap/SapQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/spanner/SpannerConnectionCredentialsOptions.js.map +1 -1
- package/lib/typeorm/driver/spanner/SpannerConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/spanner/SpannerDriver.js +250 -236
- package/lib/typeorm/driver/spanner/SpannerDriver.js.map +1 -1
- package/lib/typeorm/driver/spanner/SpannerQueryRunner.js +1136 -2168
- package/lib/typeorm/driver/spanner/SpannerQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/sqlite/SqliteConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/sqlite/SqliteDriver.js +82 -169
- package/lib/typeorm/driver/sqlite/SqliteDriver.js.map +1 -1
- package/lib/typeorm/driver/sqlite/SqliteQueryRunner.js +78 -122
- package/lib/typeorm/driver/sqlite/SqliteQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/sqlite-abstract/AbstractSqliteDriver.js +280 -268
- package/lib/typeorm/driver/sqlite-abstract/AbstractSqliteDriver.js.map +1 -1
- package/lib/typeorm/driver/sqlite-abstract/AbstractSqliteQueryRunner.js +1158 -1990
- package/lib/typeorm/driver/sqlite-abstract/AbstractSqliteQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/sqljs/SqljsConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/sqljs/SqljsDriver.js +187 -253
- package/lib/typeorm/driver/sqljs/SqljsDriver.js.map +1 -1
- package/lib/typeorm/driver/sqljs/SqljsQueryRunner.js +88 -147
- package/lib/typeorm/driver/sqljs/SqljsQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/MssqlParameter.js +10 -13
- package/lib/typeorm/driver/sqlserver/MssqlParameter.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/SqlServerConnectionCredentialsOptions.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/SqlServerConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/SqlServerDriver.js +352 -372
- package/lib/typeorm/driver/sqlserver/SqlServerDriver.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/SqlServerQueryRunner.js +1979 -3068
- package/lib/typeorm/driver/sqlserver/SqlServerQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/authentication/AzureActiveDirectoryAccessTokenAuthentication.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/authentication/AzureActiveDirectoryMsiAppServiceAuthentication.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/authentication/AzureActiveDirectoryMsiVmAuthentication.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/authentication/AzureActiveDirectoryPasswordAuthentication.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/authentication/AzureActiveDirectoryServicePrincipalSecret.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/authentication/DefaultAuthentication.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/authentication/NtlmAuthentication.js.map +1 -1
- package/lib/typeorm/driver/types/ColumnTypes.js.map +1 -1
- package/lib/typeorm/driver/types/CteCapabilities.js.map +1 -1
- package/lib/typeorm/driver/types/DataTypeDefaults.js.map +1 -1
- package/lib/typeorm/driver/types/DatabaseType.js.map +1 -1
- package/lib/typeorm/driver/types/IsolationLevel.js.map +1 -1
- package/lib/typeorm/driver/types/MappedColumnTypes.js.map +1 -1
- package/lib/typeorm/driver/types/MetadataTableType.js.map +1 -1
- package/lib/typeorm/driver/types/ReplicationMode.js.map +1 -1
- package/lib/typeorm/driver/types/UpsertType.js.map +1 -1
- package/lib/typeorm/entity-manager/EntityManager.js +351 -469
- package/lib/typeorm/entity-manager/EntityManager.js.map +1 -1
- package/lib/typeorm/entity-manager/EntityManagerFactory.js +7 -10
- package/lib/typeorm/entity-manager/EntityManagerFactory.js.map +1 -1
- package/lib/typeorm/entity-manager/MongoEntityManager.js +371 -487
- package/lib/typeorm/entity-manager/MongoEntityManager.js.map +1 -1
- package/lib/typeorm/entity-manager/SqljsEntityManager.js +16 -37
- package/lib/typeorm/entity-manager/SqljsEntityManager.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchema.js +5 -5
- package/lib/typeorm/entity-schema/EntitySchema.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchemaCheckOptions.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchemaColumnOptions.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchemaEmbeddedColumnOptions.js +17 -5
- package/lib/typeorm/entity-schema/EntitySchemaEmbeddedColumnOptions.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchemaEmbeddedError.js +11 -14
- package/lib/typeorm/entity-schema/EntitySchemaEmbeddedError.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchemaExclusionOptions.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchemaIndexOptions.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchemaOptions.js +82 -5
- package/lib/typeorm/entity-schema/EntitySchemaOptions.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchemaRelationIdOptions.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchemaRelationOptions.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchemaTransformer.js +51 -68
- package/lib/typeorm/entity-schema/EntitySchemaTransformer.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchemaUniqueOptions.js.map +1 -1
- package/lib/typeorm/error/AlreadyHasActiveConnectionError.js +6 -9
- package/lib/typeorm/error/AlreadyHasActiveConnectionError.js.map +1 -1
- package/lib/typeorm/error/CannotAttachTreeChildrenEntityError.js +6 -9
- package/lib/typeorm/error/CannotAttachTreeChildrenEntityError.js.map +1 -1
- package/lib/typeorm/error/CannotConnectAlreadyConnectedError.js +5 -8
- package/lib/typeorm/error/CannotConnectAlreadyConnectedError.js.map +1 -1
- package/lib/typeorm/error/CannotCreateEntityIdMapError.js +7 -11
- package/lib/typeorm/error/CannotCreateEntityIdMapError.js.map +1 -1
- package/lib/typeorm/error/CannotDetermineEntityError.js +6 -9
- package/lib/typeorm/error/CannotDetermineEntityError.js.map +1 -1
- package/lib/typeorm/error/CannotExecuteNotConnectedError.js +5 -8
- package/lib/typeorm/error/CannotExecuteNotConnectedError.js.map +1 -1
- package/lib/typeorm/error/CannotGetEntityManagerNotConnectedError.js +5 -8
- package/lib/typeorm/error/CannotGetEntityManagerNotConnectedError.js.map +1 -1
- package/lib/typeorm/error/CannotReflectMethodParameterTypeError.js +7 -10
- package/lib/typeorm/error/CannotReflectMethodParameterTypeError.js.map +1 -1
- package/lib/typeorm/error/CircularRelationsError.js +6 -9
- package/lib/typeorm/error/CircularRelationsError.js.map +1 -1
- package/lib/typeorm/error/ColumnTypeUndefinedError.js +8 -11
- package/lib/typeorm/error/ColumnTypeUndefinedError.js.map +1 -1
- package/lib/typeorm/error/ConnectionIsNotSetError.js +5 -8
- package/lib/typeorm/error/ConnectionIsNotSetError.js.map +1 -1
- package/lib/typeorm/error/ConnectionNotFoundError.js +5 -8
- package/lib/typeorm/error/ConnectionNotFoundError.js.map +1 -1
- package/lib/typeorm/error/CustomRepositoryCannotInheritRepositoryError.js +7 -10
- package/lib/typeorm/error/CustomRepositoryCannotInheritRepositoryError.js.map +1 -1
- package/lib/typeorm/error/CustomRepositoryDoesNotHaveEntityError.js +7 -10
- package/lib/typeorm/error/CustomRepositoryDoesNotHaveEntityError.js.map +1 -1
- package/lib/typeorm/error/CustomRepositoryNotFoundError.js +7 -10
- package/lib/typeorm/error/CustomRepositoryNotFoundError.js.map +1 -1
- package/lib/typeorm/error/DataTypeNotSupportedError.js +7 -11
- package/lib/typeorm/error/DataTypeNotSupportedError.js.map +1 -1
- package/lib/typeorm/error/DriverOptionNotSetError.js +6 -9
- package/lib/typeorm/error/DriverOptionNotSetError.js.map +1 -1
- package/lib/typeorm/error/DriverPackageNotInstalledError.js +6 -9
- package/lib/typeorm/error/DriverPackageNotInstalledError.js.map +1 -1
- package/lib/typeorm/error/EntityMetadataNotFoundError.js +10 -14
- package/lib/typeorm/error/EntityMetadataNotFoundError.js.map +1 -1
- package/lib/typeorm/error/EntityNotFoundError.js +13 -17
- package/lib/typeorm/error/EntityNotFoundError.js.map +1 -1
- package/lib/typeorm/error/EntityPropertyNotFoundError.js +7 -11
- package/lib/typeorm/error/EntityPropertyNotFoundError.js.map +1 -1
- package/lib/typeorm/error/FindRelationsNotFoundError.js +9 -13
- package/lib/typeorm/error/FindRelationsNotFoundError.js.map +1 -1
- package/lib/typeorm/error/ForbiddenTransactionModeOverrideError.js +6 -9
- package/lib/typeorm/error/ForbiddenTransactionModeOverrideError.js.map +1 -1
- package/lib/typeorm/error/InitializedRelationError.js +7 -10
- package/lib/typeorm/error/InitializedRelationError.js.map +1 -1
- package/lib/typeorm/error/InsertValuesMissingError.js +6 -9
- package/lib/typeorm/error/InsertValuesMissingError.js.map +1 -1
- package/lib/typeorm/error/LimitOnUpdateNotSupportedError.js +5 -8
- package/lib/typeorm/error/LimitOnUpdateNotSupportedError.js.map +1 -1
- package/lib/typeorm/error/LockNotSupportedOnGivenDriverError.js +5 -8
- package/lib/typeorm/error/LockNotSupportedOnGivenDriverError.js.map +1 -1
- package/lib/typeorm/error/MetadataAlreadyExistsError.js +6 -9
- package/lib/typeorm/error/MetadataAlreadyExistsError.js.map +1 -1
- package/lib/typeorm/error/MetadataWithSuchNameAlreadyExistsError.js +6 -9
- package/lib/typeorm/error/MetadataWithSuchNameAlreadyExistsError.js.map +1 -1
- package/lib/typeorm/error/MissingDeleteDateColumnError.js +5 -8
- package/lib/typeorm/error/MissingDeleteDateColumnError.js.map +1 -1
- package/lib/typeorm/error/MissingDriverError.js +6 -10
- package/lib/typeorm/error/MissingDriverError.js.map +1 -1
- package/lib/typeorm/error/MissingJoinColumnError.js +12 -16
- package/lib/typeorm/error/MissingJoinColumnError.js.map +1 -1
- package/lib/typeorm/error/MissingJoinTableError.js +12 -16
- package/lib/typeorm/error/MissingJoinTableError.js.map +1 -1
- package/lib/typeorm/error/MissingPrimaryColumnError.js +6 -9
- package/lib/typeorm/error/MissingPrimaryColumnError.js.map +1 -1
- package/lib/typeorm/error/MustBeEntityError.js +5 -8
- package/lib/typeorm/error/MustBeEntityError.js.map +1 -1
- package/lib/typeorm/error/NamingStrategyNotFoundError.js +9 -13
- package/lib/typeorm/error/NamingStrategyNotFoundError.js.map +1 -1
- package/lib/typeorm/error/NestedSetMultipleRootError.js +5 -8
- package/lib/typeorm/error/NestedSetMultipleRootError.js.map +1 -1
- package/lib/typeorm/error/NoConnectionForRepositoryError.js +6 -9
- package/lib/typeorm/error/NoConnectionForRepositoryError.js.map +1 -1
- package/lib/typeorm/error/NoConnectionOptionError.js +6 -9
- package/lib/typeorm/error/NoConnectionOptionError.js.map +1 -1
- package/lib/typeorm/error/NoNeedToReleaseEntityManagerError.js +7 -10
- package/lib/typeorm/error/NoNeedToReleaseEntityManagerError.js.map +1 -1
- package/lib/typeorm/error/NoVersionOrUpdateDateColumnError.js +5 -8
- package/lib/typeorm/error/NoVersionOrUpdateDateColumnError.js.map +1 -1
- package/lib/typeorm/error/OffsetWithoutLimitNotSupportedError.js +7 -10
- package/lib/typeorm/error/OffsetWithoutLimitNotSupportedError.js.map +1 -1
- package/lib/typeorm/error/OptimisticLockCanNotBeUsedError.js +5 -8
- package/lib/typeorm/error/OptimisticLockCanNotBeUsedError.js.map +1 -1
- package/lib/typeorm/error/OptimisticLockVersionMismatchError.js +5 -8
- package/lib/typeorm/error/OptimisticLockVersionMismatchError.js.map +1 -1
- package/lib/typeorm/error/PersistedEntityNotFoundError.js +5 -8
- package/lib/typeorm/error/PersistedEntityNotFoundError.js.map +1 -1
- package/lib/typeorm/error/PessimisticLockTransactionRequiredError.js +5 -8
- package/lib/typeorm/error/PessimisticLockTransactionRequiredError.js.map +1 -1
- package/lib/typeorm/error/PrimaryColumnCannotBeNullableError.js +6 -9
- package/lib/typeorm/error/PrimaryColumnCannotBeNullableError.js.map +1 -1
- package/lib/typeorm/error/QueryFailedError.js +18 -17
- package/lib/typeorm/error/QueryFailedError.js.map +1 -1
- package/lib/typeorm/error/QueryRunnerAlreadyReleasedError.js +5 -8
- package/lib/typeorm/error/QueryRunnerAlreadyReleasedError.js.map +1 -1
- package/lib/typeorm/error/QueryRunnerProviderAlreadyReleasedError.js +6 -9
- package/lib/typeorm/error/QueryRunnerProviderAlreadyReleasedError.js.map +1 -1
- package/lib/typeorm/error/RepositoryNotTreeError.js +9 -13
- package/lib/typeorm/error/RepositoryNotTreeError.js.map +1 -1
- package/lib/typeorm/error/ReturningStatementNotSupportedError.js +5 -8
- package/lib/typeorm/error/ReturningStatementNotSupportedError.js.map +1 -1
- package/lib/typeorm/error/SubjectRemovedAndUpdatedError.js +6 -9
- package/lib/typeorm/error/SubjectRemovedAndUpdatedError.js.map +1 -1
- package/lib/typeorm/error/SubjectWithoutIdentifierError.js +5 -8
- package/lib/typeorm/error/SubjectWithoutIdentifierError.js.map +1 -1
- package/lib/typeorm/error/TransactionAlreadyStartedError.js +5 -8
- package/lib/typeorm/error/TransactionAlreadyStartedError.js.map +1 -1
- package/lib/typeorm/error/TransactionNotStartedError.js +5 -8
- package/lib/typeorm/error/TransactionNotStartedError.js.map +1 -1
- package/lib/typeorm/error/TreeRepositoryNotSupportedError.js +5 -8
- package/lib/typeorm/error/TreeRepositoryNotSupportedError.js.map +1 -1
- package/lib/typeorm/error/TypeORMError.js +9 -18
- package/lib/typeorm/error/TypeORMError.js.map +1 -1
- package/lib/typeorm/error/UpdateValuesMissingError.js +5 -8
- package/lib/typeorm/error/UpdateValuesMissingError.js.map +1 -1
- package/lib/typeorm/error/UsingJoinColumnIsNotAllowedError.js +6 -9
- package/lib/typeorm/error/UsingJoinColumnIsNotAllowedError.js.map +1 -1
- package/lib/typeorm/error/UsingJoinColumnOnlyOnOneSideAllowedError.js +7 -10
- package/lib/typeorm/error/UsingJoinColumnOnlyOnOneSideAllowedError.js.map +1 -1
- package/lib/typeorm/error/UsingJoinTableIsNotAllowedError.js +7 -10
- package/lib/typeorm/error/UsingJoinTableIsNotAllowedError.js.map +1 -1
- package/lib/typeorm/error/UsingJoinTableOnlyOnOneSideAllowedError.js +7 -10
- package/lib/typeorm/error/UsingJoinTableOnlyOnOneSideAllowedError.js.map +1 -1
- package/lib/typeorm/error/index.js +75 -62
- package/lib/typeorm/error/index.js.map +1 -1
- package/lib/typeorm/find-options/EqualOperator.js +6 -10
- package/lib/typeorm/find-options/EqualOperator.js.map +1 -1
- package/lib/typeorm/find-options/FindManyOptions.js.map +1 -1
- package/lib/typeorm/find-options/FindOneOptions.js.map +1 -1
- package/lib/typeorm/find-options/FindOperator.js +90 -94
- package/lib/typeorm/find-options/FindOperator.js.map +1 -1
- package/lib/typeorm/find-options/FindOperatorType.js.map +1 -1
- package/lib/typeorm/find-options/FindOptionsOrder.js.map +1 -1
- package/lib/typeorm/find-options/FindOptionsRelations.js.map +1 -1
- package/lib/typeorm/find-options/FindOptionsSelect.js.map +1 -1
- package/lib/typeorm/find-options/FindOptionsUtils.js +56 -87
- package/lib/typeorm/find-options/FindOptionsUtils.js.map +1 -1
- package/lib/typeorm/find-options/FindOptionsWhere.js.map +1 -1
- package/lib/typeorm/find-options/FindTreeOptions.js.map +1 -1
- package/lib/typeorm/find-options/JoinOptions.js.map +1 -1
- package/lib/typeorm/find-options/OrderByCondition.js.map +1 -1
- package/lib/typeorm/find-options/mongodb/MongoFindManyOptions.js.map +1 -1
- package/lib/typeorm/find-options/mongodb/MongoFindOneOptions.js.map +1 -1
- package/lib/typeorm/find-options/operator/And.js +2 -6
- package/lib/typeorm/find-options/operator/And.js.map +1 -1
- package/lib/typeorm/find-options/operator/Any.js +1 -1
- package/lib/typeorm/find-options/operator/Any.js.map +1 -1
- package/lib/typeorm/find-options/operator/ArrayContainedBy.js +1 -1
- package/lib/typeorm/find-options/operator/ArrayContainedBy.js.map +1 -1
- package/lib/typeorm/find-options/operator/ArrayContains.js +1 -1
- package/lib/typeorm/find-options/operator/ArrayContains.js.map +1 -1
- package/lib/typeorm/find-options/operator/ArrayOverlap.js +1 -1
- package/lib/typeorm/find-options/operator/ArrayOverlap.js.map +1 -1
- package/lib/typeorm/find-options/operator/Between.js +1 -1
- package/lib/typeorm/find-options/operator/Between.js.map +1 -1
- package/lib/typeorm/find-options/operator/Equal.js +1 -1
- package/lib/typeorm/find-options/operator/Equal.js.map +1 -1
- package/lib/typeorm/find-options/operator/ILike.js +1 -1
- package/lib/typeorm/find-options/operator/ILike.js.map +1 -1
- package/lib/typeorm/find-options/operator/In.js +1 -1
- package/lib/typeorm/find-options/operator/In.js.map +1 -1
- package/lib/typeorm/find-options/operator/IsNull.js +1 -1
- package/lib/typeorm/find-options/operator/IsNull.js.map +1 -1
- package/lib/typeorm/find-options/operator/LessThan.js +1 -1
- package/lib/typeorm/find-options/operator/LessThan.js.map +1 -1
- package/lib/typeorm/find-options/operator/LessThanOrEqual.js +1 -1
- package/lib/typeorm/find-options/operator/LessThanOrEqual.js.map +1 -1
- package/lib/typeorm/find-options/operator/Like.js +1 -1
- package/lib/typeorm/find-options/operator/Like.js.map +1 -1
- package/lib/typeorm/find-options/operator/MoreThan.js +1 -1
- package/lib/typeorm/find-options/operator/MoreThan.js.map +1 -1
- package/lib/typeorm/find-options/operator/MoreThanOrEqual.js +1 -1
- package/lib/typeorm/find-options/operator/MoreThanOrEqual.js.map +1 -1
- package/lib/typeorm/find-options/operator/Not.js +1 -1
- package/lib/typeorm/find-options/operator/Not.js.map +1 -1
- package/lib/typeorm/find-options/operator/Raw.js +1 -1
- package/lib/typeorm/find-options/operator/Raw.js.map +1 -1
- package/lib/typeorm/globals.js +33 -99
- package/lib/typeorm/globals.js.map +1 -1
- package/lib/typeorm/index.d.ts +0 -1
- package/lib/typeorm/index.js +136 -126
- package/lib/typeorm/index.js.map +1 -1
- package/lib/typeorm/logger/AdvancedConsoleLogger.js +26 -26
- package/lib/typeorm/logger/AdvancedConsoleLogger.js.map +1 -1
- package/lib/typeorm/logger/DebugLogger.js +24 -27
- package/lib/typeorm/logger/DebugLogger.js.map +1 -1
- package/lib/typeorm/logger/FileLogger.js +31 -30
- package/lib/typeorm/logger/FileLogger.js.map +1 -1
- package/lib/typeorm/logger/Logger.js.map +1 -1
- package/lib/typeorm/logger/LoggerFactory.js +9 -12
- package/lib/typeorm/logger/LoggerFactory.js.map +1 -1
- package/lib/typeorm/logger/LoggerOptions.js.map +1 -1
- package/lib/typeorm/logger/SimpleConsoleLogger.js +25 -25
- package/lib/typeorm/logger/SimpleConsoleLogger.js.map +1 -1
- package/lib/typeorm/metadata/CheckMetadata.js +30 -6
- package/lib/typeorm/metadata/CheckMetadata.js.map +1 -1
- package/lib/typeorm/metadata/ColumnMetadata.js +343 -199
- package/lib/typeorm/metadata/ColumnMetadata.js.map +1 -1
- package/lib/typeorm/metadata/EmbeddedMetadata.js +174 -153
- package/lib/typeorm/metadata/EmbeddedMetadata.js.map +1 -1
- package/lib/typeorm/metadata/EntityListenerMetadata.js +35 -15
- package/lib/typeorm/metadata/EntityListenerMetadata.js.map +1 -1
- package/lib/typeorm/metadata/EntityMetadata.js +516 -372
- package/lib/typeorm/metadata/EntityMetadata.js.map +1 -1
- package/lib/typeorm/metadata/ExclusionMetadata.js +30 -6
- package/lib/typeorm/metadata/ExclusionMetadata.js.map +1 -1
- package/lib/typeorm/metadata/ForeignKeyMetadata.js +60 -24
- package/lib/typeorm/metadata/ForeignKeyMetadata.js.map +1 -1
- package/lib/typeorm/metadata/IndexMetadata.js +119 -73
- package/lib/typeorm/metadata/IndexMetadata.js.map +1 -1
- package/lib/typeorm/metadata/RelationCountMetadata.js +40 -10
- package/lib/typeorm/metadata/RelationCountMetadata.js.map +1 -1
- package/lib/typeorm/metadata/RelationIdMetadata.js +47 -18
- package/lib/typeorm/metadata/RelationIdMetadata.js.map +1 -1
- package/lib/typeorm/metadata/RelationMetadata.js +270 -187
- package/lib/typeorm/metadata/RelationMetadata.js.map +1 -1
- package/lib/typeorm/metadata/UniqueMetadata.js +72 -47
- package/lib/typeorm/metadata/UniqueMetadata.js.map +1 -1
- package/lib/typeorm/metadata/types/ClosureTreeOptions.js.map +1 -1
- package/lib/typeorm/metadata/types/DeferrableType.js.map +1 -1
- package/lib/typeorm/metadata/types/EventListenerTypes.js +13 -16
- package/lib/typeorm/metadata/types/EventListenerTypes.js.map +1 -1
- package/lib/typeorm/metadata/types/OnDeleteType.js.map +1 -1
- package/lib/typeorm/metadata/types/OnUpdateType.js.map +1 -1
- package/lib/typeorm/metadata/types/PropertyTypeInFunction.js.map +1 -1
- package/lib/typeorm/metadata/types/RelationTypeInFunction.js.map +1 -1
- package/lib/typeorm/metadata/types/RelationTypes.js.map +1 -1
- package/lib/typeorm/metadata/types/TableTypes.js.map +1 -1
- package/lib/typeorm/metadata/types/TreeTypes.js.map +1 -1
- package/lib/typeorm/metadata-args/CheckMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/ColumnMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/DiscriminatorValueMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/EmbeddedMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/EntityListenerMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/EntityRepositoryMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/EntitySubscriberMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/ExclusionMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/GeneratedMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/IndexMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/InheritanceMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/JoinColumnMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/JoinTableMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/MetadataArgsStorage.js +108 -113
- package/lib/typeorm/metadata-args/MetadataArgsStorage.js.map +1 -1
- package/lib/typeorm/metadata-args/NamingStrategyMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/RelationCountMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/RelationIdMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/RelationMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/TableMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/TransactionEntityMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/TransactionRepositoryMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/TreeMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/UniqueMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/types/ColumnMode.js.map +1 -1
- package/lib/typeorm/metadata-builder/ClosureJunctionEntityMetadataBuilder.js +14 -15
- package/lib/typeorm/metadata-builder/ClosureJunctionEntityMetadataBuilder.js.map +1 -1
- package/lib/typeorm/metadata-builder/EntityMetadataBuilder.js +291 -347
- package/lib/typeorm/metadata-builder/EntityMetadataBuilder.js.map +1 -1
- package/lib/typeorm/metadata-builder/EntityMetadataValidator.js +63 -77
- package/lib/typeorm/metadata-builder/EntityMetadataValidator.js.map +1 -1
- package/lib/typeorm/metadata-builder/JunctionEntityMetadataBuilder.js +64 -69
- package/lib/typeorm/metadata-builder/JunctionEntityMetadataBuilder.js.map +1 -1
- package/lib/typeorm/metadata-builder/MetadataUtils.js +12 -15
- package/lib/typeorm/metadata-builder/MetadataUtils.js.map +1 -1
- package/lib/typeorm/metadata-builder/RelationJoinColumnBuilder.js +43 -49
- package/lib/typeorm/metadata-builder/RelationJoinColumnBuilder.js.map +1 -1
- package/lib/typeorm/migration/Migration.js +23 -4
- package/lib/typeorm/migration/Migration.js.map +1 -1
- package/lib/typeorm/migration/MigrationExecutor.js +432 -691
- package/lib/typeorm/migration/MigrationExecutor.js.map +1 -1
- package/lib/typeorm/migration/MigrationInterface.js.map +1 -1
- package/lib/typeorm/naming-strategy/DefaultNamingStrategy.js +80 -84
- package/lib/typeorm/naming-strategy/DefaultNamingStrategy.js.map +1 -1
- package/lib/typeorm/naming-strategy/NamingStrategyInterface.js.map +1 -1
- package/lib/typeorm/persistence/EntityPersistExecutor.js +154 -212
- package/lib/typeorm/persistence/EntityPersistExecutor.js.map +1 -1
- package/lib/typeorm/persistence/Subject.js +162 -149
- package/lib/typeorm/persistence/Subject.js.map +1 -1
- package/lib/typeorm/persistence/SubjectChangeMap.js.map +1 -1
- package/lib/typeorm/persistence/SubjectChangedColumnsComputer.js +29 -35
- package/lib/typeorm/persistence/SubjectChangedColumnsComputer.js.map +1 -1
- package/lib/typeorm/persistence/SubjectDatabaseEntityLoader.js +99 -130
- package/lib/typeorm/persistence/SubjectDatabaseEntityLoader.js.map +1 -1
- package/lib/typeorm/persistence/SubjectExecutor.js +635 -879
- package/lib/typeorm/persistence/SubjectExecutor.js.map +1 -1
- package/lib/typeorm/persistence/SubjectTopoligicalSorter.js +62 -58
- package/lib/typeorm/persistence/SubjectTopoligicalSorter.js.map +1 -1
- package/lib/typeorm/persistence/subject-builder/CascadesSubjectBuilder.js +16 -19
- package/lib/typeorm/persistence/subject-builder/CascadesSubjectBuilder.js.map +1 -1
- package/lib/typeorm/persistence/subject-builder/ManyToManySubjectBuilder.js +50 -53
- package/lib/typeorm/persistence/subject-builder/ManyToManySubjectBuilder.js.map +1 -1
- package/lib/typeorm/persistence/subject-builder/OneToManySubjectBuilder.js +28 -33
- package/lib/typeorm/persistence/subject-builder/OneToManySubjectBuilder.js.map +1 -1
- package/lib/typeorm/persistence/subject-builder/OneToOneInverseSideSubjectBuilder.js +19 -20
- package/lib/typeorm/persistence/subject-builder/OneToOneInverseSideSubjectBuilder.js.map +1 -1
- package/lib/typeorm/persistence/tree/ClosureSubjectExecutor.js +202 -271
- package/lib/typeorm/persistence/tree/ClosureSubjectExecutor.js.map +1 -1
- package/lib/typeorm/persistence/tree/MaterializedPathSubjectExecutor.js +79 -121
- package/lib/typeorm/persistence/tree/MaterializedPathSubjectExecutor.js.map +1 -1
- package/lib/typeorm/persistence/tree/NestedSetSubjectExecutor.js +220 -353
- package/lib/typeorm/persistence/tree/NestedSetSubjectExecutor.js.map +1 -1
- package/lib/typeorm/platform/PlatformTools.js +66 -78
- package/lib/typeorm/platform/PlatformTools.js.map +1 -1
- package/lib/typeorm/query-builder/Alias.js +31 -32
- package/lib/typeorm/query-builder/Alias.js.map +1 -1
- package/lib/typeorm/query-builder/Brackets.js +8 -5
- package/lib/typeorm/query-builder/Brackets.js.map +1 -1
- package/lib/typeorm/query-builder/DeleteQueryBuilder.js +96 -120
- package/lib/typeorm/query-builder/DeleteQueryBuilder.js.map +1 -1
- package/lib/typeorm/query-builder/InsertOrUpdateOptions.js.map +1 -1
- package/lib/typeorm/query-builder/InsertQueryBuilder.js +321 -367
- package/lib/typeorm/query-builder/InsertQueryBuilder.js.map +1 -1
- package/lib/typeorm/query-builder/JoinAttribute.js +175 -206
- package/lib/typeorm/query-builder/JoinAttribute.js.map +1 -1
- package/lib/typeorm/query-builder/JoinOptions.js.map +1 -1
- package/lib/typeorm/query-builder/NotBrackets.js +4 -11
- package/lib/typeorm/query-builder/NotBrackets.js.map +1 -1
- package/lib/typeorm/query-builder/QueryBuilder.js +400 -646
- package/lib/typeorm/query-builder/QueryBuilder.js.map +1 -1
- package/lib/typeorm/query-builder/QueryBuilderCte.js.map +1 -1
- package/lib/typeorm/query-builder/QueryBuilderUtils.js +5 -9
- package/lib/typeorm/query-builder/QueryBuilderUtils.js.map +1 -1
- package/lib/typeorm/query-builder/QueryExpressionMap.js +304 -233
- package/lib/typeorm/query-builder/QueryExpressionMap.js.map +1 -1
- package/lib/typeorm/query-builder/QueryPartialEntity.js.map +1 -1
- package/lib/typeorm/query-builder/RelationIdLoader.js +166 -189
- package/lib/typeorm/query-builder/RelationIdLoader.js.map +1 -1
- package/lib/typeorm/query-builder/RelationLoader.js +81 -94
- package/lib/typeorm/query-builder/RelationLoader.js.map +1 -1
- package/lib/typeorm/query-builder/RelationQueryBuilder.js +91 -127
- package/lib/typeorm/query-builder/RelationQueryBuilder.js.map +1 -1
- package/lib/typeorm/query-builder/RelationRemover.js +121 -124
- package/lib/typeorm/query-builder/RelationRemover.js.map +1 -1
- package/lib/typeorm/query-builder/RelationUpdater.js +130 -148
- package/lib/typeorm/query-builder/RelationUpdater.js.map +1 -1
- package/lib/typeorm/query-builder/ReturningResultsEntityUpdator.js +131 -159
- package/lib/typeorm/query-builder/ReturningResultsEntityUpdator.js.map +1 -1
- package/lib/typeorm/query-builder/SelectQuery.js.map +1 -1
- package/lib/typeorm/query-builder/SelectQueryBuilder.js +955 -1211
- package/lib/typeorm/query-builder/SelectQueryBuilder.js.map +1 -1
- package/lib/typeorm/query-builder/SelectQueryBuilderOption.js.map +1 -1
- package/lib/typeorm/query-builder/SoftDeleteQueryBuilder.js +155 -194
- package/lib/typeorm/query-builder/SoftDeleteQueryBuilder.js.map +1 -1
- package/lib/typeorm/query-builder/UpdateQueryBuilder.js +204 -246
- package/lib/typeorm/query-builder/UpdateQueryBuilder.js.map +1 -1
- package/lib/typeorm/query-builder/WhereClause.js.map +1 -1
- package/lib/typeorm/query-builder/WhereExpressionBuilder.js.map +1 -1
- package/lib/typeorm/query-builder/relation-count/RelationCountAttribute.js +85 -98
- package/lib/typeorm/query-builder/relation-count/RelationCountAttribute.js.map +1 -1
- package/lib/typeorm/query-builder/relation-count/RelationCountLoadResult.js.map +1 -1
- package/lib/typeorm/query-builder/relation-count/RelationCountLoader.js +153 -172
- package/lib/typeorm/query-builder/relation-count/RelationCountLoader.js.map +1 -1
- package/lib/typeorm/query-builder/relation-count/RelationCountMetadataToAttributeTransformer.js +16 -17
- package/lib/typeorm/query-builder/relation-count/RelationCountMetadataToAttributeTransformer.js.map +1 -1
- package/lib/typeorm/query-builder/relation-id/RelationIdAttribute.js +93 -107
- package/lib/typeorm/query-builder/relation-id/RelationIdAttribute.js.map +1 -1
- package/lib/typeorm/query-builder/relation-id/RelationIdLoadResult.js.map +1 -1
- package/lib/typeorm/query-builder/relation-id/RelationIdLoader.js +259 -267
- package/lib/typeorm/query-builder/relation-id/RelationIdLoader.js.map +1 -1
- package/lib/typeorm/query-builder/relation-id/RelationIdMetadataToAttributeTransformer.js +16 -17
- package/lib/typeorm/query-builder/relation-id/RelationIdMetadataToAttributeTransformer.js.map +1 -1
- package/lib/typeorm/query-builder/result/DeleteResult.js +14 -8
- package/lib/typeorm/query-builder/result/DeleteResult.js.map +1 -1
- package/lib/typeorm/query-builder/result/InsertResult.js +19 -18
- package/lib/typeorm/query-builder/result/InsertResult.js.map +1 -1
- package/lib/typeorm/query-builder/result/UpdateResult.js +24 -18
- package/lib/typeorm/query-builder/result/UpdateResult.js.map +1 -1
- package/lib/typeorm/query-builder/transformer/DocumentToEntityTransformer.js +24 -26
- package/lib/typeorm/query-builder/transformer/DocumentToEntityTransformer.js.map +1 -1
- package/lib/typeorm/query-builder/transformer/PlainObjectToDatabaseEntityTransformer.js +77 -112
- package/lib/typeorm/query-builder/transformer/PlainObjectToDatabaseEntityTransformer.js.map +1 -1
- package/lib/typeorm/query-builder/transformer/PlainObjectToNewEntityTransformer.js +16 -22
- package/lib/typeorm/query-builder/transformer/PlainObjectToNewEntityTransformer.js.map +1 -1
- package/lib/typeorm/query-builder/transformer/RawSqlResultsToEntityTransformer.js +117 -132
- package/lib/typeorm/query-builder/transformer/RawSqlResultsToEntityTransformer.js.map +1 -1
- package/lib/typeorm/query-runner/BaseQueryRunner.js +227 -393
- package/lib/typeorm/query-runner/BaseQueryRunner.js.map +1 -1
- package/lib/typeorm/query-runner/QueryLock.js +19 -32
- package/lib/typeorm/query-runner/QueryLock.js.map +1 -1
- package/lib/typeorm/query-runner/QueryResult.js +14 -9
- package/lib/typeorm/query-runner/QueryResult.js.map +1 -1
- package/lib/typeorm/query-runner/QueryRunner.js.map +1 -1
- package/lib/typeorm/repository/AbstractRepository.js +46 -50
- package/lib/typeorm/repository/AbstractRepository.js.map +1 -1
- package/lib/typeorm/repository/BaseEntity.js +106 -123
- package/lib/typeorm/repository/BaseEntity.js.map +1 -1
- package/lib/typeorm/repository/EntityId.js.map +1 -1
- package/lib/typeorm/repository/FindTreesOptions.js.map +1 -1
- package/lib/typeorm/repository/MongoRepository.js +109 -135
- package/lib/typeorm/repository/MongoRepository.js.map +1 -1
- package/lib/typeorm/repository/RemoveOptions.js.map +1 -1
- package/lib/typeorm/repository/Repository.js +108 -140
- package/lib/typeorm/repository/Repository.js.map +1 -1
- package/lib/typeorm/repository/SaveOptions.js.map +1 -1
- package/lib/typeorm/repository/TreeRepository.js +107 -154
- package/lib/typeorm/repository/TreeRepository.js.map +1 -1
- package/lib/typeorm/repository/UpsertOptions.js.map +1 -1
- package/lib/typeorm/schema-builder/MongoSchemaBuilder.js +30 -42
- package/lib/typeorm/schema-builder/MongoSchemaBuilder.js.map +1 -1
- package/lib/typeorm/schema-builder/RdbmsSchemaBuilder.js +727 -1938
- package/lib/typeorm/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
- package/lib/typeorm/schema-builder/SchemaBuilder.js.map +1 -1
- package/lib/typeorm/schema-builder/options/TableCheckOptions.js.map +1 -1
- package/lib/typeorm/schema-builder/options/TableColumnOptions.js.map +1 -1
- package/lib/typeorm/schema-builder/options/TableExclusionOptions.js.map +1 -1
- package/lib/typeorm/schema-builder/options/TableForeignKeyOptions.js.map +1 -1
- package/lib/typeorm/schema-builder/options/TableIndexOptions.js.map +1 -1
- package/lib/typeorm/schema-builder/options/TableOptions.js.map +1 -1
- package/lib/typeorm/schema-builder/options/TableUniqueOptions.js.map +1 -1
- package/lib/typeorm/schema-builder/options/ViewOptions.js.map +1 -1
- package/lib/typeorm/schema-builder/table/Table.js +160 -157
- package/lib/typeorm/schema-builder/table/Table.js.map +1 -1
- package/lib/typeorm/schema-builder/table/TableCheck.js +24 -15
- package/lib/typeorm/schema-builder/table/TableCheck.js.map +1 -1
- package/lib/typeorm/schema-builder/table/TableColumn.js +123 -41
- package/lib/typeorm/schema-builder/table/TableColumn.js.map +1 -1
- package/lib/typeorm/schema-builder/table/TableExclusion.js +19 -9
- package/lib/typeorm/schema-builder/table/TableExclusion.js.map +1 -1
- package/lib/typeorm/schema-builder/table/TableForeignKey.js +52 -20
- package/lib/typeorm/schema-builder/table/TableForeignKey.js.map +1 -1
- package/lib/typeorm/schema-builder/table/TableIndex.js +52 -16
- package/lib/typeorm/schema-builder/table/TableIndex.js.map +1 -1
- package/lib/typeorm/schema-builder/table/TableUnique.js +26 -16
- package/lib/typeorm/schema-builder/table/TableUnique.js.map +1 -1
- package/lib/typeorm/schema-builder/util/TableUtils.js +5 -8
- package/lib/typeorm/schema-builder/util/TableUtils.js.map +1 -1
- package/lib/typeorm/schema-builder/util/ViewUtils.js +4 -7
- package/lib/typeorm/schema-builder/util/ViewUtils.js.map +1 -1
- package/lib/typeorm/schema-builder/view/View.js +32 -10
- package/lib/typeorm/schema-builder/view/View.js.map +1 -1
- package/lib/typeorm/subscriber/Broadcaster.js +180 -216
- package/lib/typeorm/subscriber/Broadcaster.js.map +1 -1
- package/lib/typeorm/subscriber/BroadcasterResult.js +16 -29
- package/lib/typeorm/subscriber/BroadcasterResult.js.map +1 -1
- package/lib/typeorm/subscriber/EntitySubscriberInterface.js.map +1 -1
- package/lib/typeorm/subscriber/event/InsertEvent.js.map +1 -1
- package/lib/typeorm/subscriber/event/LoadEvent.js.map +1 -1
- package/lib/typeorm/subscriber/event/RecoverEvent.js.map +1 -1
- package/lib/typeorm/subscriber/event/RemoveEvent.js.map +1 -1
- package/lib/typeorm/subscriber/event/SoftRemoveEvent.js.map +1 -1
- package/lib/typeorm/subscriber/event/TransactionCommitEvent.js.map +1 -1
- package/lib/typeorm/subscriber/event/TransactionRollbackEvent.js.map +1 -1
- package/lib/typeorm/subscriber/event/TransactionStartEvent.js.map +1 -1
- package/lib/typeorm/subscriber/event/UpdateEvent.js.map +1 -1
- package/lib/typeorm/util/ApplyValueTransformers.js +9 -12
- package/lib/typeorm/util/ApplyValueTransformers.js.map +1 -1
- package/lib/typeorm/util/DateUtils.js +44 -53
- package/lib/typeorm/util/DateUtils.js.map +1 -1
- package/lib/typeorm/util/DepGraph.js +50 -53
- package/lib/typeorm/util/DepGraph.js.map +1 -1
- package/lib/typeorm/util/DirectoryExportedClassesLoader.js +48 -70
- package/lib/typeorm/util/DirectoryExportedClassesLoader.js.map +1 -1
- package/lib/typeorm/util/ImportUtils.js +43 -65
- package/lib/typeorm/util/ImportUtils.js.map +1 -1
- package/lib/typeorm/util/InstanceChecker.js +64 -67
- package/lib/typeorm/util/InstanceChecker.js.map +1 -1
- package/lib/typeorm/util/ObjectUtils.js +13 -42
- package/lib/typeorm/util/ObjectUtils.js.map +1 -1
- package/lib/typeorm/util/OrmUtils.js +91 -158
- package/lib/typeorm/util/OrmUtils.js.map +1 -1
- package/lib/typeorm/util/PathUtils.js +8 -8
- package/lib/typeorm/util/PathUtils.js.map +1 -1
- package/lib/typeorm/util/RandomGenerator.js +22 -25
- package/lib/typeorm/util/RandomGenerator.js.map +1 -1
- package/lib/typeorm/util/StringUtils.js +17 -21
- package/lib/typeorm/util/StringUtils.js.map +1 -1
- package/lib/typeorm/util/TreeRepositoryUtils.js +27 -30
- package/lib/typeorm/util/TreeRepositoryUtils.js.map +1 -1
- package/lib/typeorm/util/VersionUtils.js +9 -13
- package/lib/typeorm/util/VersionUtils.js.map +1 -1
- package/lib/typeorm/util/escapeRegExp.js +2 -2
- package/lib/typeorm/util/escapeRegExp.js.map +1 -1
- package/migrations/index.js +15 -2
- package/migrations/index.js.map +1 -1
- package/migrations/migrations_index._auto-generated_.d.ts +1 -0
- package/migrations/migrations_index._auto-generated_.js.map +1 -1
- package/package.json +8 -44
- package/src.d.ts +1 -1
- package/taon.jsonc +7 -34
- package/tmp-environment.json +8 -370
- package/websql/README.md +24 -24
- package/websql/esm2022/lib/typeorm/driver/cordova/CordovaDriver.mjs +1 -1
- package/websql/esm2022/lib/typeorm/driver/cordova/CordovaQueryRunner.mjs +1 -1
- package/websql/esm2022/lib/typeorm/driver/nativescript/NativescriptDriver.mjs +1 -1
- package/websql/esm2022/lib/typeorm/driver/nativescript/NativescriptQueryRunner.mjs +1 -1
- package/websql/esm2022/lib/typeorm/driver/react-native/ReactNativeDriver.mjs +1 -1
- package/websql/esm2022/lib/typeorm/driver/react-native/ReactNativeQueryRunner.mjs +1 -1
- package/websql/esm2022/lib/typeorm/driver/sqljs/SqljsDriver.mjs +1 -1
- package/websql/esm2022/lib/typeorm/driver/sqljs/SqljsQueryRunner.mjs +1 -1
- package/websql/esm2022/lib/typeorm/index.mjs +1 -3
- package/websql/fesm2022/taon-typeorm.mjs.map +1 -1
- package/browser/package.json +0 -25
- package/websql/package.json +0 -25
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.QueryBuilder = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var EntityPropertyNotFoundError_1 = require("../error/EntityPropertyNotFoundError");
|
|
4
|
+
const QueryExpressionMap_1 = require("./QueryExpressionMap");
|
|
5
|
+
const Brackets_1 = require("./Brackets");
|
|
6
|
+
const FindOperator_1 = require("../find-options/FindOperator");
|
|
7
|
+
const In_1 = require("../find-options/operator/In");
|
|
8
|
+
const error_1 = require("../error");
|
|
9
|
+
const EntityPropertyNotFoundError_1 = require("../error/EntityPropertyNotFoundError");
|
|
11
10
|
//#endregion
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const InstanceChecker_1 = require("../util/InstanceChecker");
|
|
12
|
+
const escapeRegExp_1 = require("../util/escapeRegExp");
|
|
13
|
+
const typescript_class_helpers_1 = require("typescript-class-helpers");
|
|
15
14
|
// todo: completely cover query builder with tests
|
|
16
15
|
// todo: entityOrProperty can be target name. implement proper behaviour if it is.
|
|
17
16
|
// todo: check in persistment if id exist on object and throw exception (can be in partial selection?)
|
|
@@ -28,16 +27,38 @@ var typescript_class_helpers_1 = require("typescript-class-helpers");
|
|
|
28
27
|
/**
|
|
29
28
|
* Allows to build complex sql queries in a fashion way and execute those queries.
|
|
30
29
|
*/
|
|
31
|
-
|
|
30
|
+
class QueryBuilder {
|
|
31
|
+
"@instanceof" = Symbol.for("QueryBuilder");
|
|
32
|
+
// -------------------------------------------------------------------------
|
|
33
|
+
// Public Properties
|
|
34
|
+
// -------------------------------------------------------------------------
|
|
35
|
+
/**
|
|
36
|
+
* Connection on which QueryBuilder was created.
|
|
37
|
+
*/
|
|
38
|
+
connection;
|
|
39
|
+
/**
|
|
40
|
+
* Contains all properties of the QueryBuilder that needs to be build a final query.
|
|
41
|
+
*/
|
|
42
|
+
expressionMap;
|
|
43
|
+
// -------------------------------------------------------------------------
|
|
44
|
+
// Protected Properties
|
|
45
|
+
// -------------------------------------------------------------------------
|
|
46
|
+
/**
|
|
47
|
+
* Query runner used to execute query builder query.
|
|
48
|
+
*/
|
|
49
|
+
queryRunner;
|
|
50
|
+
/**
|
|
51
|
+
* If QueryBuilder was created in a subquery mode then its parent QueryBuilder (who created subquery) will be stored here.
|
|
52
|
+
*/
|
|
53
|
+
parentQueryBuilder;
|
|
54
|
+
/**
|
|
55
|
+
* Memo to help keep place of current parameter index for `createParameter`
|
|
56
|
+
*/
|
|
57
|
+
parameterIndex = 0;
|
|
32
58
|
/**
|
|
33
59
|
* QueryBuilder can be initialized from given Connection and QueryRunner objects or from given other QueryBuilder.
|
|
34
60
|
*/
|
|
35
|
-
|
|
36
|
-
this["@instanceof"] = Symbol.for("QueryBuilder");
|
|
37
|
-
/**
|
|
38
|
-
* Memo to help keep place of current parameter index for `createParameter`
|
|
39
|
-
*/
|
|
40
|
-
this.parameterIndex = 0;
|
|
61
|
+
constructor(connectionOrQueryBuilder, queryRunner) {
|
|
41
62
|
if (InstanceChecker_1.InstanceChecker.isQueryBuilder(connectionOrQueryBuilder)) {
|
|
42
63
|
this.connection = connectionOrQueryBuilder.connection;
|
|
43
64
|
this.queryRunner = connectionOrQueryBuilder.queryRunner;
|
|
@@ -49,31 +70,27 @@ var QueryBuilder = /** @class */ (function () {
|
|
|
49
70
|
this.expressionMap = new QueryExpressionMap_1.QueryExpressionMap(this.connection);
|
|
50
71
|
}
|
|
51
72
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
},
|
|
64
|
-
enumerable: false,
|
|
65
|
-
configurable: true
|
|
66
|
-
});
|
|
73
|
+
// -------------------------------------------------------------------------
|
|
74
|
+
// Accessors
|
|
75
|
+
// -------------------------------------------------------------------------
|
|
76
|
+
/**
|
|
77
|
+
* Gets the main alias string used in this query builder.
|
|
78
|
+
*/
|
|
79
|
+
get alias() {
|
|
80
|
+
if (!this.expressionMap.mainAlias)
|
|
81
|
+
throw new error_1.TypeORMError(`Main alias is not set`); // todo: better exception
|
|
82
|
+
return this.expressionMap.mainAlias.name;
|
|
83
|
+
}
|
|
67
84
|
/**
|
|
68
85
|
* Creates SELECT query and selects given data.
|
|
69
86
|
* Replaces all previous selections if they exist.
|
|
70
87
|
*/
|
|
71
|
-
|
|
88
|
+
select(selection, selectionAliasName) {
|
|
72
89
|
this.expressionMap.queryType = "select";
|
|
73
90
|
if (Array.isArray(selection)) {
|
|
74
|
-
this.expressionMap.selects = selection.map(
|
|
91
|
+
this.expressionMap.selects = selection.map((selection) => ({
|
|
75
92
|
selection: selection,
|
|
76
|
-
})
|
|
93
|
+
}));
|
|
77
94
|
}
|
|
78
95
|
else if (selection) {
|
|
79
96
|
this.expressionMap.selects = [
|
|
@@ -81,29 +98,29 @@ var QueryBuilder = /** @class */ (function () {
|
|
|
81
98
|
];
|
|
82
99
|
}
|
|
83
100
|
// loading it dynamically because of circular issue
|
|
84
|
-
|
|
101
|
+
const SelectQueryBuilderCls = typescript_class_helpers_1.CLASS.getBy('SelectQueryBuilder');
|
|
85
102
|
if (InstanceChecker_1.InstanceChecker.isSelectQueryBuilder(this))
|
|
86
103
|
return this;
|
|
87
104
|
return new SelectQueryBuilderCls(this);
|
|
88
|
-
}
|
|
105
|
+
}
|
|
89
106
|
/**
|
|
90
107
|
* Creates INSERT query.
|
|
91
108
|
*/
|
|
92
|
-
|
|
109
|
+
insert() {
|
|
93
110
|
this.expressionMap.queryType = "insert";
|
|
94
111
|
// loading it dynamically because of circular issue // @ts-ignore
|
|
95
|
-
|
|
112
|
+
const InsertQueryBuilderCls = typescript_class_helpers_1.CLASS.getBy('InsertQueryBuilder');
|
|
96
113
|
// debugger
|
|
97
114
|
if (InstanceChecker_1.InstanceChecker.isInsertQueryBuilder(this)) {
|
|
98
115
|
return this;
|
|
99
116
|
}
|
|
100
117
|
return new InsertQueryBuilderCls(this);
|
|
101
|
-
}
|
|
118
|
+
}
|
|
102
119
|
/**
|
|
103
120
|
* Creates UPDATE query and applies given update values.
|
|
104
121
|
*/
|
|
105
|
-
|
|
106
|
-
|
|
122
|
+
update(entityOrTableNameUpdateSet, maybeUpdateSet) {
|
|
123
|
+
const updateSet = maybeUpdateSet
|
|
107
124
|
? maybeUpdateSet
|
|
108
125
|
: entityOrTableNameUpdateSet;
|
|
109
126
|
entityOrTableNameUpdateSet = InstanceChecker_1.InstanceChecker.isEntitySchema(entityOrTableNameUpdateSet)
|
|
@@ -111,93 +128,92 @@ var QueryBuilder = /** @class */ (function () {
|
|
|
111
128
|
: entityOrTableNameUpdateSet;
|
|
112
129
|
if (typeof entityOrTableNameUpdateSet === "function" ||
|
|
113
130
|
typeof entityOrTableNameUpdateSet === "string") {
|
|
114
|
-
|
|
131
|
+
const mainAlias = this.createFromAlias(entityOrTableNameUpdateSet);
|
|
115
132
|
this.expressionMap.setMainAlias(mainAlias);
|
|
116
133
|
}
|
|
117
134
|
this.expressionMap.queryType = "update";
|
|
118
135
|
this.expressionMap.valuesSet = updateSet;
|
|
119
136
|
// loading it dynamically because of circular issue
|
|
120
|
-
|
|
137
|
+
const UpdateQueryBuilderCls = typescript_class_helpers_1.CLASS.getBy('UpdateQueryBuilder');
|
|
121
138
|
if (InstanceChecker_1.InstanceChecker.isUpdateQueryBuilder(this))
|
|
122
139
|
return this;
|
|
123
140
|
return new UpdateQueryBuilderCls(this);
|
|
124
|
-
}
|
|
141
|
+
}
|
|
125
142
|
/**
|
|
126
143
|
* Creates DELETE query.
|
|
127
144
|
*/
|
|
128
|
-
|
|
145
|
+
delete() {
|
|
129
146
|
this.expressionMap.queryType = "delete";
|
|
130
147
|
// loading it dynamically because of circular issue
|
|
131
|
-
|
|
148
|
+
const DeleteQueryBuilderCls = typescript_class_helpers_1.CLASS.getBy('DeleteQueryBuilder');
|
|
132
149
|
if (InstanceChecker_1.InstanceChecker.isDeleteQueryBuilder(this))
|
|
133
150
|
return this;
|
|
134
151
|
return new DeleteQueryBuilderCls(this);
|
|
135
|
-
}
|
|
136
|
-
|
|
152
|
+
}
|
|
153
|
+
softDelete() {
|
|
137
154
|
this.expressionMap.queryType = "soft-delete";
|
|
138
155
|
// loading it dynamically because of circular issue
|
|
139
|
-
|
|
156
|
+
const SoftDeleteQueryBuilderCls = typescript_class_helpers_1.CLASS.getBy('SoftDeleteQueryBuilder');
|
|
140
157
|
if (InstanceChecker_1.InstanceChecker.isSoftDeleteQueryBuilder(this))
|
|
141
158
|
return this;
|
|
142
159
|
return new SoftDeleteQueryBuilderCls(this);
|
|
143
|
-
}
|
|
144
|
-
|
|
160
|
+
}
|
|
161
|
+
restore() {
|
|
145
162
|
this.expressionMap.queryType = "restore";
|
|
146
163
|
// loading it dynamically because of circular issue
|
|
147
|
-
|
|
164
|
+
const SoftDeleteQueryBuilderCls = typescript_class_helpers_1.CLASS.getBy('SoftDeleteQueryBuilder');
|
|
148
165
|
if (InstanceChecker_1.InstanceChecker.isSoftDeleteQueryBuilder(this))
|
|
149
166
|
return this;
|
|
150
167
|
return new SoftDeleteQueryBuilderCls(this);
|
|
151
|
-
}
|
|
168
|
+
}
|
|
152
169
|
/**
|
|
153
170
|
* Sets entity's relation with which this query builder gonna work.
|
|
154
171
|
*/
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
172
|
+
relation(entityTargetOrPropertyPath, maybePropertyPath) {
|
|
173
|
+
const entityTarget = arguments.length === 2 ? entityTargetOrPropertyPath : undefined;
|
|
174
|
+
const propertyPath = arguments.length === 2
|
|
158
175
|
? maybePropertyPath
|
|
159
176
|
: entityTargetOrPropertyPath;
|
|
160
177
|
this.expressionMap.queryType = "relation";
|
|
161
178
|
this.expressionMap.relationPropertyPath = propertyPath;
|
|
162
179
|
if (entityTarget) {
|
|
163
|
-
|
|
180
|
+
const mainAlias = this.createFromAlias(entityTarget);
|
|
164
181
|
this.expressionMap.setMainAlias(mainAlias);
|
|
165
182
|
}
|
|
166
183
|
// loading it dynamically because of circular issue
|
|
167
|
-
|
|
184
|
+
const RelationQueryBuilderCls = typescript_class_helpers_1.CLASS.getBy('RelationQueryBuilder');
|
|
168
185
|
if (InstanceChecker_1.InstanceChecker.isRelationQueryBuilder(this))
|
|
169
186
|
return this;
|
|
170
187
|
return new RelationQueryBuilderCls(this);
|
|
171
|
-
}
|
|
188
|
+
}
|
|
172
189
|
/**
|
|
173
190
|
* Checks if given relation or relations exist in the entity.
|
|
174
191
|
* Returns true if relation exists, false otherwise.
|
|
175
192
|
*
|
|
176
193
|
* todo: move this method to manager? or create a shortcut?
|
|
177
194
|
*/
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
return relations.every(
|
|
195
|
+
hasRelation(target, relation) {
|
|
196
|
+
const entityMetadata = this.connection.getMetadata(target);
|
|
197
|
+
const relations = Array.isArray(relation) ? relation : [relation];
|
|
198
|
+
return relations.every((relation) => {
|
|
182
199
|
return !!entityMetadata.findRelationWithPropertyPath(relation);
|
|
183
200
|
});
|
|
184
|
-
}
|
|
201
|
+
}
|
|
185
202
|
/**
|
|
186
203
|
* Check the existence of a parameter for this query builder.
|
|
187
204
|
*/
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
return (((_a = this.parentQueryBuilder) === null || _a === void 0 ? void 0 : _a.hasParameter(key)) ||
|
|
205
|
+
hasParameter(key) {
|
|
206
|
+
return (this.parentQueryBuilder?.hasParameter(key) ||
|
|
191
207
|
key in this.expressionMap.parameters);
|
|
192
|
-
}
|
|
208
|
+
}
|
|
193
209
|
/**
|
|
194
210
|
* Sets parameter name and its value.
|
|
195
211
|
*
|
|
196
212
|
* The key for this parameter may contain numbers, letters, underscores, or periods.
|
|
197
213
|
*/
|
|
198
|
-
|
|
214
|
+
setParameter(key, value) {
|
|
199
215
|
if (typeof value === "function") {
|
|
200
|
-
throw new error_1.TypeORMError(
|
|
216
|
+
throw new error_1.TypeORMError(`Function parameter isn't supported in the parameters. Please check "${key}" parameter.`);
|
|
201
217
|
}
|
|
202
218
|
if (!key.match(/^([A-Za-z0-9_.]+)$/)) {
|
|
203
219
|
throw new error_1.TypeORMError("QueryBuilder parameter keys may only contain numbers, letters, underscores, or periods.");
|
|
@@ -207,198 +223,172 @@ var QueryBuilder = /** @class */ (function () {
|
|
|
207
223
|
}
|
|
208
224
|
this.expressionMap.parameters[key] = value;
|
|
209
225
|
return this;
|
|
210
|
-
}
|
|
226
|
+
}
|
|
211
227
|
/**
|
|
212
228
|
* Adds all parameters from the given object.
|
|
213
229
|
*/
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
for (var _b = tslib_1.__values(Object.entries(parameters)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
218
|
-
var _d = tslib_1.__read(_c.value, 2), key = _d[0], value = _d[1];
|
|
219
|
-
this.setParameter(key, value);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
223
|
-
finally {
|
|
224
|
-
try {
|
|
225
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
226
|
-
}
|
|
227
|
-
finally { if (e_1) throw e_1.error; }
|
|
230
|
+
setParameters(parameters) {
|
|
231
|
+
for (const [key, value] of Object.entries(parameters)) {
|
|
232
|
+
this.setParameter(key, value);
|
|
228
233
|
}
|
|
229
234
|
return this;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
|
|
235
|
+
}
|
|
236
|
+
createParameter(value) {
|
|
237
|
+
let parameterName;
|
|
233
238
|
do {
|
|
234
|
-
parameterName =
|
|
239
|
+
parameterName = `orm_param_${this.parameterIndex++}`;
|
|
235
240
|
} while (this.hasParameter(parameterName));
|
|
236
241
|
this.setParameter(parameterName, value);
|
|
237
|
-
return
|
|
238
|
-
}
|
|
242
|
+
return `:${parameterName}`;
|
|
243
|
+
}
|
|
239
244
|
/**
|
|
240
245
|
* Adds native parameters from the given object.
|
|
241
246
|
*
|
|
242
247
|
* @deprecated Use `setParameters` instead
|
|
243
248
|
*/
|
|
244
|
-
|
|
245
|
-
var _this = this;
|
|
249
|
+
setNativeParameters(parameters) {
|
|
246
250
|
// set parent query builder parameters as well in sub-query mode
|
|
247
251
|
if (this.parentQueryBuilder) {
|
|
248
252
|
this.parentQueryBuilder.setNativeParameters(parameters);
|
|
249
253
|
}
|
|
250
|
-
Object.keys(parameters).forEach(
|
|
251
|
-
|
|
254
|
+
Object.keys(parameters).forEach((key) => {
|
|
255
|
+
this.expressionMap.nativeParameters[key] = parameters[key];
|
|
252
256
|
});
|
|
253
257
|
return this;
|
|
254
|
-
}
|
|
258
|
+
}
|
|
255
259
|
/**
|
|
256
260
|
* Gets all parameters.
|
|
257
261
|
*/
|
|
258
|
-
|
|
259
|
-
|
|
262
|
+
getParameters() {
|
|
263
|
+
const parameters = Object.assign({}, this.expressionMap.parameters);
|
|
260
264
|
// add discriminator column parameter if it exist
|
|
261
265
|
if (this.expressionMap.mainAlias &&
|
|
262
266
|
this.expressionMap.mainAlias.hasMetadata) {
|
|
263
|
-
|
|
267
|
+
const metadata = this.expressionMap.mainAlias.metadata;
|
|
264
268
|
if (metadata.discriminatorColumn && metadata.parentEntityMetadata) {
|
|
265
|
-
|
|
266
|
-
.filter(
|
|
267
|
-
.map(
|
|
269
|
+
const values = metadata.childEntityMetadatas
|
|
270
|
+
.filter((childMetadata) => childMetadata.discriminatorColumn)
|
|
271
|
+
.map((childMetadata) => childMetadata.discriminatorValue);
|
|
268
272
|
values.push(metadata.discriminatorValue);
|
|
269
273
|
parameters["discriminatorColumnValues"] = values;
|
|
270
274
|
}
|
|
271
275
|
}
|
|
272
276
|
return parameters;
|
|
273
|
-
}
|
|
277
|
+
}
|
|
274
278
|
/**
|
|
275
279
|
* Prints sql to stdout using console.log.
|
|
276
280
|
*/
|
|
277
|
-
|
|
281
|
+
printSql() {
|
|
278
282
|
// TODO rename to logSql()
|
|
279
|
-
|
|
283
|
+
const [query, parameters] = this.getQueryAndParameters();
|
|
280
284
|
this.connection.logger.logQuery(query, parameters);
|
|
281
285
|
return this;
|
|
282
|
-
}
|
|
286
|
+
}
|
|
283
287
|
/**
|
|
284
288
|
* Gets generated sql that will be executed.
|
|
285
289
|
* Parameters in the query are escaped for the currently used driver.
|
|
286
290
|
*/
|
|
287
|
-
|
|
291
|
+
getSql() {
|
|
288
292
|
return this.getQueryAndParameters()[0];
|
|
289
|
-
}
|
|
293
|
+
}
|
|
290
294
|
/**
|
|
291
295
|
* Gets query to be executed with all parameters used in it.
|
|
292
296
|
*/
|
|
293
|
-
|
|
297
|
+
getQueryAndParameters() {
|
|
294
298
|
// this execution order is important because getQuery method generates this.expressionMap.nativeParameters values
|
|
295
|
-
|
|
296
|
-
|
|
299
|
+
const query = this.getQuery();
|
|
300
|
+
const parameters = this.getParameters();
|
|
297
301
|
return this.connection.driver.escapeQueryWithParameters(query, parameters, this.expressionMap.nativeParameters);
|
|
298
|
-
}
|
|
302
|
+
}
|
|
299
303
|
/**
|
|
300
304
|
* Executes sql generated by query builder and returns raw database results.
|
|
301
305
|
*/
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
case 3:
|
|
316
|
-
if (!(queryRunner !== this.queryRunner)) return [3 /*break*/, 5];
|
|
317
|
-
// means we created our own query runner
|
|
318
|
-
return [4 /*yield*/, queryRunner.release()];
|
|
319
|
-
case 4:
|
|
320
|
-
// means we created our own query runner
|
|
321
|
-
_b.sent();
|
|
322
|
-
_b.label = 5;
|
|
323
|
-
case 5: return [7 /*endfinally*/];
|
|
324
|
-
case 6: return [2 /*return*/];
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
});
|
|
328
|
-
};
|
|
306
|
+
async execute() {
|
|
307
|
+
const [sql, parameters] = this.getQueryAndParameters();
|
|
308
|
+
const queryRunner = this.obtainQueryRunner();
|
|
309
|
+
try {
|
|
310
|
+
return await queryRunner.query(sql, parameters); // await is needed here because we are using finally
|
|
311
|
+
}
|
|
312
|
+
finally {
|
|
313
|
+
if (queryRunner !== this.queryRunner) {
|
|
314
|
+
// means we created our own query runner
|
|
315
|
+
await queryRunner.release();
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
329
319
|
/**
|
|
330
320
|
* Creates a completely new query builder.
|
|
331
321
|
* Uses same query runner as current QueryBuilder.
|
|
332
322
|
*/
|
|
333
|
-
|
|
323
|
+
createQueryBuilder() {
|
|
334
324
|
return new this.constructor(this.connection, this.queryRunner);
|
|
335
|
-
}
|
|
325
|
+
}
|
|
336
326
|
/**
|
|
337
327
|
* Clones query builder as it is.
|
|
338
328
|
* Note: it uses new query runner, if you want query builder that uses exactly same query runner,
|
|
339
329
|
* you can create query builder using its constructor, for example new SelectQueryBuilder(queryBuilder)
|
|
340
330
|
* where queryBuilder is cloned QueryBuilder.
|
|
341
331
|
*/
|
|
342
|
-
|
|
332
|
+
clone() {
|
|
343
333
|
return new this.constructor(this);
|
|
344
|
-
}
|
|
334
|
+
}
|
|
345
335
|
/**
|
|
346
336
|
* Includes a Query comment in the query builder. This is helpful for debugging purposes,
|
|
347
337
|
* such as finding a specific query in the database server's logs, or for categorization using
|
|
348
338
|
* an APM product.
|
|
349
339
|
*/
|
|
350
|
-
|
|
340
|
+
comment(comment) {
|
|
351
341
|
this.expressionMap.comment = comment;
|
|
352
342
|
return this;
|
|
353
|
-
}
|
|
343
|
+
}
|
|
354
344
|
/**
|
|
355
345
|
* Disables escaping.
|
|
356
346
|
*/
|
|
357
|
-
|
|
347
|
+
disableEscaping() {
|
|
358
348
|
this.expressionMap.disableEscaping = false;
|
|
359
349
|
return this;
|
|
360
|
-
}
|
|
350
|
+
}
|
|
361
351
|
/**
|
|
362
352
|
* Escapes table name, column name or alias name using current database's escaping character.
|
|
363
353
|
*/
|
|
364
|
-
|
|
354
|
+
escape(name) {
|
|
365
355
|
if (!this.expressionMap.disableEscaping)
|
|
366
356
|
return name;
|
|
367
357
|
return this.connection.driver.escape(name);
|
|
368
|
-
}
|
|
358
|
+
}
|
|
369
359
|
/**
|
|
370
360
|
* Sets or overrides query builder's QueryRunner.
|
|
371
361
|
*/
|
|
372
|
-
|
|
362
|
+
setQueryRunner(queryRunner) {
|
|
373
363
|
this.queryRunner = queryRunner;
|
|
374
364
|
return this;
|
|
375
|
-
}
|
|
365
|
+
}
|
|
376
366
|
/**
|
|
377
367
|
* Indicates if listeners and subscribers must be called before and after query execution.
|
|
378
368
|
* Enabled by default.
|
|
379
369
|
*/
|
|
380
|
-
|
|
370
|
+
callListeners(enabled) {
|
|
381
371
|
this.expressionMap.callListeners = enabled;
|
|
382
372
|
return this;
|
|
383
|
-
}
|
|
373
|
+
}
|
|
384
374
|
/**
|
|
385
375
|
* If set to true the query will be wrapped into a transaction.
|
|
386
376
|
*/
|
|
387
|
-
|
|
377
|
+
useTransaction(enabled) {
|
|
388
378
|
this.expressionMap.useTransaction = enabled;
|
|
389
379
|
return this;
|
|
390
|
-
}
|
|
380
|
+
}
|
|
391
381
|
/**
|
|
392
382
|
* Adds CTE to query
|
|
393
383
|
*/
|
|
394
|
-
|
|
384
|
+
addCommonTableExpression(queryBuilder, alias, options) {
|
|
395
385
|
this.expressionMap.commonTableExpressions.push({
|
|
396
|
-
queryBuilder
|
|
397
|
-
alias
|
|
386
|
+
queryBuilder,
|
|
387
|
+
alias,
|
|
398
388
|
options: options || {},
|
|
399
389
|
});
|
|
400
390
|
return this;
|
|
401
|
-
}
|
|
391
|
+
}
|
|
402
392
|
// -------------------------------------------------------------------------
|
|
403
393
|
// Protected Methods
|
|
404
394
|
// -------------------------------------------------------------------------
|
|
@@ -406,37 +396,36 @@ var QueryBuilder = /** @class */ (function () {
|
|
|
406
396
|
* Gets escaped table name with schema name if SqlServer driver used with custom
|
|
407
397
|
* schema name, otherwise returns escaped table name.
|
|
408
398
|
*/
|
|
409
|
-
|
|
410
|
-
var _this = this;
|
|
399
|
+
getTableName(tablePath) {
|
|
411
400
|
return tablePath
|
|
412
401
|
.split(".")
|
|
413
|
-
.map(
|
|
402
|
+
.map((i) => {
|
|
414
403
|
// this condition need because in SQL Server driver when custom database name was specified and schema name was not, we got `dbName..tableName` string, and doesn't need to escape middle empty string
|
|
415
404
|
if (i === "")
|
|
416
405
|
return i;
|
|
417
|
-
return
|
|
406
|
+
return this.escape(i);
|
|
418
407
|
})
|
|
419
408
|
.join(".");
|
|
420
|
-
}
|
|
409
|
+
}
|
|
421
410
|
/**
|
|
422
411
|
* Gets name of the table where insert should be performed.
|
|
423
412
|
*/
|
|
424
|
-
|
|
413
|
+
getMainTableName() {
|
|
425
414
|
if (!this.expressionMap.mainAlias)
|
|
426
|
-
throw new error_1.TypeORMError(
|
|
415
|
+
throw new error_1.TypeORMError(`Entity where values should be inserted is not specified. Call "qb.into(entity)" method to specify it.`);
|
|
427
416
|
if (this.expressionMap.mainAlias.hasMetadata)
|
|
428
417
|
return this.expressionMap.mainAlias.metadata.tablePath;
|
|
429
418
|
return this.expressionMap.mainAlias.tablePath;
|
|
430
|
-
}
|
|
419
|
+
}
|
|
431
420
|
/**
|
|
432
421
|
* Specifies FROM which entity's table select/update/delete will be executed.
|
|
433
422
|
* Also sets a main string alias of the selection data.
|
|
434
423
|
*/
|
|
435
|
-
|
|
424
|
+
createFromAlias(entityTarget, aliasName) {
|
|
436
425
|
// if table has a metadata then find it to properly escape its properties
|
|
437
426
|
// const metadata = this.connection.entityMetadatas.find(metadata => metadata.tableName === tableName);
|
|
438
427
|
if (this.connection.hasMetadata(entityTarget)) {
|
|
439
|
-
|
|
428
|
+
const metadata = this.connection.getMetadata(entityTarget);
|
|
440
429
|
return this.expressionMap.createAlias({
|
|
441
430
|
type: "from",
|
|
442
431
|
name: aliasName,
|
|
@@ -446,7 +435,7 @@ var QueryBuilder = /** @class */ (function () {
|
|
|
446
435
|
}
|
|
447
436
|
else {
|
|
448
437
|
if (typeof entityTarget === "string") {
|
|
449
|
-
|
|
438
|
+
const isSubquery = entityTarget.substr(0, 1) === "(" &&
|
|
450
439
|
entityTarget.substr(-1) === ")";
|
|
451
440
|
return this.expressionMap.createAlias({
|
|
452
441
|
type: "from",
|
|
@@ -457,153 +446,79 @@ var QueryBuilder = /** @class */ (function () {
|
|
|
457
446
|
subQuery: isSubquery ? entityTarget : undefined,
|
|
458
447
|
});
|
|
459
448
|
}
|
|
460
|
-
|
|
449
|
+
const subQueryBuilder = entityTarget(this.subQuery());
|
|
461
450
|
this.setParameters(subQueryBuilder.getParameters());
|
|
462
|
-
|
|
451
|
+
const subquery = subQueryBuilder.getQuery();
|
|
463
452
|
return this.expressionMap.createAlias({
|
|
464
453
|
type: "from",
|
|
465
454
|
name: aliasName,
|
|
466
455
|
subQuery: subquery,
|
|
467
456
|
});
|
|
468
457
|
}
|
|
469
|
-
}
|
|
458
|
+
}
|
|
470
459
|
/**
|
|
471
460
|
* Replaces all entity's propertyName to name in the given statement.
|
|
472
461
|
*/
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
var _this = this;
|
|
476
|
-
var _loop_1 = function (alias) {
|
|
477
|
-
var e_3, _d, e_4, _e, e_5, _f, e_6, _g, e_7, _h, e_8, _j;
|
|
462
|
+
replacePropertyNames(statement) {
|
|
463
|
+
for (const alias of this.expressionMap.aliases) {
|
|
478
464
|
if (!alias.hasMetadata)
|
|
479
|
-
|
|
480
|
-
|
|
465
|
+
continue;
|
|
466
|
+
const replaceAliasNamePrefix = this.expressionMap
|
|
481
467
|
.aliasNamePrefixingEnabled
|
|
482
|
-
?
|
|
468
|
+
? `${alias.name}.`
|
|
483
469
|
: "";
|
|
484
|
-
|
|
470
|
+
const replacementAliasNamePrefix = this.expressionMap
|
|
485
471
|
.aliasNamePrefixingEnabled
|
|
486
|
-
?
|
|
472
|
+
? `${this.escape(alias.name)}.`
|
|
487
473
|
: "";
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
replacements[relation.propertyPath] =
|
|
502
|
-
relation.joinColumns[0].databaseName;
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
506
|
-
finally {
|
|
507
|
-
try {
|
|
508
|
-
if (_l && !_l.done && (_d = _k.return)) _d.call(_k);
|
|
509
|
-
}
|
|
510
|
-
finally { if (e_3) throw e_3.error; }
|
|
511
|
-
}
|
|
512
|
-
try {
|
|
513
|
-
for (var _m = (e_4 = void 0, tslib_1.__values(alias.metadata.relations)), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
514
|
-
var relation = _o.value;
|
|
515
|
-
try {
|
|
516
|
-
for (var _p = (e_5 = void 0, tslib_1.__values(tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(relation.joinColumns), false), tslib_1.__read(relation.inverseJoinColumns), false))), _q = _p.next(); !_q.done; _q = _p.next()) {
|
|
517
|
-
var joinColumn = _q.value;
|
|
518
|
-
var propertyKey = "".concat(relation.propertyPath, ".").concat(joinColumn.referencedColumn.propertyPath);
|
|
519
|
-
replacements[propertyKey] = joinColumn.databaseName;
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
523
|
-
finally {
|
|
524
|
-
try {
|
|
525
|
-
if (_q && !_q.done && (_f = _p.return)) _f.call(_p);
|
|
526
|
-
}
|
|
527
|
-
finally { if (e_5) throw e_5.error; }
|
|
528
|
-
}
|
|
529
|
-
}
|
|
474
|
+
const replacements = {};
|
|
475
|
+
// Insert & overwrite the replacements from least to most relevant in our replacements object.
|
|
476
|
+
// To do this we iterate and overwrite in the order of relevance.
|
|
477
|
+
// Least to Most Relevant:
|
|
478
|
+
// * Relation Property Path to first join column key
|
|
479
|
+
// * Relation Property Path + Column Path
|
|
480
|
+
// * Column Database Name
|
|
481
|
+
// * Column Property Name
|
|
482
|
+
// * Column Property Path
|
|
483
|
+
for (const relation of alias.metadata.relations) {
|
|
484
|
+
if (relation.joinColumns.length > 0)
|
|
485
|
+
replacements[relation.propertyPath] =
|
|
486
|
+
relation.joinColumns[0].databaseName;
|
|
530
487
|
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
488
|
+
for (const relation of alias.metadata.relations) {
|
|
489
|
+
for (const joinColumn of [
|
|
490
|
+
...relation.joinColumns,
|
|
491
|
+
...relation.inverseJoinColumns,
|
|
492
|
+
]) {
|
|
493
|
+
const propertyKey = `${relation.propertyPath}.${joinColumn.referencedColumn.propertyPath}`;
|
|
494
|
+
replacements[propertyKey] = joinColumn.databaseName;
|
|
535
495
|
}
|
|
536
|
-
finally { if (e_4) throw e_4.error; }
|
|
537
496
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
var column = _s.value;
|
|
541
|
-
replacements[column.databaseName] = column.databaseName;
|
|
542
|
-
}
|
|
497
|
+
for (const column of alias.metadata.columns) {
|
|
498
|
+
replacements[column.databaseName] = column.databaseName;
|
|
543
499
|
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
try {
|
|
547
|
-
if (_s && !_s.done && (_g = _r.return)) _g.call(_r);
|
|
548
|
-
}
|
|
549
|
-
finally { if (e_6) throw e_6.error; }
|
|
550
|
-
}
|
|
551
|
-
try {
|
|
552
|
-
for (var _t = (e_7 = void 0, tslib_1.__values(alias.metadata.columns)), _u = _t.next(); !_u.done; _u = _t.next()) {
|
|
553
|
-
var column = _u.value;
|
|
554
|
-
replacements[column.propertyName] = column.databaseName;
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
558
|
-
finally {
|
|
559
|
-
try {
|
|
560
|
-
if (_u && !_u.done && (_h = _t.return)) _h.call(_t);
|
|
561
|
-
}
|
|
562
|
-
finally { if (e_7) throw e_7.error; }
|
|
563
|
-
}
|
|
564
|
-
try {
|
|
565
|
-
for (var _v = (e_8 = void 0, tslib_1.__values(alias.metadata.columns)), _w = _v.next(); !_w.done; _w = _v.next()) {
|
|
566
|
-
var column = _w.value;
|
|
567
|
-
replacements[column.propertyPath] = column.databaseName;
|
|
568
|
-
}
|
|
500
|
+
for (const column of alias.metadata.columns) {
|
|
501
|
+
replacements[column.propertyName] = column.databaseName;
|
|
569
502
|
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
try {
|
|
573
|
-
if (_w && !_w.done && (_j = _v.return)) _j.call(_v);
|
|
574
|
-
}
|
|
575
|
-
finally { if (e_8) throw e_8.error; }
|
|
503
|
+
for (const column of alias.metadata.columns) {
|
|
504
|
+
replacements[column.propertyPath] = column.databaseName;
|
|
576
505
|
}
|
|
577
506
|
statement = statement.replace(new RegExp(
|
|
578
507
|
// Avoid a lookbehind here since it's not well supported
|
|
579
|
-
|
|
508
|
+
`([ =\(]|^.{0})` + // any of ' =(' or start of line
|
|
580
509
|
// followed by our prefix, e.g. 'tablename.' or ''
|
|
581
|
-
|
|
510
|
+
`${(0, escapeRegExp_1.escapeRegExp)(replaceAliasNamePrefix)}([^ =\(\)\,]+)` + // a possible property name: sequence of anything but ' =(),'
|
|
582
511
|
// terminated by ' =),' or end of line
|
|
583
|
-
|
|
512
|
+
`(?=[ =\)\,]|.{0}$)`, "gm"), (match, pre, p) => {
|
|
584
513
|
if (replacements[p]) {
|
|
585
|
-
return
|
|
514
|
+
return `${pre}${replacementAliasNamePrefix}${this.escape(replacements[p])}`;
|
|
586
515
|
}
|
|
587
516
|
return match;
|
|
588
517
|
});
|
|
589
|
-
};
|
|
590
|
-
var this_1 = this;
|
|
591
|
-
try {
|
|
592
|
-
for (var _b = tslib_1.__values(this.expressionMap.aliases), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
593
|
-
var alias = _c.value;
|
|
594
|
-
_loop_1(alias);
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
598
|
-
finally {
|
|
599
|
-
try {
|
|
600
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
601
|
-
}
|
|
602
|
-
finally { if (e_2) throw e_2.error; }
|
|
603
518
|
}
|
|
604
519
|
return statement;
|
|
605
|
-
}
|
|
606
|
-
|
|
520
|
+
}
|
|
521
|
+
createComment() {
|
|
607
522
|
if (!this.expressionMap.comment) {
|
|
608
523
|
return "";
|
|
609
524
|
}
|
|
@@ -611,84 +526,83 @@ var QueryBuilder = /** @class */ (function () {
|
|
|
611
526
|
// In some dialects query nesting is available - but not all. Because of this, we'll need
|
|
612
527
|
// to scrub "ending" characters from the SQL but otherwise we can leave everything else
|
|
613
528
|
// as-is and it should be valid.
|
|
614
|
-
return
|
|
615
|
-
}
|
|
529
|
+
return `/* ${this.expressionMap.comment.replace("*/", "")} */ `;
|
|
530
|
+
}
|
|
616
531
|
/**
|
|
617
532
|
* Creates "WHERE" expression.
|
|
618
533
|
*/
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
534
|
+
createWhereExpression() {
|
|
535
|
+
const conditionsArray = [];
|
|
536
|
+
const whereExpression = this.createWhereClausesExpression(this.expressionMap.wheres);
|
|
622
537
|
if (whereExpression.length > 0 && whereExpression !== "1=1") {
|
|
623
538
|
conditionsArray.push(this.replacePropertyNames(whereExpression));
|
|
624
539
|
}
|
|
625
540
|
if (this.expressionMap.mainAlias.hasMetadata) {
|
|
626
|
-
|
|
541
|
+
const metadata = this.expressionMap.mainAlias.metadata;
|
|
627
542
|
// Adds the global condition of "non-deleted" for the entity with delete date columns in select query.
|
|
628
543
|
if (this.expressionMap.queryType === "select" &&
|
|
629
544
|
!this.expressionMap.withDeleted &&
|
|
630
545
|
metadata.deleteDateColumn) {
|
|
631
|
-
|
|
546
|
+
const column = this.expressionMap.aliasNamePrefixingEnabled
|
|
632
547
|
? this.expressionMap.mainAlias.name +
|
|
633
548
|
"." +
|
|
634
549
|
metadata.deleteDateColumn.propertyName
|
|
635
550
|
: metadata.deleteDateColumn.propertyName;
|
|
636
|
-
|
|
551
|
+
const condition = `${this.replacePropertyNames(column)} IS NULL`;
|
|
637
552
|
conditionsArray.push(condition);
|
|
638
553
|
}
|
|
639
554
|
if (metadata.discriminatorColumn && metadata.parentEntityMetadata) {
|
|
640
|
-
|
|
555
|
+
const column = this.expressionMap.aliasNamePrefixingEnabled
|
|
641
556
|
? this.expressionMap.mainAlias.name +
|
|
642
557
|
"." +
|
|
643
558
|
metadata.discriminatorColumn.databaseName
|
|
644
559
|
: metadata.discriminatorColumn.databaseName;
|
|
645
|
-
|
|
560
|
+
const condition = `${this.replacePropertyNames(column)} IN (:...discriminatorColumnValues)`;
|
|
646
561
|
conditionsArray.push(condition);
|
|
647
562
|
}
|
|
648
563
|
}
|
|
649
564
|
if (this.expressionMap.extraAppendedAndWhereCondition) {
|
|
650
|
-
|
|
565
|
+
const condition = this.replacePropertyNames(this.expressionMap.extraAppendedAndWhereCondition);
|
|
651
566
|
conditionsArray.push(condition);
|
|
652
567
|
}
|
|
653
568
|
if (!conditionsArray.length) {
|
|
654
569
|
return "";
|
|
655
570
|
}
|
|
656
571
|
else if (conditionsArray.length === 1) {
|
|
657
|
-
return
|
|
572
|
+
return ` WHERE ${conditionsArray[0]}`;
|
|
658
573
|
}
|
|
659
574
|
else {
|
|
660
|
-
return
|
|
575
|
+
return ` WHERE ( ${conditionsArray.join(" ) AND ( ")} )`;
|
|
661
576
|
}
|
|
662
|
-
}
|
|
577
|
+
}
|
|
663
578
|
/**
|
|
664
579
|
* Creates "RETURNING" / "OUTPUT" expression.
|
|
665
580
|
*/
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
var driver = this.connection.driver;
|
|
581
|
+
createReturningExpression(returningType) {
|
|
582
|
+
const columns = this.getReturningColumns();
|
|
583
|
+
const driver = this.connection.driver;
|
|
670
584
|
// also add columns we must auto-return to perform entity updation
|
|
671
585
|
// if user gave his own returning
|
|
672
586
|
if (typeof this.expressionMap.returning !== "string" &&
|
|
673
587
|
this.expressionMap.extraReturningColumns.length > 0 &&
|
|
674
588
|
driver.isReturningSqlSupported(returningType)) {
|
|
675
|
-
columns.push
|
|
589
|
+
columns.push(...this.expressionMap.extraReturningColumns.filter((column) => {
|
|
676
590
|
return columns.indexOf(column) === -1;
|
|
677
|
-
}))
|
|
591
|
+
}));
|
|
678
592
|
}
|
|
679
593
|
if (columns.length) {
|
|
680
|
-
|
|
681
|
-
.map(
|
|
682
|
-
|
|
594
|
+
let columnsExpression = columns
|
|
595
|
+
.map((column) => {
|
|
596
|
+
const name = this.escape(column.databaseName);
|
|
683
597
|
if (driver.options.type === "mssql") {
|
|
684
|
-
if (
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
598
|
+
if (this.expressionMap.queryType === "insert" ||
|
|
599
|
+
this.expressionMap.queryType === "update" ||
|
|
600
|
+
this.expressionMap.queryType === "soft-delete" ||
|
|
601
|
+
this.expressionMap.queryType === "restore") {
|
|
688
602
|
return "INSERTED." + name;
|
|
689
603
|
}
|
|
690
604
|
else {
|
|
691
|
-
return (
|
|
605
|
+
return (this.escape(this.getMainTableName()) +
|
|
692
606
|
"." +
|
|
693
607
|
name);
|
|
694
608
|
}
|
|
@@ -703,8 +617,8 @@ var QueryBuilder = /** @class */ (function () {
|
|
|
703
617
|
columnsExpression +=
|
|
704
618
|
" INTO " +
|
|
705
619
|
columns
|
|
706
|
-
.map(
|
|
707
|
-
return
|
|
620
|
+
.map((column) => {
|
|
621
|
+
return this.createParameter({
|
|
708
622
|
type: driver.columnTypeToNativeParameter(column.type),
|
|
709
623
|
dir: driver.oracle.BIND_OUT,
|
|
710
624
|
});
|
|
@@ -726,29 +640,27 @@ var QueryBuilder = /** @class */ (function () {
|
|
|
726
640
|
return this.expressionMap.returning;
|
|
727
641
|
}
|
|
728
642
|
return "";
|
|
729
|
-
}
|
|
643
|
+
}
|
|
730
644
|
/**
|
|
731
645
|
* If returning / output cause is set to array of column names,
|
|
732
646
|
* then this method will return all column metadatas of those column names.
|
|
733
647
|
*/
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
var columns = [];
|
|
648
|
+
getReturningColumns() {
|
|
649
|
+
const columns = [];
|
|
737
650
|
if (Array.isArray(this.expressionMap.returning)) {
|
|
738
651
|
;
|
|
739
|
-
this.expressionMap.returning.forEach(
|
|
740
|
-
if (
|
|
741
|
-
columns.push
|
|
652
|
+
this.expressionMap.returning.forEach((columnName) => {
|
|
653
|
+
if (this.expressionMap.mainAlias.hasMetadata) {
|
|
654
|
+
columns.push(...this.expressionMap.mainAlias.metadata.findColumnsWithPropertyPath(columnName));
|
|
742
655
|
}
|
|
743
656
|
});
|
|
744
657
|
}
|
|
745
658
|
return columns;
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
var _this = this;
|
|
659
|
+
}
|
|
660
|
+
createWhereClausesExpression(clauses) {
|
|
749
661
|
return clauses
|
|
750
|
-
.map(
|
|
751
|
-
|
|
662
|
+
.map((clause, index) => {
|
|
663
|
+
const expression = this.createWhereConditionExpression(clause.condition);
|
|
752
664
|
switch (clause.type) {
|
|
753
665
|
case "and":
|
|
754
666
|
return (index > 0 ? "AND " : "") + expression;
|
|
@@ -759,12 +671,11 @@ var QueryBuilder = /** @class */ (function () {
|
|
|
759
671
|
})
|
|
760
672
|
.join(" ")
|
|
761
673
|
.trim();
|
|
762
|
-
}
|
|
674
|
+
}
|
|
763
675
|
/**
|
|
764
676
|
* Computes given where argument - transforms to a where string all forms it can take.
|
|
765
677
|
*/
|
|
766
|
-
|
|
767
|
-
if (alwaysWrap === void 0) { alwaysWrap = false; }
|
|
678
|
+
createWhereConditionExpression(condition, alwaysWrap = false) {
|
|
768
679
|
if (typeof condition === "string")
|
|
769
680
|
return condition;
|
|
770
681
|
if (Array.isArray(condition)) {
|
|
@@ -778,91 +689,90 @@ var QueryBuilder = /** @class */ (function () {
|
|
|
778
689
|
}
|
|
779
690
|
return "(" + this.createWhereClausesExpression(condition) + ")";
|
|
780
691
|
}
|
|
781
|
-
|
|
692
|
+
const { driver } = this.connection;
|
|
782
693
|
switch (condition.operator) {
|
|
783
694
|
case "lessThan":
|
|
784
|
-
return
|
|
695
|
+
return `${condition.parameters[0]} < ${condition.parameters[1]}`;
|
|
785
696
|
case "lessThanOrEqual":
|
|
786
|
-
return
|
|
697
|
+
return `${condition.parameters[0]} <= ${condition.parameters[1]}`;
|
|
787
698
|
case "arrayContains":
|
|
788
|
-
return
|
|
699
|
+
return `${condition.parameters[0]} @> ${condition.parameters[1]}`;
|
|
789
700
|
case "arrayContainedBy":
|
|
790
|
-
return
|
|
701
|
+
return `${condition.parameters[0]} <@ ${condition.parameters[1]}`;
|
|
791
702
|
case "arrayOverlap":
|
|
792
|
-
return
|
|
703
|
+
return `${condition.parameters[0]} && ${condition.parameters[1]}`;
|
|
793
704
|
case "moreThan":
|
|
794
|
-
return
|
|
705
|
+
return `${condition.parameters[0]} > ${condition.parameters[1]}`;
|
|
795
706
|
case "moreThanOrEqual":
|
|
796
|
-
return
|
|
707
|
+
return `${condition.parameters[0]} >= ${condition.parameters[1]}`;
|
|
797
708
|
case "notEqual":
|
|
798
|
-
return
|
|
709
|
+
return `${condition.parameters[0]} != ${condition.parameters[1]}`;
|
|
799
710
|
case "equal":
|
|
800
|
-
return
|
|
711
|
+
return `${condition.parameters[0]} = ${condition.parameters[1]}`;
|
|
801
712
|
case "ilike":
|
|
802
713
|
if (driver.options.type === "postgres" ||
|
|
803
714
|
driver.options.type === "cockroachdb") {
|
|
804
|
-
return
|
|
715
|
+
return `${condition.parameters[0]} ILIKE ${condition.parameters[1]}`;
|
|
805
716
|
}
|
|
806
|
-
return
|
|
717
|
+
return `UPPER(${condition.parameters[0]}) LIKE UPPER(${condition.parameters[1]})`;
|
|
807
718
|
case "like":
|
|
808
|
-
return
|
|
719
|
+
return `${condition.parameters[0]} LIKE ${condition.parameters[1]}`;
|
|
809
720
|
case "between":
|
|
810
|
-
return
|
|
721
|
+
return `${condition.parameters[0]} BETWEEN ${condition.parameters[1]} AND ${condition.parameters[2]}`;
|
|
811
722
|
case "in":
|
|
812
723
|
if (condition.parameters.length <= 1) {
|
|
813
724
|
return "0=1";
|
|
814
725
|
}
|
|
815
|
-
return
|
|
726
|
+
return `${condition.parameters[0]} IN (${condition.parameters
|
|
816
727
|
.slice(1)
|
|
817
|
-
.join(", ")
|
|
728
|
+
.join(", ")})`;
|
|
818
729
|
case "any":
|
|
819
|
-
return
|
|
730
|
+
return `${condition.parameters[0]} = ANY(${condition.parameters[1]})`;
|
|
820
731
|
case "isNull":
|
|
821
|
-
return
|
|
732
|
+
return `${condition.parameters[0]} IS NULL`;
|
|
822
733
|
case "not":
|
|
823
|
-
return
|
|
734
|
+
return `NOT(${this.createWhereConditionExpression(condition.condition)})`;
|
|
824
735
|
case "brackets":
|
|
825
|
-
return
|
|
736
|
+
return `${this.createWhereConditionExpression(condition.condition, true)}`;
|
|
826
737
|
}
|
|
827
|
-
throw new TypeError(
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
var _this = this;
|
|
738
|
+
throw new TypeError(`Unsupported FindOperator ${FindOperator_1.FindOperator.constructor.name}`);
|
|
739
|
+
}
|
|
740
|
+
createCteExpression() {
|
|
831
741
|
if (!this.hasCommonTableExpressions()) {
|
|
832
742
|
return "";
|
|
833
743
|
}
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
744
|
+
const databaseRequireRecusiveHint = this.connection.driver.cteCapabilities.requiresRecursiveHint;
|
|
745
|
+
const cteStrings = this.expressionMap.commonTableExpressions.map((cte) => {
|
|
746
|
+
const cteBodyExpression = typeof cte.queryBuilder === "string"
|
|
837
747
|
? cte.queryBuilder
|
|
838
748
|
: cte.queryBuilder.getQuery();
|
|
839
749
|
if (typeof cte.queryBuilder !== "string") {
|
|
840
750
|
if (cte.queryBuilder.hasCommonTableExpressions()) {
|
|
841
|
-
throw new error_1.TypeORMError(
|
|
751
|
+
throw new error_1.TypeORMError(`Nested CTEs aren't supported (CTE: ${cte.alias})`);
|
|
842
752
|
}
|
|
843
|
-
if (!
|
|
753
|
+
if (!this.connection.driver.cteCapabilities.writable &&
|
|
844
754
|
!InstanceChecker_1.InstanceChecker.isSelectQueryBuilder(cte.queryBuilder)) {
|
|
845
|
-
throw new error_1.TypeORMError(
|
|
755
|
+
throw new error_1.TypeORMError(`Only select queries are supported in CTEs in ${this.connection.options.type} (CTE: ${cte.alias})`);
|
|
846
756
|
}
|
|
847
|
-
|
|
757
|
+
this.setParameters(cte.queryBuilder.getParameters());
|
|
848
758
|
}
|
|
849
|
-
|
|
759
|
+
let cteHeader = this.escape(cte.alias);
|
|
850
760
|
if (cte.options.columnNames) {
|
|
851
|
-
|
|
761
|
+
const escapedColumnNames = cte.options.columnNames.map((column) => this.escape(column));
|
|
852
762
|
if (InstanceChecker_1.InstanceChecker.isSelectQueryBuilder(cte.queryBuilder)) {
|
|
853
763
|
if (cte.queryBuilder.expressionMap.selects.length &&
|
|
854
764
|
cte.options.columnNames.length !==
|
|
855
765
|
cte.queryBuilder.expressionMap.selects.length) {
|
|
856
|
-
throw new error_1.TypeORMError(
|
|
766
|
+
throw new error_1.TypeORMError(`cte.options.columnNames length (${cte.options.columnNames.length}) doesn't match subquery select list length ${cte.queryBuilder.expressionMap.selects.length} (CTE: ${cte.alias})`);
|
|
857
767
|
}
|
|
858
768
|
}
|
|
859
|
-
cteHeader +=
|
|
769
|
+
cteHeader += `(${escapedColumnNames.join(", ")})`;
|
|
860
770
|
}
|
|
861
|
-
|
|
771
|
+
const recursiveClause = cte.options.recursive && databaseRequireRecusiveHint
|
|
862
772
|
? "RECURSIVE"
|
|
863
773
|
: "";
|
|
864
|
-
|
|
865
|
-
|
|
774
|
+
const materializeClause = cte.options.materialized &&
|
|
775
|
+
this.connection.driver.cteCapabilities.materializedHint
|
|
866
776
|
? "MATERIALIZED"
|
|
867
777
|
: "";
|
|
868
778
|
return [
|
|
@@ -870,134 +780,109 @@ var QueryBuilder = /** @class */ (function () {
|
|
|
870
780
|
cteHeader,
|
|
871
781
|
materializeClause,
|
|
872
782
|
"AS",
|
|
873
|
-
|
|
783
|
+
`(${cteBodyExpression})`,
|
|
874
784
|
]
|
|
875
785
|
.filter(Boolean)
|
|
876
786
|
.join(" ");
|
|
877
787
|
});
|
|
878
788
|
return "WITH " + cteStrings.join(", ") + " ";
|
|
879
|
-
}
|
|
789
|
+
}
|
|
880
790
|
/**
|
|
881
791
|
* Creates "WHERE" condition for an in-ids condition.
|
|
882
792
|
*/
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
var normalized = (Array.isArray(ids) ? ids : [ids]).map(function (id) {
|
|
887
|
-
return metadata.ensureEntityIdMap(id);
|
|
888
|
-
});
|
|
793
|
+
getWhereInIdsCondition(ids) {
|
|
794
|
+
const metadata = this.expressionMap.mainAlias.metadata;
|
|
795
|
+
const normalized = (Array.isArray(ids) ? ids : [ids]).map((id) => metadata.ensureEntityIdMap(id));
|
|
889
796
|
// using in(...ids) for single primary key entities
|
|
890
797
|
if (!metadata.hasMultiplePrimaryKeys) {
|
|
891
|
-
|
|
798
|
+
const primaryColumn = metadata.primaryColumns[0];
|
|
892
799
|
// getEntityValue will try to transform `In`, it is a bug
|
|
893
800
|
// todo: remove this transformer check after #2390 is fixed
|
|
894
801
|
// This also fails for embedded & relation, so until that is fixed skip it.
|
|
895
|
-
if (!
|
|
896
|
-
!
|
|
897
|
-
!
|
|
898
|
-
return
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
})),
|
|
902
|
-
_a;
|
|
802
|
+
if (!primaryColumn.transformer &&
|
|
803
|
+
!primaryColumn.relationMetadata &&
|
|
804
|
+
!primaryColumn.embeddedMetadata) {
|
|
805
|
+
return {
|
|
806
|
+
[primaryColumn.propertyName]: (0, In_1.In)(normalized.map((id) => primaryColumn.getEntityValue(id, false))),
|
|
807
|
+
};
|
|
903
808
|
}
|
|
904
809
|
}
|
|
905
|
-
return new Brackets_1.Brackets(
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
qb.orWhere(new Brackets_1.Brackets(function (qb) { return qb.where(data); }));
|
|
909
|
-
};
|
|
910
|
-
try {
|
|
911
|
-
for (var normalized_1 = tslib_1.__values(normalized), normalized_1_1 = normalized_1.next(); !normalized_1_1.done; normalized_1_1 = normalized_1.next()) {
|
|
912
|
-
var data = normalized_1_1.value;
|
|
913
|
-
_loop_2(data);
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
917
|
-
finally {
|
|
918
|
-
try {
|
|
919
|
-
if (normalized_1_1 && !normalized_1_1.done && (_a = normalized_1.return)) _a.call(normalized_1);
|
|
920
|
-
}
|
|
921
|
-
finally { if (e_9) throw e_9.error; }
|
|
810
|
+
return new Brackets_1.Brackets((qb) => {
|
|
811
|
+
for (const data of normalized) {
|
|
812
|
+
qb.orWhere(new Brackets_1.Brackets((qb) => qb.where(data)));
|
|
922
813
|
}
|
|
923
814
|
});
|
|
924
|
-
}
|
|
925
|
-
|
|
815
|
+
}
|
|
816
|
+
findColumnsForPropertyPath(propertyPath) {
|
|
926
817
|
// Make a helper to iterate the entity & relations?
|
|
927
818
|
// Use that to set the correct alias? Or the other way around?
|
|
928
819
|
// Start with the main alias with our property paths
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
if (!
|
|
935
|
-
|
|
820
|
+
let alias = this.expressionMap.mainAlias;
|
|
821
|
+
const root = [];
|
|
822
|
+
const propertyPathParts = propertyPath.split(".");
|
|
823
|
+
while (propertyPathParts.length > 1) {
|
|
824
|
+
const part = propertyPathParts[0];
|
|
825
|
+
if (!alias?.hasMetadata) {
|
|
826
|
+
// If there's no metadata, we're wasting our time
|
|
827
|
+
// and can't actually look any of this up.
|
|
828
|
+
break;
|
|
936
829
|
}
|
|
937
830
|
if (alias.metadata.hasEmbeddedWithPropertyPath(part)) {
|
|
938
831
|
// If this is an embedded then we should combine the two as part of our lookup.
|
|
939
832
|
// Instead of just breaking, we keep going with this in case there's an embedded/relation
|
|
940
833
|
// inside an embedded.
|
|
941
|
-
propertyPathParts.unshift(
|
|
942
|
-
|
|
834
|
+
propertyPathParts.unshift(`${propertyPathParts.shift()}.${propertyPathParts.shift()}`);
|
|
835
|
+
continue;
|
|
943
836
|
}
|
|
944
837
|
if (alias.metadata.hasRelationWithPropertyPath(part)) {
|
|
945
838
|
// If this is a relation then we should find the aliases
|
|
946
839
|
// that match the relation & then continue further down
|
|
947
840
|
// the property path
|
|
948
|
-
|
|
949
|
-
if (!
|
|
950
|
-
|
|
951
|
-
throw new Error(
|
|
841
|
+
const joinAttr = this.expressionMap.joinAttributes.find((joinAttr) => joinAttr.relationPropertyPath === part);
|
|
842
|
+
if (!joinAttr?.alias) {
|
|
843
|
+
const fullRelationPath = root.length > 0 ? `${root.join(".")}.${part}` : part;
|
|
844
|
+
throw new Error(`Cannot find alias for relation at ${fullRelationPath}`);
|
|
952
845
|
}
|
|
953
846
|
alias = joinAttr.alias;
|
|
954
|
-
root.push
|
|
847
|
+
root.push(...part.split("."));
|
|
955
848
|
propertyPathParts.shift();
|
|
956
|
-
|
|
849
|
+
continue;
|
|
957
850
|
}
|
|
958
|
-
|
|
959
|
-
};
|
|
960
|
-
var this_2 = this;
|
|
961
|
-
while (propertyPathParts.length > 1) {
|
|
962
|
-
var state_1 = _loop_3();
|
|
963
|
-
if (state_1 === "break")
|
|
964
|
-
break;
|
|
851
|
+
break;
|
|
965
852
|
}
|
|
966
853
|
if (!alias) {
|
|
967
|
-
throw new Error(
|
|
854
|
+
throw new Error(`Cannot find alias for property ${propertyPath}`);
|
|
968
855
|
}
|
|
969
856
|
// Remaining parts are combined back and used to find the actual property path
|
|
970
|
-
|
|
971
|
-
|
|
857
|
+
const aliasPropertyPath = propertyPathParts.join(".");
|
|
858
|
+
const columns = alias.metadata.findColumnsWithPropertyPath(aliasPropertyPath);
|
|
972
859
|
if (!columns.length) {
|
|
973
860
|
throw new EntityPropertyNotFoundError_1.EntityPropertyNotFoundError(propertyPath, alias.metadata);
|
|
974
861
|
}
|
|
975
862
|
return [alias, root, columns];
|
|
976
|
-
}
|
|
863
|
+
}
|
|
977
864
|
/**
|
|
978
865
|
* Creates a property paths for a given ObjectLiteral.
|
|
979
866
|
*/
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
var _loop_4 = function (key) {
|
|
985
|
-
var path = prefix ? "".concat(prefix, ".").concat(key) : key;
|
|
867
|
+
createPropertyPath(metadata, entity, prefix = "") {
|
|
868
|
+
const paths = [];
|
|
869
|
+
for (const key of Object.keys(entity)) {
|
|
870
|
+
const path = prefix ? `${prefix}.${key}` : key;
|
|
986
871
|
// There's times where we don't actually want to traverse deeper.
|
|
987
872
|
// If the value is a `FindOperator`, or null, or not an object, then we don't, for example.
|
|
988
873
|
if (entity[key] === null ||
|
|
989
874
|
typeof entity[key] !== "object" ||
|
|
990
875
|
InstanceChecker_1.InstanceChecker.isFindOperator(entity[key])) {
|
|
991
876
|
paths.push(path);
|
|
992
|
-
|
|
877
|
+
continue;
|
|
993
878
|
}
|
|
994
879
|
if (metadata.hasEmbeddedWithPropertyPath(path)) {
|
|
995
|
-
|
|
996
|
-
paths.push
|
|
997
|
-
|
|
880
|
+
const subPaths = this.createPropertyPath(metadata, entity[key], path);
|
|
881
|
+
paths.push(...subPaths);
|
|
882
|
+
continue;
|
|
998
883
|
}
|
|
999
884
|
if (metadata.hasRelationWithPropertyPath(path)) {
|
|
1000
|
-
|
|
885
|
+
const relation = metadata.findRelationWithPropertyPath(path);
|
|
1001
886
|
// There's also cases where we don't want to return back all of the properties.
|
|
1002
887
|
// These handles the situation where someone passes the model & we don't need to make
|
|
1003
888
|
// a HUGE `where` to uniquely look up the entity.
|
|
@@ -1006,195 +891,86 @@ var QueryBuilder = /** @class */ (function () {
|
|
|
1006
891
|
// because it will fetch only the join columns and do the lookup.
|
|
1007
892
|
if (relation.relationType === "one-to-one" ||
|
|
1008
893
|
relation.relationType === "many-to-one") {
|
|
1009
|
-
|
|
1010
|
-
.map(
|
|
1011
|
-
.filter(
|
|
1012
|
-
|
|
1013
|
-
joinColumns.every(
|
|
1014
|
-
return column.getEntityValue(entity[key], false);
|
|
1015
|
-
});
|
|
894
|
+
const joinColumns = relation.joinColumns
|
|
895
|
+
.map((j) => j.referencedColumn)
|
|
896
|
+
.filter((j) => !!j);
|
|
897
|
+
const hasAllJoinColumns = joinColumns.length > 0 &&
|
|
898
|
+
joinColumns.every((column) => column.getEntityValue(entity[key], false));
|
|
1016
899
|
if (hasAllJoinColumns) {
|
|
1017
900
|
paths.push(path);
|
|
1018
|
-
|
|
901
|
+
continue;
|
|
1019
902
|
}
|
|
1020
903
|
}
|
|
1021
904
|
if (relation.relationType === "one-to-many" ||
|
|
1022
905
|
relation.relationType === "many-to-many") {
|
|
1023
|
-
throw new Error(
|
|
906
|
+
throw new Error(`Cannot query across ${relation.relationType} for property ${path}`);
|
|
1024
907
|
}
|
|
1025
908
|
// For any other case, if the `entity[key]` contains all of the primary keys we can do a
|
|
1026
909
|
// lookup via these. We don't need to look up via any other values 'cause these are
|
|
1027
910
|
// the unique primary keys.
|
|
1028
911
|
// This handles the situation where someone passes the model & we don't need to make
|
|
1029
912
|
// a HUGE where.
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
primaryColumns.every(
|
|
1033
|
-
return column.getEntityValue(entity[key], false);
|
|
1034
|
-
});
|
|
913
|
+
const primaryColumns = relation.inverseEntityMetadata.primaryColumns;
|
|
914
|
+
const hasAllPrimaryKeys = primaryColumns.length > 0 &&
|
|
915
|
+
primaryColumns.every((column) => column.getEntityValue(entity[key], false));
|
|
1035
916
|
if (hasAllPrimaryKeys) {
|
|
1036
|
-
|
|
1037
|
-
paths.push
|
|
1038
|
-
|
|
917
|
+
const subPaths = primaryColumns.map((column) => `${path}.${column.propertyPath}`);
|
|
918
|
+
paths.push(...subPaths);
|
|
919
|
+
continue;
|
|
1039
920
|
}
|
|
1040
921
|
// If nothing else, just return every property that's being passed to us.
|
|
1041
|
-
|
|
1042
|
-
paths.push
|
|
1043
|
-
|
|
922
|
+
const subPaths = this.createPropertyPath(relation.inverseEntityMetadata, entity[key]).map((p) => `${path}.${p}`);
|
|
923
|
+
paths.push(...subPaths);
|
|
924
|
+
continue;
|
|
1044
925
|
}
|
|
1045
926
|
paths.push(path);
|
|
1046
|
-
};
|
|
1047
|
-
var this_3 = this;
|
|
1048
|
-
try {
|
|
1049
|
-
for (var _b = tslib_1.__values(Object.keys(entity)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1050
|
-
var key = _c.value;
|
|
1051
|
-
_loop_4(key);
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
1055
|
-
finally {
|
|
1056
|
-
try {
|
|
1057
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1058
|
-
}
|
|
1059
|
-
finally { if (e_10) throw e_10.error; }
|
|
1060
927
|
}
|
|
1061
928
|
return paths;
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
propertyPaths_1 = tslib_1.__values(propertyPaths), propertyPaths_1_1 = propertyPaths_1.next();
|
|
1075
|
-
_h.label = 2;
|
|
1076
|
-
case 2:
|
|
1077
|
-
if (!!propertyPaths_1_1.done) return [3 /*break*/, 11];
|
|
1078
|
-
propertyPath = propertyPaths_1_1.value;
|
|
1079
|
-
_a = tslib_1.__read(this.findColumnsForPropertyPath(propertyPath), 3), alias = _a[0], aliasPropertyPath = _a[1], columns = _a[2];
|
|
1080
|
-
_h.label = 3;
|
|
1081
|
-
case 3:
|
|
1082
|
-
_h.trys.push([3, 8, 9, 10]);
|
|
1083
|
-
columns_1 = (e_11 = void 0, tslib_1.__values(columns)), columns_1_1 = columns_1.next();
|
|
1084
|
-
_h.label = 4;
|
|
1085
|
-
case 4:
|
|
1086
|
-
if (!!columns_1_1.done) return [3 /*break*/, 7];
|
|
1087
|
-
column = columns_1_1.value;
|
|
1088
|
-
containedWhere = where;
|
|
1089
|
-
try {
|
|
1090
|
-
for (aliasPropertyPath_1 = (e_14 = void 0, tslib_1.__values(aliasPropertyPath)), aliasPropertyPath_1_1 = aliasPropertyPath_1.next(); !aliasPropertyPath_1_1.done; aliasPropertyPath_1_1 = aliasPropertyPath_1.next()) {
|
|
1091
|
-
part = aliasPropertyPath_1_1.value;
|
|
1092
|
-
if (!containedWhere || !(part in containedWhere)) {
|
|
1093
|
-
containedWhere = {};
|
|
1094
|
-
break;
|
|
1095
|
-
}
|
|
1096
|
-
containedWhere = containedWhere[part];
|
|
1097
|
-
}
|
|
1098
|
-
}
|
|
1099
|
-
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
1100
|
-
finally {
|
|
1101
|
-
try {
|
|
1102
|
-
if (aliasPropertyPath_1_1 && !aliasPropertyPath_1_1.done && (_f = aliasPropertyPath_1.return)) _f.call(aliasPropertyPath_1);
|
|
929
|
+
}
|
|
930
|
+
*getPredicates(where) {
|
|
931
|
+
if (this.expressionMap.mainAlias.hasMetadata) {
|
|
932
|
+
const propertyPaths = this.createPropertyPath(this.expressionMap.mainAlias.metadata, where);
|
|
933
|
+
for (const propertyPath of propertyPaths) {
|
|
934
|
+
const [alias, aliasPropertyPath, columns] = this.findColumnsForPropertyPath(propertyPath);
|
|
935
|
+
for (const column of columns) {
|
|
936
|
+
let containedWhere = where;
|
|
937
|
+
for (const part of aliasPropertyPath) {
|
|
938
|
+
if (!containedWhere || !(part in containedWhere)) {
|
|
939
|
+
containedWhere = {};
|
|
940
|
+
break;
|
|
1103
941
|
}
|
|
1104
|
-
|
|
942
|
+
containedWhere = containedWhere[part];
|
|
1105
943
|
}
|
|
1106
|
-
|
|
944
|
+
// Use the correct alias & the property path from the column
|
|
945
|
+
const aliasPath = this.expressionMap
|
|
1107
946
|
.aliasNamePrefixingEnabled
|
|
1108
|
-
?
|
|
947
|
+
? `${alias.name}.${column.propertyPath}`
|
|
1109
948
|
: column.propertyPath;
|
|
1110
|
-
parameterValue = column.getEntityValue(containedWhere, true);
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
_h.sent();
|
|
1114
|
-
_h.label = 6;
|
|
1115
|
-
case 6:
|
|
1116
|
-
columns_1_1 = columns_1.next();
|
|
1117
|
-
return [3 /*break*/, 4];
|
|
1118
|
-
case 7: return [3 /*break*/, 10];
|
|
1119
|
-
case 8:
|
|
1120
|
-
e_11_1 = _h.sent();
|
|
1121
|
-
e_11 = { error: e_11_1 };
|
|
1122
|
-
return [3 /*break*/, 10];
|
|
1123
|
-
case 9:
|
|
1124
|
-
try {
|
|
1125
|
-
if (columns_1_1 && !columns_1_1.done && (_e = columns_1.return)) _e.call(columns_1);
|
|
1126
|
-
}
|
|
1127
|
-
finally { if (e_11) throw e_11.error; }
|
|
1128
|
-
return [7 /*endfinally*/];
|
|
1129
|
-
case 10:
|
|
1130
|
-
propertyPaths_1_1 = propertyPaths_1.next();
|
|
1131
|
-
return [3 /*break*/, 2];
|
|
1132
|
-
case 11: return [3 /*break*/, 14];
|
|
1133
|
-
case 12:
|
|
1134
|
-
e_12_1 = _h.sent();
|
|
1135
|
-
e_12 = { error: e_12_1 };
|
|
1136
|
-
return [3 /*break*/, 14];
|
|
1137
|
-
case 13:
|
|
1138
|
-
try {
|
|
1139
|
-
if (propertyPaths_1_1 && !propertyPaths_1_1.done && (_d = propertyPaths_1.return)) _d.call(propertyPaths_1);
|
|
1140
|
-
}
|
|
1141
|
-
finally { if (e_12) throw e_12.error; }
|
|
1142
|
-
return [7 /*endfinally*/];
|
|
1143
|
-
case 14: return [3 /*break*/, 22];
|
|
1144
|
-
case 15:
|
|
1145
|
-
_h.trys.push([15, 20, 21, 22]);
|
|
1146
|
-
_b = tslib_1.__values(Object.keys(where)), _c = _b.next();
|
|
1147
|
-
_h.label = 16;
|
|
1148
|
-
case 16:
|
|
1149
|
-
if (!!_c.done) return [3 /*break*/, 19];
|
|
1150
|
-
key = _c.value;
|
|
1151
|
-
parameterValue = where[key];
|
|
1152
|
-
aliasPath = this.expressionMap.aliasNamePrefixingEnabled
|
|
1153
|
-
? "".concat(this.alias, ".").concat(key)
|
|
1154
|
-
: key;
|
|
1155
|
-
return [4 /*yield*/, [aliasPath, parameterValue]];
|
|
1156
|
-
case 17:
|
|
1157
|
-
_h.sent();
|
|
1158
|
-
_h.label = 18;
|
|
1159
|
-
case 18:
|
|
1160
|
-
_c = _b.next();
|
|
1161
|
-
return [3 /*break*/, 16];
|
|
1162
|
-
case 19: return [3 /*break*/, 22];
|
|
1163
|
-
case 20:
|
|
1164
|
-
e_13_1 = _h.sent();
|
|
1165
|
-
e_13 = { error: e_13_1 };
|
|
1166
|
-
return [3 /*break*/, 22];
|
|
1167
|
-
case 21:
|
|
1168
|
-
try {
|
|
1169
|
-
if (_c && !_c.done && (_g = _b.return)) _g.call(_b);
|
|
1170
|
-
}
|
|
1171
|
-
finally { if (e_13) throw e_13.error; }
|
|
1172
|
-
return [7 /*endfinally*/];
|
|
1173
|
-
case 22: return [2 /*return*/];
|
|
949
|
+
const parameterValue = column.getEntityValue(containedWhere, true);
|
|
950
|
+
yield [aliasPath, parameterValue];
|
|
951
|
+
}
|
|
1174
952
|
}
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
953
|
+
}
|
|
954
|
+
else {
|
|
955
|
+
for (const key of Object.keys(where)) {
|
|
956
|
+
const parameterValue = where[key];
|
|
957
|
+
const aliasPath = this.expressionMap.aliasNamePrefixingEnabled
|
|
958
|
+
? `${this.alias}.${key}`
|
|
959
|
+
: key;
|
|
960
|
+
yield [aliasPath, parameterValue];
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
getWherePredicateCondition(aliasPath, parameterValue) {
|
|
1179
965
|
if (InstanceChecker_1.InstanceChecker.isFindOperator(parameterValue)) {
|
|
1180
|
-
|
|
966
|
+
let parameters = [];
|
|
1181
967
|
if (parameterValue.useParameter) {
|
|
1182
968
|
if (parameterValue.objectLiteralParameters) {
|
|
1183
969
|
this.setParameters(parameterValue.objectLiteralParameters);
|
|
1184
970
|
}
|
|
1185
971
|
else if (parameterValue.multipleParameters) {
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
var v = _c.value;
|
|
1189
|
-
parameters.push(this.createParameter(v));
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
1193
|
-
finally {
|
|
1194
|
-
try {
|
|
1195
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1196
|
-
}
|
|
1197
|
-
finally { if (e_15) throw e_15.error; }
|
|
972
|
+
for (const v of parameterValue.value) {
|
|
973
|
+
parameters.push(this.createParameter(v));
|
|
1198
974
|
}
|
|
1199
975
|
}
|
|
1200
976
|
else {
|
|
@@ -1222,14 +998,14 @@ var QueryBuilder = /** @class */ (function () {
|
|
|
1222
998
|
else {
|
|
1223
999
|
return {
|
|
1224
1000
|
operator: "notEqual",
|
|
1225
|
-
parameters:
|
|
1001
|
+
parameters: [aliasPath, ...parameters],
|
|
1226
1002
|
};
|
|
1227
1003
|
}
|
|
1228
1004
|
}
|
|
1229
1005
|
else {
|
|
1230
1006
|
return {
|
|
1231
1007
|
operator: parameterValue.type,
|
|
1232
|
-
parameters:
|
|
1008
|
+
parameters: [aliasPath, ...parameters],
|
|
1233
1009
|
};
|
|
1234
1010
|
}
|
|
1235
1011
|
// } else if (parameterValue === null) {
|
|
@@ -1246,14 +1022,13 @@ var QueryBuilder = /** @class */ (function () {
|
|
|
1246
1022
|
parameters: [aliasPath, this.createParameter(parameterValue)],
|
|
1247
1023
|
};
|
|
1248
1024
|
}
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
|
-
var e_16, _a, e_17, _b;
|
|
1025
|
+
}
|
|
1026
|
+
getWhereCondition(where) {
|
|
1252
1027
|
if (typeof where === "string") {
|
|
1253
1028
|
return where;
|
|
1254
1029
|
}
|
|
1255
1030
|
if (InstanceChecker_1.InstanceChecker.isBrackets(where)) {
|
|
1256
|
-
|
|
1031
|
+
const whereQueryBuilder = this.createQueryBuilder();
|
|
1257
1032
|
whereQueryBuilder.parentQueryBuilder = this;
|
|
1258
1033
|
whereQueryBuilder.expressionMap.mainAlias =
|
|
1259
1034
|
this.expressionMap.mainAlias;
|
|
@@ -1275,54 +1050,33 @@ var QueryBuilder = /** @class */ (function () {
|
|
|
1275
1050
|
if (typeof where === "function") {
|
|
1276
1051
|
return where(this);
|
|
1277
1052
|
}
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
conditions.push({
|
|
1289
|
-
type: "and",
|
|
1290
|
-
condition: this.getWherePredicateCondition(aliasPath, parameterValue),
|
|
1291
|
-
});
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
1295
|
-
finally {
|
|
1296
|
-
try {
|
|
1297
|
-
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
1298
|
-
}
|
|
1299
|
-
finally { if (e_17) throw e_17.error; }
|
|
1300
|
-
}
|
|
1301
|
-
clauses.push({ type: "or", condition: conditions });
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1304
|
-
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
1305
|
-
finally {
|
|
1306
|
-
try {
|
|
1307
|
-
if (wheres_1_1 && !wheres_1_1.done && (_a = wheres_1.return)) _a.call(wheres_1);
|
|
1053
|
+
const wheres = Array.isArray(where) ? where : [where];
|
|
1054
|
+
const clauses = [];
|
|
1055
|
+
for (const where of wheres) {
|
|
1056
|
+
const conditions = [];
|
|
1057
|
+
// Filter the conditions and set up the parameter values
|
|
1058
|
+
for (const [aliasPath, parameterValue] of this.getPredicates(where)) {
|
|
1059
|
+
conditions.push({
|
|
1060
|
+
type: "and",
|
|
1061
|
+
condition: this.getWherePredicateCondition(aliasPath, parameterValue),
|
|
1062
|
+
});
|
|
1308
1063
|
}
|
|
1309
|
-
|
|
1064
|
+
clauses.push({ type: "or", condition: conditions });
|
|
1310
1065
|
}
|
|
1311
1066
|
if (clauses.length === 1) {
|
|
1312
1067
|
return clauses[0].condition;
|
|
1313
1068
|
}
|
|
1314
1069
|
return clauses;
|
|
1315
|
-
}
|
|
1070
|
+
}
|
|
1316
1071
|
/**
|
|
1317
1072
|
* Creates a query builder used to execute sql queries inside this query builder.
|
|
1318
1073
|
*/
|
|
1319
|
-
|
|
1074
|
+
obtainQueryRunner() {
|
|
1320
1075
|
return this.queryRunner || this.connection.createQueryRunner();
|
|
1321
|
-
}
|
|
1322
|
-
|
|
1076
|
+
}
|
|
1077
|
+
hasCommonTableExpressions() {
|
|
1323
1078
|
return this.expressionMap.commonTableExpressions.length > 0;
|
|
1324
|
-
}
|
|
1325
|
-
|
|
1326
|
-
}());
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1327
1081
|
exports.QueryBuilder = QueryBuilder;
|
|
1328
1082
|
//# sourceMappingURL=QueryBuilder.js.map
|