orange-orm 4.9.0 → 4.10.0-beta.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/README.md +120 -0
- package/deno.lock +76 -0
- package/dist/index.browser.mjs +192 -56
- package/dist/index.mjs +292 -179
- package/docs/changelog.md +2 -0
- package/other.db +0 -0
- package/package.json +1 -1
- package/src/bunPg/newDatabase.js +3 -14
- package/src/bunPg/newTransaction.js +1 -0
- package/src/bunSqlite/newDatabase.js +22 -13
- package/src/bunSqlite/newTransaction.js +1 -0
- package/src/client/index.js +8 -1
- package/src/client/netAdapter.js +13 -2
- package/src/d1/newDatabase.js +3 -13
- package/src/d1/newTransaction.js +1 -0
- package/src/getTSDefinition.js +14 -1
- package/src/hostExpress.js +8 -3
- package/src/hostLocal.js +66 -6
- package/src/map2.d.ts +18 -1
- package/src/mssql/newDatabase.js +3 -13
- package/src/mssql/newTransaction.js +1 -0
- package/src/mySql/newDatabase.js +3 -13
- package/src/mySql/newTransaction.js +1 -0
- package/src/nodeSqlite/newDatabase.js +29 -18
- package/src/nodeSqlite/newTransaction.js +1 -0
- package/src/oracle/newDatabase.js +3 -13
- package/src/oracle/newTransaction.js +1 -0
- package/src/pg/newDatabase.js +4 -16
- package/src/pg/newTransaction.js +1 -0
- package/src/pglite/newDatabase.js +3 -14
- package/src/pglite/newTransaction.js +1 -0
- package/src/sap/newDatabase.js +3 -13
- package/src/sap/newTransaction.js +1 -0
- package/src/sqlite3/newDatabase.js +22 -13
- package/src/sqlite3/newTransaction.js +1 -0
- package/src/sqliteFunction.js +20 -0
- package/src/table/begin.js +0 -1
- package/src/table/commit.js +21 -1
- package/src/table/query/singleQuery/joinSql/newShallowJoinSqlCore.js +6 -4
- package/src/table/rollback.js +22 -2
- package/src/tedious/newDatabase.js +3 -13
- package/src/tedious/newTransaction.js +1 -0
package/dist/index.mjs
CHANGED
|
@@ -466,6 +466,7 @@ export interface ExpressConfig {
|
|
|
466
466
|
concurrency?: Concurrency;
|
|
467
467
|
readonly?: boolean;
|
|
468
468
|
disableBulkDeletes?: boolean;
|
|
469
|
+
hooks?: ExpressHooks;
|
|
469
470
|
}
|
|
470
471
|
|
|
471
472
|
export interface ExpressContext {
|
|
@@ -474,6 +475,18 @@ export interface ExpressContext {
|
|
|
474
475
|
client: RdbClient;
|
|
475
476
|
}
|
|
476
477
|
|
|
478
|
+
export interface ExpressTransactionHooks {
|
|
479
|
+
beforeBegin?: (db: Pool, request: import('express').Request, response: import('express').Response) => void | Promise<void>;
|
|
480
|
+
afterBegin?: (db: Pool, request: import('express').Request, response: import('express').Response) => void | Promise<void>;
|
|
481
|
+
beforeCommit?: (db: Pool, request: import('express').Request, response: import('express').Response) => void | Promise<void>;
|
|
482
|
+
afterCommit?: (db: Pool, request: import('express').Request, response: import('express').Response) => void | Promise<void>;
|
|
483
|
+
afterRollback?: (db: Pool, request: import('express').Request, response: import('express').Response, error?: unknown) => void | Promise<void>;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
export interface ExpressHooks extends ExpressTransactionHooks {
|
|
487
|
+
transaction?: ExpressTransactionHooks;
|
|
488
|
+
}
|
|
489
|
+
|
|
477
490
|
export interface ExpressTables {${getExpressTables()}
|
|
478
491
|
}
|
|
479
492
|
`;
|
|
@@ -611,13 +624,18 @@ function requireHostExpress () {
|
|
|
611
624
|
const dbOptions = { db: options.db || client.db };
|
|
612
625
|
let c = {};
|
|
613
626
|
const readonly = { readonly: options.readonly};
|
|
627
|
+
const sharedHooks = options.hooks;
|
|
614
628
|
for (let tableName in client.tables) {
|
|
629
|
+
const tableOptions = options[tableName] || {};
|
|
630
|
+
const hooks = tableOptions.hooks || sharedHooks;
|
|
615
631
|
c[tableName] = hostLocal({
|
|
616
632
|
...dbOptions,
|
|
617
633
|
...readonly,
|
|
618
|
-
...
|
|
634
|
+
...tableOptions,
|
|
619
635
|
table: client.tables[tableName],
|
|
620
|
-
isHttp: true,
|
|
636
|
+
isHttp: true,
|
|
637
|
+
client,
|
|
638
|
+
hooks
|
|
621
639
|
|
|
622
640
|
});
|
|
623
641
|
}
|
|
@@ -2201,6 +2219,35 @@ function requireQuery () {
|
|
|
2201
2219
|
return query;
|
|
2202
2220
|
}
|
|
2203
2221
|
|
|
2222
|
+
var sqliteFunction;
|
|
2223
|
+
var hasRequiredSqliteFunction;
|
|
2224
|
+
|
|
2225
|
+
function requireSqliteFunction () {
|
|
2226
|
+
if (hasRequiredSqliteFunction) return sqliteFunction;
|
|
2227
|
+
hasRequiredSqliteFunction = 1;
|
|
2228
|
+
const executeChanges = requireExecuteChanges();
|
|
2229
|
+
const popChanges = requirePopChanges();
|
|
2230
|
+
const getSessionSingleton = requireGetSessionSingleton();
|
|
2231
|
+
|
|
2232
|
+
function executeQueries(context, ...rest) {
|
|
2233
|
+
var changes = popChanges(context);
|
|
2234
|
+
|
|
2235
|
+
return executeChanges(context, changes).then(onDoneChanges);
|
|
2236
|
+
|
|
2237
|
+
function onDoneChanges() {
|
|
2238
|
+
var client = getSessionSingleton(context, 'dbClient');
|
|
2239
|
+
if (client && typeof client.function === 'function')
|
|
2240
|
+
return client.function.apply(client, rest);
|
|
2241
|
+
if (client && typeof client.createFunction === 'function')
|
|
2242
|
+
return client.createFunction.apply(client, rest);
|
|
2243
|
+
throw new Error('SQLite client does not support user-defined functions');
|
|
2244
|
+
}
|
|
2245
|
+
}
|
|
2246
|
+
|
|
2247
|
+
sqliteFunction = executeQueries;
|
|
2248
|
+
return sqliteFunction;
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2204
2251
|
var hostLocal_1;
|
|
2205
2252
|
var hasRequiredHostLocal;
|
|
2206
2253
|
|
|
@@ -2211,6 +2258,7 @@ function requireHostLocal () {
|
|
|
2211
2258
|
let getMeta = requireGetMeta();
|
|
2212
2259
|
let setSessionSingleton = requireSetSessionSingleton();
|
|
2213
2260
|
let executeQuery = requireQuery();
|
|
2261
|
+
let executeSqliteFunction = requireSqliteFunction();
|
|
2214
2262
|
let hostExpress = requireHostExpress();
|
|
2215
2263
|
const readonlyOps = ['getManyDto', 'getMany', 'aggregate', 'count'];
|
|
2216
2264
|
// { db, table, defaultConcurrency,
|
|
@@ -2221,9 +2269,12 @@ function requireHostLocal () {
|
|
|
2221
2269
|
// disableBulkDeletes, isBrowser }
|
|
2222
2270
|
function hostLocal() {
|
|
2223
2271
|
const _options = arguments[0];
|
|
2224
|
-
let { table, transaction, db, isHttp } = _options;
|
|
2272
|
+
let { table, transaction, db, isHttp, hooks, client } = _options;
|
|
2273
|
+
const transactionHooks = hooks && hooks.transaction;
|
|
2274
|
+
const getTransactionHook = (name) =>
|
|
2275
|
+
(transactionHooks && transactionHooks[name]) || (hooks && hooks[name]);
|
|
2225
2276
|
|
|
2226
|
-
let c = { get, post, patch, query, express };
|
|
2277
|
+
let c = { get, post, patch, query, sqliteFunction, express };
|
|
2227
2278
|
|
|
2228
2279
|
function get() {
|
|
2229
2280
|
return getMeta(table);
|
|
@@ -2274,10 +2325,41 @@ function requireHostLocal () {
|
|
|
2274
2325
|
else
|
|
2275
2326
|
db = dbPromise;
|
|
2276
2327
|
}
|
|
2277
|
-
|
|
2328
|
+
const beforeBegin = getTransactionHook('beforeBegin');
|
|
2329
|
+
const afterBegin = getTransactionHook('afterBegin');
|
|
2330
|
+
const beforeCommit = getTransactionHook('beforeCommit');
|
|
2331
|
+
const afterCommit = getTransactionHook('afterCommit');
|
|
2332
|
+
const afterRollback = getTransactionHook('afterRollback');
|
|
2333
|
+
const hasTransactionHooks = !!(beforeBegin
|
|
2334
|
+
|| afterBegin
|
|
2335
|
+
|| beforeCommit
|
|
2336
|
+
|| afterCommit
|
|
2337
|
+
|| afterRollback);
|
|
2338
|
+
if (!hasTransactionHooks && readonlyOps.includes(body.path))
|
|
2278
2339
|
await db.transaction({ readonly: true }, fn);
|
|
2279
|
-
else
|
|
2280
|
-
await db.transaction(
|
|
2340
|
+
else {
|
|
2341
|
+
await db.transaction(async (context) => {
|
|
2342
|
+
const hookDb = typeof client === 'function'
|
|
2343
|
+
? client({ transaction: (fn) => fn(context) })
|
|
2344
|
+
: (client || db);
|
|
2345
|
+
if (afterCommit)
|
|
2346
|
+
setSessionSingleton(context, 'afterCommitHook', () =>
|
|
2347
|
+
afterCommit(hookDb, request, response)
|
|
2348
|
+
);
|
|
2349
|
+
if (afterRollback)
|
|
2350
|
+
setSessionSingleton(context, 'afterRollbackHook', (error) =>
|
|
2351
|
+
afterRollback(hookDb, request, response, error)
|
|
2352
|
+
);
|
|
2353
|
+
if (beforeBegin)
|
|
2354
|
+
await beforeBegin(hookDb, request, response);
|
|
2355
|
+
if (afterBegin)
|
|
2356
|
+
await afterBegin(hookDb, request, response);
|
|
2357
|
+
await fn(context);
|
|
2358
|
+
if (beforeCommit)
|
|
2359
|
+
await beforeCommit(hookDb, request, response);
|
|
2360
|
+
});
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2281
2363
|
}
|
|
2282
2364
|
return result;
|
|
2283
2365
|
|
|
@@ -2312,6 +2394,31 @@ function requireHostLocal () {
|
|
|
2312
2394
|
|
|
2313
2395
|
}
|
|
2314
2396
|
|
|
2397
|
+
async function sqliteFunction() {
|
|
2398
|
+
let args = arguments;
|
|
2399
|
+
let result;
|
|
2400
|
+
|
|
2401
|
+
if (transaction)
|
|
2402
|
+
await transaction(fn);
|
|
2403
|
+
else {
|
|
2404
|
+
if (typeof db === 'function') {
|
|
2405
|
+
let dbPromise = db();
|
|
2406
|
+
if (dbPromise.then)
|
|
2407
|
+
db = await dbPromise;
|
|
2408
|
+
else
|
|
2409
|
+
db = dbPromise;
|
|
2410
|
+
}
|
|
2411
|
+
result = await db.sqliteFunction.apply(null, arguments);
|
|
2412
|
+
}
|
|
2413
|
+
|
|
2414
|
+
return result;
|
|
2415
|
+
|
|
2416
|
+
async function fn(...args1) {
|
|
2417
|
+
result = await executeSqliteFunction.apply(null, [...args1, ...args]);
|
|
2418
|
+
}
|
|
2419
|
+
|
|
2420
|
+
}
|
|
2421
|
+
|
|
2315
2422
|
function express(client, options) {
|
|
2316
2423
|
return hostExpress(hostLocal, client, options);
|
|
2317
2424
|
}
|
|
@@ -2402,6 +2509,7 @@ function requireNetAdapter () {
|
|
|
2402
2509
|
post,
|
|
2403
2510
|
patch,
|
|
2404
2511
|
query,
|
|
2512
|
+
sqliteFunction,
|
|
2405
2513
|
express
|
|
2406
2514
|
};
|
|
2407
2515
|
|
|
@@ -2457,6 +2565,10 @@ function requireNetAdapter () {
|
|
|
2457
2565
|
throw new Error('Queries are not supported through http');
|
|
2458
2566
|
}
|
|
2459
2567
|
|
|
2568
|
+
function sqliteFunction() {
|
|
2569
|
+
throw new Error('Sqlite Function is not supported through http');
|
|
2570
|
+
}
|
|
2571
|
+
|
|
2460
2572
|
function express() {
|
|
2461
2573
|
throw new Error('Hosting in express is not supported on the client side');
|
|
2462
2574
|
}
|
|
@@ -2470,7 +2582,8 @@ function requireNetAdapter () {
|
|
|
2470
2582
|
get,
|
|
2471
2583
|
post,
|
|
2472
2584
|
patch,
|
|
2473
|
-
query
|
|
2585
|
+
query,
|
|
2586
|
+
sqliteFunction
|
|
2474
2587
|
};
|
|
2475
2588
|
|
|
2476
2589
|
return c;
|
|
@@ -2495,6 +2608,11 @@ function requireNetAdapter () {
|
|
|
2495
2608
|
return adapter.query.apply(null, arguments);
|
|
2496
2609
|
}
|
|
2497
2610
|
|
|
2611
|
+
async function sqliteFunction() {
|
|
2612
|
+
const adapter = await getInnerAdapter();
|
|
2613
|
+
return adapter.sqliteFunction.apply(null, arguments);
|
|
2614
|
+
}
|
|
2615
|
+
|
|
2498
2616
|
async function getInnerAdapter() {
|
|
2499
2617
|
const db = await getDb();
|
|
2500
2618
|
if (typeof db === 'string') {
|
|
@@ -2783,6 +2901,7 @@ function requireClient () {
|
|
|
2783
2901
|
}
|
|
2784
2902
|
};
|
|
2785
2903
|
client.query = query;
|
|
2904
|
+
client.function = sqliteFunction;
|
|
2786
2905
|
client.transaction = runInTransaction;
|
|
2787
2906
|
client.db = baseUrl;
|
|
2788
2907
|
client.mssql = onProvider.bind(null, 'mssql');
|
|
@@ -2871,6 +2990,11 @@ function requireClient () {
|
|
|
2871
2990
|
return adapter.query.apply(null, arguments);
|
|
2872
2991
|
}
|
|
2873
2992
|
|
|
2993
|
+
async function sqliteFunction() {
|
|
2994
|
+
const adapter = netAdapter(baseUrl, undefined, { tableOptions: { db: baseUrl, transaction } });
|
|
2995
|
+
return adapter.sqliteFunction.apply(null, arguments);
|
|
2996
|
+
}
|
|
2997
|
+
|
|
2874
2998
|
function express(arg) {
|
|
2875
2999
|
if (providers.express) {
|
|
2876
3000
|
return providers.express(client, { ...options, ...arg });
|
|
@@ -3554,6 +3678,7 @@ function requireClient () {
|
|
|
3554
3678
|
return;
|
|
3555
3679
|
|
|
3556
3680
|
let body = stringify({ patch, options: { ...tableOptions, ...concurrencyOptions, strategy, deduceStrategy } });
|
|
3681
|
+
|
|
3557
3682
|
let adapter = netAdapter(url, tableName, { axios: axiosInterceptor, tableOptions });
|
|
3558
3683
|
let { changed, strategy: newStrategy } = await adapter.patch(body);
|
|
3559
3684
|
copyInto(changed, [row]);
|
|
@@ -4133,8 +4258,10 @@ function requireNewShallowJoinSqlCore () {
|
|
|
4133
4258
|
|
|
4134
4259
|
function _new(context, rightTable, leftColumns, rightColumns, leftAlias, rightAlias, filter) {
|
|
4135
4260
|
const quote = getSessionSingleton(context, 'quote');
|
|
4136
|
-
|
|
4137
|
-
|
|
4261
|
+
const leftAliasRaw = leftAlias;
|
|
4262
|
+
const rightAliasRaw = rightAlias;
|
|
4263
|
+
leftAlias = quote(leftAliasRaw);
|
|
4264
|
+
rightAlias = quote(rightAliasRaw);
|
|
4138
4265
|
var sql = '';
|
|
4139
4266
|
var delimiter = '';
|
|
4140
4267
|
for (var i = 0; i < leftColumns.length; i++) {
|
|
@@ -4148,7 +4275,7 @@ function requireNewShallowJoinSqlCore () {
|
|
|
4148
4275
|
sql += delimiter + leftAlias + '.' + quote(leftColumn._dbName) + '=' + rightAlias + '.' + quote(rightColumn._dbName);
|
|
4149
4276
|
}
|
|
4150
4277
|
|
|
4151
|
-
sql += newDiscriminatorSql(context, rightTable,
|
|
4278
|
+
sql += newDiscriminatorSql(context, rightTable, rightAliasRaw);
|
|
4152
4279
|
var result = newParameterized(sql);
|
|
4153
4280
|
if (filter)
|
|
4154
4281
|
result = result.append(delimiter).append(filter);
|
|
@@ -12970,14 +13097,34 @@ function requireCommit () {
|
|
|
12970
13097
|
const getSessionSingleton = requireGetSessionSingleton();
|
|
12971
13098
|
|
|
12972
13099
|
function _commit(context, result) {
|
|
13100
|
+
let hookError;
|
|
12973
13101
|
return popAndPushChanges()
|
|
13102
|
+
.then(callAfterCommit)
|
|
12974
13103
|
.then(releaseDbClient.bind(null, context))
|
|
12975
|
-
.then(onReleased)
|
|
13104
|
+
.then(onReleased)
|
|
13105
|
+
.then(throwHookErrorIfAny);
|
|
12976
13106
|
|
|
12977
13107
|
function onReleased() {
|
|
12978
13108
|
return result;
|
|
12979
13109
|
}
|
|
12980
13110
|
|
|
13111
|
+
function throwHookErrorIfAny(res) {
|
|
13112
|
+
if (hookError)
|
|
13113
|
+
throw hookError;
|
|
13114
|
+
return res;
|
|
13115
|
+
}
|
|
13116
|
+
|
|
13117
|
+
function callAfterCommit() {
|
|
13118
|
+
const hook = getSessionSingleton(context, 'afterCommitHook');
|
|
13119
|
+
if (!hook)
|
|
13120
|
+
return Promise.resolve();
|
|
13121
|
+
return Promise.resolve()
|
|
13122
|
+
.then(() => hook())
|
|
13123
|
+
.catch((e) => {
|
|
13124
|
+
hookError = e;
|
|
13125
|
+
});
|
|
13126
|
+
}
|
|
13127
|
+
|
|
12981
13128
|
async function popAndPushChanges() {
|
|
12982
13129
|
let changes = popChanges(context);
|
|
12983
13130
|
while (changes.length > 0) {
|
|
@@ -13078,10 +13225,13 @@ function requireRollback () {
|
|
|
13078
13225
|
const getSessionSingleton = requireGetSessionSingleton();
|
|
13079
13226
|
|
|
13080
13227
|
function _rollback(context, e) {
|
|
13228
|
+
let hookError;
|
|
13081
13229
|
var chain = resultToPromise()
|
|
13082
13230
|
.then(() => popChanges(context))
|
|
13083
13231
|
.then(executeRollback)
|
|
13084
|
-
.then(
|
|
13232
|
+
.then(callAfterRollback)
|
|
13233
|
+
.then(() => releaseDbClient(context))
|
|
13234
|
+
.then(throwHookErrorIfAny);
|
|
13085
13235
|
|
|
13086
13236
|
|
|
13087
13237
|
function executeRollback() {
|
|
@@ -13091,6 +13241,23 @@ function requireRollback () {
|
|
|
13091
13241
|
return executeQuery(context, rollbackCommand);
|
|
13092
13242
|
}
|
|
13093
13243
|
|
|
13244
|
+
function callAfterRollback() {
|
|
13245
|
+
const hook = getSessionSingleton(context, 'afterRollbackHook');
|
|
13246
|
+
if (!hook)
|
|
13247
|
+
return Promise.resolve();
|
|
13248
|
+
return Promise.resolve()
|
|
13249
|
+
.then(() => hook(e))
|
|
13250
|
+
.catch((err) => {
|
|
13251
|
+
hookError = err;
|
|
13252
|
+
});
|
|
13253
|
+
}
|
|
13254
|
+
|
|
13255
|
+
function throwHookErrorIfAny(res) {
|
|
13256
|
+
if (hookError)
|
|
13257
|
+
throw hookError;
|
|
13258
|
+
return res;
|
|
13259
|
+
}
|
|
13260
|
+
|
|
13094
13261
|
if (e) {
|
|
13095
13262
|
if (e.message?.indexOf('ORA-01476: divisor is equal to zero') > -1)
|
|
13096
13263
|
return newThrow(context, new Error('Conflict when updating a column'), chain);
|
|
@@ -13951,6 +14118,7 @@ function requireNewTransaction$b () {
|
|
|
13951
14118
|
rdb.aggregateCount = 0;
|
|
13952
14119
|
rdb.quote = quote;
|
|
13953
14120
|
rdb.cache = {};
|
|
14121
|
+
rdb.changes = [];
|
|
13954
14122
|
|
|
13955
14123
|
if (readonly) {
|
|
13956
14124
|
rdb.dbClient = {
|
|
@@ -14050,7 +14218,6 @@ function requireBegin () {
|
|
|
14050
14218
|
let setSessionSingleton = requireSetSessionSingleton();
|
|
14051
14219
|
|
|
14052
14220
|
function begin(context, transactionLess) {
|
|
14053
|
-
setSessionSingleton(context, 'changes', []);
|
|
14054
14221
|
if (transactionLess) {
|
|
14055
14222
|
setSessionSingleton(context, 'transactionLess', true);
|
|
14056
14223
|
return Promise.resolve();
|
|
@@ -14869,7 +15036,6 @@ function requireNewDatabase$b () {
|
|
|
14869
15036
|
let hostLocal = requireHostLocal();
|
|
14870
15037
|
let doQuery = requireQuery();
|
|
14871
15038
|
let releaseDbClient = requireReleaseDbClient();
|
|
14872
|
-
let setSessionSingleton = requireSetSessionSingleton();
|
|
14873
15039
|
|
|
14874
15040
|
function newDatabase(connectionString, poolOptions) {
|
|
14875
15041
|
if (!connectionString)
|
|
@@ -14886,10 +15052,9 @@ function requireNewDatabase$b () {
|
|
|
14886
15052
|
}
|
|
14887
15053
|
let domain = createDomain();
|
|
14888
15054
|
|
|
14889
|
-
if (fn)
|
|
14890
|
-
|
|
14891
|
-
|
|
14892
|
-
return domain.run(run);
|
|
15055
|
+
if (!fn)
|
|
15056
|
+
throw new Error('transaction requires a function');
|
|
15057
|
+
return domain.run(runInTransaction);
|
|
14893
15058
|
|
|
14894
15059
|
async function runInTransaction() {
|
|
14895
15060
|
let result;
|
|
@@ -14907,13 +15072,6 @@ function requireNewDatabase$b () {
|
|
|
14907
15072
|
return _begin(domain, options);
|
|
14908
15073
|
}
|
|
14909
15074
|
|
|
14910
|
-
function run() {
|
|
14911
|
-
let p;
|
|
14912
|
-
let transaction = newTransaction(domain, pool, options);
|
|
14913
|
-
p = new Promise(transaction);
|
|
14914
|
-
|
|
14915
|
-
return p.then(begin);
|
|
14916
|
-
}
|
|
14917
15075
|
|
|
14918
15076
|
};
|
|
14919
15077
|
|
|
@@ -14939,7 +15097,6 @@ function requireNewDatabase$b () {
|
|
|
14939
15097
|
let domain = createDomain();
|
|
14940
15098
|
let transaction = newTransaction(domain, pool);
|
|
14941
15099
|
let p = domain.run(() => new Promise(transaction)
|
|
14942
|
-
.then(() => setSessionSingleton(domain, 'changes', []))
|
|
14943
15100
|
.then(() => doQuery(domain, query).then(onResult, onError)));
|
|
14944
15101
|
return p;
|
|
14945
15102
|
|
|
@@ -15385,6 +15542,7 @@ function requireNewTransaction$a () {
|
|
|
15385
15542
|
rdb.aggregateCount = 0;
|
|
15386
15543
|
rdb.quote = quote;
|
|
15387
15544
|
rdb.cache = {};
|
|
15545
|
+
rdb.changes = [];
|
|
15388
15546
|
|
|
15389
15547
|
if (readonly) {
|
|
15390
15548
|
rdb.dbClient = {
|
|
@@ -15627,7 +15785,6 @@ function requireNewDatabase$a () {
|
|
|
15627
15785
|
let hostLocal = requireHostLocal();
|
|
15628
15786
|
let doQuery = requireQuery();
|
|
15629
15787
|
let releaseDbClient = requireReleaseDbClient();
|
|
15630
|
-
let setSessionSingleton = requireSetSessionSingleton();
|
|
15631
15788
|
|
|
15632
15789
|
function newDatabase(connectionString, poolOptions) {
|
|
15633
15790
|
poolOptions = poolOptions || { min: 1 };
|
|
@@ -15642,10 +15799,9 @@ function requireNewDatabase$a () {
|
|
|
15642
15799
|
}
|
|
15643
15800
|
let domain = createDomain();
|
|
15644
15801
|
|
|
15645
|
-
if (fn)
|
|
15646
|
-
|
|
15647
|
-
|
|
15648
|
-
return domain.run(run);
|
|
15802
|
+
if (!fn)
|
|
15803
|
+
throw new Error('transaction requires a function');
|
|
15804
|
+
return domain.run(runInTransaction);
|
|
15649
15805
|
|
|
15650
15806
|
async function runInTransaction() {
|
|
15651
15807
|
let result;
|
|
@@ -15664,14 +15820,6 @@ function requireNewDatabase$a () {
|
|
|
15664
15820
|
return _begin(domain, options);
|
|
15665
15821
|
}
|
|
15666
15822
|
|
|
15667
|
-
function run() {
|
|
15668
|
-
let p;
|
|
15669
|
-
let transaction = newTransaction(domain, pool, options);
|
|
15670
|
-
p = new Promise(transaction);
|
|
15671
|
-
|
|
15672
|
-
return p.then(begin)
|
|
15673
|
-
.then(negotiateSchema);
|
|
15674
|
-
}
|
|
15675
15823
|
|
|
15676
15824
|
function negotiateSchema(previous) {
|
|
15677
15825
|
let schema = options && options.schema;
|
|
@@ -15712,7 +15860,6 @@ function requireNewDatabase$a () {
|
|
|
15712
15860
|
let domain = createDomain();
|
|
15713
15861
|
let transaction = newTransaction(domain, pool);
|
|
15714
15862
|
let p = domain.run(() => new Promise(transaction)
|
|
15715
|
-
.then(() => setSessionSingleton(domain, 'changes', []))
|
|
15716
15863
|
.then(() => doQuery(domain, query).then(onResult, onError)));
|
|
15717
15864
|
return p;
|
|
15718
15865
|
|
|
@@ -16147,6 +16294,7 @@ function requireNewTransaction$9 () {
|
|
|
16147
16294
|
rdb.aggregateCount = 0;
|
|
16148
16295
|
rdb.quote = quote;
|
|
16149
16296
|
rdb.cache = {};
|
|
16297
|
+
rdb.changes = [];
|
|
16150
16298
|
|
|
16151
16299
|
if (readonly) {
|
|
16152
16300
|
rdb.dbClient = {
|
|
@@ -16368,7 +16516,6 @@ function requireNewDatabase$9 () {
|
|
|
16368
16516
|
let hostLocal = requireHostLocal();
|
|
16369
16517
|
let doQuery = requireQuery();
|
|
16370
16518
|
let releaseDbClient = requireReleaseDbClient();
|
|
16371
|
-
let setSessionSingleton = requireSetSessionSingleton();
|
|
16372
16519
|
|
|
16373
16520
|
function newDatabase(connectionString, poolOptions) {
|
|
16374
16521
|
if (!connectionString)
|
|
@@ -16385,10 +16532,9 @@ function requireNewDatabase$9 () {
|
|
|
16385
16532
|
}
|
|
16386
16533
|
let domain = createDomain();
|
|
16387
16534
|
|
|
16388
|
-
if (fn)
|
|
16389
|
-
|
|
16390
|
-
|
|
16391
|
-
return domain.run(run);
|
|
16535
|
+
if (!fn)
|
|
16536
|
+
throw new Error('transaction requires a function');
|
|
16537
|
+
return domain.run(runInTransaction);
|
|
16392
16538
|
|
|
16393
16539
|
async function runInTransaction() {
|
|
16394
16540
|
let result;
|
|
@@ -16407,14 +16553,6 @@ function requireNewDatabase$9 () {
|
|
|
16407
16553
|
return _begin(domain, options);
|
|
16408
16554
|
}
|
|
16409
16555
|
|
|
16410
|
-
function run() {
|
|
16411
|
-
let p;
|
|
16412
|
-
let transaction = newTransaction(domain, pool, options);
|
|
16413
|
-
p = new Promise(transaction);
|
|
16414
|
-
|
|
16415
|
-
return p.then(begin)
|
|
16416
|
-
.then(negotiateSchema);
|
|
16417
|
-
}
|
|
16418
16556
|
|
|
16419
16557
|
function negotiateSchema(previous) {
|
|
16420
16558
|
let schema = options && options.schema;
|
|
@@ -16455,7 +16593,6 @@ function requireNewDatabase$9 () {
|
|
|
16455
16593
|
let domain = createDomain();
|
|
16456
16594
|
let transaction = newTransaction(domain, pool);
|
|
16457
16595
|
let p = domain.run(() => new Promise(transaction)
|
|
16458
|
-
.then(() => setSessionSingleton(domain, 'changes', []))
|
|
16459
16596
|
.then(() => doQuery(domain, query).then(onResult, onError)));
|
|
16460
16597
|
return p;
|
|
16461
16598
|
|
|
@@ -16633,6 +16770,7 @@ function requireNewTransaction$8 () {
|
|
|
16633
16770
|
rdb.aggregateCount = 0;
|
|
16634
16771
|
rdb.quote = quote;
|
|
16635
16772
|
rdb.cache = {};
|
|
16773
|
+
rdb.changes = [];
|
|
16636
16774
|
|
|
16637
16775
|
if (readonly) {
|
|
16638
16776
|
rdb.dbClient = {
|
|
@@ -16898,7 +17036,6 @@ function requireNewDatabase$8 () {
|
|
|
16898
17036
|
let hostLocal = requireHostLocal();
|
|
16899
17037
|
let doQuery = requireQuery();
|
|
16900
17038
|
let releaseDbClient = requireReleaseDbClient();
|
|
16901
|
-
let setSessionSingleton = requireSetSessionSingleton();
|
|
16902
17039
|
|
|
16903
17040
|
function newDatabase(connectionString, poolOptions) {
|
|
16904
17041
|
if (!connectionString)
|
|
@@ -16915,10 +17052,9 @@ function requireNewDatabase$8 () {
|
|
|
16915
17052
|
}
|
|
16916
17053
|
let domain = createDomain();
|
|
16917
17054
|
|
|
16918
|
-
if (fn)
|
|
16919
|
-
|
|
16920
|
-
|
|
16921
|
-
return domain.run(run);
|
|
17055
|
+
if (!fn)
|
|
17056
|
+
throw new Error('transaction requires a function');
|
|
17057
|
+
return domain.run(runInTransaction);
|
|
16922
17058
|
|
|
16923
17059
|
async function runInTransaction() {
|
|
16924
17060
|
let result;
|
|
@@ -16937,15 +17073,6 @@ function requireNewDatabase$8 () {
|
|
|
16937
17073
|
return _begin(domain, options);
|
|
16938
17074
|
}
|
|
16939
17075
|
|
|
16940
|
-
function run() {
|
|
16941
|
-
let p;
|
|
16942
|
-
let transaction = newTransaction(domain, pool, options);
|
|
16943
|
-
p = new Promise(transaction);
|
|
16944
|
-
|
|
16945
|
-
return p.then(begin)
|
|
16946
|
-
.then(negotiateSchema);
|
|
16947
|
-
}
|
|
16948
|
-
|
|
16949
17076
|
function negotiateSchema(previous) {
|
|
16950
17077
|
let schema = options && options.schema;
|
|
16951
17078
|
if (!schema)
|
|
@@ -16985,7 +17112,6 @@ function requireNewDatabase$8 () {
|
|
|
16985
17112
|
let domain = createDomain();
|
|
16986
17113
|
let transaction = newTransaction(domain, pool);
|
|
16987
17114
|
let p = domain.run(() => new Promise(transaction)
|
|
16988
|
-
.then(() => setSessionSingleton(domain, 'changes', []))
|
|
16989
17115
|
.then(() => doQuery(domain, query).then(onResult, onError)));
|
|
16990
17116
|
return p;
|
|
16991
17117
|
|
|
@@ -17389,6 +17515,7 @@ function requireNewTransaction$7 () {
|
|
|
17389
17515
|
rdb.aggregateCount = 0;
|
|
17390
17516
|
rdb.quote = quote;
|
|
17391
17517
|
rdb.cache = {};
|
|
17518
|
+
rdb.changes = [];
|
|
17392
17519
|
|
|
17393
17520
|
if (readonly) {
|
|
17394
17521
|
rdb.dbClient = {
|
|
@@ -17585,8 +17712,8 @@ function requireNewDatabase$7 () {
|
|
|
17585
17712
|
let express = requireHostExpress();
|
|
17586
17713
|
let hostLocal = requireHostLocal();
|
|
17587
17714
|
let doQuery = requireQuery();
|
|
17715
|
+
let doSqliteFunction = requireSqliteFunction();
|
|
17588
17716
|
let releaseDbClient = requireReleaseDbClient();
|
|
17589
|
-
let setSessionSingleton = requireSetSessionSingleton();
|
|
17590
17717
|
|
|
17591
17718
|
function newDatabase(connectionString, poolOptions) {
|
|
17592
17719
|
if (!connectionString)
|
|
@@ -17602,11 +17729,9 @@ function requireNewDatabase$7 () {
|
|
|
17602
17729
|
options = undefined;
|
|
17603
17730
|
}
|
|
17604
17731
|
let domain = createDomain();
|
|
17605
|
-
|
|
17606
|
-
|
|
17607
|
-
|
|
17608
|
-
else
|
|
17609
|
-
return domain.run(run);
|
|
17732
|
+
if (!fn)
|
|
17733
|
+
throw new Error('transaction requires a function');
|
|
17734
|
+
return domain.run(runInTransaction);
|
|
17610
17735
|
|
|
17611
17736
|
function begin() {
|
|
17612
17737
|
return _begin(domain, options);
|
|
@@ -17620,30 +17745,27 @@ function requireNewDatabase$7 () {
|
|
|
17620
17745
|
.then(() => fn(domain))
|
|
17621
17746
|
.then((res) => result = res)
|
|
17622
17747
|
.then(() => commit(domain))
|
|
17623
|
-
.then(null, (e) => rollback(domain, e));
|
|
17748
|
+
.then(null, (e) => Promise.resolve(rollback(domain, e)));
|
|
17624
17749
|
return result;
|
|
17625
17750
|
}
|
|
17626
17751
|
|
|
17627
|
-
function run() {
|
|
17628
|
-
let p;
|
|
17629
|
-
let transaction = newTransaction(domain, pool, options);
|
|
17630
|
-
p = new Promise(transaction);
|
|
17631
|
-
|
|
17632
|
-
return p.then(begin);
|
|
17633
|
-
}
|
|
17634
17752
|
|
|
17635
17753
|
};
|
|
17636
17754
|
|
|
17637
17755
|
c.createTransaction = function(options) {
|
|
17756
|
+
console.dir('create transaction');
|
|
17638
17757
|
let domain = createDomain();
|
|
17639
17758
|
let transaction = newTransaction(domain, pool);
|
|
17640
17759
|
let p = domain.run(() => new Promise(transaction).then(begin));
|
|
17641
|
-
|
|
17642
17760
|
function run(fn) {
|
|
17643
17761
|
return p.then(() => fn(domain));
|
|
17644
17762
|
}
|
|
17645
|
-
run.rollback =
|
|
17646
|
-
|
|
17763
|
+
run.rollback = function(error) {
|
|
17764
|
+
return Promise.resolve(rollback(domain, error));
|
|
17765
|
+
};
|
|
17766
|
+
run.commit = function() {
|
|
17767
|
+
return Promise.resolve(commit(domain));
|
|
17768
|
+
};
|
|
17647
17769
|
return run;
|
|
17648
17770
|
|
|
17649
17771
|
function begin() {
|
|
@@ -17655,7 +17777,6 @@ function requireNewDatabase$7 () {
|
|
|
17655
17777
|
let domain = createDomain();
|
|
17656
17778
|
let transaction = newTransaction(domain, pool);
|
|
17657
17779
|
let p = domain.run(() => new Promise(transaction)
|
|
17658
|
-
.then(() => setSessionSingleton(domain, 'changes', []))
|
|
17659
17780
|
.then(() => doQuery(domain, query).then(onResult, onError)));
|
|
17660
17781
|
return p;
|
|
17661
17782
|
|
|
@@ -17670,6 +17791,23 @@ function requireNewDatabase$7 () {
|
|
|
17670
17791
|
}
|
|
17671
17792
|
};
|
|
17672
17793
|
|
|
17794
|
+
c.sqliteFunction = function(...args) {
|
|
17795
|
+
let domain = createDomain();
|
|
17796
|
+
let transaction = newTransaction(domain, pool);
|
|
17797
|
+
let p = domain.run(() => new Promise(transaction)
|
|
17798
|
+
.then(() => doSqliteFunction(domain, ...args).then(onResult, onError)));
|
|
17799
|
+
return p;
|
|
17800
|
+
|
|
17801
|
+
function onResult(result) {
|
|
17802
|
+
releaseDbClient(domain);
|
|
17803
|
+
return result;
|
|
17804
|
+
}
|
|
17805
|
+
|
|
17806
|
+
function onError(e) {
|
|
17807
|
+
releaseDbClient(domain);
|
|
17808
|
+
throw e;
|
|
17809
|
+
}
|
|
17810
|
+
};
|
|
17673
17811
|
|
|
17674
17812
|
c.rollback = rollback;
|
|
17675
17813
|
c.commit = commit;
|
|
@@ -17810,6 +17948,7 @@ function requireNewTransaction$6 () {
|
|
|
17810
17948
|
rdb.aggregateCount = 0;
|
|
17811
17949
|
rdb.quote = quote;
|
|
17812
17950
|
rdb.cache = {};
|
|
17951
|
+
rdb.changes = [];
|
|
17813
17952
|
|
|
17814
17953
|
if (readonly) {
|
|
17815
17954
|
rdb.dbClient = {
|
|
@@ -17989,8 +18128,8 @@ function requireNewDatabase$6 () {
|
|
|
17989
18128
|
let express = requireHostExpress();
|
|
17990
18129
|
let hostLocal = requireHostLocal();
|
|
17991
18130
|
let doQuery = requireQuery();
|
|
18131
|
+
let doSqliteFunction = requireSqliteFunction();
|
|
17992
18132
|
let releaseDbClient = requireReleaseDbClient();
|
|
17993
|
-
let setSessionSingleton = requireSetSessionSingleton();
|
|
17994
18133
|
|
|
17995
18134
|
function newDatabase(connectionString, poolOptions) {
|
|
17996
18135
|
if (!connectionString)
|
|
@@ -18007,10 +18146,9 @@ function requireNewDatabase$6 () {
|
|
|
18007
18146
|
}
|
|
18008
18147
|
let domain = createDomain();
|
|
18009
18148
|
|
|
18010
|
-
if (fn)
|
|
18011
|
-
|
|
18012
|
-
|
|
18013
|
-
return domain.run(run);
|
|
18149
|
+
if (!fn)
|
|
18150
|
+
throw new Error('transaction requires a function');
|
|
18151
|
+
return domain.run(runInTransaction);
|
|
18014
18152
|
|
|
18015
18153
|
function begin() {
|
|
18016
18154
|
return _begin(domain, options);
|
|
@@ -18028,13 +18166,6 @@ function requireNewDatabase$6 () {
|
|
|
18028
18166
|
return result;
|
|
18029
18167
|
}
|
|
18030
18168
|
|
|
18031
|
-
function run() {
|
|
18032
|
-
let p;
|
|
18033
|
-
let transaction = newTransaction(domain, pool, options);
|
|
18034
|
-
p = new Promise(transaction);
|
|
18035
|
-
|
|
18036
|
-
return p.then(begin);
|
|
18037
|
-
}
|
|
18038
18169
|
|
|
18039
18170
|
};
|
|
18040
18171
|
|
|
@@ -18059,7 +18190,6 @@ function requireNewDatabase$6 () {
|
|
|
18059
18190
|
let domain = createDomain();
|
|
18060
18191
|
let transaction = newTransaction(domain, pool);
|
|
18061
18192
|
let p = domain.run(() => new Promise(transaction)
|
|
18062
|
-
.then(() => setSessionSingleton(domain, 'changes', []))
|
|
18063
18193
|
.then(() => doQuery(domain, query).then(onResult, onError)));
|
|
18064
18194
|
return p;
|
|
18065
18195
|
|
|
@@ -18074,6 +18204,24 @@ function requireNewDatabase$6 () {
|
|
|
18074
18204
|
}
|
|
18075
18205
|
};
|
|
18076
18206
|
|
|
18207
|
+
c.sqliteFunction = function(...args) {
|
|
18208
|
+
let domain = createDomain();
|
|
18209
|
+
let transaction = newTransaction(domain, pool);
|
|
18210
|
+
let p = domain.run(() => new Promise(transaction)
|
|
18211
|
+
.then(() => doSqliteFunction(domain, ...args).then(onResult, onError)));
|
|
18212
|
+
return p;
|
|
18213
|
+
|
|
18214
|
+
function onResult(result) {
|
|
18215
|
+
releaseDbClient(domain);
|
|
18216
|
+
return result;
|
|
18217
|
+
}
|
|
18218
|
+
|
|
18219
|
+
function onError(e) {
|
|
18220
|
+
releaseDbClient(domain);
|
|
18221
|
+
throw e;
|
|
18222
|
+
}
|
|
18223
|
+
};
|
|
18224
|
+
|
|
18077
18225
|
|
|
18078
18226
|
c.rollback = rollback;
|
|
18079
18227
|
c.commit = commit;
|
|
@@ -18233,6 +18381,7 @@ function requireNewTransaction$5 () {
|
|
|
18233
18381
|
rdb.aggregateCount = 0;
|
|
18234
18382
|
rdb.quote = quote;
|
|
18235
18383
|
rdb.cache = {};
|
|
18384
|
+
rdb.changes = [];
|
|
18236
18385
|
|
|
18237
18386
|
if (readonly) {
|
|
18238
18387
|
rdb.dbClient = {
|
|
@@ -18434,8 +18583,8 @@ function requireNewDatabase$5 () {
|
|
|
18434
18583
|
let express = requireHostExpress();
|
|
18435
18584
|
let hostLocal = requireHostLocal();
|
|
18436
18585
|
let doQuery = requireQuery();
|
|
18586
|
+
let doSqliteFunction = requireSqliteFunction();
|
|
18437
18587
|
let releaseDbClient = requireReleaseDbClient();
|
|
18438
|
-
let setSessionSingleton = requireSetSessionSingleton();
|
|
18439
18588
|
|
|
18440
18589
|
function newDatabase(connectionString, poolOptions) {
|
|
18441
18590
|
if (!connectionString)
|
|
@@ -18452,10 +18601,9 @@ function requireNewDatabase$5 () {
|
|
|
18452
18601
|
}
|
|
18453
18602
|
let domain = createDomain();
|
|
18454
18603
|
|
|
18455
|
-
if (fn)
|
|
18456
|
-
|
|
18457
|
-
|
|
18458
|
-
return domain.run(run);
|
|
18604
|
+
if (!fn)
|
|
18605
|
+
throw new Error('transaction requires a function');
|
|
18606
|
+
return domain.run(runInTransaction);
|
|
18459
18607
|
|
|
18460
18608
|
function begin() {
|
|
18461
18609
|
return _begin(domain, options);
|
|
@@ -18473,13 +18621,6 @@ function requireNewDatabase$5 () {
|
|
|
18473
18621
|
return result;
|
|
18474
18622
|
}
|
|
18475
18623
|
|
|
18476
|
-
function run() {
|
|
18477
|
-
let p;
|
|
18478
|
-
let transaction = newTransaction(domain, pool, options);
|
|
18479
|
-
p = new Promise(transaction);
|
|
18480
|
-
|
|
18481
|
-
return p.then(begin);
|
|
18482
|
-
}
|
|
18483
18624
|
|
|
18484
18625
|
};
|
|
18485
18626
|
|
|
@@ -18504,7 +18645,6 @@ function requireNewDatabase$5 () {
|
|
|
18504
18645
|
let domain = createDomain();
|
|
18505
18646
|
let transaction = newTransaction(domain, pool);
|
|
18506
18647
|
let p = domain.run(() => new Promise(transaction)
|
|
18507
|
-
.then(() => setSessionSingleton(domain, 'changes', []))
|
|
18508
18648
|
.then(() => doQuery(domain, query).then(onResult, onError)));
|
|
18509
18649
|
return p;
|
|
18510
18650
|
|
|
@@ -18519,6 +18659,24 @@ function requireNewDatabase$5 () {
|
|
|
18519
18659
|
}
|
|
18520
18660
|
};
|
|
18521
18661
|
|
|
18662
|
+
c.sqliteFunction = function(...args) {
|
|
18663
|
+
let domain = createDomain();
|
|
18664
|
+
let transaction = newTransaction(domain, pool);
|
|
18665
|
+
let p = domain.run(() => new Promise(transaction)
|
|
18666
|
+
.then(() => doSqliteFunction(domain, ...args).then(onResult, onError)));
|
|
18667
|
+
return p;
|
|
18668
|
+
|
|
18669
|
+
function onResult(result) {
|
|
18670
|
+
releaseDbClient(domain);
|
|
18671
|
+
return result;
|
|
18672
|
+
}
|
|
18673
|
+
|
|
18674
|
+
function onError(e) {
|
|
18675
|
+
releaseDbClient(domain);
|
|
18676
|
+
throw e;
|
|
18677
|
+
}
|
|
18678
|
+
};
|
|
18679
|
+
|
|
18522
18680
|
|
|
18523
18681
|
c.rollback = rollback;
|
|
18524
18682
|
c.commit = commit;
|
|
@@ -18658,6 +18816,7 @@ function requireNewTransaction$4 () {
|
|
|
18658
18816
|
rdb.aggregateCount = 0;
|
|
18659
18817
|
rdb.quote = (name) => `"${name}"`;
|
|
18660
18818
|
rdb.cache = {};
|
|
18819
|
+
rdb.changes = [];
|
|
18661
18820
|
|
|
18662
18821
|
if (readonly) {
|
|
18663
18822
|
rdb.dbClient = {
|
|
@@ -18845,7 +19004,6 @@ function requireNewDatabase$4 () {
|
|
|
18845
19004
|
let hostLocal = requireHostLocal();
|
|
18846
19005
|
let doQuery = requireQuery();
|
|
18847
19006
|
let releaseDbClient = requireReleaseDbClient();
|
|
18848
|
-
let setSessionSingleton = requireSetSessionSingleton();
|
|
18849
19007
|
|
|
18850
19008
|
function newDatabase(d1Database, poolOptions) {
|
|
18851
19009
|
if (!d1Database)
|
|
@@ -18862,10 +19020,9 @@ function requireNewDatabase$4 () {
|
|
|
18862
19020
|
}
|
|
18863
19021
|
let domain = createDomain();
|
|
18864
19022
|
|
|
18865
|
-
if (fn)
|
|
18866
|
-
|
|
18867
|
-
|
|
18868
|
-
return domain.run(run);
|
|
19023
|
+
if (!fn)
|
|
19024
|
+
throw new Error('transaction requires a function');
|
|
19025
|
+
return domain.run(runInTransaction);
|
|
18869
19026
|
|
|
18870
19027
|
async function runInTransaction() {
|
|
18871
19028
|
let result;
|
|
@@ -18884,13 +19041,6 @@ function requireNewDatabase$4 () {
|
|
|
18884
19041
|
return _begin(domain, transactionLess);
|
|
18885
19042
|
}
|
|
18886
19043
|
|
|
18887
|
-
function run() {
|
|
18888
|
-
let p;
|
|
18889
|
-
let transaction = newTransaction(domain, pool, options);
|
|
18890
|
-
p = new Promise(transaction);
|
|
18891
|
-
|
|
18892
|
-
return p.then(begin);
|
|
18893
|
-
}
|
|
18894
19044
|
|
|
18895
19045
|
};
|
|
18896
19046
|
|
|
@@ -18918,7 +19068,6 @@ function requireNewDatabase$4 () {
|
|
|
18918
19068
|
let domain = createDomain();
|
|
18919
19069
|
let transaction = newTransaction(domain, pool);
|
|
18920
19070
|
let p = domain.run(() => new Promise(transaction)
|
|
18921
|
-
.then(() => setSessionSingleton(domain, 'changes', []))
|
|
18922
19071
|
.then(() => doQuery(domain, query).then(onResult, onError)));
|
|
18923
19072
|
return p;
|
|
18924
19073
|
|
|
@@ -19659,6 +19808,7 @@ function requireNewTransaction$3 () {
|
|
|
19659
19808
|
rdb.aggregateCount = 0;
|
|
19660
19809
|
rdb.quote = quote;
|
|
19661
19810
|
rdb.cache = {};
|
|
19811
|
+
rdb.changes = [];
|
|
19662
19812
|
|
|
19663
19813
|
if (readonly) {
|
|
19664
19814
|
rdb.dbClient = {
|
|
@@ -19872,7 +20022,6 @@ function requireNewDatabase$3 () {
|
|
|
19872
20022
|
let hostLocal = requireHostLocal();
|
|
19873
20023
|
let doQuery = requireQuery();
|
|
19874
20024
|
let releaseDbClient = requireReleaseDbClient();
|
|
19875
|
-
let setSessionSingleton = requireSetSessionSingleton();
|
|
19876
20025
|
|
|
19877
20026
|
function newDatabase(connectionString, poolOptions) {
|
|
19878
20027
|
if (!connectionString)
|
|
@@ -19889,10 +20038,9 @@ function requireNewDatabase$3 () {
|
|
|
19889
20038
|
}
|
|
19890
20039
|
let domain = createDomain();
|
|
19891
20040
|
|
|
19892
|
-
if (fn)
|
|
19893
|
-
|
|
19894
|
-
|
|
19895
|
-
return domain.run(run);
|
|
20041
|
+
if (!fn)
|
|
20042
|
+
throw new Error('transaction requires a function');
|
|
20043
|
+
return domain.run(runInTransaction);
|
|
19896
20044
|
|
|
19897
20045
|
async function runInTransaction() {
|
|
19898
20046
|
let result;
|
|
@@ -19910,13 +20058,6 @@ function requireNewDatabase$3 () {
|
|
|
19910
20058
|
return _begin(domain, options);
|
|
19911
20059
|
}
|
|
19912
20060
|
|
|
19913
|
-
function run() {
|
|
19914
|
-
let p;
|
|
19915
|
-
let transaction = newTransaction(domain, pool, options);
|
|
19916
|
-
p = new Promise(transaction);
|
|
19917
|
-
|
|
19918
|
-
return p.then(begin);
|
|
19919
|
-
}
|
|
19920
20061
|
|
|
19921
20062
|
};
|
|
19922
20063
|
|
|
@@ -19945,7 +20086,6 @@ function requireNewDatabase$3 () {
|
|
|
19945
20086
|
let domain = createDomain();
|
|
19946
20087
|
let transaction = newTransaction(domain, pool);
|
|
19947
20088
|
let p = domain.run(() => new Promise(transaction)
|
|
19948
|
-
.then(() => setSessionSingleton(domain, 'changes', []))
|
|
19949
20089
|
.then(() => doQuery(domain, query).then(onResult, onError)));
|
|
19950
20090
|
return p;
|
|
19951
20091
|
|
|
@@ -20383,6 +20523,7 @@ function requireNewTransaction$2 () {
|
|
|
20383
20523
|
rdb.aggregateCount = 0;
|
|
20384
20524
|
rdb.quote = quote;
|
|
20385
20525
|
rdb.cache = {};
|
|
20526
|
+
rdb.changes = [];
|
|
20386
20527
|
|
|
20387
20528
|
if (readonly) {
|
|
20388
20529
|
rdb.dbClient = {
|
|
@@ -20641,7 +20782,6 @@ function requireNewDatabase$2 () {
|
|
|
20641
20782
|
let hostLocal = requireHostLocal();
|
|
20642
20783
|
let doQuery = requireQuery();
|
|
20643
20784
|
let releaseDbClient = requireReleaseDbClient();
|
|
20644
|
-
let setSessionSingleton = requireSetSessionSingleton();
|
|
20645
20785
|
|
|
20646
20786
|
function newDatabase(connectionString, poolOptions) {
|
|
20647
20787
|
if (!connectionString)
|
|
@@ -20658,10 +20798,9 @@ function requireNewDatabase$2 () {
|
|
|
20658
20798
|
}
|
|
20659
20799
|
let domain = createDomain();
|
|
20660
20800
|
|
|
20661
|
-
if (fn)
|
|
20662
|
-
|
|
20663
|
-
|
|
20664
|
-
return domain.run(run);
|
|
20801
|
+
if (!fn)
|
|
20802
|
+
throw new Error('transaction requires a function');
|
|
20803
|
+
return domain.run(runInTransaction);
|
|
20665
20804
|
|
|
20666
20805
|
function begin() {
|
|
20667
20806
|
return _begin(domain, options);
|
|
@@ -20680,13 +20819,6 @@ function requireNewDatabase$2 () {
|
|
|
20680
20819
|
}
|
|
20681
20820
|
|
|
20682
20821
|
|
|
20683
|
-
function run() {
|
|
20684
|
-
let p;
|
|
20685
|
-
let transaction = newTransaction(domain, pool, options);
|
|
20686
|
-
p = new Promise(transaction);
|
|
20687
|
-
|
|
20688
|
-
return p.then(begin);
|
|
20689
|
-
}
|
|
20690
20822
|
|
|
20691
20823
|
};
|
|
20692
20824
|
|
|
@@ -20714,7 +20846,6 @@ function requireNewDatabase$2 () {
|
|
|
20714
20846
|
let domain = createDomain();
|
|
20715
20847
|
let transaction = newTransaction(domain, pool);
|
|
20716
20848
|
let p = domain.run(() => new Promise(transaction)
|
|
20717
|
-
.then(() => setSessionSingleton(domain, 'changes', []))
|
|
20718
20849
|
.then(() => doQuery(domain, query).then(onResult, onError)));
|
|
20719
20850
|
return p;
|
|
20720
20851
|
|
|
@@ -21155,6 +21286,7 @@ function requireNewTransaction$1 () {
|
|
|
21155
21286
|
rdb.aggregateCount = 0;
|
|
21156
21287
|
rdb.quote = quote;
|
|
21157
21288
|
rdb.cache = {};
|
|
21289
|
+
rdb.changes = [];
|
|
21158
21290
|
|
|
21159
21291
|
if (readonly) {
|
|
21160
21292
|
rdb.dbClient = {
|
|
@@ -21292,7 +21424,6 @@ function requireNewDatabase$1 () {
|
|
|
21292
21424
|
let hostLocal = requireHostLocal();
|
|
21293
21425
|
let doQuery = requireQuery();
|
|
21294
21426
|
let releaseDbClient = requireReleaseDbClient();
|
|
21295
|
-
let setSessionSingleton = requireSetSessionSingleton();
|
|
21296
21427
|
|
|
21297
21428
|
function newDatabase(connectionString, poolOptions) {
|
|
21298
21429
|
if (!connectionString)
|
|
@@ -21309,10 +21440,9 @@ function requireNewDatabase$1 () {
|
|
|
21309
21440
|
}
|
|
21310
21441
|
let domain = createDomain();
|
|
21311
21442
|
|
|
21312
|
-
if (fn)
|
|
21313
|
-
|
|
21314
|
-
|
|
21315
|
-
return domain.run(run);
|
|
21443
|
+
if (!fn)
|
|
21444
|
+
throw new Error('transaction requires a function');
|
|
21445
|
+
return domain.run(runInTransaction);
|
|
21316
21446
|
|
|
21317
21447
|
|
|
21318
21448
|
function begin() {
|
|
@@ -21332,13 +21462,6 @@ function requireNewDatabase$1 () {
|
|
|
21332
21462
|
|
|
21333
21463
|
}
|
|
21334
21464
|
|
|
21335
|
-
function run() {
|
|
21336
|
-
let p;
|
|
21337
|
-
let transaction = newTransaction(domain, pool, options);
|
|
21338
|
-
p = new Promise(transaction);
|
|
21339
|
-
|
|
21340
|
-
return p.then(begin);
|
|
21341
|
-
}
|
|
21342
21465
|
|
|
21343
21466
|
};
|
|
21344
21467
|
|
|
@@ -21368,7 +21491,6 @@ function requireNewDatabase$1 () {
|
|
|
21368
21491
|
let domain = createDomain();
|
|
21369
21492
|
let transaction = newTransaction(domain, pool);
|
|
21370
21493
|
let p = domain.run(() => new Promise(transaction)
|
|
21371
|
-
.then(() => setSessionSingleton(domain, 'changes', []))
|
|
21372
21494
|
.then(() => doQuery(domain, query).then(onResult, onError)));
|
|
21373
21495
|
return p;
|
|
21374
21496
|
|
|
@@ -21958,6 +22080,7 @@ function requireNewTransaction () {
|
|
|
21958
22080
|
rdb.aggregateCount = 0;
|
|
21959
22081
|
rdb.quote = quote;
|
|
21960
22082
|
rdb.cache = {};
|
|
22083
|
+
rdb.changes = [];
|
|
21961
22084
|
|
|
21962
22085
|
if (readonly) {
|
|
21963
22086
|
rdb.dbClient = {
|
|
@@ -22166,7 +22289,6 @@ function requireNewDatabase () {
|
|
|
22166
22289
|
let hostLocal = requireHostLocal();
|
|
22167
22290
|
let doQuery = requireQuery();
|
|
22168
22291
|
let releaseDbClient = requireReleaseDbClient();
|
|
22169
|
-
let setSessionSingleton = requireSetSessionSingleton();
|
|
22170
22292
|
|
|
22171
22293
|
function newDatabase(connectionString, poolOptions) {
|
|
22172
22294
|
if (!connectionString)
|
|
@@ -22183,10 +22305,9 @@ function requireNewDatabase () {
|
|
|
22183
22305
|
}
|
|
22184
22306
|
let domain = createDomain();
|
|
22185
22307
|
|
|
22186
|
-
if (fn)
|
|
22187
|
-
|
|
22188
|
-
|
|
22189
|
-
return domain.run(run);
|
|
22308
|
+
if (!fn)
|
|
22309
|
+
throw new Error('transaction requires a function');
|
|
22310
|
+
return domain.run(runInTransaction);
|
|
22190
22311
|
|
|
22191
22312
|
|
|
22192
22313
|
function begin() {
|
|
@@ -22206,13 +22327,6 @@ function requireNewDatabase () {
|
|
|
22206
22327
|
|
|
22207
22328
|
}
|
|
22208
22329
|
|
|
22209
|
-
function run() {
|
|
22210
|
-
let p;
|
|
22211
|
-
let transaction = newTransaction(domain, pool, options);
|
|
22212
|
-
p = new Promise(transaction);
|
|
22213
|
-
|
|
22214
|
-
return p.then(begin);
|
|
22215
|
-
}
|
|
22216
22330
|
|
|
22217
22331
|
};
|
|
22218
22332
|
|
|
@@ -22237,7 +22351,6 @@ function requireNewDatabase () {
|
|
|
22237
22351
|
let domain = createDomain();
|
|
22238
22352
|
let transaction = newTransaction(domain, pool);
|
|
22239
22353
|
let p = domain.run(() => new Promise(transaction)
|
|
22240
|
-
.then(() => setSessionSingleton(domain, 'changes', []))
|
|
22241
22354
|
.then(() => doQuery(domain, query).then(onResult, onError)));
|
|
22242
22355
|
return p;
|
|
22243
22356
|
|