typeorm 1.0.0-nightly.20260708 → 1.0.0-nightly.20260711
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/common/PrimitiveCriteria.js.map +1 -1
- package/browser/connection/ConnectionMetadataBuilder.js.map +1 -1
- package/browser/connection/ConnectionOptionsReader.js.map +1 -1
- package/browser/data-source/BaseDataSourceOptions.d.ts +2 -1
- package/browser/data-source/BaseDataSourceOptions.js.map +1 -1
- package/browser/data-source/DataSource.js.map +1 -1
- package/browser/decorator/ForeignKey.js.map +1 -1
- package/browser/decorator/columns/PrimaryGeneratedColumn.js.map +1 -1
- package/browser/decorator/options/RelationOptions.js.map +1 -1
- package/browser/decorator/tree/TreeChildren.js.map +1 -1
- package/browser/driver/capacitor/CapacitorDataSourceOptions.js.map +1 -1
- package/browser/entity-manager/EntityManager.d.ts +17 -0
- package/browser/entity-manager/EntityManager.js +67 -83
- package/browser/entity-manager/EntityManager.js.map +1 -1
- package/browser/entity-manager/MongoEntityManager.js.map +1 -1
- package/browser/entity-schema/EntitySchemaRelationOptions.js.map +1 -1
- package/browser/find-options/FindOneOptions.js.map +1 -1
- package/browser/find-options/FindOptionsWhere.js.map +1 -1
- package/browser/logger/AbstractLogger.js.map +1 -1
- package/browser/logger/Logger.js.map +1 -1
- package/browser/metadata/IndexMetadata.js.map +1 -1
- package/browser/metadata/UniqueMetadata.js.map +1 -1
- package/browser/metadata/types/OnDeleteType.js.map +1 -1
- package/browser/metadata/types/OnUpdateType.js.map +1 -1
- package/browser/metadata/types/RelationTypeInFunction.js.map +1 -1
- package/browser/metadata/types/RelationTypes.js.map +1 -1
- package/browser/metadata/types/TreeTypes.js.map +1 -1
- package/browser/persistence/subject-builder/OneToManySubjectBuilder.js.map +1 -1
- package/browser/query-builder/InsertQueryBuilder.js.map +1 -1
- package/browser/query-builder/QueryBuilder.js +17 -0
- package/browser/query-builder/QueryBuilder.js.map +1 -1
- package/browser/query-builder/SelectQueryBuilder.js.map +1 -1
- package/browser/query-builder/UpdateQueryBuilder.js.map +1 -1
- package/browser/query-builder/WhereClause.js.map +1 -1
- package/browser/repository/BaseEntity.js.map +1 -1
- package/browser/repository/MongoRepository.js.map +1 -1
- package/browser/repository/Repository.js.map +1 -1
- package/browser/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
- package/browser/util/OrmUtils.d.ts +14 -4
- package/browser/util/OrmUtils.js +25 -6
- package/browser/util/OrmUtils.js.map +1 -1
- package/common/PrimitiveCriteria.js.map +1 -1
- package/connection/ConnectionMetadataBuilder.js.map +1 -1
- package/connection/ConnectionOptionsReader.js.map +1 -1
- package/data-source/BaseDataSourceOptions.d.ts +2 -1
- package/data-source/BaseDataSourceOptions.js.map +1 -1
- package/data-source/DataSource.js.map +1 -1
- package/decorator/ForeignKey.js.map +1 -1
- package/decorator/columns/PrimaryGeneratedColumn.js.map +1 -1
- package/decorator/options/RelationOptions.js.map +1 -1
- package/decorator/tree/TreeChildren.js.map +1 -1
- package/driver/capacitor/CapacitorDataSourceOptions.js.map +1 -1
- package/entity-manager/EntityManager.d.ts +17 -0
- package/entity-manager/EntityManager.js +67 -83
- package/entity-manager/EntityManager.js.map +1 -1
- package/entity-manager/MongoEntityManager.js.map +1 -1
- package/entity-schema/EntitySchemaRelationOptions.js.map +1 -1
- package/find-options/FindOneOptions.js.map +1 -1
- package/find-options/FindOptionsWhere.js.map +1 -1
- package/logger/AbstractLogger.js.map +1 -1
- package/logger/Logger.js.map +1 -1
- package/metadata/IndexMetadata.js.map +1 -1
- package/metadata/UniqueMetadata.js.map +1 -1
- package/metadata/types/OnDeleteType.js.map +1 -1
- package/metadata/types/OnUpdateType.js.map +1 -1
- package/metadata/types/RelationTypeInFunction.js.map +1 -1
- package/metadata/types/RelationTypes.js.map +1 -1
- package/metadata/types/TreeTypes.js.map +1 -1
- package/package.json +7 -7
- package/persistence/subject-builder/OneToManySubjectBuilder.js.map +1 -1
- package/query-builder/InsertQueryBuilder.js.map +1 -1
- package/query-builder/QueryBuilder.js +17 -0
- package/query-builder/QueryBuilder.js.map +1 -1
- package/query-builder/SelectQueryBuilder.js.map +1 -1
- package/query-builder/UpdateQueryBuilder.js.map +1 -1
- package/query-builder/WhereClause.js.map +1 -1
- package/repository/BaseEntity.js.map +1 -1
- package/repository/MongoRepository.js.map +1 -1
- package/repository/Repository.js.map +1 -1
- package/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
- package/util/OrmUtils.d.ts +14 -4
- package/util/OrmUtils.js +25 -6
- package/util/OrmUtils.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimitiveCriteria.js","sourceRoot":"../build/browser/src/","sources":["common/PrimitiveCriteria.ts"],"names":[],"mappings":"","sourcesContent":["export type SinglePrimitiveCriteria = string | number | Date\n\nexport type PrimitiveCriteria =\n
|
|
1
|
+
{"version":3,"file":"PrimitiveCriteria.js","sourceRoot":"../build/browser/src/","sources":["common/PrimitiveCriteria.ts"],"names":[],"mappings":"","sourcesContent":["export type SinglePrimitiveCriteria = string | number | Date\n\nexport type PrimitiveCriteria =\n SinglePrimitiveCriteria | SinglePrimitiveCriteria[]\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionMetadataBuilder.js","sourceRoot":"../build/browser/src/","sources":["connection/ConnectionMetadataBuilder.ts"],"names":[],"mappings":";;;AAAA,2FAAqF;AACrF,+CAA2C;AAE3C,wCAAmD;AACnD,qFAAiF;AACjF,sFAAkF;AAKlF,6DAAyD;AAEzD;;GAEG;AACH,MAAa,yBAAyB;IAClC,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAsB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAEhD,4EAA4E;IAC5E,iBAAiB;IACjB,4EAA4E;IAE5E;;;;OAIG;IACH,KAAK,CAAC,eAAe,CACjB,UAAiC;QAEjC,MAAM,CAAC,gBAAgB,EAAE,oBAAoB,CAAC,GAC1C,mBAAQ,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAA;QAC/C,MAAM,mBAAmB,GAAG;YACxB,GAAG,gBAAgB;YACnB,GAAG,CAAC,MAAM,IAAA,6DAA4B,EAClC,IAAI,CAAC,UAAU,CAAC,MAAM,EACtB,oBAAoB,CACvB,CAAC;SACL,CAAA;QACD,OAAO,mBAAmB,CAAC,GAAG,CAC1B,CAAC,cAAc,EAAE,EAAE,CACf,IAAK,cAA+C,EAAE,CAC7D,CAAA;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,gBAAgB,CAClB,WAAkC;QAElC,MAAM,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,GAC5C,mBAAQ,CAAC,sBAAsB,CAAC,WAAW,IAAI,EAAE,CAAC,CAAA;QACtD,MAAM,oBAAoB,GAAG;YACzB,GAAG,iBAAiB;YACpB,GAAG,CAAC,MAAM,IAAA,6DAA4B,EAClC,IAAI,CAAC,UAAU,CAAC,MAAM,EACtB,qBAAqB,CACxB,CAAC;SACL,CAAA;QACD,OAAO,IAAA,gCAAsB,GAAE;aAC1B,iBAAiB,CAAC,oBAAoB,CAAC;aACvC,GAAG,CACA,CAAC,QAAQ,EAAE,EAAE,CACT,
|
|
1
|
+
{"version":3,"file":"ConnectionMetadataBuilder.js","sourceRoot":"../build/browser/src/","sources":["connection/ConnectionMetadataBuilder.ts"],"names":[],"mappings":";;;AAAA,2FAAqF;AACrF,+CAA2C;AAE3C,wCAAmD;AACnD,qFAAiF;AACjF,sFAAkF;AAKlF,6DAAyD;AAEzD;;GAEG;AACH,MAAa,yBAAyB;IAClC,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAsB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAEhD,4EAA4E;IAC5E,iBAAiB;IACjB,4EAA4E;IAE5E;;;;OAIG;IACH,KAAK,CAAC,eAAe,CACjB,UAAiC;QAEjC,MAAM,CAAC,gBA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E,CAC1C,iCAAe,CAAC,cAAc,CAAC,WAAW,CAAC,CACvC,CAAA;QAEZ,MAAM,gBAAgB,GAAG;YACrB,GAAG,aAAa;YAChB,GAAG,CAAC,MAAM,IAAA,6DAA4B,EAClC,IAAI,CAAC,UAAU,CAAC,MAAM,EACtB,iBAAiB,CACpB,CAAC;SACL,CAAA;QACD,gBAAgB,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE;YACrC,oDAAoD;YACpD,IAAI,iCAAe,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,CAAC;gBAC9C,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;YACnC,CAAC;QACL,CAAC,CAAC,CAAA;QACF,MAAM,wBAAwB,GAAG,IAAI,6CAAqB,CACtD,IAAI,CAAC,UAAU,EACf,IAAA,gCAAsB,GAAE,CAC3B,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAA;QAEzB,MAAM,6BAA6B,GAC/B,IAAI,iDAAuB,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC,CAAA;QAC1D,MAAM,qBAAqB,GAAG,IAAI,6CAAqB,CACnD,IAAI,CAAC,UAAU,EACf,6BAA6B,CAChC,CAAC,KAAK,EAAE,CAAA;QAET,OAAO,CAAC,GAAG,wBAAwB,EAAE,GAAG,qBAAqB,CAAC,CAAA;IAClE,CAAC;CACJ;AA5GD,8DA4GC","sourcesContent":["import { importClassesFromDirectories } from \"../util/DirectoryExportedClassesLoader\"\nimport { OrmUtils } from \"../util/OrmUtils\"\nimport type { MigrationInterface } from \"../migration/MigrationInterface\"\nimport { getMetadataArgsStorage } from \"../globals\"\nimport { EntityMetadataBuilder } from \"../metadata-builder/EntityMetadataBuilder\"\nimport { EntitySchemaTransformer } from \"../entity-schema/EntitySchemaTransformer\"\nimport type { DataSource } from \"../data-source/DataSource\"\nimport type { EntitySchema } from \"../entity-schema/EntitySchema\"\nimport type { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport type { EntitySubscriberInterface } from \"../subscriber/EntitySubscriberInterface\"\nimport { InstanceChecker } from \"../util/InstanceChecker\"\n\n/**\n * Builds migration instances, subscriber instances and entity metadatas for the given classes.\n */\nexport class ConnectionMetadataBuilder {\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(protected dataSource: DataSource) {}\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Builds migration instances for the given classes or directories.\n *\n * @param migrations\n */\n async buildMigrations(\n migrations: (Function | string)[],\n ): Promise<MigrationInterface[]> {\n const [migrationClasses, migrationDirectories] =\n OrmUtils.splitClassesAndStrings(migrations)\n const allMigrationClasses = [\n ...migrationClasses,\n ...(await importClassesFromDirectories(\n this.dataSource.logger,\n migrationDirectories,\n )),\n ]\n return allMigrationClasses.map(\n (migrationClass) =>\n new (migrationClass as new () => MigrationInterface)(),\n )\n }\n\n /**\n * Builds subscriber instances for the given classes or directories.\n *\n * @param subscribers\n */\n async buildSubscribers(\n subscribers: (Function | string)[],\n ): Promise<EntitySubscriberInterface<any>[]> {\n const [subscriberClasses, subscriberDirectories] =\n OrmUtils.splitClassesAndStrings(subscribers || [])\n const allSubscriberClasses = [\n ...subscriberClasses,\n ...(await importClassesFromDirectories(\n this.dataSource.logger,\n subscriberDirectories,\n )),\n ]\n return getMetadataArgsStorage()\n .filterSubscribers(allSubscriberClasses)\n .map(\n (metadata) =>\n new (\n metadata.target as new () => EntitySubscriberInterface<any>\n )(),\n )\n }\n\n /**\n * Builds entity metadatas for the given classes or directories.\n *\n * @param entities\n */\n async buildEntityMetadatas(\n entities: (Function | EntitySchema<any> | string)[],\n ): Promise<EntityMetadata[]> {\n // todo: instead we need to merge multiple metadata args storages\n\n const [entityClassesOrSchemas, entityDirectories] =\n OrmUtils.splitClassesAndStrings(entities || [])\n const entityClasses: Function[] = entityClassesOrSchemas.filter(\n (entityClass) => !InstanceChecker.isEntitySchema(entityClass),\n ) as any\n const entitySchemas: EntitySchema<any>[] =\n entityClassesOrSchemas.filter((entityClass) =>\n InstanceChecker.isEntitySchema(entityClass),\n ) as any\n\n const allEntityClasses = [\n ...entityClasses,\n ...(await importClassesFromDirectories(\n this.dataSource.logger,\n entityDirectories,\n )),\n ]\n allEntityClasses.forEach((entityClass) => {\n // if we have entity schemas loaded from directories\n if (InstanceChecker.isEntitySchema(entityClass)) {\n entitySchemas.push(entityClass)\n }\n })\n const decoratorEntityMetadatas = new EntityMetadataBuilder(\n this.dataSource,\n getMetadataArgsStorage(),\n ).build(allEntityClasses)\n\n const metadataArgsStorageFromSchema =\n new EntitySchemaTransformer().transform(entitySchemas)\n const schemaEntityMetadatas = new EntityMetadataBuilder(\n this.dataSource,\n metadataArgsStorageFromSchema,\n ).build()\n\n return [...decoratorEntityMetadatas, ...schemaEntityMetadatas]\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionOptionsReader.js","sourceRoot":"../build/browser/src/","sources":["connection/ConnectionOptionsReader.ts"],"names":[],"mappings":";;;AACA,oCAAuC;AACvC,6DAAyD;AACzD,qDAAyD;AACzD,iDAA8C;AAE9C;;GAEG;AACH,MAAa,uBAAuB;IAChC,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YACc,OAWT;QAXS,YAAO,GAAP,OAAO,CAWhB;IACF,CAAC;IAEJ,4EAA4E;IAC5E,iBAAiB;IACjB,4EAA4E;IAE5E;;OAEG;IACH,KAAK,CAAC,GAAG;QACL,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAA;QACjC,IAAI,CAAC,OAAO;YACR,MAAM,IAAI,oBAAY,CAClB,kEAAkE,CACrE,CAAA;QAEL,OAAO,OAAO,CAAA;IAClB,CAAC;IAED,4EAA4E;IAC5E,oBAAoB;IACpB,4EAA4E;IAE5E;;;;OAIG;IACO,KAAK,CAAC,IAAI;QAChB,IAAI,iBAAiB,GAGH,SAAS,CAAA;QAE3B,MAAM,WAAW,GA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,QAAQ,KAAK,QAAQ;oBACpC,CAAC,IAAA,sBAAU,EAAC,OAAO,CAAC,QAAQ,CAAC;oBAC7B,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,gBAAgB;oBACrD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,IAAI,mBAAmB;oBAC7D,OAAO,CAAC,QAAQ,KAAK,UAAU,EACjC,CAAC;oBACC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE;wBACnB,QAAQ,EAAE,IAAI,CAAC,aAAa,GAAG,GAAG,GAAG,OAAO,CAAC,QAAQ;qBACxD,CAAC,CAAA;gBACN,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAA;QAEF,OAAO,iBAAiB,CAAA;IAC5B,CAAC;IAED;;OAEG;IACH,IAAc,YAAY;QACtB,OAAO,6BAAa,CAAC,WAAW,CAC5B,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,cAAc,CACtB,CAAA;IACL,CAAC;IAED;;OAEG;IACH,IAAc,aAAa;QACvB,OAAO,IAAI,CAAC,OAAO,EAAE,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAA;IAC9C,CAAC;IAED;;OAEG;IACH,IAAc,cAAc;QACxB,OAAO,IAAI,CAAC,OAAO,EAAE,UAAU,IAAI,WAAW,CAAA;IAClD,CAAC;CACJ;AAzND,0DAyNC","sourcesContent":["import type { DataSourceOptions } from \"../data-source/DataSourceOptions\"\nimport { TypeORMError } from \"../error\"\nimport { PlatformTools } from \"../platform/PlatformTools\"\nimport { importOrRequireFile } from \"../util/ImportUtils\"\nimport { isAbsolute } from \"../util/PathUtils\"\n\n/**\n * Reads connection options from the ormconfig.\n */\nexport class ConnectionOptionsReader {\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(\n protected options?: {\n /**\n * Directory from where the `ormconfig` file should be read.\n * Default: `process.cwd()`.\n */\n root?: string\n\n /**\n * Filename of the ormconfig configuration. By default its equal to \"ormconfig\".\n */\n configName?: string\n },\n ) {}\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Returns all connection options read from the ormconfig.\n */\n async get(): Promise<DataSourceOptions[]> {\n const options = await this.load()\n if (!options)\n throw new TypeORMError(\n `No connection options were found in any orm configuration files.`,\n )\n\n return options\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Loads all connection options from a configuration file.\n *\n * todo: get in count NODE_ENV somehow\n */\n protected async load(): Promise<DataSourceOptions[] | undefined> {\n let connectionOptions:\n | DataSourceOptions\n | DataSourceOptions[]\n | undefined = undefined\n\n const fileFormats = [\"js\", \"mjs\", \"cjs\", \"ts\", \"mts\", \"cts\", \"json\"]\n\n // Detect if baseFilePath contains file extension\n const possibleExtension = PlatformTools.pathExtname(this.baseFilePath)\n const fileExtension = fileFormats.find(\n (extension) => `.${extension}` === possibleExtension,\n )\n\n // try to find any of following configuration formats\n const foundFileFormat =\n fileExtension ??\n fileFormats.find((format) => {\n return PlatformTools.fileExist(this.baseFilePath + \".\" + format)\n })\n\n // Determine config file name\n const configFile = fileExtension\n ? this.baseFilePath\n : this.baseFilePath + \".\" + foundFileFormat\n\n // try to find connection options from any of available sources of configuration\n if (\n foundFileFormat === \"js\" ||\n foundFileFormat === \"mjs\" ||\n foundFileFormat === \"cjs\" ||\n foundFileFormat === \"ts\" ||\n foundFileFormat === \"mts\" ||\n foundFileFormat === \"cts\"\n ) {\n try {\n const [importOrRequireResult, moduleSystem] =\n await importOrRequireFile(configFile)\n const configModule = await importOrRequireResult\n\n if (\n moduleSystem === \"esm\" ||\n (configModule &&\n \"__esModule\" in configModule &&\n \"default\" in configModule)\n ) {\n connectionOptions = configModule.default\n } else {\n connectionOptions = configModule\n }\n } catch (err) {\n PlatformTools.logWarn(\n `Warning: Could not load ormconfig file at ${configFile}`,\n err instanceof Error ? err.message : String(err),\n )\n }\n } else if (foundFileFormat === \"json\") {\n try {\n connectionOptions = require(configFile)\n } catch (err) {\n PlatformTools.logWarn(\n `Warning: Could not load ormconfig file at ${configFile}`,\n err instanceof Error ? err.message : String(err),\n )\n }\n }\n\n // normalize and return connection options\n if (connectionOptions) {\n return this.normalizeConnectionOptions(connectionOptions)\n }\n\n return undefined\n }\n\n /**\n * Normalize connection options.\n *\n * @param connectionOptions\n */\n protected normalizeConnectionOptions(\n connectionOptions: DataSourceOptions | DataSourceOptions[],\n ): DataSourceOptions[] {\n if (!Array.isArray(connectionOptions))\n connectionOptions = [connectionOptions]\n\n connectionOptions.forEach((options) => {\n options.baseDirectory = this.baseDirectory\n if (options.entities) {\n const entities = (options.entities as any[]).map((entity) => {\n if (typeof entity === \"string\" && !entity.startsWith(\"/\")) {\n return this.baseDirectory + \"/\" + entity\n }\n\n return entity\n })\n Object.assign(connectionOptions, { entities: entities })\n }\n if (options.subscribers) {\n const subscribers = (options.subscribers as any[]).map(\n (subscriber) => {\n if (\n typeof subscriber === \"string\" &&\n !subscriber.startsWith(\"/\")\n ) {\n return this.baseDirectory + \"/\" + subscriber\n }\n\n return subscriber\n },\n )\n Object.assign(connectionOptions, { subscribers: subscribers })\n }\n if (options.migrations) {\n const migrations = (options.migrations as any[]).map(\n (migration) => {\n if (\n typeof migration === \"string\" &&\n !migration.startsWith(\"/\")\n ) {\n return this.baseDirectory + \"/\" + migration\n }\n\n return migration\n },\n )\n Object.assign(connectionOptions, { migrations: migrations })\n }\n\n // make database path file in sqlite relative to package.json\n if (options.type === \"better-sqlite3\") {\n if (\n typeof options.database === \"string\" &&\n !isAbsolute(options.database) &&\n !options.database.startsWith(\"/\") && // unix absolute\n options.database.slice(1, 3) !== \":\\\\\" && // windows absolute\n options.database !== \":memory:\"\n ) {\n Object.assign(options, {\n database: this.baseDirectory + \"/\" + options.database,\n })\n }\n }\n })\n\n return connectionOptions\n }\n\n /**\n * Gets directory where configuration file should be located and configuration file name.\n */\n protected get baseFilePath(): string {\n return PlatformTools.pathResolve(\n this.baseDirectory,\n this.baseConfigName,\n )\n }\n\n /**\n * Gets directory where configuration file should be located.\n */\n protected get baseDirectory(): string {\n return this.options?.root ?? process.cwd()\n }\n\n /**\n * Gets configuration file name.\n */\n protected get baseConfigName(): string {\n return this.options?.configName ?? \"ormconfig\"\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ConnectionOptionsReader.js","sourceRoot":"../build/browser/src/","sources":["connection/ConnectionOptionsReader.ts"],"names":[],"mappings":";;;AACA,oCAAuC;AACvC,6DAAyD;AACzD,qDAAyD;AACzD,iDAA8C;AAE9C;;GAEG;AACH,MAAa,uBAAuB;IAChC,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YACc,OAWT;QAXS,YAAO,GAAP,OAAO,CAWhB;IACF,CAAC;IAEJ,4EAA4E;IAC5E,iBAAiB;IACjB,4EAA4E;IAE5E;;OAEG;IACH,KAAK,CAAC,GAAG;QACL,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAA;QACjC,IAAI,CAAC,OAAO;YACR,MAAM,IAAI,oBAAY,CAClB,kEAAkE,CACrE,CAAA;QAEL,OAAO,OAAO,CAAA;IAClB,CAAC;IAED,4EAA4E;IAC5E,oBAAoB;IACpB,4EAA4E;IAE5E;;;;OAIG;IACO,KAAK,CAAC,IAAI;QAChB,IAAI,iBAAiB,GACqC,SAAS,CAAA;QAEnE,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QAEpE,iDAAiD;QACjD,MAAM,iBAAiB,GAAG,6BAAa,CAAC,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;QACtE,MAAM,aAAa,GAAG,WAAW,CAAC,IAAI,CAClC,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,SAAS,EAAE,KAAK,iBAAiB,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C,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE;wBACnB,QAAQ,EAAE,IAAI,CAAC,aAAa,GAAG,GAAG,GAAG,OAAO,CAAC,QAAQ;qBACxD,CAAC,CAAA;gBACN,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAA;QAEF,OAAO,iBAAiB,CAAA;IAC5B,CAAC;IAED;;OAEG;IACH,IAAc,YAAY;QACtB,OAAO,6BAAa,CAAC,WAAW,CAC5B,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,cAAc,CACtB,CAAA;IACL,CAAC;IAED;;OAEG;IACH,IAAc,aAAa;QACvB,OAAO,IAAI,CAAC,OAAO,EAAE,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAA;IAC9C,CAAC;IAED;;OAEG;IACH,IAAc,cAAc;QACxB,OAAO,IAAI,CAAC,OAAO,EAAE,UAAU,IAAI,WAAW,CAAA;IAClD,CAAC;CACJ;AAvND,0DAuNC","sourcesContent":["import type { DataSourceOptions } from \"../data-source/DataSourceOptions\"\nimport { TypeORMError } from \"../error\"\nimport { PlatformTools } from \"../platform/PlatformTools\"\nimport { importOrRequireFile } from \"../util/ImportUtils\"\nimport { isAbsolute } from \"../util/PathUtils\"\n\n/**\n * Reads connection options from the ormconfig.\n */\nexport class ConnectionOptionsReader {\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(\n protected options?: {\n /**\n * Directory from where the `ormconfig` file should be read.\n * Default: `process.cwd()`.\n */\n root?: string\n\n /**\n * Filename of the ormconfig configuration. By default its equal to \"ormconfig\".\n */\n configName?: string\n },\n ) {}\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Returns all connection options read from the ormconfig.\n */\n async get(): Promise<DataSourceOptions[]> {\n const options = await this.load()\n if (!options)\n throw new TypeORMError(\n `No connection options were found in any orm configuration files.`,\n )\n\n return options\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Loads all connection options from a configuration file.\n *\n * todo: get in count NODE_ENV somehow\n */\n protected async load(): Promise<DataSourceOptions[] | undefined> {\n let connectionOptions:\n DataSourceOptions | DataSourceOptions[] | undefined = undefined\n\n const fileFormats = [\"js\", \"mjs\", \"cjs\", \"ts\", \"mts\", \"cts\", \"json\"]\n\n // Detect if baseFilePath contains file extension\n const possibleExtension = PlatformTools.pathExtname(this.baseFilePath)\n const fileExtension = fileFormats.find(\n (extension) => `.${extension}` === possibleExtension,\n )\n\n // try to find any of following configuration formats\n const foundFileFormat =\n fileExtension ??\n fileFormats.find((format) => {\n return PlatformTools.fileExist(this.baseFilePath + \".\" + format)\n })\n\n // Determine config file name\n const configFile = fileExtension\n ? this.baseFilePath\n : this.baseFilePath + \".\" + foundFileFormat\n\n // try to find connection options from any of available sources of configuration\n if (\n foundFileFormat === \"js\" ||\n foundFileFormat === \"mjs\" ||\n foundFileFormat === \"cjs\" ||\n foundFileFormat === \"ts\" ||\n foundFileFormat === \"mts\" ||\n foundFileFormat === \"cts\"\n ) {\n try {\n const [importOrRequireResult, moduleSystem] =\n await importOrRequireFile(configFile)\n const configModule = await importOrRequireResult\n\n if (\n moduleSystem === \"esm\" ||\n (configModule &&\n \"__esModule\" in configModule &&\n \"default\" in configModule)\n ) {\n connectionOptions = configModule.default\n } else {\n connectionOptions = configModule\n }\n } catch (err) {\n PlatformTools.logWarn(\n `Warning: Could not load ormconfig file at ${configFile}`,\n err instanceof Error ? err.message : String(err),\n )\n }\n } else if (foundFileFormat === \"json\") {\n try {\n connectionOptions = require(configFile)\n } catch (err) {\n PlatformTools.logWarn(\n `Warning: Could not load ormconfig file at ${configFile}`,\n err instanceof Error ? err.message : String(err),\n )\n }\n }\n\n // normalize and return connection options\n if (connectionOptions) {\n return this.normalizeConnectionOptions(connectionOptions)\n }\n\n return undefined\n }\n\n /**\n * Normalize connection options.\n *\n * @param connectionOptions\n */\n protected normalizeConnectionOptions(\n connectionOptions: DataSourceOptions | DataSourceOptions[],\n ): DataSourceOptions[] {\n if (!Array.isArray(connectionOptions))\n connectionOptions = [connectionOptions]\n\n connectionOptions.forEach((options) => {\n options.baseDirectory = this.baseDirectory\n if (options.entities) {\n const entities = (options.entities as any[]).map((entity) => {\n if (typeof entity === \"string\" && !entity.startsWith(\"/\")) {\n return this.baseDirectory + \"/\" + entity\n }\n\n return entity\n })\n Object.assign(connectionOptions, { entities: entities })\n }\n if (options.subscribers) {\n const subscribers = (options.subscribers as any[]).map(\n (subscriber) => {\n if (\n typeof subscriber === \"string\" &&\n !subscriber.startsWith(\"/\")\n ) {\n return this.baseDirectory + \"/\" + subscriber\n }\n\n return subscriber\n },\n )\n Object.assign(connectionOptions, { subscribers: subscribers })\n }\n if (options.migrations) {\n const migrations = (options.migrations as any[]).map(\n (migration) => {\n if (\n typeof migration === \"string\" &&\n !migration.startsWith(\"/\")\n ) {\n return this.baseDirectory + \"/\" + migration\n }\n\n return migration\n },\n )\n Object.assign(connectionOptions, { migrations: migrations })\n }\n\n // make database path file in sqlite relative to package.json\n if (options.type === \"better-sqlite3\") {\n if (\n typeof options.database === \"string\" &&\n !isAbsolute(options.database) &&\n !options.database.startsWith(\"/\") && // unix absolute\n options.database.slice(1, 3) !== \":\\\\\" && // windows absolute\n options.database !== \":memory:\"\n ) {\n Object.assign(options, {\n database: this.baseDirectory + \"/\" + options.database,\n })\n }\n }\n })\n\n return connectionOptions\n }\n\n /**\n * Gets directory where configuration file should be located and configuration file name.\n */\n protected get baseFilePath(): string {\n return PlatformTools.pathResolve(\n this.baseDirectory,\n this.baseConfigName,\n )\n }\n\n /**\n * Gets directory where configuration file should be located.\n */\n protected get baseDirectory(): string {\n return this.options?.root ?? process.cwd()\n }\n\n /**\n * Gets configuration file name.\n */\n protected get baseConfigName(): string {\n return this.options?.configName ?? \"ormconfig\"\n }\n}\n"]}
|
|
@@ -173,7 +173,8 @@ export interface BaseDataSourceOptions {
|
|
|
173
173
|
*/
|
|
174
174
|
readonly isolateWhereStatements?: boolean;
|
|
175
175
|
/**
|
|
176
|
-
* Controls how null
|
|
176
|
+
* Controls how null/undefined values in where criteria are handled by find
|
|
177
|
+
* and write methods (update/delete/softDelete/restore). Defaults to "throw".
|
|
177
178
|
*/
|
|
178
179
|
readonly invalidWhereValuesBehavior?: InvalidFindOptionsWhereBehavior;
|
|
179
180
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseDataSourceOptions.js","sourceRoot":"../build/browser/src/","sources":["data-source/BaseDataSourceOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { QueryResultCache } from \"../cache/QueryResultCache\"\nimport type { MixedList } from \"../common/MixedList\"\nimport type { DataSource } from \"../data-source/DataSource\"\nimport type { DatabaseType } from \"../driver/types/DatabaseType\"\nimport type { InvalidFindOptionsWhereBehavior } from \"../driver/types/InvalidFindOptionsWhereBehavior\"\nimport type { IsolationLevel } from \"../driver/types/IsolationLevel\"\nimport type { EntitySchema } from \"../entity-schema/EntitySchema\"\nimport type { Logger } from \"../logger/Logger\"\nimport type { LoggerOptions } from \"../logger/LoggerOptions\"\nimport type { NamingStrategyInterface } from \"../naming-strategy/NamingStrategyInterface\"\n\n/**\n * BaseDataSourceOptions is set of DataSourceOptions shared by all database types.\n */\nexport interface BaseDataSourceOptions {\n /**\n * Database type. This value is required.\n */\n readonly type: DatabaseType\n\n /**\n * Entities to be loaded for this connection.\n * Accepts both entity classes and directories where from entities need to be loaded.\n * Directories support glob patterns.\n */\n readonly entities?: MixedList<Function | string | EntitySchema>\n\n /**\n * Subscribers to be loaded for this connection.\n * Accepts both subscriber classes and directories where from subscribers need to be loaded.\n * Directories support glob patterns.\n */\n readonly subscribers?: MixedList<Function | string>\n\n /**\n * Default isolation level for transactions. When set, all transactions started\n * without an explicit level will use this value. An explicit isolation level\n * passed to `transaction()` or `startTransaction()` overrides this default.\n * Must be a level supported by the driver.\n */\n readonly isolationLevel?: IsolationLevel\n\n /**\n * Migrations to be loaded for this connection.\n * Accepts both migration classes and glob patterns representing migration files.\n */\n readonly migrations?: MixedList<Function | string>\n\n /**\n * Migrations table name, in case of different name from \"migrations\".\n * Accepts single string name.\n */\n readonly migrationsTableName?: string\n\n /**\n * Transaction mode for migrations to run in\n */\n readonly migrationsTransactionMode?: \"all\" | \"none\" | \"each\"\n\n /**\n * Typeorm metadata table name, in case of different name from \"typeorm_metadata\".\n * Accepts single string name.\n */\n readonly metadataTableName?: string\n\n /**\n * Naming strategy to be used to name tables and columns in the database.\n */\n readonly namingStrategy?: NamingStrategyInterface\n\n /**\n * Logging options.\n */\n readonly logging?: LoggerOptions\n\n /**\n * Logger instance used to log queries and events in the ORM.\n */\n readonly logger?:\n | \"advanced-console\"\n | \"simple-console\"\n | \"formatted-console\"\n | \"file\"\n | \"debug\"\n | Logger\n\n /**\n * Maximum number of milliseconds query should be executed before logger log a warning.\n */\n readonly maxQueryExecutionTime?: number\n\n /**\n * Maximum number of clients the pool should contain.\n */\n readonly poolSize?: number\n\n /**\n * Indicates if database schema should be auto created on every application launch.\n * Be careful with this option and don't use this in production - otherwise you can lose production data.\n * This option is useful during debug and development.\n * Alternative to it, you can use CLI and run schema:sync command.\n *\n * Note that for MongoDB database it does not create schema, because MongoDB is schemaless.\n * Instead, it syncs just by creating indices.\n */\n readonly synchronize?: boolean\n\n /**\n * Indicates if migrations should be auto run on every application launch.\n * Alternative to it, you can use CLI and run migrations:run command.\n */\n readonly migrationsRun?: boolean\n\n /**\n * Drops the schema each time connection is being established.\n * Be careful with this option and don't use this in production - otherwise you'll lose all production data.\n * This option is useful during debug and development.\n */\n readonly dropSchema?: boolean\n\n /**\n * Prefix to use on all tables (collections) of this connection in the database.\n */\n readonly entityPrefix?: string\n\n /**\n * When creating new Entity instances, skip all constructors when true.\n */\n readonly entitySkipConstructor?: boolean\n\n /**\n * Extra connection options passed through to the underlying driver client\n * (e.g. `pg`, `mysql2`, `tedious`, `mongodb`).\n *\n * Use this for driver-native settings that are not modeled as typed\n * options on the per-driver `DataSourceOptions`. Prefer the typed\n * per-driver options when they exist; `extra` is the escape hatch for\n * anything the driver supports but TypeORM does not expose directly.\n */\n readonly extra?: any\n\n /**\n * Specifies how relations must be loaded - using \"joins\" or separate queries.\n * If you are loading too much data with nested joins it's better to load relations\n * using separate queries.\n *\n * Default strategy is \"join\", but this default can be changed here.\n * Also, strategy can be set per-query in FindOptions and QueryBuilder.\n */\n readonly relationLoadStrategy?: \"join\" | \"query\"\n\n /**\n * Optionally applied \"typename\" to the model.\n * If set, then each hydrated model will have this property with the target model / entity name inside.\n *\n * (works like a discriminator property).\n */\n readonly typename?: string\n\n /**\n * Holds reference to the baseDirectory where configuration file are expected.\n *\n * @internal\n */\n baseDirectory?: string\n\n /**\n * Allows to setup cache options.\n */\n readonly cache?:\n | boolean\n | {\n /**\n * Type of caching.\n *\n * - \"database\" means cached values will be stored in the separate table in database. This is default value.\n * - \"redis\" means cached values will be stored inside redis. You must provide redis connection options.\n */\n readonly type?:\n
|
|
1
|
+
{"version":3,"file":"BaseDataSourceOptions.js","sourceRoot":"../build/browser/src/","sources":["data-source/BaseDataSourceOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { QueryResultCache } from \"../cache/QueryResultCache\"\nimport type { MixedList } from \"../common/MixedList\"\nimport type { DataSource } from \"../data-source/DataSource\"\nimport type { DatabaseType } from \"../driver/types/DatabaseType\"\nimport type { InvalidFindOptionsWhereBehavior } from \"../driver/types/InvalidFindOptionsWhereBehavior\"\nimport type { IsolationLevel } from \"../driver/types/IsolationLevel\"\nimport type { EntitySchema } from \"../entity-schema/EntitySchema\"\nimport type { Logger } from \"../logger/Logger\"\nimport type { LoggerOptions } from \"../logger/LoggerOptions\"\nimport type { NamingStrategyInterface } from \"../naming-strategy/NamingStrategyInterface\"\n\n/**\n * BaseDataSourceOptions is set of DataSourceOptions shared by all database types.\n */\nexport interface BaseDataSourceOptions {\n /**\n * Database type. This value is required.\n */\n readonly type: DatabaseType\n\n /**\n * Entities to be loaded for this connection.\n * Accepts both entity classes and directories where from entities need to be loaded.\n * Directories support glob patterns.\n */\n readonly entities?: MixedList<Function | string | EntitySchema>\n\n /**\n * Subscribers to be loaded for this connection.\n * Accepts both subscriber classes and directories where from subscribers need to be loaded.\n * Directories support glob patterns.\n */\n readonly subscribers?: MixedList<Function | string>\n\n /**\n * Default isolation level for transactions. When set, all transactions started\n * without an explicit level will use this value. An explicit isolation level\n * passed to `transaction()` or `startTransaction()` overrides this default.\n * Must be a level supported by the driver.\n */\n readonly isolationLevel?: IsolationLevel\n\n /**\n * Migrations to be loaded for this connection.\n * Accepts both migration classes and glob patterns representing migration files.\n */\n readonly migrations?: MixedList<Function | string>\n\n /**\n * Migrations table name, in case of different name from \"migrations\".\n * Accepts single string name.\n */\n readonly migrationsTableName?: string\n\n /**\n * Transaction mode for migrations to run in\n */\n readonly migrationsTransactionMode?: \"all\" | \"none\" | \"each\"\n\n /**\n * Typeorm metadata table name, in case of different name from \"typeorm_metadata\".\n * Accepts single string name.\n */\n readonly metadataTableName?: string\n\n /**\n * Naming strategy to be used to name tables and columns in the database.\n */\n readonly namingStrategy?: NamingStrategyInterface\n\n /**\n * Logging options.\n */\n readonly logging?: LoggerOptions\n\n /**\n * Logger instance used to log queries and events in the ORM.\n */\n readonly logger?:\n | \"advanced-console\"\n | \"simple-console\"\n | \"formatted-console\"\n | \"file\"\n | \"debug\"\n | Logger\n\n /**\n * Maximum number of milliseconds query should be executed before logger log a warning.\n */\n readonly maxQueryExecutionTime?: number\n\n /**\n * Maximum number of clients the pool should contain.\n */\n readonly poolSize?: number\n\n /**\n * Indicates if database schema should be auto created on every application launch.\n * Be careful with this option and don't use this in production - otherwise you can lose production data.\n * This option is useful during debug and development.\n * Alternative to it, you can use CLI and run schema:sync command.\n *\n * Note that for MongoDB database it does not create schema, because MongoDB is schemaless.\n * Instead, it syncs just by creating indices.\n */\n readonly synchronize?: boolean\n\n /**\n * Indicates if migrations should be auto run on every application launch.\n * Alternative to it, you can use CLI and run migrations:run command.\n */\n readonly migrationsRun?: boolean\n\n /**\n * Drops the schema each time connection is being established.\n * Be careful with this option and don't use this in production - otherwise you'll lose all production data.\n * This option is useful during debug and development.\n */\n readonly dropSchema?: boolean\n\n /**\n * Prefix to use on all tables (collections) of this connection in the database.\n */\n readonly entityPrefix?: string\n\n /**\n * When creating new Entity instances, skip all constructors when true.\n */\n readonly entitySkipConstructor?: boolean\n\n /**\n * Extra connection options passed through to the underlying driver client\n * (e.g. `pg`, `mysql2`, `tedious`, `mongodb`).\n *\n * Use this for driver-native settings that are not modeled as typed\n * options on the per-driver `DataSourceOptions`. Prefer the typed\n * per-driver options when they exist; `extra` is the escape hatch for\n * anything the driver supports but TypeORM does not expose directly.\n */\n readonly extra?: any\n\n /**\n * Specifies how relations must be loaded - using \"joins\" or separate queries.\n * If you are loading too much data with nested joins it's better to load relations\n * using separate queries.\n *\n * Default strategy is \"join\", but this default can be changed here.\n * Also, strategy can be set per-query in FindOptions and QueryBuilder.\n */\n readonly relationLoadStrategy?: \"join\" | \"query\"\n\n /**\n * Optionally applied \"typename\" to the model.\n * If set, then each hydrated model will have this property with the target model / entity name inside.\n *\n * (works like a discriminator property).\n */\n readonly typename?: string\n\n /**\n * Holds reference to the baseDirectory where configuration file are expected.\n *\n * @internal\n */\n baseDirectory?: string\n\n /**\n * Allows to setup cache options.\n */\n readonly cache?:\n | boolean\n | {\n /**\n * Type of caching.\n *\n * - \"database\" means cached values will be stored in the separate table in database. This is default value.\n * - \"redis\" means cached values will be stored inside redis. You must provide redis connection options.\n */\n readonly type?:\n \"database\" | \"redis\" | \"ioredis\" | \"ioredis/cluster\" // todo: add mongodb and other cache providers as well in the future\n\n /**\n * Factory function for custom cache providers that implement QueryResultCache.\n */\n readonly provider?: (dataSource: DataSource) => QueryResultCache\n\n /**\n * Configurable table name for \"database\" type cache.\n * Default value is \"query-result-cache\"\n */\n readonly tableName?: string\n\n /**\n * Used to provide redis connection options.\n */\n readonly options?: any\n\n /**\n * If set to true then queries (using find methods and QueryBuilder's methods) will always be cached.\n */\n readonly alwaysEnabled?: boolean\n\n /**\n * Time in milliseconds in which cache will expire.\n * This can be setup per-query.\n * Default value is 1000 which is equivalent to 1 second.\n */\n readonly duration?: number\n\n /**\n * Used to specify if cache errors should be ignored, and pass through the call to the Database.\n */\n readonly ignoreErrors?: boolean\n }\n\n /**\n * Allows automatic isolation of where clauses\n */\n readonly isolateWhereStatements?: boolean\n\n /**\n * Controls how null/undefined values in where criteria are handled by find\n * and write methods (update/delete/softDelete/restore). Defaults to \"throw\".\n */\n readonly invalidWhereValuesBehavior?: InvalidFindOptionsWhereBehavior\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataSource.js","sourceRoot":"../build/browser/src/","sources":["data-source/DataSource.ts"],"names":[],"mappings":";;;AACA,oDAAwD;AAKxD,oFAAgF;AAChF,oCAMiB;AAMjB,sEAAkE;AAIlE,yFAAqF;AAErF,iFAA6E;AAC7E,2DAAuD;AACvD,uFAAmF;AAEnF,4EAAwE;AACxE,2DAAuD;AACvD,8EAA0E;AAG1E,oEAAgE;AAChE,qDAAiD;AAEjD,iFAA2E;AAE3E,wEAAoE;AACpE,uDAAmD;AACnD,6DAAyD;AAEzD,qDAAiD;AAEjD,IAAA,qCAAqB,GAAE,CAAA;AAEvB;;;;;;;GAOG;AACH,MAAa,UAAU;IA2EnB,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAY,OAA0B;QA9E7B,mBAAa,GAAG,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;QAyCjD;;WAEG;QACM,eAAU,GAAyB,EAAE,CAAA;QAE9C;;WAEG;QACM,gBAAW,GAAqC,EAAE,CAAA;QAE3D;;WAEG;QACM,oBAAe,GAAqB,EAAE,CAAA;QAE/C;;;WAGG;QACM,uBAAkB,GAAG,IAAI,GAAG,EAAqC,CAAA;QAmBtE,IAAA,qCAAqB,GAAE,CAAA;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO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UAAU,IAAI,EAAE,CAChC,CAAA;QACD,MAAM,UAAU,GACZ,MAAM,yBAAyB,CAAC,eAAe,CAAC,mBAAmB,CAAC,CAAA;QACxE,yBAAW,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAA;QAEpD,iGAAiG;QACjG,uBAAuB,CAAC,YAAY,CAChC,IAAI,CAAC,eAAe,CAAC,MAAM,CACvB,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,KAAK,MAAM,CAC9C,EACD,IAAI,CAAC,MAAM,CACd,CAAA;QAED,0CAA0C;QAC1C,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;YAC3C,IACI,iCAAe,CAAC,uBAAuB,CAAC,cAAc,CAAC,MAAM,CAAC,EAChE,CAAC;gBACC,cAAc,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;YAC7C,CAAC;QACL,CAAC;IACL,CAAC;IAED;;OAEG;IACH,8BAA8B;QAC1B,IACI,aAAa,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO;YACpC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,EACjC,CAAC;YACC,MAAM,KAAK,GACP,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAGvB,CAAC,WAAW,CAAA;YACb,IAAI,KAAK,EAAE,CAAC;gBACR,OAAO,KAAK,CAAA;YAChB,CAAC;QACL,CAAC;QACD,OAAO,OAAO,CAAA;IAClB,CAAC;CACJ;AA5tBD,gCA4tBC","sourcesContent":["import type { Driver } from \"../driver/Driver\"\nimport { registerQueryBuilders } from \"../query-builder\"\nimport type { Repository } from \"../repository/Repository\"\nimport type { EntitySubscriberInterface } from \"../subscriber/EntitySubscriberInterface\"\nimport type { EntityTarget } from \"../common/EntityTarget\"\nimport type { EntityManager } from \"../entity-manager/EntityManager\"\nimport { DefaultNamingStrategy } from \"../naming-strategy/DefaultNamingStrategy\"\nimport {\n CannotConnectAlreadyConnectedError,\n CannotExecuteNotConnectedError,\n EntityMetadataNotFoundError,\n QueryRunnerProviderAlreadyReleasedError,\n TypeORMError,\n} from \"../error\"\nimport type { TreeRepository } from \"../repository/TreeRepository\"\nimport type { NamingStrategyInterface } from \"../naming-strategy/NamingStrategyInterface\"\nimport type { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport type { Logger } from \"../logger/Logger\"\nimport type { MigrationInterface } from \"../migration/MigrationInterface\"\nimport { MigrationExecutor } from \"../migration/MigrationExecutor\"\nimport type { Migration } from \"../migration/Migration\"\nimport type { MongoRepository } from \"../repository/MongoRepository\"\nimport type { MongoEntityManager } from \"../entity-manager/MongoEntityManager\"\nimport { EntityMetadataValidator } from \"../metadata-builder/EntityMetadataValidator\"\nimport type { DataSourceOptions } from \"./DataSourceOptions\"\nimport { EntityManagerFactory } from \"../entity-manager/EntityManagerFactory\"\nimport { DriverFactory } from \"../driver/DriverFactory\"\nimport { ConnectionMetadataBuilder } from \"../connection/ConnectionMetadataBuilder\"\nimport type { QueryRunner } from \"../query-runner/QueryRunner\"\nimport { SelectQueryBuilder } from \"../query-builder/SelectQueryBuilder\"\nimport { LoggerFactory } from \"../logger/LoggerFactory\"\nimport { QueryResultCacheFactory } from \"../cache/QueryResultCacheFactory\"\nimport type { QueryResultCache } from \"../cache/QueryResultCache\"\nimport type { SqljsEntityManager } from \"../entity-manager/SqljsEntityManager\"\nimport { RelationLoader } from \"../query-builder/RelationLoader\"\nimport { ObjectUtils } from \"../util/ObjectUtils\"\nimport type { IsolationLevel } from \"../driver/types/IsolationLevel\"\nimport { validateIsolationLevel } from \"../driver/validate-isolation-level\"\nimport type { ReplicationMode } from \"../driver/types/ReplicationMode\"\nimport { RelationIdLoader } from \"../query-builder/RelationIdLoader\"\nimport { DriverUtils } from \"../driver/DriverUtils\"\nimport { InstanceChecker } from \"../util/InstanceChecker\"\nimport type { ObjectLiteral } from \"../common/ObjectLiteral\"\nimport { buildSqlTag } from \"../util/SqlTagUtils\"\n\nregisterQueryBuilders()\n\n/**\n * DataSource is a pre-defined connection configuration to a specific database.\n * You can have multiple data sources connected (with multiple connections in it),\n * connected to multiple databases in your application.\n *\n * Before, it was called `Connection`, but now `Connection` is deprecated\n * because `Connection` isn't the best name for what it's actually is.\n */\nexport class DataSource {\n readonly \"@instanceof\" = Symbol.for(\"DataSource\")\n\n // -------------------------------------------------------------------------\n // Public Readonly Properties\n // -------------------------------------------------------------------------\n\n /**\n * DataSource options.\n */\n readonly options: DataSourceOptions\n\n /**\n * Indicates if the DataSource is initialized or not.\n */\n readonly isInitialized: boolean\n\n /**\n * Database driver used by this connection.\n */\n driver: Driver\n\n /**\n * EntityManager of this connection.\n */\n readonly manager: EntityManager\n\n /**\n * Naming strategy used in the connection.\n */\n namingStrategy: NamingStrategyInterface\n\n /**\n * Name for the metadata table\n */\n readonly metadataTableName: string\n\n /**\n * Logger used to log orm events.\n */\n logger: Logger\n\n /**\n * Migration instances that are registered for this connection.\n */\n readonly migrations: MigrationInterface[] = []\n\n /**\n * Entity subscriber instances that are registered for this connection.\n */\n readonly subscribers: EntitySubscriberInterface<any>[] = []\n\n /**\n * All entity metadatas that are registered for this connection.\n */\n readonly entityMetadatas: EntityMetadata[] = []\n\n /**\n * All entity metadatas that are registered for this connection.\n * This is a copy of #.entityMetadatas property -> used for more performant searches.\n */\n readonly entityMetadatasMap = new Map<EntityTarget<any>, EntityMetadata>()\n\n /**\n * Used to work with query result cache.\n */\n queryResultCache?: QueryResultCache\n\n /**\n * Used to load relations and work with lazy relations.\n */\n readonly relationLoader: RelationLoader\n\n readonly relationIdLoader: RelationIdLoader\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(options: DataSourceOptions) {\n registerQueryBuilders()\n this.options = options\n this.logger = new LoggerFactory().create(\n this.options.logger,\n this.options.logging,\n )\n this.driver = new DriverFactory().create(this)\n this.manager = this.createEntityManager()\n this.namingStrategy =\n options.namingStrategy ?? new DefaultNamingStrategy()\n this.metadataTableName = options.metadataTableName ?? \"typeorm_metadata\"\n this.queryResultCache = options.cache\n ? new QueryResultCacheFactory(this).create()\n : undefined\n this.relationLoader = new RelationLoader(this)\n this.relationIdLoader = new RelationIdLoader(this)\n this.isInitialized = false\n }\n\n // -------------------------------------------------------------------------\n // Public Accessors\n // -------------------------------------------------------------------------\n\n /**\n * Gets the mongodb entity manager that allows to perform mongodb-specific repository operations\n * with any entity in this connection.\n *\n * Available only in mongodb connections.\n *\n * @returns the mongodb entity manager\n */\n get mongoManager(): MongoEntityManager {\n if (!InstanceChecker.isMongoEntityManager(this.manager))\n throw new TypeORMError(\n `MongoEntityManager is only available for MongoDB databases.`,\n )\n\n return this.manager as MongoEntityManager\n }\n\n /**\n * Gets a sql.js specific Entity Manager that allows to perform special load and save operations\n *\n * Available only in connection with the sqljs driver.\n *\n * @returns an sqljs specific Entity Manager\n */\n get sqljsManager(): SqljsEntityManager {\n if (!InstanceChecker.isSqljsEntityManager(this.manager))\n throw new TypeORMError(\n `SqljsEntityManager is only available for Sqljs databases.`,\n )\n\n return this.manager\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n /**\n * Updates current connection options with provided options.\n *\n * @param options\n */\n setOptions(options: Partial<DataSourceOptions>): this {\n Object.assign(this.options, options)\n\n if (options.logger || options.logging) {\n this.logger = new LoggerFactory().create(\n options.logger ?? this.options.logger,\n options.logging ?? this.options.logging,\n )\n }\n\n if (options.namingStrategy) {\n this.namingStrategy = options.namingStrategy\n }\n\n if (options.cache) {\n this.queryResultCache = new QueryResultCacheFactory(this).create()\n }\n\n // todo: we must update the database in the driver as well, if it was set by setOptions method\n // in the future we need to refactor the code and remove \"database\" from the driver, and instead\n // use database (and options) from a single place - data source.\n if (options.database) {\n this.driver.database = DriverUtils.buildDriverOptions(\n this.options,\n ).database\n }\n\n // todo: need to take a look if we need to update schema and other \"poor\" properties\n\n return this\n }\n\n /**\n * Performs connection to the database.\n * This method should be called once on application bootstrap.\n * This method not necessarily creates database connection (depend on database type),\n * but it also can setup a connection pool with database to use.\n */\n async initialize(): Promise<this> {\n if (this.isInitialized) throw new CannotConnectAlreadyConnectedError()\n\n // validate isolationLevel before connecting\n validateIsolationLevel(\n this.driver.supportedIsolationLevels,\n this.options.isolationLevel,\n )\n\n // connect to the database via its driver\n await this.driver.connect()\n\n // connect to the cache-specific database if cache is enabled\n if (this.queryResultCache) await this.queryResultCache.connect()\n\n // set connected status for the current connection\n ObjectUtils.assign(this, { isInitialized: true })\n\n try {\n // build all metadatas registered in the current connection\n await this.buildMetadatas()\n\n await this.driver.afterConnect()\n\n // if option is set - drop schema once connection is done\n if (this.options.dropSchema) await this.dropDatabase()\n\n // if option is set - automatically synchronize a schema\n if (this.options.migrationsRun)\n await this.runMigrations({\n transaction: this.options.migrationsTransactionMode,\n })\n\n // if option is set - automatically synchronize a schema\n if (this.options.synchronize) await this.synchronize()\n } catch (error) {\n // if for some reason build metadata fail (for example validation error during entity metadata check)\n // connection needs to be closed\n await this.destroy()\n throw error\n }\n\n return this\n }\n\n /**\n * Closes connection with the database.\n * Once connection is closed, you cannot use repositories or perform any operations except opening connection again.\n */\n async destroy(): Promise<void> {\n if (!this.isInitialized) throw new CannotExecuteNotConnectedError()\n\n await this.driver.disconnect()\n\n // disconnect from the cache-specific database if cache was enabled\n if (this.queryResultCache) await this.queryResultCache.disconnect()\n\n ObjectUtils.assign(this, { isInitialized: false })\n }\n\n /**\n * Creates database schema for all entities registered in this connection.\n * Can be used only after connection to the database is established.\n *\n * @param dropBeforeSync If set to true then it drops the database with all its tables and data\n */\n async synchronize(dropBeforeSync: boolean = false): Promise<void> {\n if (!this.isInitialized) throw new CannotExecuteNotConnectedError()\n\n if (dropBeforeSync) await this.dropDatabase()\n\n const schemaBuilder = this.driver.createSchemaBuilder()\n await schemaBuilder.build()\n }\n\n /**\n * Drops the database and all its data.\n * Be careful with this method on production since this method will erase all your database tables and their data.\n * Can be used only after connection to the database is established.\n */\n // TODO rename\n async dropDatabase(): Promise<void> {\n const queryRunner = this.createQueryRunner()\n try {\n if (\n this.driver.options.type === \"mssql\" ||\n DriverUtils.isMySQLFamily(this.driver) ||\n this.driver.options.type === \"aurora-mysql\" ||\n DriverUtils.isSQLiteFamily(this.driver)\n ) {\n const databases: string[] = []\n this.entityMetadatas.forEach((metadata) => {\n if (\n metadata.database &&\n databases.indexOf(metadata.database) === -1\n )\n databases.push(metadata.database)\n })\n if (databases.length === 0 && this.driver.database) {\n databases.push(this.driver.database)\n }\n\n if (databases.length === 0) {\n await queryRunner.clearDatabase()\n } else {\n for (const database of databases) {\n await queryRunner.clearDatabase(database)\n }\n }\n } else {\n await queryRunner.clearDatabase()\n }\n } finally {\n await queryRunner.release()\n }\n }\n\n /**\n * Runs all pending migrations.\n * Can be used only after connection to the database is established.\n *\n * @param options\n * @param options.transaction\n * @param options.fake\n */\n async runMigrations(options?: {\n transaction?: \"all\" | \"none\" | \"each\"\n fake?: boolean\n }): Promise<Migration[]> {\n if (!this.isInitialized) throw new CannotExecuteNotConnectedError()\n\n const migrationExecutor = new MigrationExecutor(this)\n migrationExecutor.transaction =\n options?.transaction ??\n this.options?.migrationsTransactionMode ??\n \"all\"\n migrationExecutor.fake = options?.fake ?? false\n\n const successMigrations =\n await migrationExecutor.executePendingMigrations()\n return successMigrations\n }\n\n /**\n * Reverts last executed migration.\n * Can be used only after connection to the database is established.\n *\n * @param options\n * @param options.transaction\n * @param options.fake\n */\n async undoLastMigration(options?: {\n transaction?: \"all\" | \"none\" | \"each\"\n fake?: boolean\n }): Promise<void> {\n if (!this.isInitialized) throw new CannotExecuteNotConnectedError()\n\n const migrationExecutor = new MigrationExecutor(this)\n migrationExecutor.transaction = options?.transaction ?? \"all\"\n migrationExecutor.fake = options?.fake ?? false\n\n await migrationExecutor.undoLastMigration()\n }\n\n /**\n * Lists all migrations and whether they have been run.\n * Returns true if there are pending migrations\n */\n async showMigrations(): Promise<boolean> {\n if (!this.isInitialized) {\n throw new CannotExecuteNotConnectedError()\n }\n const migrationExecutor = new MigrationExecutor(this)\n return await migrationExecutor.showMigrations()\n }\n\n /**\n * Checks if entity metadata exist for the given entity class, target name or table name.\n *\n * @param target\n */\n hasMetadata(target: EntityTarget<any>): boolean {\n return !!this.findMetadata(target)\n }\n\n /**\n * Gets entity metadata for the given entity class or schema name.\n *\n * @param target\n */\n getMetadata(target: EntityTarget<any>): EntityMetadata {\n const metadata = this.findMetadata(target)\n if (!metadata) throw new EntityMetadataNotFoundError(target)\n\n return metadata\n }\n\n /**\n * Gets repository for the given entity.\n *\n * @param target\n */\n getRepository<Entity extends ObjectLiteral>(\n target: EntityTarget<Entity>,\n ): Repository<Entity> {\n return this.manager.getRepository(target)\n }\n\n /**\n * Gets tree repository for the given entity class or name.\n * Only tree-type entities can have a TreeRepository, like ones decorated with `@Tree` decorator.\n *\n * @param target\n */\n getTreeRepository<Entity extends ObjectLiteral>(\n target: EntityTarget<Entity>,\n ): TreeRepository<Entity> {\n return this.manager.getTreeRepository(target)\n }\n\n /**\n * Gets mongodb-specific repository for the given entity class or name.\n * Works only if connection is mongodb-specific.\n *\n * @param target\n */\n getMongoRepository<Entity extends ObjectLiteral>(\n target: EntityTarget<Entity>,\n ): MongoRepository<Entity> {\n if (!(this.driver.options.type === \"mongodb\"))\n throw new TypeORMError(\n `You can use getMongoRepository only for MongoDB connections.`,\n )\n\n return this.manager.getRepository(target) as any\n }\n\n /**\n * Wraps given function execution (and all operations made there) into a transaction.\n * All database operations must be executed using provided entity manager.\n */\n async transaction<T>(\n runInTransaction: (entityManager: EntityManager) => Promise<T>,\n ): Promise<T>\n async transaction<T>(\n isolationLevel: IsolationLevel,\n runInTransaction: (entityManager: EntityManager) => Promise<T>,\n ): Promise<T>\n async transaction<T>(\n isolationOrRunInTransaction:\n | IsolationLevel\n | ((entityManager: EntityManager) => Promise<T>),\n runInTransactionParam?: (entityManager: EntityManager) => Promise<T>,\n ): Promise<any> {\n return this.manager.transaction(\n isolationOrRunInTransaction as any,\n runInTransactionParam as any,\n )\n }\n\n /**\n * Executes raw SQL query and returns raw database results.\n *\n * @param query\n * @param parameters\n * @param queryRunner\n * @returns a raw response from the database client\n * @see {@link https://typeorm.io/data-source-api | Official docs} for examples.\n */\n async query<T = any>(\n query: string,\n parameters?: any[] | ObjectLiteral,\n queryRunner?: QueryRunner,\n ): Promise<T> {\n if (InstanceChecker.isMongoEntityManager(this.manager))\n throw new TypeORMError(`Queries aren't supported by MongoDB.`)\n\n if (queryRunner?.isReleased)\n throw new QueryRunnerProviderAlreadyReleasedError()\n\n const usedQueryRunner = queryRunner ?? this.createQueryRunner()\n\n try {\n return await usedQueryRunner.query(query, parameters) // await is needed here because we are using finally\n } finally {\n if (!queryRunner) await usedQueryRunner.release()\n }\n }\n\n /**\n * Tagged template function that executes raw SQL query and returns raw database results.\n * Template expressions are automatically transformed into database parameters.\n * Raw query execution is supported only by relational databases (MongoDB is not supported).\n * Note: Don't call this as a regular function, it is meant to be used with backticks to tag a template literal.\n *\n * @example\n * dataSource.sql`SELECT * FROM table_name WHERE id = ${id}`\n *\n * @param strings\n * @param values\n * @returns a raw response from the database client\n */\n async sql<T = any>(\n strings: TemplateStringsArray,\n ...values: unknown[]\n ): Promise<T> {\n const { query, parameters } = buildSqlTag({\n driver: this.driver,\n strings: strings,\n expressions: values,\n })\n\n return await this.query(query, parameters)\n }\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n alias: string,\n queryRunner?: QueryRunner,\n ): SelectQueryBuilder<Entity>\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder(queryRunner?: QueryRunner): SelectQueryBuilder<any>\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n *\n * @param entityOrRunner\n * @param alias\n * @param queryRunner\n */\n createQueryBuilder<Entity extends ObjectLiteral>(\n entityOrRunner?: EntityTarget<Entity> | QueryRunner,\n alias?: string,\n queryRunner?: QueryRunner,\n ): SelectQueryBuilder<Entity> {\n if (InstanceChecker.isMongoEntityManager(this.manager))\n throw new TypeORMError(`Query Builder is not supported by MongoDB.`)\n\n if (alias) {\n alias = DriverUtils.buildAlias(this.driver, undefined, alias)\n const metadata = this.getMetadata(\n entityOrRunner as EntityTarget<Entity>,\n )\n return new SelectQueryBuilder(this, queryRunner)\n .select(alias)\n .from(metadata.target, alias)\n } else {\n return new SelectQueryBuilder(\n this,\n entityOrRunner as QueryRunner | undefined,\n )\n }\n }\n\n /**\n * Creates a query runner used for perform queries on a single database connection.\n * Using query runners you can control your queries to execute using single database connection and\n * manually control your database transaction.\n *\n * Mode is used in replication mode and indicates whatever you want to connect\n * to master database or any of slave databases.\n * If you perform writes you must use master database,\n * if you perform reads you can use slave databases.\n *\n * @param mode\n */\n createQueryRunner(mode: ReplicationMode = \"master\"): QueryRunner {\n const queryRunner = this.driver.createQueryRunner(mode)\n const manager = this.createEntityManager(queryRunner)\n Object.assign(queryRunner, { manager: manager })\n return queryRunner\n }\n\n /**\n * Gets entity metadata of the junction table (many-to-many table).\n *\n * @param entityTarget\n * @param relationPropertyPath\n */\n getManyToManyMetadata(\n entityTarget: EntityTarget<any>,\n relationPropertyPath: string,\n ) {\n const relationMetadata =\n this.getMetadata(entityTarget).findRelationWithPropertyPath(\n relationPropertyPath,\n )\n if (!relationMetadata)\n throw new TypeORMError(\n `Relation \"${relationPropertyPath}\" was not found in ${entityTarget} entity.`,\n )\n if (!relationMetadata.isManyToMany)\n throw new TypeORMError(\n `Relation \"${entityTarget}#${relationPropertyPath}\" does not have a many-to-many relationship.` +\n `You can use this method only on many-to-many relations.`,\n )\n\n return relationMetadata.junctionEntityMetadata\n }\n\n /**\n * Creates an Entity Manager for the current connection with the help of the EntityManagerFactory.\n *\n * @param queryRunner\n */\n createEntityManager(queryRunner?: QueryRunner): EntityManager {\n return new EntityManagerFactory().create(this, queryRunner)\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Finds exist entity metadata by the given entity class, target name or table name.\n *\n * @param target\n */\n protected findMetadata(\n target: EntityTarget<any>,\n ): EntityMetadata | undefined {\n const metadataFromMap = this.entityMetadatasMap.get(target)\n if (metadataFromMap) return metadataFromMap\n\n for (const [_, metadata] of this.entityMetadatasMap) {\n if (\n InstanceChecker.isEntitySchema(target) &&\n metadata.name === target.options.name\n ) {\n return metadata\n }\n if (typeof target === \"string\") {\n if (target.indexOf(\".\") !== -1) {\n if (metadata.tablePath === target) {\n return metadata\n }\n } else {\n if (\n metadata.name === target ||\n metadata.tableName === target\n ) {\n return metadata\n }\n }\n }\n if (\n ObjectUtils.isObjectWithName(target) &&\n typeof target.name === \"string\"\n ) {\n if (target.name.indexOf(\".\") !== -1) {\n if (metadata.tablePath === target.name) {\n return metadata\n }\n } else {\n if (\n metadata.name === target.name ||\n metadata.tableName === target.name\n ) {\n return metadata\n }\n }\n }\n }\n\n return undefined\n }\n\n /**\n * Builds metadatas for all registered classes inside this connection.\n */\n protected async buildMetadatas(): Promise<void> {\n const connectionMetadataBuilder = new ConnectionMetadataBuilder(this)\n const entityMetadataValidator = new EntityMetadataValidator()\n\n // create subscribers instances if they are not disallowed from high-level (for example they can disallowed from migrations run process)\n const flattenedSubscribers = ObjectUtils.mixedListToArray(\n this.options.subscribers ?? [],\n )\n const subscribers =\n await connectionMetadataBuilder.buildSubscribers(\n flattenedSubscribers,\n )\n ObjectUtils.assign(this, { subscribers: subscribers })\n\n // build entity metadatas\n const flattenedEntities = ObjectUtils.mixedListToArray(\n this.options.entities ?? [],\n )\n const entityMetadatas =\n await connectionMetadataBuilder.buildEntityMetadatas(\n flattenedEntities,\n )\n ObjectUtils.assign(this, {\n entityMetadatas: entityMetadatas,\n entityMetadatasMap: new Map(\n entityMetadatas.map((metadata) => [metadata.target, metadata]),\n ),\n })\n\n // create migration instances\n const flattenedMigrations = ObjectUtils.mixedListToArray(\n this.options.migrations ?? [],\n )\n const migrations =\n await connectionMetadataBuilder.buildMigrations(flattenedMigrations)\n ObjectUtils.assign(this, { migrations: migrations })\n\n // validate all created entity metadatas to make sure user created entities are valid and correct\n entityMetadataValidator.validateMany(\n this.entityMetadatas.filter(\n (metadata) => metadata.tableType !== \"view\",\n ),\n this.driver,\n )\n\n // set current data source to the entities\n for (const entityMetadata of entityMetadatas) {\n if (\n InstanceChecker.isBaseEntityConstructor(entityMetadata.target)\n ) {\n entityMetadata.target.useDataSource(this)\n }\n }\n }\n\n /**\n * Get the replication mode SELECT queries should use for this datasource by default\n */\n defaultReplicationModeForReads(): ReplicationMode {\n if (\n \"replication\" in this.driver.options &&\n this.driver.options.replication\n ) {\n const value = (\n this.driver.options.replication as {\n defaultMode?: ReplicationMode\n }\n ).defaultMode\n if (value) {\n return value\n }\n }\n return \"slave\"\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"DataSource.js","sourceRoot":"../build/browser/src/","sources":["data-source/DataSource.ts"],"names":[],"mappings":";;;AACA,oDAAwD;AAKxD,oFAAgF;AAChF,oCAMiB;AAMjB,sEAAkE;AAIlE,yFAAqF;AAErF,iFAA6E;AAC7E,2DAAuD;AACvD,uFAAmF;AAEnF,4EAAwE;AACxE,2DAAuD;AACvD,8EAA0E;AAG1E,oEAAgE;AAChE,qDAAiD;AAEjD,iFAA2E;AAE3E,wEAAoE;AACpE,uDAAmD;AACnD,6DAAyD;AAEzD,qDAAiD;AAEjD,IAAA,qCAAqB,GAAE,CAAA;AAEvB;;;;;;;GAOG;AACH,MAAa,UAAU;IA2EnB,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAY,OAA0B;QA9E7B,mBAAa,GAAG,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;QAyCjD;;WAEG;QACM,eAAU,GAAyB,EAAE,CAAA;QAE9C;;WAEG;QACM,gBAAW,GAAqC,EAAE,CAAA;QAE3D;;WAEG;QACM,oBAAe,GAAqB,EAAE,CAAA;QAE/C;;;WAGG;QACM,uBAA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AC,CAAA;QAEF,6BAA6B;QAC7B,MAAM,mBAAmB,GAAG,yBAAW,CAAC,gBAAgB,CACpD,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAChC,CAAA;QACD,MAAM,UAAU,GACZ,MAAM,yBAAyB,CAAC,eAAe,CAAC,mBAAmB,CAAC,CAAA;QACxE,yBAAW,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAA;QAEpD,iGAAiG;QACjG,uBAAuB,CAAC,YAAY,CAChC,IAAI,CAAC,eAAe,CAAC,MAAM,CACvB,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,KAAK,MAAM,CAC9C,EACD,IAAI,CAAC,MAAM,CACd,CAAA;QAED,0CAA0C;QAC1C,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;YAC3C,IACI,iCAAe,CAAC,uBAAuB,CAAC,cAAc,CAAC,MAAM,CAAC,EAChE,CAAC;gBACC,cAAc,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;YAC7C,CAAC;QACL,CAAC;IACL,CAAC;IAED;;OAEG;IACH,8BAA8B;QAC1B,IACI,aAAa,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO;YACpC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,EACjC,CAAC;YACC,MAAM,KAAK,GACP,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAGvB,CAAC,WAAW,CAAA;YACb,IAAI,KAAK,EAAE,CAAC;gBACR,OAAO,KAAK,CAAA;YAChB,CAAC;QACL,CAAC;QACD,OAAO,OAAO,CAAA;IAClB,CAAC;CACJ;AA3tBD,gCA2tBC","sourcesContent":["import type { Driver } from \"../driver/Driver\"\nimport { registerQueryBuilders } from \"../query-builder\"\nimport type { Repository } from \"../repository/Repository\"\nimport type { EntitySubscriberInterface } from \"../subscriber/EntitySubscriberInterface\"\nimport type { EntityTarget } from \"../common/EntityTarget\"\nimport type { EntityManager } from \"../entity-manager/EntityManager\"\nimport { DefaultNamingStrategy } from \"../naming-strategy/DefaultNamingStrategy\"\nimport {\n CannotConnectAlreadyConnectedError,\n CannotExecuteNotConnectedError,\n EntityMetadataNotFoundError,\n QueryRunnerProviderAlreadyReleasedError,\n TypeORMError,\n} from \"../error\"\nimport type { TreeRepository } from \"../repository/TreeRepository\"\nimport type { NamingStrategyInterface } from \"../naming-strategy/NamingStrategyInterface\"\nimport type { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport type { Logger } from \"../logger/Logger\"\nimport type { MigrationInterface } from \"../migration/MigrationInterface\"\nimport { MigrationExecutor } from \"../migration/MigrationExecutor\"\nimport type { Migration } from \"../migration/Migration\"\nimport type { MongoRepository } from \"../repository/MongoRepository\"\nimport type { MongoEntityManager } from \"../entity-manager/MongoEntityManager\"\nimport { EntityMetadataValidator } from \"../metadata-builder/EntityMetadataValidator\"\nimport type { DataSourceOptions } from \"./DataSourceOptions\"\nimport { EntityManagerFactory } from \"../entity-manager/EntityManagerFactory\"\nimport { DriverFactory } from \"../driver/DriverFactory\"\nimport { ConnectionMetadataBuilder } from \"../connection/ConnectionMetadataBuilder\"\nimport type { QueryRunner } from \"../query-runner/QueryRunner\"\nimport { SelectQueryBuilder } from \"../query-builder/SelectQueryBuilder\"\nimport { LoggerFactory } from \"../logger/LoggerFactory\"\nimport { QueryResultCacheFactory } from \"../cache/QueryResultCacheFactory\"\nimport type { QueryResultCache } from \"../cache/QueryResultCache\"\nimport type { SqljsEntityManager } from \"../entity-manager/SqljsEntityManager\"\nimport { RelationLoader } from \"../query-builder/RelationLoader\"\nimport { ObjectUtils } from \"../util/ObjectUtils\"\nimport type { IsolationLevel } from \"../driver/types/IsolationLevel\"\nimport { validateIsolationLevel } from \"../driver/validate-isolation-level\"\nimport type { ReplicationMode } from \"../driver/types/ReplicationMode\"\nimport { RelationIdLoader } from \"../query-builder/RelationIdLoader\"\nimport { DriverUtils } from \"../driver/DriverUtils\"\nimport { InstanceChecker } from \"../util/InstanceChecker\"\nimport type { ObjectLiteral } from \"../common/ObjectLiteral\"\nimport { buildSqlTag } from \"../util/SqlTagUtils\"\n\nregisterQueryBuilders()\n\n/**\n * DataSource is a pre-defined connection configuration to a specific database.\n * You can have multiple data sources connected (with multiple connections in it),\n * connected to multiple databases in your application.\n *\n * Before, it was called `Connection`, but now `Connection` is deprecated\n * because `Connection` isn't the best name for what it's actually is.\n */\nexport class DataSource {\n readonly \"@instanceof\" = Symbol.for(\"DataSource\")\n\n // -------------------------------------------------------------------------\n // Public Readonly Properties\n // -------------------------------------------------------------------------\n\n /**\n * DataSource options.\n */\n readonly options: DataSourceOptions\n\n /**\n * Indicates if the DataSource is initialized or not.\n */\n readonly isInitialized: boolean\n\n /**\n * Database driver used by this connection.\n */\n driver: Driver\n\n /**\n * EntityManager of this connection.\n */\n readonly manager: EntityManager\n\n /**\n * Naming strategy used in the connection.\n */\n namingStrategy: NamingStrategyInterface\n\n /**\n * Name for the metadata table\n */\n readonly metadataTableName: string\n\n /**\n * Logger used to log orm events.\n */\n logger: Logger\n\n /**\n * Migration instances that are registered for this connection.\n */\n readonly migrations: MigrationInterface[] = []\n\n /**\n * Entity subscriber instances that are registered for this connection.\n */\n readonly subscribers: EntitySubscriberInterface<any>[] = []\n\n /**\n * All entity metadatas that are registered for this connection.\n */\n readonly entityMetadatas: EntityMetadata[] = []\n\n /**\n * All entity metadatas that are registered for this connection.\n * This is a copy of #.entityMetadatas property -> used for more performant searches.\n */\n readonly entityMetadatasMap = new Map<EntityTarget<any>, EntityMetadata>()\n\n /**\n * Used to work with query result cache.\n */\n queryResultCache?: QueryResultCache\n\n /**\n * Used to load relations and work with lazy relations.\n */\n readonly relationLoader: RelationLoader\n\n readonly relationIdLoader: RelationIdLoader\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(options: DataSourceOptions) {\n registerQueryBuilders()\n this.options = options\n this.logger = new LoggerFactory().create(\n this.options.logger,\n this.options.logging,\n )\n this.driver = new DriverFactory().create(this)\n this.manager = this.createEntityManager()\n this.namingStrategy =\n options.namingStrategy ?? new DefaultNamingStrategy()\n this.metadataTableName = options.metadataTableName ?? \"typeorm_metadata\"\n this.queryResultCache = options.cache\n ? new QueryResultCacheFactory(this).create()\n : undefined\n this.relationLoader = new RelationLoader(this)\n this.relationIdLoader = new RelationIdLoader(this)\n this.isInitialized = false\n }\n\n // -------------------------------------------------------------------------\n // Public Accessors\n // -------------------------------------------------------------------------\n\n /**\n * Gets the mongodb entity manager that allows to perform mongodb-specific repository operations\n * with any entity in this connection.\n *\n * Available only in mongodb connections.\n *\n * @returns the mongodb entity manager\n */\n get mongoManager(): MongoEntityManager {\n if (!InstanceChecker.isMongoEntityManager(this.manager))\n throw new TypeORMError(\n `MongoEntityManager is only available for MongoDB databases.`,\n )\n\n return this.manager as MongoEntityManager\n }\n\n /**\n * Gets a sql.js specific Entity Manager that allows to perform special load and save operations\n *\n * Available only in connection with the sqljs driver.\n *\n * @returns an sqljs specific Entity Manager\n */\n get sqljsManager(): SqljsEntityManager {\n if (!InstanceChecker.isSqljsEntityManager(this.manager))\n throw new TypeORMError(\n `SqljsEntityManager is only available for Sqljs databases.`,\n )\n\n return this.manager\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n /**\n * Updates current connection options with provided options.\n *\n * @param options\n */\n setOptions(options: Partial<DataSourceOptions>): this {\n Object.assign(this.options, options)\n\n if (options.logger || options.logging) {\n this.logger = new LoggerFactory().create(\n options.logger ?? this.options.logger,\n options.logging ?? this.options.logging,\n )\n }\n\n if (options.namingStrategy) {\n this.namingStrategy = options.namingStrategy\n }\n\n if (options.cache) {\n this.queryResultCache = new QueryResultCacheFactory(this).create()\n }\n\n // todo: we must update the database in the driver as well, if it was set by setOptions method\n // in the future we need to refactor the code and remove \"database\" from the driver, and instead\n // use database (and options) from a single place - data source.\n if (options.database) {\n this.driver.database = DriverUtils.buildDriverOptions(\n this.options,\n ).database\n }\n\n // todo: need to take a look if we need to update schema and other \"poor\" properties\n\n return this\n }\n\n /**\n * Performs connection to the database.\n * This method should be called once on application bootstrap.\n * This method not necessarily creates database connection (depend on database type),\n * but it also can setup a connection pool with database to use.\n */\n async initialize(): Promise<this> {\n if (this.isInitialized) throw new CannotConnectAlreadyConnectedError()\n\n // validate isolationLevel before connecting\n validateIsolationLevel(\n this.driver.supportedIsolationLevels,\n this.options.isolationLevel,\n )\n\n // connect to the database via its driver\n await this.driver.connect()\n\n // connect to the cache-specific database if cache is enabled\n if (this.queryResultCache) await this.queryResultCache.connect()\n\n // set connected status for the current connection\n ObjectUtils.assign(this, { isInitialized: true })\n\n try {\n // build all metadatas registered in the current connection\n await this.buildMetadatas()\n\n await this.driver.afterConnect()\n\n // if option is set - drop schema once connection is done\n if (this.options.dropSchema) await this.dropDatabase()\n\n // if option is set - automatically synchronize a schema\n if (this.options.migrationsRun)\n await this.runMigrations({\n transaction: this.options.migrationsTransactionMode,\n })\n\n // if option is set - automatically synchronize a schema\n if (this.options.synchronize) await this.synchronize()\n } catch (error) {\n // if for some reason build metadata fail (for example validation error during entity metadata check)\n // connection needs to be closed\n await this.destroy()\n throw error\n }\n\n return this\n }\n\n /**\n * Closes connection with the database.\n * Once connection is closed, you cannot use repositories or perform any operations except opening connection again.\n */\n async destroy(): Promise<void> {\n if (!this.isInitialized) throw new CannotExecuteNotConnectedError()\n\n await this.driver.disconnect()\n\n // disconnect from the cache-specific database if cache was enabled\n if (this.queryResultCache) await this.queryResultCache.disconnect()\n\n ObjectUtils.assign(this, { isInitialized: false })\n }\n\n /**\n * Creates database schema for all entities registered in this connection.\n * Can be used only after connection to the database is established.\n *\n * @param dropBeforeSync If set to true then it drops the database with all its tables and data\n */\n async synchronize(dropBeforeSync: boolean = false): Promise<void> {\n if (!this.isInitialized) throw new CannotExecuteNotConnectedError()\n\n if (dropBeforeSync) await this.dropDatabase()\n\n const schemaBuilder = this.driver.createSchemaBuilder()\n await schemaBuilder.build()\n }\n\n /**\n * Drops the database and all its data.\n * Be careful with this method on production since this method will erase all your database tables and their data.\n * Can be used only after connection to the database is established.\n */\n // TODO rename\n async dropDatabase(): Promise<void> {\n const queryRunner = this.createQueryRunner()\n try {\n if (\n this.driver.options.type === \"mssql\" ||\n DriverUtils.isMySQLFamily(this.driver) ||\n this.driver.options.type === \"aurora-mysql\" ||\n DriverUtils.isSQLiteFamily(this.driver)\n ) {\n const databases: string[] = []\n this.entityMetadatas.forEach((metadata) => {\n if (\n metadata.database &&\n databases.indexOf(metadata.database) === -1\n )\n databases.push(metadata.database)\n })\n if (databases.length === 0 && this.driver.database) {\n databases.push(this.driver.database)\n }\n\n if (databases.length === 0) {\n await queryRunner.clearDatabase()\n } else {\n for (const database of databases) {\n await queryRunner.clearDatabase(database)\n }\n }\n } else {\n await queryRunner.clearDatabase()\n }\n } finally {\n await queryRunner.release()\n }\n }\n\n /**\n * Runs all pending migrations.\n * Can be used only after connection to the database is established.\n *\n * @param options\n * @param options.transaction\n * @param options.fake\n */\n async runMigrations(options?: {\n transaction?: \"all\" | \"none\" | \"each\"\n fake?: boolean\n }): Promise<Migration[]> {\n if (!this.isInitialized) throw new CannotExecuteNotConnectedError()\n\n const migrationExecutor = new MigrationExecutor(this)\n migrationExecutor.transaction =\n options?.transaction ??\n this.options?.migrationsTransactionMode ??\n \"all\"\n migrationExecutor.fake = options?.fake ?? false\n\n const successMigrations =\n await migrationExecutor.executePendingMigrations()\n return successMigrations\n }\n\n /**\n * Reverts last executed migration.\n * Can be used only after connection to the database is established.\n *\n * @param options\n * @param options.transaction\n * @param options.fake\n */\n async undoLastMigration(options?: {\n transaction?: \"all\" | \"none\" | \"each\"\n fake?: boolean\n }): Promise<void> {\n if (!this.isInitialized) throw new CannotExecuteNotConnectedError()\n\n const migrationExecutor = new MigrationExecutor(this)\n migrationExecutor.transaction = options?.transaction ?? \"all\"\n migrationExecutor.fake = options?.fake ?? false\n\n await migrationExecutor.undoLastMigration()\n }\n\n /**\n * Lists all migrations and whether they have been run.\n * Returns true if there are pending migrations\n */\n async showMigrations(): Promise<boolean> {\n if (!this.isInitialized) {\n throw new CannotExecuteNotConnectedError()\n }\n const migrationExecutor = new MigrationExecutor(this)\n return await migrationExecutor.showMigrations()\n }\n\n /**\n * Checks if entity metadata exist for the given entity class, target name or table name.\n *\n * @param target\n */\n hasMetadata(target: EntityTarget<any>): boolean {\n return !!this.findMetadata(target)\n }\n\n /**\n * Gets entity metadata for the given entity class or schema name.\n *\n * @param target\n */\n getMetadata(target: EntityTarget<any>): EntityMetadata {\n const metadata = this.findMetadata(target)\n if (!metadata) throw new EntityMetadataNotFoundError(target)\n\n return metadata\n }\n\n /**\n * Gets repository for the given entity.\n *\n * @param target\n */\n getRepository<Entity extends ObjectLiteral>(\n target: EntityTarget<Entity>,\n ): Repository<Entity> {\n return this.manager.getRepository(target)\n }\n\n /**\n * Gets tree repository for the given entity class or name.\n * Only tree-type entities can have a TreeRepository, like ones decorated with `@Tree` decorator.\n *\n * @param target\n */\n getTreeRepository<Entity extends ObjectLiteral>(\n target: EntityTarget<Entity>,\n ): TreeRepository<Entity> {\n return this.manager.getTreeRepository(target)\n }\n\n /**\n * Gets mongodb-specific repository for the given entity class or name.\n * Works only if connection is mongodb-specific.\n *\n * @param target\n */\n getMongoRepository<Entity extends ObjectLiteral>(\n target: EntityTarget<Entity>,\n ): MongoRepository<Entity> {\n if (!(this.driver.options.type === \"mongodb\"))\n throw new TypeORMError(\n `You can use getMongoRepository only for MongoDB connections.`,\n )\n\n return this.manager.getRepository(target) as any\n }\n\n /**\n * Wraps given function execution (and all operations made there) into a transaction.\n * All database operations must be executed using provided entity manager.\n */\n async transaction<T>(\n runInTransaction: (entityManager: EntityManager) => Promise<T>,\n ): Promise<T>\n async transaction<T>(\n isolationLevel: IsolationLevel,\n runInTransaction: (entityManager: EntityManager) => Promise<T>,\n ): Promise<T>\n async transaction<T>(\n isolationOrRunInTransaction:\n IsolationLevel | ((entityManager: EntityManager) => Promise<T>),\n runInTransactionParam?: (entityManager: EntityManager) => Promise<T>,\n ): Promise<any> {\n return this.manager.transaction(\n isolationOrRunInTransaction as any,\n runInTransactionParam as any,\n )\n }\n\n /**\n * Executes raw SQL query and returns raw database results.\n *\n * @param query\n * @param parameters\n * @param queryRunner\n * @returns a raw response from the database client\n * @see {@link https://typeorm.io/data-source-api | Official docs} for examples.\n */\n async query<T = any>(\n query: string,\n parameters?: any[] | ObjectLiteral,\n queryRunner?: QueryRunner,\n ): Promise<T> {\n if (InstanceChecker.isMongoEntityManager(this.manager))\n throw new TypeORMError(`Queries aren't supported by MongoDB.`)\n\n if (queryRunner?.isReleased)\n throw new QueryRunnerProviderAlreadyReleasedError()\n\n const usedQueryRunner = queryRunner ?? this.createQueryRunner()\n\n try {\n return await usedQueryRunner.query(query, parameters) // await is needed here because we are using finally\n } finally {\n if (!queryRunner) await usedQueryRunner.release()\n }\n }\n\n /**\n * Tagged template function that executes raw SQL query and returns raw database results.\n * Template expressions are automatically transformed into database parameters.\n * Raw query execution is supported only by relational databases (MongoDB is not supported).\n * Note: Don't call this as a regular function, it is meant to be used with backticks to tag a template literal.\n *\n * @example\n * dataSource.sql`SELECT * FROM table_name WHERE id = ${id}`\n *\n * @param strings\n * @param values\n * @returns a raw response from the database client\n */\n async sql<T = any>(\n strings: TemplateStringsArray,\n ...values: unknown[]\n ): Promise<T> {\n const { query, parameters } = buildSqlTag({\n driver: this.driver,\n strings: strings,\n expressions: values,\n })\n\n return await this.query(query, parameters)\n }\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n alias: string,\n queryRunner?: QueryRunner,\n ): SelectQueryBuilder<Entity>\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder(queryRunner?: QueryRunner): SelectQueryBuilder<any>\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n *\n * @param entityOrRunner\n * @param alias\n * @param queryRunner\n */\n createQueryBuilder<Entity extends ObjectLiteral>(\n entityOrRunner?: EntityTarget<Entity> | QueryRunner,\n alias?: string,\n queryRunner?: QueryRunner,\n ): SelectQueryBuilder<Entity> {\n if (InstanceChecker.isMongoEntityManager(this.manager))\n throw new TypeORMError(`Query Builder is not supported by MongoDB.`)\n\n if (alias) {\n alias = DriverUtils.buildAlias(this.driver, undefined, alias)\n const metadata = this.getMetadata(\n entityOrRunner as EntityTarget<Entity>,\n )\n return new SelectQueryBuilder(this, queryRunner)\n .select(alias)\n .from(metadata.target, alias)\n } else {\n return new SelectQueryBuilder(\n this,\n entityOrRunner as QueryRunner | undefined,\n )\n }\n }\n\n /**\n * Creates a query runner used for perform queries on a single database connection.\n * Using query runners you can control your queries to execute using single database connection and\n * manually control your database transaction.\n *\n * Mode is used in replication mode and indicates whatever you want to connect\n * to master database or any of slave databases.\n * If you perform writes you must use master database,\n * if you perform reads you can use slave databases.\n *\n * @param mode\n */\n createQueryRunner(mode: ReplicationMode = \"master\"): QueryRunner {\n const queryRunner = this.driver.createQueryRunner(mode)\n const manager = this.createEntityManager(queryRunner)\n Object.assign(queryRunner, { manager: manager })\n return queryRunner\n }\n\n /**\n * Gets entity metadata of the junction table (many-to-many table).\n *\n * @param entityTarget\n * @param relationPropertyPath\n */\n getManyToManyMetadata(\n entityTarget: EntityTarget<any>,\n relationPropertyPath: string,\n ) {\n const relationMetadata =\n this.getMetadata(entityTarget).findRelationWithPropertyPath(\n relationPropertyPath,\n )\n if (!relationMetadata)\n throw new TypeORMError(\n `Relation \"${relationPropertyPath}\" was not found in ${entityTarget} entity.`,\n )\n if (!relationMetadata.isManyToMany)\n throw new TypeORMError(\n `Relation \"${entityTarget}#${relationPropertyPath}\" does not have a many-to-many relationship.` +\n `You can use this method only on many-to-many relations.`,\n )\n\n return relationMetadata.junctionEntityMetadata\n }\n\n /**\n * Creates an Entity Manager for the current connection with the help of the EntityManagerFactory.\n *\n * @param queryRunner\n */\n createEntityManager(queryRunner?: QueryRunner): EntityManager {\n return new EntityManagerFactory().create(this, queryRunner)\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Finds exist entity metadata by the given entity class, target name or table name.\n *\n * @param target\n */\n protected findMetadata(\n target: EntityTarget<any>,\n ): EntityMetadata | undefined {\n const metadataFromMap = this.entityMetadatasMap.get(target)\n if (metadataFromMap) return metadataFromMap\n\n for (const [_, metadata] of this.entityMetadatasMap) {\n if (\n InstanceChecker.isEntitySchema(target) &&\n metadata.name === target.options.name\n ) {\n return metadata\n }\n if (typeof target === \"string\") {\n if (target.indexOf(\".\") !== -1) {\n if (metadata.tablePath === target) {\n return metadata\n }\n } else {\n if (\n metadata.name === target ||\n metadata.tableName === target\n ) {\n return metadata\n }\n }\n }\n if (\n ObjectUtils.isObjectWithName(target) &&\n typeof target.name === \"string\"\n ) {\n if (target.name.indexOf(\".\") !== -1) {\n if (metadata.tablePath === target.name) {\n return metadata\n }\n } else {\n if (\n metadata.name === target.name ||\n metadata.tableName === target.name\n ) {\n return metadata\n }\n }\n }\n }\n\n return undefined\n }\n\n /**\n * Builds metadatas for all registered classes inside this connection.\n */\n protected async buildMetadatas(): Promise<void> {\n const connectionMetadataBuilder = new ConnectionMetadataBuilder(this)\n const entityMetadataValidator = new EntityMetadataValidator()\n\n // create subscribers instances if they are not disallowed from high-level (for example they can disallowed from migrations run process)\n const flattenedSubscribers = ObjectUtils.mixedListToArray(\n this.options.subscribers ?? [],\n )\n const subscribers =\n await connectionMetadataBuilder.buildSubscribers(\n flattenedSubscribers,\n )\n ObjectUtils.assign(this, { subscribers: subscribers })\n\n // build entity metadatas\n const flattenedEntities = ObjectUtils.mixedListToArray(\n this.options.entities ?? [],\n )\n const entityMetadatas =\n await connectionMetadataBuilder.buildEntityMetadatas(\n flattenedEntities,\n )\n ObjectUtils.assign(this, {\n entityMetadatas: entityMetadatas,\n entityMetadatasMap: new Map(\n entityMetadatas.map((metadata) => [metadata.target, metadata]),\n ),\n })\n\n // create migration instances\n const flattenedMigrations = ObjectUtils.mixedListToArray(\n this.options.migrations ?? [],\n )\n const migrations =\n await connectionMetadataBuilder.buildMigrations(flattenedMigrations)\n ObjectUtils.assign(this, { migrations: migrations })\n\n // validate all created entity metadatas to make sure user created entities are valid and correct\n entityMetadataValidator.validateMany(\n this.entityMetadatas.filter(\n (metadata) => metadata.tableType !== \"view\",\n ),\n this.driver,\n )\n\n // set current data source to the entities\n for (const entityMetadata of entityMetadatas) {\n if (\n InstanceChecker.isBaseEntityConstructor(entityMetadata.target)\n ) {\n entityMetadata.target.useDataSource(this)\n }\n }\n }\n\n /**\n * Get the replication mode SELECT queries should use for this datasource by default\n */\n defaultReplicationModeForReads(): ReplicationMode {\n if (\n \"replication\" in this.driver.options &&\n this.driver.options.replication\n ) {\n const value = (\n this.driver.options.replication as {\n defaultMode?: ReplicationMode\n }\n ).defaultMode\n if (value) {\n return value\n }\n }\n return \"slave\"\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ForeignKey.js","sourceRoot":"../build/browser/src/","sources":["decorator/ForeignKey.ts"],"names":[],"mappings":";;AAiEA,
|
|
1
|
+
{"version":3,"file":"ForeignKey.js","sourceRoot":"../build/browser/src/","sources":["decorator/ForeignKey.ts"],"names":[],"mappings":";;AAiEA,gCAmDC;AAnHD,wCAAmD;AAEnD,qDAAiD;AAoDjD;;;;;;;;;GASG;AACH,SAAgB,UAAU,CAKtB,oBAA8D,EAC9D,iCACyD,EACzD,8BACkD,EAClD,YAAgC;IAEhC,MAAM,WAAW,GACb,OAAO,iCAAiC,KAAK,QAAQ;QACrD,OAAO,iCAAiC,KAAK,UAAU;QACnD,CAAC,CAAC,iCAAiC;QACnC,CAAC,CAAC,SAAS,CAAA;IAEnB,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,iCAAiC,CAAC;QAChE,CAAC,CAAC,iCAAiC;QACnC,CAAC,CAAC,SAAS,CAAA;IAEf,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,CAAC,8BAA8B,CAAC;QACvE,CAAC,CAAC,8BAA8B;QAChC,CAAC,CAAC,SAAS,CAAA;IAEf,MAAM,OAAO,GACT,yBAAW,CAAC,QAAQ,CAAC,iCAAiC,CAAC;QACvD,CAAC,KAAK,CAAC,OAAO,CAAC,iCAAiC,CAAC;QAC7C,CAAC,CAAC,iCAAiC;QACnC,CAAC,CAAC,yBAAW,CAAC,QAAQ,CAAC,8BAA8B,CAAC;YAClD,CAAC,KAAK,CAAC,OAAO,CAAC,8BAA8B,CAAC;YAChD,CAAC,CAAC,8BAA8B;YAChC,CAAC,CAAC,YAAY,CAAA;IAExB,OAAO,UACH,WAA8B,EAC9B,YAA8B;QAE9B,IAAA,gCAAsB,GAAE,CAAC,WAAW,CAAC,IAAI,CAAC;YACtC,MAAM,EAAE,YAAY;gBAChB,CAAC,CAAC,WAAW,CAAC,WAAW;gBACzB,CAAC,CAAE,WAAwB;YAC/B,YAAY,EAAE,YAAY;YAC1B,IAAI,EAAE,oBAAoB;YAC1B,WAAW;YACX,WAAW;YACX,qBAAqB;YACrB,GAAI,OAA6B;SACV,CAAC,CAAA;IAChC,CAAC,CAAA;AACL,CAAC","sourcesContent":["import type { ObjectType } from \"../common/ObjectType\"\nimport { getMetadataArgsStorage } from \"../globals\"\nimport type { ForeignKeyMetadataArgs } from \"../metadata-args/ForeignKeyMetadataArgs\"\nimport { ObjectUtils } from \"../util/ObjectUtils\"\nimport type { ForeignKeyOptions } from \"./options/ForeignKeyOptions\"\n\n/**\n * Creates a database foreign key. Can be used on entity property or on entity.\n * Can create foreign key with composite columns when used on entity.\n * Warning! Don't use this with relations; relation decorators create foreign keys automatically.\n *\n * @param typeFunctionOrTarget\n * @param options\n */\nexport function ForeignKey<T>(\n typeFunctionOrTarget: string | ((type?: any) => ObjectType<T>),\n options?: ForeignKeyOptions,\n): PropertyDecorator\n\n/**\n * Creates a database foreign key. Can be used on entity property or on entity.\n * Can create foreign key with composite columns when used on entity.\n * Warning! Don't use this with relations; relation decorators create foreign keys automatically.\n *\n * @param typeFunctionOrTarget\n * @param inverseSide\n * @param options\n */\nexport function ForeignKey<T>(\n typeFunctionOrTarget: string | ((type?: any) => ObjectType<T>),\n inverseSide: string | ((object: T) => any),\n options?: ForeignKeyOptions,\n): PropertyDecorator\n\n/**\n * Creates a database foreign key. Can be used on entity property or on entity.\n * Can create foreign key with composite columns when used on entity.\n * Warning! Don't use this with relations; relation decorators create foreign keys automatically.\n *\n * @param typeFunctionOrTarget\n * @param columnNames\n * @param referencedColumnNames\n * @param options\n */\nexport function ForeignKey<\n T,\n C extends (readonly [] | readonly string[]) &\n (number extends C[\"length\"] ? readonly [] : unknown),\n>(\n typeFunctionOrTarget: string | ((type?: any) => ObjectType<T>),\n columnNames: C,\n referencedColumnNames: { [K in keyof C]: string },\n options?: ForeignKeyOptions,\n): ClassDecorator\n\n/**\n * Creates a database foreign key. Can be used on entity property or on entity.\n * Can create foreign key with composite columns when used on entity.\n * Warning! Don't use this with relations; relation decorators create foreign keys automatically.\n *\n * @param typeFunctionOrTarget\n * @param inverseSideOrColumnNamesOrOptions\n * @param referencedColumnNamesOrOptions\n * @param maybeOptions\n */\nexport function ForeignKey<\n T,\n C extends (readonly [] | readonly string[]) &\n (number extends C[\"length\"] ? readonly [] : unknown),\n>(\n typeFunctionOrTarget: string | ((type?: any) => ObjectType<T>),\n inverseSideOrColumnNamesOrOptions?:\n string | ((object: T) => any) | C | ForeignKeyOptions,\n referencedColumnNamesOrOptions?:\n { [K in keyof C]: string } | ForeignKeyOptions,\n maybeOptions?: ForeignKeyOptions,\n): ClassDecorator & PropertyDecorator {\n const inverseSide =\n typeof inverseSideOrColumnNamesOrOptions === \"string\" ||\n typeof inverseSideOrColumnNamesOrOptions === \"function\"\n ? inverseSideOrColumnNamesOrOptions\n : undefined\n\n const columnNames = Array.isArray(inverseSideOrColumnNamesOrOptions)\n ? inverseSideOrColumnNamesOrOptions\n : undefined\n\n const referencedColumnNames = Array.isArray(referencedColumnNamesOrOptions)\n ? referencedColumnNamesOrOptions\n : undefined\n\n const options =\n ObjectUtils.isObject(inverseSideOrColumnNamesOrOptions) &&\n !Array.isArray(inverseSideOrColumnNamesOrOptions)\n ? inverseSideOrColumnNamesOrOptions\n : ObjectUtils.isObject(referencedColumnNamesOrOptions) &&\n !Array.isArray(referencedColumnNamesOrOptions)\n ? referencedColumnNamesOrOptions\n : maybeOptions\n\n return function (\n clsOrObject: Function | Object,\n propertyName?: string | symbol,\n ) {\n getMetadataArgsStorage().foreignKeys.push({\n target: propertyName\n ? clsOrObject.constructor\n : (clsOrObject as Function),\n propertyName: propertyName,\n type: typeFunctionOrTarget,\n inverseSide,\n columnNames,\n referencedColumnNames,\n ...(options as ForeignKeyOptions),\n } as ForeignKeyMetadataArgs)\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimaryGeneratedColumn.js","sourceRoot":"../build/browser/src/","sources":["decorator/columns/PrimaryGeneratedColumn.ts"],"names":[],"mappings":";;AAoEA,
|
|
1
|
+
{"version":3,"file":"PrimaryGeneratedColumn.js","sourceRoot":"../build/browser/src/","sources":["decorator/columns/PrimaryGeneratedColumn.ts"],"names":[],"mappings":";;AAoEA,wDA6DC;AAjID,2CAAsD;AAMtD,wDAAoD;AAsDpD;;;;;;;GAOG;AACH,SAAgB,sBAAsB,CAClC,iBAO2C,EAC3C,YAG2C;IAE3C,uBAAuB;IACvB,MAAM,OAAO,GAAkB,EAAE,CAAA;IACjC,IAAI,QAAqD,CAAA;IACzD,IAAI,iBAAiB,EAAE,CAAC;QACpB,IAAI,OAAO,iBAAiB,KAAK,QAAQ;YACrC,QAAQ,GAAG,iBACoC,CAAA;QAEnD,IAAI,yBAAW,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC;YAC1C,QAAQ,GAAG,WAAW,CAAA;YACtB,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAA;QAC7C,CAAC;IACL,CAAC;SAAM,CAAC;QACJ,QAAQ,GAAG,WAAW,CAAA;IAC1B,CAAC;IACD,IAAI,yBAAW,CAAC,QAAQ,CAAC,YAAY,CAAC;QAAE,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;IAE5E,OAAO,UAAU,MAAc,EAAE,YAAoB;QACjD,sFAAsF;QACtF,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAChB,IAAI,QAAQ,KAAK,WAAW,IAAI,QAAQ,KAAK,UAAU,EAAE,CAAC;gBACtD,OAAO,CAAC,IAAI,GAAG,MAAM,CAAA;YACzB,CAAC;iBAAM,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;gBAC7B,OAAO,CAAC,IAAI,GAAG,MAAM,CAAA;YACzB,CAAC;iBAAM,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;gBAC9B,OAAO,CAAC,IAAI,GAAG,KAAK,CAAA;YACxB,CAAC;QACL,CAAC;QAED,2DAA2D;QAC3D,OAAO,CAAC,OAAO,GAAG,IAAI,CAAA;QAEtB,gCAAgC;QAChC,IAAA,gCAAsB,GAAE,CAAC,OAAO,CAAC,IAAI,CAAC;YAClC,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,OAAO;SACnB,CAAC,CAAA;QAEF,mCAAmC;QACnC,IAAA,gCAAsB,GAAE,CAAC,WAAW,CAAC,IAAI,CAAC;YACtC,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,QAAQ,EAAE,QAAQ;SACI,CAAC,CAAA;IAC/B,CAAC,CAAA;AACL,CAAC","sourcesContent":["import { getMetadataArgsStorage } from \"../../globals\"\nimport type { PrimaryGeneratedColumnNumericOptions } from \"../options/PrimaryGeneratedColumnNumericOptions\"\nimport type { PrimaryGeneratedColumnUUIDOptions } from \"../options/PrimaryGeneratedColumnUUIDOptions\"\nimport type { GeneratedMetadataArgs } from \"../../metadata-args/GeneratedMetadataArgs\"\nimport type { ColumnOptions } from \"../options/ColumnOptions\"\nimport type { PrimaryGeneratedColumnIdentityOptions } from \"../options/PrimaryGeneratedColumnIdentityOptions\"\nimport { ObjectUtils } from \"../../util/ObjectUtils\"\n\n/**\n * Column decorator is used to mark a specific class property as a table column.\n */\nexport function PrimaryGeneratedColumn(): PropertyDecorator\n\n/**\n * Column decorator is used to mark a specific class property as a table column.\n *\n * @param options\n */\nexport function PrimaryGeneratedColumn(\n options: PrimaryGeneratedColumnNumericOptions,\n): PropertyDecorator\n\n/**\n * Column decorator is used to mark a specific class property as a table column.\n *\n * @param strategy\n * @param options\n */\nexport function PrimaryGeneratedColumn(\n strategy: \"increment\",\n options?: PrimaryGeneratedColumnNumericOptions,\n): PropertyDecorator\n\n/**\n * Column decorator is used to mark a specific class property as a table column.\n *\n * @param strategy\n * @param options\n */\nexport function PrimaryGeneratedColumn(\n strategy: \"uuid\",\n options?: PrimaryGeneratedColumnUUIDOptions,\n): PropertyDecorator\n\n/**\n * Column decorator is used to mark a specific class property as a table column.\n *\n * @param strategy\n * @param options\n */\nexport function PrimaryGeneratedColumn(\n strategy: \"rowid\",\n options?: PrimaryGeneratedColumnUUIDOptions,\n): PropertyDecorator\n\nexport function PrimaryGeneratedColumn(\n strategy: \"identity\",\n options?: PrimaryGeneratedColumnIdentityOptions,\n): PropertyDecorator\n\n/**\n * Column decorator is used to mark a specific class property as a table column.\n * Only properties decorated with this decorator will be persisted to the database when entity be saved.\n * This column creates an integer PRIMARY COLUMN with generated set to true.\n *\n * @param strategyOrOptions\n * @param maybeOptions\n */\nexport function PrimaryGeneratedColumn(\n strategyOrOptions?:\n | \"increment\"\n | \"uuid\"\n | \"rowid\"\n | \"identity\"\n | PrimaryGeneratedColumnNumericOptions\n | PrimaryGeneratedColumnUUIDOptions\n | PrimaryGeneratedColumnIdentityOptions,\n maybeOptions?:\n | PrimaryGeneratedColumnNumericOptions\n | PrimaryGeneratedColumnUUIDOptions\n | PrimaryGeneratedColumnIdentityOptions,\n): PropertyDecorator {\n // normalize parameters\n const options: ColumnOptions = {}\n let strategy: \"increment\" | \"uuid\" | \"rowid\" | \"identity\"\n if (strategyOrOptions) {\n if (typeof strategyOrOptions === \"string\")\n strategy = strategyOrOptions as\n \"increment\" | \"uuid\" | \"rowid\" | \"identity\"\n\n if (ObjectUtils.isObject(strategyOrOptions)) {\n strategy = \"increment\"\n Object.assign(options, strategyOrOptions)\n }\n } else {\n strategy = \"increment\"\n }\n if (ObjectUtils.isObject(maybeOptions)) Object.assign(options, maybeOptions)\n\n return function (object: Object, propertyName: string) {\n // if column type is not explicitly set then determine it based on generation strategy\n if (!options.type) {\n if (strategy === \"increment\" || strategy === \"identity\") {\n options.type = Number\n } else if (strategy === \"uuid\") {\n options.type = \"uuid\"\n } else if (strategy === \"rowid\") {\n options.type = \"int\"\n }\n }\n\n // explicitly set a primary and generated to column options\n options.primary = true\n\n // register column metadata args\n getMetadataArgsStorage().columns.push({\n target: object.constructor,\n propertyName: propertyName,\n mode: \"regular\",\n options: options,\n })\n\n // register generated metadata args\n getMetadataArgsStorage().generations.push({\n target: object.constructor,\n propertyName: propertyName,\n strategy: strategy,\n } as GeneratedMetadataArgs)\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelationOptions.js","sourceRoot":"../build/browser/src/","sources":["decorator/options/RelationOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { DeferrableType } from \"../../metadata/types/DeferrableType\"\nimport type { OnDeleteType } from \"../../metadata/types/OnDeleteType\"\nimport type { OnUpdateType } from \"../../metadata/types/OnUpdateType\"\n\n/**\n * Describes all relation's options.\n */\nexport interface RelationOptions {\n /**\n * Sets cascades options for the given relation.\n * If set to true then it means that related object can be allowed to be inserted or updated in the database.\n * You can separately restrict cascades to insertion or updation using following syntax:\n *\n * @example\n * cascade: [\"insert\", \"update\", \"remove\", \"soft-remove\", \"recover\"] // include or exclude one of them\n *\n */\n cascade?:\n
|
|
1
|
+
{"version":3,"file":"RelationOptions.js","sourceRoot":"../build/browser/src/","sources":["decorator/options/RelationOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { DeferrableType } from \"../../metadata/types/DeferrableType\"\nimport type { OnDeleteType } from \"../../metadata/types/OnDeleteType\"\nimport type { OnUpdateType } from \"../../metadata/types/OnUpdateType\"\n\n/**\n * Describes all relation's options.\n */\nexport interface RelationOptions {\n /**\n * Sets cascades options for the given relation.\n * If set to true then it means that related object can be allowed to be inserted or updated in the database.\n * You can separately restrict cascades to insertion or updation using following syntax:\n *\n * @example\n * cascade: [\"insert\", \"update\", \"remove\", \"soft-remove\", \"recover\"] // include or exclude one of them\n *\n */\n cascade?:\n boolean | (\"insert\" | \"update\" | \"remove\" | \"soft-remove\" | \"recover\")[]\n\n /**\n * Indicates if relation column value can be nullable or not.\n */\n nullable?: boolean\n\n /**\n * Database cascade action on delete.\n */\n onDelete?: OnDeleteType\n\n /**\n * Database cascade action on update.\n */\n onUpdate?: OnUpdateType\n\n /**\n * Indicate if foreign key constraints can be deferred.\n */\n deferrable?: DeferrableType\n\n /**\n * Indicates whether foreign key constraints will be created for join columns.\n * Can be used only for many-to-one and owner one-to-one relations.\n * Defaults to true.\n */\n createForeignKeyConstraints?: boolean\n\n /**\n * Set this relation to be lazy. Note: lazy relations are promises. When you call them they return promise\n * which resolve relation result then. If your property's type is Promise then this relation is set to lazy automatically.\n */\n lazy?: boolean\n\n /**\n * Set this relation to be eager.\n * Eager relations are always loaded automatically when relation's owner entity is loaded using find* methods.\n * Only using QueryBuilder prevents loading eager relations.\n * Eager flag cannot be set from both sides of relation - you can eager load only one side of the relationship.\n */\n eager?: boolean\n\n /**\n * Indicates if persistence is enabled for the relation.\n * By default its enabled, but if you want to avoid any changes in the relation to be reflected in the database you can disable it.\n * If its disabled you can only change a relation from inverse side of a relation or using relation query builder functionality.\n * This is useful for performance optimization since its disabling avoid multiple extra queries during entity save.\n */\n persistence?: boolean\n\n /**\n * When a parent is saved (with cascading but) without a child row that still exists in database, this will control what shall happen to them.\n * delete will remove these rows from database.\n * nullify will remove the relation key.\n * disable will keep the relation intact. Removal of related item is only possible through its own repo.\n */\n orphanedRowAction?: \"nullify\" | \"delete\" | \"soft-delete\" | \"disable\"\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeChildren.js","sourceRoot":"../build/browser/src/","sources":["decorator/tree/TreeChildren.ts"],"names":[],"mappings":";;AAWA,
|
|
1
|
+
{"version":3,"file":"TreeChildren.js","sourceRoot":"../build/browser/src/","sources":["decorator/tree/TreeChildren.ts"],"names":[],"mappings":";;AAWA,oCA6BC;AAxCD,2CAAsD;AAItD;;;;;;GAMG;AACH,SAAgB,YAAY,CAAC,OAG5B;IACG,OAAO,UAAU,MAAc,EAAE,YAAoB;QACjD,OAAO,KAAK,EAAqB,CAAA;QAEjC,4CAA4C;QAC5C,MAAM,aAAa,GACf,OAAO,IAAK,OAAe,CAAC,WAAW;YACnC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,aAAa,EAAE,MAAM,EAAE,YAAY,CAAC;YAC1D,CAAC,CAAC,SAAS,CAAA;QACnB,MAAM,MAAM,GACR,CAAC,aAAa;YACV,OAAO,aAAa,CAAC,IAAI,KAAK,QAAQ;YACtC,aAAa,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,SAAS,CAAC;YACnD,KAAK,CAAA;QAET,oCAAoC;QACpC,IAAA,gCAAsB,GAAE,CAAC,SAAS,CAAC,IAAI,CAAC;YACpC,cAAc,EAAE,IAAI;YACpB,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,MAAM,EAAE,MAAM;YACd,YAAY,EAAE,aAAa;YAC3B,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW;YAC9B,OAAO,EAAE,OAAO;SACK,CAAC,CAAA;IAC9B,CAAC,CAAA;AACL,CAAC","sourcesContent":["import { getMetadataArgsStorage } from \"../../globals\"\nimport type { RelationMetadataArgs } from \"../../metadata-args/RelationMetadataArgs\"\nimport type { RelationOptions } from \"../options/RelationOptions\"\n\n/**\n * Marks an entity property as a children of the tree.\n * \"Tree children\" will contain all children (bind) of this entity.\n *\n * @param options\n * @param options.cascade\n */\nexport function TreeChildren(options?: {\n cascade?:\n boolean | (\"insert\" | \"update\" | \"remove\" | \"soft-remove\" | \"recover\")[]\n}): PropertyDecorator {\n return function (object: Object, propertyName: string) {\n options ??= {} as RelationOptions\n\n // now try to determine it its lazy relation\n const reflectedType =\n Reflect && (Reflect as any).getMetadata\n ? Reflect.getMetadata(\"design:type\", object, propertyName)\n : undefined\n const isLazy =\n (reflectedType &&\n typeof reflectedType.name === \"string\" &&\n reflectedType.name.toLowerCase() === \"promise\") ??\n false\n\n // add one-to-many relation for this\n getMetadataArgsStorage().relations.push({\n isTreeChildren: true,\n target: object.constructor,\n propertyName: propertyName,\n isLazy: isLazy,\n relationType: \"one-to-many\",\n type: () => object.constructor,\n options: options,\n } as RelationMetadataArgs)\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CapacitorDataSourceOptions.js","sourceRoot":"../build/browser/src/","sources":["driver/capacitor/CapacitorDataSourceOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\n\n/**\n * Sqlite-specific connection options.\n */\nexport interface CapacitorDataSourceOptions extends BaseDataSourceOptions {\n /**\n * Database type.\n */\n readonly type: \"capacitor\"\n\n /**\n * The capacitor-sqlite instance. For example, `new SQLiteConnection(CapacitorSQLite)`.\n */\n readonly driver: any\n\n /**\n * Database name (capacitor-sqlite will add the suffix `SQLite.db`)\n */\n readonly database: string\n\n /**\n * Set the mode for database encryption\n */\n readonly mode?: \"no-encryption\" | \"encryption\" | \"secret\" | \"newsecret\"\n\n /**\n * Database version\n */\n readonly version?: number\n\n /**\n * The SQLite journal mode (optional)\n */\n readonly journalMode?:\n
|
|
1
|
+
{"version":3,"file":"CapacitorDataSourceOptions.js","sourceRoot":"../build/browser/src/","sources":["driver/capacitor/CapacitorDataSourceOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\n\n/**\n * Sqlite-specific connection options.\n */\nexport interface CapacitorDataSourceOptions extends BaseDataSourceOptions {\n /**\n * Database type.\n */\n readonly type: \"capacitor\"\n\n /**\n * The capacitor-sqlite instance. For example, `new SQLiteConnection(CapacitorSQLite)`.\n */\n readonly driver: any\n\n /**\n * Database name (capacitor-sqlite will add the suffix `SQLite.db`)\n */\n readonly database: string\n\n /**\n * Set the mode for database encryption\n */\n readonly mode?: \"no-encryption\" | \"encryption\" | \"secret\" | \"newsecret\"\n\n /**\n * Database version\n */\n readonly version?: number\n\n /**\n * The SQLite journal mode (optional)\n */\n readonly journalMode?:\n \"DELETE\" | \"TRUNCATE\" | \"PERSIST\" | \"MEMORY\" | \"WAL\" | \"OFF\"\n\n readonly poolSize?: never\n}\n"]}
|
|
@@ -234,6 +234,23 @@ export declare class EntityManager {
|
|
|
234
234
|
*/
|
|
235
235
|
insert<Entity extends ObjectLiteral>(target: EntityTarget<Entity>, entity: QueryDeepPartialEntity<Entity> | QueryDeepPartialEntity<Entity>[]): Promise<InsertResult>;
|
|
236
236
|
upsert<Entity extends ObjectLiteral>(target: EntityTarget<Entity>, entityOrEntities: QueryDeepPartialEntity<Entity> | QueryDeepPartialEntity<Entity>[], conflictPathsOrOptions: string[] | UpsertOptions<Entity>): Promise<InsertResult>;
|
|
237
|
+
/**
|
|
238
|
+
* Shared by update/delete/softDelete/restore. Object criteria is normalized
|
|
239
|
+
* via {@link OrmUtils.normalizeWhereCriteria}, then rejected if it would
|
|
240
|
+
* produce no predicate and therefore render as an always-true `WHERE 1=1` —
|
|
241
|
+
* an empty object or array, an empty OR-branch, a bare primitive inside an
|
|
242
|
+
* OR-array, or a keyless object. Primitive id criteria is returned untouched
|
|
243
|
+
* for `whereInIds` (rejected only when wholly empty).
|
|
244
|
+
*
|
|
245
|
+
* @param criteria the raw criteria passed to the operation
|
|
246
|
+
* @param methodName the calling method, used in the error message
|
|
247
|
+
* @returns the criteria to build with, and whether to execute it via
|
|
248
|
+
* `whereInIds` (primitive) or `where` (object)
|
|
249
|
+
*/
|
|
250
|
+
protected normalizeAndValidateWhereCriteria(criteria: any, methodName: string): {
|
|
251
|
+
criteria: any;
|
|
252
|
+
isPrimitive: boolean;
|
|
253
|
+
};
|
|
237
254
|
/**
|
|
238
255
|
* Updates entity partially. Entity can be found by a given condition(s).
|
|
239
256
|
* Unlike save method executes a primitive operation without cascades, relations and other operations included.
|