@event-driven-io/dumbo 0.13.0-beta.32 → 0.13.0-beta.34
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-4SM4JJJZ.js → chunk-33P5766L.js} +2 -2
- package/dist/{chunk-GVR3PSDL.cjs → chunk-4MMMEDQ7.cjs} +180 -85
- package/dist/chunk-4MMMEDQ7.cjs.map +1 -0
- package/dist/{chunk-CMHMR5VO.js → chunk-6HAHSSPW.js} +158 -168
- package/dist/chunk-6HAHSSPW.js.map +1 -0
- package/dist/{chunk-UA542GT3.cjs → chunk-GNH5XC6D.cjs} +43 -43
- package/dist/{chunk-UA542GT3.cjs.map → chunk-GNH5XC6D.cjs.map} +1 -1
- package/dist/{chunk-JKE6SULM.js → chunk-H2JBS7HM.js} +163 -68
- package/dist/chunk-H2JBS7HM.js.map +1 -0
- package/dist/{chunk-J2S3DPDR.cjs → chunk-JIZGCEPE.cjs} +216 -226
- package/dist/chunk-JIZGCEPE.cjs.map +1 -0
- package/dist/{chunk-MOPKHYYU.cjs → chunk-NJI6PJFZ.cjs} +6 -6
- package/dist/{chunk-MOPKHYYU.cjs.map → chunk-NJI6PJFZ.cjs.map} +1 -1
- package/dist/{chunk-HZM7GDOT.cjs → chunk-RQ3KKMTP.cjs} +4 -4
- package/dist/{chunk-HZM7GDOT.cjs.map → chunk-RQ3KKMTP.cjs.map} +1 -1
- package/dist/{chunk-WLWELSA2.js → chunk-UK7MXVS2.js} +2 -2
- package/dist/{chunk-RA2L3FQW.js → chunk-Y5TD53QE.js} +2 -2
- package/dist/cloudflare.cjs +60 -60
- package/dist/cloudflare.js +3 -3
- package/dist/index.cjs +5 -5
- package/dist/index.js +3 -3
- package/dist/pg.cjs +37 -37
- package/dist/pg.js +3 -3
- package/dist/postgresql.cjs +4 -4
- package/dist/postgresql.js +3 -3
- package/dist/sqlite.cjs +4 -4
- package/dist/sqlite.d.cts +16 -15
- package/dist/sqlite.d.ts +16 -15
- package/dist/sqlite.js +3 -3
- package/dist/sqlite3.cjs +29 -29
- package/dist/sqlite3.js +3 -3
- package/package.json +15 -14
- package/dist/chunk-CMHMR5VO.js.map +0 -1
- package/dist/chunk-GVR3PSDL.cjs.map +0 -1
- package/dist/chunk-J2S3DPDR.cjs.map +0 -1
- package/dist/chunk-JKE6SULM.js.map +0 -1
- /package/dist/{chunk-4SM4JJJZ.js.map → chunk-33P5766L.js.map} +0 -0
- /package/dist/{chunk-WLWELSA2.js.map → chunk-UK7MXVS2.js.map} +0 -0
- /package/dist/{chunk-RA2L3FQW.js.map → chunk-Y5TD53QE.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SQL,
|
|
3
3
|
exists
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-H2JBS7HM.js";
|
|
5
5
|
|
|
6
6
|
// src/storage/postgresql/core/connections/connectionString.ts
|
|
7
7
|
var defaultPostgreSQLConnectionString = "postgresql://postgres@localhost:5432/postgres";
|
|
@@ -80,4 +80,4 @@ export {
|
|
|
80
80
|
functionExists,
|
|
81
81
|
postgreSQLMetadata
|
|
82
82
|
};
|
|
83
|
-
//# sourceMappingURL=chunk-
|
|
83
|
+
//# sourceMappingURL=chunk-33P5766L.js.map
|
|
@@ -2180,6 +2180,9 @@ var createConnection = (options) => {
|
|
|
2180
2180
|
return typedConnection;
|
|
2181
2181
|
};
|
|
2182
2182
|
|
|
2183
|
+
// src/core/taskProcessing/executionGuards.ts
|
|
2184
|
+
var _uuid = require('uuid');
|
|
2185
|
+
|
|
2183
2186
|
// src/core/taskProcessing/taskProcessor.ts
|
|
2184
2187
|
var TaskProcessor = (_class20 = class {
|
|
2185
2188
|
__init() {this.queue = []}
|
|
@@ -2187,10 +2190,14 @@ var TaskProcessor = (_class20 = class {
|
|
|
2187
2190
|
__init3() {this.activeTasks = 0}
|
|
2188
2191
|
__init4() {this.activeGroups = /* @__PURE__ */ new Set()}
|
|
2189
2192
|
|
|
2190
|
-
|
|
2193
|
+
__init5() {this.stopped = false}
|
|
2194
|
+
constructor(options) {;_class20.prototype.__init.call(this);_class20.prototype.__init2.call(this);_class20.prototype.__init3.call(this);_class20.prototype.__init4.call(this);_class20.prototype.__init5.call(this);_class20.prototype.__init6.call(this);_class20.prototype.__init7.call(this);
|
|
2191
2195
|
this.options = options;
|
|
2192
2196
|
}
|
|
2193
2197
|
enqueue(task, options) {
|
|
2198
|
+
if (this.stopped) {
|
|
2199
|
+
return Promise.reject(new DumboError("TaskProcessor has been stopped"));
|
|
2200
|
+
}
|
|
2194
2201
|
if (this.queue.length >= this.options.maxQueueSize) {
|
|
2195
2202
|
return Promise.reject(
|
|
2196
2203
|
new TransientDatabaseError(
|
|
@@ -2203,6 +2210,15 @@ var TaskProcessor = (_class20 = class {
|
|
|
2203
2210
|
waitForEndOfProcessing() {
|
|
2204
2211
|
return this.schedule(({ ack }) => Promise.resolve(ack()));
|
|
2205
2212
|
}
|
|
2213
|
+
async stop(options) {
|
|
2214
|
+
if (this.stopped) return;
|
|
2215
|
+
this.stopped = true;
|
|
2216
|
+
this.queue.length = 0;
|
|
2217
|
+
this.activeGroups.clear();
|
|
2218
|
+
if (!_optionalChain([options, 'optionalAccess', _46 => _46.force])) {
|
|
2219
|
+
await this.waitForEndOfProcessing();
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2206
2222
|
schedule(task, options) {
|
|
2207
2223
|
return promiseWithDeadline(
|
|
2208
2224
|
(resolve, reject) => {
|
|
@@ -2235,7 +2251,7 @@ var TaskProcessor = (_class20 = class {
|
|
|
2235
2251
|
while (this.activeTasks < this.options.maxActiveTasks && this.queue.length > 0) {
|
|
2236
2252
|
const item = this.takeFirstAvailableItem();
|
|
2237
2253
|
if (item === null) return;
|
|
2238
|
-
const groupId = _optionalChain([item, 'access',
|
|
2254
|
+
const groupId = _optionalChain([item, 'access', _47 => _47.options, 'optionalAccess', _48 => _48.taskGroupId]);
|
|
2239
2255
|
if (groupId) {
|
|
2240
2256
|
this.activeGroups.add(groupId);
|
|
2241
2257
|
}
|
|
@@ -2263,9 +2279,9 @@ var TaskProcessor = (_class20 = class {
|
|
|
2263
2279
|
this.ensureProcessing();
|
|
2264
2280
|
}
|
|
2265
2281
|
}
|
|
2266
|
-
|
|
2282
|
+
__init6() {this.takeFirstAvailableItem = () => {
|
|
2267
2283
|
const taskIndex = this.queue.findIndex(
|
|
2268
|
-
(item2) => !_optionalChain([item2, 'access',
|
|
2284
|
+
(item2) => !_optionalChain([item2, 'access', _49 => _49.options, 'optionalAccess', _50 => _50.taskGroupId]) || !this.activeGroups.has(item2.options.taskGroupId)
|
|
2269
2285
|
);
|
|
2270
2286
|
if (taskIndex === -1) {
|
|
2271
2287
|
return null;
|
|
@@ -2273,31 +2289,153 @@ var TaskProcessor = (_class20 = class {
|
|
|
2273
2289
|
const [item] = this.queue.splice(taskIndex, 1);
|
|
2274
2290
|
return _nullishCoalesce(item, () => ( null));
|
|
2275
2291
|
}}
|
|
2276
|
-
|
|
2277
|
-
(item) => !_optionalChain([item, 'access',
|
|
2292
|
+
__init7() {this.hasItemsToProcess = () => this.queue.findIndex(
|
|
2293
|
+
(item) => !_optionalChain([item, 'access', _51 => _51.options, 'optionalAccess', _52 => _52.taskGroupId]) || !this.activeGroups.has(item.options.taskGroupId)
|
|
2278
2294
|
) !== -1}
|
|
2279
2295
|
}, _class20);
|
|
2280
2296
|
var DEFAULT_PROMISE_DEADLINE = 2147483647;
|
|
2281
2297
|
var promiseWithDeadline = (executor, options) => {
|
|
2282
2298
|
return new Promise((resolve, reject) => {
|
|
2283
2299
|
let taskStarted = false;
|
|
2284
|
-
|
|
2285
|
-
|
|
2300
|
+
let timeoutId = null;
|
|
2301
|
+
const deadline = _nullishCoalesce(options.deadline, () => ( DEFAULT_PROMISE_DEADLINE));
|
|
2302
|
+
timeoutId = setTimeout(() => {
|
|
2286
2303
|
if (!taskStarted) {
|
|
2287
2304
|
reject(
|
|
2288
2305
|
new Error("Task was not started within the maximum waiting time")
|
|
2289
2306
|
);
|
|
2290
2307
|
}
|
|
2291
|
-
},
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2308
|
+
}, deadline);
|
|
2309
|
+
timeoutId.unref();
|
|
2310
|
+
executor(
|
|
2311
|
+
(value) => {
|
|
2312
|
+
taskStarted = true;
|
|
2313
|
+
if (timeoutId) {
|
|
2314
|
+
clearTimeout(timeoutId);
|
|
2315
|
+
}
|
|
2316
|
+
timeoutId = null;
|
|
2317
|
+
resolve(value);
|
|
2318
|
+
},
|
|
2319
|
+
(reason) => {
|
|
2320
|
+
if (timeoutId) {
|
|
2321
|
+
clearTimeout(timeoutId);
|
|
2322
|
+
}
|
|
2323
|
+
timeoutId = null;
|
|
2324
|
+
reject(reason);
|
|
2325
|
+
}
|
|
2326
|
+
);
|
|
2327
|
+
});
|
|
2328
|
+
};
|
|
2329
|
+
|
|
2330
|
+
// src/core/taskProcessing/executionGuards.ts
|
|
2331
|
+
var guardBoundedAccess = (getResource, options) => {
|
|
2332
|
+
let isStopped = false;
|
|
2333
|
+
const taskProcessor = new TaskProcessor({
|
|
2334
|
+
maxActiveTasks: options.maxResources,
|
|
2335
|
+
maxQueueSize: _nullishCoalesce(options.maxQueueSize, () => ( 1e3))
|
|
2336
|
+
});
|
|
2337
|
+
const resourcePool = [];
|
|
2338
|
+
const allResources = /* @__PURE__ */ new Set();
|
|
2339
|
+
const ackCallbacks = /* @__PURE__ */ new Map();
|
|
2340
|
+
const acquire = async () => taskProcessor.enqueue(async ({ ack }) => {
|
|
2341
|
+
try {
|
|
2342
|
+
let resource;
|
|
2343
|
+
if (options.reuseResources) {
|
|
2344
|
+
resource = resourcePool.pop();
|
|
2345
|
+
}
|
|
2346
|
+
if (!resource) {
|
|
2347
|
+
resource = await getResource();
|
|
2348
|
+
allResources.add(resource);
|
|
2349
|
+
}
|
|
2350
|
+
ackCallbacks.set(resource, ack);
|
|
2351
|
+
return resource;
|
|
2352
|
+
} catch (e) {
|
|
2353
|
+
ack();
|
|
2354
|
+
throw e;
|
|
2355
|
+
}
|
|
2356
|
+
});
|
|
2357
|
+
const release = (resource) => {
|
|
2358
|
+
const ack = ackCallbacks.get(resource);
|
|
2359
|
+
if (ack) {
|
|
2360
|
+
ackCallbacks.delete(resource);
|
|
2361
|
+
if (options.reuseResources) {
|
|
2362
|
+
resourcePool.push(resource);
|
|
2363
|
+
}
|
|
2364
|
+
ack();
|
|
2365
|
+
}
|
|
2366
|
+
};
|
|
2367
|
+
const execute = async (operation) => {
|
|
2368
|
+
const resource = await acquire();
|
|
2369
|
+
try {
|
|
2370
|
+
return await operation(resource);
|
|
2371
|
+
} finally {
|
|
2372
|
+
release(resource);
|
|
2373
|
+
}
|
|
2374
|
+
};
|
|
2375
|
+
return {
|
|
2376
|
+
acquire,
|
|
2377
|
+
release,
|
|
2378
|
+
execute,
|
|
2379
|
+
waitForIdle: () => taskProcessor.waitForEndOfProcessing(),
|
|
2380
|
+
stop: async (stopOptions) => {
|
|
2381
|
+
if (isStopped) return;
|
|
2382
|
+
isStopped = true;
|
|
2383
|
+
if (_optionalChain([options, 'optionalAccess', _53 => _53.closeResource])) {
|
|
2384
|
+
const resources = [...allResources];
|
|
2385
|
+
allResources.clear();
|
|
2386
|
+
resourcePool.length = 0;
|
|
2387
|
+
await Promise.all(
|
|
2388
|
+
resources.map(
|
|
2389
|
+
async (resource) => await options.closeResource(resource)
|
|
2390
|
+
)
|
|
2391
|
+
);
|
|
2296
2392
|
}
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2393
|
+
await taskProcessor.stop(stopOptions);
|
|
2394
|
+
}
|
|
2395
|
+
};
|
|
2396
|
+
};
|
|
2397
|
+
var guardInitializedOnce = (initialize, options) => {
|
|
2398
|
+
let initPromise = null;
|
|
2399
|
+
const taskProcessor = new TaskProcessor({
|
|
2400
|
+
maxActiveTasks: 1,
|
|
2401
|
+
maxQueueSize: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _54 => _54.maxQueueSize]), () => ( 1e3))
|
|
2300
2402
|
});
|
|
2403
|
+
const ensureInitialized = async (retryCount = 0) => {
|
|
2404
|
+
if (initPromise !== null) {
|
|
2405
|
+
return initPromise;
|
|
2406
|
+
}
|
|
2407
|
+
return taskProcessor.enqueue(
|
|
2408
|
+
async ({ ack }) => {
|
|
2409
|
+
if (initPromise !== null) {
|
|
2410
|
+
ack();
|
|
2411
|
+
return initPromise;
|
|
2412
|
+
}
|
|
2413
|
+
try {
|
|
2414
|
+
const promise = initialize();
|
|
2415
|
+
initPromise = promise;
|
|
2416
|
+
const result = await promise;
|
|
2417
|
+
ack();
|
|
2418
|
+
return result;
|
|
2419
|
+
} catch (error) {
|
|
2420
|
+
initPromise = null;
|
|
2421
|
+
ack();
|
|
2422
|
+
const maxRetries = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _55 => _55.maxRetries]), () => ( 3));
|
|
2423
|
+
if (retryCount < maxRetries) {
|
|
2424
|
+
return ensureInitialized(retryCount + 1);
|
|
2425
|
+
}
|
|
2426
|
+
throw error;
|
|
2427
|
+
}
|
|
2428
|
+
},
|
|
2429
|
+
{ taskGroupId: _uuid.v7.call(void 0, ) }
|
|
2430
|
+
);
|
|
2431
|
+
};
|
|
2432
|
+
return {
|
|
2433
|
+
ensureInitialized,
|
|
2434
|
+
reset: () => {
|
|
2435
|
+
initPromise = null;
|
|
2436
|
+
},
|
|
2437
|
+
stop: (options2) => taskProcessor.stop(options2)
|
|
2438
|
+
};
|
|
2301
2439
|
};
|
|
2302
2440
|
|
|
2303
2441
|
// src/core/connections/pool.ts
|
|
@@ -2352,67 +2490,29 @@ var createSingletonConnectionPool = (options) => {
|
|
|
2352
2490
|
};
|
|
2353
2491
|
return result;
|
|
2354
2492
|
};
|
|
2355
|
-
var memoizeConnection = (fn) => {
|
|
2356
|
-
let promise = null;
|
|
2357
|
-
return () => {
|
|
2358
|
-
if (!promise) {
|
|
2359
|
-
promise = Promise.resolve(fn()).catch((err) => {
|
|
2360
|
-
promise = null;
|
|
2361
|
-
throw err;
|
|
2362
|
-
});
|
|
2363
|
-
}
|
|
2364
|
-
return promise;
|
|
2365
|
-
};
|
|
2366
|
-
};
|
|
2367
2493
|
var createBoundedConnectionPool = (options) => {
|
|
2368
2494
|
const { driverType, maxConnections } = options;
|
|
2369
|
-
const
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
const taskProcessor = new TaskProcessor({
|
|
2373
|
-
maxActiveTasks: maxConnections,
|
|
2374
|
-
maxQueueSize: 1e3
|
|
2495
|
+
const guardMaxConnections = guardBoundedAccess(options.getConnection, {
|
|
2496
|
+
maxResources: maxConnections,
|
|
2497
|
+
reuseResources: true
|
|
2375
2498
|
});
|
|
2376
|
-
const ackCallbacks = /* @__PURE__ */ new Map();
|
|
2377
2499
|
let closed = false;
|
|
2378
|
-
const acquire = async () => {
|
|
2379
|
-
if (closed) throw new DumboError("Connection pool is closed");
|
|
2380
|
-
return taskProcessor.enqueue(async ({ ack }) => {
|
|
2381
|
-
try {
|
|
2382
|
-
let conn = pool.pop();
|
|
2383
|
-
if (!conn) {
|
|
2384
|
-
conn = await getConnection();
|
|
2385
|
-
allConnections.add(conn);
|
|
2386
|
-
}
|
|
2387
|
-
ackCallbacks.set(conn, ack);
|
|
2388
|
-
return conn;
|
|
2389
|
-
} catch (e) {
|
|
2390
|
-
ack();
|
|
2391
|
-
throw e;
|
|
2392
|
-
}
|
|
2393
|
-
});
|
|
2394
|
-
};
|
|
2395
|
-
const release = (conn) => {
|
|
2396
|
-
const ack = ackCallbacks.get(conn);
|
|
2397
|
-
if (ack) {
|
|
2398
|
-
ackCallbacks.delete(conn);
|
|
2399
|
-
pool.push(conn);
|
|
2400
|
-
ack();
|
|
2401
|
-
}
|
|
2402
|
-
};
|
|
2403
2500
|
const executeWithPooling = async (operation) => {
|
|
2404
|
-
const conn = await acquire();
|
|
2501
|
+
const conn = await guardMaxConnections.acquire();
|
|
2405
2502
|
try {
|
|
2406
2503
|
return await operation(conn);
|
|
2407
2504
|
} finally {
|
|
2408
|
-
release(conn);
|
|
2505
|
+
guardMaxConnections.release(conn);
|
|
2409
2506
|
}
|
|
2410
2507
|
};
|
|
2411
2508
|
return {
|
|
2412
2509
|
driverType,
|
|
2413
2510
|
connection: async () => {
|
|
2414
|
-
const conn = await acquire();
|
|
2415
|
-
return wrapPooledConnection(
|
|
2511
|
+
const conn = await guardMaxConnections.acquire();
|
|
2512
|
+
return wrapPooledConnection(
|
|
2513
|
+
conn,
|
|
2514
|
+
() => Promise.resolve(guardMaxConnections.release(conn))
|
|
2515
|
+
);
|
|
2416
2516
|
},
|
|
2417
2517
|
execute: {
|
|
2418
2518
|
query: (sql, opts) => executeWithPooling((c) => c.execute.query(sql, opts)),
|
|
@@ -2423,18 +2523,13 @@ var createBoundedConnectionPool = (options) => {
|
|
|
2423
2523
|
withConnection: executeWithPooling,
|
|
2424
2524
|
...transactionFactoryWithAsyncAmbientConnection(
|
|
2425
2525
|
driverType,
|
|
2426
|
-
acquire,
|
|
2427
|
-
release
|
|
2526
|
+
guardMaxConnections.acquire,
|
|
2527
|
+
guardMaxConnections.release
|
|
2428
2528
|
),
|
|
2429
2529
|
close: async () => {
|
|
2430
2530
|
if (closed) return;
|
|
2431
2531
|
closed = true;
|
|
2432
|
-
|
|
2433
|
-
ackCallbacks.clear();
|
|
2434
|
-
const connections = [...allConnections];
|
|
2435
|
-
allConnections.clear();
|
|
2436
|
-
pool.length = 0;
|
|
2437
|
-
await Promise.all(connections.map((conn) => conn.close()));
|
|
2532
|
+
await guardMaxConnections.stop({ force: true });
|
|
2438
2533
|
}
|
|
2439
2534
|
};
|
|
2440
2535
|
};
|
|
@@ -2506,28 +2601,28 @@ var runSQLMigrations = (pool, migrations, partialOptions) => pool.withTransactio
|
|
|
2506
2601
|
...partialOptions,
|
|
2507
2602
|
schema: {
|
|
2508
2603
|
...defaultOptions.schema,
|
|
2509
|
-
..._nullishCoalesce(_optionalChain([partialOptions, 'optionalAccess',
|
|
2604
|
+
..._nullishCoalesce(_optionalChain([partialOptions, 'optionalAccess', _56 => _56.schema]), () => ( {}))
|
|
2510
2605
|
},
|
|
2511
2606
|
lock: {
|
|
2512
2607
|
...defaultOptions.lock,
|
|
2513
|
-
..._optionalChain([partialOptions, 'optionalAccess',
|
|
2608
|
+
..._optionalChain([partialOptions, 'optionalAccess', _57 => _57.lock]),
|
|
2514
2609
|
options: {
|
|
2515
2610
|
lockId: MIGRATIONS_LOCK_ID,
|
|
2516
|
-
..._optionalChain([defaultOptions, 'access',
|
|
2517
|
-
..._optionalChain([partialOptions, 'optionalAccess',
|
|
2611
|
+
..._optionalChain([defaultOptions, 'access', _58 => _58.lock, 'optionalAccess', _59 => _59.options]),
|
|
2612
|
+
..._optionalChain([partialOptions, 'optionalAccess', _60 => _60.lock, 'optionalAccess', _61 => _61.options])
|
|
2518
2613
|
}
|
|
2519
2614
|
},
|
|
2520
|
-
dryRun: _nullishCoalesce(defaultOptions.dryRun, () => ( _optionalChain([partialOptions, 'optionalAccess',
|
|
2521
|
-
ignoreMigrationHashMismatch: _nullishCoalesce(defaultOptions.ignoreMigrationHashMismatch, () => ( _optionalChain([partialOptions, 'optionalAccess',
|
|
2522
|
-
migrationTimeoutMs: _nullishCoalesce(defaultOptions.migrationTimeoutMs, () => ( _optionalChain([partialOptions, 'optionalAccess',
|
|
2615
|
+
dryRun: _nullishCoalesce(defaultOptions.dryRun, () => ( _optionalChain([partialOptions, 'optionalAccess', _62 => _62.dryRun]))),
|
|
2616
|
+
ignoreMigrationHashMismatch: _nullishCoalesce(defaultOptions.ignoreMigrationHashMismatch, () => ( _optionalChain([partialOptions, 'optionalAccess', _63 => _63.ignoreMigrationHashMismatch]))),
|
|
2617
|
+
migrationTimeoutMs: _nullishCoalesce(defaultOptions.migrationTimeoutMs, () => ( _optionalChain([partialOptions, 'optionalAccess', _64 => _64.migrationTimeoutMs])))
|
|
2523
2618
|
};
|
|
2524
2619
|
const { databaseLock: _, ...rest } = _nullishCoalesce(options.lock, () => ( {}));
|
|
2525
|
-
const databaseLock = _nullishCoalesce(_optionalChain([options, 'access',
|
|
2620
|
+
const databaseLock = _nullishCoalesce(_optionalChain([options, 'access', _65 => _65.lock, 'optionalAccess', _66 => _66.databaseLock]), () => ( NoDatabaseLock));
|
|
2526
2621
|
const lockOptions = {
|
|
2527
2622
|
lockId: MIGRATIONS_LOCK_ID,
|
|
2528
2623
|
...rest
|
|
2529
2624
|
};
|
|
2530
|
-
const migrationTable = _nullishCoalesce(_optionalChain([options, 'access',
|
|
2625
|
+
const migrationTable = _nullishCoalesce(_optionalChain([options, 'access', _67 => _67.schema, 'optionalAccess', _68 => _68.migrationTable]), () => ( migrationTableSchemaComponent));
|
|
2531
2626
|
const coreMigrations = migrationTable.migrations;
|
|
2532
2627
|
const result = { applied: [], skipped: [] };
|
|
2533
2628
|
await databaseLock.withAcquire(
|
|
@@ -2578,7 +2673,7 @@ var runSQLMigration = async (databaseType, execute, migration, options) => {
|
|
|
2578
2673
|
});
|
|
2579
2674
|
return false;
|
|
2580
2675
|
}
|
|
2581
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
2676
|
+
if (_optionalChain([options, 'optionalAccess', _69 => _69.ignoreMigrationHashMismatch]) !== true)
|
|
2582
2677
|
throw new Error(
|
|
2583
2678
|
`Migration hash mismatch for "${migration.name}". Aborting migration.`
|
|
2584
2679
|
);
|
|
@@ -2591,7 +2686,7 @@ var runSQLMigration = async (databaseType, execute, migration, options) => {
|
|
|
2591
2686
|
return false;
|
|
2592
2687
|
}
|
|
2593
2688
|
await execute.batchCommand(sqls, {
|
|
2594
|
-
timeoutMs: _optionalChain([options, 'optionalAccess',
|
|
2689
|
+
timeoutMs: _optionalChain([options, 'optionalAccess', _70 => _70.migrationTimeoutMs])
|
|
2595
2690
|
});
|
|
2596
2691
|
await recordMigration(execute, newMigration);
|
|
2597
2692
|
return true;
|
|
@@ -2845,5 +2940,5 @@ var SchemaComponentMigrator = (component, dumbo) => {
|
|
|
2845
2940
|
|
|
2846
2941
|
|
|
2847
2942
|
|
|
2848
|
-
exports.schemaComponent = schemaComponent; exports.isSchemaComponentOfType = isSchemaComponentOfType; exports.filterSchemaComponentsOfType = filterSchemaComponentsOfType; exports.mapSchemaComponentsOfType = mapSchemaComponentsOfType; exports.findSchemaComponentsOfType = findSchemaComponentsOfType; exports.ColumnURNType = ColumnURNType; exports.ColumnURN = ColumnURN; exports.columnSchemaComponent = columnSchemaComponent; exports.IndexURNType = IndexURNType; exports.IndexURN = IndexURN; exports.indexSchemaComponent = indexSchemaComponent; exports.TableURNType = TableURNType; exports.TableURN = TableURN; exports.tableSchemaComponent = tableSchemaComponent; exports.DatabaseSchemaURNType = DatabaseSchemaURNType; exports.DatabaseSchemaURN = DatabaseSchemaURN; exports.databaseSchemaSchemaComponent = databaseSchemaSchemaComponent; exports.DatabaseURNType = DatabaseURNType; exports.DatabaseURN = DatabaseURN; exports.databaseSchemaComponent = databaseSchemaComponent; exports.relationship = relationship; exports.schemaComponentURN = schemaComponentURN; exports.canHandleDriverWithConnectionString = canHandleDriverWithConnectionString; exports.DumboDatabaseDriverRegistry = DumboDatabaseDriverRegistry; exports.dumboDatabaseDriverRegistry = dumboDatabaseDriverRegistry; exports.toDatabaseDriverType = toDatabaseDriverType; exports.fromDatabaseDriverType = fromDatabaseDriverType; exports.getDatabaseDriverName = getDatabaseDriverName; exports.getDatabaseType = getDatabaseType; exports.DumboDatabaseMetadataRegistry = DumboDatabaseMetadataRegistry; exports.dumboDatabaseMetadataRegistry = dumboDatabaseMetadataRegistry; exports.getDatabaseMetadata = getDatabaseMetadata; exports.resolveDatabaseMetadata = resolveDatabaseMetadata; exports.getDefaultDatabase = getDefaultDatabase; exports.getDefaultDatabaseAsync = getDefaultDatabaseAsync; exports.dumboSchema = dumboSchema; exports.defaultDatabaseLockOptions = defaultDatabaseLockOptions; exports.NoDatabaseLock = NoDatabaseLock; exports.mapRows = mapRows; exports.toCamelCase = toCamelCase; exports.mapToCamelCase = mapToCamelCase; exports.firstOrNull = firstOrNull; exports.first = first; exports.singleOrNull = singleOrNull; exports.single = single; exports.count = count; exports.exists = exists; exports.composeJSONReplacers = composeJSONReplacers; exports.composeJSONRevivers = composeJSONRevivers; exports.JSONReplacer = JSONReplacer; exports.JSONReviver = JSONReviver; exports.JSONReplacers = JSONReplacers; exports.JSONRevivers = JSONRevivers; exports.jsonSerializer = jsonSerializer; exports.JSONSerializer = JSONSerializer; exports.JSONCodec = JSONCodec; exports.ParametrizedSQLBuilder = ParametrizedSQLBuilder; exports.SQLToken = SQLToken; exports.SQLIdentifier = SQLIdentifier; exports.SQLPlain = SQLPlain; exports.SQLLiteral = SQLLiteral; exports.SQLArray = SQLArray; exports.SQLIn = SQLIn; exports.ColumnTypeToken = ColumnTypeToken; exports.SerialToken = SerialToken; exports.BigSerialToken = BigSerialToken; exports.IntegerToken = IntegerToken; exports.BigIntegerToken = BigIntegerToken; exports.JSONBToken = JSONBToken; exports.TimestampToken = TimestampToken; exports.TimestamptzToken = TimestamptzToken; exports.VarcharToken = VarcharToken; exports.AutoIncrementSQLColumnToken = AutoIncrementSQLColumnToken; exports.SQLColumnTypeTokens = SQLColumnTypeTokens; exports.SQLColumnTypeTokensFactory = SQLColumnTypeTokensFactory; exports.SQLColumnToken = SQLColumnToken; exports.SQLProcessor = SQLProcessor; exports.ExpandArrayProcessor = ExpandArrayProcessor; exports.ExpandSQLInProcessor = ExpandSQLInProcessor; exports.FormatIdentifierProcessor = FormatIdentifierProcessor; exports.MapLiteralProcessor = MapLiteralProcessor; exports.SQLProcessorsRegistry = SQLProcessorsRegistry; exports.mapDefaultSQLColumnProcessors = mapDefaultSQLColumnProcessors; exports.defaultProcessorsRegistry = defaultProcessorsRegistry; exports.TokenizedSQL = TokenizedSQL; exports.isTokenizedSQL = isTokenizedSQL; exports.SQL = SQL; exports.RawSQL = RawSQL; exports.isSQL = isSQL; exports.ansiSqlReservedMap = ansiSqlReservedMap; exports.ANSISQLParamPlaceholder = ANSISQLParamPlaceholder; exports.ANSISQLIdentifierQuote = ANSISQLIdentifierQuote; exports.mapANSISQLParamPlaceholder = mapANSISQLParamPlaceholder; exports.mapSQLIdentifier = mapSQLIdentifier; exports.DefaultMapSQLParamValueOptions = DefaultMapSQLParamValueOptions; exports.SQLValueMapper = SQLValueMapper; exports.mapSQLParamValue = mapSQLParamValue; exports.SQLFormatter = SQLFormatter; exports.registerFormatter = registerFormatter; exports.getFormatter = getFormatter; exports.formatSQL = formatSQL; exports.describeSQL = describeSQL; exports.color = color; exports.prettyJson = prettyJson; exports.tracer = tracer; exports.LogLevel = LogLevel; exports.LogStyle = LogStyle; exports.sqlMigration = sqlMigration; exports.migrationTableSchemaComponent = migrationTableSchemaComponent; exports.SchemaComponentMigrator = SchemaComponentMigrator; exports.MIGRATIONS_LOCK_ID = MIGRATIONS_LOCK_ID; exports.registerDefaultMigratorOptions = registerDefaultMigratorOptions; exports.getDefaultMigratorOptionsFromRegistry = getDefaultMigratorOptionsFromRegistry; exports.runSQLMigrations = runSQLMigrations; exports.combineMigrations = combineMigrations; exports.DumboError = DumboError; exports.ConcurrencyError = ConcurrencyError; exports.TransientDatabaseError = TransientDatabaseError; exports.ConnectionError = ConnectionError; exports.SerializationError = SerializationError; exports.DeadlockError = DeadlockError; exports.LockNotAvailableError = LockNotAvailableError; exports.InsufficientResourcesError = InsufficientResourcesError; exports.SystemError = SystemError; exports.AdminShutdownError = AdminShutdownError; exports.QueryCanceledError = QueryCanceledError; exports.IntegrityConstraintViolationError = IntegrityConstraintViolationError; exports.UniqueConstraintError = UniqueConstraintError; exports.ForeignKeyViolationError = ForeignKeyViolationError; exports.NotNullViolationError = NotNullViolationError; exports.CheckViolationError = CheckViolationError; exports.ExclusionViolationError = ExclusionViolationError; exports.DataError = DataError; exports.InvalidOperationError = InvalidOperationError; exports.mapColumnToJSON = mapColumnToJSON; exports.mapColumnToBigint = mapColumnToBigint; exports.mapColumnToDate = mapColumnToDate; exports.mapSQLQueryResult = mapSQLQueryResult; exports.BatchCommandNoChangesError = BatchCommandNoChangesError; exports.sqlExecutor = sqlExecutor; exports.sqlExecutorInNewConnection = sqlExecutorInNewConnection; exports.sqlExecutorInAmbientConnection = sqlExecutorInAmbientConnection; exports.executeInNewDbClient = executeInNewDbClient; exports.executeInNewConnection = executeInNewConnection; exports.executeInAmbientConnection = executeInAmbientConnection; exports.executeInTransaction = executeInTransaction; exports.transactionFactoryWithDbClient = transactionFactoryWithDbClient; exports.transactionFactoryWithNewConnection = transactionFactoryWithNewConnection; exports.transactionFactoryWithAmbientConnection = transactionFactoryWithAmbientConnection; exports.transactionFactoryWithAsyncAmbientConnection = transactionFactoryWithAsyncAmbientConnection; exports.createAmbientConnection = createAmbientConnection; exports.createSingletonConnection = createSingletonConnection; exports.createTransientConnection = createTransientConnection; exports.createConnection = createConnection; exports.
|
|
2849
|
-
//# sourceMappingURL=chunk-
|
|
2943
|
+
exports.schemaComponent = schemaComponent; exports.isSchemaComponentOfType = isSchemaComponentOfType; exports.filterSchemaComponentsOfType = filterSchemaComponentsOfType; exports.mapSchemaComponentsOfType = mapSchemaComponentsOfType; exports.findSchemaComponentsOfType = findSchemaComponentsOfType; exports.ColumnURNType = ColumnURNType; exports.ColumnURN = ColumnURN; exports.columnSchemaComponent = columnSchemaComponent; exports.IndexURNType = IndexURNType; exports.IndexURN = IndexURN; exports.indexSchemaComponent = indexSchemaComponent; exports.TableURNType = TableURNType; exports.TableURN = TableURN; exports.tableSchemaComponent = tableSchemaComponent; exports.DatabaseSchemaURNType = DatabaseSchemaURNType; exports.DatabaseSchemaURN = DatabaseSchemaURN; exports.databaseSchemaSchemaComponent = databaseSchemaSchemaComponent; exports.DatabaseURNType = DatabaseURNType; exports.DatabaseURN = DatabaseURN; exports.databaseSchemaComponent = databaseSchemaComponent; exports.relationship = relationship; exports.schemaComponentURN = schemaComponentURN; exports.canHandleDriverWithConnectionString = canHandleDriverWithConnectionString; exports.DumboDatabaseDriverRegistry = DumboDatabaseDriverRegistry; exports.dumboDatabaseDriverRegistry = dumboDatabaseDriverRegistry; exports.toDatabaseDriverType = toDatabaseDriverType; exports.fromDatabaseDriverType = fromDatabaseDriverType; exports.getDatabaseDriverName = getDatabaseDriverName; exports.getDatabaseType = getDatabaseType; exports.DumboDatabaseMetadataRegistry = DumboDatabaseMetadataRegistry; exports.dumboDatabaseMetadataRegistry = dumboDatabaseMetadataRegistry; exports.getDatabaseMetadata = getDatabaseMetadata; exports.resolveDatabaseMetadata = resolveDatabaseMetadata; exports.getDefaultDatabase = getDefaultDatabase; exports.getDefaultDatabaseAsync = getDefaultDatabaseAsync; exports.dumboSchema = dumboSchema; exports.defaultDatabaseLockOptions = defaultDatabaseLockOptions; exports.NoDatabaseLock = NoDatabaseLock; exports.mapRows = mapRows; exports.toCamelCase = toCamelCase; exports.mapToCamelCase = mapToCamelCase; exports.firstOrNull = firstOrNull; exports.first = first; exports.singleOrNull = singleOrNull; exports.single = single; exports.count = count; exports.exists = exists; exports.composeJSONReplacers = composeJSONReplacers; exports.composeJSONRevivers = composeJSONRevivers; exports.JSONReplacer = JSONReplacer; exports.JSONReviver = JSONReviver; exports.JSONReplacers = JSONReplacers; exports.JSONRevivers = JSONRevivers; exports.jsonSerializer = jsonSerializer; exports.JSONSerializer = JSONSerializer; exports.JSONCodec = JSONCodec; exports.ParametrizedSQLBuilder = ParametrizedSQLBuilder; exports.SQLToken = SQLToken; exports.SQLIdentifier = SQLIdentifier; exports.SQLPlain = SQLPlain; exports.SQLLiteral = SQLLiteral; exports.SQLArray = SQLArray; exports.SQLIn = SQLIn; exports.ColumnTypeToken = ColumnTypeToken; exports.SerialToken = SerialToken; exports.BigSerialToken = BigSerialToken; exports.IntegerToken = IntegerToken; exports.BigIntegerToken = BigIntegerToken; exports.JSONBToken = JSONBToken; exports.TimestampToken = TimestampToken; exports.TimestamptzToken = TimestamptzToken; exports.VarcharToken = VarcharToken; exports.AutoIncrementSQLColumnToken = AutoIncrementSQLColumnToken; exports.SQLColumnTypeTokens = SQLColumnTypeTokens; exports.SQLColumnTypeTokensFactory = SQLColumnTypeTokensFactory; exports.SQLColumnToken = SQLColumnToken; exports.SQLProcessor = SQLProcessor; exports.ExpandArrayProcessor = ExpandArrayProcessor; exports.ExpandSQLInProcessor = ExpandSQLInProcessor; exports.FormatIdentifierProcessor = FormatIdentifierProcessor; exports.MapLiteralProcessor = MapLiteralProcessor; exports.SQLProcessorsRegistry = SQLProcessorsRegistry; exports.mapDefaultSQLColumnProcessors = mapDefaultSQLColumnProcessors; exports.defaultProcessorsRegistry = defaultProcessorsRegistry; exports.TokenizedSQL = TokenizedSQL; exports.isTokenizedSQL = isTokenizedSQL; exports.SQL = SQL; exports.RawSQL = RawSQL; exports.isSQL = isSQL; exports.ansiSqlReservedMap = ansiSqlReservedMap; exports.ANSISQLParamPlaceholder = ANSISQLParamPlaceholder; exports.ANSISQLIdentifierQuote = ANSISQLIdentifierQuote; exports.mapANSISQLParamPlaceholder = mapANSISQLParamPlaceholder; exports.mapSQLIdentifier = mapSQLIdentifier; exports.DefaultMapSQLParamValueOptions = DefaultMapSQLParamValueOptions; exports.SQLValueMapper = SQLValueMapper; exports.mapSQLParamValue = mapSQLParamValue; exports.SQLFormatter = SQLFormatter; exports.registerFormatter = registerFormatter; exports.getFormatter = getFormatter; exports.formatSQL = formatSQL; exports.describeSQL = describeSQL; exports.color = color; exports.prettyJson = prettyJson; exports.tracer = tracer; exports.LogLevel = LogLevel; exports.LogStyle = LogStyle; exports.sqlMigration = sqlMigration; exports.migrationTableSchemaComponent = migrationTableSchemaComponent; exports.SchemaComponentMigrator = SchemaComponentMigrator; exports.MIGRATIONS_LOCK_ID = MIGRATIONS_LOCK_ID; exports.registerDefaultMigratorOptions = registerDefaultMigratorOptions; exports.getDefaultMigratorOptionsFromRegistry = getDefaultMigratorOptionsFromRegistry; exports.runSQLMigrations = runSQLMigrations; exports.combineMigrations = combineMigrations; exports.DumboError = DumboError; exports.ConcurrencyError = ConcurrencyError; exports.TransientDatabaseError = TransientDatabaseError; exports.ConnectionError = ConnectionError; exports.SerializationError = SerializationError; exports.DeadlockError = DeadlockError; exports.LockNotAvailableError = LockNotAvailableError; exports.InsufficientResourcesError = InsufficientResourcesError; exports.SystemError = SystemError; exports.AdminShutdownError = AdminShutdownError; exports.QueryCanceledError = QueryCanceledError; exports.IntegrityConstraintViolationError = IntegrityConstraintViolationError; exports.UniqueConstraintError = UniqueConstraintError; exports.ForeignKeyViolationError = ForeignKeyViolationError; exports.NotNullViolationError = NotNullViolationError; exports.CheckViolationError = CheckViolationError; exports.ExclusionViolationError = ExclusionViolationError; exports.DataError = DataError; exports.InvalidOperationError = InvalidOperationError; exports.mapColumnToJSON = mapColumnToJSON; exports.mapColumnToBigint = mapColumnToBigint; exports.mapColumnToDate = mapColumnToDate; exports.mapSQLQueryResult = mapSQLQueryResult; exports.BatchCommandNoChangesError = BatchCommandNoChangesError; exports.sqlExecutor = sqlExecutor; exports.sqlExecutorInNewConnection = sqlExecutorInNewConnection; exports.sqlExecutorInAmbientConnection = sqlExecutorInAmbientConnection; exports.executeInNewDbClient = executeInNewDbClient; exports.executeInNewConnection = executeInNewConnection; exports.executeInAmbientConnection = executeInAmbientConnection; exports.executeInTransaction = executeInTransaction; exports.transactionFactoryWithDbClient = transactionFactoryWithDbClient; exports.transactionFactoryWithNewConnection = transactionFactoryWithNewConnection; exports.transactionFactoryWithAmbientConnection = transactionFactoryWithAmbientConnection; exports.transactionFactoryWithAsyncAmbientConnection = transactionFactoryWithAsyncAmbientConnection; exports.createAmbientConnection = createAmbientConnection; exports.createSingletonConnection = createSingletonConnection; exports.createTransientConnection = createTransientConnection; exports.createConnection = createConnection; exports.guardInitializedOnce = guardInitializedOnce; exports.createAmbientConnectionPool = createAmbientConnectionPool; exports.createSingletonConnectionPool = createSingletonConnectionPool; exports.createBoundedConnectionPool = createBoundedConnectionPool; exports.createSingletonClientConnectionPool = createSingletonClientConnectionPool; exports.createAlwaysNewConnectionPool = createAlwaysNewConnectionPool; exports.createConnectionPool = createConnectionPool;
|
|
2944
|
+
//# sourceMappingURL=chunk-4MMMEDQ7.cjs.map
|