corebasic 1.0.63 → 1.0.65
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/libs/dip.js +3 -3
- package/package.json +1 -1
package/libs/dip.js
CHANGED
|
@@ -16,7 +16,7 @@ export const transactionCommit = Elabase.transactionCommit
|
|
|
16
16
|
export const IdempotentDip = () => {
|
|
17
17
|
return {
|
|
18
18
|
txn: '',
|
|
19
|
-
new: (async function (txn,
|
|
19
|
+
new: (async function (txn, blank) {
|
|
20
20
|
this.txn = txn
|
|
21
21
|
return blank ? this : (await Elabase.query("txns",{_id: this.txn}).length ? false : this)
|
|
22
22
|
}),
|
|
@@ -30,14 +30,14 @@ export const IdempotentDip = () => {
|
|
|
30
30
|
return await Elabase.query(collection, {...query, ...idempotent}).length
|
|
31
31
|
}),
|
|
32
32
|
upsert: (async function (collection, query, data, rollback) {
|
|
33
|
-
await this.
|
|
33
|
+
await this.insert(collection, query, data.$setOnInsert)
|
|
34
34
|
return await this.update(collection, query, data, rollback)
|
|
35
35
|
}),
|
|
36
36
|
cleanup: (async function (collection, query) {
|
|
37
37
|
await Elabase.update(collection, query, { $unset: { [this.txn]: true } })
|
|
38
38
|
}),
|
|
39
39
|
finish: (async function () {
|
|
40
|
-
return await Elabase.
|
|
40
|
+
return await Elabase.update("txns",{_id: this.txn}, {}, {upsert: true})
|
|
41
41
|
})
|
|
42
42
|
}
|
|
43
43
|
}
|