@depup/typeorm-extension 4.0.0-depup.0 → 4.2.0-depup.0

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/dist/index.d.mts CHANGED
@@ -2,14 +2,22 @@ import { DataSource, DataSourceOptions, EntityMetadata, EntitySchema, EntityTarg
2
2
  import { CompilerOptions, TypeAcquisition } from "typescript";
3
3
  import { DatabaseType } from "typeorm/driver/types/DatabaseType.js";
4
4
  //#region src/errors/base.d.ts
5
- declare class TypeormExtensionError extends Error {}
5
+ export declare class TypeormExtensionError extends Error {}
6
+ //#endregion
7
+ //#region src/errors/database-lock.d.ts
8
+ export declare class DatabaseLockError extends TypeormExtensionError {
9
+ static timeout(name: string, timeout: number): DatabaseLockError;
10
+ static transactionActive(name: string): DatabaseLockError;
11
+ static transactionLeftOpen(name: string): DatabaseLockError;
12
+ }
6
13
  //#endregion
7
14
  //#region src/errors/driver.d.ts
8
- declare class DriverError extends TypeormExtensionError {
15
+ export declare class DriverError extends TypeormExtensionError {
9
16
  constructor(message?: string);
10
17
  static undeterminable(): DriverError;
11
18
  static notSupported(driverName: string): DriverError;
12
19
  static schemaAlterationNotSupported(driverName: string): DriverError;
20
+ static lockNotSupported(driverName: string): DriverError;
13
21
  static columnConversionExpressionNotSupported(driverName: string): DriverError;
14
22
  static columnGenerationExpressionUnknown(columnName: string): DriverError;
15
23
  static connectionClosed(): DriverError;
@@ -17,7 +25,7 @@ declare class DriverError extends TypeormExtensionError {
17
25
  }
18
26
  //#endregion
19
27
  //#region src/errors/entity-metadata.d.ts
20
- declare class EntityMetadataError extends TypeormExtensionError {
28
+ export declare class EntityMetadataError extends TypeormExtensionError {
21
29
  constructor(message?: string);
22
30
  static notRegistered(name: string): EntityMetadataError;
23
31
  }
@@ -28,7 +36,7 @@ type EntityRelationLookupErrorOptions = {
28
36
  relation: string;
29
37
  columns: string[];
30
38
  };
31
- declare class EntityRelationLookupError extends TypeormExtensionError {
39
+ export declare class EntityRelationLookupError extends TypeormExtensionError {
32
40
  /**
33
41
  * The property name of the relation.
34
42
  */
@@ -43,10 +51,12 @@ declare class EntityRelationLookupError extends TypeormExtensionError {
43
51
  }
44
52
  //#endregion
45
53
  //#region src/errors/options.d.ts
46
- declare class OptionsError extends TypeormExtensionError {
54
+ export declare class OptionsError extends TypeormExtensionError {
47
55
  constructor(message?: string);
48
56
  static undeterminable(): OptionsError;
49
57
  static notFound(): OptionsError;
58
+ static timezoneUnsupported(timezone: unknown): OptionsError;
59
+ static timezoneConflict(detail: string): OptionsError;
50
60
  static databaseNotDefined(): OptionsError;
51
61
  }
52
62
  //#endregion
@@ -54,7 +64,7 @@ declare class OptionsError extends TypeormExtensionError {
54
64
  /**
55
65
  * A single reconciling statement, in the shape typeorm's schema builder emits it.
56
66
  */
57
- type SchemaDriftStatement = {
67
+ export type SchemaDriftStatement = {
58
68
  query: string;
59
69
  parameters?: unknown[];
60
70
  };
@@ -64,7 +74,7 @@ type SchemaDriftStatement = {
64
74
  * The up statements would reconcile the database schema with the entity metadata,
65
75
  * the down statements would revert that reconciliation.
66
76
  */
67
- type SchemaDrift = {
77
+ export type SchemaDrift = {
68
78
  /**
69
79
  * Whether the database schema deviates from the entity metadata.
70
80
  */
@@ -72,7 +82,7 @@ type SchemaDrift = {
72
82
  up: SchemaDriftStatement[];
73
83
  down: SchemaDriftStatement[];
74
84
  };
75
- type SchemaDriftOptions = {
85
+ export type SchemaDriftOptions = {
76
86
  /**
77
87
  * Report no drift if the data source has no migrations registered.
78
88
  *
@@ -86,7 +96,7 @@ type SchemaDriftOptions = {
86
96
  };
87
97
  //#endregion
88
98
  //#region src/errors/schema.d.ts
89
- declare class SchemaDriftError extends TypeormExtensionError {
99
+ export declare class SchemaDriftError extends TypeormExtensionError {
90
100
  /**
91
101
  * The statements which would reconcile the database schema
92
102
  * with the entity metadata.
@@ -106,7 +116,7 @@ declare class SchemaDriftError extends TypeormExtensionError {
106
116
  * exists to make a run resumable, not to swallow a wrong description of the
107
117
  * database.
108
118
  */
109
- declare class SchemaAlterationError extends TypeormExtensionError {
119
+ export declare class SchemaAlterationError extends TypeormExtensionError {
110
120
  static tableNotFound(table: string): SchemaAlterationError;
111
121
  static columnNotFound(table: string, column: string): SchemaAlterationError;
112
122
  static columnMismatch(table: string, column: string): SchemaAlterationError;
@@ -127,7 +137,7 @@ declare class SchemaAlterationError extends TypeormExtensionError {
127
137
  * the connection on demand. close() is terminal: a closed connection cannot
128
138
  * be reopened, and closing a never-opened connection is a no-op.
129
139
  */
130
- interface IDatabaseConnection {
140
+ export interface IDatabaseConnection {
131
141
  open(): Promise<void>;
132
142
  execute(statement: string): Promise<unknown>;
133
143
  close(): Promise<void>;
@@ -140,13 +150,13 @@ interface IDatabaseConnection {
140
150
  * (e.g. the initial database, or a freshly created database). When omitted,
141
151
  * the server side default (maintenance database) is used.
142
152
  */
143
- interface IDatabaseConnectionFactory {
153
+ export interface IDatabaseConnectionFactory {
144
154
  create(database?: string): IDatabaseConnection;
145
155
  }
146
156
  /**
147
157
  * Filesystem effects for file backed databases (better-sqlite3).
148
158
  */
149
- interface IFileSystem {
159
+ export interface IFileSystem {
150
160
  assertDirectoryWritable(path: string): Promise<void>;
151
161
  /**
152
162
  * Whether the file exists and is writable.
@@ -167,7 +177,7 @@ interface IFileSystem {
167
177
  * Dialect neutral connection facts, derived once per operation
168
178
  * from the resolved DataSourceOptions.
169
179
  */
170
- type ConnectionParams = {
180
+ export type ConnectionParams = {
171
181
  database?: string;
172
182
  host?: string;
173
183
  user?: string;
@@ -191,12 +201,12 @@ type ConnectionParams = {
191
201
  template?: string;
192
202
  extra?: Record<string, any>;
193
203
  };
194
- type DatabaseCreateOperation = {
204
+ export type DatabaseCreateOperation = {
195
205
  params: ConnectionParams;
196
206
  ifNotExist: boolean;
197
207
  initialDatabase?: string;
198
208
  };
199
- type DatabaseDropOperation = {
209
+ export type DatabaseDropOperation = {
200
210
  params: ConnectionParams;
201
211
  ifExist: boolean;
202
212
  initialDatabase?: string;
@@ -208,28 +218,28 @@ type DatabaseDropOperation = {
208
218
  * Implementations must stay pure: types, typed errors and pure helpers only —
209
219
  * no native clients, no I/O, no environment state.
210
220
  */
211
- interface IDatabaseDialect {
221
+ export interface IDatabaseDialect {
212
222
  create(operation: DatabaseCreateOperation): Promise<unknown>;
213
223
  drop(operation: DatabaseDropOperation): Promise<unknown>;
214
224
  }
215
- type DatabaseDialectName = 'postgres' | 'cockroachdb' | 'mysql' | 'mssql' | 'oracle' | 'mongodb' | 'better-sqlite3';
225
+ export type DatabaseDialectName = 'postgres' | 'cockroachdb' | 'mysql' | 'mssql' | 'oracle' | 'mongodb' | 'better-sqlite3';
216
226
  /**
217
227
  * Composition overrides for building a dialect —
218
228
  * used by tests and the caller supplied connection escape hatch.
219
229
  * Only the slot a dialect actually consumes has an effect.
220
230
  */
221
- type DatabaseDialectOverrides = {
231
+ export type DatabaseDialectOverrides = {
222
232
  connectionFactory?: IDatabaseConnectionFactory;
223
233
  fs?: IFileSystem;
224
234
  cwd?: string;
225
235
  };
226
- type DatabaseDialectRegistryEntry = {
236
+ export type DatabaseDialectRegistryEntry = {
227
237
  buildParams: (options: DataSourceOptions) => ConnectionParams;
228
238
  buildDialect: (options: DataSourceOptions, params: ConnectionParams, overrides: DatabaseDialectOverrides) => IDatabaseDialect;
229
239
  };
230
240
  //#endregion
231
241
  //#region src/database/core/cockroachdb/module.d.ts
232
- declare class CockroachDBDialect implements IDatabaseDialect {
242
+ export declare class CockroachDBDialect implements IDatabaseDialect {
233
243
  protected connectionFactory: IDatabaseConnectionFactory;
234
244
  constructor(connectionFactory: IDatabaseConnectionFactory);
235
245
  create(operation: DatabaseCreateOperation): Promise<unknown>;
@@ -243,14 +253,14 @@ declare class CockroachDBDialect implements IDatabaseDialect {
243
253
  * The double space after the IF NOT EXISTS clause is preserved
244
254
  * from the previous implementation.
245
255
  */
246
- declare function buildCockroachDBCreateDatabaseQuery(database: string, ifNotExist: boolean): string;
256
+ export declare function buildCockroachDBCreateDatabaseQuery(database: string, ifNotExist: boolean): string;
247
257
  /**
248
258
  * @link https://github.com/typeorm/typeorm/blob/master/src/driver/cockroachdb/CockroachQueryRunner.ts#L356
249
259
  */
250
- declare function buildCockroachDBDropDatabaseQuery(database: string, ifExist: boolean): string;
260
+ export declare function buildCockroachDBDropDatabaseQuery(database: string, ifExist: boolean): string;
251
261
  //#endregion
252
262
  //#region src/database/core/mongodb/module.d.ts
253
- declare class MongoDBDialect implements IDatabaseDialect {
263
+ export declare class MongoDBDialect implements IDatabaseDialect {
254
264
  protected connectionFactory: IDatabaseConnectionFactory;
255
265
  constructor(connectionFactory: IDatabaseConnectionFactory);
256
266
  /**
@@ -267,13 +277,13 @@ declare class MongoDBDialect implements IDatabaseDialect {
267
277
  *
268
278
  * @link https://www.mongodb.com/docs/manual/reference/command/dropDatabase/
269
279
  */
270
- declare function buildMongoDBDropDatabaseCommand(): string;
280
+ export declare function buildMongoDBDropDatabaseCommand(): string;
271
281
  //#endregion
272
282
  //#region src/database/core/mongodb/uri.d.ts
273
- declare function buildMongoDBConnectionUri(params: ConnectionParams, database?: string): string;
283
+ export declare function buildMongoDBConnectionUri(params: ConnectionParams, database?: string): string;
274
284
  //#endregion
275
285
  //#region src/database/core/mssql/module.d.ts
276
- declare class MsSQLDialect implements IDatabaseDialect {
286
+ export declare class MsSQLDialect implements IDatabaseDialect {
277
287
  protected connectionFactory: IDatabaseConnectionFactory;
278
288
  constructor(connectionFactory: IDatabaseConnectionFactory);
279
289
  create(operation: DatabaseCreateOperation): Promise<unknown>;
@@ -288,17 +298,17 @@ declare class MsSQLDialect implements IDatabaseDialect {
288
298
  * which is not valid T-SQL (SQL Server uses `COLLATE <collation_name>`).
289
299
  * The clause was removed; a proper collation option is future work.
290
300
  */
291
- declare function buildMsSQLCreateDatabaseQuery(params: ConnectionParams, ifNotExist: boolean): string;
301
+ export declare function buildMsSQLCreateDatabaseQuery(params: ConnectionParams, ifNotExist: boolean): string;
292
302
  /**
293
303
  * @link https://github.com/typeorm/typeorm/blob/master/src/driver/sqlserver/SqlServerQueryRunner.ts#L425
294
304
  */
295
- declare function buildMsSQLDropDatabaseQuery(database: string, ifExist: boolean): string;
305
+ export declare function buildMsSQLDropDatabaseQuery(database: string, ifExist: boolean): string;
296
306
  //#endregion
297
307
  //#region src/database/core/mysql/module.d.ts
298
308
  /**
299
309
  * Serves mysql AND mariadb.
300
310
  */
301
- declare class MySQLDialect implements IDatabaseDialect {
311
+ export declare class MySQLDialect implements IDatabaseDialect {
302
312
  protected connectionFactory: IDatabaseConnectionFactory;
303
313
  constructor(connectionFactory: IDatabaseConnectionFactory);
304
314
  create(operation: DatabaseCreateOperation): Promise<unknown>;
@@ -306,25 +316,25 @@ declare class MySQLDialect implements IDatabaseDialect {
306
316
  }
307
317
  //#endregion
308
318
  //#region src/database/core/mysql/statements.d.ts
309
- declare const MYSQL_FOREIGN_KEY_CHECKS_OFF = "SET FOREIGN_KEY_CHECKS=0;";
310
- declare const MYSQL_FOREIGN_KEY_CHECKS_ON = "SET FOREIGN_KEY_CHECKS=1;";
311
- declare const MYSQL_FOREIGN_KEY_CHECKS_SELECT = "SELECT @@SESSION.foreign_key_checks AS `value`;";
319
+ export declare const MYSQL_FOREIGN_KEY_CHECKS_OFF = "SET FOREIGN_KEY_CHECKS=0;";
320
+ export declare const MYSQL_FOREIGN_KEY_CHECKS_ON = "SET FOREIGN_KEY_CHECKS=1;";
321
+ export declare const MYSQL_FOREIGN_KEY_CHECKS_SELECT = "SELECT @@SESSION.foreign_key_checks AS `value`;";
312
322
  /**
313
323
  * Infer the CHARACTER SET from a collation (charset) when it is not
314
324
  * explicitly configured, e.g. utf8mb4_general_ci -> utf8mb4.
315
325
  */
316
- declare function deriveMySQLCharacterSet(charset: string, characterSet?: string): string | undefined;
326
+ export declare function deriveMySQLCharacterSet(charset: string, characterSet?: string): string | undefined;
317
327
  /**
318
328
  * @link https://github.com/typeorm/typeorm/blob/master/src/driver/mysql/MysqlQueryRunner.ts#L297
319
329
  */
320
- declare function buildMySQLCreateDatabaseQuery(params: ConnectionParams, ifNotExist: boolean): string;
330
+ export declare function buildMySQLCreateDatabaseQuery(params: ConnectionParams, ifNotExist: boolean): string;
321
331
  /**
322
332
  * @link https://github.com/typeorm/typeorm/blob/master/src/driver/mysql/MysqlQueryRunner.ts#L306
323
333
  */
324
- declare function buildMySQLDropDatabaseQuery(database: string, ifExist: boolean): string;
334
+ export declare function buildMySQLDropDatabaseQuery(database: string, ifExist: boolean): string;
325
335
  //#endregion
326
336
  //#region src/database/core/oracle/module.d.ts
327
- declare class OracleDialect implements IDatabaseDialect {
337
+ export declare class OracleDialect implements IDatabaseDialect {
328
338
  protected connectionFactory: IDatabaseConnectionFactory;
329
339
  constructor(connectionFactory: IDatabaseConnectionFactory);
330
340
  create(operation: DatabaseCreateOperation): Promise<unknown>;
@@ -339,7 +349,7 @@ declare class OracleDialect implements IDatabaseDialect {
339
349
  /**
340
350
  * Assemble the TNS connect descriptor when none is configured.
341
351
  */
342
- declare function buildOracleConnectString(params: ConnectionParams): string;
352
+ export declare function buildOracleConnectString(params: ConnectionParams): string;
343
353
  /**
344
354
  * @link https://github.com/typeorm/typeorm/blob/master/src/driver/oracle/OracleQueryRunner.ts#L295
345
355
  *
@@ -347,13 +357,13 @@ declare function buildOracleConnectString(params: ConnectionParams): string;
347
357
  * byte-for-byte from the previous implementation for fidelity — changing
348
358
  * it is a semantic decision, not a refactor side effect.
349
359
  */
350
- declare function buildOracleCreateDatabaseQuery(database: string): string;
360
+ export declare function buildOracleCreateDatabaseQuery(database: string): string;
351
361
  //#endregion
352
362
  //#region src/database/core/params.d.ts
353
- declare function buildConnectionParams(options: DataSourceOptions): ConnectionParams;
363
+ export declare function buildConnectionParams(options: DataSourceOptions): ConnectionParams;
354
364
  //#endregion
355
365
  //#region src/database/core/postgres/module.d.ts
356
- declare class PostgresDialect implements IDatabaseDialect {
366
+ export declare class PostgresDialect implements IDatabaseDialect {
357
367
  protected connectionFactory: IDatabaseConnectionFactory;
358
368
  constructor(connectionFactory: IDatabaseConnectionFactory);
359
369
  create(operation: DatabaseCreateOperation): Promise<unknown>;
@@ -361,16 +371,16 @@ declare class PostgresDialect implements IDatabaseDialect {
361
371
  }
362
372
  //#endregion
363
373
  //#region src/database/core/postgres/statements.d.ts
364
- declare function buildPostgresDatabaseExistsQuery(database: string): string;
374
+ export declare function buildPostgresDatabaseExistsQuery(database: string): string;
365
375
  /**
366
376
  * @link https://github.com/typeorm/typeorm/blob/master/src/driver/postgres/PostgresQueryRunner.ts#L326
367
377
  */
368
- declare function buildPostgresCreateDatabaseQuery(params: ConnectionParams): string;
369
- declare function buildPostgresCreateSchemaQuery(schema: string): string;
378
+ export declare function buildPostgresCreateDatabaseQuery(params: ConnectionParams): string;
379
+ export declare function buildPostgresCreateSchemaQuery(schema: string): string;
370
380
  /**
371
381
  * @link https://github.com/typeorm/typeorm/blob/master/src/driver/postgres/PostgresQueryRunner.ts#L343
372
382
  */
373
- declare function buildPostgresDropDatabaseQuery(database: string, ifExist: boolean): string;
383
+ export declare function buildPostgresDropDatabaseQuery(database: string, ifExist: boolean): string;
374
384
  //#endregion
375
385
  //#region src/database/core/sqlite/module.d.ts
376
386
  /**
@@ -379,7 +389,7 @@ declare function buildPostgresDropDatabaseQuery(database: string, ifExist: boole
379
389
  * create produces the file (or fails when it exists, unless ifNotExist),
380
390
  * drop removes it (or fails when it is missing, unless ifExist).
381
391
  */
382
- declare class SQLiteDialect implements IDatabaseDialect {
392
+ export declare class SQLiteDialect implements IDatabaseDialect {
383
393
  protected fs: IFileSystem;
384
394
  protected cwd: string;
385
395
  constructor(fs: IFileSystem, cwd: string);
@@ -388,14 +398,14 @@ declare class SQLiteDialect implements IDatabaseDialect {
388
398
  }
389
399
  //#endregion
390
400
  //#region src/database/core/sqlite/path.d.ts
391
- declare function resolveSQLiteDatabasePath(database: string, cwd: string): string;
392
- declare function resolveSQLiteDatabaseDirectory(database: string, cwd: string): string;
401
+ export declare function resolveSQLiteDatabasePath(database: string, cwd: string): string;
402
+ export declare function resolveSQLiteDatabaseDirectory(database: string, cwd: string): string;
393
403
  //#endregion
394
404
  //#region src/database/core/utils.d.ts
395
- declare function hasResultRows(input: unknown): boolean;
405
+ export declare function hasResultRows(input: unknown): boolean;
396
406
  //#endregion
397
407
  //#region src/database/methods/check/types.d.ts
398
- type DatabaseCheckContext = {
408
+ export type DatabaseCheckContext = {
399
409
  /**
400
410
  * Options for finding the typeorm DataSource.
401
411
  *
@@ -423,7 +433,7 @@ type DatabaseCheckContext = {
423
433
  */
424
434
  dataSource?: DataSource;
425
435
  };
426
- type DatabaseCheckResult = {
436
+ export type DatabaseCheckResult = {
427
437
  /**
428
438
  * Indicates whether the database
429
439
  * has already been created or not.
@@ -452,11 +462,11 @@ type DatabaseCheckResult = {
452
462
  *
453
463
  * @param context
454
464
  */
455
- declare function checkDatabase(context?: DatabaseCheckContext): Promise<DatabaseCheckResult>;
465
+ export declare function checkDatabase(context?: DatabaseCheckContext): Promise<DatabaseCheckResult>;
456
466
  //#endregion
457
467
  //#region src/utils/tsconfig/type.d.ts
458
- type StripEnums<T extends Record<string, any>> = { [K in keyof T]: T[K] extends boolean ? T[K] : T[K] extends string ? T[K] : T[K] extends object ? T[K] : T[K] extends Array<any> ? T[K] : T[K] extends undefined ? undefined : any; };
459
- interface TSConfig {
468
+ export type StripEnums<T extends Record<string, any>> = { [K in keyof T]: T[K] extends boolean ? T[K] : T[K] extends string ? T[K] : T[K] extends object ? T[K] : T[K] extends Array<any> ? T[K] : T[K] extends undefined ? undefined : any; };
469
+ export interface TSConfig {
460
470
  compilerOptions?: StripEnums<CompilerOptions>;
461
471
  exclude?: string[];
462
472
  compileOnSave?: boolean;
@@ -467,10 +477,10 @@ interface TSConfig {
467
477
  }
468
478
  //#endregion
469
479
  //#region src/utils/tsconfig/module.d.ts
470
- declare function readTSConfig(input?: string): Promise<TSConfig>;
480
+ export declare function readTSConfig(input?: string): Promise<TSConfig>;
471
481
  //#endregion
472
482
  //#region src/data-source/find/type.d.ts
473
- type DataSourceFindOptions = {
483
+ export type DataSourceFindOptions = {
474
484
  /**
475
485
  * Directory where to look for DataSource files.
476
486
  */
@@ -493,10 +503,10 @@ type DataSourceFindOptions = {
493
503
  };
494
504
  //#endregion
495
505
  //#region src/data-source/find/module.d.ts
496
- declare function findDataSource(context?: DataSourceFindOptions): Promise<DataSource | undefined>;
506
+ export declare function findDataSource(context?: DataSourceFindOptions): Promise<DataSource | undefined>;
497
507
  //#endregion
498
508
  //#region src/data-source/options/type.d.ts
499
- type DataSourceOptionsBuildContext = {
509
+ export type DataSourceOptionsBuildContext = {
500
510
  /**
501
511
  * Data source file name without extension
502
512
  *
@@ -528,32 +538,62 @@ type DataSourceOptionsBuildContext = {
528
538
  *
529
539
  * @param context
530
540
  */
531
- declare function buildDataSourceOptions(context?: DataSourceOptionsBuildContext): Promise<DataSourceOptions>;
541
+ export declare function buildDataSourceOptions(context?: DataSourceOptionsBuildContext): Promise<DataSourceOptions>;
532
542
  //#endregion
533
543
  //#region src/data-source/options/singleton.d.ts
534
- declare function setDataSourceOptions(options: DataSourceOptions, alias?: string): void;
535
- declare function hasDataSourceOptions(alias?: string): boolean;
536
- declare function useDataSourceOptions(alias?: string): Promise<DataSourceOptions>;
544
+ export declare function setDataSourceOptions(options: DataSourceOptions, alias?: string): void;
545
+ export declare function hasDataSourceOptions(alias?: string): boolean;
546
+ export declare function useDataSourceOptions(alias?: string): Promise<DataSourceOptions>;
547
+ //#endregion
548
+ //#region src/data-source/options/timezone/type.d.ts
549
+ /**
550
+ * The timezones a data source can be pinned to. Only UTC can be expressed
551
+ * on every side: a zone-less value can be read as UTC by appending a marker,
552
+ * while any other zone needs the offset in force at that instant.
553
+ */
554
+ type DataSourceTimezone = 'UTC';
555
+ //#endregion
556
+ //#region src/data-source/options/timezone/module.d.ts
557
+ /**
558
+ * Pin a data source to a timezone (only UTC) on EVERY side of a zone-less
559
+ * date column: the database session that stamps it (`now()`,
560
+ * `CURRENT_TIMESTAMP`), and the driver that reads it and serializes Date
561
+ * parameters into it. Left alone, the database stamps in its own session
562
+ * zone while the driver reads and writes in the zone of the Node process,
563
+ * which agree only while both clocks do.
564
+ *
565
+ * Each driver lives in its own file (`postgres.ts`, `mysql.ts`, `oracle.ts`);
566
+ * every other driver needs nothing and is returned unchanged. A setting the
567
+ * caller already made is kept when it agrees with the pin (a UTC `timezone`,
568
+ * a UTC `TimeZone`) or can be built upon (a pg `Client`, pg `types` leaving
569
+ * timestamps alone, an oracle `sessionCallback` function), and throws an
570
+ * `OptionsError` when it contradicts it: half a pin shifts values instead of
571
+ * fixing them. Applying it twice returns the pinned options unchanged.
572
+ *
573
+ * Only values written from then on are affected: rows a database stamped in
574
+ * another zone before keep that wall clock.
575
+ */
576
+ export declare function pinTimezone<T extends DataSourceOptions>(options: T, timezone: DataSourceTimezone): T;
537
577
  //#endregion
538
578
  //#region src/data-source/options/utils/env.d.ts
539
- declare function hasEnvDataSourceOptions(): boolean;
540
- declare function readDataSourceOptionsFromEnv(): DataSourceOptions | undefined;
541
- declare function mergeDataSourceOptionsWithEnv(options: DataSourceOptions): DataSourceOptions;
579
+ export declare function hasEnvDataSourceOptions(): boolean;
580
+ export declare function readDataSourceOptionsFromEnv(): DataSourceOptions | undefined;
581
+ export declare function mergeDataSourceOptionsWithEnv(options: DataSourceOptions): DataSourceOptions;
542
582
  //#endregion
543
583
  //#region src/data-source/options/utils/merge.d.ts
544
- declare function mergeDataSourceOptions(target: DataSourceOptions, source: DataSourceOptions): DataSourceOptions;
584
+ export declare function mergeDataSourceOptions(target: DataSourceOptions, source: DataSourceOptions): DataSourceOptions;
545
585
  //#endregion
546
586
  //#region src/data-source/singleton.d.ts
547
- declare function setDataSource(dataSource: DataSource, alias?: string): void;
548
- declare function hasDataSource(alias?: string): boolean;
549
- declare function unsetDataSource(alias?: string): void;
550
- declare function useDataSource(alias?: string): Promise<DataSource>;
587
+ export declare function setDataSource(dataSource: DataSource, alias?: string): void;
588
+ export declare function hasDataSource(alias?: string): boolean;
589
+ export declare function unsetDataSource(alias?: string): void;
590
+ export declare function useDataSource(alias?: string): Promise<DataSource>;
551
591
  //#endregion
552
592
  //#region src/data-source/type.d.ts
553
- type DataSourceCacheOption = DataSourceOptions['cache'];
593
+ export type DataSourceCacheOption = DataSourceOptions['cache'];
554
594
  //#endregion
555
595
  //#region src/database/methods/type.d.ts
556
- type DatabaseBaseContext = {
596
+ export type DatabaseBaseContext = {
557
597
  /**
558
598
  * Options for finding the typeorm DataSource.
559
599
  */
@@ -577,8 +617,8 @@ type DatabaseBaseContext = {
577
617
  */
578
618
  connection?: Pick<IDatabaseConnection, 'execute'>;
579
619
  };
580
- type DatabaseBaseContextInput = Partial<DatabaseBaseContext>;
581
- type DatabaseCreateContext = Omit<DatabaseBaseContext, 'findOptions'> & {
620
+ export type DatabaseBaseContextInput = Partial<DatabaseBaseContext>;
621
+ export type DatabaseCreateContext = Omit<DatabaseBaseContext, 'findOptions'> & {
582
622
  /**
583
623
  * Only create database if not already exist.
584
624
  *
@@ -592,8 +632,8 @@ type DatabaseCreateContext = Omit<DatabaseBaseContext, 'findOptions'> & {
592
632
  */
593
633
  synchronize: boolean;
594
634
  };
595
- type DatabaseCreateContextInput = Partial<DatabaseCreateContext>;
596
- type DatabaseDropContext = Omit<DatabaseBaseContext, 'findOptions'> & {
635
+ export type DatabaseCreateContextInput = Partial<DatabaseCreateContext> & Pick<DatabaseBaseContext, 'findOptions'>;
636
+ export type DatabaseDropContext = Omit<DatabaseBaseContext, 'findOptions'> & {
597
637
  /**
598
638
  * Only drop database if existed.
599
639
  *
@@ -601,7 +641,7 @@ type DatabaseDropContext = Omit<DatabaseBaseContext, 'findOptions'> & {
601
641
  */
602
642
  ifExist?: boolean;
603
643
  };
604
- type DatabaseDropContextInput = Partial<DatabaseDropContext>;
644
+ export type DatabaseDropContextInput = Partial<DatabaseDropContext> & Pick<DatabaseBaseContext, 'findOptions'>;
605
645
  //#endregion
606
646
  //#region src/database/methods/create/module.d.ts
607
647
  /**
@@ -612,7 +652,7 @@ type DatabaseDropContextInput = Partial<DatabaseDropContext>;
612
652
  *
613
653
  * @param input
614
654
  */
615
- declare function createDatabase(input?: DatabaseCreateContextInput): Promise<unknown>;
655
+ export declare function createDatabase(input?: DatabaseCreateContextInput): Promise<unknown>;
616
656
  //#endregion
617
657
  //#region src/database/methods/drop/module.d.ts
618
658
  /**
@@ -623,77 +663,112 @@ declare function createDatabase(input?: DatabaseCreateContextInput): Promise<unk
623
663
  *
624
664
  * @param input
625
665
  */
626
- declare function dropDatabase(input?: DatabaseDropContextInput): Promise<unknown>;
666
+ export declare function dropDatabase(input?: DatabaseDropContextInput): Promise<unknown>;
627
667
  //#endregion
628
668
  //#region src/database/driver/cockroachdb.d.ts
629
669
  /**
630
670
  * @deprecated Use createDatabase() instead — dialect dispatch is automatic.
631
671
  */
632
- declare function createCockroachDBDatabase(input?: DatabaseCreateContextInput): Promise<unknown>;
672
+ export declare function createCockroachDBDatabase(input?: DatabaseCreateContextInput): Promise<unknown>;
633
673
  /**
634
674
  * @deprecated Use dropDatabase() instead — dialect dispatch is automatic.
635
675
  */
636
- declare function dropCockroachDBDatabase(input?: DatabaseDropContextInput): Promise<unknown>;
676
+ export declare function dropCockroachDBDatabase(input?: DatabaseDropContextInput): Promise<unknown>;
637
677
  //#endregion
638
678
  //#region src/database/driver/mongodb.d.ts
639
679
  /**
640
680
  * @deprecated Use createDatabase() instead — dialect dispatch is automatic.
641
681
  */
642
- declare function createMongoDBDatabase(input?: DatabaseCreateContextInput): Promise<unknown>;
682
+ export declare function createMongoDBDatabase(input?: DatabaseCreateContextInput): Promise<unknown>;
643
683
  /**
644
684
  * @deprecated Use dropDatabase() instead — dialect dispatch is automatic.
645
685
  */
646
- declare function dropMongoDBDatabase(input?: DatabaseDropContextInput): Promise<unknown>;
686
+ export declare function dropMongoDBDatabase(input?: DatabaseDropContextInput): Promise<unknown>;
647
687
  //#endregion
648
688
  //#region src/database/driver/mssql.d.ts
649
689
  /**
650
690
  * @deprecated Use createDatabase() instead — dialect dispatch is automatic.
651
691
  */
652
- declare function createMsSQLDatabase(input?: DatabaseCreateContextInput): Promise<unknown>;
692
+ export declare function createMsSQLDatabase(input?: DatabaseCreateContextInput): Promise<unknown>;
653
693
  /**
654
694
  * @deprecated Use dropDatabase() instead — dialect dispatch is automatic.
655
695
  */
656
- declare function dropMsSQLDatabase(input?: DatabaseDropContextInput): Promise<unknown>;
696
+ export declare function dropMsSQLDatabase(input?: DatabaseDropContextInput): Promise<unknown>;
657
697
  //#endregion
658
698
  //#region src/database/driver/mysql.d.ts
659
699
  /**
660
700
  * @deprecated Use createDatabase() instead — dialect dispatch is automatic.
661
701
  */
662
- declare function createMySQLDatabase(input?: DatabaseCreateContextInput): Promise<unknown>;
702
+ export declare function createMySQLDatabase(input?: DatabaseCreateContextInput): Promise<unknown>;
663
703
  /**
664
704
  * @deprecated Use dropDatabase() instead — dialect dispatch is automatic.
665
705
  */
666
- declare function dropMySQLDatabase(input?: DatabaseDropContextInput): Promise<unknown>;
706
+ export declare function dropMySQLDatabase(input?: DatabaseDropContextInput): Promise<unknown>;
667
707
  //#endregion
668
708
  //#region src/database/driver/oracle.d.ts
669
709
  /**
670
710
  * @deprecated Use createDatabase() instead — dialect dispatch is automatic.
671
711
  */
672
- declare function createOracleDatabase(input?: DatabaseCreateContextInput): Promise<unknown>;
712
+ export declare function createOracleDatabase(input?: DatabaseCreateContextInput): Promise<unknown>;
673
713
  /**
674
714
  * @deprecated Use dropDatabase() instead — dialect dispatch is automatic.
675
715
  */
676
- declare function dropOracleDatabase(input?: DatabaseDropContextInput): Promise<unknown>;
716
+ export declare function dropOracleDatabase(input?: DatabaseDropContextInput): Promise<unknown>;
677
717
  //#endregion
678
718
  //#region src/database/driver/postgres.d.ts
679
719
  /**
680
720
  * @deprecated Use createDatabase() instead — dialect dispatch is automatic.
681
721
  */
682
- declare function createPostgresDatabase(input?: DatabaseCreateContextInput): Promise<unknown>;
722
+ export declare function createPostgresDatabase(input?: DatabaseCreateContextInput): Promise<unknown>;
683
723
  /**
684
724
  * @deprecated Use dropDatabase() instead — dialect dispatch is automatic.
685
725
  */
686
- declare function dropPostgresDatabase(input?: DatabaseDropContextInput): Promise<unknown>;
726
+ export declare function dropPostgresDatabase(input?: DatabaseDropContextInput): Promise<unknown>;
687
727
  //#endregion
688
728
  //#region src/database/driver/sqlite.d.ts
689
729
  /**
690
730
  * @deprecated Use createDatabase() instead — dialect dispatch is automatic.
691
731
  */
692
- declare function createSQLiteDatabase(input?: DatabaseCreateContextInput): Promise<unknown>;
732
+ export declare function createSQLiteDatabase(input?: DatabaseCreateContextInput): Promise<unknown>;
693
733
  /**
694
734
  * @deprecated Use dropDatabase() instead — dialect dispatch is automatic.
695
735
  */
696
- declare function dropSQLiteDatabase(input?: DatabaseDropContextInput): Promise<unknown>;
736
+ export declare function dropSQLiteDatabase(input?: DatabaseDropContextInput): Promise<unknown>;
737
+ //#endregion
738
+ //#region src/database/lock/type.d.ts
739
+ type DatabaseLockOptions = {
740
+ /**
741
+ * How long to wait for the lock, in milliseconds.
742
+ * 0 tries once, unset waits until the lock is free.
743
+ */
744
+ timeout?: number;
745
+ /**
746
+ * Throw a DriverError on a driver which has no lock. Set to false to run
747
+ * the callback without a lock there instead (e.g. sqlite in tests).
748
+ *
749
+ * default: true
750
+ */
751
+ strict?: boolean;
752
+ };
753
+ //#endregion
754
+ //#region src/database/lock/module.d.ts
755
+ /**
756
+ * Run a callback while holding a named advisory lock, so that only one
757
+ * session at a time (across processes) runs it. The lock is released
758
+ * afterwards, also when the callback throws. A transaction the callback
759
+ * leaves open on the query runner is rolled back first.
760
+ *
761
+ * The lock is session scoped: the query runner must stay on one connection
762
+ * for the whole call, which a typeorm QueryRunner does until it is released.
763
+ * Nested calls with the same name on the same query runner do not block.
764
+ *
765
+ * Supported for postgres, mysql and mariadb.
766
+ *
767
+ * @throws DriverError on any other driver, unless `strict` is false.
768
+ * @throws DatabaseLockError if the lock can not be acquired within `timeout`,
769
+ * the query runner is in a transaction, or the callback left one open.
770
+ */
771
+ export declare function withDatabaseLock<T>(queryRunner: QueryRunner, name: string, fn: () => Promise<T>, options?: DatabaseLockOptions): Promise<T>;
697
772
  //#endregion
698
773
  //#region src/database/schema/alter/checks.d.ts
699
774
  /**
@@ -705,7 +780,7 @@ declare function dropSQLiteDatabase(input?: DatabaseDropContextInput): Promise<u
705
780
  * re-validated — the check only buys a full table scan, plus a failure mode for
706
781
  * rows some past import inserted with the checks off.
707
782
  */
708
- declare function withForeignKeyChecksDisabled<T>(queryRunner: QueryRunner, fn: () => Promise<T>): Promise<T>;
783
+ export declare function withForeignKeyChecksDisabled<T>(queryRunner: QueryRunner, fn: () => Promise<T>): Promise<T>;
709
784
  //#endregion
710
785
  //#region src/database/schema/alter/type.d.ts
711
786
  /**
@@ -833,7 +908,7 @@ type SchemaChangeColumnTypeInput = SchemaStrictInput & {
833
908
  * @throws SchemaAlterationError if the column matches neither description and
834
909
  * `strict`.
835
910
  */
836
- declare function changeColumnType(queryRunner: QueryRunner, input: SchemaChangeColumnTypeInput): Promise<boolean>;
911
+ export declare function changeColumnType(queryRunner: QueryRunner, input: SchemaChangeColumnTypeInput): Promise<boolean>;
837
912
  //#endregion
838
913
  //#region src/database/schema/alter/foreign-keys.d.ts
839
914
  /**
@@ -856,7 +931,7 @@ declare function changeColumnType(queryRunner: QueryRunner, input: SchemaChangeC
856
931
  * @throws SchemaAlterationError if neither name exists (and no `meta` describes
857
932
  * the constraint) and `strict`.
858
933
  */
859
- declare function renameForeignKey(queryRunner: QueryRunner, input: SchemaRenameForeignKeyInput): Promise<boolean>;
934
+ export declare function renameForeignKey(queryRunner: QueryRunner, input: SchemaRenameForeignKeyInput): Promise<boolean>;
860
935
  //#endregion
861
936
  //#region src/database/schema/alter/indices.d.ts
862
937
  /**
@@ -878,7 +953,7 @@ declare function renameForeignKey(queryRunner: QueryRunner, input: SchemaRenameF
878
953
  * @throws DriverError for a driver which can not express the rename.
879
954
  * @throws SchemaAlterationError if neither name exists and `strict`.
880
955
  */
881
- declare function renameIndex(queryRunner: QueryRunner, input: SchemaRenameIndexInput): Promise<boolean>;
956
+ export declare function renameIndex(queryRunner: QueryRunner, input: SchemaRenameIndexInput): Promise<boolean>;
882
957
  //#endregion
883
958
  //#region src/database/schema/drift/module.d.ts
884
959
  /**
@@ -902,28 +977,28 @@ declare function renameIndex(queryRunner: QueryRunner, input: SchemaRenameIndexI
902
977
  * enabled is left untouched and inspected through an own instance — otherwise
903
978
  * initializing it would mutate (or drop) the very schema being inspected.
904
979
  */
905
- declare function getSchemaDrift(input: DataSource | DataSourceOptions, options?: SchemaDriftOptions): Promise<SchemaDrift>;
980
+ export declare function getSchemaDrift(input: DataSource | DataSourceOptions, options?: SchemaDriftOptions): Promise<SchemaDrift>;
906
981
  /**
907
982
  * Throw if the database schema deviates from the entity metadata.
908
983
  *
909
984
  * @throws SchemaDriftError
910
985
  */
911
- declare function assertSchemaMatchesMetadata(input: DataSource | DataSourceOptions, options?: SchemaDriftOptions): Promise<void>;
986
+ export declare function assertSchemaMatchesMetadata(input: DataSource | DataSourceOptions, options?: SchemaDriftOptions): Promise<void>;
912
987
  //#endregion
913
988
  //#region src/database/schema/synchronize.d.ts
914
- declare function synchronizeDatabaseSchema(input: DataSource | DataSourceOptions): Promise<Migration[]>;
989
+ export declare function synchronizeDatabaseSchema(input: DataSource | DataSourceOptions): Promise<Migration[]>;
915
990
  //#endregion
916
991
  //#region src/database/utils/context.d.ts
917
- declare function buildDatabaseCreateContext(input?: DatabaseCreateContextInput): Promise<DatabaseCreateContext>;
918
- declare function buildDatabaseDropContext(input?: DatabaseDropContextInput): Promise<DatabaseDropContext>;
992
+ export declare function buildDatabaseCreateContext(input?: DatabaseCreateContextInput): Promise<DatabaseCreateContext>;
993
+ export declare function buildDatabaseDropContext(input?: DatabaseDropContextInput): Promise<DatabaseDropContext>;
919
994
  //#endregion
920
995
  //#region src/database/utils/type.d.ts
921
- type MigrationGenerateResult = {
996
+ export type MigrationGenerateResult = {
922
997
  up: string[];
923
998
  down: string[];
924
999
  content?: string;
925
1000
  };
926
- type MigrationGenerateCommandContext = {
1001
+ export type MigrationGenerateCommandContext = {
927
1002
  /**
928
1003
  * Directory where the migration(s) should be stored.
929
1004
  */
@@ -944,6 +1019,19 @@ type MigrationGenerateCommandContext = {
944
1019
  * Prettify sql statements.
945
1020
  */
946
1021
  prettify?: boolean;
1022
+ /**
1023
+ * Language of the generated migration file. It also determines the file extension.
1024
+ *
1025
+ * @default 'ts'
1026
+ */
1027
+ language?: 'ts' | 'js';
1028
+ /**
1029
+ * Generate an ESM (export class) instead of a CommonJS (module.exports) migration.
1030
+ * Only applies to the language js.
1031
+ *
1032
+ * @default false
1033
+ */
1034
+ esm?: boolean;
947
1035
  /**
948
1036
  * Only return up- & down-statements instead of backing up the migration to the file system.
949
1037
  */
@@ -951,18 +1039,18 @@ type MigrationGenerateCommandContext = {
951
1039
  };
952
1040
  //#endregion
953
1041
  //#region src/database/utils/migration.d.ts
954
- declare function generateMigration(context: MigrationGenerateCommandContext): Promise<MigrationGenerateResult>;
1042
+ export declare function generateMigration(context: MigrationGenerateCommandContext): Promise<MigrationGenerateResult>;
955
1043
  //#endregion
956
1044
  //#region src/database/utils/query.d.ts
957
- declare function existsQuery<T extends ObjectLiteral = ObjectLiteral>(builder: SelectQueryBuilder<T>, inverse?: boolean): string;
1045
+ export declare function existsQuery<T extends ObjectLiteral = ObjectLiteral>(builder: SelectQueryBuilder<T>, inverse?: boolean): string;
958
1046
  //#endregion
959
1047
  //#region src/env/constants.d.ts
960
- declare enum EnvironmentName {
1048
+ export declare enum EnvironmentName {
961
1049
  DEVELOPMENT = "development",
962
1050
  PRODUCTION = "production",
963
1051
  TEST = "test"
964
1052
  }
965
- declare enum EnvironmentVariableName {
1053
+ export declare enum EnvironmentVariableName {
966
1054
  ENV = "NODE_ENV",
967
1055
  SEEDS = "DB_SEEDS",
968
1056
  SEEDS_ALT = "TYPEORM_SEEDING_SEEDS",
@@ -1014,6 +1102,8 @@ declare enum EnvironmentVariableName {
1014
1102
  MAX_QUERY_EXECUTION_TIME_ALT = "TYPEORM_MAX_QUERY_EXECUTION_TIME",
1015
1103
  DEBUG = "DB_DEBUG",
1016
1104
  DEBUG_ALT = "TYPEORM_DEBUG",
1105
+ PIN_TIMEZONE = "DB_PIN_TIMEZONE",
1106
+ PIN_TIMEZONE_ALT = "TYPEORM_PIN_TIMEZONE",
1017
1107
  UUID_EXTENSION = "DB_UUID_EXTENSION",
1018
1108
  UUID_EXTENSION_ALT = "TYPEORM_UUID_EXTENSION",
1019
1109
  CACHE = "DB_CACHE",
@@ -1027,7 +1117,7 @@ declare enum EnvironmentVariableName {
1027
1117
  }
1028
1118
  //#endregion
1029
1119
  //#region src/env/type.d.ts
1030
- interface Environment {
1120
+ export interface Environment {
1031
1121
  env: `${EnvironmentName}`;
1032
1122
  seeds: string[];
1033
1123
  factories: string[];
@@ -1058,16 +1148,21 @@ interface Environment {
1058
1148
  maxQueryExecutionTime?: number;
1059
1149
  debug?: string;
1060
1150
  cache?: DataSourceCacheOption;
1151
+ /**
1152
+ * Pin the database session and the driver to this timezone
1153
+ * (only `UTC` is supported), see `pinTimezone`.
1154
+ */
1155
+ pinTimezone?: string;
1061
1156
  uuidExtension?: string;
1062
1157
  }
1063
1158
  //#endregion
1064
1159
  //#region src/env/module.d.ts
1065
- declare function useEnv(): Environment;
1066
- declare function useEnv<K extends keyof Environment>(key: K): Environment[K];
1067
- declare function resetEnv(): void;
1160
+ export declare function useEnv(): Environment;
1161
+ export declare function useEnv<K extends keyof Environment>(key: K): Environment[K];
1162
+ export declare function resetEnv(): void;
1068
1163
  //#endregion
1069
1164
  //#region src/helpers/entity/name.d.ts
1070
- declare function getEntityName<O>(entity: ObjectType<O> | EntitySchema<O> | string): string;
1165
+ export declare function getEntityName<O>(entity: ObjectType<O> | EntitySchema<O> | string): string;
1071
1166
  //#endregion
1072
1167
  //#region src/helpers/entity/property-names.d.ts
1073
1168
  /**
@@ -1077,7 +1172,7 @@ declare function getEntityName<O>(entity: ObjectType<O> | EntitySchema<O> | stri
1077
1172
  * @param input
1078
1173
  * @param dataSource
1079
1174
  */
1080
- declare function getEntityPropertyNames<T extends ObjectLiteral>(input: EntityTarget<T> | Repository<T>, dataSource?: DataSource): Promise<string[]>;
1175
+ export declare function getEntityPropertyNames<T extends ObjectLiteral>(input: EntityTarget<T> | Repository<T>, dataSource?: DataSource): Promise<string[]>;
1081
1176
  //#endregion
1082
1177
  //#region src/helpers/entity/metadata.d.ts
1083
1178
  /**
@@ -1087,7 +1182,7 @@ declare function getEntityPropertyNames<T extends ObjectLiteral>(input: EntityTa
1087
1182
  * @param input
1088
1183
  * @param dataSource
1089
1184
  */
1090
- declare function getEntityMetadata<T extends ObjectLiteral>(input: Repository<T> | EntityTarget<T>, dataSource?: DataSource): Promise<EntityMetadata>;
1185
+ export declare function getEntityMetadata<T extends ObjectLiteral>(input: Repository<T> | EntityTarget<T>, dataSource?: DataSource): Promise<EntityMetadata>;
1091
1186
  //#endregion
1092
1187
  //#region src/helpers/entity/join-columns.d.ts
1093
1188
  type EntityRelationColumnsValidateOptions<T> = {
@@ -1102,7 +1197,7 @@ type EntityRelationColumnsValidateOptions<T> = {
1102
1197
  * @param entity
1103
1198
  * @param options
1104
1199
  */
1105
- declare function validateEntityJoinColumns<T extends ObjectLiteral>(entity: Partial<T>, options: EntityRelationColumnsValidateOptions<T>): Promise<Partial<T>>;
1200
+ export declare function validateEntityJoinColumns<T extends ObjectLiteral>(entity: Partial<T>, options: EntityRelationColumnsValidateOptions<T>): Promise<Partial<T>>;
1106
1201
  //#endregion
1107
1202
  //#region src/helpers/entity/uniqueness.d.ts
1108
1203
  type EntityUniquenessCheckOptions<T> = {
@@ -1130,30 +1225,30 @@ type EntityUniquenessCheckOptions<T> = {
1130
1225
  * @experimental
1131
1226
  * @param options
1132
1227
  */
1133
- declare function isEntityUnique<T extends ObjectLiteral>(options: EntityUniquenessCheckOptions<T>): Promise<boolean>;
1228
+ export declare function isEntityUnique<T extends ObjectLiteral>(options: EntityUniquenessCheckOptions<T>): Promise<boolean>;
1134
1229
  //#endregion
1135
1230
  //#region src/seeder/factory/type.d.ts
1136
1231
  /**
1137
1232
  * The meta argument is undefined, as long as SeederFactory.setMeta() was not called.
1138
1233
  */
1139
- type FactoryCallback<O, Meta = unknown> = (meta: Meta | undefined) => O | Promise<O>;
1140
- type SeederFactoryItem = {
1234
+ export type FactoryCallback<O, Meta = unknown> = (meta: Meta | undefined) => O | Promise<O>;
1235
+ export type SeederFactoryItem = {
1141
1236
  factoryFn: FactoryCallback<any, any>;
1142
1237
  entity: ObjectType<any> | EntitySchema<any>;
1143
1238
  };
1144
- type SeederFactoryContext<O, Meta = unknown> = {
1239
+ export type SeederFactoryContext<O, Meta = unknown> = {
1145
1240
  name: string;
1146
1241
  entity: ObjectType<O> | EntitySchema<O>;
1147
1242
  factoryFn: FactoryCallback<O, Meta>;
1148
1243
  dataSource?: DataSource;
1149
1244
  };
1150
- type SeederFactoryManagerContext = {
1245
+ export type SeederFactoryManagerContext = {
1151
1246
  items?: Record<string, SeederFactoryItem>;
1152
1247
  dataSource?: DataSource;
1153
1248
  };
1154
1249
  //#endregion
1155
1250
  //#region src/seeder/factory/module.d.ts
1156
- declare class SeederFactory<O extends Record<string, any>, Meta = unknown> {
1251
+ export declare class SeederFactory<O extends Record<string, any>, Meta = unknown> {
1157
1252
  readonly context: SeederFactoryContext<O, Meta>;
1158
1253
  meta: Meta | undefined;
1159
1254
  constructor(context: SeederFactoryContext<O, Meta>);
@@ -1165,7 +1260,7 @@ declare class SeederFactory<O extends Record<string, any>, Meta = unknown> {
1165
1260
  }
1166
1261
  //#endregion
1167
1262
  //#region src/seeder/factory/manager.d.ts
1168
- declare class SeederFactoryManager {
1263
+ export declare class SeederFactoryManager {
1169
1264
  readonly items: Record<string, SeederFactoryItem>;
1170
1265
  readonly dataSource: DataSource | undefined;
1171
1266
  constructor(context?: SeederFactoryManagerContext);
@@ -1174,14 +1269,14 @@ declare class SeederFactoryManager {
1174
1269
  }
1175
1270
  //#endregion
1176
1271
  //#region src/seeder/factory/utils.d.ts
1177
- declare function useSeederFactoryManager(): SeederFactoryManager;
1178
- declare function resetSeederFactoryManager(): void;
1179
- declare function setSeederFactory<O extends Record<string, any>, Meta = unknown>(entity: ObjectType<O> | EntitySchema<O>, factoryFn: FactoryCallback<O, Meta>): SeederFactoryItem;
1180
- declare function useSeederFactory<O extends Record<string, any>, Meta = unknown>(entity: ObjectType<O> | EntitySchema<O>): SeederFactory<O, Meta>;
1181
- declare function prepareSeederFactories(items: SeederFactoryItem[] | string[], root?: string): Promise<void>;
1272
+ export declare function useSeederFactoryManager(): SeederFactoryManager;
1273
+ export declare function resetSeederFactoryManager(): void;
1274
+ export declare function setSeederFactory<O extends Record<string, any>, Meta = unknown>(entity: ObjectType<O> | EntitySchema<O>, factoryFn: FactoryCallback<O, Meta>): SeederFactoryItem;
1275
+ export declare function useSeederFactory<O extends Record<string, any>, Meta = unknown>(entity: ObjectType<O> | EntitySchema<O>): SeederFactory<O, Meta>;
1276
+ export declare function prepareSeederFactories(items: SeederFactoryItem[] | string[], root?: string): Promise<void>;
1182
1277
  //#endregion
1183
1278
  //#region src/seeder/type.d.ts
1184
- interface Seeder {
1279
+ export interface Seeder {
1185
1280
  /**
1186
1281
  * Track seeder execution.
1187
1282
  *
@@ -1190,8 +1285,8 @@ interface Seeder {
1190
1285
  track?: boolean;
1191
1286
  run(dataSource: DataSource, factoryManager: SeederFactoryManager): Promise<any>;
1192
1287
  }
1193
- type SeederConstructor = new () => Seeder;
1194
- type SeederOptions = {
1288
+ export type SeederConstructor = new () => Seeder;
1289
+ export type SeederOptions = {
1195
1290
  seeds?: SeederConstructor[] | string[];
1196
1291
  seedName?: string;
1197
1292
  seedTableName?: string;
@@ -1202,14 +1297,14 @@ type SeederOptions = {
1202
1297
  * A fully resolved seeder configuration
1203
1298
  * (explicit input ← data-source options ← environment ← built-in defaults).
1204
1299
  */
1205
- type SeederConfig = {
1300
+ export type SeederConfig = {
1206
1301
  seeds: SeederConstructor[] | string[];
1207
1302
  seedName?: string;
1208
1303
  seedTableName: string;
1209
1304
  seedTracking: boolean;
1210
1305
  factories: SeederFactoryItem[] | string[];
1211
1306
  };
1212
- type SeederExecutorOptions = {
1307
+ export type SeederExecutorOptions = {
1213
1308
  /**
1214
1309
  * Root directory of the project.
1215
1310
  */
@@ -1226,7 +1321,7 @@ type SeederExecutorOptions = {
1226
1321
  */
1227
1322
  preserveFilePaths?: boolean;
1228
1323
  };
1229
- type SeederPrepareElement = {
1324
+ export type SeederPrepareElement = {
1230
1325
  constructor: SeederConstructor;
1231
1326
  timestamp?: number;
1232
1327
  fileName?: string;
@@ -1234,10 +1329,10 @@ type SeederPrepareElement = {
1234
1329
  };
1235
1330
  //#endregion
1236
1331
  //#region src/seeder/config.d.ts
1237
- declare function resolveSeederConfig(input?: SeederOptions, dataSourceOptions?: SeederOptions, env?: Pick<Environment, 'seeds' | 'factories'>): SeederConfig;
1332
+ export declare function resolveSeederConfig(input?: SeederOptions, dataSourceOptions?: SeederOptions, env?: Pick<Environment, 'seeds' | 'factories'>): SeederConfig;
1238
1333
  //#endregion
1239
1334
  //#region src/seeder/entity.d.ts
1240
- declare class SeederEntity {
1335
+ export declare class SeederEntity {
1241
1336
  /**
1242
1337
  * ID of the seeder.
1243
1338
  *
@@ -1290,50 +1385,50 @@ declare class SeederEntity {
1290
1385
  }
1291
1386
  //#endregion
1292
1387
  //#region src/utils/code-transformation/constants.d.ts
1293
- declare enum CodeTransformation {
1388
+ export declare enum CodeTransformation {
1294
1389
  JUST_IN_TIME = "jit",
1295
1390
  NONE = "none"
1296
1391
  }
1297
1392
  //#endregion
1298
1393
  //#region src/utils/code-transformation/module.d.ts
1299
- declare function detectCodeTransformation(): `${CodeTransformation}`;
1300
- declare function isCodeTransformation(input: string): boolean;
1394
+ export declare function detectCodeTransformation(): `${CodeTransformation}`;
1395
+ export declare function isCodeTransformation(input: string): boolean;
1301
1396
  //#endregion
1302
1397
  //#region src/utils/file-path.d.ts
1303
- declare function transformFilePath(input: string, dist?: string, src?: string): string;
1304
- declare function resolveFilePath(filePath: string, root?: string): string;
1305
- declare function parseFilePath(filePath: string, root?: string): {
1398
+ export declare function transformFilePath(input: string, dist?: string, src?: string): string;
1399
+ export declare function resolveFilePath(filePath: string, root?: string): string;
1400
+ export declare function parseFilePath(filePath: string, root?: string): {
1306
1401
  directory: string;
1307
1402
  name: string;
1308
1403
  };
1309
1404
  //#endregion
1310
1405
  //#region src/utils/file-system.d.ts
1311
- declare function isDirectory(input: string): Promise<boolean>;
1406
+ export declare function isDirectory(input: string): Promise<boolean>;
1312
1407
  //#endregion
1313
1408
  //#region src/utils/has-property.d.ts
1314
- declare function hasOwnProperty<X extends Record<string, any>, Y extends PropertyKey>(obj: X, prop: Y): obj is X & Record<Y, unknown>;
1315
- declare function hasStringProperty<X extends Record<string, any>, Y extends PropertyKey>(obj: X, prop: Y): obj is X & Record<Y, string>;
1409
+ export declare function hasOwnProperty<X extends Record<string, any>, Y extends PropertyKey>(obj: X, prop: Y): obj is X & Record<Y, unknown>;
1410
+ export declare function hasStringProperty<X extends Record<string, any>, Y extends PropertyKey>(obj: X, prop: Y): obj is X & Record<Y, string>;
1316
1411
  //#endregion
1317
1412
  //#region src/utils/object.d.ts
1318
- declare function pickRecord(data: Record<string, any>, keys: string[]): Record<string, any>;
1319
- declare function extendObject<T extends Record<string, any>>(target: T, source: Partial<T>): T;
1320
- declare function isObject(item: unknown): item is Record<string, any>;
1413
+ export declare function pickRecord(data: Record<string, any>, keys: string[]): Record<string, any>;
1414
+ export declare function extendObject<T extends Record<string, any>>(target: T, source: Partial<T>): T;
1415
+ export declare function isObject(item: unknown): item is Record<string, any>;
1321
1416
  //#endregion
1322
1417
  //#region src/utils/path-resolver/constants.d.ts
1323
- declare enum PathResolverMode {
1418
+ export declare enum PathResolverMode {
1324
1419
  AUTO = "auto",
1325
1420
  PRESERVE = "preserve",
1326
1421
  TRANSFORM = "transform"
1327
1422
  }
1328
1423
  //#endregion
1329
1424
  //#region src/utils/path-resolver/helpers/adjust-file-path.d.ts
1330
- declare function adjustFilePath<T extends unknown | unknown[]>(input: T, tsconfig?: string | TSConfig): Promise<T>;
1425
+ export declare function adjustFilePath<T extends unknown | unknown[]>(input: T, tsconfig?: string | TSConfig): Promise<T>;
1331
1426
  //#endregion
1332
1427
  //#region src/utils/path-resolver/helpers/adjust-file-paths.d.ts
1333
- declare function adjustFilePaths<T extends Record<string, any>>(input: T, keys?: (keyof T)[], tsconfig?: string | TSConfig): Promise<T>;
1428
+ export declare function adjustFilePaths<T extends Record<string, any>>(input: T, keys?: (keyof T)[], tsconfig?: string | TSConfig): Promise<T>;
1334
1429
  //#endregion
1335
1430
  //#region src/utils/path-resolver/type.d.ts
1336
- type PathResolverOptions = {
1431
+ export type PathResolverOptions = {
1337
1432
  /**
1338
1433
  * Root directory against which relative paths are absolutized.
1339
1434
  *
@@ -1356,7 +1451,7 @@ type PathResolverOptions = {
1356
1451
  */
1357
1452
  mode?: `${PathResolverMode}`;
1358
1453
  };
1359
- interface IPathResolver {
1454
+ export interface IPathResolver {
1360
1455
  /**
1361
1456
  * Absolutize a path against the root directory.
1362
1457
  */
@@ -1381,7 +1476,7 @@ interface IPathResolver {
1381
1476
  }
1382
1477
  //#endregion
1383
1478
  //#region src/utils/path-resolver/module.d.ts
1384
- declare class PathResolver implements IPathResolver {
1479
+ export declare class PathResolver implements IPathResolver {
1385
1480
  protected root?: string;
1386
1481
  protected mode: `${PathResolverMode}`;
1387
1482
  protected tsconfigInput?: string | TSConfig;
@@ -1395,22 +1490,22 @@ declare class PathResolver implements IPathResolver {
1395
1490
  protected readTsconfig(): Promise<TSConfig>;
1396
1491
  protected shouldTransform(): boolean;
1397
1492
  }
1398
- declare function createPathResolver(options?: PathResolverOptions): IPathResolver;
1493
+ export declare function createPathResolver(options?: PathResolverOptions): IPathResolver;
1399
1494
  //#endregion
1400
1495
  //#region src/utils/promise.d.ts
1401
- declare function isPromise(p: unknown): p is Promise<unknown>;
1496
+ export declare function isPromise(p: unknown): p is Promise<unknown>;
1402
1497
  //#endregion
1403
1498
  //#region src/utils/separator.d.ts
1404
- declare function canReplaceWindowsSeparator(input: string): boolean;
1405
- declare function replaceWindowSeparator(input: string): string;
1406
- declare function safeReplaceWindowsSeparator(input: string): string;
1499
+ export declare function canReplaceWindowsSeparator(input: string): boolean;
1500
+ export declare function replaceWindowSeparator(input: string): string;
1501
+ export declare function safeReplaceWindowsSeparator(input: string): string;
1407
1502
  //#endregion
1408
1503
  //#region src/utils/slash.d.ts
1409
- declare function hasTrailingSlash(input?: string, queryParams?: boolean): boolean;
1410
- declare function withoutTrailingSlash(input?: string, queryParams?: boolean): string;
1504
+ export declare function hasTrailingSlash(input?: string, queryParams?: boolean): boolean;
1505
+ export declare function withoutTrailingSlash(input?: string, queryParams?: boolean): string;
1411
1506
  //#endregion
1412
1507
  //#region src/seeder/executor.d.ts
1413
- declare class SeederExecutor {
1508
+ export declare class SeederExecutor {
1414
1509
  protected dataSource: DataSource;
1415
1510
  protected options: SeederExecutorOptions;
1416
1511
  protected pathResolver: IPathResolver;
@@ -1434,23 +1529,23 @@ declare class SeederExecutor {
1434
1529
  }
1435
1530
  //#endregion
1436
1531
  //#region src/seeder/module.d.ts
1437
- declare function runSeeder(dataSource: DataSource, seeder: SeederConstructor | string, options?: SeederOptions): Promise<SeederEntity | undefined>;
1438
- declare function runSeeders(dataSource: DataSource, options?: SeederOptions): Promise<SeederEntity[]>;
1532
+ export declare function runSeeder(dataSource: DataSource, seeder: SeederConstructor | string, options?: SeederOptions): Promise<SeederEntity | undefined>;
1533
+ export declare function runSeeders(dataSource: DataSource, options?: SeederOptions): Promise<SeederEntity[]>;
1439
1534
  //#endregion
1440
1535
  //#region src/seeder/utils/file-name.d.ts
1441
- declare function buildSeederFileName(name: string, timestamp: number, options?: {
1536
+ export declare function buildSeederFileName(name: string, timestamp: number, options?: {
1442
1537
  javascript?: boolean;
1443
1538
  }): string;
1444
1539
  //#endregion
1445
1540
  //#region src/seeder/utils/file-path.d.ts
1446
- declare function resolveFilePatterns(filesPattern: string[], root?: string): Promise<string[]>;
1447
- declare function resolveFilePaths(filePaths: string[], root?: string): string[];
1541
+ export declare function resolveFilePatterns(filesPattern: string[], root?: string): Promise<string[]>;
1542
+ export declare function resolveFilePaths(filePaths: string[], root?: string): string[];
1448
1543
  //#endregion
1449
1544
  //#region src/seeder/utils/prepare.d.ts
1450
- declare function prepareSeederSeeds(input: SeederConstructor[] | string[], root?: string): Promise<SeederPrepareElement[]>;
1545
+ export declare function prepareSeederSeeds(input: SeederConstructor[] | string[], root?: string): Promise<SeederPrepareElement[]>;
1451
1546
  //#endregion
1452
1547
  //#region src/seeder/utils/template.d.ts
1453
- declare function buildSeederFileTemplate(name: string, timestamp: number): string;
1548
+ export declare function buildSeederFileTemplate(name: string, timestamp: number): string;
1454
1549
  //#endregion
1455
- export { CockroachDBDialect, CodeTransformation, ConnectionParams, DataSourceCacheOption, DataSourceFindOptions, DataSourceOptionsBuildContext, DatabaseBaseContext, DatabaseBaseContextInput, DatabaseCheckContext, DatabaseCheckResult, DatabaseCreateContext, DatabaseCreateContextInput, DatabaseCreateOperation, DatabaseDialectName, DatabaseDialectOverrides, DatabaseDialectRegistryEntry, DatabaseDropContext, DatabaseDropContextInput, DatabaseDropOperation, DriverError, EntityMetadataError, EntityRelationLookupError, Environment, EnvironmentName, EnvironmentVariableName, FactoryCallback, IDatabaseConnection, IDatabaseConnectionFactory, IDatabaseDialect, IFileSystem, IPathResolver, MYSQL_FOREIGN_KEY_CHECKS_OFF, MYSQL_FOREIGN_KEY_CHECKS_ON, MYSQL_FOREIGN_KEY_CHECKS_SELECT, MigrationGenerateCommandContext, MigrationGenerateResult, MongoDBDialect, MsSQLDialect, MySQLDialect, OptionsError, OracleDialect, PathResolver, PathResolverMode, PathResolverOptions, PostgresDialect, SQLiteDialect, SchemaAlterationError, type SchemaChangeColumnTypeInput, type SchemaColumnType, SchemaDrift, SchemaDriftError, SchemaDriftOptions, SchemaDriftStatement, type SchemaForeignKeyMeta, type SchemaRenameForeignKeyInput, type SchemaRenameIndexInput, type SchemaStrictInput, Seeder, SeederConfig, SeederConstructor, SeederEntity, SeederExecutor, SeederExecutorOptions, SeederFactory, SeederFactoryContext, SeederFactoryItem, SeederFactoryManager, SeederFactoryManagerContext, SeederOptions, SeederPrepareElement, StripEnums, TSConfig, TypeormExtensionError, adjustFilePath, adjustFilePaths, assertSchemaMatchesMetadata, buildCockroachDBCreateDatabaseQuery, buildCockroachDBDropDatabaseQuery, buildConnectionParams, buildDataSourceOptions, buildDatabaseCreateContext, buildDatabaseDropContext, buildMongoDBConnectionUri, buildMongoDBDropDatabaseCommand, buildMsSQLCreateDatabaseQuery, buildMsSQLDropDatabaseQuery, buildMySQLCreateDatabaseQuery, buildMySQLDropDatabaseQuery, buildOracleConnectString, buildOracleCreateDatabaseQuery, buildPostgresCreateDatabaseQuery, buildPostgresCreateSchemaQuery, buildPostgresDatabaseExistsQuery, buildPostgresDropDatabaseQuery, buildSeederFileName, buildSeederFileTemplate, canReplaceWindowsSeparator, changeColumnType, checkDatabase, createCockroachDBDatabase, createDatabase, createMongoDBDatabase, createMsSQLDatabase, createMySQLDatabase, createOracleDatabase, createPathResolver, createPostgresDatabase, createSQLiteDatabase, deriveMySQLCharacterSet, detectCodeTransformation, dropCockroachDBDatabase, dropDatabase, dropMongoDBDatabase, dropMsSQLDatabase, dropMySQLDatabase, dropOracleDatabase, dropPostgresDatabase, dropSQLiteDatabase, existsQuery, extendObject, findDataSource, generateMigration, getEntityMetadata, getEntityName, getEntityPropertyNames, getSchemaDrift, hasDataSource, hasDataSourceOptions, hasEnvDataSourceOptions, hasOwnProperty, hasResultRows, hasStringProperty, hasTrailingSlash, isCodeTransformation, isDirectory, isEntityUnique, isObject, isPromise, mergeDataSourceOptions, mergeDataSourceOptionsWithEnv, parseFilePath, pickRecord, prepareSeederFactories, prepareSeederSeeds, readDataSourceOptionsFromEnv, readTSConfig, renameForeignKey, renameIndex, replaceWindowSeparator, resetEnv, resetSeederFactoryManager, resolveFilePath, resolveFilePaths, resolveFilePatterns, resolveSQLiteDatabaseDirectory, resolveSQLiteDatabasePath, resolveSeederConfig, runSeeder, runSeeders, safeReplaceWindowsSeparator, setDataSource, setDataSourceOptions, setSeederFactory, synchronizeDatabaseSchema, transformFilePath, unsetDataSource, useDataSource, useDataSourceOptions, useEnv, useSeederFactory, useSeederFactoryManager, validateEntityJoinColumns, withForeignKeyChecksDisabled, withoutTrailingSlash };
1550
+ export type { DataSourceTimezone, DatabaseLockOptions, SchemaChangeColumnTypeInput, SchemaColumnType, SchemaForeignKeyMeta, SchemaRenameForeignKeyInput, SchemaRenameIndexInput, SchemaStrictInput };
1456
1551
  //# sourceMappingURL=index.d.mts.map