@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/replica/index.js
CHANGED
|
@@ -1,270 +1,277 @@
|
|
|
1
|
-
import { l as
|
|
1
|
+
import { l as Ee, a as Fe, f as oe, b as K, m as Ne, c as se, d as Oe, r as xe, e as ke, w as Se, R as je, i as Ce, g as re, h as Pe, j as Ae, k as De, n as ie, o as Re, p as Le, q as Ke, s as Ve, t as B, u as Ue, v as Ye, x as J } from "../replica-record-BaptWabD.js";
|
|
2
|
+
import { y as st } from "../replica-record-BaptWabD.js";
|
|
2
3
|
import { isFieldMap as ce } from "@ebbjs/core";
|
|
3
|
-
const
|
|
4
|
-
if (c ===
|
|
5
|
-
const
|
|
6
|
-
if (
|
|
7
|
-
const p = Object.keys(c.map),
|
|
8
|
-
if (p.length !==
|
|
9
|
-
for (const
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
4
|
+
const ae = (c, a) => {
|
|
5
|
+
if (c === a) return !0;
|
|
6
|
+
const u = ce(c), l = ce(a);
|
|
7
|
+
if (u !== l || !u || !l) return !1;
|
|
8
|
+
const p = Object.keys(c.map), y = Object.keys(a.map);
|
|
9
|
+
if (p.length !== y.length) return !1;
|
|
10
|
+
for (const m of p) {
|
|
11
|
+
const h = c.map[m], I = a.map[m];
|
|
12
|
+
if (h === void 0 || I === void 0 || !ae(h, I)) return !1;
|
|
12
13
|
}
|
|
13
14
|
return !0;
|
|
14
|
-
},
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
17
|
-
for (const l of
|
|
18
|
-
const p = c[l],
|
|
19
|
-
if (p === void 0 ||
|
|
15
|
+
}, ze = (c, a) => {
|
|
16
|
+
const u = Object.keys(c);
|
|
17
|
+
if (u.length !== Object.keys(a).length) return !1;
|
|
18
|
+
for (const l of u) {
|
|
19
|
+
const p = c[l], y = a[l];
|
|
20
|
+
if (p === void 0 || y === void 0 || !ae(p, y)) return !1;
|
|
20
21
|
}
|
|
21
22
|
return !0;
|
|
22
|
-
},
|
|
23
|
+
}, V = (c) => c == null, Be = (c, a) => V(c) || V(a) ? V(c) !== V(a) : c.type !== a.type || c.exists !== a.exists || c.created_hlc !== a.created_hlc || c.updated_hlc !== a.updated_hlc || c.deleted_hlc !== a.deleted_hlc ? !0 : !ze(c.data.fields, a.data.fields), Je = {
|
|
23
24
|
holds: () => !0
|
|
24
|
-
},
|
|
25
|
+
}, He = 1024, We = 16, Ge = 3e4, le = (c, a) => c === void 0 ? a : !Number.isFinite(c) || c <= 0 ? Number.POSITIVE_INFINITY : Math.max(1, Math.floor(c)), Qe = (c) => c === void 0 ? Ge : !Number.isFinite(c) || c <= 0 ? Number.POSITIVE_INFINITY : c, Xe = (c) => {
|
|
25
26
|
typeof c == "object" && "unref" in c && typeof c.unref == "function" && c.unref();
|
|
26
|
-
},
|
|
27
|
-
const
|
|
28
|
-
let
|
|
29
|
-
const
|
|
30
|
-
let
|
|
31
|
-
const
|
|
32
|
-
|
|
27
|
+
}, tt = (c) => {
|
|
28
|
+
const a = c?.materialization ?? Je, u = (e) => a.holds(e), l = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
|
|
29
|
+
let y = /* @__PURE__ */ new Map();
|
|
30
|
+
const m = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map(), fe = le(c?.journalCapacity, He), ue = le(c?.pinnedCapacity, We), H = Qe(c?.pinnedTtlMs), g = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Map();
|
|
31
|
+
let W = 0;
|
|
32
|
+
const E = /* @__PURE__ */ new Map();
|
|
33
|
+
let w = [], b = 0, O = {}, M = {}, d = 0, x = 0, F = 0;
|
|
34
|
+
const U = /* @__PURE__ */ new Set(), N = () => {
|
|
35
|
+
for (const e of U)
|
|
33
36
|
try {
|
|
34
37
|
e();
|
|
35
38
|
} catch (t) {
|
|
36
39
|
console.error("[Replica] change listener threw:", t);
|
|
37
40
|
}
|
|
41
|
+
}, C = (e, t) => {
|
|
42
|
+
const s = p.get(e);
|
|
43
|
+
s === void 0 ? p.set(e, /* @__PURE__ */ new Set([t])) : s.add(t);
|
|
38
44
|
}, P = (e, t) => {
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
const o = p.get(e);
|
|
43
|
-
o !== void 0 && (o.delete(t), o.size === 0 && p.delete(e));
|
|
44
|
-
}, Q = (e) => a(e.type) || g.has(e.id), A = (e) => {
|
|
45
|
+
const s = p.get(e);
|
|
46
|
+
s !== void 0 && (s.delete(t), s.size === 0 && p.delete(e));
|
|
47
|
+
}, G = (e) => u(e.type) || g.has(e.id), A = (e) => {
|
|
45
48
|
const t = g.get(e);
|
|
46
49
|
t !== void 0 && (t.timer !== null && clearTimeout(t.timer), g.delete(e));
|
|
47
|
-
},
|
|
48
|
-
v.has(e) && (v.delete(e),
|
|
49
|
-
},
|
|
50
|
+
}, Y = (e) => {
|
|
51
|
+
v.has(e) && (v.delete(e), E.delete(e), j.set(e, ++W));
|
|
52
|
+
}, Q = (e) => {
|
|
50
53
|
A(e), g.set(e, { open: !0, timer: null });
|
|
51
54
|
const t = [];
|
|
52
|
-
for (const
|
|
53
|
-
if (g.size - t.length <=
|
|
54
|
-
t.push(
|
|
55
|
+
for (const s of g.keys()) {
|
|
56
|
+
if (g.size - t.length <= ue) break;
|
|
57
|
+
t.push(s);
|
|
55
58
|
}
|
|
56
|
-
t.length > 0 &&
|
|
57
|
-
},
|
|
59
|
+
t.length > 0 && k(t);
|
|
60
|
+
}, de = (e) => {
|
|
58
61
|
const t = g.get(e);
|
|
59
62
|
if (!(t === void 0 || !t.open)) {
|
|
60
|
-
if (t.open = !1, !Number.isFinite(
|
|
61
|
-
|
|
63
|
+
if (t.open = !1, !Number.isFinite(H)) {
|
|
64
|
+
k([e]);
|
|
62
65
|
return;
|
|
63
66
|
}
|
|
64
|
-
t.timer = setTimeout(() =>
|
|
67
|
+
t.timer = setTimeout(() => k([e]), H), Xe(t.timer);
|
|
65
68
|
}
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
}, Z = () =>
|
|
69
|
-
const e = Z() -
|
|
70
|
-
e <= 0 || (
|
|
71
|
-
},
|
|
69
|
+
}, pe = (e) => g.get(e)?.open === !0, X = (e, t, s) => {
|
|
70
|
+
d += 1, w.push({ revision: d, id: e, deleted: t, components: s }), he();
|
|
71
|
+
}, Z = () => w.length - b, he = () => {
|
|
72
|
+
const e = Z() - fe;
|
|
73
|
+
e <= 0 || (b += e, x = w[b - 1].revision, b * 2 >= w.length && (w = w.slice(b), b = 0));
|
|
74
|
+
}, D = (e) => h.has(e) ? h.get(e) ?? null : l.get(e) ?? null, R = (e) => h.has(e) ? h.get(e) ?? void 0 : l.get(e), $ = (e) => {
|
|
72
75
|
const t = new Set(p.get(e) ?? []);
|
|
73
|
-
for (const [n,
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
+
for (const [n, o] of h)
|
|
77
|
+
o !== null && o.type === e ? t.add(n) : t.delete(n);
|
|
78
|
+
const s = [];
|
|
76
79
|
for (const n of t) {
|
|
77
|
-
const
|
|
78
|
-
|
|
80
|
+
const o = R(n);
|
|
81
|
+
o !== void 0 && s.push(o);
|
|
79
82
|
}
|
|
80
|
-
return
|
|
83
|
+
return s;
|
|
81
84
|
}, q = (e, t) => {
|
|
82
|
-
const
|
|
83
|
-
n === void 0 ? e.set(
|
|
84
|
-
}, ee = (e, t,
|
|
85
|
-
const
|
|
86
|
-
if (!
|
|
87
|
-
q(
|
|
85
|
+
const s = t.update.subject_id, n = e.get(s);
|
|
86
|
+
n === void 0 ? e.set(s, [t]) : n.push(t);
|
|
87
|
+
}, ee = (e, t, s, n) => {
|
|
88
|
+
const o = e.subject_id, r = l.get(o) ?? null, i = Ue(e, r);
|
|
89
|
+
if (!u(i) && !g.has(o) && v.has(o)) {
|
|
90
|
+
q(E, { update: e, gsn: t, hlc: s, position: n });
|
|
88
91
|
return;
|
|
89
92
|
}
|
|
90
|
-
const
|
|
91
|
-
if (
|
|
92
|
-
if (!
|
|
93
|
-
q(
|
|
93
|
+
const f = B(r, e, t, s, J);
|
|
94
|
+
if (f === null) {
|
|
95
|
+
if (!u(i) && !g.has(o)) return;
|
|
96
|
+
q(I, { update: e, gsn: t, hlc: s, position: n });
|
|
94
97
|
return;
|
|
95
98
|
}
|
|
96
|
-
if (!
|
|
97
|
-
r !== null && (l.delete(
|
|
99
|
+
if (!G(f)) {
|
|
100
|
+
r !== null && (l.delete(o), P(r.type, o)), r === null && I.delete(o);
|
|
98
101
|
return;
|
|
99
102
|
}
|
|
100
|
-
if (l.set(
|
|
101
|
-
const
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
let
|
|
106
|
-
for (const
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
if (l.set(o, f), r !== null && r.type !== f.type && P(r.type, o), C(f.type, o), r === null) {
|
|
104
|
+
const S = I.get(o);
|
|
105
|
+
if (S !== void 0) {
|
|
106
|
+
I.delete(o);
|
|
107
|
+
const _e = S.filter((T) => T.gsn > t).sort((T, Te) => T.gsn - Te.gsn);
|
|
108
|
+
let _ = f;
|
|
109
|
+
for (const T of _e)
|
|
110
|
+
_ = B(_, T.update, T.gsn, T.hlc, J) ?? _;
|
|
111
|
+
_ !== f && (l.set(o, _), f.type !== _.type && (P(f.type, o), C(_.type, o)));
|
|
109
112
|
}
|
|
110
113
|
}
|
|
111
114
|
}, te = (e, t) => {
|
|
112
|
-
const
|
|
113
|
-
|
|
115
|
+
const s = e ?? void 0, n = t ?? void 0;
|
|
116
|
+
O = ie(O, Re(s, n)), M = ie(M, Le(s, n));
|
|
117
|
+
const o = Ke(s, n);
|
|
118
|
+
o !== null && (y = Ve(y, o));
|
|
114
119
|
}, L = (e, t) => {
|
|
115
|
-
const
|
|
116
|
-
let
|
|
120
|
+
const s = l.get(e) ?? null, n = m.get(e);
|
|
121
|
+
let o = s;
|
|
117
122
|
if (n !== void 0)
|
|
118
|
-
for (const
|
|
119
|
-
|
|
120
|
-
const r =
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
for (const f of n)
|
|
124
|
+
o = B(o, f.update, 0, f.hlc, J);
|
|
125
|
+
const r = o !== null && G(o) ? o : null;
|
|
126
|
+
(r === null || u(r.type)) && A(e), n === void 0 || n.length === 0 ? h.delete(e) : h.set(e, r), te(t, r);
|
|
127
|
+
const i = (f) => X(e, f, Ye(t, r));
|
|
128
|
+
if (r === null) {
|
|
129
|
+
o !== null ? i(o.deleted_hlc !== null) : t !== null && i(!0);
|
|
123
130
|
return;
|
|
124
131
|
}
|
|
125
|
-
|
|
126
|
-
},
|
|
127
|
-
e.has(t) || e.set(t,
|
|
132
|
+
Be(t, r) && i(r.deleted_hlc !== null);
|
|
133
|
+
}, z = (e, t) => {
|
|
134
|
+
e.has(t) || e.set(t, D(t));
|
|
128
135
|
}, ne = (e, t) => {
|
|
129
|
-
const
|
|
130
|
-
for (const [n,
|
|
131
|
-
|
|
132
|
-
for (const n of
|
|
133
|
-
const r = (
|
|
134
|
-
r.length === 0 ?
|
|
136
|
+
const s = [];
|
|
137
|
+
for (const [n, o] of m)
|
|
138
|
+
o.some((r) => r.actionId === e) && (z(t, n), s.push(n));
|
|
139
|
+
for (const n of s) {
|
|
140
|
+
const r = (m.get(n) ?? []).filter((i) => i.actionId !== e);
|
|
141
|
+
r.length === 0 ? m.delete(n) : m.set(n, r);
|
|
135
142
|
}
|
|
136
|
-
return
|
|
137
|
-
},
|
|
143
|
+
return s;
|
|
144
|
+
}, ge = (e, t, s) => {
|
|
138
145
|
const n = /* @__PURE__ */ new Map();
|
|
139
|
-
for (const i of t)
|
|
140
|
-
const
|
|
141
|
-
for (const i of t) ee(i, e.gsn, e.hlc,
|
|
142
|
-
|
|
146
|
+
for (const i of t) z(n, i.subject_id);
|
|
147
|
+
const o = ne(e.id, n);
|
|
148
|
+
for (const i of t) ee(i, e.gsn, e.hlc, s);
|
|
149
|
+
s > F && (F = s);
|
|
143
150
|
const r = new Set(t.map((i) => i.subject_id));
|
|
144
|
-
for (const i of
|
|
151
|
+
for (const i of o) r.add(i);
|
|
145
152
|
for (const i of r) L(i, n.get(i) ?? null);
|
|
146
|
-
return
|
|
147
|
-
},
|
|
148
|
-
const t = /* @__PURE__ */ new Map(),
|
|
153
|
+
return N(), d;
|
|
154
|
+
}, me = (e) => {
|
|
155
|
+
const t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set();
|
|
149
156
|
for (const n of e.updates) {
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
const r = { actionId: e.id, update: n, hlc: e.hlc }, i =
|
|
153
|
-
i === void 0 ?
|
|
157
|
+
const o = n.subject_id;
|
|
158
|
+
z(t, o), s.add(o);
|
|
159
|
+
const r = { actionId: e.id, update: n, hlc: e.hlc }, i = m.get(o);
|
|
160
|
+
i === void 0 ? m.set(o, [r]) : i.push(r);
|
|
154
161
|
}
|
|
155
|
-
for (const n of
|
|
156
|
-
return
|
|
157
|
-
},
|
|
158
|
-
const t = /* @__PURE__ */ new Map(),
|
|
159
|
-
for (const n of
|
|
160
|
-
return
|
|
161
|
-
},
|
|
162
|
+
for (const n of s) L(n, t.get(n) ?? null);
|
|
163
|
+
return N(), d;
|
|
164
|
+
}, Ie = (e) => {
|
|
165
|
+
const t = /* @__PURE__ */ new Map(), s = ne(e, t);
|
|
166
|
+
for (const n of s) L(n, t.get(n) ?? null);
|
|
167
|
+
return N(), d;
|
|
168
|
+
}, k = (e) => {
|
|
162
169
|
const t = /* @__PURE__ */ new Set();
|
|
163
|
-
let
|
|
170
|
+
let s = !1;
|
|
164
171
|
for (const n of e) {
|
|
165
172
|
if (t.has(n)) continue;
|
|
166
|
-
t.add(n),
|
|
167
|
-
const
|
|
168
|
-
l.delete(n),
|
|
169
|
-
const i =
|
|
170
|
-
i !== null && (
|
|
173
|
+
t.add(n), Y(n), A(n), E.delete(n);
|
|
174
|
+
const o = D(n), r = l.get(n);
|
|
175
|
+
l.delete(n), m.delete(n), h.delete(n), I.delete(n), r !== void 0 && P(r.type, n), te(o, null);
|
|
176
|
+
const i = o ?? r ?? null;
|
|
177
|
+
i !== null && (s = !0, X(n, !0, ke(i)));
|
|
171
178
|
}
|
|
172
|
-
return
|
|
179
|
+
return s && N(), d;
|
|
173
180
|
}, ve = (e) => {
|
|
174
|
-
if (!
|
|
175
|
-
l.clear(), p.clear(),
|
|
176
|
-
for (const
|
|
177
|
-
|
|
178
|
-
const t = {},
|
|
179
|
-
const i =
|
|
180
|
-
i === void 0 ?
|
|
181
|
+
if (!Ce(e)) return d;
|
|
182
|
+
l.clear(), p.clear(), I.clear(), m.clear(), h.clear(), E.clear(), v.clear(), j.clear();
|
|
183
|
+
for (const o of g.keys()) A(o);
|
|
184
|
+
w.length = 0, b = 0;
|
|
185
|
+
const t = {}, s = {}, n = (o, r) => {
|
|
186
|
+
const i = o[r.key];
|
|
187
|
+
i === void 0 ? o[r.key] = { [r.rowId]: r.value } : i[r.rowId] = r.value;
|
|
181
188
|
};
|
|
182
|
-
for (const
|
|
183
|
-
if (!
|
|
184
|
-
const r = re(
|
|
185
|
-
l.set(r.id, r),
|
|
186
|
-
const i =
|
|
189
|
+
for (const o of e.entities) {
|
|
190
|
+
if (!u(o.type)) continue;
|
|
191
|
+
const r = re(o);
|
|
192
|
+
l.set(r.id, r), C(r.type, r.id);
|
|
193
|
+
const i = Pe(r);
|
|
187
194
|
i !== null && n(t, i);
|
|
188
|
-
const
|
|
189
|
-
|
|
195
|
+
const f = Ae(r);
|
|
196
|
+
f !== null && n(s, f);
|
|
190
197
|
}
|
|
191
|
-
return
|
|
192
|
-
},
|
|
198
|
+
return y = De(l.values()), O = t, M = s, d = e.revision > d ? e.revision : d + 1, x = d, F = e.position, N(), d;
|
|
199
|
+
}, ye = () => {
|
|
193
200
|
let e = Number.POSITIVE_INFINITY;
|
|
194
|
-
for (const n of
|
|
195
|
-
for (const
|
|
196
|
-
const t = e === Number.POSITIVE_INFINITY ?
|
|
201
|
+
for (const n of I.values())
|
|
202
|
+
for (const o of n) e = Math.min(e, o.position);
|
|
203
|
+
const t = e === Number.POSITIVE_INFINITY ? F : Math.min(F, e - 1), s = [];
|
|
197
204
|
for (const n of l.values())
|
|
198
|
-
|
|
205
|
+
u(n.type) && s.push(Se(n));
|
|
199
206
|
return {
|
|
200
|
-
format:
|
|
207
|
+
format: je,
|
|
201
208
|
position: t,
|
|
202
|
-
revision:
|
|
203
|
-
entities:
|
|
209
|
+
revision: d,
|
|
210
|
+
entities: s
|
|
204
211
|
};
|
|
205
212
|
}, we = () => {
|
|
206
|
-
const e = {}, t = {},
|
|
213
|
+
const e = {}, t = {}, s = new Set(p.keys());
|
|
207
214
|
for (const r of h.values())
|
|
208
|
-
r !== null &&
|
|
209
|
-
let n = 0,
|
|
210
|
-
for (const r of
|
|
215
|
+
r !== null && s.add(r.type);
|
|
216
|
+
let n = 0, o = 0;
|
|
217
|
+
for (const r of s) {
|
|
211
218
|
const i = $(r).length;
|
|
212
|
-
i !== 0 && (e[r] = i, n += i,
|
|
219
|
+
i !== 0 && (e[r] = i, n += i, u(r) && (t[r] = i, o += i));
|
|
213
220
|
}
|
|
214
221
|
return {
|
|
215
222
|
entities: n,
|
|
216
223
|
byType: e,
|
|
217
|
-
held:
|
|
224
|
+
held: o,
|
|
218
225
|
heldByType: t,
|
|
219
226
|
pinned: g.size,
|
|
220
|
-
revision:
|
|
221
|
-
position:
|
|
227
|
+
revision: d,
|
|
228
|
+
position: F,
|
|
222
229
|
changes: Z(),
|
|
223
|
-
changeFloor:
|
|
230
|
+
changeFloor: x
|
|
224
231
|
};
|
|
225
|
-
},
|
|
226
|
-
if (e <
|
|
232
|
+
}, be = (e) => {
|
|
233
|
+
if (e < x) return [];
|
|
227
234
|
const t = [];
|
|
228
|
-
for (let
|
|
229
|
-
const n =
|
|
235
|
+
for (let s = b; s < w.length; s += 1) {
|
|
236
|
+
const n = w[s];
|
|
230
237
|
n.revision > e && t.push(n);
|
|
231
238
|
}
|
|
232
239
|
return t;
|
|
233
|
-
},
|
|
234
|
-
const n =
|
|
235
|
-
l.set(e, t),
|
|
236
|
-
for (const
|
|
237
|
-
L(e, n),
|
|
240
|
+
}, Me = (e, t, s) => {
|
|
241
|
+
const n = D(e);
|
|
242
|
+
l.set(e, t), C(t.type, e), Q(e);
|
|
243
|
+
for (const o of s) ee(o.update, o.gsn, o.hlc, o.position);
|
|
244
|
+
L(e, n), N();
|
|
238
245
|
};
|
|
239
246
|
return {
|
|
240
247
|
get revision() {
|
|
241
|
-
return
|
|
248
|
+
return d;
|
|
242
249
|
},
|
|
243
250
|
get changeFloor() {
|
|
244
|
-
return
|
|
251
|
+
return x;
|
|
245
252
|
},
|
|
246
|
-
get:
|
|
253
|
+
get: R,
|
|
247
254
|
base: (e) => l.get(e),
|
|
248
255
|
iterate: $,
|
|
249
|
-
isHeld:
|
|
256
|
+
isHeld: u,
|
|
250
257
|
open: (e) => {
|
|
251
|
-
const t =
|
|
258
|
+
const t = R(e);
|
|
252
259
|
if (t !== void 0)
|
|
253
|
-
return
|
|
254
|
-
const
|
|
255
|
-
if (
|
|
260
|
+
return u(t.type) || Q(e), Promise.resolve(t);
|
|
261
|
+
const s = v.get(e);
|
|
262
|
+
if (s !== void 0) return s;
|
|
256
263
|
const n = c?.readEntity;
|
|
257
264
|
if (n === void 0) return Promise.resolve(null);
|
|
258
|
-
const
|
|
259
|
-
|
|
265
|
+
const o = ++W;
|
|
266
|
+
j.set(e, o);
|
|
260
267
|
const r = n(e).then(
|
|
261
268
|
(i) => {
|
|
262
|
-
if (v.get(e) === r && v.delete(e),
|
|
263
|
-
const
|
|
264
|
-
if (
|
|
265
|
-
if (
|
|
266
|
-
const
|
|
267
|
-
return
|
|
269
|
+
if (v.get(e) === r && v.delete(e), j.get(e) !== o) return null;
|
|
270
|
+
const f = E.get(e) ?? [];
|
|
271
|
+
if (E.delete(e), i === null) return null;
|
|
272
|
+
if (u(i.type)) return i;
|
|
273
|
+
const S = re(i);
|
|
274
|
+
return Me(e, S, f), R(e) ?? S;
|
|
268
275
|
},
|
|
269
276
|
(i) => {
|
|
270
277
|
throw v.get(e) === r && v.delete(e), i;
|
|
@@ -273,36 +280,38 @@ const fe = (c, f) => {
|
|
|
273
280
|
return v.set(e, r), r;
|
|
274
281
|
},
|
|
275
282
|
close: (e) => {
|
|
276
|
-
const t =
|
|
283
|
+
const t = D(e);
|
|
277
284
|
if (t === null) {
|
|
278
|
-
|
|
285
|
+
Y(e);
|
|
279
286
|
return;
|
|
280
287
|
}
|
|
281
|
-
|
|
288
|
+
u(t.type) || (Y(e), g.has(e) ? de(e) : k([e]));
|
|
282
289
|
},
|
|
283
|
-
isOpen:
|
|
284
|
-
changesSince:
|
|
290
|
+
isOpen: pe,
|
|
291
|
+
changesSince: be,
|
|
285
292
|
stats: we,
|
|
286
|
-
relationships: (e) => e.sourceId !== void 0 ?
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
+
relationships: (e) => e.sourceId !== void 0 ? K(M[oe(e.as, e.type, e.sourceId)]) : e.targetId !== void 0 ? K(O[xe(e.as, e.type, e.targetId)]) : [],
|
|
294
|
+
components: (e) => Oe(y, e),
|
|
295
|
+
memberships: (e) => e.groupId !== void 0 ? K(O[Ne(e.groupId)]) : e.entityId !== void 0 ? K(M[se(e.entityId)]) : [],
|
|
296
|
+
relationshipLinks: (e) => Fe(M[oe(e.as, e.type, e.sourceId)]),
|
|
297
|
+
membershipLinks: (e) => Ee(M[se(e)]),
|
|
298
|
+
ingest: ge,
|
|
299
|
+
optimistic: me,
|
|
300
|
+
discard: Ie,
|
|
293
301
|
load: ve,
|
|
294
|
-
toRecord:
|
|
295
|
-
evict:
|
|
296
|
-
subscribe: (e) => (
|
|
297
|
-
|
|
302
|
+
toRecord: ye,
|
|
303
|
+
evict: k,
|
|
304
|
+
subscribe: (e) => (U.add(e), () => {
|
|
305
|
+
U.delete(e);
|
|
298
306
|
})
|
|
299
307
|
};
|
|
300
308
|
};
|
|
301
309
|
export {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
310
|
+
We as DEFAULT_PINNED_CAPACITY,
|
|
311
|
+
Ge as DEFAULT_PINNED_TTL_MS,
|
|
312
|
+
B as applyUpdate,
|
|
313
|
+
Be as contentChanged,
|
|
314
|
+
tt as createReplica,
|
|
315
|
+
st as foldEntityAction,
|
|
316
|
+
Je as holdAll
|
|
308
317
|
};
|