dataply 0.0.26-alpha.13 → 0.0.26-alpha.14
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/cjs/index.js +20 -25
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -10953,11 +10953,6 @@ var RowTableEngine = class {
|
|
|
10953
10953
|
}
|
|
10954
10954
|
};
|
|
10955
10955
|
|
|
10956
|
-
// src/utils/catchPromise.ts
|
|
10957
|
-
async function catchPromise(promise) {
|
|
10958
|
-
return promise.then((res) => [void 0, res]).catch((reason) => [reason]);
|
|
10959
|
-
}
|
|
10960
|
-
|
|
10961
10956
|
// src/core/transaction/LockManager.ts
|
|
10962
10957
|
var LockManager = class {
|
|
10963
10958
|
lock;
|
|
@@ -11493,41 +11488,41 @@ var DataplyAPI = class {
|
|
|
11493
11488
|
const release = await this.acquireWriteLock();
|
|
11494
11489
|
const internalTx = this.createTransaction();
|
|
11495
11490
|
internalTx.__setWriteLockRelease(release);
|
|
11496
|
-
|
|
11497
|
-
|
|
11491
|
+
try {
|
|
11492
|
+
const result = await this.txContext.run(internalTx, () => callback(internalTx));
|
|
11493
|
+
await internalTx.commit();
|
|
11494
|
+
return result;
|
|
11495
|
+
} catch (error) {
|
|
11498
11496
|
await internalTx.rollback();
|
|
11499
|
-
throw
|
|
11497
|
+
throw error;
|
|
11500
11498
|
}
|
|
11501
|
-
await internalTx.commit();
|
|
11502
|
-
return result2;
|
|
11503
11499
|
}
|
|
11504
11500
|
if (!tx.__hasWriteLockRelease()) {
|
|
11505
11501
|
const release = await this.acquireWriteLock();
|
|
11506
11502
|
tx.__setWriteLockRelease(release);
|
|
11507
11503
|
}
|
|
11508
|
-
|
|
11509
|
-
|
|
11510
|
-
throw error;
|
|
11504
|
+
if (this.txContext.get() === tx) {
|
|
11505
|
+
return callback(tx);
|
|
11511
11506
|
}
|
|
11512
|
-
return
|
|
11507
|
+
return this.txContext.run(tx, () => callback(tx));
|
|
11513
11508
|
}
|
|
11514
11509
|
async withReadTransaction(callback, tx) {
|
|
11515
11510
|
this.logger.debug("Running with read transaction");
|
|
11516
|
-
const isInternalTx = !tx;
|
|
11517
11511
|
if (!tx) {
|
|
11518
|
-
|
|
11519
|
-
|
|
11520
|
-
|
|
11521
|
-
|
|
11522
|
-
|
|
11523
|
-
|
|
11512
|
+
const internalTx = this.createTransaction();
|
|
11513
|
+
try {
|
|
11514
|
+
const result = await this.txContext.run(internalTx, () => callback(internalTx));
|
|
11515
|
+
await internalTx.commit();
|
|
11516
|
+
return result;
|
|
11517
|
+
} catch (error) {
|
|
11518
|
+
await internalTx.rollback();
|
|
11519
|
+
throw error;
|
|
11524
11520
|
}
|
|
11525
|
-
throw error;
|
|
11526
11521
|
}
|
|
11527
|
-
if (
|
|
11528
|
-
|
|
11522
|
+
if (this.txContext.get() === tx) {
|
|
11523
|
+
return callback(tx);
|
|
11529
11524
|
}
|
|
11530
|
-
return
|
|
11525
|
+
return this.txContext.run(tx, () => callback(tx));
|
|
11531
11526
|
}
|
|
11532
11527
|
/**
|
|
11533
11528
|
* Runs a generator callback function within a transaction context.
|