fetchium 0.3.0 → 0.3.1
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/CHANGELOG.md +6 -0
- package/dist/cjs/development/QueryClient-BefSCMoE.js +2 -0
- package/dist/cjs/development/{QueryClient-QKhS8mhg.js.map → QueryClient-BefSCMoE.js.map} +1 -1
- package/dist/cjs/development/index.js +1 -1
- package/dist/cjs/{production/mutation-CgS9gXW7.js → development/mutation-OJNwoJcf.js} +2 -2
- package/dist/cjs/{production/mutation-CgS9gXW7.js.map → development/mutation-OJNwoJcf.js.map} +1 -1
- package/dist/cjs/development/react/index.js +1 -1
- package/dist/cjs/development/rest/index.js +1 -1
- package/dist/cjs/development/topic/index.js +1 -1
- package/dist/cjs/production/QueryClient-rbPYznie.js +2 -0
- package/dist/cjs/production/{QueryClient-DIAqDTHF.js.map → QueryClient-rbPYznie.js.map} +1 -1
- package/dist/cjs/production/index.js +1 -1
- package/dist/cjs/{development/mutation-w67Vpuvw.js → production/mutation-CjSajlTU.js} +2 -2
- package/dist/cjs/{development/mutation-w67Vpuvw.js.map → production/mutation-CjSajlTU.js.map} +1 -1
- package/dist/cjs/production/react/index.js +1 -1
- package/dist/cjs/production/rest/index.js +1 -1
- package/dist/cjs/production/topic/index.js +1 -1
- package/dist/esm/EntityInstance.d.ts.map +1 -1
- package/dist/esm/development/{QueryClient-C9tBdK1Z.js → QueryClient-DfxP7pt2.js} +511 -514
- package/dist/esm/development/{QueryClient-C9tBdK1Z.js.map → QueryClient-DfxP7pt2.js.map} +1 -1
- package/dist/esm/development/index.js +2 -2
- package/dist/esm/development/{mutation-Dx63NCGk.js → mutation-DZAq7Pbu.js} +2 -2
- package/dist/esm/development/{mutation-Dx63NCGk.js.map → mutation-DZAq7Pbu.js.map} +1 -1
- package/dist/esm/development/react/index.js +1 -1
- package/dist/esm/development/rest/index.js +2 -2
- package/dist/esm/development/topic/index.js +1 -1
- package/dist/esm/production/{QueryClient-D64xo0EA.js → QueryClient-DrWSXg0y.js} +408 -409
- package/dist/esm/production/{QueryClient-D64xo0EA.js.map → QueryClient-DrWSXg0y.js.map} +1 -1
- package/dist/esm/production/index.js +2 -2
- package/dist/esm/production/{mutation-Aw1JE7VO.js → mutation-B8dmX5lz.js} +2 -2
- package/dist/esm/production/{mutation-Aw1JE7VO.js.map → mutation-B8dmX5lz.js.map} +1 -1
- package/dist/esm/production/react/index.js +1 -1
- package/dist/esm/production/rest/index.js +2 -2
- package/dist/esm/production/topic/index.js +1 -1
- package/package.json +3 -3
- package/dist/cjs/development/QueryClient-QKhS8mhg.js +0 -2
- package/dist/cjs/production/QueryClient-DIAqDTHF.js +0 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { notifier as
|
|
2
|
-
import { registerCustomHash as
|
|
1
|
+
import { notifier as dt, relay as $t, setScopeOwner as be, reactiveMethod as Ce, signal as Lt, context as Ut, getContext as Oe, task as Se, reactiveSignal as Re, isSignal as Ae, watcher as xe } from "signalium";
|
|
2
|
+
import { registerCustomHash as Ne, hashValue as N, registerCustomSnapshot as De } from "signalium/utils";
|
|
3
3
|
import { d as qt } from "./shared-DcuVH8Pf.js";
|
|
4
|
-
import { SyncQueryStore as
|
|
5
|
-
var
|
|
6
|
-
const
|
|
7
|
-
var
|
|
8
|
-
class
|
|
4
|
+
import { SyncQueryStore as Ie, MemoryPersistentStore as ke } from "./stores/sync.js";
|
|
5
|
+
var K = /* @__PURE__ */ ((e) => (e.Always = "always", e.Online = "online", e.OfflineFirst = "offlineFirst", e))(K || {}), d = /* @__PURE__ */ ((e) => (e[e.UNDEFINED = 1] = "UNDEFINED", e[e.NULL = 2] = "NULL", e[e.NUMBER = 4] = "NUMBER", e[e.STRING = 8] = "STRING", e[e.BOOLEAN = 16] = "BOOLEAN", e[e.OBJECT = 32] = "OBJECT", e[e.ARRAY = 64] = "ARRAY", e[e.ID = 128] = "ID", e[e.RECORD = 256] = "RECORD", e[e.UNION = 512] = "UNION", e[e.ENTITY = 1024] = "ENTITY", e[e.HAS_FORMAT = 4096] = "HAS_FORMAT", e[e.IS_EAGER_FORMAT = 8192] = "IS_EAGER_FORMAT", e[e.PARSE_RESULT = 16384] = "PARSE_RESULT", e[e.LIVE = 32768] = "LIVE", e))(d || {});
|
|
6
|
+
const k = /* @__PURE__ */ Symbol("array"), F = /* @__PURE__ */ Symbol("record"), Vt = /* @__PURE__ */ Symbol("QUERY_ID");
|
|
7
|
+
var lt = /* @__PURE__ */ ((e) => (e[e.Array = 0] = "Array", e[e.Value = 1] = "Value", e))(lt || {});
|
|
8
|
+
class Q {
|
|
9
9
|
type;
|
|
10
10
|
entityDefs;
|
|
11
11
|
constraintFieldRefs;
|
|
@@ -18,7 +18,7 @@ class B {
|
|
|
18
18
|
this.type = t, this.entityDefs = n, this.constraintFieldRefs = i, this.sort = r, this.valueType = s, this.onCreate = o, this.onUpdate = a, this.onDelete = c;
|
|
19
19
|
}
|
|
20
20
|
static array(t, n, i) {
|
|
21
|
-
return new
|
|
21
|
+
return new Q(
|
|
22
22
|
0,
|
|
23
23
|
t,
|
|
24
24
|
n,
|
|
@@ -30,7 +30,7 @@ class B {
|
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
static value(t, n, i, r, s, o) {
|
|
33
|
-
return new
|
|
33
|
+
return new Q(
|
|
34
34
|
1,
|
|
35
35
|
t,
|
|
36
36
|
n,
|
|
@@ -42,12 +42,12 @@ class B {
|
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
const
|
|
46
|
-
function
|
|
47
|
-
return
|
|
45
|
+
const O = /* @__PURE__ */ new WeakMap();
|
|
46
|
+
function P(e) {
|
|
47
|
+
return O.get(e);
|
|
48
48
|
}
|
|
49
|
-
var
|
|
50
|
-
class
|
|
49
|
+
var Z = /* @__PURE__ */ ((e) => (e[e.Query = 0] = "Query", e[e.Entity = 1] = "Entity", e))(Z || {});
|
|
50
|
+
class Fe {
|
|
51
51
|
constructor(t, n, i) {
|
|
52
52
|
this._onEvict = n, this._intervalId = setInterval(this._tick, t * 6e4 * i);
|
|
53
53
|
}
|
|
@@ -70,7 +70,7 @@ class Me {
|
|
|
70
70
|
clearInterval(this._intervalId);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
class
|
|
73
|
+
class Me {
|
|
74
74
|
_buckets = /* @__PURE__ */ new Map();
|
|
75
75
|
_nextTickEntries = /* @__PURE__ */ new Map();
|
|
76
76
|
_nextTickScheduled = !1;
|
|
@@ -88,7 +88,7 @@ class Te {
|
|
|
88
88
|
}
|
|
89
89
|
const { _buckets: r } = this;
|
|
90
90
|
let s = r.get(n);
|
|
91
|
-
s || (s = new
|
|
91
|
+
s || (s = new Fe(n, this._onEvict, this._multiplier), r.set(n, s)), s.schedule(t, i);
|
|
92
92
|
}
|
|
93
93
|
cancel(t, n) {
|
|
94
94
|
if (n !== 1 / 0) {
|
|
@@ -113,7 +113,7 @@ class Te {
|
|
|
113
113
|
t.clear(), n.clear();
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
class
|
|
116
|
+
class Te {
|
|
117
117
|
schedule(t, n, i) {
|
|
118
118
|
}
|
|
119
119
|
cancel(t, n) {
|
|
@@ -121,35 +121,35 @@ class Pe {
|
|
|
121
121
|
destroy() {
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
const
|
|
124
|
+
const z = /* @__PURE__ */ Symbol("fieldRef"), I = /* @__PURE__ */ Symbol("fieldRefPath"), ht = /* @__PURE__ */ Symbol("DEFINITION_TARGET"), J = /* @__PURE__ */ Symbol("CANCEL_PROXY"), Pe = /\[([^\]]+)\]/g;
|
|
125
125
|
function Kt(e) {
|
|
126
126
|
const t = {
|
|
127
|
-
[
|
|
128
|
-
[
|
|
127
|
+
[z]: !0,
|
|
128
|
+
[I]: e
|
|
129
129
|
};
|
|
130
|
-
return new Proxy(t,
|
|
130
|
+
return new Proxy(t, je);
|
|
131
131
|
}
|
|
132
|
-
const
|
|
132
|
+
const je = {
|
|
133
133
|
get(e, t) {
|
|
134
|
-
if (t ===
|
|
135
|
-
if (t ===
|
|
134
|
+
if (t === z) return !0;
|
|
135
|
+
if (t === I) return e[I];
|
|
136
136
|
if (t === Symbol.toPrimitive || t === "toString" || t === "valueOf") {
|
|
137
|
-
const i = e[
|
|
137
|
+
const i = e[I];
|
|
138
138
|
return () => `[${i.join(".")}]`;
|
|
139
139
|
}
|
|
140
140
|
if (typeof t == "symbol") return;
|
|
141
|
-
const n = e[
|
|
141
|
+
const n = e[I];
|
|
142
142
|
return Kt([...n, t]);
|
|
143
143
|
},
|
|
144
144
|
has(e, t) {
|
|
145
|
-
return t ===
|
|
145
|
+
return t === z || t === I;
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
148
|
function Bt(e) {
|
|
149
|
-
return typeof e == "object" && e !== null && e[
|
|
149
|
+
return typeof e == "object" && e !== null && e[z] === !0;
|
|
150
150
|
}
|
|
151
151
|
function Qt(e) {
|
|
152
|
-
return e[
|
|
152
|
+
return e[I];
|
|
153
153
|
}
|
|
154
154
|
function Yt(e) {
|
|
155
155
|
let t = !1;
|
|
@@ -160,15 +160,15 @@ function Yt(e) {
|
|
|
160
160
|
get(n, i) {
|
|
161
161
|
if (t)
|
|
162
162
|
throw new Error("Definition proxy accessed after extraction. Avoid arrow functions that capture `this`.");
|
|
163
|
-
return i === ht ? n : i ===
|
|
163
|
+
return i === ht ? n : i === J ? () => {
|
|
164
164
|
t = !0;
|
|
165
165
|
} : typeof i == "symbol" ? n[i] : Kt([i]);
|
|
166
166
|
}
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function $e(e) {
|
|
170
170
|
const t = e[ht];
|
|
171
|
-
e[
|
|
171
|
+
e[J]();
|
|
172
172
|
const n = {};
|
|
173
173
|
for (const s of Object.getOwnPropertyNames(t))
|
|
174
174
|
n[s] = t[s];
|
|
@@ -184,7 +184,7 @@ function Le(e) {
|
|
|
184
184
|
}
|
|
185
185
|
return { fields: n, methods: i };
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function yt(e, t) {
|
|
188
188
|
let n = t;
|
|
189
189
|
for (const i of e) {
|
|
190
190
|
if (n == null) return;
|
|
@@ -192,43 +192,43 @@ function lt(e, t) {
|
|
|
192
192
|
}
|
|
193
193
|
return n;
|
|
194
194
|
}
|
|
195
|
-
function
|
|
196
|
-
return e.replace(
|
|
197
|
-
const r = i.split("."), s =
|
|
195
|
+
function Le(e, t) {
|
|
196
|
+
return e.replace(Pe, (n, i) => {
|
|
197
|
+
const r = i.split("."), s = yt(r, t);
|
|
198
198
|
return s != null ? encodeURIComponent(String(s)) : "";
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function X(e, t) {
|
|
202
202
|
if (Bt(e))
|
|
203
|
-
return
|
|
203
|
+
return yt(Qt(e), t);
|
|
204
204
|
if (typeof e == "string")
|
|
205
|
-
return
|
|
205
|
+
return Le(e, t);
|
|
206
206
|
if (Array.isArray(e))
|
|
207
|
-
return e.map((n) =>
|
|
207
|
+
return e.map((n) => X(n, t));
|
|
208
208
|
if (typeof e == "object" && e !== null && Object.getPrototypeOf(e) === Object.prototype) {
|
|
209
209
|
const n = {};
|
|
210
210
|
for (const i of Object.keys(e))
|
|
211
|
-
n[i] =
|
|
211
|
+
n[i] = X(e[i], t);
|
|
212
212
|
return n;
|
|
213
213
|
}
|
|
214
214
|
return e;
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function rt(e, t, n) {
|
|
217
217
|
const i = e.fields, r = e.methods, s = { params: t }, o = {};
|
|
218
218
|
for (const [a, c] of Object.entries(i))
|
|
219
|
-
o[a] =
|
|
219
|
+
o[a] = X(c, s);
|
|
220
220
|
o.params = t, o.context = n;
|
|
221
221
|
for (const [a, c] of Object.entries(r))
|
|
222
222
|
o[a] = c.bind(o);
|
|
223
223
|
return o;
|
|
224
224
|
}
|
|
225
|
-
class
|
|
225
|
+
class pt {
|
|
226
226
|
static cache;
|
|
227
227
|
constructor() {
|
|
228
228
|
return Yt(this);
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
const Gt = Object.entries,
|
|
231
|
+
const Gt = Object.entries, st = Object.keys;
|
|
232
232
|
let Ht = () => {
|
|
233
233
|
};
|
|
234
234
|
{
|
|
@@ -256,11 +256,11 @@ let Ht = () => {
|
|
|
256
256
|
if (a !== 0 && c !== 0 && a !== c) return !1;
|
|
257
257
|
if (i.shape === r.shape) return !0;
|
|
258
258
|
if (i.shape !== void 0 && r.shape !== void 0 && typeof i.shape == "object" && typeof r.shape == "object") {
|
|
259
|
-
const f = i.shape,
|
|
259
|
+
const f = i.shape, l = r.shape;
|
|
260
260
|
for (const u of Object.keys(f))
|
|
261
|
-
if (u in
|
|
262
|
-
for (const u of Object.keys(
|
|
263
|
-
if (u in f && !n(f[u],
|
|
261
|
+
if (u in l && !n(f[u], l[u])) return !1;
|
|
262
|
+
for (const u of Object.keys(l))
|
|
263
|
+
if (u in f && !n(f[u], l[u])) return !1;
|
|
264
264
|
}
|
|
265
265
|
return !0;
|
|
266
266
|
}
|
|
@@ -273,10 +273,10 @@ let Ht = () => {
|
|
|
273
273
|
);
|
|
274
274
|
};
|
|
275
275
|
}
|
|
276
|
-
function
|
|
276
|
+
function Rt(e) {
|
|
277
277
|
return typeof e == "number" ? e | d.UNDEFINED : e instanceof m ? (e.mask & d.UNDEFINED) !== 0 ? e : m.cloneWith(e, d.UNDEFINED) : e;
|
|
278
278
|
}
|
|
279
|
-
function
|
|
279
|
+
function At(e) {
|
|
280
280
|
return e instanceof m && (e.mask & d.OBJECT) !== 0 && (e.mask & (d.ENTITY | d.ARRAY | d.UNION | d.RECORD | d.LIVE)) === 0;
|
|
281
281
|
}
|
|
282
282
|
function Wt(e, t, n) {
|
|
@@ -290,15 +290,15 @@ function Wt(e, t, n) {
|
|
|
290
290
|
let o = 0, a;
|
|
291
291
|
const c = [];
|
|
292
292
|
let f = !0;
|
|
293
|
-
for (const
|
|
294
|
-
const u =
|
|
295
|
-
u !== void 0 ? (o++, a === void 0 && (a = u), a !== void 0 && u !== a && !
|
|
293
|
+
for (const l of e) {
|
|
294
|
+
const u = l?.[s];
|
|
295
|
+
u !== void 0 ? (o++, a === void 0 && (a = u), a !== void 0 && u !== a && !At(u) && Ht(n, s, a, u), At(u) ? c.push(u.shape) : (f = !1, c.push(void 0))) : (f = !1, c.push(void 0));
|
|
296
296
|
}
|
|
297
297
|
if (f && o > 0) {
|
|
298
|
-
const
|
|
299
|
-
r[s] = o < t ?
|
|
298
|
+
const l = Wt(c, t, n), u = new m(d.OBJECT, l);
|
|
299
|
+
r[s] = o < t ? Rt(u) : u;
|
|
300
300
|
} else
|
|
301
|
-
r[s] = o < t ?
|
|
301
|
+
r[s] = o < t ? Rt(a) : a;
|
|
302
302
|
}
|
|
303
303
|
return r;
|
|
304
304
|
}
|
|
@@ -368,7 +368,7 @@ class m {
|
|
|
368
368
|
return i._methods = t._methods, i._entityConfig = t._entityConfig, i._entityClass = t._entityClass, i._entityCache = t._entityCache, i._liveConfig = t._liveConfig, i;
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
|
-
class
|
|
371
|
+
class L extends Set {
|
|
372
372
|
lowercaseMap;
|
|
373
373
|
// lowercase -> canonical (strings only)
|
|
374
374
|
constructor(t) {
|
|
@@ -403,24 +403,24 @@ class $ extends Set {
|
|
|
403
403
|
return t;
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
|
-
const
|
|
407
|
-
|
|
408
|
-
let t =
|
|
406
|
+
const Ue = 1128875347;
|
|
407
|
+
Ne(L, (e) => {
|
|
408
|
+
let t = Ue;
|
|
409
409
|
for (const n of e)
|
|
410
410
|
t += N(n);
|
|
411
411
|
return t >>> 0;
|
|
412
412
|
});
|
|
413
|
-
function
|
|
413
|
+
function gt(e, t) {
|
|
414
414
|
return new m(e, t);
|
|
415
415
|
}
|
|
416
|
+
function qe(e) {
|
|
417
|
+
return gt(d.ARRAY, e);
|
|
418
|
+
}
|
|
416
419
|
function Ve(e) {
|
|
417
|
-
return
|
|
420
|
+
return gt(d.RECORD | d.OBJECT, e);
|
|
418
421
|
}
|
|
419
422
|
function Ke(e) {
|
|
420
|
-
return
|
|
421
|
-
}
|
|
422
|
-
function Be(e) {
|
|
423
|
-
return pt(d.PARSE_RESULT, e);
|
|
423
|
+
return gt(d.PARSE_RESULT, e);
|
|
424
424
|
}
|
|
425
425
|
function zt(e, t) {
|
|
426
426
|
let n = e, i, r, s;
|
|
@@ -439,17 +439,17 @@ function zt(e, t) {
|
|
|
439
439
|
r = o, s = a;
|
|
440
440
|
break;
|
|
441
441
|
case "object":
|
|
442
|
-
if (a instanceof
|
|
442
|
+
if (a instanceof L || a instanceof Set)
|
|
443
443
|
break;
|
|
444
444
|
a.mask & d.LIVE && (n |= d.LIVE);
|
|
445
445
|
break;
|
|
446
446
|
}
|
|
447
447
|
return new m(n, t, void 0, r, s, i);
|
|
448
448
|
}
|
|
449
|
-
function
|
|
449
|
+
function Be(e) {
|
|
450
450
|
return zt(d.OBJECT, e);
|
|
451
451
|
}
|
|
452
|
-
function
|
|
452
|
+
function xt(e, t, n) {
|
|
453
453
|
const i = e.mask;
|
|
454
454
|
if ((i & d.UNION) !== 0) {
|
|
455
455
|
const r = e;
|
|
@@ -462,7 +462,7 @@ function At(e, t, n) {
|
|
|
462
462
|
}
|
|
463
463
|
const s = r.shape;
|
|
464
464
|
if (s !== void 0)
|
|
465
|
-
for (const o of [...
|
|
465
|
+
for (const o of [...st(s), k, F]) {
|
|
466
466
|
const a = s[o];
|
|
467
467
|
if (t[o] !== void 0 && t[o] !== a)
|
|
468
468
|
throw new Error(
|
|
@@ -471,13 +471,13 @@ function At(e, t, n) {
|
|
|
471
471
|
t[o] = a;
|
|
472
472
|
}
|
|
473
473
|
} else if ((i & d.ARRAY) !== 0) {
|
|
474
|
-
if (t[
|
|
474
|
+
if (t[k] !== void 0)
|
|
475
475
|
throw new Error("Array shape already defined");
|
|
476
|
-
t[
|
|
476
|
+
t[k] = e.shape;
|
|
477
477
|
} else if ((i & d.RECORD) !== 0) {
|
|
478
|
-
if (t[
|
|
478
|
+
if (t[F] !== void 0)
|
|
479
479
|
throw new Error("Record shape already defined");
|
|
480
|
-
t[
|
|
480
|
+
t[F] = e.shape;
|
|
481
481
|
} else {
|
|
482
482
|
const r = e.typenameField, s = e.typenameValue;
|
|
483
483
|
if (s === void 0)
|
|
@@ -490,27 +490,27 @@ function At(e, t, n) {
|
|
|
490
490
|
}
|
|
491
491
|
return n;
|
|
492
492
|
}
|
|
493
|
-
function
|
|
493
|
+
function mt(...e) {
|
|
494
494
|
const t = e;
|
|
495
495
|
let n = 0, i = 0, r, s, o, a, c = 0;
|
|
496
|
-
for (const
|
|
497
|
-
if (typeof
|
|
498
|
-
n |=
|
|
496
|
+
for (const l of t) {
|
|
497
|
+
if (typeof l == "number") {
|
|
498
|
+
n |= l;
|
|
499
499
|
continue;
|
|
500
500
|
}
|
|
501
|
-
if (
|
|
501
|
+
if (l instanceof Set) {
|
|
502
502
|
if (s === void 0)
|
|
503
|
-
s = new Set(
|
|
503
|
+
s = new Set(l);
|
|
504
504
|
else
|
|
505
|
-
for (const u of
|
|
505
|
+
for (const u of l)
|
|
506
506
|
s.add(u);
|
|
507
507
|
continue;
|
|
508
508
|
}
|
|
509
|
-
if (i++, c |=
|
|
510
|
-
r =
|
|
509
|
+
if (i++, c |= l.mask, i === 1) {
|
|
510
|
+
r = l;
|
|
511
511
|
continue;
|
|
512
512
|
}
|
|
513
|
-
i === 2 && (o = /* @__PURE__ */ Object.create(null), a =
|
|
513
|
+
i === 2 && (o = /* @__PURE__ */ Object.create(null), a = xt(r, o, a)), a = xt(l, o, a);
|
|
514
514
|
}
|
|
515
515
|
if (i === 0)
|
|
516
516
|
return s === void 0 ? n : n === 0 ? s : new m(n | d.UNION, void 0, s);
|
|
@@ -519,65 +519,65 @@ function gt(...e) {
|
|
|
519
519
|
const f = n | c | d.UNION;
|
|
520
520
|
return new m(f, o, s, a);
|
|
521
521
|
}
|
|
522
|
-
function
|
|
522
|
+
function vt(e, t, n) {
|
|
523
523
|
const i = e;
|
|
524
524
|
if (typeof i == "number")
|
|
525
525
|
return i | t;
|
|
526
526
|
if (i instanceof Set)
|
|
527
|
-
return
|
|
527
|
+
return mt(e, t);
|
|
528
528
|
let r = n.get(i);
|
|
529
529
|
return r === void 0 && (r = m.cloneWith(i, t), n.set(i, r)), r;
|
|
530
530
|
}
|
|
531
|
-
const
|
|
531
|
+
const Qe = /* @__PURE__ */ new WeakMap(), Ye = /* @__PURE__ */ new WeakMap(), Ge = /* @__PURE__ */ new WeakMap();
|
|
532
|
+
function He(e) {
|
|
533
|
+
return vt(e, d.UNDEFINED | d.NULL, Ge);
|
|
534
|
+
}
|
|
532
535
|
function We(e) {
|
|
533
|
-
return
|
|
536
|
+
return vt(e, d.UNDEFINED, Qe);
|
|
534
537
|
}
|
|
535
538
|
function ze(e) {
|
|
536
|
-
return
|
|
539
|
+
return vt(e, d.NULL, Ye);
|
|
537
540
|
}
|
|
538
541
|
function Je(e) {
|
|
539
|
-
return mt(e, d.NULL, Ge);
|
|
540
|
-
}
|
|
541
|
-
function Xe(e) {
|
|
542
542
|
return e;
|
|
543
543
|
}
|
|
544
|
-
function
|
|
544
|
+
function Xe(e) {
|
|
545
545
|
return /* @__PURE__ */ new Set([e]);
|
|
546
546
|
}
|
|
547
547
|
const Jt = ((...e) => new Set(e));
|
|
548
|
-
Jt.caseInsensitive = (...e) => new
|
|
549
|
-
const
|
|
550
|
-
let
|
|
551
|
-
const
|
|
552
|
-
class
|
|
548
|
+
Jt.caseInsensitive = (...e) => new L(e);
|
|
549
|
+
const _t = 16;
|
|
550
|
+
let Ze = 0;
|
|
551
|
+
const ot = [], Xt = [], Zt = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ new Map(), tt = /* @__PURE__ */ new WeakSet();
|
|
552
|
+
class Y {
|
|
553
553
|
_raw;
|
|
554
554
|
_formatted;
|
|
555
555
|
_parsed;
|
|
556
556
|
_formatId;
|
|
557
557
|
constructor(t, n, i) {
|
|
558
|
-
this._raw = t, this._formatId = n, i ? (this._formatted =
|
|
558
|
+
this._raw = t, this._formatId = n, i ? (this._formatted = ot[n](t), this._parsed = !0) : this._parsed = !1, tt.add(this);
|
|
559
559
|
}
|
|
560
560
|
getValue() {
|
|
561
|
-
return this._parsed || (this._formatted =
|
|
561
|
+
return this._parsed || (this._formatted = ot[this._formatId](this._raw), this._parsed = !0), this._formatted;
|
|
562
562
|
}
|
|
563
563
|
toJSON() {
|
|
564
564
|
return this._parsed ? Xt[this._formatId](this._formatted) : this._raw;
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
|
-
function
|
|
567
|
+
function tn(e) {
|
|
568
568
|
const t = Zt.get(e);
|
|
569
569
|
if (t === void 0)
|
|
570
570
|
throw new Error(`Format ${e} not registered`);
|
|
571
571
|
return t;
|
|
572
572
|
}
|
|
573
|
-
function
|
|
574
|
-
const t = e >>
|
|
573
|
+
function Nt(e) {
|
|
574
|
+
const t = e >> _t;
|
|
575
575
|
return te.get(t);
|
|
576
576
|
}
|
|
577
577
|
function ee(e, t, n, i, r) {
|
|
578
|
-
const s =
|
|
579
|
-
|
|
580
|
-
const o = r?.eager ?? !0, c = s <<
|
|
578
|
+
const s = Ze++;
|
|
579
|
+
ot[s] = n, Xt[s] = i, te.set(s, e);
|
|
580
|
+
const o = r?.eager ?? !0, c = s << _t | t | d.HAS_FORMAT | (o ? d.IS_EAGER_FORMAT : 0);
|
|
581
581
|
Zt.set(e, c);
|
|
582
582
|
}
|
|
583
583
|
ee(
|
|
@@ -608,52 +608,52 @@ ee(
|
|
|
608
608
|
},
|
|
609
609
|
(e) => e.toISOString()
|
|
610
610
|
);
|
|
611
|
-
const
|
|
612
|
-
function
|
|
613
|
-
let t =
|
|
611
|
+
const Dt = /* @__PURE__ */ new WeakMap();
|
|
612
|
+
function $(e) {
|
|
613
|
+
let t = Dt.get(e);
|
|
614
614
|
if (t === void 0) {
|
|
615
615
|
const n = new e(), i = n[ht] ?? n;
|
|
616
|
-
n[
|
|
616
|
+
n[J] && n[J]();
|
|
617
617
|
const r = {};
|
|
618
|
-
for (const [f,
|
|
619
|
-
if (!(typeof
|
|
618
|
+
for (const [f, l] of Gt(i)) {
|
|
619
|
+
if (!(typeof l == "number" || typeof l == "string" || l instanceof Set || l instanceof m || l instanceof L))
|
|
620
620
|
throw new Error(
|
|
621
|
-
`[fetchium] Entity '${e.name}' field '${f}' has an invalid type definition. All entity fields must be type definitions (e.g. t.string, t.number, t.entity(...), etc). Got: ${typeof
|
|
621
|
+
`[fetchium] Entity '${e.name}' field '${f}' has an invalid type definition. All entity fields must be type definitions (e.g. t.string, t.number, t.entity(...), etc). Got: ${typeof l == "object" ? l?.constructor?.name ?? typeof l : typeof l}`
|
|
622
622
|
);
|
|
623
|
-
r[f] =
|
|
623
|
+
r[f] = l;
|
|
624
624
|
}
|
|
625
625
|
const s = Object.getPrototypeOf(e.prototype);
|
|
626
626
|
if (s != null) {
|
|
627
627
|
const f = s.constructor;
|
|
628
|
-
if (f !==
|
|
629
|
-
const u =
|
|
630
|
-
for (const
|
|
631
|
-
if (
|
|
632
|
-
throw new Error(`Cannot extend: field '${
|
|
628
|
+
if (f !== pt && typeof f == "function") {
|
|
629
|
+
const u = $(f).shape;
|
|
630
|
+
for (const h of st(u))
|
|
631
|
+
if (h in r && r[h] !== u[h])
|
|
632
|
+
throw new Error(`Cannot extend: field '${h}' already exists in type definition`);
|
|
633
633
|
}
|
|
634
634
|
}
|
|
635
635
|
const o = {}, a = e.prototype;
|
|
636
636
|
for (const f of Object.getOwnPropertyNames(a))
|
|
637
637
|
f !== "constructor" && typeof a[f] == "function" && (o[f] = a[f]);
|
|
638
|
-
t = zt(d.ENTITY | d.OBJECT, r), t._entityClass = e,
|
|
638
|
+
t = zt(d.ENTITY | d.OBJECT, r), t._entityClass = e, st(o).length > 0 && (t._methods = o), typeof o.__subscribe == "function" && (t._entityConfig = { hasSubscribe: !0 });
|
|
639
639
|
const c = e;
|
|
640
|
-
c.cache && (t._entityCache = c.cache),
|
|
640
|
+
c.cache && (t._entityCache = c.cache), Dt.set(e, t);
|
|
641
641
|
}
|
|
642
642
|
return t;
|
|
643
643
|
}
|
|
644
|
-
function
|
|
645
|
-
return
|
|
644
|
+
function en(e) {
|
|
645
|
+
return $(e);
|
|
646
646
|
}
|
|
647
647
|
function ne(e, t) {
|
|
648
648
|
if (t == null) return;
|
|
649
649
|
const n = /* @__PURE__ */ new Map();
|
|
650
650
|
if (Array.isArray(t))
|
|
651
651
|
for (const i of t) {
|
|
652
|
-
const [r, s] = i, a =
|
|
652
|
+
const [r, s] = i, a = $(r).typenameValue;
|
|
653
653
|
if (a === void 0) continue;
|
|
654
654
|
const c = [];
|
|
655
|
-
for (const [f,
|
|
656
|
-
c.push([f,
|
|
655
|
+
for (const [f, l] of Object.entries(s))
|
|
656
|
+
c.push([f, l]);
|
|
657
657
|
c.length > 0 && n.set(a, c);
|
|
658
658
|
}
|
|
659
659
|
else {
|
|
@@ -668,19 +668,19 @@ function ne(e, t) {
|
|
|
668
668
|
return n.size > 0 ? n : void 0;
|
|
669
669
|
}
|
|
670
670
|
function ie(e) {
|
|
671
|
-
return Array.isArray(e) ? e.map((t) =>
|
|
671
|
+
return Array.isArray(e) ? e.map((t) => $(t)) : [$(e)];
|
|
672
672
|
}
|
|
673
|
-
function
|
|
674
|
-
const n = ie(e), i = n.length === 1 ? n[0] :
|
|
675
|
-
return s._liveConfig =
|
|
673
|
+
function nn(e, t) {
|
|
674
|
+
const n = ie(e), i = n.length === 1 ? n[0] : mt(...n.map((o) => o)), r = d.ARRAY | d.LIVE, s = new m(r, i);
|
|
675
|
+
return s._liveConfig = Q.array(
|
|
676
676
|
n,
|
|
677
677
|
ne(n, t?.constraints),
|
|
678
678
|
t?.sort
|
|
679
679
|
), s;
|
|
680
680
|
}
|
|
681
|
-
function
|
|
681
|
+
function rn(e, t, n) {
|
|
682
682
|
const i = ie(t), r = e, s = d.LIVE, o = new m(s, void 0);
|
|
683
|
-
return o._liveConfig =
|
|
683
|
+
return o._liveConfig = Q.value(
|
|
684
684
|
i,
|
|
685
685
|
ne(i, n?.constraints),
|
|
686
686
|
r,
|
|
@@ -689,10 +689,10 @@ function sn(e, t, n) {
|
|
|
689
689
|
n.onDelete
|
|
690
690
|
), o;
|
|
691
691
|
}
|
|
692
|
-
const
|
|
693
|
-
format:
|
|
694
|
-
typename:
|
|
695
|
-
const:
|
|
692
|
+
const sn = {
|
|
693
|
+
format: tn,
|
|
694
|
+
typename: Je,
|
|
695
|
+
const: Xe,
|
|
696
696
|
enum: Jt,
|
|
697
697
|
id: d.ID | d.STRING | d.NUMBER,
|
|
698
698
|
string: d.STRING,
|
|
@@ -700,20 +700,20 @@ const on = {
|
|
|
700
700
|
boolean: d.BOOLEAN,
|
|
701
701
|
null: d.NULL,
|
|
702
702
|
undefined: d.UNDEFINED,
|
|
703
|
-
array:
|
|
704
|
-
object:
|
|
705
|
-
record:
|
|
706
|
-
union:
|
|
707
|
-
nullish:
|
|
708
|
-
optional:
|
|
709
|
-
nullable:
|
|
710
|
-
result:
|
|
711
|
-
entity:
|
|
712
|
-
liveArray:
|
|
713
|
-
liveValue:
|
|
703
|
+
array: qe,
|
|
704
|
+
object: Be,
|
|
705
|
+
record: Ve,
|
|
706
|
+
union: mt,
|
|
707
|
+
nullish: He,
|
|
708
|
+
optional: We,
|
|
709
|
+
nullable: ze,
|
|
710
|
+
result: Ke,
|
|
711
|
+
entity: en,
|
|
712
|
+
liveArray: nn,
|
|
713
|
+
liveValue: rn
|
|
714
714
|
};
|
|
715
|
-
function
|
|
716
|
-
if (e instanceof
|
|
715
|
+
function B(e) {
|
|
716
|
+
if (e instanceof L)
|
|
717
717
|
return Array.from(e).map((i) => typeof i == "string" ? `"${i}"` : String(i)).join(" | ");
|
|
718
718
|
if (e instanceof Set)
|
|
719
719
|
return Array.from(e).map((i) => typeof i == "string" ? `"${i}"` : String(i)).join(" | ");
|
|
@@ -723,7 +723,7 @@ function K(e) {
|
|
|
723
723
|
return String(e);
|
|
724
724
|
if (typeof e == "number") {
|
|
725
725
|
if ((e & d.HAS_FORMAT) !== 0) {
|
|
726
|
-
const r =
|
|
726
|
+
const r = Nt(e);
|
|
727
727
|
if (r)
|
|
728
728
|
return `"${r}"`;
|
|
729
729
|
}
|
|
@@ -739,12 +739,12 @@ function K(e) {
|
|
|
739
739
|
i.push(o);
|
|
740
740
|
}
|
|
741
741
|
if (n.shape !== void 0) {
|
|
742
|
-
n.shape[
|
|
742
|
+
n.shape[k] !== void 0 && i.push(`Array<${B(n.shape[k])}>`), n.shape[F] !== void 0 && i.push(`Record<string, ${B(n.shape[F])}>`);
|
|
743
743
|
for (const [s, o] of Object.entries(n.shape))
|
|
744
|
-
s !==
|
|
744
|
+
s !== k && s !== F && i.push(s);
|
|
745
745
|
}
|
|
746
746
|
if (t = n.mask, (t & d.HAS_FORMAT) !== 0) {
|
|
747
|
-
const s =
|
|
747
|
+
const s = Nt(t);
|
|
748
748
|
s && i.push(`"${s}"`);
|
|
749
749
|
}
|
|
750
750
|
return t & d.UNDEFINED && i.push("undefined"), t & d.NULL && i.push("null"), t & d.NUMBER && i.push("number"), t & d.STRING && i.push("string"), t & d.BOOLEAN && i.push("boolean"), i.length === 0 ? "union" : i.join(" | ");
|
|
@@ -753,11 +753,11 @@ function K(e) {
|
|
|
753
753
|
return `Entity<${e.typenameValue}>`;
|
|
754
754
|
if (t & d.ARRAY) {
|
|
755
755
|
const n = e.shape;
|
|
756
|
-
return `Array<${
|
|
756
|
+
return `Array<${B(n)}>`;
|
|
757
757
|
}
|
|
758
758
|
if (t & d.RECORD) {
|
|
759
759
|
const n = e.shape;
|
|
760
|
-
return `Record<string, ${
|
|
760
|
+
return `Record<string, ${B(n)}>`;
|
|
761
761
|
}
|
|
762
762
|
if (t & d.OBJECT) {
|
|
763
763
|
const n = e.typenameValue;
|
|
@@ -765,13 +765,13 @@ function K(e) {
|
|
|
765
765
|
}
|
|
766
766
|
return "unknown";
|
|
767
767
|
}
|
|
768
|
-
function
|
|
768
|
+
function V(e, t, n) {
|
|
769
769
|
return new TypeError(
|
|
770
|
-
`Validation error at ${e}: expected ${
|
|
770
|
+
`Validation error at ${e}: expected ${B(t)}, got ${typeof n == "object" ? n === null ? "null" : Array.isArray(n) ? "array" : "object" : typeof n}`
|
|
771
771
|
);
|
|
772
772
|
}
|
|
773
773
|
const re = Array.isArray;
|
|
774
|
-
function
|
|
774
|
+
function It(e) {
|
|
775
775
|
if (e === null) return d.NULL;
|
|
776
776
|
switch (typeof e) {
|
|
777
777
|
case "number":
|
|
@@ -788,39 +788,39 @@ function Dt(e) {
|
|
|
788
788
|
throw new Error(`Invalid type: ${typeof e}`);
|
|
789
789
|
}
|
|
790
790
|
}
|
|
791
|
-
function
|
|
792
|
-
return
|
|
791
|
+
function $n(e) {
|
|
792
|
+
return j(e);
|
|
793
793
|
}
|
|
794
|
-
function
|
|
794
|
+
function j(e) {
|
|
795
795
|
if (e === null || typeof e != "object")
|
|
796
796
|
return e;
|
|
797
797
|
if (re(e))
|
|
798
|
-
return e.map((n) =>
|
|
798
|
+
return e.map((n) => j(n));
|
|
799
799
|
if (e instanceof Date)
|
|
800
800
|
return new Date(e.getTime());
|
|
801
801
|
if (e instanceof Map) {
|
|
802
802
|
const n = /* @__PURE__ */ new Map();
|
|
803
803
|
for (const [i, r] of e)
|
|
804
|
-
n.set(
|
|
804
|
+
n.set(j(i), j(r));
|
|
805
805
|
return n;
|
|
806
806
|
}
|
|
807
807
|
if (e instanceof Set) {
|
|
808
808
|
const n = /* @__PURE__ */ new Set();
|
|
809
809
|
for (const i of e)
|
|
810
|
-
n.add(
|
|
810
|
+
n.add(j(i));
|
|
811
811
|
return n;
|
|
812
812
|
}
|
|
813
813
|
const t = {};
|
|
814
814
|
for (const n of Object.keys(e))
|
|
815
|
-
t[n] =
|
|
815
|
+
t[n] = j(e[n]);
|
|
816
816
|
return t;
|
|
817
817
|
}
|
|
818
|
-
const
|
|
818
|
+
const wt = Object.entries, on = () => {
|
|
819
819
|
};
|
|
820
|
-
class
|
|
820
|
+
class at {
|
|
821
821
|
queryClient = void 0;
|
|
822
822
|
preloadedEntities = void 0;
|
|
823
|
-
warn =
|
|
823
|
+
warn = on;
|
|
824
824
|
/** When true, missing optional fields on existing entities are set to
|
|
825
825
|
* undefined. False for mutation events (truly partial payloads). */
|
|
826
826
|
isPartialEvent = !1;
|
|
@@ -831,16 +831,16 @@ class ot {
|
|
|
831
831
|
}
|
|
832
832
|
}
|
|
833
833
|
function se(e, t, n) {
|
|
834
|
-
return
|
|
834
|
+
return M(e, t, n, "");
|
|
835
835
|
}
|
|
836
|
-
function
|
|
837
|
-
return
|
|
836
|
+
function an(e, t, n) {
|
|
837
|
+
return Et(e, t, n);
|
|
838
838
|
}
|
|
839
|
-
function
|
|
840
|
-
const r = e >>
|
|
839
|
+
function kt(e, t, n, i) {
|
|
840
|
+
const r = e >> _t;
|
|
841
841
|
if ((e & d.IS_EAGER_FORMAT) !== 0)
|
|
842
842
|
try {
|
|
843
|
-
return new
|
|
843
|
+
return new Y(t, r, !0);
|
|
844
844
|
} catch (o) {
|
|
845
845
|
if ((e & d.UNDEFINED) !== 0) {
|
|
846
846
|
n.warn("Invalid formatted value for optional type, defaulting to undefined", {
|
|
@@ -852,62 +852,62 @@ function It(e, t, n, i) {
|
|
|
852
852
|
}
|
|
853
853
|
throw o;
|
|
854
854
|
}
|
|
855
|
-
return new
|
|
855
|
+
return new Y(t, r, !1);
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function M(e, t, n, i) {
|
|
858
858
|
const r = t;
|
|
859
|
-
if (r instanceof
|
|
859
|
+
if (r instanceof L) {
|
|
860
860
|
const c = r.get(e);
|
|
861
|
-
if (c === void 0) throw
|
|
861
|
+
if (c === void 0) throw V(i, r, e);
|
|
862
862
|
return c;
|
|
863
863
|
}
|
|
864
864
|
if (r instanceof Set) {
|
|
865
|
-
if (!r.has(e)) throw
|
|
865
|
+
if (!r.has(e)) throw V(i, r, e);
|
|
866
866
|
return e;
|
|
867
867
|
}
|
|
868
868
|
if (typeof r == "string") {
|
|
869
869
|
if (e == null) return r;
|
|
870
|
-
if (e !== r) throw
|
|
870
|
+
if (e !== r) throw V(i, r, e);
|
|
871
871
|
return e;
|
|
872
872
|
}
|
|
873
873
|
if (typeof r == "number") {
|
|
874
|
-
const c =
|
|
874
|
+
const c = It(e);
|
|
875
875
|
if ((r & c) === 0) {
|
|
876
876
|
if ((r & d.UNDEFINED) !== 0) {
|
|
877
877
|
n.warn("Invalid value for optional type, defaulting to undefined", { value: e, path: i });
|
|
878
878
|
return;
|
|
879
879
|
}
|
|
880
|
-
throw
|
|
880
|
+
throw V(i, r, e);
|
|
881
881
|
}
|
|
882
|
-
return (r & d.HAS_FORMAT) !== 0 && e !== null && e !== void 0 ?
|
|
882
|
+
return (r & d.HAS_FORMAT) !== 0 && e !== null && e !== void 0 ? kt(r, e, n, i) : e;
|
|
883
883
|
}
|
|
884
884
|
const s = r.mask, o = r._liveConfig;
|
|
885
|
-
if (o !== void 0 && o.type ===
|
|
886
|
-
return o.valueType !== void 0 ?
|
|
885
|
+
if (o !== void 0 && o.type === lt.Value)
|
|
886
|
+
return o.valueType !== void 0 ? M(e, o.valueType, n, i) : e;
|
|
887
887
|
if ((s & d.PARSE_RESULT) !== 0)
|
|
888
888
|
try {
|
|
889
|
-
return { success: !0, value:
|
|
889
|
+
return { success: !0, value: M(e, r.shape, n, i) };
|
|
890
890
|
} catch (c) {
|
|
891
891
|
return { success: !1, error: c instanceof Error ? c : new Error(String(c)) };
|
|
892
892
|
}
|
|
893
|
-
const a =
|
|
893
|
+
const a = It(e);
|
|
894
894
|
if ((s & a) === 0 && !r.values?.has(e)) {
|
|
895
895
|
if ((s & d.UNDEFINED) !== 0) {
|
|
896
896
|
n.warn("Invalid value for optional type, defaulting to undefined", { value: e, path: i });
|
|
897
897
|
return;
|
|
898
898
|
}
|
|
899
|
-
throw
|
|
899
|
+
throw V(i, s, e);
|
|
900
900
|
}
|
|
901
|
-
return a < d.OBJECT ? (s & d.HAS_FORMAT) !== 0 && e !== null && e !== void 0 ?
|
|
901
|
+
return a < d.OBJECT ? (s & d.HAS_FORMAT) !== 0 && e !== null && e !== void 0 ? kt(s, e, n, i) : e : (s & d.UNION) !== 0 ? cn(a, e, r, n, i) : a === d.ARRAY ? oe(e, r.shape, n, i) : (s & d.RECORD) !== 0 ? ae(e, r.shape, n, i) : (s & d.ENTITY) !== 0 && n.queryClient !== void 0 ? Et(e, r, n) : ce(e, r, n, i);
|
|
902
902
|
}
|
|
903
|
-
function
|
|
903
|
+
function cn(e, t, n, i, r) {
|
|
904
904
|
if (e === d.ARRAY) {
|
|
905
|
-
const s = n.shape[
|
|
905
|
+
const s = n.shape[k];
|
|
906
906
|
return s === void 0 || typeof s == "number" ? t : oe(t, s, i, r);
|
|
907
907
|
} else {
|
|
908
908
|
const s = n.typenameField, o = s ? t[s] : void 0;
|
|
909
909
|
if (o === void 0 || typeof o != "string") {
|
|
910
|
-
const c = n.shape[
|
|
910
|
+
const c = n.shape[F];
|
|
911
911
|
if (c === void 0)
|
|
912
912
|
throw new Error(
|
|
913
913
|
`Typename field '${s}' is required for union discrimination but was not found in the data`
|
|
@@ -917,14 +917,14 @@ function fn(e, t, n, i, r) {
|
|
|
917
917
|
const a = n.shape[o];
|
|
918
918
|
if (a === void 0 || typeof a == "number")
|
|
919
919
|
throw new Error(`Unknown typename '${o}' in union`);
|
|
920
|
-
return a.mask & d.ENTITY && i.queryClient !== void 0 ?
|
|
920
|
+
return a.mask & d.ENTITY && i.queryClient !== void 0 ? Et(t, a, i) : ce(t, a, i, r);
|
|
921
921
|
}
|
|
922
922
|
}
|
|
923
923
|
function oe(e, t, n, i) {
|
|
924
924
|
const r = [];
|
|
925
925
|
for (let s = 0; s < e.length; s++)
|
|
926
926
|
try {
|
|
927
|
-
r.push(
|
|
927
|
+
r.push(M(e[s], t, n, `${i}[${s}]`));
|
|
928
928
|
} catch (o) {
|
|
929
929
|
n.warn("Failed to parse array item, filtering out", {
|
|
930
930
|
index: s,
|
|
@@ -935,19 +935,19 @@ function oe(e, t, n, i) {
|
|
|
935
935
|
return r;
|
|
936
936
|
}
|
|
937
937
|
function ae(e, t, n, i) {
|
|
938
|
-
for (const [r, s] of
|
|
939
|
-
e[r] =
|
|
938
|
+
for (const [r, s] of wt(e))
|
|
939
|
+
e[r] = M(s, t, n, `${i}["${r}"]`);
|
|
940
940
|
return e;
|
|
941
941
|
}
|
|
942
942
|
function ce(e, t, n, i) {
|
|
943
|
-
if (
|
|
943
|
+
if (O.has(e))
|
|
944
944
|
return e;
|
|
945
945
|
const r = t.shape;
|
|
946
|
-
for (const [s, o] of
|
|
947
|
-
e[s] =
|
|
946
|
+
for (const [s, o] of wt(r))
|
|
947
|
+
e[s] = M(e[s], o, n, `${i}.${s}`);
|
|
948
948
|
return e;
|
|
949
949
|
}
|
|
950
|
-
function
|
|
950
|
+
function Et(e, t, n) {
|
|
951
951
|
const i = n.queryClient, r = n.preloadedEntities;
|
|
952
952
|
let s, o;
|
|
953
953
|
if (r !== void 0)
|
|
@@ -962,29 +962,29 @@ function wt(e, t, n) {
|
|
|
962
962
|
if (a !== void 0)
|
|
963
963
|
return a.data;
|
|
964
964
|
if (r !== void 0) {
|
|
965
|
-
const
|
|
966
|
-
if (
|
|
965
|
+
const _ = i.entityMap.getEntity(s)?.data ?? r.get(s);
|
|
966
|
+
if (_ === void 0)
|
|
967
967
|
throw new Error(`Cached entity ${s} not found in preloaded map`);
|
|
968
|
-
e =
|
|
968
|
+
e = _;
|
|
969
969
|
}
|
|
970
970
|
const c = {};
|
|
971
971
|
typeof t.idField == "symbol" && (c[t.idField] = o);
|
|
972
|
-
const f = i.entityMap.getEntity(s),
|
|
972
|
+
const f = i.entityMap.getEntity(s), l = n.isPartialEvent && f !== void 0, u = {
|
|
973
973
|
key: s,
|
|
974
974
|
shape: t,
|
|
975
975
|
data: c,
|
|
976
|
-
rawKeys:
|
|
976
|
+
rawKeys: l ? new Set(Object.keys(e)) : void 0
|
|
977
977
|
};
|
|
978
978
|
n.seen.set(c, u), n.seenByKey.set(s, u);
|
|
979
|
-
const
|
|
980
|
-
for (const [p,
|
|
981
|
-
|
|
979
|
+
const h = `[[${t.typenameValue}:${o}]]`, g = t.shape;
|
|
980
|
+
for (const [p, _] of wt(g))
|
|
981
|
+
l && !(p in e) || (c[p] = M(e[p], _, n, `${h}.${p}`));
|
|
982
982
|
return c;
|
|
983
983
|
}
|
|
984
|
-
function
|
|
985
|
-
return
|
|
984
|
+
function fn(e, t) {
|
|
985
|
+
return un(e, t.shape, t.typenameField);
|
|
986
986
|
}
|
|
987
|
-
function
|
|
987
|
+
function un(e, t, n) {
|
|
988
988
|
if (t === void 0) return !0;
|
|
989
989
|
for (const i of Object.keys(t)) {
|
|
990
990
|
if (i === n) continue;
|
|
@@ -999,18 +999,18 @@ function dn(e, t, n) {
|
|
|
999
999
|
}
|
|
1000
1000
|
return !0;
|
|
1001
1001
|
}
|
|
1002
|
-
const
|
|
1002
|
+
const dn = Object.prototype, W = /* @__PURE__ */ new WeakMap();
|
|
1003
1003
|
function x(e) {
|
|
1004
1004
|
if (typeof e != "object" || e === null) return e;
|
|
1005
|
-
if (
|
|
1006
|
-
if (
|
|
1005
|
+
if (tt.has(e)) return x(e.getValue());
|
|
1006
|
+
if (O.has(e)) return e;
|
|
1007
1007
|
if (Array.isArray(e)) {
|
|
1008
|
-
let t =
|
|
1009
|
-
return t === void 0 && (t = new Proxy(e, ln),
|
|
1008
|
+
let t = W.get(e);
|
|
1009
|
+
return t === void 0 && (t = new Proxy(e, ln), W.set(e, t)), t;
|
|
1010
1010
|
}
|
|
1011
|
-
if (Object.getPrototypeOf(e) ===
|
|
1012
|
-
let t =
|
|
1013
|
-
return t === void 0 && (t = new Proxy(e,
|
|
1011
|
+
if (Object.getPrototypeOf(e) === dn) {
|
|
1012
|
+
let t = W.get(e);
|
|
1013
|
+
return t === void 0 && (t = new Proxy(e, hn), W.set(e, t)), t;
|
|
1014
1014
|
}
|
|
1015
1015
|
return e;
|
|
1016
1016
|
}
|
|
@@ -1029,7 +1029,7 @@ const ln = {
|
|
|
1029
1029
|
deleteProperty() {
|
|
1030
1030
|
throw new Error("Cannot mutate a read-only array");
|
|
1031
1031
|
}
|
|
1032
|
-
},
|
|
1032
|
+
}, hn = {
|
|
1033
1033
|
get(e, t, n) {
|
|
1034
1034
|
return typeof t == "string" ? x(e[t]) : Reflect.get(e, t, n);
|
|
1035
1035
|
},
|
|
@@ -1048,23 +1048,22 @@ const ln = {
|
|
|
1048
1048
|
getOwnPropertyDescriptor(e, t) {
|
|
1049
1049
|
return Object.getOwnPropertyDescriptor(e, t);
|
|
1050
1050
|
}
|
|
1051
|
-
},
|
|
1051
|
+
}, yn = (e, t, n) => {
|
|
1052
1052
|
const i = e, r = Object.keys(i), s = t !== null && typeof t == "object" && !Array.isArray(t) ? t : void 0;
|
|
1053
1053
|
let o = !s || Object.keys(s).length !== r.length;
|
|
1054
1054
|
const a = {};
|
|
1055
1055
|
for (let c = 0; c < r.length; c++) {
|
|
1056
|
-
const f = r[c],
|
|
1056
|
+
const f = r[c], l = i[f];
|
|
1057
1057
|
let u;
|
|
1058
|
-
typeof
|
|
1058
|
+
typeof l == "function" ? u = l : u = n(l, s?.[f]), a[f] = u, !o && u !== s?.[f] && (o = !0);
|
|
1059
1059
|
}
|
|
1060
1060
|
return o ? a : s;
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
class gn {
|
|
1061
|
+
};
|
|
1062
|
+
De(
|
|
1063
|
+
pt,
|
|
1064
|
+
yn
|
|
1065
|
+
);
|
|
1066
|
+
class pn {
|
|
1068
1067
|
_notifier;
|
|
1069
1068
|
_queryClient;
|
|
1070
1069
|
_proxies = /* @__PURE__ */ new Map();
|
|
@@ -1082,7 +1081,7 @@ class gn {
|
|
|
1082
1081
|
_extraMethods;
|
|
1083
1082
|
_extraGetters;
|
|
1084
1083
|
constructor(t, n, i, r, s, o) {
|
|
1085
|
-
this._notifier =
|
|
1084
|
+
this._notifier = dt(), this._queryClient = o, this.key = t, this.typename = n, this.id = i, this.idField = r, this.data = s, this.entityRefs = void 0;
|
|
1086
1085
|
}
|
|
1087
1086
|
retain() {
|
|
1088
1087
|
this.refCount++;
|
|
@@ -1094,7 +1093,7 @@ class gn {
|
|
|
1094
1093
|
if (this.refCount < 0)
|
|
1095
1094
|
throw new Error(`Entity ${this.typename}:${this.id} released more times than retained`);
|
|
1096
1095
|
const t = this._entityCache?.gcTime;
|
|
1097
|
-
t !== void 0 ? this._queryClient.gcManager.schedule(this.key, t,
|
|
1096
|
+
t !== void 0 ? this._queryClient.gcManager.schedule(this.key, t, Z.Entity) : this.evict();
|
|
1098
1097
|
}
|
|
1099
1098
|
evict() {
|
|
1100
1099
|
const t = this.liveCollections.slice();
|
|
@@ -1128,13 +1127,13 @@ class gn {
|
|
|
1128
1127
|
getProxy(t) {
|
|
1129
1128
|
const n = t;
|
|
1130
1129
|
let i = this._proxies.get(n);
|
|
1131
|
-
return i === void 0 && (i =
|
|
1130
|
+
return i === void 0 && (i = mn(this, this.key, t, this._notifier, this._queryClient), this._proxies.set(n, i)), i;
|
|
1132
1131
|
}
|
|
1133
1132
|
get proxy() {
|
|
1134
1133
|
return this._proxies.values().next().value;
|
|
1135
1134
|
}
|
|
1136
1135
|
satisfiesDef(t) {
|
|
1137
|
-
return this.satisfiedDefs.has(t) ? !0 :
|
|
1136
|
+
return this.satisfiedDefs.has(t) ? !0 : fn(this.data, t) ? (this.satisfiedDefs.add(t), !0) : !1;
|
|
1138
1137
|
}
|
|
1139
1138
|
save() {
|
|
1140
1139
|
this._queryClient.entityMap.save(this);
|
|
@@ -1146,96 +1145,94 @@ class gn {
|
|
|
1146
1145
|
this._notifier.consume();
|
|
1147
1146
|
}
|
|
1148
1147
|
}
|
|
1149
|
-
function
|
|
1148
|
+
function gn(e, t, n) {
|
|
1150
1149
|
const i = [];
|
|
1151
1150
|
for (const r of e) {
|
|
1152
1151
|
if (typeof r != "object" || r === null) continue;
|
|
1153
|
-
const s =
|
|
1152
|
+
const s = O.get(r);
|
|
1154
1153
|
if (s === void 0) continue;
|
|
1155
1154
|
const o = n.entityMap.getEntity(s);
|
|
1156
1155
|
o !== void 0 && o.satisfiesDef(t) && i.push(r);
|
|
1157
1156
|
}
|
|
1158
1157
|
return i;
|
|
1159
1158
|
}
|
|
1160
|
-
function
|
|
1161
|
-
const s = n.shape ?? {}, o = n, a = o._methods, c = o._entityClass, f = o._entityConfig,
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
}, _ = a.__subscribe.call(v, y);
|
|
1169
|
-
return E.value = v, _;
|
|
1159
|
+
function mn(e, t, n, i, r) {
|
|
1160
|
+
const s = n.shape ?? {}, o = n, a = o._methods, c = o._entityClass, f = o._entityConfig, l = c ? c.prototype : pt.prototype, u = n.typenameField, h = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), p = () => ({ __entityRef: t });
|
|
1161
|
+
let _;
|
|
1162
|
+
f?.hasSubscribe && a && "__subscribe" in a && (_ = $t((E) => {
|
|
1163
|
+
const y = (w) => {
|
|
1164
|
+
w.__eventSource = t, r.applyMutationEvent(w);
|
|
1165
|
+
}, b = a.__subscribe.call(v, y);
|
|
1166
|
+
return E.value = v, b;
|
|
1170
1167
|
}));
|
|
1171
1168
|
let v;
|
|
1172
1169
|
if (u && !(u in s))
|
|
1173
1170
|
throw new Error(`typenameField "${u}" must be declared in the entity shape`);
|
|
1174
|
-
const
|
|
1175
|
-
if (
|
|
1171
|
+
const S = Object.keys(s);
|
|
1172
|
+
if (S.includes("__typename") || S.push("__typename"), a)
|
|
1176
1173
|
for (const E of Object.keys(a))
|
|
1177
|
-
|
|
1178
|
-
let
|
|
1179
|
-
function
|
|
1174
|
+
S.includes(E) || S.push(E);
|
|
1175
|
+
let T, R = S;
|
|
1176
|
+
function U() {
|
|
1180
1177
|
const E = e._extraMethods;
|
|
1181
|
-
if (E !==
|
|
1182
|
-
if (
|
|
1183
|
-
for (const
|
|
1184
|
-
R.includes(
|
|
1178
|
+
if (E !== T) {
|
|
1179
|
+
if (T = E, R = S.slice(), E !== void 0)
|
|
1180
|
+
for (const b of Object.keys(E))
|
|
1181
|
+
R.includes(b) || R.push(b);
|
|
1185
1182
|
const y = e._extraGetters;
|
|
1186
1183
|
if (y !== void 0)
|
|
1187
|
-
for (const
|
|
1188
|
-
R.includes(
|
|
1184
|
+
for (const b of Object.keys(y))
|
|
1185
|
+
R.includes(b) || R.push(b);
|
|
1189
1186
|
}
|
|
1190
1187
|
return R;
|
|
1191
1188
|
}
|
|
1192
|
-
const
|
|
1189
|
+
const q = {
|
|
1193
1190
|
getPrototypeOf() {
|
|
1194
|
-
return
|
|
1191
|
+
return l;
|
|
1195
1192
|
},
|
|
1196
|
-
get(E, y) {
|
|
1197
|
-
if (typeof y == "symbol") return;
|
|
1193
|
+
get(E, y, b) {
|
|
1194
|
+
if (typeof y == "symbol") return Reflect.get(l, y, b);
|
|
1198
1195
|
if (y === "toJSON") return p;
|
|
1199
1196
|
if (y === "__context") return r.getContext();
|
|
1200
1197
|
if (y === "__typename") return e.typename;
|
|
1201
|
-
if (
|
|
1202
|
-
const
|
|
1203
|
-
if (
|
|
1204
|
-
return
|
|
1198
|
+
if (_?.value, i.consume(), typeof y == "string") {
|
|
1199
|
+
const D = e._extraGetters;
|
|
1200
|
+
if (D !== void 0 && y in D)
|
|
1201
|
+
return D[y]();
|
|
1205
1202
|
const A = e._extraMethods;
|
|
1206
1203
|
if (A !== void 0 && y in A) {
|
|
1207
|
-
let C =
|
|
1208
|
-
return C || (C = A[y].bind(v),
|
|
1204
|
+
let C = h.get(y);
|
|
1205
|
+
return C || (C = A[y].bind(v), h.set(y, C)), C;
|
|
1209
1206
|
}
|
|
1210
1207
|
if (a && y in a) {
|
|
1211
|
-
let C =
|
|
1212
|
-
return C || (C =
|
|
1208
|
+
let C = h.get(y);
|
|
1209
|
+
return C || (C = Ce(v, a[y].bind(v)), h.set(y, C)), C;
|
|
1213
1210
|
}
|
|
1214
1211
|
}
|
|
1215
|
-
const
|
|
1216
|
-
if (typeof
|
|
1217
|
-
return x(
|
|
1218
|
-
if (Array.isArray(
|
|
1219
|
-
const
|
|
1220
|
-
if (
|
|
1221
|
-
const A =
|
|
1212
|
+
const w = e.data[y];
|
|
1213
|
+
if (typeof w == "object" && w !== null && tt.has(w))
|
|
1214
|
+
return x(w.getValue());
|
|
1215
|
+
if (Array.isArray(w) && typeof y == "string") {
|
|
1216
|
+
const D = s[y];
|
|
1217
|
+
if (D instanceof m && (D.mask & d.ARRAY) !== 0) {
|
|
1218
|
+
const A = D.shape;
|
|
1222
1219
|
if (A instanceof m && (A.mask & d.ENTITY) !== 0) {
|
|
1223
1220
|
const C = A.typenameValue;
|
|
1224
1221
|
if (C !== void 0) {
|
|
1225
|
-
const
|
|
1226
|
-
if (
|
|
1227
|
-
const
|
|
1228
|
-
if (
|
|
1229
|
-
return x(
|
|
1230
|
-
const St =
|
|
1231
|
-
return g.set(y, { source:
|
|
1222
|
+
const Ot = r.getEntityDefsForTypename(C);
|
|
1223
|
+
if (Ot !== void 0 && Ot.length > 1) {
|
|
1224
|
+
const et = g.get(y);
|
|
1225
|
+
if (et !== void 0 && et.source === w)
|
|
1226
|
+
return x(et.filtered);
|
|
1227
|
+
const St = gn(w, A, r);
|
|
1228
|
+
return g.set(y, { source: w, filtered: St }), x(St);
|
|
1232
1229
|
}
|
|
1233
1230
|
}
|
|
1234
1231
|
}
|
|
1235
1232
|
}
|
|
1236
|
-
return x(
|
|
1233
|
+
return x(w);
|
|
1237
1234
|
}
|
|
1238
|
-
return x(
|
|
1235
|
+
return x(w);
|
|
1239
1236
|
},
|
|
1240
1237
|
set() {
|
|
1241
1238
|
throw new Error("Entity properties are read-only");
|
|
@@ -1243,36 +1240,36 @@ function vn(e, t, n, i, r) {
|
|
|
1243
1240
|
has(E, y) {
|
|
1244
1241
|
if (y === "__typename") return !0;
|
|
1245
1242
|
if (typeof y == "string") {
|
|
1246
|
-
const
|
|
1247
|
-
if (
|
|
1248
|
-
const
|
|
1249
|
-
if (
|
|
1243
|
+
const b = e._extraGetters;
|
|
1244
|
+
if (b && y in b) return !0;
|
|
1245
|
+
const w = e._extraMethods;
|
|
1246
|
+
if (w && y in w || a && y in a) return !0;
|
|
1250
1247
|
}
|
|
1251
1248
|
return y in s;
|
|
1252
1249
|
},
|
|
1253
1250
|
ownKeys() {
|
|
1254
|
-
return
|
|
1251
|
+
return U();
|
|
1255
1252
|
},
|
|
1256
1253
|
getOwnPropertyDescriptor(E, y) {
|
|
1257
1254
|
if (y === "__typename")
|
|
1258
1255
|
return { enumerable: !0, configurable: !0, value: e.typename, writable: !1 };
|
|
1259
1256
|
if (y in s)
|
|
1260
|
-
return { enumerable: !0, configurable: !0, value:
|
|
1257
|
+
return { enumerable: !0, configurable: !0, value: q.get(E, y, v), writable: !1 };
|
|
1261
1258
|
if (typeof y == "string") {
|
|
1262
|
-
const
|
|
1263
|
-
if (_ && y in _)
|
|
1264
|
-
return { enumerable: !0, configurable: !0, value: U.get(E, y, v), writable: !1 };
|
|
1265
|
-
const b = e._extraMethods;
|
|
1259
|
+
const b = e._extraGetters;
|
|
1266
1260
|
if (b && y in b)
|
|
1267
|
-
return { enumerable: !0, configurable: !0, value:
|
|
1261
|
+
return { enumerable: !0, configurable: !0, value: q.get(E, y, v), writable: !1 };
|
|
1262
|
+
const w = e._extraMethods;
|
|
1263
|
+
if (w && y in w)
|
|
1264
|
+
return { enumerable: !0, configurable: !0, value: q.get(E, y, v), writable: !1 };
|
|
1268
1265
|
if (a && y in a)
|
|
1269
|
-
return { enumerable: !1, configurable: !0, value:
|
|
1266
|
+
return { enumerable: !1, configurable: !0, value: q.get(E, y, v), writable: !1 };
|
|
1270
1267
|
}
|
|
1271
1268
|
}
|
|
1272
1269
|
};
|
|
1273
|
-
return v = new Proxy({},
|
|
1270
|
+
return v = new Proxy({}, q), O.set(v, t), be(v, r), v;
|
|
1274
1271
|
}
|
|
1275
|
-
class
|
|
1272
|
+
class vn {
|
|
1276
1273
|
instances = /* @__PURE__ */ new Map();
|
|
1277
1274
|
persistEntity;
|
|
1278
1275
|
constructor(t) {
|
|
@@ -1294,7 +1291,7 @@ class _n {
|
|
|
1294
1291
|
if (typeof a != "string" && typeof a != "number")
|
|
1295
1292
|
throw new Error(`Entity id must be string or number: ${i.typenameValue}`);
|
|
1296
1293
|
const c = i;
|
|
1297
|
-
s = new
|
|
1294
|
+
s = new pn(t, i.typenameValue, a, o, n, r), s._entityCache = c._entityCache, this.instances.set(t, s);
|
|
1298
1295
|
}
|
|
1299
1296
|
return s.parseId = r.currentParseId, s;
|
|
1300
1297
|
}
|
|
@@ -1310,7 +1307,7 @@ class _n {
|
|
|
1310
1307
|
this.persistEntity(t.key, t.data, n);
|
|
1311
1308
|
}
|
|
1312
1309
|
}
|
|
1313
|
-
class
|
|
1310
|
+
class fe {
|
|
1314
1311
|
onlineSignal;
|
|
1315
1312
|
manualOverride = void 0;
|
|
1316
1313
|
eventListenersAttached = !1;
|
|
@@ -1374,7 +1371,7 @@ class ue {
|
|
|
1374
1371
|
}, window.addEventListener("online", this.handleOnline), window.addEventListener("offline", this.handleOffline), this.eventListenersAttached = !0);
|
|
1375
1372
|
}
|
|
1376
1373
|
}
|
|
1377
|
-
class
|
|
1374
|
+
class ue {
|
|
1378
1375
|
static onlineSignal = Lt(!0);
|
|
1379
1376
|
get isOnline() {
|
|
1380
1377
|
return !0;
|
|
@@ -1384,19 +1381,19 @@ class de {
|
|
|
1384
1381
|
clearManualOverride() {
|
|
1385
1382
|
}
|
|
1386
1383
|
getOnlineSignal() {
|
|
1387
|
-
return
|
|
1384
|
+
return ue.onlineSignal;
|
|
1388
1385
|
}
|
|
1389
1386
|
destroy() {
|
|
1390
1387
|
}
|
|
1391
1388
|
}
|
|
1392
|
-
const
|
|
1393
|
-
function
|
|
1389
|
+
const _n = new fe(), Ln = Ut(_n);
|
|
1390
|
+
function bt(e, t = typeof window > "u") {
|
|
1394
1391
|
let n;
|
|
1395
1392
|
e === !1 ? n = 0 : e === void 0 || e === !0 ? n = t ? 0 : 3 : typeof e == "number" ? n = e : n = e.retries;
|
|
1396
1393
|
const i = typeof e == "object" && e.retryDelay ? e.retryDelay : (r) => 1e3 * Math.pow(2, r);
|
|
1397
1394
|
return { retries: n, retryDelay: i };
|
|
1398
1395
|
}
|
|
1399
|
-
class
|
|
1396
|
+
class Un {
|
|
1400
1397
|
static cache;
|
|
1401
1398
|
/**
|
|
1402
1399
|
* The adapter class responsible for sending requests for this query type.
|
|
@@ -1410,28 +1407,28 @@ class qn {
|
|
|
1410
1407
|
}
|
|
1411
1408
|
}
|
|
1412
1409
|
const Ft = /* @__PURE__ */ new WeakMap();
|
|
1413
|
-
class
|
|
1410
|
+
class H {
|
|
1414
1411
|
constructor(t, n) {
|
|
1415
1412
|
this.captured = n, this.statics = t;
|
|
1416
1413
|
}
|
|
1417
1414
|
statics;
|
|
1418
1415
|
createExecutionContext(t, n) {
|
|
1419
|
-
return
|
|
1416
|
+
return rt(this.captured, t, n);
|
|
1420
1417
|
}
|
|
1421
1418
|
resolveOptions(t) {
|
|
1422
|
-
const { methods: n } = this.captured, i = n.getConfig ? n.getConfig.call(t) : t.config, r =
|
|
1419
|
+
const { methods: n } = this.captured, i = n.getConfig ? n.getConfig.call(t) : t.config, r = bt(i?.retry);
|
|
1423
1420
|
return { config: i, retryConfig: r };
|
|
1424
1421
|
}
|
|
1425
1422
|
static for(t) {
|
|
1426
1423
|
let n = Ft.get(t);
|
|
1427
1424
|
if (n !== void 0)
|
|
1428
1425
|
return n;
|
|
1429
|
-
const i = new t(), r =
|
|
1426
|
+
const i = new t(), r = $e(i), s = String(r.methods.getIdentityKey.call(r.fields)), o = r.fields.result, a = o instanceof m ? o : sn.object(o), c = (a.mask & d.ENTITY) !== 0, f = t.cache, l = r.fields.fetchNext, u = t.adapter;
|
|
1430
1427
|
if (!u)
|
|
1431
1428
|
throw new Error(
|
|
1432
1429
|
`Query class "${t.name}" must define a static \`adapter\` property. Extend RESTQuery (from fetchium/rest) or set \`static adapter = MyAdapter\` on your query class.`
|
|
1433
1430
|
);
|
|
1434
|
-
const
|
|
1431
|
+
const h = typeof u.prototype.sendNext == "function", g = c ? a : new m(
|
|
1435
1432
|
d.ENTITY | d.OBJECT,
|
|
1436
1433
|
a.shape,
|
|
1437
1434
|
void 0,
|
|
@@ -1441,64 +1438,64 @@ class G {
|
|
|
1441
1438
|
Vt
|
|
1442
1439
|
// idField — symbol, injected onto payload before parse
|
|
1443
1440
|
);
|
|
1444
|
-
return n = new
|
|
1445
|
-
{ id: s, shape: g, cache: f, rawFetchNext:
|
|
1441
|
+
return n = new H(
|
|
1442
|
+
{ id: s, shape: g, cache: f, rawFetchNext: l, hasSendNext: h, isEntityResult: c, adapterClass: u },
|
|
1446
1443
|
r
|
|
1447
1444
|
), Ft.set(t, n), n;
|
|
1448
1445
|
}
|
|
1449
1446
|
}
|
|
1450
|
-
const
|
|
1451
|
-
const n =
|
|
1452
|
-
return
|
|
1447
|
+
const qn = (e, t) => {
|
|
1448
|
+
const n = H.for(e);
|
|
1449
|
+
return Ct(n, t);
|
|
1453
1450
|
};
|
|
1454
|
-
function
|
|
1455
|
-
const n =
|
|
1451
|
+
function Vn(e, ...t) {
|
|
1452
|
+
const n = H.for(e), i = Oe(kn);
|
|
1456
1453
|
if (i === void 0)
|
|
1457
1454
|
throw new Error("QueryClient not found");
|
|
1458
1455
|
const r = t[0];
|
|
1459
1456
|
return i.getQuery(n, r);
|
|
1460
1457
|
}
|
|
1461
|
-
function
|
|
1458
|
+
function ct(e) {
|
|
1462
1459
|
if (e.reason !== void 0) return e.reason;
|
|
1463
1460
|
if (typeof DOMException < "u")
|
|
1464
1461
|
return new DOMException("The operation was aborted", "AbortError");
|
|
1465
1462
|
const t = new Error("The operation was aborted");
|
|
1466
1463
|
return t.name = "AbortError", t;
|
|
1467
1464
|
}
|
|
1468
|
-
function
|
|
1465
|
+
function de(e, t) {
|
|
1469
1466
|
return new Promise((n, i) => {
|
|
1470
1467
|
if (t?.aborted) {
|
|
1471
|
-
i(
|
|
1468
|
+
i(ct(t));
|
|
1472
1469
|
return;
|
|
1473
1470
|
}
|
|
1474
1471
|
const r = setTimeout(n, e);
|
|
1475
1472
|
t?.addEventListener(
|
|
1476
1473
|
"abort",
|
|
1477
1474
|
() => {
|
|
1478
|
-
clearTimeout(r), i(
|
|
1475
|
+
clearTimeout(r), i(ct(t));
|
|
1479
1476
|
},
|
|
1480
1477
|
{ once: !0 }
|
|
1481
1478
|
);
|
|
1482
1479
|
});
|
|
1483
1480
|
}
|
|
1484
|
-
async function
|
|
1481
|
+
async function ft(e, t, n) {
|
|
1485
1482
|
if (t.retries < 0)
|
|
1486
1483
|
throw new Error("retries must be non-negative");
|
|
1487
1484
|
const i = Math.max(0, t.retries);
|
|
1488
1485
|
let r;
|
|
1489
1486
|
for (let s = 0; s <= i; s++) {
|
|
1490
1487
|
if (n?.aborted)
|
|
1491
|
-
throw
|
|
1488
|
+
throw ct(n);
|
|
1492
1489
|
try {
|
|
1493
1490
|
return await e();
|
|
1494
1491
|
} catch (o) {
|
|
1495
1492
|
if (r = o, s >= i) throw o;
|
|
1496
|
-
await
|
|
1493
|
+
await de(t.retryDelay(s), n);
|
|
1497
1494
|
}
|
|
1498
1495
|
}
|
|
1499
1496
|
throw r;
|
|
1500
1497
|
}
|
|
1501
|
-
class
|
|
1498
|
+
class wn {
|
|
1502
1499
|
def;
|
|
1503
1500
|
queryKey;
|
|
1504
1501
|
storageKey = -1;
|
|
@@ -1516,7 +1513,7 @@ class En {
|
|
|
1516
1513
|
debounceTimer = void 0;
|
|
1517
1514
|
/** Resolved per-instance options (depend on actual params). */
|
|
1518
1515
|
config = void 0;
|
|
1519
|
-
retryConfig =
|
|
1516
|
+
retryConfig = bt(void 0);
|
|
1520
1517
|
/** Cancels in-flight fetches and retry waits. */
|
|
1521
1518
|
_abortController = void 0;
|
|
1522
1519
|
/** Cached execution context, recreated only when storageKey (params) changes. */
|
|
@@ -1546,16 +1543,16 @@ class En {
|
|
|
1546
1543
|
const a = () => {
|
|
1547
1544
|
this._isActive = !1, clearTimeout(this.debounceTimer), this.debounceTimer = void 0, this._abortController?.abort(), this._abortController = void 0, this._fetchNextAbort?.abort(), this._fetchNextAbort = void 0, this._fetchNextPromise = void 0, this.unsubscribe?.(), this.unsubscribe = void 0;
|
|
1548
1545
|
const f = this.config?.gcTime ?? qt;
|
|
1549
|
-
this.queryClient.gcManager.schedule(this.queryKey, f,
|
|
1546
|
+
this.queryClient.gcManager.schedule(this.queryKey, f, Z.Query);
|
|
1550
1547
|
}, c = (f = !1) => {
|
|
1551
|
-
const { wasPaused:
|
|
1552
|
-
if (this.wasPaused = u, u && !
|
|
1548
|
+
const { wasPaused: l, isPaused: u, initialized: h } = this;
|
|
1549
|
+
if (this.wasPaused = u, u && !l && h) {
|
|
1553
1550
|
a();
|
|
1554
1551
|
return;
|
|
1555
1552
|
}
|
|
1556
1553
|
this._isActive = !0;
|
|
1557
|
-
const g = jt(this.params), p =
|
|
1558
|
-
|
|
1554
|
+
const g = jt(this.params), p = Ct(this.def, g), _ = p !== this.storageKey;
|
|
1555
|
+
_ && (this.currentParams = g, this.storageKey = p), this.getOrCreateExecutionContext(), this.initialized ? l || f ? (this.queryClient.activateQuery(this), f && this.updatedAt !== void 0 && this.setupSubscription(), this.relayState.isPending && this._abortController === void 0 ? this.runQueryImmediately() : (this.config?.refreshStaleOnReconnect ?? !0) && this.isStale && this.runDebounced()) : _ && (this.setupSubscription(), this.runDebounced()) : (this.queryClient.activateQuery(this), this.initialize());
|
|
1559
1556
|
};
|
|
1560
1557
|
return c(!0), {
|
|
1561
1558
|
update: c,
|
|
@@ -1604,7 +1601,7 @@ class En {
|
|
|
1604
1601
|
if (!this.isPaused)
|
|
1605
1602
|
try {
|
|
1606
1603
|
if (i !== void 0 && this.setupSubscription(), i === void 0 || this.isStale) {
|
|
1607
|
-
if (await
|
|
1604
|
+
if (await de(0), this.isPaused) return;
|
|
1608
1605
|
this.runQueryImmediately();
|
|
1609
1606
|
}
|
|
1610
1607
|
} catch (r) {
|
|
@@ -1635,7 +1632,7 @@ class En {
|
|
|
1635
1632
|
if (this.isPaused)
|
|
1636
1633
|
throw new Error("Query is paused due to network status");
|
|
1637
1634
|
const n = this.getOrCreateExecutionContext(), i = this.queryClient.getAdapter(t.statics.adapterClass), r = this._abortController?.signal ?? new AbortController().signal;
|
|
1638
|
-
return
|
|
1635
|
+
return ft(
|
|
1639
1636
|
async () => {
|
|
1640
1637
|
const s = await i.send(n, r);
|
|
1641
1638
|
this.updatedAt = Date.now();
|
|
@@ -1691,7 +1688,7 @@ class En {
|
|
|
1691
1688
|
const n = this._fetchNextAbort.signal, i = this.getOrCreateExecutionContext();
|
|
1692
1689
|
i.resultData = this.rootEntity.data;
|
|
1693
1690
|
const r = this.queryClient.getAdapter(t.statics.adapterClass);
|
|
1694
|
-
return
|
|
1691
|
+
return ft(
|
|
1695
1692
|
async () => {
|
|
1696
1693
|
const s = await r.sendNext(i, n);
|
|
1697
1694
|
this.updatedAt = Date.now();
|
|
@@ -1712,21 +1709,21 @@ class En {
|
|
|
1712
1709
|
return Date.now() - this.updatedAt >= t;
|
|
1713
1710
|
}
|
|
1714
1711
|
get isPaused() {
|
|
1715
|
-
const t = this.config?.networkMode ??
|
|
1716
|
-
if (t ===
|
|
1712
|
+
const t = this.config?.networkMode ?? K.Online;
|
|
1713
|
+
if (t === K.Always)
|
|
1717
1714
|
return !1;
|
|
1718
1715
|
const n = this.queryClient.networkManager.getOnlineSignal().value;
|
|
1719
1716
|
switch (t) {
|
|
1720
|
-
case
|
|
1717
|
+
case K.Online:
|
|
1721
1718
|
return !n;
|
|
1722
|
-
case
|
|
1719
|
+
case K.OfflineFirst:
|
|
1723
1720
|
return !n && this.updatedAt === void 0;
|
|
1724
1721
|
default:
|
|
1725
1722
|
return !1;
|
|
1726
1723
|
}
|
|
1727
1724
|
}
|
|
1728
1725
|
}
|
|
1729
|
-
class
|
|
1726
|
+
class En {
|
|
1730
1727
|
def;
|
|
1731
1728
|
queryClient;
|
|
1732
1729
|
_inFlight = !1;
|
|
@@ -1735,7 +1732,7 @@ class bn {
|
|
|
1735
1732
|
this.def = t, this.queryClient = n, this.task = this.createTask();
|
|
1736
1733
|
}
|
|
1737
1734
|
createTask() {
|
|
1738
|
-
return
|
|
1735
|
+
return Se(
|
|
1739
1736
|
async (t) => {
|
|
1740
1737
|
if (this._inFlight)
|
|
1741
1738
|
throw new Error("A mutation is already in progress. Await the previous call before starting a new one.");
|
|
@@ -1755,7 +1752,7 @@ class bn {
|
|
|
1755
1752
|
if (!(n instanceof m))
|
|
1756
1753
|
return t;
|
|
1757
1754
|
const i = this.queryClient.getContext().log?.warn ?? (() => {
|
|
1758
|
-
}), r = new
|
|
1755
|
+
}), r = new at();
|
|
1759
1756
|
return r.reset(void 0, void 0, i), se(t, n, r);
|
|
1760
1757
|
}
|
|
1761
1758
|
// ======================================================
|
|
@@ -1764,7 +1761,7 @@ class bn {
|
|
|
1764
1761
|
processEffects(t, n) {
|
|
1765
1762
|
let i;
|
|
1766
1763
|
if (this.def.hasGetEffects) {
|
|
1767
|
-
const s =
|
|
1764
|
+
const s = rt(
|
|
1768
1765
|
this.def.captured,
|
|
1769
1766
|
t ?? {},
|
|
1770
1767
|
this.queryClient.getContext()
|
|
@@ -1772,23 +1769,23 @@ class bn {
|
|
|
1772
1769
|
s.result = n, i = s.getEffects();
|
|
1773
1770
|
} else if (this.def.effects !== void 0) {
|
|
1774
1771
|
const s = { params: t, result: n };
|
|
1775
|
-
i =
|
|
1772
|
+
i = X(this.def.effects, s);
|
|
1776
1773
|
}
|
|
1777
1774
|
if (i === void 0) return;
|
|
1778
1775
|
const r = this.queryClient;
|
|
1779
|
-
|
|
1776
|
+
nt(i.creates, "create", r), nt(i.updates, "update", r), nt(i.deletes, "delete", r), i.invalidates && r.invalidateQueries(i.invalidates);
|
|
1780
1777
|
}
|
|
1781
1778
|
// ======================================================
|
|
1782
1779
|
// Retry logic
|
|
1783
1780
|
// ======================================================
|
|
1784
1781
|
executeWithRetry(t) {
|
|
1785
|
-
const n =
|
|
1782
|
+
const n = bt(this.def.config?.retry, !0), i = this.queryClient.getAdapter(this.def.adapterClass);
|
|
1786
1783
|
if (!i.sendMutation)
|
|
1787
1784
|
throw new Error(
|
|
1788
1785
|
`Adapter "${this.def.adapterClass.name}" does not implement sendMutation(). Add a sendMutation() method to handle mutations.`
|
|
1789
1786
|
);
|
|
1790
|
-
return
|
|
1791
|
-
const r = new AbortController(), s =
|
|
1787
|
+
return ft(async () => {
|
|
1788
|
+
const r = new AbortController(), s = rt(
|
|
1792
1789
|
this.def.captured,
|
|
1793
1790
|
t ?? {},
|
|
1794
1791
|
this.queryClient.getContext()
|
|
@@ -1797,22 +1794,22 @@ class bn {
|
|
|
1797
1794
|
}, n);
|
|
1798
1795
|
}
|
|
1799
1796
|
}
|
|
1800
|
-
function
|
|
1801
|
-
return typeof e == "string" ? e :
|
|
1797
|
+
function bn(e) {
|
|
1798
|
+
return typeof e == "string" ? e : $(e).typenameValue;
|
|
1802
1799
|
}
|
|
1803
|
-
function
|
|
1800
|
+
function nt(e, t, n) {
|
|
1804
1801
|
if (e)
|
|
1805
1802
|
for (const [i, r] of e) {
|
|
1806
|
-
const s =
|
|
1803
|
+
const s = bn(i);
|
|
1807
1804
|
s !== void 0 && n.applyMutationEvent({ type: t, typename: s, data: r });
|
|
1808
1805
|
}
|
|
1809
1806
|
}
|
|
1810
1807
|
const le = "__eventSource";
|
|
1811
|
-
function
|
|
1808
|
+
function he(e) {
|
|
1812
1809
|
return { field: e, segments: e.indexOf(".") !== -1 ? e.split(".") : void 0 };
|
|
1813
1810
|
}
|
|
1814
|
-
function
|
|
1815
|
-
return e.map(
|
|
1811
|
+
function Cn(e) {
|
|
1812
|
+
return e.map(he);
|
|
1816
1813
|
}
|
|
1817
1814
|
function On(e, t) {
|
|
1818
1815
|
if (t.segments === void 0) return e[t.field];
|
|
@@ -1823,7 +1820,7 @@ function On(e, t) {
|
|
|
1823
1820
|
}
|
|
1824
1821
|
return n;
|
|
1825
1822
|
}
|
|
1826
|
-
function
|
|
1823
|
+
function ye(e, t) {
|
|
1827
1824
|
const n = [];
|
|
1828
1825
|
for (let i = 0; i < t.length; i++) {
|
|
1829
1826
|
const r = t[i], s = On(e, r);
|
|
@@ -1832,24 +1829,24 @@ function pe(e, t) {
|
|
|
1832
1829
|
}
|
|
1833
1830
|
return N(n);
|
|
1834
1831
|
}
|
|
1835
|
-
function
|
|
1832
|
+
function Sn(e, t) {
|
|
1836
1833
|
if (e === void 0) return;
|
|
1837
1834
|
const n = /* @__PURE__ */ new Map();
|
|
1838
1835
|
for (const [i, r] of e) {
|
|
1839
1836
|
const s = r.slice().sort((c, f) => c[0] < f[0] ? -1 : c[0] > f[0] ? 1 : 0), o = [];
|
|
1840
1837
|
let a = !0;
|
|
1841
1838
|
for (const [c, f] of s) {
|
|
1842
|
-
let
|
|
1839
|
+
let l;
|
|
1843
1840
|
if (Bt(f)) {
|
|
1844
1841
|
const u = Qt(f);
|
|
1845
|
-
|
|
1842
|
+
l = yt(u, t);
|
|
1846
1843
|
} else
|
|
1847
|
-
|
|
1848
|
-
if (
|
|
1844
|
+
l = f;
|
|
1845
|
+
if (l === void 0) {
|
|
1849
1846
|
a = !1;
|
|
1850
1847
|
break;
|
|
1851
1848
|
}
|
|
1852
|
-
o.push(c,
|
|
1849
|
+
o.push(c, l);
|
|
1853
1850
|
}
|
|
1854
1851
|
a && n.set(i, N(o));
|
|
1855
1852
|
}
|
|
@@ -1860,12 +1857,12 @@ function Mt(e, t) {
|
|
|
1860
1857
|
if (n !== void 0)
|
|
1861
1858
|
return n.map(([i]) => i).sort();
|
|
1862
1859
|
}
|
|
1863
|
-
class
|
|
1860
|
+
class Rn {
|
|
1864
1861
|
fields;
|
|
1865
1862
|
fieldPaths;
|
|
1866
1863
|
_bindings = /* @__PURE__ */ new Map();
|
|
1867
1864
|
constructor(t) {
|
|
1868
|
-
this.fields = t, this.fieldPaths = t.map(
|
|
1865
|
+
this.fields = t, this.fieldPaths = t.map(he);
|
|
1869
1866
|
}
|
|
1870
1867
|
register(t, n) {
|
|
1871
1868
|
let i = this._bindings.get(t);
|
|
@@ -1885,12 +1882,12 @@ class An {
|
|
|
1885
1882
|
function Tt(e) {
|
|
1886
1883
|
return N(e);
|
|
1887
1884
|
}
|
|
1888
|
-
class
|
|
1885
|
+
class An {
|
|
1889
1886
|
_groups = /* @__PURE__ */ new Map();
|
|
1890
1887
|
getOrCreateGroup(t) {
|
|
1891
1888
|
const n = Tt(t);
|
|
1892
1889
|
let i = this._groups.get(n);
|
|
1893
|
-
return i === void 0 && (i = new
|
|
1890
|
+
return i === void 0 && (i = new Rn(t), this._groups.set(n, i)), i;
|
|
1894
1891
|
}
|
|
1895
1892
|
register(t, n, i) {
|
|
1896
1893
|
this.getOrCreateGroup(n).register(t, i);
|
|
@@ -1913,12 +1910,12 @@ class xn {
|
|
|
1913
1910
|
}
|
|
1914
1911
|
routeEvent(t, n, i, r, s, o) {
|
|
1915
1912
|
for (const a of this._groups.values()) {
|
|
1916
|
-
const c =
|
|
1913
|
+
const c = ye(n, a.fieldPaths);
|
|
1917
1914
|
if (c === void 0) continue;
|
|
1918
1915
|
const f = a.getMatching(c);
|
|
1919
1916
|
if (f !== void 0)
|
|
1920
|
-
for (const
|
|
1921
|
-
|
|
1917
|
+
for (const l of f)
|
|
1918
|
+
l.onEvent(t, i, r, s, o);
|
|
1922
1919
|
}
|
|
1923
1920
|
}
|
|
1924
1921
|
}
|
|
@@ -1926,12 +1923,12 @@ function Pt(e) {
|
|
|
1926
1923
|
const t = /* @__PURE__ */ new Set();
|
|
1927
1924
|
for (const n of e)
|
|
1928
1925
|
if (typeof n == "object" && n !== null) {
|
|
1929
|
-
const i =
|
|
1926
|
+
const i = P(n);
|
|
1930
1927
|
i !== void 0 && t.add(i);
|
|
1931
1928
|
}
|
|
1932
1929
|
return t;
|
|
1933
1930
|
}
|
|
1934
|
-
class
|
|
1931
|
+
class pe {
|
|
1935
1932
|
_queryClient;
|
|
1936
1933
|
_parent;
|
|
1937
1934
|
_constraintHashes;
|
|
@@ -1942,7 +1939,7 @@ class ge {
|
|
|
1942
1939
|
this._queryClient = i, this._parent = r, this._constraintHashes = s, this._constraintFieldRefs = n, this.instance = o, this._entityDefsByTypename = /* @__PURE__ */ new Map();
|
|
1943
1940
|
for (const a of t)
|
|
1944
1941
|
a.typenameValue !== void 0 && this._entityDefsByTypename.set(a.typenameValue, a);
|
|
1945
|
-
|
|
1942
|
+
tt.add(this);
|
|
1946
1943
|
}
|
|
1947
1944
|
getValue() {
|
|
1948
1945
|
return this.instance.getValue();
|
|
@@ -1981,7 +1978,7 @@ class ge {
|
|
|
1981
1978
|
n !== -1 && t.splice(n, 1);
|
|
1982
1979
|
}
|
|
1983
1980
|
}
|
|
1984
|
-
class
|
|
1981
|
+
class xn {
|
|
1985
1982
|
_notifier;
|
|
1986
1983
|
_items;
|
|
1987
1984
|
_keys;
|
|
@@ -1989,31 +1986,31 @@ class Nn {
|
|
|
1989
1986
|
_queryClient;
|
|
1990
1987
|
_parent;
|
|
1991
1988
|
constructor(t, n, i, r, s, o) {
|
|
1992
|
-
this._notifier =
|
|
1989
|
+
this._notifier = dt(), this._items = i, this._keys = Pt(i), this._queryClient = t, this._parent = n;
|
|
1993
1990
|
const a = r !== void 0 && s !== void 0, c = o !== void 0;
|
|
1994
|
-
(a || c) && (this._outputSignal =
|
|
1991
|
+
(a || c) && (this._outputSignal = Re(() => {
|
|
1995
1992
|
this._notifier.consume();
|
|
1996
1993
|
let f = this._items;
|
|
1997
1994
|
if (a) {
|
|
1998
|
-
const
|
|
1995
|
+
const l = [];
|
|
1999
1996
|
for (const u of f) {
|
|
2000
1997
|
if (typeof u != "object" || u === null) {
|
|
2001
|
-
|
|
1998
|
+
l.push(u);
|
|
2002
1999
|
continue;
|
|
2003
2000
|
}
|
|
2004
|
-
const
|
|
2005
|
-
if (
|
|
2006
|
-
|
|
2001
|
+
const h = P(u);
|
|
2002
|
+
if (h === void 0) {
|
|
2003
|
+
l.push(u);
|
|
2007
2004
|
continue;
|
|
2008
2005
|
}
|
|
2009
|
-
const g = t.entityMap.getEntity(
|
|
2006
|
+
const g = t.entityMap.getEntity(h);
|
|
2010
2007
|
if (g === void 0) {
|
|
2011
|
-
|
|
2008
|
+
l.push(u);
|
|
2012
2009
|
continue;
|
|
2013
2010
|
}
|
|
2014
|
-
g.consume(),
|
|
2011
|
+
g.consume(), ye(g.data, r) === s && l.push(u);
|
|
2015
2012
|
}
|
|
2016
|
-
f =
|
|
2013
|
+
f = l;
|
|
2017
2014
|
}
|
|
2018
2015
|
return c && (f = (f === this._items ? f.slice() : f).sort(o)), f;
|
|
2019
2016
|
}));
|
|
@@ -2059,7 +2056,7 @@ class Nn {
|
|
|
2059
2056
|
this._items = i, this._keys = Pt(i);
|
|
2060
2057
|
for (const r of i)
|
|
2061
2058
|
if (typeof r == "object" && r !== null) {
|
|
2062
|
-
const s =
|
|
2059
|
+
const s = P(r);
|
|
2063
2060
|
if (s !== void 0) {
|
|
2064
2061
|
const o = this._queryClient.entityMap.getEntity(s);
|
|
2065
2062
|
o !== void 0 && this._parent.addChildRef(o);
|
|
@@ -2067,7 +2064,7 @@ class Nn {
|
|
|
2067
2064
|
}
|
|
2068
2065
|
for (const r of n)
|
|
2069
2066
|
if (typeof r == "object" && r !== null) {
|
|
2070
|
-
const s =
|
|
2067
|
+
const s = P(r);
|
|
2071
2068
|
if (s !== void 0) {
|
|
2072
2069
|
const o = this._queryClient.entityMap.getEntity(s);
|
|
2073
2070
|
o !== void 0 && this._parent.removeChildRef(o);
|
|
@@ -2079,20 +2076,20 @@ class Nn {
|
|
|
2079
2076
|
if (Array.isArray(t))
|
|
2080
2077
|
for (const n of t) {
|
|
2081
2078
|
if (typeof n != "object" || n === null) continue;
|
|
2082
|
-
const i =
|
|
2079
|
+
const i = P(n);
|
|
2083
2080
|
i !== void 0 && this.add(i, n);
|
|
2084
2081
|
}
|
|
2085
2082
|
}
|
|
2086
2083
|
_findIndex(t) {
|
|
2087
2084
|
for (let n = 0; n < this._items.length; n++) {
|
|
2088
2085
|
const i = this._items[n];
|
|
2089
|
-
if (typeof i == "object" && i !== null &&
|
|
2086
|
+
if (typeof i == "object" && i !== null && P(i) === t)
|
|
2090
2087
|
return n;
|
|
2091
2088
|
}
|
|
2092
2089
|
return -1;
|
|
2093
2090
|
}
|
|
2094
2091
|
}
|
|
2095
|
-
class
|
|
2092
|
+
class Nn {
|
|
2096
2093
|
_notifier;
|
|
2097
2094
|
_value;
|
|
2098
2095
|
_createdKeys;
|
|
@@ -2103,7 +2100,7 @@ class Dn {
|
|
|
2103
2100
|
_onUpdate;
|
|
2104
2101
|
_onDelete;
|
|
2105
2102
|
constructor(t, n, i, r, s, o) {
|
|
2106
|
-
this._notifier =
|
|
2103
|
+
this._notifier = dt(), this._value = i, this._createdKeys = /* @__PURE__ */ new Set(), this._deletedKeys = /* @__PURE__ */ new Set(), this._queryClient = t, this._parent = n, this._onCreate = r, this._onUpdate = s, this._onDelete = o;
|
|
2107
2104
|
}
|
|
2108
2105
|
onEvent(t, n, i, r) {
|
|
2109
2106
|
switch (r) {
|
|
@@ -2133,39 +2130,39 @@ class Dn {
|
|
|
2133
2130
|
append(t) {
|
|
2134
2131
|
}
|
|
2135
2132
|
}
|
|
2136
|
-
function
|
|
2133
|
+
function ge(e, t, n, i, r) {
|
|
2137
2134
|
let s = e.constraintFieldRefs;
|
|
2138
2135
|
if (s === void 0) {
|
|
2139
2136
|
s = /* @__PURE__ */ new Map();
|
|
2140
2137
|
for (const f of e.entityDefs) {
|
|
2141
|
-
const
|
|
2142
|
-
|
|
2138
|
+
const l = f.typenameValue;
|
|
2139
|
+
l !== void 0 && s.set(l, [[le, n.key]]);
|
|
2143
2140
|
}
|
|
2144
2141
|
}
|
|
2145
|
-
const o =
|
|
2142
|
+
const o = Sn(s, i) ?? /* @__PURE__ */ new Map();
|
|
2146
2143
|
let a;
|
|
2147
|
-
if (e.type ===
|
|
2148
|
-
let f,
|
|
2144
|
+
if (e.type === lt.Array) {
|
|
2145
|
+
let f, l;
|
|
2149
2146
|
if (e.constraintFieldRefs !== void 0 && o.size > 0 && o.size === 1)
|
|
2150
2147
|
for (const [u] of e.constraintFieldRefs) {
|
|
2151
|
-
const
|
|
2152
|
-
if (
|
|
2153
|
-
|
|
2148
|
+
const h = o.get(u);
|
|
2149
|
+
if (h !== void 0) {
|
|
2150
|
+
l = h;
|
|
2154
2151
|
const g = e.constraintFieldRefs.get(u);
|
|
2155
|
-
g !== void 0 && (f =
|
|
2152
|
+
g !== void 0 && (f = Cn(g.map(([p]) => p)));
|
|
2156
2153
|
break;
|
|
2157
2154
|
}
|
|
2158
2155
|
}
|
|
2159
|
-
a = new
|
|
2156
|
+
a = new xn(
|
|
2160
2157
|
r,
|
|
2161
2158
|
n,
|
|
2162
2159
|
Array.isArray(t) ? t : [],
|
|
2163
2160
|
f,
|
|
2164
|
-
|
|
2161
|
+
l,
|
|
2165
2162
|
e.sort
|
|
2166
2163
|
);
|
|
2167
2164
|
} else
|
|
2168
|
-
a = new
|
|
2165
|
+
a = new Nn(
|
|
2169
2166
|
r,
|
|
2170
2167
|
n,
|
|
2171
2168
|
t,
|
|
@@ -2173,7 +2170,7 @@ function me(e, t, n, i, r) {
|
|
|
2173
2170
|
e.onUpdate,
|
|
2174
2171
|
e.onDelete
|
|
2175
2172
|
);
|
|
2176
|
-
const c = new
|
|
2173
|
+
const c = new pe(
|
|
2177
2174
|
e.entityDefs,
|
|
2178
2175
|
s,
|
|
2179
2176
|
r,
|
|
@@ -2183,74 +2180,74 @@ function me(e, t, n, i, r) {
|
|
|
2183
2180
|
);
|
|
2184
2181
|
return n.liveCollections.push(c), r.registerLiveCollection(c), c;
|
|
2185
2182
|
}
|
|
2186
|
-
const
|
|
2187
|
-
function
|
|
2183
|
+
const me = Object.entries, ve = Object.prototype;
|
|
2184
|
+
function it(e, t, n, i = !1) {
|
|
2188
2185
|
const r = e.queryClient;
|
|
2189
2186
|
r.currentParseId++;
|
|
2190
2187
|
const s = e.seen, o = /* @__PURE__ */ new Map();
|
|
2191
|
-
return { data:
|
|
2188
|
+
return { data: G(t, s, r, n, o, i), entityRefs: o };
|
|
2192
2189
|
}
|
|
2193
|
-
function
|
|
2190
|
+
function G(e, t, n, i, r, s) {
|
|
2194
2191
|
if (typeof e != "object" || e === null) return e;
|
|
2195
2192
|
const o = t.get(e);
|
|
2196
2193
|
if (o !== void 0)
|
|
2197
|
-
return
|
|
2194
|
+
return Dn(o, t, n, i, r, s);
|
|
2198
2195
|
if (Array.isArray(e)) {
|
|
2199
2196
|
for (let a = 0; a < e.length; a++) {
|
|
2200
2197
|
const c = e[a];
|
|
2201
|
-
typeof c == "object" && c !== null && !(c instanceof
|
|
2198
|
+
typeof c == "object" && c !== null && !(c instanceof Y) && !O.has(c) && (e[a] = G(c, t, n, i, r, s));
|
|
2202
2199
|
}
|
|
2203
2200
|
return e;
|
|
2204
2201
|
}
|
|
2205
|
-
if (Object.getPrototypeOf(e) ===
|
|
2202
|
+
if (Object.getPrototypeOf(e) === ve && !O.has(e)) {
|
|
2206
2203
|
const a = e;
|
|
2207
2204
|
for (const c of Object.keys(a)) {
|
|
2208
2205
|
const f = a[c];
|
|
2209
|
-
typeof f == "object" && f !== null && !(f instanceof
|
|
2206
|
+
typeof f == "object" && f !== null && !(f instanceof Y) && !O.has(f) && (a[c] = G(f, t, n, i, r, s));
|
|
2210
2207
|
}
|
|
2211
2208
|
}
|
|
2212
2209
|
return e;
|
|
2213
2210
|
}
|
|
2214
|
-
function
|
|
2215
|
-
return typeof e == "object" && e !== null && !(e instanceof
|
|
2211
|
+
function _e(e) {
|
|
2212
|
+
return typeof e == "object" && e !== null && !(e instanceof Y) && !O.has(e);
|
|
2216
2213
|
}
|
|
2217
|
-
function
|
|
2218
|
-
const { key: o, data: a, shape: c, rawKeys: f } = e,
|
|
2219
|
-
if (g ? (
|
|
2220
|
-
h,
|
|
2221
|
-
a,
|
|
2214
|
+
function Dn(e, t, n, i, r, s) {
|
|
2215
|
+
const { key: o, data: a, shape: c, rawKeys: f } = e, l = c.shape, u = n.prepareEntity(o, a, c), h = u.data, g = h !== a, p = g && f !== void 0 && u.entityRefs !== void 0 ? new Map(u.entityRefs) : /* @__PURE__ */ new Map();
|
|
2216
|
+
if (g ? (we(
|
|
2222
2217
|
l,
|
|
2218
|
+
a,
|
|
2219
|
+
h,
|
|
2223
2220
|
f,
|
|
2224
2221
|
u,
|
|
2225
|
-
|
|
2222
|
+
h,
|
|
2226
2223
|
t,
|
|
2227
2224
|
n,
|
|
2228
2225
|
i,
|
|
2229
2226
|
p,
|
|
2230
2227
|
s
|
|
2231
|
-
), u.notify()) :
|
|
2228
|
+
), u.notify()) : Ee(l, a, u, a, t, n, i, p, s), s && u.liveCollections.length > 0)
|
|
2232
2229
|
for (const v of u.liveCollections) {
|
|
2233
|
-
const
|
|
2234
|
-
if (Array.isArray(
|
|
2235
|
-
for (const
|
|
2236
|
-
if (typeof
|
|
2237
|
-
const R =
|
|
2230
|
+
const S = v.instance.getRawValue();
|
|
2231
|
+
if (Array.isArray(S))
|
|
2232
|
+
for (const T of S) {
|
|
2233
|
+
if (typeof T != "object" || T === null) continue;
|
|
2234
|
+
const R = O.get(T);
|
|
2238
2235
|
if (R === void 0) continue;
|
|
2239
|
-
const
|
|
2240
|
-
|
|
2236
|
+
const U = n.entityMap.getEntity(R);
|
|
2237
|
+
U !== void 0 && p.set(U, (p.get(U) ?? 0) + 1);
|
|
2241
2238
|
}
|
|
2242
2239
|
}
|
|
2243
2240
|
u.setChildRefs(p.size > 0 ? p : void 0, i);
|
|
2244
|
-
const
|
|
2245
|
-
return r.set(u, (r.get(u) ?? 0) + 1),
|
|
2241
|
+
const _ = u.getProxy(c);
|
|
2242
|
+
return r.set(u, (r.get(u) ?? 0) + 1), _;
|
|
2246
2243
|
}
|
|
2247
|
-
function
|
|
2248
|
-
for (const [u,
|
|
2244
|
+
function we(e, t, n, i, r, s, o, a, c, f, l) {
|
|
2245
|
+
for (const [u, h] of me(e))
|
|
2249
2246
|
if (!(i !== void 0 && !i.has(u)))
|
|
2250
|
-
if (
|
|
2247
|
+
if (_e(t[u]) && (t[u] = G(t[u], o, a, c, f, l)), h instanceof m && h._liveConfig !== void 0) {
|
|
2251
2248
|
const g = n[u];
|
|
2252
|
-
g instanceof
|
|
2253
|
-
|
|
2249
|
+
g instanceof pe ? l ? g.append(t[u]) : g.reset(t[u]) : n[u] = ge(
|
|
2250
|
+
h._liveConfig,
|
|
2254
2251
|
t[u],
|
|
2255
2252
|
r,
|
|
2256
2253
|
s,
|
|
@@ -2258,11 +2255,11 @@ function Ee(e, t, n, i, r, s, o, a, c, f, h) {
|
|
|
2258
2255
|
);
|
|
2259
2256
|
} else {
|
|
2260
2257
|
const g = t[u], p = n[u];
|
|
2261
|
-
if (
|
|
2262
|
-
const
|
|
2263
|
-
if (
|
|
2264
|
-
|
|
2265
|
-
|
|
2258
|
+
if (ut(g) && ut(p)) {
|
|
2259
|
+
const _ = h instanceof m && h.shape !== void 0 ? h.shape : void 0;
|
|
2260
|
+
if (_ !== void 0)
|
|
2261
|
+
we(
|
|
2262
|
+
_,
|
|
2266
2263
|
g,
|
|
2267
2264
|
p,
|
|
2268
2265
|
void 0,
|
|
@@ -2272,7 +2269,7 @@ function Ee(e, t, n, i, r, s, o, a, c, f, h) {
|
|
|
2272
2269
|
a,
|
|
2273
2270
|
c,
|
|
2274
2271
|
f,
|
|
2275
|
-
|
|
2272
|
+
l
|
|
2276
2273
|
);
|
|
2277
2274
|
else
|
|
2278
2275
|
for (const v of Object.keys(g))
|
|
@@ -2282,12 +2279,12 @@ function Ee(e, t, n, i, r, s, o, a, c, f, h) {
|
|
|
2282
2279
|
n[u] = g;
|
|
2283
2280
|
}
|
|
2284
2281
|
}
|
|
2285
|
-
function
|
|
2286
|
-
for (const [f,
|
|
2282
|
+
function Ee(e, t, n, i, r, s, o, a, c) {
|
|
2283
|
+
for (const [f, l] of me(e))
|
|
2287
2284
|
if (f in t)
|
|
2288
|
-
if (
|
|
2289
|
-
t[f] =
|
|
2290
|
-
|
|
2285
|
+
if (_e(t[f]) && (t[f] = G(t[f], r, s, o, a, c)), l instanceof m && l._liveConfig !== void 0)
|
|
2286
|
+
t[f] = ge(
|
|
2287
|
+
l._liveConfig,
|
|
2291
2288
|
t[f],
|
|
2292
2289
|
n,
|
|
2293
2290
|
i,
|
|
@@ -2295,32 +2292,32 @@ function be(e, t, n, i, r, s, o, a, c) {
|
|
|
2295
2292
|
);
|
|
2296
2293
|
else {
|
|
2297
2294
|
const u = t[f];
|
|
2298
|
-
if (
|
|
2299
|
-
const
|
|
2300
|
-
|
|
2295
|
+
if (ut(u)) {
|
|
2296
|
+
const h = l instanceof m && l.shape !== void 0 ? l.shape : void 0;
|
|
2297
|
+
h !== void 0 && Ee(h, u, n, i, r, s, o, a, c);
|
|
2301
2298
|
}
|
|
2302
2299
|
}
|
|
2303
2300
|
}
|
|
2304
|
-
function
|
|
2305
|
-
return typeof e == "object" && e !== null && !Array.isArray(e) && Object.getPrototypeOf(e) ===
|
|
2301
|
+
function ut(e) {
|
|
2302
|
+
return typeof e == "object" && e !== null && !Array.isArray(e) && Object.getPrototypeOf(e) === ve && !O.has(e);
|
|
2306
2303
|
}
|
|
2307
|
-
function
|
|
2304
|
+
function Kn(e) {
|
|
2308
2305
|
if (e !== void 0)
|
|
2309
2306
|
return typeof e == "string" ? e : typeof e == "function" ? e() : e.value;
|
|
2310
2307
|
}
|
|
2311
|
-
function
|
|
2312
|
-
return
|
|
2308
|
+
function In(e) {
|
|
2309
|
+
return Ae(e);
|
|
2313
2310
|
}
|
|
2314
2311
|
function jt(e) {
|
|
2315
2312
|
if (e === void 0)
|
|
2316
2313
|
return;
|
|
2317
2314
|
const t = {};
|
|
2318
2315
|
for (const [n, i] of Object.entries(e))
|
|
2319
|
-
|
|
2316
|
+
In(i) ? t[n] = i.value : t[n] = i;
|
|
2320
2317
|
return t;
|
|
2321
2318
|
}
|
|
2322
|
-
const
|
|
2323
|
-
class
|
|
2319
|
+
const Ct = (e, t) => N([e.statics.id, t]);
|
|
2320
|
+
class Bn {
|
|
2324
2321
|
entityMap;
|
|
2325
2322
|
queryInstances = /* @__PURE__ */ new Map();
|
|
2326
2323
|
mutationInstances = /* @__PURE__ */ new Map();
|
|
@@ -2337,7 +2334,7 @@ class Qn {
|
|
|
2337
2334
|
networkUnsubscribe;
|
|
2338
2335
|
constructor(t = {}) {
|
|
2339
2336
|
const {
|
|
2340
|
-
store: n = new
|
|
2337
|
+
store: n = new Ie(new ke()),
|
|
2341
2338
|
log: i,
|
|
2342
2339
|
evictionMultiplier: r,
|
|
2343
2340
|
adapters: s,
|
|
@@ -2345,15 +2342,15 @@ class Qn {
|
|
|
2345
2342
|
gcManager: a,
|
|
2346
2343
|
...c
|
|
2347
2344
|
} = t;
|
|
2348
|
-
this.isServer = typeof window > "u", this.store = n, this.context = { ...c, log: i ?? console, evictionMultiplier: r }, this.gcManager = t.gcManager ?? (this.isServer ? new
|
|
2345
|
+
this.isServer = typeof window > "u", this.store = n, this.context = { ...c, log: i ?? console, evictionMultiplier: r }, this.gcManager = t.gcManager ?? (this.isServer ? new Te() : new Me(this.handleEviction, r)), this.networkManager = t.networkManager ?? new fe(), this.entityMap = new vn((u, h, g) => this.store.saveEntity(u, h, g));
|
|
2349
2346
|
for (const u of t.adapters ?? [])
|
|
2350
2347
|
this.adapters.set(u.constructor, u), u.register(this);
|
|
2351
|
-
const f = this.networkManager.getOnlineSignal(),
|
|
2352
|
-
this.networkUnsubscribe =
|
|
2348
|
+
const f = this.networkManager.getOnlineSignal(), l = xe(() => f.value);
|
|
2349
|
+
this.networkUnsubscribe = l.addListener(
|
|
2353
2350
|
() => {
|
|
2354
2351
|
const u = f.value;
|
|
2355
|
-
for (const
|
|
2356
|
-
|
|
2352
|
+
for (const h of this.adapters.values())
|
|
2353
|
+
h.onNetworkStatusChange?.(u);
|
|
2357
2354
|
},
|
|
2358
2355
|
{ skipInitial: !0 }
|
|
2359
2356
|
), this.store.purgeStaleQueries?.();
|
|
@@ -2444,9 +2441,9 @@ class Qn {
|
|
|
2444
2441
|
* that triggers fetches and prepopulates with cached data
|
|
2445
2442
|
*/
|
|
2446
2443
|
getQuery(t, n) {
|
|
2447
|
-
const i =
|
|
2444
|
+
const i = Ct(t, n);
|
|
2448
2445
|
let r = this.queryInstances.get(i);
|
|
2449
|
-
return r === void 0 && (r = new
|
|
2446
|
+
return r === void 0 && (r = new wn(t, this, i, n), this.queryInstances.set(i, r)), r.relay;
|
|
2450
2447
|
}
|
|
2451
2448
|
/**
|
|
2452
2449
|
* Gets or creates a MutationResult for the given mutation definition.
|
|
@@ -2455,7 +2452,7 @@ class Qn {
|
|
|
2455
2452
|
getMutation(t) {
|
|
2456
2453
|
const n = t.id;
|
|
2457
2454
|
let i = this.mutationInstances.get(n);
|
|
2458
|
-
return i === void 0 && (i = new
|
|
2455
|
+
return i === void 0 && (i = new En(t, this), this.mutationInstances.set(n, i)), i.task;
|
|
2459
2456
|
}
|
|
2460
2457
|
/**
|
|
2461
2458
|
* Parse data: validates, formats, produces parsed entity data objects.
|
|
@@ -2463,7 +2460,7 @@ class Qn {
|
|
|
2463
2460
|
*/
|
|
2464
2461
|
parseData(t, n, i) {
|
|
2465
2462
|
const r = this.context.log?.warn ?? (() => {
|
|
2466
|
-
}), s = new
|
|
2463
|
+
}), s = new at();
|
|
2467
2464
|
return s.reset(this, i, r), { data: se(t, n, s), ctx: s };
|
|
2468
2465
|
}
|
|
2469
2466
|
/**
|
|
@@ -2472,7 +2469,7 @@ class Qn {
|
|
|
2472
2469
|
* refs. Returns the reified data and root-level entity refs.
|
|
2473
2470
|
*/
|
|
2474
2471
|
applyRefs(t, n = !0, i = !1) {
|
|
2475
|
-
return
|
|
2472
|
+
return it(t.ctx, t.data, n, i);
|
|
2476
2473
|
}
|
|
2477
2474
|
/**
|
|
2478
2475
|
* Parse and apply data as a root entity. For non-entity results, injects
|
|
@@ -2481,7 +2478,7 @@ class Qn {
|
|
|
2481
2478
|
*/
|
|
2482
2479
|
parseAndApplyRootEntity(t, n, i, r, s = !1, o) {
|
|
2483
2480
|
typeof i.idField == "symbol" && typeof t == "object" && t !== null && !("__entityRef" in t) && (t[Vt] = n);
|
|
2484
|
-
const a = this.parseData(t, i, o), c =
|
|
2481
|
+
const a = this.parseData(t, i, o), c = it(a.ctx, a.data, r, s), f = O.get(c.data);
|
|
2485
2482
|
return this.entityMap.getEntity(f);
|
|
2486
2483
|
}
|
|
2487
2484
|
prepareEntity(t, n, i) {
|
|
@@ -2497,55 +2494,55 @@ class Qn {
|
|
|
2497
2494
|
if (s === void 0 || typeof s == "symbol") return;
|
|
2498
2495
|
const o = t.data, a = t.id !== void 0 ? t.id : n === "delete" && (typeof o == "string" || typeof o == "number") ? o : o[s];
|
|
2499
2496
|
if (a === void 0) return;
|
|
2500
|
-
const c = N([i, a]), f = t.__eventSource,
|
|
2497
|
+
const c = N([i, a]), f = t.__eventSource, l = typeof o == "object" && o !== null ? o : {}, u = this.entityMap.getEntity(c);
|
|
2501
2498
|
if (n === "delete") {
|
|
2502
|
-
const
|
|
2503
|
-
this.routeEvent(i,
|
|
2499
|
+
const _ = u !== void 0 ? u.data : l;
|
|
2500
|
+
this.routeEvent(i, _, c, n, f, void 0, _);
|
|
2504
2501
|
return;
|
|
2505
2502
|
}
|
|
2506
2503
|
try {
|
|
2507
|
-
const
|
|
2508
|
-
}), v = new
|
|
2504
|
+
const _ = this.context.log?.warn ?? (() => {
|
|
2505
|
+
}), v = new at();
|
|
2509
2506
|
v.reset(
|
|
2510
2507
|
this,
|
|
2511
2508
|
void 0,
|
|
2512
|
-
|
|
2509
|
+
_,
|
|
2513
2510
|
/* isPartialEvent */
|
|
2514
2511
|
!0
|
|
2515
2512
|
);
|
|
2516
|
-
const
|
|
2517
|
-
|
|
2518
|
-
} catch (
|
|
2519
|
-
if (this.context.log?.warn?.("Failed to apply mutation event",
|
|
2513
|
+
const S = an(l, r, v);
|
|
2514
|
+
it(v, S, !0);
|
|
2515
|
+
} catch (_) {
|
|
2516
|
+
if (this.context.log?.warn?.("Failed to apply mutation event", _), u === void 0) {
|
|
2520
2517
|
const v = this.entityMap.getEntity(c);
|
|
2521
2518
|
v !== void 0 && v.evict();
|
|
2522
2519
|
}
|
|
2523
2520
|
return;
|
|
2524
2521
|
}
|
|
2525
|
-
const
|
|
2526
|
-
if (
|
|
2527
|
-
this.entityMap.save(
|
|
2522
|
+
const h = this.entityMap.getEntity(c);
|
|
2523
|
+
if (h === void 0) return;
|
|
2524
|
+
this.entityMap.save(h);
|
|
2528
2525
|
const g = u === void 0;
|
|
2529
2526
|
let p = !1;
|
|
2530
|
-
this.routeEvent(i,
|
|
2527
|
+
this.routeEvent(i, h.data, c, n, f, () => {
|
|
2531
2528
|
p = !0;
|
|
2532
|
-
}), g && !p &&
|
|
2529
|
+
}), g && !p && h.evict();
|
|
2533
2530
|
}
|
|
2534
2531
|
// ======================================================
|
|
2535
2532
|
// Query Invalidation
|
|
2536
2533
|
// ======================================================
|
|
2537
2534
|
invalidateQueries(t) {
|
|
2538
2535
|
for (const n of t) {
|
|
2539
|
-
const i = Array.isArray(n), r = i ? n[0] : n, s = i ? n[1] : void 0, a =
|
|
2536
|
+
const i = Array.isArray(n), r = i ? n[0] : n, s = i ? n[1] : void 0, a = H.for(r).statics.id;
|
|
2540
2537
|
for (const [, c] of this.queryInstances)
|
|
2541
|
-
c.def.statics.id === a && (s === void 0 ||
|
|
2538
|
+
c.def.statics.id === a && (s === void 0 || Fn(c.resolvedParams, s)) && c.markStale();
|
|
2542
2539
|
}
|
|
2543
2540
|
}
|
|
2544
2541
|
// ======================================================
|
|
2545
2542
|
// In-Memory GC
|
|
2546
2543
|
// ======================================================
|
|
2547
2544
|
handleEviction = (t, n) => {
|
|
2548
|
-
if (n ===
|
|
2545
|
+
if (n === Z.Query) {
|
|
2549
2546
|
const r = this.queryInstances.get(t);
|
|
2550
2547
|
if (r === void 0) return;
|
|
2551
2548
|
r.rootEntity?.evict(), this.queryInstances.delete(t);
|
|
@@ -2559,7 +2556,7 @@ class Qn {
|
|
|
2559
2556
|
// ======================================================
|
|
2560
2557
|
getOrCreateMatcher(t) {
|
|
2561
2558
|
let n = this.constraintRegistry.get(t);
|
|
2562
|
-
return n === void 0 && (n = new
|
|
2559
|
+
return n === void 0 && (n = new An(), this.constraintRegistry.set(t, n)), n;
|
|
2563
2560
|
}
|
|
2564
2561
|
registerLiveCollection(t) {
|
|
2565
2562
|
for (const [n, i] of t._entityDefsByTypename)
|
|
@@ -2584,40 +2581,40 @@ class Qn {
|
|
|
2584
2581
|
this.adapters.clear(), this.queryInstances.clear(), this.mutationInstances.clear(), this.constraintRegistry.clear(), this.typenameRegistry.clear(), this.mergedDefCache.clear();
|
|
2585
2582
|
}
|
|
2586
2583
|
}
|
|
2587
|
-
const
|
|
2588
|
-
function
|
|
2584
|
+
const kn = Ut(void 0);
|
|
2585
|
+
function Fn(e, t) {
|
|
2589
2586
|
if (e === void 0) return !1;
|
|
2590
2587
|
for (const n in t)
|
|
2591
2588
|
if (e[n] !== t[n]) return !1;
|
|
2592
2589
|
return !0;
|
|
2593
2590
|
}
|
|
2594
2591
|
export {
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2592
|
+
k as A,
|
|
2593
|
+
pt as E,
|
|
2594
|
+
Me as G,
|
|
2595
|
+
Q as L,
|
|
2599
2596
|
d as M,
|
|
2600
|
-
|
|
2597
|
+
fe as N,
|
|
2601
2598
|
Vt as Q,
|
|
2602
|
-
|
|
2599
|
+
F as R,
|
|
2603
2600
|
m as V,
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2601
|
+
lt as a,
|
|
2602
|
+
Ln as b,
|
|
2603
|
+
K as c,
|
|
2604
|
+
Te as d,
|
|
2605
|
+
ue as e,
|
|
2606
|
+
Un as f,
|
|
2607
|
+
Bn as g,
|
|
2608
|
+
kn as h,
|
|
2609
|
+
_n as i,
|
|
2610
|
+
$n as j,
|
|
2611
|
+
Vn as k,
|
|
2615
2612
|
Yt as l,
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2613
|
+
$e as m,
|
|
2614
|
+
X as n,
|
|
2615
|
+
Kn as o,
|
|
2616
|
+
qn as q,
|
|
2620
2617
|
ee as r,
|
|
2621
|
-
|
|
2618
|
+
sn as t
|
|
2622
2619
|
};
|
|
2623
|
-
//# sourceMappingURL=QueryClient-
|
|
2620
|
+
//# sourceMappingURL=QueryClient-DfxP7pt2.js.map
|