@holo-js/db 0.2.6 → 0.3.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/chunk-2URJWY4D.mjs +35 -0
- package/dist/config.d.ts +18 -0
- package/dist/config.mjs +10 -0
- package/dist/index.d.ts +63 -203
- package/dist/index.mjs +1994 -2144
- package/package.json +11 -20
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// src/databaseConfig.ts
|
|
2
|
+
import { registerConfigNormalizer } from "@holo-js/config/registry";
|
|
3
|
+
var holoDatabaseDefaults = Object.freeze({
|
|
4
|
+
defaultConnection: "default",
|
|
5
|
+
connections: Object.freeze({
|
|
6
|
+
default: Object.freeze({
|
|
7
|
+
driver: "sqlite",
|
|
8
|
+
url: "./data/database.sqlite",
|
|
9
|
+
schema: "public",
|
|
10
|
+
logging: false
|
|
11
|
+
})
|
|
12
|
+
})
|
|
13
|
+
});
|
|
14
|
+
function defineDatabaseConfig(config) {
|
|
15
|
+
return Object.freeze({ ...config });
|
|
16
|
+
}
|
|
17
|
+
function normalizeDatabaseConfig(config = {}) {
|
|
18
|
+
const configuredConnections = config.connections;
|
|
19
|
+
const connections = configuredConnections && Object.keys(configuredConnections).length > 0 ? Object.freeze({ ...configuredConnections }) : holoDatabaseDefaults.connections;
|
|
20
|
+
const defaultConnection = config.defaultConnection ?? Object.keys(connections)[0];
|
|
21
|
+
return Object.freeze({
|
|
22
|
+
defaultConnection,
|
|
23
|
+
connections
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
registerConfigNormalizer({
|
|
27
|
+
name: "database",
|
|
28
|
+
normalize: normalizeDatabaseConfig
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
holoDatabaseDefaults,
|
|
33
|
+
defineDatabaseConfig,
|
|
34
|
+
normalizeDatabaseConfig
|
|
35
|
+
};
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HoloProjectConnectionConfig, HoloProjectDatabaseConfig } from '@holo-js/kernel';
|
|
2
|
+
|
|
3
|
+
type HoloDatabaseConnectionConfig = HoloProjectConnectionConfig;
|
|
4
|
+
type HoloDatabaseConfig = HoloProjectDatabaseConfig;
|
|
5
|
+
interface NormalizedHoloDatabaseConfig {
|
|
6
|
+
readonly defaultConnection?: string;
|
|
7
|
+
readonly connections: Readonly<Record<string, HoloDatabaseConnectionConfig | string>>;
|
|
8
|
+
}
|
|
9
|
+
declare module '@holo-js/config' {
|
|
10
|
+
interface HoloConfigRegistry {
|
|
11
|
+
database: NormalizedHoloDatabaseConfig;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
declare const holoDatabaseDefaults: Readonly<NormalizedHoloDatabaseConfig>;
|
|
15
|
+
declare function defineDatabaseConfig<TConfig extends HoloDatabaseConfig>(config: TConfig): Readonly<TConfig>;
|
|
16
|
+
declare function normalizeDatabaseConfig(config?: HoloDatabaseConfig): NormalizedHoloDatabaseConfig;
|
|
17
|
+
|
|
18
|
+
export { type HoloDatabaseConfig, type HoloDatabaseConnectionConfig, type NormalizedHoloDatabaseConfig, defineDatabaseConfig, holoDatabaseDefaults, normalizeDatabaseConfig };
|
package/dist/config.mjs
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export { HoloDatabaseConfig, HoloDatabaseConnectionConfig, NormalizedHoloDatabaseConfig, defineDatabaseConfig, holoDatabaseDefaults, normalizeDatabaseConfig } from './config.js';
|
|
2
|
+
import '@holo-js/kernel';
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
5
|
* Capability flags exposed by a driver+dialect pair.
|
|
3
6
|
*
|
|
@@ -242,14 +245,22 @@ declare class QueryScheduler {
|
|
|
242
245
|
private readonly concurrentState;
|
|
243
246
|
private readonly serializedState;
|
|
244
247
|
private readonly workerState;
|
|
248
|
+
private activeOperations;
|
|
249
|
+
private exclusiveActive;
|
|
250
|
+
private exclusivePending;
|
|
251
|
+
private readonly operationWaiters;
|
|
252
|
+
private readonly exclusiveWaiters;
|
|
253
|
+
private readonly exclusiveScope;
|
|
245
254
|
constructor(options: QuerySchedulerOptions);
|
|
246
255
|
schedule<T>(options: {
|
|
247
256
|
transactional: boolean;
|
|
248
257
|
preferWorkerThreads?: boolean;
|
|
258
|
+
withinExclusive?: boolean;
|
|
249
259
|
}, callback: (schedulingMode: SchedulingMode) => Promise<T>): Promise<{
|
|
250
260
|
result: T;
|
|
251
261
|
schedulingMode: SchedulingMode;
|
|
252
262
|
}>;
|
|
263
|
+
exclusive<T>(callback: () => Promise<T>): Promise<T>;
|
|
253
264
|
preview(options: {
|
|
254
265
|
transactional: boolean;
|
|
255
266
|
preferWorkerThreads?: boolean;
|
|
@@ -258,6 +269,9 @@ declare class QueryScheduler {
|
|
|
258
269
|
private resolveState;
|
|
259
270
|
private waitForSlot;
|
|
260
271
|
private wakeNext;
|
|
272
|
+
private acquireOperation;
|
|
273
|
+
private releaseOperation;
|
|
274
|
+
private wakeGate;
|
|
261
275
|
}
|
|
262
276
|
declare function createQueryScheduler(options: QuerySchedulerOptions): QueryScheduler;
|
|
263
277
|
|
|
@@ -334,6 +348,7 @@ interface DriverExecutionResult {
|
|
|
334
348
|
lastInsertId?: number | string;
|
|
335
349
|
}
|
|
336
350
|
interface DriverAdapter {
|
|
351
|
+
readonly supportsConcurrentTransactionScopes?: boolean;
|
|
337
352
|
initialize(): Promise<void>;
|
|
338
353
|
disconnect(): Promise<void>;
|
|
339
354
|
isConnected(): boolean;
|
|
@@ -1257,7 +1272,6 @@ declare class TableQueryBuilder<TTableOrName extends TableReference = string, TS
|
|
|
1257
1272
|
private applyCapturedJsonPathValue;
|
|
1258
1273
|
private isJsonRecord;
|
|
1259
1274
|
private captureUpsertPreviousRows;
|
|
1260
|
-
private hasUniqueByValues;
|
|
1261
1275
|
private rowsMatchUniqueBy;
|
|
1262
1276
|
private shouldUseReturningMutationRows;
|
|
1263
1277
|
private queryReturningMutationRows;
|
|
@@ -1352,6 +1366,9 @@ declare function getModelDefinition<TTable extends TableDefinition>(reference: M
|
|
|
1352
1366
|
declare class ModelRepository<TTable extends TableDefinition = TableDefinition> {
|
|
1353
1367
|
private readonly connection;
|
|
1354
1368
|
readonly definition: ModelDefinition<TTable>;
|
|
1369
|
+
private readonly eventDispatcher;
|
|
1370
|
+
private readonly relationAggregateCalculator;
|
|
1371
|
+
private readonly valueTransformer;
|
|
1355
1372
|
constructor(definition: ModelDefinition<TTable>, connection: DatabaseContext);
|
|
1356
1373
|
static from<TTable extends TableDefinition>(reference: ModelDefinitionLike | ModelDefinition<TTable> | ModelReference<TTable>, connection?: DatabaseContext): ModelRepository<TTable>;
|
|
1357
1374
|
getConnection(): DatabaseContext;
|
|
@@ -1480,11 +1497,7 @@ declare class ModelRepository<TTable extends TableDefinition = TableDefinition>
|
|
|
1480
1497
|
private applyExistsBooleanGroup;
|
|
1481
1498
|
private qualifyParentColumn;
|
|
1482
1499
|
private getRelationParentValue;
|
|
1483
|
-
private getAggregateAttributeKey;
|
|
1484
1500
|
private getRelationAggregateValues;
|
|
1485
|
-
private computeAggregateValue;
|
|
1486
|
-
private computeExtremeAggregateValue;
|
|
1487
|
-
private assertNumericAggregateValue;
|
|
1488
1501
|
private getRelatedEntitiesByParentKey;
|
|
1489
1502
|
attachCollection(entities: readonly Entity<TTable>[]): readonly Entity<TTable>[];
|
|
1490
1503
|
resolveRelationProperty(entity: Entity<TTable>, relationName: string): unknown;
|
|
@@ -1546,33 +1559,17 @@ declare class ModelRepository<TTable extends TableDefinition = TableDefinition>
|
|
|
1546
1559
|
private getPivotRelatedIdColumn;
|
|
1547
1560
|
private getReservedPivotColumns;
|
|
1548
1561
|
private buildPivotInsertPayload;
|
|
1549
|
-
private applyGeneratedUniqueIds;
|
|
1550
|
-
private applyPendingAttributes;
|
|
1551
|
-
private getObserverInstances;
|
|
1552
1562
|
private dispatchCancelableEvent;
|
|
1553
1563
|
private dispatchEvent;
|
|
1554
1564
|
private dispatchSyncEvent;
|
|
1555
1565
|
resolveAttribute(key: string, entity: Entity<TTable>, value: unknown): unknown;
|
|
1556
1566
|
shouldPreventAccessingMissingAttributes(key: string): boolean;
|
|
1557
1567
|
serializeEntity(entity: Entity<TTable>): Record<string, unknown>;
|
|
1558
|
-
private serializeRelationValue;
|
|
1559
|
-
private serializeOutputValue;
|
|
1560
1568
|
serializeAttributeValue(key: string, value: unknown): unknown;
|
|
1561
1569
|
private normalizeFromStorage;
|
|
1562
1570
|
private applyTimestampDefaults;
|
|
1563
1571
|
private normalizeForStorage;
|
|
1564
|
-
private applySchemaReadNormalization;
|
|
1565
|
-
private applySchemaWriteNormalization;
|
|
1566
|
-
private getSchemaDialectName;
|
|
1567
1572
|
private applyCastGet;
|
|
1568
|
-
private applyCastSet;
|
|
1569
|
-
private resolveCastDefinition;
|
|
1570
|
-
private parseBuiltInCast;
|
|
1571
|
-
private parseVectorValue;
|
|
1572
|
-
private serializeVectorValue;
|
|
1573
|
-
private parseVectorString;
|
|
1574
|
-
private parseVectorDimensions;
|
|
1575
|
-
private formatDateCast;
|
|
1576
1573
|
}
|
|
1577
1574
|
|
|
1578
1575
|
type BuilderCallback<TBuilder> = (query: TBuilder) => unknown;
|
|
@@ -3269,6 +3266,49 @@ declare class DatabaseContext {
|
|
|
3269
3266
|
}
|
|
3270
3267
|
declare function createDatabase(options: DatabaseContextOptions): DatabaseContext;
|
|
3271
3268
|
|
|
3269
|
+
type DatabaseDriverConnection = {
|
|
3270
|
+
readonly url?: string;
|
|
3271
|
+
readonly host?: string;
|
|
3272
|
+
readonly port?: number;
|
|
3273
|
+
readonly username?: string;
|
|
3274
|
+
readonly password?: string;
|
|
3275
|
+
readonly database?: string;
|
|
3276
|
+
readonly ssl?: boolean | Record<string, unknown>;
|
|
3277
|
+
};
|
|
3278
|
+
type DatabaseDriverFactory = {
|
|
3279
|
+
readonly driver: string;
|
|
3280
|
+
readonly supportsConcurrentTransactionScopes?: boolean;
|
|
3281
|
+
create(connection: DatabaseDriverConnection): DriverAdapter;
|
|
3282
|
+
};
|
|
3283
|
+
declare function registerDatabaseDriverFactory(factory: DatabaseDriverFactory): void;
|
|
3284
|
+
declare function getDatabaseDriverFactory(driver: string): DatabaseDriverFactory | undefined;
|
|
3285
|
+
declare function unregisterDatabaseDriverFactory(factory: DatabaseDriverFactory): void;
|
|
3286
|
+
declare class DeferredDatabaseDriverAdapter implements DriverAdapter {
|
|
3287
|
+
private readonly driver;
|
|
3288
|
+
private readonly connection;
|
|
3289
|
+
private adapter?;
|
|
3290
|
+
private pending?;
|
|
3291
|
+
constructor(driver: string, connection: DatabaseDriverConnection);
|
|
3292
|
+
get supportsConcurrentTransactionScopes(): boolean;
|
|
3293
|
+
private resolve;
|
|
3294
|
+
initialize(): Promise<void>;
|
|
3295
|
+
disconnect(): Promise<void>;
|
|
3296
|
+
isConnected(): boolean;
|
|
3297
|
+
ensureDatabaseExists(): Promise<void>;
|
|
3298
|
+
isDatabaseMissingError(error: unknown): boolean;
|
|
3299
|
+
runWithTransactionScope<T>(callback: () => Promise<T>): Promise<T>;
|
|
3300
|
+
introspect<TRow extends Record<string, unknown> = Record<string, unknown>>(sql: string, bindings?: readonly unknown[], options?: DatabaseOperationOptions): Promise<DriverQueryResult<TRow>>;
|
|
3301
|
+
query<TRow extends Record<string, unknown> = Record<string, unknown>>(sql: string, bindings?: readonly unknown[], options?: DatabaseOperationOptions): Promise<DriverQueryResult<TRow>>;
|
|
3302
|
+
execute(sql: string, bindings?: readonly unknown[], options?: DatabaseOperationOptions): Promise<DriverExecutionResult>;
|
|
3303
|
+
beginTransaction(options?: DatabaseTransactionOptions): Promise<void>;
|
|
3304
|
+
commit(options?: DatabaseOperationOptions): Promise<void>;
|
|
3305
|
+
rollback(options?: DatabaseOperationOptions): Promise<void>;
|
|
3306
|
+
createSavepoint(name: string, options?: DatabaseOperationOptions): Promise<void>;
|
|
3307
|
+
rollbackToSavepoint(name: string, options?: DatabaseOperationOptions): Promise<void>;
|
|
3308
|
+
releaseSavepoint(name: string, options?: DatabaseOperationOptions): Promise<void>;
|
|
3309
|
+
}
|
|
3310
|
+
declare function createDeferredDatabaseDriverAdapter(driver: string, connection: DatabaseDriverConnection): DriverAdapter;
|
|
3311
|
+
|
|
3272
3312
|
declare function unsafeSql(sql: string, bindings?: readonly unknown[], source?: string): UnsafeStatement;
|
|
3273
3313
|
|
|
3274
3314
|
declare class DatabaseError extends Error {
|
|
@@ -3363,137 +3403,6 @@ declare class AsyncConnectionContext {
|
|
|
3363
3403
|
}
|
|
3364
3404
|
declare const connectionAsyncContext: AsyncConnectionContext;
|
|
3365
3405
|
|
|
3366
|
-
declare abstract class LazyDriverAdapter implements DriverAdapter {
|
|
3367
|
-
private adapter?;
|
|
3368
|
-
private pending?;
|
|
3369
|
-
protected connected: boolean;
|
|
3370
|
-
protected abstract readonly driverLabel: string;
|
|
3371
|
-
protected abstract createConcreteAdapter(): Promise<DriverAdapter>;
|
|
3372
|
-
protected resolveAdapter(): Promise<DriverAdapter>;
|
|
3373
|
-
initialize(): Promise<void>;
|
|
3374
|
-
disconnect(): Promise<void>;
|
|
3375
|
-
isConnected(): boolean;
|
|
3376
|
-
ensureDatabaseExists(): Promise<void>;
|
|
3377
|
-
isDatabaseMissingError(error: unknown): boolean;
|
|
3378
|
-
runWithTransactionScope<T>(callback: () => Promise<T>): Promise<T>;
|
|
3379
|
-
introspect<TRow extends Record<string, unknown> = Record<string, unknown>>(sql: string, bindings?: readonly unknown[], options?: DatabaseOperationOptions): Promise<DriverQueryResult<TRow>>;
|
|
3380
|
-
query<TRow extends Record<string, unknown> = Record<string, unknown>>(sql: string, bindings?: readonly unknown[], options?: DatabaseOperationOptions): Promise<DriverQueryResult<TRow>>;
|
|
3381
|
-
execute(sql: string, bindings?: readonly unknown[], options?: DatabaseOperationOptions): Promise<DriverExecutionResult>;
|
|
3382
|
-
beginTransaction(options?: DatabaseTransactionOptions): Promise<void>;
|
|
3383
|
-
commit(options?: DatabaseOperationOptions): Promise<void>;
|
|
3384
|
-
rollback(options?: DatabaseOperationOptions): Promise<void>;
|
|
3385
|
-
createSavepoint(name: string, options?: DatabaseOperationOptions): Promise<void>;
|
|
3386
|
-
rollbackToSavepoint(name: string, options?: DatabaseOperationOptions): Promise<void>;
|
|
3387
|
-
releaseSavepoint(name: string, options?: DatabaseOperationOptions): Promise<void>;
|
|
3388
|
-
}
|
|
3389
|
-
interface SQLiteStatementLike {
|
|
3390
|
-
all(...params: readonly unknown[]): Record<string, unknown>[];
|
|
3391
|
-
run(...params: readonly unknown[]): {
|
|
3392
|
-
changes?: number;
|
|
3393
|
-
lastInsertRowid?: unknown;
|
|
3394
|
-
};
|
|
3395
|
-
}
|
|
3396
|
-
interface SQLiteDatabaseLike {
|
|
3397
|
-
prepare(sql: string): SQLiteStatementLike;
|
|
3398
|
-
exec(sql: string): unknown;
|
|
3399
|
-
close(): unknown;
|
|
3400
|
-
}
|
|
3401
|
-
interface SQLiteAdapterOptions {
|
|
3402
|
-
filename?: string;
|
|
3403
|
-
database?: SQLiteDatabaseLike;
|
|
3404
|
-
createDatabase?: (filename: string) => SQLiteDatabaseLike;
|
|
3405
|
-
}
|
|
3406
|
-
declare class SQLiteAdapter extends LazyDriverAdapter {
|
|
3407
|
-
private readonly options;
|
|
3408
|
-
protected readonly driverLabel = "SQLiteAdapter";
|
|
3409
|
-
readonly filename: string;
|
|
3410
|
-
constructor(options?: SQLiteAdapterOptions);
|
|
3411
|
-
protected createConcreteAdapter(): Promise<DriverAdapter>;
|
|
3412
|
-
createSavepoint(name: string, options?: DatabaseOperationOptions): Promise<void>;
|
|
3413
|
-
rollbackToSavepoint(name: string, options?: DatabaseOperationOptions): Promise<void>;
|
|
3414
|
-
releaseSavepoint(name: string, options?: DatabaseOperationOptions): Promise<void>;
|
|
3415
|
-
}
|
|
3416
|
-
declare function createSQLiteAdapter(options?: SQLiteAdapterOptions): SQLiteAdapter;
|
|
3417
|
-
interface PostgresQueryableLike {
|
|
3418
|
-
query(sql: string, bindings?: readonly unknown[]): Promise<{
|
|
3419
|
-
rows: Record<string, unknown>[];
|
|
3420
|
-
rowCount?: number | null;
|
|
3421
|
-
}>;
|
|
3422
|
-
}
|
|
3423
|
-
interface PostgresClientLike extends PostgresQueryableLike {
|
|
3424
|
-
release?(): void;
|
|
3425
|
-
end?(): Promise<void>;
|
|
3426
|
-
}
|
|
3427
|
-
interface PostgresPoolLike extends PostgresQueryableLike {
|
|
3428
|
-
connect(): Promise<PostgresClientLike>;
|
|
3429
|
-
end(): Promise<void>;
|
|
3430
|
-
}
|
|
3431
|
-
interface PostgresConnectionConfig {
|
|
3432
|
-
connectionString?: string;
|
|
3433
|
-
host?: string;
|
|
3434
|
-
port?: number;
|
|
3435
|
-
user?: string;
|
|
3436
|
-
password?: string;
|
|
3437
|
-
database?: string;
|
|
3438
|
-
ssl?: boolean | Record<string, unknown>;
|
|
3439
|
-
}
|
|
3440
|
-
interface PostgresAdapterOptions<TConfig extends PostgresConnectionConfig = PostgresConnectionConfig> {
|
|
3441
|
-
connectionString?: string;
|
|
3442
|
-
config?: TConfig;
|
|
3443
|
-
client?: PostgresClientLike;
|
|
3444
|
-
pool?: PostgresPoolLike;
|
|
3445
|
-
createPool?: (config?: TConfig) => PostgresPoolLike;
|
|
3446
|
-
}
|
|
3447
|
-
declare class PostgresAdapter<TConfig extends PostgresConnectionConfig = PostgresConnectionConfig> extends LazyDriverAdapter {
|
|
3448
|
-
private readonly options;
|
|
3449
|
-
protected readonly driverLabel = "PostgresAdapter";
|
|
3450
|
-
readonly config?: TConfig;
|
|
3451
|
-
constructor(options?: PostgresAdapterOptions<TConfig>);
|
|
3452
|
-
protected createConcreteAdapter(): Promise<DriverAdapter>;
|
|
3453
|
-
createSavepoint(name: string, options?: DatabaseOperationOptions): Promise<void>;
|
|
3454
|
-
rollbackToSavepoint(name: string, options?: DatabaseOperationOptions): Promise<void>;
|
|
3455
|
-
releaseSavepoint(name: string, options?: DatabaseOperationOptions): Promise<void>;
|
|
3456
|
-
}
|
|
3457
|
-
declare function createPostgresAdapter<TConfig extends PostgresConnectionConfig = PostgresConnectionConfig>(options?: PostgresAdapterOptions<TConfig>): PostgresAdapter<TConfig>;
|
|
3458
|
-
interface MySQLQueryableLike {
|
|
3459
|
-
query(sql: string, bindings?: readonly unknown[]): Promise<readonly [unknown, unknown]>;
|
|
3460
|
-
}
|
|
3461
|
-
interface MySQLClientLike extends MySQLQueryableLike {
|
|
3462
|
-
release?(): void;
|
|
3463
|
-
end?(): Promise<void>;
|
|
3464
|
-
}
|
|
3465
|
-
interface MySQLPoolLike extends MySQLQueryableLike {
|
|
3466
|
-
getConnection(): Promise<MySQLClientLike>;
|
|
3467
|
-
end(): Promise<void>;
|
|
3468
|
-
}
|
|
3469
|
-
interface MySQLConnectionConfig {
|
|
3470
|
-
host?: string;
|
|
3471
|
-
port?: number;
|
|
3472
|
-
user?: string;
|
|
3473
|
-
password?: string;
|
|
3474
|
-
database?: string;
|
|
3475
|
-
ssl?: unknown;
|
|
3476
|
-
uri?: string;
|
|
3477
|
-
}
|
|
3478
|
-
interface MySQLAdapterOptions<TConfig extends MySQLConnectionConfig = MySQLConnectionConfig> {
|
|
3479
|
-
uri?: string;
|
|
3480
|
-
config?: TConfig;
|
|
3481
|
-
client?: MySQLClientLike;
|
|
3482
|
-
pool?: MySQLPoolLike;
|
|
3483
|
-
createPool?: (config: TConfig) => MySQLPoolLike;
|
|
3484
|
-
}
|
|
3485
|
-
declare class MySQLAdapter<TConfig extends MySQLConnectionConfig = MySQLConnectionConfig> extends LazyDriverAdapter {
|
|
3486
|
-
private readonly options;
|
|
3487
|
-
protected readonly driverLabel = "MySQLAdapter";
|
|
3488
|
-
readonly config: TConfig;
|
|
3489
|
-
constructor(options?: MySQLAdapterOptions<TConfig>);
|
|
3490
|
-
protected createConcreteAdapter(): Promise<DriverAdapter>;
|
|
3491
|
-
createSavepoint(name: string, options?: DatabaseOperationOptions): Promise<void>;
|
|
3492
|
-
rollbackToSavepoint(name: string, options?: DatabaseOperationOptions): Promise<void>;
|
|
3493
|
-
releaseSavepoint(name: string, options?: DatabaseOperationOptions): Promise<void>;
|
|
3494
|
-
}
|
|
3495
|
-
declare function createMySQLAdapter<TConfig extends MySQLConnectionConfig = MySQLConnectionConfig>(options?: MySQLAdapterOptions<TConfig>): MySQLAdapter<TConfig>;
|
|
3496
|
-
|
|
3497
3406
|
type SupportedDatabaseDriver = 'sqlite' | 'postgres' | 'mysql';
|
|
3498
3407
|
interface RuntimeConnectionConfig {
|
|
3499
3408
|
driver?: SupportedDatabaseDriver | string;
|
|
@@ -3533,7 +3442,7 @@ type RuntimeAdapterConnectionConfig = {
|
|
|
3533
3442
|
declare function isSupportedDatabaseDriver(value: string): value is SupportedDatabaseDriver;
|
|
3534
3443
|
declare function parseDatabaseDriver(value: string | undefined, fallback: SupportedDatabaseDriver): SupportedDatabaseDriver;
|
|
3535
3444
|
declare function createDialect(driver: SupportedDatabaseDriver): Dialect;
|
|
3536
|
-
declare function createAdapter(driver: SupportedDatabaseDriver, connection: string | RuntimeAdapterConnectionConfig):
|
|
3445
|
+
declare function createAdapter(driver: SupportedDatabaseDriver, connection: string | RuntimeAdapterConnectionConfig): DriverAdapter;
|
|
3537
3446
|
declare function createRuntimeLogger(enabled: boolean): DatabaseLogger | undefined;
|
|
3538
3447
|
declare function createRuntimeConnectionOptions(driver: SupportedDatabaseDriver, connection: string | RuntimeAdapterConnectionConfig, dbLogging: boolean, schemaName?: string, connectionName?: string): DatabaseContextOptions;
|
|
3539
3448
|
declare function resolveRuntimeConnectionManagerOptions(config: RuntimeConfigInput): ConnectionManager;
|
|
@@ -4154,53 +4063,4 @@ declare function HasUuids<TTable extends TableDefinition = TableDefinition>(opti
|
|
|
4154
4063
|
declare function HasUlids<TTable extends TableDefinition = TableDefinition>(options?: Omit<UniqueIdTraitOptions<TTable>, 'generator'>): UniqueIdTrait<TTable>;
|
|
4155
4064
|
declare function HasSnowflakes<TTable extends TableDefinition = TableDefinition>(options?: Omit<UniqueIdTraitOptions<TTable>, 'generator'>): UniqueIdTrait<TTable>;
|
|
4156
4065
|
|
|
4157
|
-
|
|
4158
|
-
models: string;
|
|
4159
|
-
migrations: string;
|
|
4160
|
-
generatedSchema: string;
|
|
4161
|
-
seeders: string;
|
|
4162
|
-
observers: string;
|
|
4163
|
-
factories: string;
|
|
4164
|
-
commands: string;
|
|
4165
|
-
jobs: string;
|
|
4166
|
-
events: string;
|
|
4167
|
-
listeners: string;
|
|
4168
|
-
authorizationPolicies: string;
|
|
4169
|
-
authorizationAbilities: string;
|
|
4170
|
-
}
|
|
4171
|
-
interface HoloProjectConnectionConfig {
|
|
4172
|
-
driver?: SupportedDatabaseDriver;
|
|
4173
|
-
url?: string;
|
|
4174
|
-
host?: string;
|
|
4175
|
-
port?: number | string;
|
|
4176
|
-
username?: string;
|
|
4177
|
-
password?: string;
|
|
4178
|
-
database?: string;
|
|
4179
|
-
filename?: string;
|
|
4180
|
-
schema?: string;
|
|
4181
|
-
ssl?: boolean | Record<string, unknown>;
|
|
4182
|
-
logging?: boolean;
|
|
4183
|
-
}
|
|
4184
|
-
interface HoloProjectDatabaseConfig {
|
|
4185
|
-
defaultConnection?: string;
|
|
4186
|
-
connections?: Record<string, HoloProjectConnectionConfig | string>;
|
|
4187
|
-
}
|
|
4188
|
-
interface HoloProjectConfig {
|
|
4189
|
-
paths?: Partial<HoloProjectPaths>;
|
|
4190
|
-
database?: HoloProjectDatabaseConfig;
|
|
4191
|
-
models?: readonly string[];
|
|
4192
|
-
migrations?: readonly string[];
|
|
4193
|
-
seeders?: readonly string[];
|
|
4194
|
-
}
|
|
4195
|
-
declare const DEFAULT_HOLO_PROJECT_PATHS: Readonly<HoloProjectPaths>;
|
|
4196
|
-
interface NormalizedHoloProjectConfig {
|
|
4197
|
-
readonly paths: Readonly<HoloProjectPaths>;
|
|
4198
|
-
readonly database?: HoloProjectDatabaseConfig;
|
|
4199
|
-
readonly models: readonly string[];
|
|
4200
|
-
readonly migrations: readonly string[];
|
|
4201
|
-
readonly seeders: readonly string[];
|
|
4202
|
-
}
|
|
4203
|
-
declare function normalizeHoloProjectConfig(config?: HoloProjectConfig): NormalizedHoloProjectConfig;
|
|
4204
|
-
declare function defineHoloProject<TConfig extends HoloProjectConfig>(config: TConfig): NormalizedHoloProjectConfig & TConfig;
|
|
4205
|
-
|
|
4206
|
-
export { type AddColumnOperation, type AlterColumnOperation, type AnyColumnDefinition, type AnyModelDefinition, AsyncConnectionContext, type BelongsToManyRelationDefinition, type BelongsToManyRelationMethods, type BelongsToRelationDefinition, type BelongsToRelationMethods, type BoundTableDefinition, type BuiltInCastName, type BuiltInCastString, CapabilityError, type CastableDefinition, ColumnBuilder, type ColumnDefinition, type CompiledStatement, CompilerError, type ConcurrencyOptions, ConfigurationError, ConnectionManager, type ConnectionManagerOptions, type CreateForeignKeyOperation, type CreateIndexOperation, type CreateTableOperation, type CursorPaginatedResult, type CursorPaginationOptions, DB, type DDLOperation, type DDLStatement, DEFAULT_CAPABILITIES, DEFAULT_HOLO_PROJECT_PATHS, DEFAULT_SECURITY_POLICY, DIALECT_ID_STRATEGY_MAP, DIALECT_LOGICAL_TYPE_MAP, DIALECT_VECTOR_SUPPORT, type DatabaseCapabilities, DatabaseContext, type DatabaseContextOptions, type DatabaseDependencyCollectionResult, type DatabaseDependencyInvalidationEvent, type DatabaseDependencyInvalidationListener, type DatabaseDriverName, DatabaseError, type DatabaseLogger, type DatabaseOperationOptions, type DatabaseQueryCacheBridge, type DatabaseTransactionOptions, type DefineModelOptions, type DefineTableOptions, type DeleteQueryPlan, type Dialect, type DriverAdapter, type DriverExecutionResult, type DriverQueryResult, type DropColumnOperation, type DropForeignKeyOperation, type DropIndexOperation, type DropTableOperation, type DynamicRelationResolver, type EmptyScopeMap, Entity, type EntityWithLoaded, type EnumCastDefinition, Factory, type FactoryAttributes, type FactoryContext, type FactoryDefinition, type FactoryHook, type FactoryModelReference, FactoryService, type FactoryStateDefinition, type ForeignKeyReference, type GeneratedMigrationTemplate, type GeneratedSchemaTable, type GeneratedSchemaTableName, type GeneratedSchemaTables, type HasManyRelationDefinition, type HasManyRelationMethods, type HasManyThroughRelationDefinition, type HasOneOfManyRelationDefinition, type HasOneRelationDefinition, type HasOneRelationMethods, type HasOneThroughRelationDefinition, HasSnowflakes, HasUlids, HasUniqueIds, HasUuids, type HoloProjectConfig, type HoloProjectConnectionConfig, type HoloProjectDatabaseConfig, type HoloProjectPaths, HydrationError, type IdGenerationStrategy, type InferInsert, type InferSelect, type InferUpdate, type InsertQueryPlan, type IntrospectedColumn, type IntrospectedForeignKey, type IntrospectedIndex, type LogicalColumnKind, type MigrateOptions, type MigrationContext, type MigrationDefinition, type MigrationErrorLog, type MigrationExecutionPolicy, MigrationService, type MigrationSquashPlan, type MigrationStartLog, type MigrationStatus, type MigrationSuccessLog, type MigrationTemplateKind, type MigrationTemplateOptions, type ModelAttributeKey, type ModelCastDefinition, type ModelCollection, type ModelDefinition, type ModelDefinitionLike, ModelEventService, type ModelInsertPayload, ModelNotFoundException, ModelQueryBuilder, type ModelRecord, type ModelReference, ModelRegistry, type ModelRelationPath, ModelRepository, type ModelRepositoryLike, type ModelScopeArgs, type ModelScopeMap, type ModelTrait, type ModelUpdatePayload, type MorphManyRelationDefinition, type MorphOneOfManyRelationDefinition, type MorphOneRelationDefinition, type MorphToManyRelationDefinition, type MorphToRelationDefinition, type MorphedByManyRelationDefinition, MySQLAdapter, type MySQLAdapterOptions, type MySQLClientLike, type MySQLPoolLike, MySQLQueryCompiler, type MySQLQueryableLike, MySQLSchemaCompiler, type NormalizedHoloProjectConfig, type PaginatedResult, type PaginationMeta, type PaginationOptions, type PivotRelationMethods, PostgresAdapter, type PostgresAdapterOptions, type PostgresClientLike, type PostgresPoolLike, PostgresQueryCompiler, type PostgresQueryableLike, PostgresSchemaCompiler, type QueryCacheConfig, type QueryCacheFlexibleTtlInput, type QueryCacheTtlInput, type QueryDirection, type QueryOperator, type QueryOrderBy, type QueryPlan, type QueryPredicate, QueryScheduler, type QuerySelection, type QuerySource, type RegisteredModelName, type RegisteredModelReference, type RegisteredModels, type RelatedColumnNameForRelationPath, type RelationConstraintDefinition, type RelationDefinition, RelationError, type RelationMap, type RenameColumnOperation, type RenameIndexOperation, type RenameTableOperation, type ResolveEagerLoadPath, type ResolveEagerLoadUnion, type ResolveEagerLoads, type RollbackOptions, type RuntimeConfigInput, type RuntimeConnectionConfig, type RuntimeDatabaseConfig, type RuntimeHoloConfig, SQLQueryCompiler, SQLSchemaCompiler, SQLiteAdapter, type SQLiteAdapterOptions, type SQLiteDatabaseLike, SQLiteQueryCompiler, SQLiteSchemaCompiler, type SQLiteStatementLike, type SchemaColumnMismatch, type SchemaDefaultDialectName, type SchemaDialectName, type SchemaDiff, SchemaError, type SchemaForeignKeyMismatch, type SchemaIndexMismatch, SchemaRegistry, SchemaService, type SchemaSyncPlan, SecurityError, type SecurityPolicy, type SeedOptions, type SeederContext, type SeederDefinition, type SeederErrorLog, SeederService, type SeederStartLog, type SeederSuccessLog, type SelectQueryPlan, SerializationError, type SerializeLoaded, type SerializeModels, type SerializedEntityWithLoaded, type SimplePaginatedResult, type SimplePaginationMeta, type StaticModelApi, type SupportedDatabaseDriver, type TableColumnsShape, type TableDefinition, TableDefinitionBuilder, type TableIndexDefinition, TableMutationBuilder, TableQueryBuilder, type TableSchemaDiff, type TransactionCallback, TransactionError, type TransactionMode, type UniqueIdRuntimeConfig, type UniqueIdTrait, type UniqueIdTraitKind, type UnsafeStatement, type UpdateQueryPlan, type VectorValue, addColumnOperation, alterColumnOperation, belongsTo, belongsToMany, binaryCast, clearGeneratedTables, collectDatabaseQueryDependencies, column, compileDialectDefaultLiteral, configureDB, configureDatabaseQueryCacheBridge, connectionAsyncContext, createAdapter, createCapabilities, createConnectionManager, createCursorPaginator, createDatabase, createDeleteQueryPlan, createDialect, createFactoryService, createForeignKeyOperation, createIndexOperation, createInsertQueryPlan, createMigrationFileName, createMigrationService, createMigrationTimestamp, createModelCollection, createModelEventService, createModelRegistry, createMySQLAdapter, createPaginator, createPostgresAdapter, createQueryScheduler, createRuntimeConnectionOptions, createRuntimeLogger, createSQLiteAdapter, diffSchema as createSchemaDiff, createSchemaRegistry, createSchemaService, createSecurityPolicy, createSeederService, createSelectQueryPlan, createSimplePaginator, createTableOperation, createTableSource, createUpdateQueryPlan, defineFactory, defineGeneratedTable, defineHoloProject, defineMigration, defineModel, defineSeeder, diffSchema, dropColumnOperation, dropForeignKeyOperation, dropIndexOperation, dropTableOperation, encryptedCast, enumCast, generateMigrationTemplate, generateSnowflake, generateUlid, generateUuidV7, getDatabaseQueryCacheBridge, getGeneratedTableDefinition, getModelDefinition, hasMany, hasManyThrough, hasOne, hasOneThrough, inferMigrationTableName, inferMigrationTemplateKind, isSupportedDatabaseDriver, latestMorphOne, latestOfMany, listGeneratedTableDefinitions, morphMany, morphOfMany, morphOne, morphTo, morphToMany, morphedByMany, normalizeDialectReadValue, normalizeDialectWriteValue, normalizeHoloProjectConfig, normalizeMigrationSlug, ofMany, oldestMorphOne, oldestOfMany, onDatabaseDependencyInvalidated, parseDatabaseDriver, queryCacheInternals, recordDatabaseQueryDependencies, redactBindings, redactSql, registerGeneratedTables, renameColumnOperation, renameIndexOperation, renameTableOperation, renderGeneratedSchemaModule, renderGeneratedSchemaPlaceholder, renderGeneratedSchemaRuntimeModule, resetDB, resetDatabaseDependencyInvalidationListeners, resetDatabaseQueryCacheBridge, resetGlobalModelRegistry, resetMorphRegistry, resolveDialectColumnType, resolveDialectIdStrategyType, resolveGeneratedTableDefinition, resolveMorphModel, resolveRuntimeConnectionManagerOptions, scopeRelation, serializeModels, uniqueSlug, unsafeSql, validateQueryPlan, withLimit, withOffset, withOrderBy, withPredicate, withSelections };
|
|
4066
|
+
export { type AddColumnOperation, type AlterColumnOperation, type AnyColumnDefinition, type AnyModelDefinition, AsyncConnectionContext, type BelongsToManyRelationDefinition, type BelongsToManyRelationMethods, type BelongsToRelationDefinition, type BelongsToRelationMethods, type BoundTableDefinition, type BuiltInCastName, type BuiltInCastString, CapabilityError, type CastableDefinition, ColumnBuilder, type ColumnDefinition, type CompiledStatement, CompilerError, type ConcurrencyOptions, ConfigurationError, ConnectionManager, type ConnectionManagerOptions, type CreateForeignKeyOperation, type CreateIndexOperation, type CreateTableOperation, type CursorPaginatedResult, type CursorPaginationOptions, DB, type DDLOperation, type DDLStatement, DEFAULT_CAPABILITIES, DEFAULT_SECURITY_POLICY, DIALECT_ID_STRATEGY_MAP, DIALECT_LOGICAL_TYPE_MAP, DIALECT_VECTOR_SUPPORT, type DatabaseCapabilities, DatabaseContext, type DatabaseContextOptions, type DatabaseDependencyCollectionResult, type DatabaseDependencyInvalidationEvent, type DatabaseDependencyInvalidationListener, type DatabaseDriverConnection, type DatabaseDriverFactory, type DatabaseDriverName, DatabaseError, type DatabaseLogger, type DatabaseOperationOptions, type DatabaseQueryCacheBridge, type DatabaseTransactionOptions, DeferredDatabaseDriverAdapter, type DefineModelOptions, type DefineTableOptions, type DeleteQueryPlan, type Dialect, type DriverAdapter, type DriverExecutionResult, type DriverQueryResult, type DropColumnOperation, type DropForeignKeyOperation, type DropIndexOperation, type DropTableOperation, type DynamicRelationResolver, type EmptyScopeMap, Entity, type EntityWithLoaded, type EnumCastDefinition, Factory, type FactoryAttributes, type FactoryContext, type FactoryDefinition, type FactoryHook, type FactoryModelReference, FactoryService, type FactoryStateDefinition, type ForeignKeyReference, type GeneratedMigrationTemplate, type GeneratedSchemaTable, type GeneratedSchemaTableName, type GeneratedSchemaTables, type HasManyRelationDefinition, type HasManyRelationMethods, type HasManyThroughRelationDefinition, type HasOneOfManyRelationDefinition, type HasOneRelationDefinition, type HasOneRelationMethods, type HasOneThroughRelationDefinition, HasSnowflakes, HasUlids, HasUniqueIds, HasUuids, HydrationError, type IdGenerationStrategy, type InferInsert, type InferSelect, type InferUpdate, type InsertQueryPlan, type IntrospectedColumn, type IntrospectedForeignKey, type IntrospectedIndex, type LogicalColumnKind, type MigrateOptions, type MigrationContext, type MigrationDefinition, type MigrationErrorLog, type MigrationExecutionPolicy, MigrationService, type MigrationSquashPlan, type MigrationStartLog, type MigrationStatus, type MigrationSuccessLog, type MigrationTemplateKind, type MigrationTemplateOptions, type ModelAttributeKey, type ModelCastDefinition, type ModelCollection, type ModelDefinition, type ModelDefinitionLike, ModelEventService, type ModelInsertPayload, ModelNotFoundException, ModelQueryBuilder, type ModelRecord, type ModelReference, ModelRegistry, type ModelRelationPath, ModelRepository, type ModelRepositoryLike, type ModelScopeArgs, type ModelScopeMap, type ModelTrait, type ModelUpdatePayload, type MorphManyRelationDefinition, type MorphOneOfManyRelationDefinition, type MorphOneRelationDefinition, type MorphToManyRelationDefinition, type MorphToRelationDefinition, type MorphedByManyRelationDefinition, MySQLQueryCompiler, MySQLSchemaCompiler, type PaginatedResult, type PaginationMeta, type PaginationOptions, type PivotRelationMethods, PostgresQueryCompiler, PostgresSchemaCompiler, type QueryCacheConfig, type QueryCacheFlexibleTtlInput, type QueryCacheTtlInput, type QueryDirection, type QueryOperator, type QueryOrderBy, type QueryPlan, type QueryPredicate, QueryScheduler, type QuerySelection, type QuerySource, type RegisteredModelName, type RegisteredModelReference, type RegisteredModels, type RelatedColumnNameForRelationPath, type RelationConstraintDefinition, type RelationDefinition, RelationError, type RelationMap, type RenameColumnOperation, type RenameIndexOperation, type RenameTableOperation, type ResolveEagerLoadPath, type ResolveEagerLoadUnion, type ResolveEagerLoads, type RollbackOptions, type RuntimeConfigInput, type RuntimeConnectionConfig, type RuntimeDatabaseConfig, type RuntimeHoloConfig, SQLQueryCompiler, SQLSchemaCompiler, SQLiteQueryCompiler, SQLiteSchemaCompiler, type SchemaColumnMismatch, type SchemaDefaultDialectName, type SchemaDialectName, type SchemaDiff, SchemaError, type SchemaForeignKeyMismatch, type SchemaIndexMismatch, SchemaRegistry, SchemaService, type SchemaSyncPlan, SecurityError, type SecurityPolicy, type SeedOptions, type SeederContext, type SeederDefinition, type SeederErrorLog, SeederService, type SeederStartLog, type SeederSuccessLog, type SelectQueryPlan, SerializationError, type SerializeLoaded, type SerializeModels, type SerializedEntityWithLoaded, type SimplePaginatedResult, type SimplePaginationMeta, type StaticModelApi, type SupportedDatabaseDriver, type TableColumnsShape, type TableDefinition, TableDefinitionBuilder, type TableIndexDefinition, TableMutationBuilder, TableQueryBuilder, type TableSchemaDiff, type TransactionCallback, TransactionError, type TransactionMode, type UniqueIdRuntimeConfig, type UniqueIdTrait, type UniqueIdTraitKind, type UnsafeStatement, type UpdateQueryPlan, type VectorValue, addColumnOperation, alterColumnOperation, belongsTo, belongsToMany, binaryCast, clearGeneratedTables, collectDatabaseQueryDependencies, column, compileDialectDefaultLiteral, configureDB, configureDatabaseQueryCacheBridge, connectionAsyncContext, createAdapter, createCapabilities, createConnectionManager, createCursorPaginator, createDatabase, createDeferredDatabaseDriverAdapter, createDeleteQueryPlan, createDialect, createFactoryService, createForeignKeyOperation, createIndexOperation, createInsertQueryPlan, createMigrationFileName, createMigrationService, createMigrationTimestamp, createModelCollection, createModelEventService, createModelRegistry, createPaginator, createQueryScheduler, createRuntimeConnectionOptions, createRuntimeLogger, diffSchema as createSchemaDiff, createSchemaRegistry, createSchemaService, createSecurityPolicy, createSeederService, createSelectQueryPlan, createSimplePaginator, createTableOperation, createTableSource, createUpdateQueryPlan, defineFactory, defineGeneratedTable, defineMigration, defineModel, defineSeeder, diffSchema, dropColumnOperation, dropForeignKeyOperation, dropIndexOperation, dropTableOperation, encryptedCast, enumCast, generateMigrationTemplate, generateSnowflake, generateUlid, generateUuidV7, getDatabaseDriverFactory, getDatabaseQueryCacheBridge, getGeneratedTableDefinition, getModelDefinition, hasMany, hasManyThrough, hasOne, hasOneThrough, inferMigrationTableName, inferMigrationTemplateKind, isSupportedDatabaseDriver, latestMorphOne, latestOfMany, listGeneratedTableDefinitions, morphMany, morphOfMany, morphOne, morphTo, morphToMany, morphedByMany, normalizeDialectReadValue, normalizeDialectWriteValue, normalizeMigrationSlug, ofMany, oldestMorphOne, oldestOfMany, onDatabaseDependencyInvalidated, parseDatabaseDriver, queryCacheInternals, recordDatabaseQueryDependencies, redactBindings, redactSql, registerDatabaseDriverFactory, registerGeneratedTables, renameColumnOperation, renameIndexOperation, renameTableOperation, renderGeneratedSchemaModule, renderGeneratedSchemaPlaceholder, renderGeneratedSchemaRuntimeModule, resetDB, resetDatabaseDependencyInvalidationListeners, resetDatabaseQueryCacheBridge, resetGlobalModelRegistry, resetMorphRegistry, resolveDialectColumnType, resolveDialectIdStrategyType, resolveGeneratedTableDefinition, resolveMorphModel, resolveRuntimeConnectionManagerOptions, scopeRelation, serializeModels, uniqueSlug, unregisterDatabaseDriverFactory, unsafeSql, validateQueryPlan, withLimit, withOffset, withOrderBy, withPredicate, withSelections };
|