@roc-db/indexed-db 0.2.0-pre.45 → 0.2.0-pre.46
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/index.js
CHANGED
|
@@ -87,15 +87,22 @@ var commitCreate = (txn, document) => {
|
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
// src/functions/commitDelete.ts
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
import { entityFromRef } from "roc-db";
|
|
91
|
+
var commitDelete = async (txn, ref) => {
|
|
92
|
+
const entity = entityFromRef(ref);
|
|
93
|
+
let objectStore;
|
|
94
|
+
if (entity === "Mutation") {
|
|
95
|
+
objectStore = txn.engineOpts.txn.objectStore("mutations");
|
|
96
|
+
} else {
|
|
97
|
+
objectStore = txn.engineOpts.txn.objectStore("entities");
|
|
98
|
+
}
|
|
92
99
|
const request = objectStore.delete(ref);
|
|
93
100
|
return new Promise((resolve, reject) => {
|
|
94
101
|
request.onsuccess = () => {
|
|
95
102
|
resolve(true);
|
|
96
103
|
};
|
|
97
104
|
request.onerror = (event) => {
|
|
98
|
-
console.error("Error
|
|
105
|
+
console.error("Error deleting document", event?.target?.error);
|
|
99
106
|
reject(event?.target?.error);
|
|
100
107
|
};
|
|
101
108
|
});
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { type Ref, type WriteTransaction } from "roc-db";
|
|
2
|
+
export declare const commitDelete: (txn: WriteTransaction, ref: Ref) => Promise<unknown>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roc-db/indexed-db",
|
|
3
|
-
"version": "0.2.0-pre.
|
|
3
|
+
"version": "0.2.0-pre.46",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"sideEffects": false,
|
|
15
15
|
"dependencies": {},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"roc-db": "0.2.0-pre.
|
|
17
|
+
"roc-db": "0.2.0-pre.46",
|
|
18
18
|
"zod": "^3.0.0"
|
|
19
19
|
},
|
|
20
20
|
"keywords": [],
|