@ebbjs/storage 0.3.0 → 1.1.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/dist/indexeddb/index.d.ts +55 -20
- package/dist/indexeddb/index.js +202 -179
- package/dist/memory/index.d.ts +56 -21
- package/dist/memory/index.js +105 -87
- package/dist/replica/index.d.ts +49 -11
- package/dist/replica/index.js +209 -200
- package/dist/replica-record-BaptWabD.js +243 -0
- package/dist/types/index.d.ts +92 -23
- package/package.json +2 -2
- package/dist/replica-record-D3lkFACh.js +0 -167
package/dist/indexeddb/index.js
CHANGED
|
@@ -1,121 +1,125 @@
|
|
|
1
|
-
import { unwrap as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { compare as
|
|
5
|
-
const
|
|
1
|
+
import { unwrap as D, openDB as O } from "idb";
|
|
2
|
+
import { c as T, l as N, f as R, a as b, b as C, e as k, o as P, p as B, z as M, B as F, C as H, M as x, m as L, A as j, r as G, i as K, u as I } from "../replica-record-BaptWabD.js";
|
|
3
|
+
import { m as U, a as V, i as Y, c as h } from "../cursor-record-D39emd6R.js";
|
|
4
|
+
import { componentModel as z, compare as X } from "@ebbjs/core";
|
|
5
|
+
const Q = 11, J = 9, W = 11, f = "actionPosition", A = "replica", Z = (t, e, o, a) => {
|
|
6
|
+
const s = [J, W], u = e > 0 && s.some((i) => e < i);
|
|
7
|
+
if (u)
|
|
8
|
+
for (const i of Array.from(t.objectStoreNames))
|
|
9
|
+
t.deleteObjectStore(i);
|
|
6
10
|
if (t.objectStoreNames.contains("actions"))
|
|
7
|
-
|
|
11
|
+
a.objectStore("actions").indexNames.contains("position") || a.objectStore("actions").createIndex("position", "position");
|
|
8
12
|
else {
|
|
9
|
-
const
|
|
10
|
-
|
|
13
|
+
const i = t.createObjectStore("actions", { keyPath: "id" });
|
|
14
|
+
i.createIndex("subject_id", "subject_ids", { multiEntry: !0 }), i.createIndex("position", "position");
|
|
11
15
|
}
|
|
12
16
|
if (!t.objectStoreNames.contains("entities")) {
|
|
13
|
-
const
|
|
14
|
-
|
|
17
|
+
const i = t.createObjectStore("entities", { keyPath: "id" });
|
|
18
|
+
i.indexNames.contains("type") || i.createIndex("type", "type"), i.createIndex("components", "components", { multiEntry: !0 });
|
|
15
19
|
}
|
|
16
20
|
if (t.objectStoreNames.contains("relationships") || t.createObjectStore("relationships", { keyPath: "key" }), !t.objectStoreNames.contains("dirty")) {
|
|
17
|
-
const
|
|
18
|
-
|
|
21
|
+
const i = t.createObjectStore("dirty", { keyPath: "entityId" });
|
|
22
|
+
i.indexNames.contains("entityType") || i.createIndex("entityType", "entityType");
|
|
19
23
|
}
|
|
20
|
-
t.objectStoreNames.contains("cursors") || t.createObjectStore("cursors", { keyPath: "groupId" }), t.objectStoreNames.contains("outbox") || t.createObjectStore("outbox", { keyPath: "action.id" }), t.objectStoreNames.contains("sequence") || t.createObjectStore("sequence", { keyPath: "id" }), t.objectStoreNames.contains("replica") || t.createObjectStore("replica", { keyPath: ["type", "id"] }), t.objectStoreNames.contains("replicaCursor") || t.createObjectStore("replicaCursor", { keyPath: "id" }), e < 8 &&
|
|
21
|
-
},
|
|
22
|
-
const e =
|
|
23
|
-
let
|
|
24
|
+
t.objectStoreNames.contains("cursors") || t.createObjectStore("cursors", { keyPath: "groupId" }), t.objectStoreNames.contains("outbox") || t.createObjectStore("outbox", { keyPath: "action.id" }), t.objectStoreNames.contains("sequence") || t.createObjectStore("sequence", { keyPath: "id" }), t.objectStoreNames.contains("replica") || t.createObjectStore("replica", { keyPath: ["type", "id"] }), t.objectStoreNames.contains("replicaCursor") || t.createObjectStore("replicaCursor", { keyPath: "id" }), u ? a.objectStore("sequence").put({ id: f, value: 0 }) : e < 8 && $(a);
|
|
25
|
+
}, $ = (t) => {
|
|
26
|
+
const e = D(t.objectStore("actions")), o = t.objectStore("sequence");
|
|
27
|
+
let a = 0;
|
|
24
28
|
const s = e.openCursor();
|
|
25
29
|
s.onsuccess = () => {
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
|
|
30
|
+
const u = s.result;
|
|
31
|
+
if (u === null) {
|
|
32
|
+
o.put({ id: f, value: a });
|
|
29
33
|
return;
|
|
30
34
|
}
|
|
31
|
-
|
|
35
|
+
a += 1, u.update({ ...u.value, position: a }), u.continue();
|
|
32
36
|
};
|
|
33
|
-
},
|
|
37
|
+
}, tt = (t) => {
|
|
34
38
|
const e = /* @__PURE__ */ new Set();
|
|
35
|
-
for (const
|
|
36
|
-
e.add(
|
|
39
|
+
for (const o of t.updates)
|
|
40
|
+
e.add(o.subject_id);
|
|
37
41
|
return Array.from(e);
|
|
38
|
-
},
|
|
39
|
-
const { subject_ids: e, position:
|
|
40
|
-
return
|
|
41
|
-
},
|
|
42
|
-
const
|
|
43
|
-
return await
|
|
44
|
-
},
|
|
42
|
+
}, g = (t) => {
|
|
43
|
+
const { subject_ids: e, position: o, ...a } = t;
|
|
44
|
+
return a;
|
|
45
|
+
}, E = async (t, e) => {
|
|
46
|
+
const o = t.objectStore("actions"), a = await o.get(e.id), s = await t.objectStore("sequence").get(f), u = a === void 0, i = u ? (s?.value ?? 0) + 1 : a.position, y = a === void 0 ? e : { ...e, updates: U(a.updates, e.updates) }, w = V(a?.updates ?? [], e.updates);
|
|
47
|
+
return await o.put({ ...y, position: i, subject_ids: tt(y) }), u && await t.objectStore("sequence").put({ id: f, value: i }), { action: y, position: i, added: w };
|
|
48
|
+
}, et = (t) => ({
|
|
45
49
|
async append(e) {
|
|
46
|
-
const
|
|
47
|
-
return await
|
|
50
|
+
const o = t.transaction(["actions", "sequence"], "readwrite"), a = await E(o, e);
|
|
51
|
+
return await o.done, a;
|
|
48
52
|
},
|
|
49
53
|
async appendMany(e) {
|
|
50
|
-
const
|
|
54
|
+
const o = t.transaction(["actions", "sequence"], "readwrite"), a = [];
|
|
51
55
|
for (const s of e)
|
|
52
|
-
|
|
53
|
-
return await
|
|
56
|
+
a.push(await E(o, s));
|
|
57
|
+
return await o.done, a;
|
|
54
58
|
},
|
|
55
59
|
async readTail(e) {
|
|
56
|
-
const
|
|
57
|
-
return await
|
|
58
|
-
action:
|
|
60
|
+
const o = t.transaction("actions", "readonly"), a = await o.store.index("position").getAll(IDBKeyRange.lowerBound(e, !0));
|
|
61
|
+
return await o.done, a.map((s) => ({
|
|
62
|
+
action: g(s),
|
|
59
63
|
position: s.position,
|
|
60
64
|
added: s.updates
|
|
61
65
|
}));
|
|
62
66
|
},
|
|
63
67
|
async lastPosition() {
|
|
64
|
-
return (await t.get("sequence",
|
|
68
|
+
return (await t.get("sequence", f))?.value ?? 0;
|
|
65
69
|
},
|
|
66
70
|
async getAll() {
|
|
67
|
-
return (await t.getAll("actions")).map(
|
|
71
|
+
return (await t.getAll("actions")).map(g);
|
|
68
72
|
},
|
|
69
73
|
async getForEntity(e) {
|
|
70
|
-
const
|
|
71
|
-
return await
|
|
74
|
+
const o = t.transaction("actions", "readonly"), a = await o.store.index("subject_id").getAll(e);
|
|
75
|
+
return await o.done, a.map(g).sort((u, i) => u.gsn - i.gsn);
|
|
72
76
|
},
|
|
73
77
|
async clear() {
|
|
74
78
|
const e = t.transaction(["actions", "sequence"], "readwrite");
|
|
75
|
-
await e.objectStore("actions").clear(), await e.objectStore("sequence").put({ id:
|
|
79
|
+
await e.objectStore("actions").clear(), await e.objectStore("sequence").put({ id: f, value: 0 }), await e.done;
|
|
76
80
|
}
|
|
77
|
-
}),
|
|
78
|
-
const e = async (
|
|
81
|
+
}), v = (t) => t === void 0 ? null : h(t), ot = (t) => {
|
|
82
|
+
const e = async (o) => v(await t.get("cursors", o));
|
|
79
83
|
return {
|
|
80
|
-
async get(
|
|
81
|
-
return (await t.get("cursors",
|
|
84
|
+
async get(o) {
|
|
85
|
+
return (await t.get("cursors", o))?.cursor ?? null;
|
|
82
86
|
},
|
|
83
|
-
async set(
|
|
84
|
-
const s = await e(
|
|
85
|
-
await t.put("cursors", { groupId:
|
|
87
|
+
async set(o, a) {
|
|
88
|
+
const s = await e(o);
|
|
89
|
+
await t.put("cursors", { groupId: o, ...s, cursor: a });
|
|
86
90
|
},
|
|
87
|
-
async getRecord(
|
|
88
|
-
return e(
|
|
91
|
+
async getRecord(o) {
|
|
92
|
+
return e(o);
|
|
89
93
|
},
|
|
90
|
-
async setRecord(
|
|
91
|
-
if (
|
|
92
|
-
await t.delete("cursors",
|
|
94
|
+
async setRecord(o, a) {
|
|
95
|
+
if (Y(a)) {
|
|
96
|
+
await t.delete("cursors", o);
|
|
93
97
|
return;
|
|
94
98
|
}
|
|
95
99
|
await t.put("cursors", {
|
|
96
|
-
groupId:
|
|
97
|
-
...
|
|
100
|
+
groupId: o,
|
|
101
|
+
...h(a)
|
|
98
102
|
});
|
|
99
103
|
},
|
|
100
104
|
async records() {
|
|
101
|
-
const
|
|
102
|
-
for (const s of
|
|
103
|
-
|
|
104
|
-
return
|
|
105
|
+
const o = await t.getAll("cursors"), a = /* @__PURE__ */ new Map();
|
|
106
|
+
for (const s of o)
|
|
107
|
+
a.set(s.groupId, v(s) ?? {});
|
|
108
|
+
return a;
|
|
105
109
|
},
|
|
106
110
|
async clear() {
|
|
107
111
|
await t.clear("cursors");
|
|
108
112
|
}
|
|
109
113
|
};
|
|
110
|
-
},
|
|
111
|
-
async mark(e,
|
|
112
|
-
await t.get("dirty", e) || await t.put("dirty", { entityId: e, entityType:
|
|
114
|
+
}, at = (t) => ({
|
|
115
|
+
async mark(e, o) {
|
|
116
|
+
await t.get("dirty", e) || await t.put("dirty", { entityId: e, entityType: o });
|
|
113
117
|
},
|
|
114
118
|
async isDirty(e) {
|
|
115
119
|
return await t.get("dirty", e) !== void 0;
|
|
116
120
|
},
|
|
117
121
|
async getDirtyForType(e) {
|
|
118
|
-
return (await t.getAllFromIndex("dirty", "entityType", e)).map((
|
|
122
|
+
return (await t.getAllFromIndex("dirty", "entityType", e)).map((a) => a.entityId);
|
|
119
123
|
},
|
|
120
124
|
async clear(e) {
|
|
121
125
|
await t.delete("dirty", e);
|
|
@@ -123,86 +127,99 @@ const z = 8, m = "actionPosition", A = "replica", Q = (t, e, a, n) => {
|
|
|
123
127
|
async clearAll() {
|
|
124
128
|
await t.clear("dirty");
|
|
125
129
|
}
|
|
126
|
-
}),
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
await
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}, y = async (
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
await
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
|
|
130
|
+
}), nt = (t, e, o) => {
|
|
131
|
+
const a = (n) => ({
|
|
132
|
+
...structuredClone(n),
|
|
133
|
+
components: k(n)
|
|
134
|
+
}), s = (n) => {
|
|
135
|
+
const { components: r, ...l } = n;
|
|
136
|
+
return l;
|
|
137
|
+
}, u = async (n) => {
|
|
138
|
+
const r = await t.get("entities", n);
|
|
139
|
+
return r === void 0 ? void 0 : s(r);
|
|
140
|
+
}, i = async (n, r) => {
|
|
141
|
+
r === null ? await t.delete("relationships", n) : await t.put("relationships", { key: n, rows: r });
|
|
142
|
+
}, y = async (n) => {
|
|
143
|
+
const r = await t.get("relationships", n.key);
|
|
144
|
+
await i(n.key, H(r?.rows, n));
|
|
145
|
+
}, w = async (n) => {
|
|
146
|
+
const r = await t.get("relationships", n.key);
|
|
147
|
+
await i(n.key, F(r?.rows, n));
|
|
148
|
+
}, c = async (n, r) => {
|
|
149
|
+
for (const l of [P(n, r), B(n, r)])
|
|
150
|
+
l.remove !== null && await w(l.remove), l.add !== null && await y(l.add);
|
|
151
|
+
}, p = async (n) => {
|
|
152
|
+
if (!await o.isDirty(n)) return;
|
|
153
|
+
const l = await e.getForEntity(n);
|
|
154
|
+
if (l.length === 0) return;
|
|
155
|
+
const S = M(l, n);
|
|
156
|
+
if (S === null) return;
|
|
157
|
+
const q = await u(n);
|
|
158
|
+
await t.put("entities", a(S)), await c(q, S), await o.clear(n);
|
|
159
|
+
}, d = async (n) => {
|
|
160
|
+
for (const r of await o.getDirtyForType(n))
|
|
161
|
+
await p(r);
|
|
162
|
+
}, m = async (n) => {
|
|
163
|
+
const r = await t.get("relationships", n);
|
|
164
|
+
return C(r?.rows);
|
|
155
165
|
};
|
|
156
166
|
return {
|
|
157
|
-
async get(
|
|
158
|
-
await
|
|
159
|
-
const r = await t.get("entities",
|
|
160
|
-
return r ?
|
|
167
|
+
async get(n) {
|
|
168
|
+
await p(n);
|
|
169
|
+
const r = await t.get("entities", n);
|
|
170
|
+
return r === void 0 ? null : s(r);
|
|
171
|
+
},
|
|
172
|
+
async set(n) {
|
|
173
|
+
const r = await u(n.id);
|
|
174
|
+
await t.put("entities", a(n)), await c(r, n);
|
|
161
175
|
},
|
|
162
|
-
async
|
|
163
|
-
|
|
164
|
-
await t.put("entities", n(o)), await p(r, o);
|
|
176
|
+
async query(n) {
|
|
177
|
+
return await d(n), (await t.getAllFromIndex("entities", "type", n)).map(s);
|
|
165
178
|
},
|
|
166
|
-
async
|
|
167
|
-
return await
|
|
179
|
+
async queryByComponent(n) {
|
|
180
|
+
return await d(z(n)), (await t.getAllFromIndex("entities", "components", n)).filter((l) => l.deleted_hlc === null).map((l) => l.id).sort();
|
|
168
181
|
},
|
|
169
182
|
async queryByRelationship({
|
|
170
|
-
as:
|
|
183
|
+
as: n,
|
|
171
184
|
type: r,
|
|
172
|
-
targetId:
|
|
185
|
+
targetId: l
|
|
173
186
|
}) {
|
|
174
|
-
return await
|
|
187
|
+
return await d(j), m(G(n, r, l));
|
|
175
188
|
},
|
|
176
189
|
async queryByRelationshipSource({
|
|
177
|
-
as:
|
|
190
|
+
as: n,
|
|
178
191
|
type: r,
|
|
179
|
-
sourceId:
|
|
192
|
+
sourceId: l
|
|
180
193
|
}) {
|
|
181
|
-
await
|
|
182
|
-
const
|
|
183
|
-
return
|
|
194
|
+
await d(j);
|
|
195
|
+
const S = await t.get("relationships", R(n, r, l));
|
|
196
|
+
return b(S?.rows);
|
|
184
197
|
},
|
|
185
|
-
async queryByMembership(
|
|
186
|
-
return await
|
|
198
|
+
async queryByMembership(n) {
|
|
199
|
+
return await d(x), m(L(n));
|
|
187
200
|
},
|
|
188
|
-
async queryByMembershipEntity(
|
|
189
|
-
await
|
|
190
|
-
const r = await t.get("relationships",
|
|
191
|
-
return
|
|
201
|
+
async queryByMembershipEntity(n) {
|
|
202
|
+
await d(x);
|
|
203
|
+
const r = await t.get("relationships", T(n));
|
|
204
|
+
return N(r?.rows);
|
|
192
205
|
},
|
|
193
206
|
async reset() {
|
|
194
207
|
await t.clear("relationships"), await t.clear("entities");
|
|
195
208
|
}
|
|
196
209
|
};
|
|
197
|
-
},
|
|
210
|
+
}, st = (t) => ({
|
|
211
|
+
...t,
|
|
212
|
+
scope: t.scope ?? "field",
|
|
213
|
+
remoteActions: t.remoteActions ?? []
|
|
214
|
+
}), _ = (t) => ({
|
|
198
215
|
action: t.action,
|
|
199
216
|
status: t.status,
|
|
200
217
|
enqueuedAtHlc: t.enqueuedAtHlc,
|
|
201
218
|
// A row predating the field reads as "always concurrent", never
|
|
202
219
|
// silently dropped.
|
|
203
220
|
basedOnGsn: t.basedOnGsn ?? 0,
|
|
204
|
-
conflict: t.conflict
|
|
205
|
-
}),
|
|
221
|
+
conflict: t.conflict === void 0 ? void 0 : st(t.conflict)
|
|
222
|
+
}), rt = (t) => ({
|
|
206
223
|
async put(e) {
|
|
207
224
|
await t.put("outbox", {
|
|
208
225
|
action: e.action,
|
|
@@ -212,22 +229,22 @@ const z = 8, m = "actionPosition", A = "replica", Q = (t, e, a, n) => {
|
|
|
212
229
|
conflict: e.conflict
|
|
213
230
|
});
|
|
214
231
|
},
|
|
215
|
-
async putAndDelete(e,
|
|
216
|
-
const
|
|
217
|
-
|
|
232
|
+
async putAndDelete(e, o) {
|
|
233
|
+
const a = t.transaction("outbox", "readwrite");
|
|
234
|
+
a.store.put({
|
|
218
235
|
action: e.action,
|
|
219
236
|
status: e.status,
|
|
220
237
|
enqueuedAtHlc: e.enqueuedAtHlc,
|
|
221
238
|
basedOnGsn: e.basedOnGsn,
|
|
222
239
|
conflict: e.conflict
|
|
223
|
-
}),
|
|
240
|
+
}), a.store.delete(o), await a.done;
|
|
224
241
|
},
|
|
225
242
|
async list() {
|
|
226
|
-
return (await t.getAll("outbox")).map(
|
|
243
|
+
return (await t.getAll("outbox")).map(_).sort((o, a) => X(o.enqueuedAtHlc, a.enqueuedAtHlc));
|
|
227
244
|
},
|
|
228
245
|
async get(e) {
|
|
229
|
-
const
|
|
230
|
-
return
|
|
246
|
+
const o = await t.get("outbox", e);
|
|
247
|
+
return o === void 0 ? null : _(o);
|
|
231
248
|
},
|
|
232
249
|
async delete(e) {
|
|
233
250
|
await t.delete("outbox", e);
|
|
@@ -235,101 +252,107 @@ const z = 8, m = "actionPosition", A = "replica", Q = (t, e, a, n) => {
|
|
|
235
252
|
async clear() {
|
|
236
253
|
await t.clear("outbox");
|
|
237
254
|
}
|
|
238
|
-
}),
|
|
255
|
+
}), it = (t) => ({
|
|
239
256
|
async load() {
|
|
240
|
-
const e = t.transaction(["replica", "replicaCursor"], "readonly"),
|
|
241
|
-
if (
|
|
257
|
+
const e = t.transaction(["replica", "replicaCursor"], "readonly"), o = await e.objectStore("replicaCursor").get(A);
|
|
258
|
+
if (o === void 0)
|
|
242
259
|
return await e.done, null;
|
|
243
|
-
const
|
|
260
|
+
const a = await e.objectStore("replica").getAll();
|
|
244
261
|
await e.done;
|
|
245
262
|
const s = {
|
|
246
|
-
format:
|
|
247
|
-
position:
|
|
248
|
-
revision:
|
|
249
|
-
entities:
|
|
263
|
+
format: o.format,
|
|
264
|
+
position: o.position,
|
|
265
|
+
revision: o.revision,
|
|
266
|
+
entities: a
|
|
250
267
|
};
|
|
251
|
-
return
|
|
268
|
+
return K(s) ? s : null;
|
|
252
269
|
},
|
|
253
270
|
async save(e) {
|
|
254
|
-
const
|
|
255
|
-
await
|
|
271
|
+
const o = t.transaction(["replica", "replicaCursor"], "readwrite"), a = o.objectStore("replica");
|
|
272
|
+
await a.clear();
|
|
256
273
|
for (const s of e.entities)
|
|
257
|
-
await
|
|
258
|
-
await
|
|
274
|
+
await a.put(s);
|
|
275
|
+
await o.objectStore("replicaCursor").put({
|
|
259
276
|
id: A,
|
|
260
277
|
format: e.format,
|
|
261
278
|
position: e.position,
|
|
262
279
|
revision: e.revision
|
|
263
|
-
}), await
|
|
280
|
+
}), await o.done;
|
|
264
281
|
},
|
|
265
282
|
async clear() {
|
|
266
283
|
const e = t.transaction(["replica", "replicaCursor"], "readwrite");
|
|
267
284
|
await e.objectStore("replica").clear(), await e.objectStore("replicaCursor").clear(), await e.done;
|
|
268
285
|
}
|
|
269
|
-
}),
|
|
270
|
-
const e = t.dbName ?? "ebb-storage",
|
|
271
|
-
upgrade:
|
|
272
|
-
}),
|
|
286
|
+
}), yt = async (t = {}) => {
|
|
287
|
+
const e = t.dbName ?? "ebb-storage", o = await O(e, Q, {
|
|
288
|
+
upgrade: Z
|
|
289
|
+
}), a = et(o), s = at(o), u = nt(o, a, s), i = ot(o), y = rt(o), w = it(o);
|
|
273
290
|
return {
|
|
274
291
|
actions: {
|
|
275
|
-
async append(
|
|
276
|
-
const
|
|
277
|
-
for (const
|
|
278
|
-
await s.mark(
|
|
279
|
-
|
|
292
|
+
async append(c) {
|
|
293
|
+
const p = await a.append(c);
|
|
294
|
+
for (const d of c.updates)
|
|
295
|
+
await s.mark(
|
|
296
|
+
d.subject_id,
|
|
297
|
+
I(d, await u.get(d.subject_id))
|
|
298
|
+
);
|
|
299
|
+
return p;
|
|
280
300
|
},
|
|
281
|
-
async appendMany(
|
|
282
|
-
const
|
|
283
|
-
for (const
|
|
284
|
-
for (const
|
|
285
|
-
await s.mark(
|
|
286
|
-
|
|
301
|
+
async appendMany(c) {
|
|
302
|
+
const p = await a.appendMany(c);
|
|
303
|
+
for (const d of c)
|
|
304
|
+
for (const m of d.updates)
|
|
305
|
+
await s.mark(
|
|
306
|
+
m.subject_id,
|
|
307
|
+
I(m, await u.get(m.subject_id))
|
|
308
|
+
);
|
|
309
|
+
return p;
|
|
287
310
|
},
|
|
288
|
-
async readTail(
|
|
289
|
-
return
|
|
311
|
+
async readTail(c) {
|
|
312
|
+
return a.readTail(c);
|
|
290
313
|
},
|
|
291
314
|
async lastPosition() {
|
|
292
|
-
return
|
|
315
|
+
return a.lastPosition();
|
|
293
316
|
},
|
|
294
317
|
async getAll() {
|
|
295
|
-
return
|
|
318
|
+
return a.getAll();
|
|
296
319
|
},
|
|
297
|
-
async getForEntity(
|
|
298
|
-
return
|
|
320
|
+
async getForEntity(c) {
|
|
321
|
+
return a.getForEntity(c);
|
|
299
322
|
},
|
|
300
323
|
async clear() {
|
|
301
|
-
await
|
|
324
|
+
await a.clear(), await s.clearAll(), await u.reset(), await w.clear();
|
|
302
325
|
}
|
|
303
326
|
},
|
|
304
|
-
entities:
|
|
327
|
+
entities: u,
|
|
305
328
|
dirtyTracker: {
|
|
306
|
-
async mark(
|
|
307
|
-
await s.mark(
|
|
329
|
+
async mark(c, p) {
|
|
330
|
+
await s.mark(c, p);
|
|
308
331
|
},
|
|
309
|
-
async isDirty(
|
|
310
|
-
return s.isDirty(
|
|
332
|
+
async isDirty(c) {
|
|
333
|
+
return s.isDirty(c);
|
|
311
334
|
},
|
|
312
|
-
async getDirtyForType(
|
|
313
|
-
return s.getDirtyForType(
|
|
335
|
+
async getDirtyForType(c) {
|
|
336
|
+
return s.getDirtyForType(c);
|
|
314
337
|
},
|
|
315
|
-
async clear(
|
|
316
|
-
await s.clear(
|
|
338
|
+
async clear(c) {
|
|
339
|
+
await s.clear(c);
|
|
317
340
|
},
|
|
318
341
|
async clearAll() {
|
|
319
342
|
await s.clearAll();
|
|
320
343
|
}
|
|
321
344
|
},
|
|
322
|
-
cursors:
|
|
323
|
-
outbox:
|
|
324
|
-
replica:
|
|
325
|
-
async isDirty(
|
|
326
|
-
return s.isDirty(
|
|
345
|
+
cursors: i,
|
|
346
|
+
outbox: y,
|
|
347
|
+
replica: w,
|
|
348
|
+
async isDirty(c) {
|
|
349
|
+
return s.isDirty(c);
|
|
327
350
|
},
|
|
328
351
|
async reset() {
|
|
329
|
-
await
|
|
352
|
+
await a.clear(), await s.clearAll(), await u.reset(), await w.clear(), await i.clear();
|
|
330
353
|
}
|
|
331
354
|
};
|
|
332
355
|
};
|
|
333
356
|
export {
|
|
334
|
-
|
|
357
|
+
yt as createIndexedDBAdapter
|
|
335
358
|
};
|