@wxn0brp/db-core 0.12.14 → 0.12.15
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/db/transaction.js +3 -1
- package/dist/db/valthera.js +16 -10
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/dist/db/transaction.js
CHANGED
|
@@ -69,7 +69,9 @@ export class Transaction {
|
|
|
69
69
|
return this._parent.execute("getCollections", {}, this.handle);
|
|
70
70
|
}
|
|
71
71
|
removeCollection(target) {
|
|
72
|
-
|
|
72
|
+
const collection = resolveCollection(target);
|
|
73
|
+
this._parent._collections.delete(collection);
|
|
74
|
+
return this._parent.execute("removeCollection", collection, this.handle);
|
|
73
75
|
}
|
|
74
76
|
async commit() {
|
|
75
77
|
try {
|
package/dist/db/valthera.js
CHANGED
|
@@ -321,17 +321,23 @@ export class ValtheraClass {
|
|
|
321
321
|
async transaction(collections, fn) {
|
|
322
322
|
await this.init();
|
|
323
323
|
const releases = [];
|
|
324
|
-
const
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
324
|
+
const keys = this.executor instanceof SmartExecutor && this.executor.aware
|
|
325
|
+
? [
|
|
326
|
+
...new Set(collections),
|
|
327
|
+
]
|
|
328
|
+
: [
|
|
329
|
+
undefined,
|
|
330
|
+
];
|
|
331
|
+
if (!keys.length)
|
|
332
|
+
keys.push(undefined);
|
|
333
|
+
const acquire = (collection) => new Promise((resolve, reject) => this.executor
|
|
334
|
+
.addOp(async () => {
|
|
335
|
+
resolve();
|
|
336
|
+
await new Promise(release => releases.push(release));
|
|
337
|
+
}, undefined, collection)
|
|
338
|
+
.catch(reject));
|
|
334
339
|
try {
|
|
340
|
+
await Promise.all(keys.map(acquire));
|
|
335
341
|
let handle;
|
|
336
342
|
try {
|
|
337
343
|
handle = await this.adapter.beginTransaction(genId(), collections);
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.12.
|
|
1
|
+
export declare const version = "0.12.15";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "0.12.
|
|
1
|
+
export const version = "0.12.15";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wxn0brp/db-core",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.15",
|
|
4
4
|
"types": "dist/index.d.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "wxn0brP",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"homepage": "https://github.com/wxn0brP/ValtheraDB",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@wxn0brp/event-emitter": "0.0.
|
|
16
|
+
"@wxn0brp/event-emitter": "0.0.9"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/bun": "*",
|