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 ft, relay as kt, setScopeOwner as ge, reactiveMethod as ve, signal as Ft, context as Tt, getContext as _e, task as me, reactiveSignal as we, isSignal as Ee, watcher as be } from "signalium";
|
|
2
|
+
import { registerCustomHash as Ce, hashValue as D, registerCustomSnapshot as xe } from "signalium/utils";
|
|
3
3
|
import { d as Pt } from "./shared-DcuVH8Pf.js";
|
|
4
|
-
import { SyncQueryStore as
|
|
5
|
-
var
|
|
6
|
-
const
|
|
7
|
-
var
|
|
8
|
-
class
|
|
4
|
+
import { SyncQueryStore as Oe, MemoryPersistentStore as Re } from "./stores/sync.js";
|
|
5
|
+
var L = /* @__PURE__ */ ((e) => (e.Always = "always", e.Online = "online", e.OfflineFirst = "offlineFirst", e))(L || {}), 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 B = /* @__PURE__ */ Symbol("array"), Y = /* @__PURE__ */ Symbol("record"), jt = /* @__PURE__ */ Symbol("QUERY_ID");
|
|
7
|
+
var ut = /* @__PURE__ */ ((e) => (e[e.Array = 0] = "Array", e[e.Value = 1] = "Value", e))(ut || {});
|
|
8
|
+
class q {
|
|
9
9
|
type;
|
|
10
10
|
entityDefs;
|
|
11
11
|
constraintFieldRefs;
|
|
@@ -18,7 +18,7 @@ class L {
|
|
|
18
18
|
this.type = t, this.entityDefs = i, this.constraintFieldRefs = n, this.sort = s, this.valueType = r, this.onCreate = o, this.onUpdate = a, this.onDelete = c;
|
|
19
19
|
}
|
|
20
20
|
static array(t, i, n) {
|
|
21
|
-
return new
|
|
21
|
+
return new q(
|
|
22
22
|
0,
|
|
23
23
|
t,
|
|
24
24
|
i,
|
|
@@ -30,7 +30,7 @@ class L {
|
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
static value(t, i, n, s, r, o) {
|
|
33
|
-
return new
|
|
33
|
+
return new q(
|
|
34
34
|
1,
|
|
35
35
|
t,
|
|
36
36
|
i,
|
|
@@ -43,11 +43,11 @@ class L {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
const x = /* @__PURE__ */ new WeakMap();
|
|
46
|
-
function
|
|
46
|
+
function F(e) {
|
|
47
47
|
return x.get(e);
|
|
48
48
|
}
|
|
49
|
-
var
|
|
50
|
-
class
|
|
49
|
+
var H = /* @__PURE__ */ ((e) => (e[e.Query = 0] = "Query", e[e.Entity = 1] = "Entity", e))(H || {});
|
|
50
|
+
class Se {
|
|
51
51
|
constructor(t, i, n) {
|
|
52
52
|
this._onEvict = i, this._intervalId = setInterval(this._tick, t * 6e4 * n);
|
|
53
53
|
}
|
|
@@ -70,7 +70,7 @@ class Ae {
|
|
|
70
70
|
clearInterval(this._intervalId);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
class
|
|
73
|
+
class Ae {
|
|
74
74
|
_buckets = /* @__PURE__ */ new Map();
|
|
75
75
|
_nextTickEntries = /* @__PURE__ */ new Map();
|
|
76
76
|
_nextTickScheduled = !1;
|
|
@@ -88,7 +88,7 @@ class De {
|
|
|
88
88
|
}
|
|
89
89
|
const { _buckets: s } = this;
|
|
90
90
|
let r = s.get(i);
|
|
91
|
-
r || (r = new
|
|
91
|
+
r || (r = new Se(i, this._onEvict, this._multiplier), s.set(i, r)), r.schedule(t, n);
|
|
92
92
|
}
|
|
93
93
|
cancel(t, i) {
|
|
94
94
|
if (i !== 1 / 0) {
|
|
@@ -113,7 +113,7 @@ class De {
|
|
|
113
113
|
t.clear(), i.clear();
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
class
|
|
116
|
+
class De {
|
|
117
117
|
schedule(t, i, n) {
|
|
118
118
|
}
|
|
119
119
|
cancel(t, i) {
|
|
@@ -121,35 +121,35 @@ class Ie {
|
|
|
121
121
|
destroy() {
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
const
|
|
124
|
+
const G = /* @__PURE__ */ Symbol("fieldRef"), M = /* @__PURE__ */ Symbol("fieldRefPath"), dt = /* @__PURE__ */ Symbol("DEFINITION_TARGET"), W = /* @__PURE__ */ Symbol("CANCEL_PROXY"), Ie = /\[([^\]]+)\]/g;
|
|
125
125
|
function Lt(e) {
|
|
126
126
|
const t = {
|
|
127
|
-
[
|
|
128
|
-
[
|
|
127
|
+
[G]: !0,
|
|
128
|
+
[M]: e
|
|
129
129
|
};
|
|
130
|
-
return new Proxy(t,
|
|
130
|
+
return new Proxy(t, Ne);
|
|
131
131
|
}
|
|
132
|
-
const
|
|
132
|
+
const Ne = {
|
|
133
133
|
get(e, t) {
|
|
134
|
-
if (t ===
|
|
135
|
-
if (t ===
|
|
134
|
+
if (t === G) return !0;
|
|
135
|
+
if (t === M) return e[M];
|
|
136
136
|
if (t === Symbol.toPrimitive || t === "toString" || t === "valueOf") {
|
|
137
|
-
const n = e[
|
|
137
|
+
const n = e[M];
|
|
138
138
|
return () => `[${n.join(".")}]`;
|
|
139
139
|
}
|
|
140
140
|
if (typeof t == "symbol") return;
|
|
141
|
-
const i = e[
|
|
141
|
+
const i = e[M];
|
|
142
142
|
return Lt([...i, t]);
|
|
143
143
|
},
|
|
144
144
|
has(e, t) {
|
|
145
|
-
return t ===
|
|
145
|
+
return t === G || t === M;
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
148
|
function qt(e) {
|
|
149
|
-
return typeof e == "object" && e !== null && e[
|
|
149
|
+
return typeof e == "object" && e !== null && e[G] === !0;
|
|
150
150
|
}
|
|
151
151
|
function Ut(e) {
|
|
152
|
-
return e[
|
|
152
|
+
return e[M];
|
|
153
153
|
}
|
|
154
154
|
function Vt(e) {
|
|
155
155
|
return new Proxy(e, {
|
|
@@ -157,14 +157,14 @@ function Vt(e) {
|
|
|
157
157
|
return t[i] = n, !0;
|
|
158
158
|
},
|
|
159
159
|
get(t, i) {
|
|
160
|
-
return i ===
|
|
160
|
+
return i === dt ? t : i === W ? () => {
|
|
161
161
|
} : typeof i == "symbol" ? t[i] : Lt([i]);
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
|
-
function
|
|
166
|
-
const t = e[
|
|
167
|
-
e[
|
|
165
|
+
function Me(e) {
|
|
166
|
+
const t = e[dt];
|
|
167
|
+
e[W]();
|
|
168
168
|
const i = {};
|
|
169
169
|
for (const r of Object.getOwnPropertyNames(t))
|
|
170
170
|
i[r] = t[r];
|
|
@@ -180,7 +180,7 @@ function ke(e) {
|
|
|
180
180
|
}
|
|
181
181
|
return { fields: i, methods: n };
|
|
182
182
|
}
|
|
183
|
-
function
|
|
183
|
+
function lt(e, t) {
|
|
184
184
|
let i = t;
|
|
185
185
|
for (const n of e) {
|
|
186
186
|
if (i == null) return;
|
|
@@ -188,47 +188,47 @@ function dt(e, t) {
|
|
|
188
188
|
}
|
|
189
189
|
return i;
|
|
190
190
|
}
|
|
191
|
-
function
|
|
192
|
-
return e.replace(
|
|
193
|
-
const s = n.split("."), r =
|
|
191
|
+
function ke(e, t) {
|
|
192
|
+
return e.replace(Ie, (i, n) => {
|
|
193
|
+
const s = n.split("."), r = lt(s, t);
|
|
194
194
|
return r != null ? encodeURIComponent(String(r)) : "";
|
|
195
195
|
});
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function z(e, t) {
|
|
198
198
|
if (qt(e))
|
|
199
|
-
return
|
|
199
|
+
return lt(Ut(e), t);
|
|
200
200
|
if (typeof e == "string")
|
|
201
|
-
return
|
|
201
|
+
return ke(e, t);
|
|
202
202
|
if (Array.isArray(e))
|
|
203
|
-
return e.map((i) =>
|
|
203
|
+
return e.map((i) => z(i, t));
|
|
204
204
|
if (typeof e == "object" && e !== null && Object.getPrototypeOf(e) === Object.prototype) {
|
|
205
205
|
const i = {};
|
|
206
206
|
for (const n of Object.keys(e))
|
|
207
|
-
i[n] =
|
|
207
|
+
i[n] = z(e[n], t);
|
|
208
208
|
return i;
|
|
209
209
|
}
|
|
210
210
|
return e;
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function it(e, t, i) {
|
|
213
213
|
const n = e.fields, s = e.methods, r = { params: t }, o = {};
|
|
214
214
|
for (const [a, c] of Object.entries(n))
|
|
215
|
-
o[a] =
|
|
215
|
+
o[a] = z(c, r);
|
|
216
216
|
o.params = t, o.context = i;
|
|
217
217
|
for (const [a, c] of Object.entries(s))
|
|
218
218
|
o[a] = c.bind(o);
|
|
219
219
|
return o;
|
|
220
220
|
}
|
|
221
|
-
class
|
|
221
|
+
class ht {
|
|
222
222
|
static cache;
|
|
223
223
|
constructor() {
|
|
224
224
|
return Vt(this);
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
|
-
const Kt = Object.entries,
|
|
228
|
-
function
|
|
227
|
+
const Kt = Object.entries, nt = Object.keys;
|
|
228
|
+
function Ct(e) {
|
|
229
229
|
return typeof e == "number" ? e | d.UNDEFINED : e instanceof _ ? (e.mask & d.UNDEFINED) !== 0 ? e : _.cloneWith(e, d.UNDEFINED) : e;
|
|
230
230
|
}
|
|
231
|
-
function
|
|
231
|
+
function Fe(e) {
|
|
232
232
|
return e instanceof _ && (e.mask & d.OBJECT) !== 0 && (e.mask & (d.ENTITY | d.ARRAY | d.UNION | d.RECORD | d.LIVE)) === 0;
|
|
233
233
|
}
|
|
234
234
|
function $t(e, t, i) {
|
|
@@ -244,13 +244,13 @@ function $t(e, t, i) {
|
|
|
244
244
|
let f = !0;
|
|
245
245
|
for (const l of e) {
|
|
246
246
|
const u = l?.[r];
|
|
247
|
-
u !== void 0 ? (o++, a === void 0 && (a = u),
|
|
247
|
+
u !== void 0 ? (o++, a === void 0 && (a = u), Fe(u) ? c.push(u.shape) : (f = !1, c.push(void 0))) : (f = !1, c.push(void 0));
|
|
248
248
|
}
|
|
249
249
|
if (f && o > 0) {
|
|
250
250
|
const l = $t(c, t), u = new _(d.OBJECT, l);
|
|
251
|
-
s[r] = o < t ?
|
|
251
|
+
s[r] = o < t ? Ct(u) : u;
|
|
252
252
|
} else
|
|
253
|
-
s[r] = o < t ?
|
|
253
|
+
s[r] = o < t ? Ct(a) : a;
|
|
254
254
|
}
|
|
255
255
|
return s;
|
|
256
256
|
}
|
|
@@ -322,7 +322,7 @@ class _ {
|
|
|
322
322
|
return n._methods = t._methods, n._entityConfig = t._entityConfig, n._entityClass = t._entityClass, n._entityCache = t._entityCache, n._liveConfig = t._liveConfig, n;
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
|
-
class
|
|
325
|
+
class J extends Set {
|
|
326
326
|
lowercaseMap;
|
|
327
327
|
// lowercase -> canonical (strings only)
|
|
328
328
|
constructor(t) {
|
|
@@ -357,24 +357,24 @@ class H extends Set {
|
|
|
357
357
|
return t;
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
const
|
|
361
|
-
|
|
362
|
-
let t =
|
|
360
|
+
const Te = 1128875347;
|
|
361
|
+
Ce(J, (e) => {
|
|
362
|
+
let t = Te;
|
|
363
363
|
for (const i of e)
|
|
364
364
|
t += D(i);
|
|
365
365
|
return t >>> 0;
|
|
366
366
|
});
|
|
367
|
-
function
|
|
367
|
+
function yt(e, t) {
|
|
368
368
|
return new _(e, t);
|
|
369
369
|
}
|
|
370
|
+
function Pe(e) {
|
|
371
|
+
return yt(d.ARRAY, e);
|
|
372
|
+
}
|
|
370
373
|
function je(e) {
|
|
371
|
-
return
|
|
374
|
+
return yt(d.RECORD | d.OBJECT, e);
|
|
372
375
|
}
|
|
373
376
|
function Le(e) {
|
|
374
|
-
return
|
|
375
|
-
}
|
|
376
|
-
function qe(e) {
|
|
377
|
-
return ht(d.PARSE_RESULT, e);
|
|
377
|
+
return yt(d.PARSE_RESULT, e);
|
|
378
378
|
}
|
|
379
379
|
function Qt(e, t) {
|
|
380
380
|
let i = e, n, s, r;
|
|
@@ -393,17 +393,17 @@ function Qt(e, t) {
|
|
|
393
393
|
s = o, r = a;
|
|
394
394
|
break;
|
|
395
395
|
case "object":
|
|
396
|
-
if (a instanceof
|
|
396
|
+
if (a instanceof J || a instanceof Set)
|
|
397
397
|
break;
|
|
398
398
|
a.mask & d.LIVE && (i |= d.LIVE);
|
|
399
399
|
break;
|
|
400
400
|
}
|
|
401
401
|
return new _(i, t, void 0, s, r, n);
|
|
402
402
|
}
|
|
403
|
-
function
|
|
403
|
+
function qe(e) {
|
|
404
404
|
return Qt(d.OBJECT, e);
|
|
405
405
|
}
|
|
406
|
-
function
|
|
406
|
+
function xt(e, t, i) {
|
|
407
407
|
const n = e.mask;
|
|
408
408
|
if ((n & d.UNION) !== 0) {
|
|
409
409
|
const s = e;
|
|
@@ -416,7 +416,7 @@ function Ct(e, t, i) {
|
|
|
416
416
|
}
|
|
417
417
|
const r = s.shape;
|
|
418
418
|
if (r !== void 0)
|
|
419
|
-
for (const o of [...
|
|
419
|
+
for (const o of [...nt(r), B, Y]) {
|
|
420
420
|
const a = r[o];
|
|
421
421
|
if (t[o] !== void 0 && t[o] !== a)
|
|
422
422
|
throw new Error(
|
|
@@ -425,13 +425,13 @@ function Ct(e, t, i) {
|
|
|
425
425
|
t[o] = a;
|
|
426
426
|
}
|
|
427
427
|
} else if ((n & d.ARRAY) !== 0) {
|
|
428
|
-
if (t[
|
|
428
|
+
if (t[B] !== void 0)
|
|
429
429
|
throw new Error("Array shape already defined");
|
|
430
|
-
t[
|
|
430
|
+
t[B] = e.shape;
|
|
431
431
|
} else if ((n & d.RECORD) !== 0) {
|
|
432
|
-
if (t[
|
|
432
|
+
if (t[Y] !== void 0)
|
|
433
433
|
throw new Error("Record shape already defined");
|
|
434
|
-
t[
|
|
434
|
+
t[Y] = e.shape;
|
|
435
435
|
} else {
|
|
436
436
|
const s = e.typenameField, r = e.typenameValue;
|
|
437
437
|
if (r === void 0)
|
|
@@ -444,7 +444,7 @@ function Ct(e, t, i) {
|
|
|
444
444
|
}
|
|
445
445
|
return i;
|
|
446
446
|
}
|
|
447
|
-
function
|
|
447
|
+
function pt(...e) {
|
|
448
448
|
const t = e;
|
|
449
449
|
let i = 0, n = 0, s, r, o, a, c = 0;
|
|
450
450
|
for (const l of t) {
|
|
@@ -464,7 +464,7 @@ function yt(...e) {
|
|
|
464
464
|
s = l;
|
|
465
465
|
continue;
|
|
466
466
|
}
|
|
467
|
-
n === 2 && (o = /* @__PURE__ */ Object.create(null), a =
|
|
467
|
+
n === 2 && (o = /* @__PURE__ */ Object.create(null), a = xt(s, o, a)), a = xt(l, o, a);
|
|
468
468
|
}
|
|
469
469
|
if (n === 0)
|
|
470
470
|
return r === void 0 ? i : i === 0 ? r : new _(i | d.UNION, void 0, r);
|
|
@@ -473,60 +473,60 @@ function yt(...e) {
|
|
|
473
473
|
const f = i | c | d.UNION;
|
|
474
474
|
return new _(f, o, r, a);
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function gt(e, t, i) {
|
|
477
477
|
const n = e;
|
|
478
478
|
if (typeof n == "number")
|
|
479
479
|
return n | t;
|
|
480
480
|
if (n instanceof Set)
|
|
481
|
-
return
|
|
481
|
+
return pt(e, t);
|
|
482
482
|
let s = i.get(n);
|
|
483
483
|
return s === void 0 && (s = _.cloneWith(n, t), i.set(n, s)), s;
|
|
484
484
|
}
|
|
485
|
-
const
|
|
485
|
+
const Ue = /* @__PURE__ */ new WeakMap(), Ve = /* @__PURE__ */ new WeakMap(), Ke = /* @__PURE__ */ new WeakMap();
|
|
486
|
+
function $e(e) {
|
|
487
|
+
return gt(e, d.UNDEFINED | d.NULL, Ke);
|
|
488
|
+
}
|
|
486
489
|
function Qe(e) {
|
|
487
|
-
return
|
|
490
|
+
return gt(e, d.UNDEFINED, Ue);
|
|
488
491
|
}
|
|
489
492
|
function Be(e) {
|
|
490
|
-
return
|
|
493
|
+
return gt(e, d.NULL, Ve);
|
|
491
494
|
}
|
|
492
495
|
function Ye(e) {
|
|
493
|
-
return pt(e, d.NULL, Ke);
|
|
494
|
-
}
|
|
495
|
-
function Ge(e) {
|
|
496
496
|
return e;
|
|
497
497
|
}
|
|
498
|
-
function
|
|
498
|
+
function Ge(e) {
|
|
499
499
|
return /* @__PURE__ */ new Set([e]);
|
|
500
500
|
}
|
|
501
501
|
const Bt = ((...e) => new Set(e));
|
|
502
|
-
Bt.caseInsensitive = (...e) => new
|
|
502
|
+
Bt.caseInsensitive = (...e) => new J(e);
|
|
503
503
|
const Yt = 16;
|
|
504
|
-
let
|
|
505
|
-
const
|
|
506
|
-
class
|
|
504
|
+
let We = 0;
|
|
505
|
+
const st = [], Gt = [], Wt = /* @__PURE__ */ new Map(), X = /* @__PURE__ */ new WeakSet();
|
|
506
|
+
class U {
|
|
507
507
|
_raw;
|
|
508
508
|
_formatted;
|
|
509
509
|
_parsed;
|
|
510
510
|
_formatId;
|
|
511
511
|
constructor(t, i, n) {
|
|
512
|
-
this._raw = t, this._formatId = i, n ? (this._formatted =
|
|
512
|
+
this._raw = t, this._formatId = i, n ? (this._formatted = st[i](t), this._parsed = !0) : this._parsed = !1, X.add(this);
|
|
513
513
|
}
|
|
514
514
|
getValue() {
|
|
515
|
-
return this._parsed || (this._formatted =
|
|
515
|
+
return this._parsed || (this._formatted = st[this._formatId](this._raw), this._parsed = !0), this._formatted;
|
|
516
516
|
}
|
|
517
517
|
toJSON() {
|
|
518
518
|
return this._parsed ? Gt[this._formatId](this._formatted) : this._raw;
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
|
-
function
|
|
521
|
+
function ze(e) {
|
|
522
522
|
const t = Wt.get(e);
|
|
523
523
|
if (t === void 0)
|
|
524
524
|
throw new Error(`Format ${e} not registered`);
|
|
525
525
|
return t;
|
|
526
526
|
}
|
|
527
527
|
function zt(e, t, i, n, s) {
|
|
528
|
-
const r =
|
|
529
|
-
|
|
528
|
+
const r = We++;
|
|
529
|
+
st[r] = i, Gt[r] = n;
|
|
530
530
|
const o = s?.eager ?? !0, c = r << Yt | t | d.HAS_FORMAT | (o ? d.IS_EAGER_FORMAT : 0);
|
|
531
531
|
Wt.set(e, c);
|
|
532
532
|
}
|
|
@@ -558,21 +558,21 @@ zt(
|
|
|
558
558
|
},
|
|
559
559
|
(e) => e.toISOString()
|
|
560
560
|
);
|
|
561
|
-
const
|
|
562
|
-
function
|
|
563
|
-
let t =
|
|
561
|
+
const Ot = /* @__PURE__ */ new WeakMap();
|
|
562
|
+
function P(e) {
|
|
563
|
+
let t = Ot.get(e);
|
|
564
564
|
if (t === void 0) {
|
|
565
|
-
const i = new e(), n = i[
|
|
566
|
-
i[
|
|
565
|
+
const i = new e(), n = i[dt] ?? i;
|
|
566
|
+
i[W] && i[W]();
|
|
567
567
|
const s = {};
|
|
568
568
|
for (const [f, l] of Kt(n))
|
|
569
569
|
s[f] = l;
|
|
570
570
|
const r = Object.getPrototypeOf(e.prototype);
|
|
571
571
|
if (r != null) {
|
|
572
572
|
const f = r.constructor;
|
|
573
|
-
if (f !==
|
|
574
|
-
const u =
|
|
575
|
-
for (const y of
|
|
573
|
+
if (f !== ht && typeof f == "function") {
|
|
574
|
+
const u = P(f).shape;
|
|
575
|
+
for (const y of nt(u))
|
|
576
576
|
if (y in s && s[y] !== u[y])
|
|
577
577
|
throw new Error(`Cannot extend: field '${y}' already exists in type definition`);
|
|
578
578
|
}
|
|
@@ -580,21 +580,21 @@ function T(e) {
|
|
|
580
580
|
const o = {}, a = e.prototype;
|
|
581
581
|
for (const f of Object.getOwnPropertyNames(a))
|
|
582
582
|
f !== "constructor" && typeof a[f] == "function" && (o[f] = a[f]);
|
|
583
|
-
t = Qt(d.ENTITY | d.OBJECT, s), t._entityClass = e,
|
|
583
|
+
t = Qt(d.ENTITY | d.OBJECT, s), t._entityClass = e, nt(o).length > 0 && (t._methods = o), typeof o.__subscribe == "function" && (t._entityConfig = { hasSubscribe: !0 });
|
|
584
584
|
const c = e;
|
|
585
|
-
c.cache && (t._entityCache = c.cache),
|
|
585
|
+
c.cache && (t._entityCache = c.cache), Ot.set(e, t);
|
|
586
586
|
}
|
|
587
587
|
return t;
|
|
588
588
|
}
|
|
589
|
-
function
|
|
590
|
-
return
|
|
589
|
+
function He(e) {
|
|
590
|
+
return P(e);
|
|
591
591
|
}
|
|
592
592
|
function Ht(e, t) {
|
|
593
593
|
if (t == null) return;
|
|
594
594
|
const i = /* @__PURE__ */ new Map();
|
|
595
595
|
if (Array.isArray(t))
|
|
596
596
|
for (const n of t) {
|
|
597
|
-
const [s, r] = n, a =
|
|
597
|
+
const [s, r] = n, a = P(s).typenameValue;
|
|
598
598
|
if (a === void 0) continue;
|
|
599
599
|
const c = [];
|
|
600
600
|
for (const [f, l] of Object.entries(r))
|
|
@@ -613,19 +613,19 @@ function Ht(e, t) {
|
|
|
613
613
|
return i.size > 0 ? i : void 0;
|
|
614
614
|
}
|
|
615
615
|
function Jt(e) {
|
|
616
|
-
return Array.isArray(e) ? e.map((t) =>
|
|
616
|
+
return Array.isArray(e) ? e.map((t) => P(t)) : [P(e)];
|
|
617
617
|
}
|
|
618
|
-
function
|
|
619
|
-
const i = Jt(e), n = i.length === 1 ? i[0] :
|
|
620
|
-
return r._liveConfig =
|
|
618
|
+
function Je(e, t) {
|
|
619
|
+
const i = Jt(e), n = i.length === 1 ? i[0] : pt(...i.map((o) => o)), s = d.ARRAY | d.LIVE, r = new _(s, n);
|
|
620
|
+
return r._liveConfig = q.array(
|
|
621
621
|
i,
|
|
622
622
|
Ht(i, t?.constraints),
|
|
623
623
|
t?.sort
|
|
624
624
|
), r;
|
|
625
625
|
}
|
|
626
|
-
function
|
|
626
|
+
function Xe(e, t, i) {
|
|
627
627
|
const n = Jt(t), s = e, r = d.LIVE, o = new _(r, void 0);
|
|
628
|
-
return o._liveConfig =
|
|
628
|
+
return o._liveConfig = q.value(
|
|
629
629
|
n,
|
|
630
630
|
Ht(n, i?.constraints),
|
|
631
631
|
s,
|
|
@@ -634,10 +634,10 @@ function Ze(e, t, i) {
|
|
|
634
634
|
i.onDelete
|
|
635
635
|
), o;
|
|
636
636
|
}
|
|
637
|
-
const
|
|
638
|
-
format:
|
|
639
|
-
typename:
|
|
640
|
-
const:
|
|
637
|
+
const Ze = {
|
|
638
|
+
format: ze,
|
|
639
|
+
typename: Ye,
|
|
640
|
+
const: Ge,
|
|
641
641
|
enum: Bt,
|
|
642
642
|
id: d.ID | d.STRING | d.NUMBER,
|
|
643
643
|
string: d.STRING,
|
|
@@ -645,23 +645,23 @@ const ti = {
|
|
|
645
645
|
boolean: d.BOOLEAN,
|
|
646
646
|
null: d.NULL,
|
|
647
647
|
undefined: d.UNDEFINED,
|
|
648
|
-
array:
|
|
649
|
-
object:
|
|
650
|
-
record:
|
|
651
|
-
union:
|
|
652
|
-
nullish:
|
|
653
|
-
optional:
|
|
654
|
-
nullable:
|
|
655
|
-
result:
|
|
656
|
-
entity:
|
|
657
|
-
liveArray:
|
|
658
|
-
liveValue:
|
|
648
|
+
array: Pe,
|
|
649
|
+
object: qe,
|
|
650
|
+
record: je,
|
|
651
|
+
union: pt,
|
|
652
|
+
nullish: $e,
|
|
653
|
+
optional: Qe,
|
|
654
|
+
nullable: Be,
|
|
655
|
+
result: Le,
|
|
656
|
+
entity: He,
|
|
657
|
+
liveArray: Je,
|
|
658
|
+
liveValue: Xe
|
|
659
659
|
};
|
|
660
|
-
function
|
|
660
|
+
function j(e, t, i) {
|
|
661
661
|
return new TypeError(`Validation error at ${e}`);
|
|
662
662
|
}
|
|
663
663
|
const Xt = Array.isArray;
|
|
664
|
-
function
|
|
664
|
+
function Rt(e) {
|
|
665
665
|
if (e === null) return d.NULL;
|
|
666
666
|
switch (typeof e) {
|
|
667
667
|
case "number":
|
|
@@ -678,39 +678,39 @@ function Ot(e) {
|
|
|
678
678
|
throw new Error(`Invalid type: ${typeof e}`);
|
|
679
679
|
}
|
|
680
680
|
}
|
|
681
|
-
function
|
|
682
|
-
return
|
|
681
|
+
function Mi(e) {
|
|
682
|
+
return T(e);
|
|
683
683
|
}
|
|
684
|
-
function
|
|
684
|
+
function T(e) {
|
|
685
685
|
if (e === null || typeof e != "object")
|
|
686
686
|
return e;
|
|
687
687
|
if (Xt(e))
|
|
688
|
-
return e.map((i) =>
|
|
688
|
+
return e.map((i) => T(i));
|
|
689
689
|
if (e instanceof Date)
|
|
690
690
|
return new Date(e.getTime());
|
|
691
691
|
if (e instanceof Map) {
|
|
692
692
|
const i = /* @__PURE__ */ new Map();
|
|
693
693
|
for (const [n, s] of e)
|
|
694
|
-
i.set(
|
|
694
|
+
i.set(T(n), T(s));
|
|
695
695
|
return i;
|
|
696
696
|
}
|
|
697
697
|
if (e instanceof Set) {
|
|
698
698
|
const i = /* @__PURE__ */ new Set();
|
|
699
699
|
for (const n of e)
|
|
700
|
-
i.add(
|
|
700
|
+
i.add(T(n));
|
|
701
701
|
return i;
|
|
702
702
|
}
|
|
703
703
|
const t = {};
|
|
704
704
|
for (const i of Object.keys(e))
|
|
705
|
-
t[i] =
|
|
705
|
+
t[i] = T(e[i]);
|
|
706
706
|
return t;
|
|
707
707
|
}
|
|
708
|
-
const
|
|
708
|
+
const vt = Object.entries, ti = () => {
|
|
709
709
|
};
|
|
710
|
-
class
|
|
710
|
+
class rt {
|
|
711
711
|
queryClient = void 0;
|
|
712
712
|
preloadedEntities = void 0;
|
|
713
|
-
warn =
|
|
713
|
+
warn = ti;
|
|
714
714
|
/** When true, missing optional fields on existing entities are set to
|
|
715
715
|
* undefined. False for mutation events (truly partial payloads). */
|
|
716
716
|
isPartialEvent = !1;
|
|
@@ -721,16 +721,16 @@ class st {
|
|
|
721
721
|
}
|
|
722
722
|
}
|
|
723
723
|
function Zt(e, t, i) {
|
|
724
|
-
return
|
|
724
|
+
return k(e, t, i, "");
|
|
725
725
|
}
|
|
726
|
-
function
|
|
727
|
-
return
|
|
726
|
+
function ei(e, t, i) {
|
|
727
|
+
return _t(e, t, i);
|
|
728
728
|
}
|
|
729
|
-
function
|
|
729
|
+
function St(e, t, i, n) {
|
|
730
730
|
const s = e >> Yt;
|
|
731
731
|
if ((e & d.IS_EAGER_FORMAT) !== 0)
|
|
732
732
|
try {
|
|
733
|
-
return new
|
|
733
|
+
return new U(t, s, !0);
|
|
734
734
|
} catch (o) {
|
|
735
735
|
if ((e & d.UNDEFINED) !== 0) {
|
|
736
736
|
i.warn("Invalid formatted value for optional type, defaulting to undefined", {
|
|
@@ -742,62 +742,62 @@ function Rt(e, t, i, n) {
|
|
|
742
742
|
}
|
|
743
743
|
throw o;
|
|
744
744
|
}
|
|
745
|
-
return new
|
|
745
|
+
return new U(t, s, !1);
|
|
746
746
|
}
|
|
747
|
-
function
|
|
747
|
+
function k(e, t, i, n) {
|
|
748
748
|
const s = t;
|
|
749
|
-
if (s instanceof
|
|
749
|
+
if (s instanceof J) {
|
|
750
750
|
const c = s.get(e);
|
|
751
|
-
if (c === void 0) throw
|
|
751
|
+
if (c === void 0) throw j(n);
|
|
752
752
|
return c;
|
|
753
753
|
}
|
|
754
754
|
if (s instanceof Set) {
|
|
755
|
-
if (!s.has(e)) throw
|
|
755
|
+
if (!s.has(e)) throw j(n);
|
|
756
756
|
return e;
|
|
757
757
|
}
|
|
758
758
|
if (typeof s == "string") {
|
|
759
759
|
if (e == null) return s;
|
|
760
|
-
if (e !== s) throw
|
|
760
|
+
if (e !== s) throw j(n);
|
|
761
761
|
return e;
|
|
762
762
|
}
|
|
763
763
|
if (typeof s == "number") {
|
|
764
|
-
const c =
|
|
764
|
+
const c = Rt(e);
|
|
765
765
|
if ((s & c) === 0) {
|
|
766
766
|
if ((s & d.UNDEFINED) !== 0) {
|
|
767
767
|
i.warn("Invalid value for optional type, defaulting to undefined", { value: e, path: n });
|
|
768
768
|
return;
|
|
769
769
|
}
|
|
770
|
-
throw
|
|
770
|
+
throw j(n);
|
|
771
771
|
}
|
|
772
|
-
return (s & d.HAS_FORMAT) !== 0 && e !== null && e !== void 0 ?
|
|
772
|
+
return (s & d.HAS_FORMAT) !== 0 && e !== null && e !== void 0 ? St(s, e, i, n) : e;
|
|
773
773
|
}
|
|
774
774
|
const r = s.mask, o = s._liveConfig;
|
|
775
|
-
if (o !== void 0 && o.type ===
|
|
776
|
-
return o.valueType !== void 0 ?
|
|
775
|
+
if (o !== void 0 && o.type === ut.Value)
|
|
776
|
+
return o.valueType !== void 0 ? k(e, o.valueType, i, n) : e;
|
|
777
777
|
if ((r & d.PARSE_RESULT) !== 0)
|
|
778
778
|
try {
|
|
779
|
-
return { success: !0, value:
|
|
779
|
+
return { success: !0, value: k(e, s.shape, i, n) };
|
|
780
780
|
} catch (c) {
|
|
781
781
|
return { success: !1, error: c instanceof Error ? c : new Error(String(c)) };
|
|
782
782
|
}
|
|
783
|
-
const a =
|
|
783
|
+
const a = Rt(e);
|
|
784
784
|
if ((r & a) === 0 && !s.values?.has(e)) {
|
|
785
785
|
if ((r & d.UNDEFINED) !== 0) {
|
|
786
786
|
i.warn("Invalid value for optional type, defaulting to undefined", { value: e, path: n });
|
|
787
787
|
return;
|
|
788
788
|
}
|
|
789
|
-
throw
|
|
789
|
+
throw j(n);
|
|
790
790
|
}
|
|
791
|
-
return a < d.OBJECT ? (r & d.HAS_FORMAT) !== 0 && e !== null && e !== void 0 ?
|
|
791
|
+
return a < d.OBJECT ? (r & d.HAS_FORMAT) !== 0 && e !== null && e !== void 0 ? St(r, e, i, n) : e : (r & d.UNION) !== 0 ? ii(a, e, s, i, n) : a === d.ARRAY ? te(e, s.shape, i, n) : (r & d.RECORD) !== 0 ? ee(e, s.shape, i, n) : (r & d.ENTITY) !== 0 && i.queryClient !== void 0 ? _t(e, s, i) : ie(e, s, i, n);
|
|
792
792
|
}
|
|
793
|
-
function
|
|
793
|
+
function ii(e, t, i, n, s) {
|
|
794
794
|
if (e === d.ARRAY) {
|
|
795
|
-
const r = i.shape[
|
|
795
|
+
const r = i.shape[B];
|
|
796
796
|
return r === void 0 || typeof r == "number" ? t : te(t, r, n, s);
|
|
797
797
|
} else {
|
|
798
798
|
const r = i.typenameField, o = r ? t[r] : void 0;
|
|
799
799
|
if (o === void 0 || typeof o != "string") {
|
|
800
|
-
const c = i.shape[
|
|
800
|
+
const c = i.shape[Y];
|
|
801
801
|
if (c === void 0)
|
|
802
802
|
throw new Error(
|
|
803
803
|
`Typename field '${r}' is required for union discrimination but was not found in the data`
|
|
@@ -807,14 +807,14 @@ function ni(e, t, i, n, s) {
|
|
|
807
807
|
const a = i.shape[o];
|
|
808
808
|
if (a === void 0 || typeof a == "number")
|
|
809
809
|
throw new Error(`Unknown typename '${o}' in union`);
|
|
810
|
-
return a.mask & d.ENTITY && n.queryClient !== void 0 ?
|
|
810
|
+
return a.mask & d.ENTITY && n.queryClient !== void 0 ? _t(t, a, n) : ie(t, a, n, s);
|
|
811
811
|
}
|
|
812
812
|
}
|
|
813
813
|
function te(e, t, i, n) {
|
|
814
814
|
const s = [];
|
|
815
815
|
for (let r = 0; r < e.length; r++)
|
|
816
816
|
try {
|
|
817
|
-
s.push(
|
|
817
|
+
s.push(k(e[r], t, i, `${n}[${r}]`));
|
|
818
818
|
} catch (o) {
|
|
819
819
|
i.warn("Failed to parse array item, filtering out", {
|
|
820
820
|
index: r,
|
|
@@ -825,19 +825,19 @@ function te(e, t, i, n) {
|
|
|
825
825
|
return s;
|
|
826
826
|
}
|
|
827
827
|
function ee(e, t, i, n) {
|
|
828
|
-
for (const [s, r] of
|
|
829
|
-
e[s] =
|
|
828
|
+
for (const [s, r] of vt(e))
|
|
829
|
+
e[s] = k(r, t, i, `${n}["${s}"]`);
|
|
830
830
|
return e;
|
|
831
831
|
}
|
|
832
832
|
function ie(e, t, i, n) {
|
|
833
833
|
if (x.has(e))
|
|
834
834
|
return e;
|
|
835
835
|
const s = t.shape;
|
|
836
|
-
for (const [r, o] of
|
|
837
|
-
e[r] =
|
|
836
|
+
for (const [r, o] of vt(s))
|
|
837
|
+
e[r] = k(e[r], o, i, `${n}.${r}`);
|
|
838
838
|
return e;
|
|
839
839
|
}
|
|
840
|
-
function
|
|
840
|
+
function _t(e, t, i) {
|
|
841
841
|
const n = i.queryClient, s = i.preloadedEntities;
|
|
842
842
|
let r, o;
|
|
843
843
|
if (s !== void 0)
|
|
@@ -867,14 +867,14 @@ function vt(e, t, i) {
|
|
|
867
867
|
};
|
|
868
868
|
i.seen.set(c, u), i.seenByKey.set(r, u);
|
|
869
869
|
const y = `[[${t.typenameValue}:${o}]]`, v = t.shape;
|
|
870
|
-
for (const [p, g] of
|
|
871
|
-
l && !(p in e) || (c[p] =
|
|
870
|
+
for (const [p, g] of vt(v))
|
|
871
|
+
l && !(p in e) || (c[p] = k(e[p], g, i, `${y}.${p}`));
|
|
872
872
|
return c;
|
|
873
873
|
}
|
|
874
|
-
function
|
|
875
|
-
return
|
|
874
|
+
function ni(e, t) {
|
|
875
|
+
return si(e, t.shape, t.typenameField);
|
|
876
876
|
}
|
|
877
|
-
function
|
|
877
|
+
function si(e, t, i) {
|
|
878
878
|
if (t === void 0) return !0;
|
|
879
879
|
for (const n of Object.keys(t)) {
|
|
880
880
|
if (n === i) continue;
|
|
@@ -889,22 +889,22 @@ function ri(e, t, i) {
|
|
|
889
889
|
}
|
|
890
890
|
return !0;
|
|
891
891
|
}
|
|
892
|
-
const
|
|
892
|
+
const ri = Object.prototype, Q = /* @__PURE__ */ new WeakMap();
|
|
893
893
|
function A(e) {
|
|
894
894
|
if (typeof e != "object" || e === null) return e;
|
|
895
|
-
if (
|
|
895
|
+
if (X.has(e)) return A(e.getValue());
|
|
896
896
|
if (x.has(e)) return e;
|
|
897
897
|
if (Array.isArray(e)) {
|
|
898
|
-
let t =
|
|
899
|
-
return t === void 0 && (t = new Proxy(e,
|
|
898
|
+
let t = Q.get(e);
|
|
899
|
+
return t === void 0 && (t = new Proxy(e, oi), Q.set(e, t)), t;
|
|
900
900
|
}
|
|
901
|
-
if (Object.getPrototypeOf(e) ===
|
|
902
|
-
let t =
|
|
903
|
-
return t === void 0 && (t = new Proxy(e,
|
|
901
|
+
if (Object.getPrototypeOf(e) === ri) {
|
|
902
|
+
let t = Q.get(e);
|
|
903
|
+
return t === void 0 && (t = new Proxy(e, ai), Q.set(e, t)), t;
|
|
904
904
|
}
|
|
905
905
|
return e;
|
|
906
906
|
}
|
|
907
|
-
const
|
|
907
|
+
const oi = {
|
|
908
908
|
get(e, t, i) {
|
|
909
909
|
if (typeof t == "string") {
|
|
910
910
|
const n = Number(t);
|
|
@@ -919,7 +919,7 @@ const ai = {
|
|
|
919
919
|
deleteProperty() {
|
|
920
920
|
return !1;
|
|
921
921
|
}
|
|
922
|
-
},
|
|
922
|
+
}, ai = {
|
|
923
923
|
get(e, t, i) {
|
|
924
924
|
return typeof t == "string" ? A(e[t]) : Reflect.get(e, t, i);
|
|
925
925
|
},
|
|
@@ -938,7 +938,7 @@ const ai = {
|
|
|
938
938
|
getOwnPropertyDescriptor(e, t) {
|
|
939
939
|
return Object.getOwnPropertyDescriptor(e, t);
|
|
940
940
|
}
|
|
941
|
-
},
|
|
941
|
+
}, ci = (e, t, i) => {
|
|
942
942
|
const n = e, s = Object.keys(n), r = t !== null && typeof t == "object" && !Array.isArray(t) ? t : void 0;
|
|
943
943
|
let o = !r || Object.keys(r).length !== s.length;
|
|
944
944
|
const a = {};
|
|
@@ -948,13 +948,12 @@ const ai = {
|
|
|
948
948
|
typeof l == "function" ? u = l : u = i(l, r?.[f]), a[f] = u, !o && u !== r?.[f] && (o = !0);
|
|
949
949
|
}
|
|
950
950
|
return o ? a : r;
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
class ui {
|
|
951
|
+
};
|
|
952
|
+
xe(
|
|
953
|
+
ht,
|
|
954
|
+
ci
|
|
955
|
+
);
|
|
956
|
+
class fi {
|
|
958
957
|
_notifier;
|
|
959
958
|
_queryClient;
|
|
960
959
|
_proxies = /* @__PURE__ */ new Map();
|
|
@@ -972,7 +971,7 @@ class ui {
|
|
|
972
971
|
_extraMethods;
|
|
973
972
|
_extraGetters;
|
|
974
973
|
constructor(t, i, n, s, r, o) {
|
|
975
|
-
this._notifier =
|
|
974
|
+
this._notifier = ft(), this._queryClient = o, this.key = t, this.typename = i, this.id = n, this.idField = s, this.data = r, this.entityRefs = void 0;
|
|
976
975
|
}
|
|
977
976
|
retain() {
|
|
978
977
|
this.refCount++;
|
|
@@ -983,7 +982,7 @@ class ui {
|
|
|
983
982
|
if (--this.refCount > 0 || this.refCount < 0)
|
|
984
983
|
return;
|
|
985
984
|
const t = this._entityCache?.gcTime;
|
|
986
|
-
t !== void 0 ? this._queryClient.gcManager.schedule(this.key, t,
|
|
985
|
+
t !== void 0 ? this._queryClient.gcManager.schedule(this.key, t, H.Entity) : this.evict();
|
|
987
986
|
}
|
|
988
987
|
evict() {
|
|
989
988
|
const t = this.liveCollections.slice();
|
|
@@ -1017,13 +1016,13 @@ class ui {
|
|
|
1017
1016
|
getProxy(t) {
|
|
1018
1017
|
const i = t;
|
|
1019
1018
|
let n = this._proxies.get(i);
|
|
1020
|
-
return n === void 0 && (n =
|
|
1019
|
+
return n === void 0 && (n = di(this, this.key, t, this._notifier, this._queryClient), this._proxies.set(i, n)), n;
|
|
1021
1020
|
}
|
|
1022
1021
|
get proxy() {
|
|
1023
1022
|
return this._proxies.values().next().value;
|
|
1024
1023
|
}
|
|
1025
1024
|
satisfiesDef(t) {
|
|
1026
|
-
return this.satisfiedDefs.has(t) ? !0 :
|
|
1025
|
+
return this.satisfiedDefs.has(t) ? !0 : ni(this.data, t) ? (this.satisfiedDefs.add(t), !0) : !1;
|
|
1027
1026
|
}
|
|
1028
1027
|
save() {
|
|
1029
1028
|
this._queryClient.entityMap.save(this);
|
|
@@ -1035,7 +1034,7 @@ class ui {
|
|
|
1035
1034
|
this._notifier.consume();
|
|
1036
1035
|
}
|
|
1037
1036
|
}
|
|
1038
|
-
function
|
|
1037
|
+
function ui(e, t, i) {
|
|
1039
1038
|
const n = [];
|
|
1040
1039
|
for (const s of e) {
|
|
1041
1040
|
if (typeof s != "object" || s === null) continue;
|
|
@@ -1046,33 +1045,33 @@ function di(e, t, i) {
|
|
|
1046
1045
|
}
|
|
1047
1046
|
return n;
|
|
1048
1047
|
}
|
|
1049
|
-
function
|
|
1050
|
-
const r = i.shape ?? {}, o = i, a = o._methods, c = o._entityClass, f = o._entityConfig, l = c ? c.prototype :
|
|
1051
|
-
|
|
1048
|
+
function di(e, t, i, n, s) {
|
|
1049
|
+
const r = i.shape ?? {}, o = i, a = o._methods, c = o._entityClass, f = o._entityConfig, l = c ? c.prototype : ht.prototype;
|
|
1050
|
+
i.typenameField;
|
|
1052
1051
|
const u = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), v = () => ({ __entityRef: t });
|
|
1053
1052
|
let p;
|
|
1054
1053
|
f?.hasSubscribe && a && "__subscribe" in a && (p = kt((E) => {
|
|
1055
|
-
const h = (
|
|
1056
|
-
|
|
1057
|
-
},
|
|
1058
|
-
return E.value = g,
|
|
1054
|
+
const h = (w) => {
|
|
1055
|
+
w.__eventSource = t, s.applyMutationEvent(w);
|
|
1056
|
+
}, b = a.__subscribe.call(g, h);
|
|
1057
|
+
return E.value = g, b;
|
|
1059
1058
|
}));
|
|
1060
1059
|
let g;
|
|
1061
|
-
const
|
|
1062
|
-
if (
|
|
1060
|
+
const m = Object.keys(r);
|
|
1061
|
+
if (m.includes("__typename") || m.push("__typename"), a)
|
|
1063
1062
|
for (const E of Object.keys(a))
|
|
1064
|
-
|
|
1065
|
-
let I, O =
|
|
1066
|
-
function
|
|
1063
|
+
m.includes(E) || m.push(E);
|
|
1064
|
+
let I, O = m;
|
|
1065
|
+
function $() {
|
|
1067
1066
|
const E = e._extraMethods;
|
|
1068
1067
|
if (E !== I) {
|
|
1069
|
-
if (I = E, O =
|
|
1070
|
-
for (const
|
|
1071
|
-
O.includes(
|
|
1068
|
+
if (I = E, O = m.slice(), E !== void 0)
|
|
1069
|
+
for (const b of Object.keys(E))
|
|
1070
|
+
O.includes(b) || O.push(b);
|
|
1072
1071
|
const h = e._extraGetters;
|
|
1073
1072
|
if (h !== void 0)
|
|
1074
|
-
for (const
|
|
1075
|
-
O.includes(
|
|
1073
|
+
for (const b of Object.keys(h))
|
|
1074
|
+
O.includes(b) || O.push(b);
|
|
1076
1075
|
}
|
|
1077
1076
|
return O;
|
|
1078
1077
|
}
|
|
@@ -1080,15 +1079,15 @@ function li(e, t, i, n, s) {
|
|
|
1080
1079
|
getPrototypeOf() {
|
|
1081
1080
|
return l;
|
|
1082
1081
|
},
|
|
1083
|
-
get(E, h) {
|
|
1084
|
-
if (typeof h == "symbol") return;
|
|
1082
|
+
get(E, h, b) {
|
|
1083
|
+
if (typeof h == "symbol") return Reflect.get(l, h, b);
|
|
1085
1084
|
if (h === "toJSON") return v;
|
|
1086
1085
|
if (h === "__context") return s.getContext();
|
|
1087
1086
|
if (h === "__typename") return e.typename;
|
|
1088
1087
|
if (p?.value, n.consume(), typeof h == "string") {
|
|
1089
|
-
const
|
|
1090
|
-
if (
|
|
1091
|
-
return
|
|
1088
|
+
const N = e._extraGetters;
|
|
1089
|
+
if (N !== void 0 && h in N)
|
|
1090
|
+
return N[h]();
|
|
1092
1091
|
const S = e._extraMethods;
|
|
1093
1092
|
if (S !== void 0 && h in S) {
|
|
1094
1093
|
let C = u.get(h);
|
|
@@ -1096,33 +1095,33 @@ function li(e, t, i, n, s) {
|
|
|
1096
1095
|
}
|
|
1097
1096
|
if (a && h in a) {
|
|
1098
1097
|
let C = u.get(h);
|
|
1099
|
-
return C || (C =
|
|
1098
|
+
return C || (C = ve(g, a[h].bind(g)), u.set(h, C)), C;
|
|
1100
1099
|
}
|
|
1101
1100
|
}
|
|
1102
|
-
const
|
|
1103
|
-
if (typeof
|
|
1104
|
-
return A(
|
|
1105
|
-
if (Array.isArray(
|
|
1106
|
-
const
|
|
1107
|
-
if (
|
|
1108
|
-
const S =
|
|
1101
|
+
const w = e.data[h];
|
|
1102
|
+
if (typeof w == "object" && w !== null && X.has(w))
|
|
1103
|
+
return A(w.getValue());
|
|
1104
|
+
if (Array.isArray(w) && typeof h == "string") {
|
|
1105
|
+
const N = r[h];
|
|
1106
|
+
if (N instanceof _ && (N.mask & d.ARRAY) !== 0) {
|
|
1107
|
+
const S = N.shape;
|
|
1109
1108
|
if (S instanceof _ && (S.mask & d.ENTITY) !== 0) {
|
|
1110
1109
|
const C = S.typenameValue;
|
|
1111
1110
|
if (C !== void 0) {
|
|
1112
|
-
const
|
|
1113
|
-
if (
|
|
1114
|
-
const
|
|
1115
|
-
if (
|
|
1116
|
-
return A(
|
|
1117
|
-
const
|
|
1118
|
-
return y.set(h, { source:
|
|
1111
|
+
const Et = s.getEntityDefsForTypename(C);
|
|
1112
|
+
if (Et !== void 0 && Et.length > 1) {
|
|
1113
|
+
const Z = y.get(h);
|
|
1114
|
+
if (Z !== void 0 && Z.source === w)
|
|
1115
|
+
return A(Z.filtered);
|
|
1116
|
+
const bt = ui(w, S, s);
|
|
1117
|
+
return y.set(h, { source: w, filtered: bt }), A(bt);
|
|
1119
1118
|
}
|
|
1120
1119
|
}
|
|
1121
1120
|
}
|
|
1122
1121
|
}
|
|
1123
|
-
return A(
|
|
1122
|
+
return A(w);
|
|
1124
1123
|
}
|
|
1125
|
-
return A(
|
|
1124
|
+
return A(w);
|
|
1126
1125
|
},
|
|
1127
1126
|
set() {
|
|
1128
1127
|
return !1;
|
|
@@ -1130,15 +1129,15 @@ function li(e, t, i, n, s) {
|
|
|
1130
1129
|
has(E, h) {
|
|
1131
1130
|
if (h === "__typename") return !0;
|
|
1132
1131
|
if (typeof h == "string") {
|
|
1133
|
-
const
|
|
1134
|
-
if (
|
|
1135
|
-
const
|
|
1136
|
-
if (
|
|
1132
|
+
const b = e._extraGetters;
|
|
1133
|
+
if (b && h in b) return !0;
|
|
1134
|
+
const w = e._extraMethods;
|
|
1135
|
+
if (w && h in w || a && h in a) return !0;
|
|
1137
1136
|
}
|
|
1138
1137
|
return h in r;
|
|
1139
1138
|
},
|
|
1140
1139
|
ownKeys() {
|
|
1141
|
-
return
|
|
1140
|
+
return $();
|
|
1142
1141
|
},
|
|
1143
1142
|
getOwnPropertyDescriptor(E, h) {
|
|
1144
1143
|
if (h === "__typename")
|
|
@@ -1146,20 +1145,20 @@ function li(e, t, i, n, s) {
|
|
|
1146
1145
|
if (h in r)
|
|
1147
1146
|
return { enumerable: !0, configurable: !0, value: R.get(E, h, g), writable: !1 };
|
|
1148
1147
|
if (typeof h == "string") {
|
|
1149
|
-
const
|
|
1150
|
-
if (m && h in m)
|
|
1151
|
-
return { enumerable: !0, configurable: !0, value: R.get(E, h, g), writable: !1 };
|
|
1152
|
-
const b = e._extraMethods;
|
|
1148
|
+
const b = e._extraGetters;
|
|
1153
1149
|
if (b && h in b)
|
|
1154
1150
|
return { enumerable: !0, configurable: !0, value: R.get(E, h, g), writable: !1 };
|
|
1151
|
+
const w = e._extraMethods;
|
|
1152
|
+
if (w && h in w)
|
|
1153
|
+
return { enumerable: !0, configurable: !0, value: R.get(E, h, g), writable: !1 };
|
|
1155
1154
|
if (a && h in a)
|
|
1156
1155
|
return { enumerable: !1, configurable: !0, value: R.get(E, h, g), writable: !1 };
|
|
1157
1156
|
}
|
|
1158
1157
|
}
|
|
1159
1158
|
};
|
|
1160
|
-
return g = new Proxy({}, R), x.set(g, t),
|
|
1159
|
+
return g = new Proxy({}, R), x.set(g, t), ge(g, s), g;
|
|
1161
1160
|
}
|
|
1162
|
-
class
|
|
1161
|
+
class li {
|
|
1163
1162
|
instances = /* @__PURE__ */ new Map();
|
|
1164
1163
|
persistEntity;
|
|
1165
1164
|
constructor(t) {
|
|
@@ -1181,7 +1180,7 @@ class hi {
|
|
|
1181
1180
|
if (typeof a != "string" && typeof a != "number")
|
|
1182
1181
|
throw new Error(`Entity id must be string or number: ${n.typenameValue}`);
|
|
1183
1182
|
const c = n;
|
|
1184
|
-
r = new
|
|
1183
|
+
r = new fi(t, n.typenameValue, a, o, i, s), r._entityCache = c._entityCache, this.instances.set(t, r);
|
|
1185
1184
|
}
|
|
1186
1185
|
return r.parseId = s.currentParseId, r;
|
|
1187
1186
|
}
|
|
@@ -1197,7 +1196,7 @@ class hi {
|
|
|
1197
1196
|
this.persistEntity(t.key, t.data, i);
|
|
1198
1197
|
}
|
|
1199
1198
|
}
|
|
1200
|
-
class
|
|
1199
|
+
class ne {
|
|
1201
1200
|
onlineSignal;
|
|
1202
1201
|
manualOverride = void 0;
|
|
1203
1202
|
eventListenersAttached = !1;
|
|
@@ -1261,7 +1260,7 @@ class se {
|
|
|
1261
1260
|
}, window.addEventListener("online", this.handleOnline), window.addEventListener("offline", this.handleOffline), this.eventListenersAttached = !0);
|
|
1262
1261
|
}
|
|
1263
1262
|
}
|
|
1264
|
-
class
|
|
1263
|
+
class se {
|
|
1265
1264
|
static onlineSignal = Ft(!0);
|
|
1266
1265
|
get isOnline() {
|
|
1267
1266
|
return !0;
|
|
@@ -1271,19 +1270,19 @@ class re {
|
|
|
1271
1270
|
clearManualOverride() {
|
|
1272
1271
|
}
|
|
1273
1272
|
getOnlineSignal() {
|
|
1274
|
-
return
|
|
1273
|
+
return se.onlineSignal;
|
|
1275
1274
|
}
|
|
1276
1275
|
destroy() {
|
|
1277
1276
|
}
|
|
1278
1277
|
}
|
|
1279
|
-
const
|
|
1280
|
-
function
|
|
1278
|
+
const hi = new ne(), ki = Tt(hi);
|
|
1279
|
+
function mt(e, t = typeof window > "u") {
|
|
1281
1280
|
let i;
|
|
1282
1281
|
e === !1 ? i = 0 : e === void 0 || e === !0 ? i = t ? 0 : 3 : typeof e == "number" ? i = e : i = e.retries;
|
|
1283
1282
|
const n = typeof e == "object" && e.retryDelay ? e.retryDelay : (s) => 1e3 * Math.pow(2, s);
|
|
1284
1283
|
return { retries: i, retryDelay: n };
|
|
1285
1284
|
}
|
|
1286
|
-
class
|
|
1285
|
+
class Fi {
|
|
1287
1286
|
static cache;
|
|
1288
1287
|
/**
|
|
1289
1288
|
* The adapter class responsible for sending requests for this query type.
|
|
@@ -1297,23 +1296,23 @@ class Ti {
|
|
|
1297
1296
|
}
|
|
1298
1297
|
}
|
|
1299
1298
|
const At = /* @__PURE__ */ new WeakMap();
|
|
1300
|
-
class
|
|
1299
|
+
class K {
|
|
1301
1300
|
constructor(t, i) {
|
|
1302
1301
|
this.captured = i, this.statics = t;
|
|
1303
1302
|
}
|
|
1304
1303
|
statics;
|
|
1305
1304
|
createExecutionContext(t, i) {
|
|
1306
|
-
return
|
|
1305
|
+
return it(this.captured, t, i);
|
|
1307
1306
|
}
|
|
1308
1307
|
resolveOptions(t) {
|
|
1309
|
-
const { methods: i } = this.captured, n = i.getConfig ? i.getConfig.call(t) : t.config, s =
|
|
1308
|
+
const { methods: i } = this.captured, n = i.getConfig ? i.getConfig.call(t) : t.config, s = mt(n?.retry);
|
|
1310
1309
|
return { config: n, retryConfig: s };
|
|
1311
1310
|
}
|
|
1312
1311
|
static for(t) {
|
|
1313
1312
|
let i = At.get(t);
|
|
1314
1313
|
if (i !== void 0)
|
|
1315
1314
|
return i;
|
|
1316
|
-
const n = new t(), s =
|
|
1315
|
+
const n = new t(), s = Me(n), r = String(s.methods.getIdentityKey.call(s.fields)), o = s.fields.result, a = o instanceof _ ? o : Ze.object(o), c = (a.mask & d.ENTITY) !== 0, f = t.cache, l = s.fields.fetchNext, u = t.adapter;
|
|
1317
1316
|
if (!u)
|
|
1318
1317
|
throw new Error(
|
|
1319
1318
|
`Query class "${t.name}" must define a static \`adapter\` property. Extend RESTQuery (from fetchium/rest) or set \`static adapter = MyAdapter\` on your query class.`
|
|
@@ -1328,62 +1327,62 @@ class V {
|
|
|
1328
1327
|
jt
|
|
1329
1328
|
// idField — symbol, injected onto payload before parse
|
|
1330
1329
|
);
|
|
1331
|
-
return i = new
|
|
1330
|
+
return i = new K(
|
|
1332
1331
|
{ id: r, shape: v, cache: f, rawFetchNext: l, hasSendNext: y, isEntityResult: c, adapterClass: u },
|
|
1333
1332
|
s
|
|
1334
1333
|
), At.set(t, i), i;
|
|
1335
1334
|
}
|
|
1336
1335
|
}
|
|
1337
|
-
const
|
|
1338
|
-
const i =
|
|
1339
|
-
return
|
|
1336
|
+
const Ti = (e, t) => {
|
|
1337
|
+
const i = K.for(e);
|
|
1338
|
+
return wt(i, t);
|
|
1340
1339
|
};
|
|
1341
|
-
function
|
|
1342
|
-
const i =
|
|
1340
|
+
function Pi(e, ...t) {
|
|
1341
|
+
const i = K.for(e), n = _e(Ri);
|
|
1343
1342
|
if (n === void 0)
|
|
1344
1343
|
throw new Error("QueryClient not found");
|
|
1345
1344
|
const s = t[0];
|
|
1346
1345
|
return n.getQuery(i, s);
|
|
1347
1346
|
}
|
|
1348
|
-
function
|
|
1347
|
+
function ot(e) {
|
|
1349
1348
|
if (e.reason !== void 0) return e.reason;
|
|
1350
1349
|
if (typeof DOMException < "u")
|
|
1351
1350
|
return new DOMException("The operation was aborted", "AbortError");
|
|
1352
1351
|
const t = new Error("The operation was aborted");
|
|
1353
1352
|
return t.name = "AbortError", t;
|
|
1354
1353
|
}
|
|
1355
|
-
function
|
|
1354
|
+
function re(e, t) {
|
|
1356
1355
|
return new Promise((i, n) => {
|
|
1357
1356
|
if (t?.aborted) {
|
|
1358
|
-
n(
|
|
1357
|
+
n(ot(t));
|
|
1359
1358
|
return;
|
|
1360
1359
|
}
|
|
1361
1360
|
const s = setTimeout(i, e);
|
|
1362
1361
|
t?.addEventListener(
|
|
1363
1362
|
"abort",
|
|
1364
1363
|
() => {
|
|
1365
|
-
clearTimeout(s), n(
|
|
1364
|
+
clearTimeout(s), n(ot(t));
|
|
1366
1365
|
},
|
|
1367
1366
|
{ once: !0 }
|
|
1368
1367
|
);
|
|
1369
1368
|
});
|
|
1370
1369
|
}
|
|
1371
|
-
async function
|
|
1370
|
+
async function at(e, t, i) {
|
|
1372
1371
|
const n = Math.max(0, t.retries);
|
|
1373
1372
|
let s;
|
|
1374
1373
|
for (let r = 0; r <= n; r++) {
|
|
1375
1374
|
if (i?.aborted)
|
|
1376
|
-
throw
|
|
1375
|
+
throw ot(i);
|
|
1377
1376
|
try {
|
|
1378
1377
|
return await e();
|
|
1379
1378
|
} catch (o) {
|
|
1380
1379
|
if (s = o, r >= n) throw o;
|
|
1381
|
-
await
|
|
1380
|
+
await re(t.retryDelay(r), i);
|
|
1382
1381
|
}
|
|
1383
1382
|
}
|
|
1384
1383
|
throw s;
|
|
1385
1384
|
}
|
|
1386
|
-
class
|
|
1385
|
+
class yi {
|
|
1387
1386
|
def;
|
|
1388
1387
|
queryKey;
|
|
1389
1388
|
storageKey = -1;
|
|
@@ -1401,7 +1400,7 @@ class pi {
|
|
|
1401
1400
|
debounceTimer = void 0;
|
|
1402
1401
|
/** Resolved per-instance options (depend on actual params). */
|
|
1403
1402
|
config = void 0;
|
|
1404
|
-
retryConfig =
|
|
1403
|
+
retryConfig = mt(void 0);
|
|
1405
1404
|
/** Cancels in-flight fetches and retry waits. */
|
|
1406
1405
|
_abortController = void 0;
|
|
1407
1406
|
/** Cached execution context, recreated only when storageKey (params) changes. */
|
|
@@ -1429,7 +1428,7 @@ class pi {
|
|
|
1429
1428
|
const a = () => {
|
|
1430
1429
|
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;
|
|
1431
1430
|
const f = this.config?.gcTime ?? Pt;
|
|
1432
|
-
this.queryClient.gcManager.schedule(this.queryKey, f,
|
|
1431
|
+
this.queryClient.gcManager.schedule(this.queryKey, f, H.Query);
|
|
1433
1432
|
}, c = (f = !1) => {
|
|
1434
1433
|
const { wasPaused: l, isPaused: u, initialized: y } = this;
|
|
1435
1434
|
if (this.wasPaused = u, u && !l && y) {
|
|
@@ -1437,7 +1436,7 @@ class pi {
|
|
|
1437
1436
|
return;
|
|
1438
1437
|
}
|
|
1439
1438
|
this._isActive = !0;
|
|
1440
|
-
const v = Mt(this.params), p =
|
|
1439
|
+
const v = Mt(this.params), p = wt(this.def, v), g = p !== this.storageKey;
|
|
1441
1440
|
g && (this.currentParams = v, 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()) : g && (this.setupSubscription(), this.runDebounced()) : (this.queryClient.activateQuery(this), this.initialize());
|
|
1442
1441
|
};
|
|
1443
1442
|
return c(!0), {
|
|
@@ -1487,7 +1486,7 @@ class pi {
|
|
|
1487
1486
|
if (!this.isPaused)
|
|
1488
1487
|
try {
|
|
1489
1488
|
if (n !== void 0 && this.setupSubscription(), n === void 0 || this.isStale) {
|
|
1490
|
-
if (await
|
|
1489
|
+
if (await re(0), this.isPaused) return;
|
|
1491
1490
|
this.runQueryImmediately();
|
|
1492
1491
|
}
|
|
1493
1492
|
} catch (s) {
|
|
@@ -1518,7 +1517,7 @@ class pi {
|
|
|
1518
1517
|
if (this.isPaused)
|
|
1519
1518
|
throw new Error("Query is paused due to network status");
|
|
1520
1519
|
const i = this.getOrCreateExecutionContext(), n = this.queryClient.getAdapter(t.statics.adapterClass), s = this._abortController?.signal ?? new AbortController().signal;
|
|
1521
|
-
return
|
|
1520
|
+
return at(
|
|
1522
1521
|
async () => {
|
|
1523
1522
|
const r = await n.send(i, s);
|
|
1524
1523
|
this.updatedAt = Date.now();
|
|
@@ -1574,7 +1573,7 @@ class pi {
|
|
|
1574
1573
|
const i = this._fetchNextAbort.signal, n = this.getOrCreateExecutionContext();
|
|
1575
1574
|
n.resultData = this.rootEntity.data;
|
|
1576
1575
|
const s = this.queryClient.getAdapter(t.statics.adapterClass);
|
|
1577
|
-
return
|
|
1576
|
+
return at(
|
|
1578
1577
|
async () => {
|
|
1579
1578
|
const r = await s.sendNext(n, i);
|
|
1580
1579
|
this.updatedAt = Date.now();
|
|
@@ -1595,21 +1594,21 @@ class pi {
|
|
|
1595
1594
|
return Date.now() - this.updatedAt >= t;
|
|
1596
1595
|
}
|
|
1597
1596
|
get isPaused() {
|
|
1598
|
-
const t = this.config?.networkMode ??
|
|
1599
|
-
if (t ===
|
|
1597
|
+
const t = this.config?.networkMode ?? L.Online;
|
|
1598
|
+
if (t === L.Always)
|
|
1600
1599
|
return !1;
|
|
1601
1600
|
const i = this.queryClient.networkManager.getOnlineSignal().value;
|
|
1602
1601
|
switch (t) {
|
|
1603
|
-
case
|
|
1602
|
+
case L.Online:
|
|
1604
1603
|
return !i;
|
|
1605
|
-
case
|
|
1604
|
+
case L.OfflineFirst:
|
|
1606
1605
|
return !i && this.updatedAt === void 0;
|
|
1607
1606
|
default:
|
|
1608
1607
|
return !1;
|
|
1609
1608
|
}
|
|
1610
1609
|
}
|
|
1611
1610
|
}
|
|
1612
|
-
class
|
|
1611
|
+
class pi {
|
|
1613
1612
|
def;
|
|
1614
1613
|
queryClient;
|
|
1615
1614
|
_inFlight = !1;
|
|
@@ -1618,7 +1617,7 @@ class gi {
|
|
|
1618
1617
|
this.def = t, this.queryClient = i, this.task = this.createTask();
|
|
1619
1618
|
}
|
|
1620
1619
|
createTask() {
|
|
1621
|
-
return
|
|
1620
|
+
return me(
|
|
1622
1621
|
async (t) => {
|
|
1623
1622
|
if (this._inFlight)
|
|
1624
1623
|
throw new Error("A mutation is already in progress. Await the previous call before starting a new one.");
|
|
@@ -1638,7 +1637,7 @@ class gi {
|
|
|
1638
1637
|
if (!(i instanceof _))
|
|
1639
1638
|
return t;
|
|
1640
1639
|
const n = this.queryClient.getContext().log?.warn ?? (() => {
|
|
1641
|
-
}), s = new
|
|
1640
|
+
}), s = new rt();
|
|
1642
1641
|
return s.reset(void 0, void 0, n), Zt(t, i, s);
|
|
1643
1642
|
}
|
|
1644
1643
|
// ======================================================
|
|
@@ -1647,7 +1646,7 @@ class gi {
|
|
|
1647
1646
|
processEffects(t, i) {
|
|
1648
1647
|
let n;
|
|
1649
1648
|
if (this.def.hasGetEffects) {
|
|
1650
|
-
const r =
|
|
1649
|
+
const r = it(
|
|
1651
1650
|
this.def.captured,
|
|
1652
1651
|
t ?? {},
|
|
1653
1652
|
this.queryClient.getContext()
|
|
@@ -1655,23 +1654,23 @@ class gi {
|
|
|
1655
1654
|
r.result = i, n = r.getEffects();
|
|
1656
1655
|
} else if (this.def.effects !== void 0) {
|
|
1657
1656
|
const r = { params: t, result: i };
|
|
1658
|
-
n =
|
|
1657
|
+
n = z(this.def.effects, r);
|
|
1659
1658
|
}
|
|
1660
1659
|
if (n === void 0) return;
|
|
1661
1660
|
const s = this.queryClient;
|
|
1662
|
-
|
|
1661
|
+
tt(n.creates, "create", s), tt(n.updates, "update", s), tt(n.deletes, "delete", s), n.invalidates && s.invalidateQueries(n.invalidates);
|
|
1663
1662
|
}
|
|
1664
1663
|
// ======================================================
|
|
1665
1664
|
// Retry logic
|
|
1666
1665
|
// ======================================================
|
|
1667
1666
|
executeWithRetry(t) {
|
|
1668
|
-
const i =
|
|
1667
|
+
const i = mt(this.def.config?.retry, !0), n = this.queryClient.getAdapter(this.def.adapterClass);
|
|
1669
1668
|
if (!n.sendMutation)
|
|
1670
1669
|
throw new Error(
|
|
1671
1670
|
`Adapter "${this.def.adapterClass.name}" does not implement sendMutation(). Add a sendMutation() method to handle mutations.`
|
|
1672
1671
|
);
|
|
1673
|
-
return
|
|
1674
|
-
const s = new AbortController(), r =
|
|
1672
|
+
return at(async () => {
|
|
1673
|
+
const s = new AbortController(), r = it(
|
|
1675
1674
|
this.def.captured,
|
|
1676
1675
|
t ?? {},
|
|
1677
1676
|
this.queryClient.getContext()
|
|
@@ -1680,24 +1679,24 @@ class gi {
|
|
|
1680
1679
|
}, i);
|
|
1681
1680
|
}
|
|
1682
1681
|
}
|
|
1683
|
-
function
|
|
1684
|
-
return typeof e == "string" ? e :
|
|
1682
|
+
function gi(e) {
|
|
1683
|
+
return typeof e == "string" ? e : P(e).typenameValue;
|
|
1685
1684
|
}
|
|
1686
|
-
function
|
|
1685
|
+
function tt(e, t, i) {
|
|
1687
1686
|
if (e)
|
|
1688
1687
|
for (const [n, s] of e) {
|
|
1689
|
-
const r =
|
|
1688
|
+
const r = gi(n);
|
|
1690
1689
|
r !== void 0 && i.applyMutationEvent({ type: t, typename: r, data: s });
|
|
1691
1690
|
}
|
|
1692
1691
|
}
|
|
1693
|
-
const
|
|
1694
|
-
function
|
|
1692
|
+
const oe = "__eventSource";
|
|
1693
|
+
function ae(e) {
|
|
1695
1694
|
return { field: e, segments: e.indexOf(".") !== -1 ? e.split(".") : void 0 };
|
|
1696
1695
|
}
|
|
1697
|
-
function
|
|
1698
|
-
return e.map(
|
|
1696
|
+
function vi(e) {
|
|
1697
|
+
return e.map(ae);
|
|
1699
1698
|
}
|
|
1700
|
-
function
|
|
1699
|
+
function _i(e, t) {
|
|
1701
1700
|
if (t.segments === void 0) return e[t.field];
|
|
1702
1701
|
let i = e;
|
|
1703
1702
|
for (const n of t.segments) {
|
|
@@ -1706,16 +1705,16 @@ function mi(e, t) {
|
|
|
1706
1705
|
}
|
|
1707
1706
|
return i;
|
|
1708
1707
|
}
|
|
1709
|
-
function
|
|
1708
|
+
function ce(e, t) {
|
|
1710
1709
|
const i = [];
|
|
1711
1710
|
for (let n = 0; n < t.length; n++) {
|
|
1712
|
-
const s = t[n], r =
|
|
1711
|
+
const s = t[n], r = _i(e, s);
|
|
1713
1712
|
if (r === void 0) return;
|
|
1714
1713
|
i.push(s.field, r);
|
|
1715
1714
|
}
|
|
1716
1715
|
return D(i);
|
|
1717
1716
|
}
|
|
1718
|
-
function
|
|
1717
|
+
function mi(e, t) {
|
|
1719
1718
|
if (e === void 0) return;
|
|
1720
1719
|
const i = /* @__PURE__ */ new Map();
|
|
1721
1720
|
for (const [n, s] of e) {
|
|
@@ -1725,7 +1724,7 @@ function wi(e, t) {
|
|
|
1725
1724
|
let l;
|
|
1726
1725
|
if (qt(f)) {
|
|
1727
1726
|
const u = Ut(f);
|
|
1728
|
-
l =
|
|
1727
|
+
l = lt(u, t);
|
|
1729
1728
|
} else
|
|
1730
1729
|
l = f;
|
|
1731
1730
|
if (l === void 0) {
|
|
@@ -1743,12 +1742,12 @@ function Dt(e, t) {
|
|
|
1743
1742
|
if (i !== void 0)
|
|
1744
1743
|
return i.map(([n]) => n).sort();
|
|
1745
1744
|
}
|
|
1746
|
-
class
|
|
1745
|
+
class wi {
|
|
1747
1746
|
fields;
|
|
1748
1747
|
fieldPaths;
|
|
1749
1748
|
_bindings = /* @__PURE__ */ new Map();
|
|
1750
1749
|
constructor(t) {
|
|
1751
|
-
this.fields = t, this.fieldPaths = t.map(
|
|
1750
|
+
this.fields = t, this.fieldPaths = t.map(ae);
|
|
1752
1751
|
}
|
|
1753
1752
|
register(t, i) {
|
|
1754
1753
|
let n = this._bindings.get(t);
|
|
@@ -1768,12 +1767,12 @@ class Ei {
|
|
|
1768
1767
|
function It(e) {
|
|
1769
1768
|
return D(e);
|
|
1770
1769
|
}
|
|
1771
|
-
class
|
|
1770
|
+
class Ei {
|
|
1772
1771
|
_groups = /* @__PURE__ */ new Map();
|
|
1773
1772
|
getOrCreateGroup(t) {
|
|
1774
1773
|
const i = It(t);
|
|
1775
1774
|
let n = this._groups.get(i);
|
|
1776
|
-
return n === void 0 && (n = new
|
|
1775
|
+
return n === void 0 && (n = new wi(t), this._groups.set(i, n)), n;
|
|
1777
1776
|
}
|
|
1778
1777
|
register(t, i, n) {
|
|
1779
1778
|
this.getOrCreateGroup(i).register(t, n);
|
|
@@ -1796,7 +1795,7 @@ class bi {
|
|
|
1796
1795
|
}
|
|
1797
1796
|
routeEvent(t, i, n, s, r, o) {
|
|
1798
1797
|
for (const a of this._groups.values()) {
|
|
1799
|
-
const c =
|
|
1798
|
+
const c = ce(i, a.fieldPaths);
|
|
1800
1799
|
if (c === void 0) continue;
|
|
1801
1800
|
const f = a.getMatching(c);
|
|
1802
1801
|
if (f !== void 0)
|
|
@@ -1809,12 +1808,12 @@ function Nt(e) {
|
|
|
1809
1808
|
const t = /* @__PURE__ */ new Set();
|
|
1810
1809
|
for (const i of e)
|
|
1811
1810
|
if (typeof i == "object" && i !== null) {
|
|
1812
|
-
const n =
|
|
1811
|
+
const n = F(i);
|
|
1813
1812
|
n !== void 0 && t.add(n);
|
|
1814
1813
|
}
|
|
1815
1814
|
return t;
|
|
1816
1815
|
}
|
|
1817
|
-
class
|
|
1816
|
+
class fe {
|
|
1818
1817
|
_queryClient;
|
|
1819
1818
|
_parent;
|
|
1820
1819
|
_constraintHashes;
|
|
@@ -1825,7 +1824,7 @@ class ue {
|
|
|
1825
1824
|
this._queryClient = n, this._parent = s, this._constraintHashes = r, this._constraintFieldRefs = i, this.instance = o, this._entityDefsByTypename = /* @__PURE__ */ new Map();
|
|
1826
1825
|
for (const a of t)
|
|
1827
1826
|
a.typenameValue !== void 0 && this._entityDefsByTypename.set(a.typenameValue, a);
|
|
1828
|
-
|
|
1827
|
+
X.add(this);
|
|
1829
1828
|
}
|
|
1830
1829
|
getValue() {
|
|
1831
1830
|
return this.instance.getValue();
|
|
@@ -1864,7 +1863,7 @@ class ue {
|
|
|
1864
1863
|
i !== -1 && t.splice(i, 1);
|
|
1865
1864
|
}
|
|
1866
1865
|
}
|
|
1867
|
-
class
|
|
1866
|
+
class bi {
|
|
1868
1867
|
_notifier;
|
|
1869
1868
|
_items;
|
|
1870
1869
|
_keys;
|
|
@@ -1872,9 +1871,9 @@ class Ci {
|
|
|
1872
1871
|
_queryClient;
|
|
1873
1872
|
_parent;
|
|
1874
1873
|
constructor(t, i, n, s, r, o) {
|
|
1875
|
-
this._notifier =
|
|
1874
|
+
this._notifier = ft(), this._items = n, this._keys = Nt(n), this._queryClient = t, this._parent = i;
|
|
1876
1875
|
const a = s !== void 0 && r !== void 0, c = o !== void 0;
|
|
1877
|
-
(a || c) && (this._outputSignal =
|
|
1876
|
+
(a || c) && (this._outputSignal = we(() => {
|
|
1878
1877
|
this._notifier.consume();
|
|
1879
1878
|
let f = this._items;
|
|
1880
1879
|
if (a) {
|
|
@@ -1884,7 +1883,7 @@ class Ci {
|
|
|
1884
1883
|
l.push(u);
|
|
1885
1884
|
continue;
|
|
1886
1885
|
}
|
|
1887
|
-
const y =
|
|
1886
|
+
const y = F(u);
|
|
1888
1887
|
if (y === void 0) {
|
|
1889
1888
|
l.push(u);
|
|
1890
1889
|
continue;
|
|
@@ -1894,7 +1893,7 @@ class Ci {
|
|
|
1894
1893
|
l.push(u);
|
|
1895
1894
|
continue;
|
|
1896
1895
|
}
|
|
1897
|
-
v.consume(),
|
|
1896
|
+
v.consume(), ce(v.data, s) === r && l.push(u);
|
|
1898
1897
|
}
|
|
1899
1898
|
f = l;
|
|
1900
1899
|
}
|
|
@@ -1942,7 +1941,7 @@ class Ci {
|
|
|
1942
1941
|
this._items = n, this._keys = Nt(n);
|
|
1943
1942
|
for (const s of n)
|
|
1944
1943
|
if (typeof s == "object" && s !== null) {
|
|
1945
|
-
const r =
|
|
1944
|
+
const r = F(s);
|
|
1946
1945
|
if (r !== void 0) {
|
|
1947
1946
|
const o = this._queryClient.entityMap.getEntity(r);
|
|
1948
1947
|
o !== void 0 && this._parent.addChildRef(o);
|
|
@@ -1950,7 +1949,7 @@ class Ci {
|
|
|
1950
1949
|
}
|
|
1951
1950
|
for (const s of i)
|
|
1952
1951
|
if (typeof s == "object" && s !== null) {
|
|
1953
|
-
const r =
|
|
1952
|
+
const r = F(s);
|
|
1954
1953
|
if (r !== void 0) {
|
|
1955
1954
|
const o = this._queryClient.entityMap.getEntity(r);
|
|
1956
1955
|
o !== void 0 && this._parent.removeChildRef(o);
|
|
@@ -1962,20 +1961,20 @@ class Ci {
|
|
|
1962
1961
|
if (Array.isArray(t))
|
|
1963
1962
|
for (const i of t) {
|
|
1964
1963
|
if (typeof i != "object" || i === null) continue;
|
|
1965
|
-
const n =
|
|
1964
|
+
const n = F(i);
|
|
1966
1965
|
n !== void 0 && this.add(n, i);
|
|
1967
1966
|
}
|
|
1968
1967
|
}
|
|
1969
1968
|
_findIndex(t) {
|
|
1970
1969
|
for (let i = 0; i < this._items.length; i++) {
|
|
1971
1970
|
const n = this._items[i];
|
|
1972
|
-
if (typeof n == "object" && n !== null &&
|
|
1971
|
+
if (typeof n == "object" && n !== null && F(n) === t)
|
|
1973
1972
|
return i;
|
|
1974
1973
|
}
|
|
1975
1974
|
return -1;
|
|
1976
1975
|
}
|
|
1977
1976
|
}
|
|
1978
|
-
class
|
|
1977
|
+
class Ci {
|
|
1979
1978
|
_notifier;
|
|
1980
1979
|
_value;
|
|
1981
1980
|
_createdKeys;
|
|
@@ -1986,7 +1985,7 @@ class xi {
|
|
|
1986
1985
|
_onUpdate;
|
|
1987
1986
|
_onDelete;
|
|
1988
1987
|
constructor(t, i, n, s, r, o) {
|
|
1989
|
-
this._notifier =
|
|
1988
|
+
this._notifier = ft(), this._value = n, this._createdKeys = /* @__PURE__ */ new Set(), this._deletedKeys = /* @__PURE__ */ new Set(), this._queryClient = t, this._parent = i, this._onCreate = s, this._onUpdate = r, this._onDelete = o;
|
|
1990
1989
|
}
|
|
1991
1990
|
onEvent(t, i, n, s) {
|
|
1992
1991
|
switch (s) {
|
|
@@ -2016,18 +2015,18 @@ class xi {
|
|
|
2016
2015
|
append(t) {
|
|
2017
2016
|
}
|
|
2018
2017
|
}
|
|
2019
|
-
function
|
|
2018
|
+
function ue(e, t, i, n, s) {
|
|
2020
2019
|
let r = e.constraintFieldRefs;
|
|
2021
2020
|
if (r === void 0) {
|
|
2022
2021
|
r = /* @__PURE__ */ new Map();
|
|
2023
2022
|
for (const f of e.entityDefs) {
|
|
2024
2023
|
const l = f.typenameValue;
|
|
2025
|
-
l !== void 0 && r.set(l, [[
|
|
2024
|
+
l !== void 0 && r.set(l, [[oe, i.key]]);
|
|
2026
2025
|
}
|
|
2027
2026
|
}
|
|
2028
|
-
const o =
|
|
2027
|
+
const o = mi(r, n) ?? /* @__PURE__ */ new Map();
|
|
2029
2028
|
let a;
|
|
2030
|
-
if (e.type ===
|
|
2029
|
+
if (e.type === ut.Array) {
|
|
2031
2030
|
let f, l;
|
|
2032
2031
|
if (e.constraintFieldRefs !== void 0 && o.size > 0 && o.size === 1)
|
|
2033
2032
|
for (const [u] of e.constraintFieldRefs) {
|
|
@@ -2035,11 +2034,11 @@ function de(e, t, i, n, s) {
|
|
|
2035
2034
|
if (y !== void 0) {
|
|
2036
2035
|
l = y;
|
|
2037
2036
|
const v = e.constraintFieldRefs.get(u);
|
|
2038
|
-
v !== void 0 && (f =
|
|
2037
|
+
v !== void 0 && (f = vi(v.map(([p]) => p)));
|
|
2039
2038
|
break;
|
|
2040
2039
|
}
|
|
2041
2040
|
}
|
|
2042
|
-
a = new
|
|
2041
|
+
a = new bi(
|
|
2043
2042
|
s,
|
|
2044
2043
|
i,
|
|
2045
2044
|
Array.isArray(t) ? t : [],
|
|
@@ -2048,7 +2047,7 @@ function de(e, t, i, n, s) {
|
|
|
2048
2047
|
e.sort
|
|
2049
2048
|
);
|
|
2050
2049
|
} else
|
|
2051
|
-
a = new
|
|
2050
|
+
a = new Ci(
|
|
2052
2051
|
s,
|
|
2053
2052
|
i,
|
|
2054
2053
|
t,
|
|
@@ -2056,7 +2055,7 @@ function de(e, t, i, n, s) {
|
|
|
2056
2055
|
e.onUpdate,
|
|
2057
2056
|
e.onDelete
|
|
2058
2057
|
);
|
|
2059
|
-
const c = new
|
|
2058
|
+
const c = new fe(
|
|
2060
2059
|
e.entityDefs,
|
|
2061
2060
|
r,
|
|
2062
2061
|
s,
|
|
@@ -2066,40 +2065,40 @@ function de(e, t, i, n, s) {
|
|
|
2066
2065
|
);
|
|
2067
2066
|
return i.liveCollections.push(c), s.registerLiveCollection(c), c;
|
|
2068
2067
|
}
|
|
2069
|
-
const
|
|
2070
|
-
function
|
|
2068
|
+
const de = Object.entries, le = Object.prototype;
|
|
2069
|
+
function et(e, t, i, n = !1) {
|
|
2071
2070
|
const s = e.queryClient;
|
|
2072
2071
|
s.currentParseId++;
|
|
2073
2072
|
const r = e.seen, o = /* @__PURE__ */ new Map();
|
|
2074
|
-
return { data:
|
|
2073
|
+
return { data: V(t, r, s, i, o, n), entityRefs: o };
|
|
2075
2074
|
}
|
|
2076
|
-
function
|
|
2075
|
+
function V(e, t, i, n, s, r) {
|
|
2077
2076
|
if (typeof e != "object" || e === null) return e;
|
|
2078
2077
|
const o = t.get(e);
|
|
2079
2078
|
if (o !== void 0)
|
|
2080
|
-
return
|
|
2079
|
+
return xi(o, t, i, n, s, r);
|
|
2081
2080
|
if (Array.isArray(e)) {
|
|
2082
2081
|
for (let a = 0; a < e.length; a++) {
|
|
2083
2082
|
const c = e[a];
|
|
2084
|
-
typeof c == "object" && c !== null && !(c instanceof
|
|
2083
|
+
typeof c == "object" && c !== null && !(c instanceof U) && !x.has(c) && (e[a] = V(c, t, i, n, s, r));
|
|
2085
2084
|
}
|
|
2086
2085
|
return e;
|
|
2087
2086
|
}
|
|
2088
|
-
if (Object.getPrototypeOf(e) ===
|
|
2087
|
+
if (Object.getPrototypeOf(e) === le && !x.has(e)) {
|
|
2089
2088
|
const a = e;
|
|
2090
2089
|
for (const c of Object.keys(a)) {
|
|
2091
2090
|
const f = a[c];
|
|
2092
|
-
typeof f == "object" && f !== null && !(f instanceof
|
|
2091
|
+
typeof f == "object" && f !== null && !(f instanceof U) && !x.has(f) && (a[c] = V(f, t, i, n, s, r));
|
|
2093
2092
|
}
|
|
2094
2093
|
}
|
|
2095
2094
|
return e;
|
|
2096
2095
|
}
|
|
2097
|
-
function
|
|
2098
|
-
return typeof e == "object" && e !== null && !(e instanceof
|
|
2096
|
+
function he(e) {
|
|
2097
|
+
return typeof e == "object" && e !== null && !(e instanceof U) && !x.has(e);
|
|
2099
2098
|
}
|
|
2100
|
-
function
|
|
2099
|
+
function xi(e, t, i, n, s, r) {
|
|
2101
2100
|
const { key: o, data: a, shape: c, rawKeys: f } = e, l = c.shape, u = i.prepareEntity(o, a, c), y = u.data, v = y !== a, p = v && f !== void 0 && u.entityRefs !== void 0 ? new Map(u.entityRefs) : /* @__PURE__ */ new Map();
|
|
2102
|
-
if (v ? (
|
|
2101
|
+
if (v ? (ye(
|
|
2103
2102
|
l,
|
|
2104
2103
|
a,
|
|
2105
2104
|
y,
|
|
@@ -2111,15 +2110,15 @@ function Oi(e, t, i, n, s, r) {
|
|
|
2111
2110
|
n,
|
|
2112
2111
|
p,
|
|
2113
2112
|
r
|
|
2114
|
-
), u.notify()) :
|
|
2115
|
-
for (const
|
|
2116
|
-
const I =
|
|
2113
|
+
), u.notify()) : pe(l, a, u, a, t, i, n, p, r), r && u.liveCollections.length > 0)
|
|
2114
|
+
for (const m of u.liveCollections) {
|
|
2115
|
+
const I = m.instance.getRawValue();
|
|
2117
2116
|
if (Array.isArray(I))
|
|
2118
2117
|
for (const O of I) {
|
|
2119
2118
|
if (typeof O != "object" || O === null) continue;
|
|
2120
|
-
const
|
|
2121
|
-
if (
|
|
2122
|
-
const R = i.entityMap.getEntity(
|
|
2119
|
+
const $ = x.get(O);
|
|
2120
|
+
if ($ === void 0) continue;
|
|
2121
|
+
const R = i.entityMap.getEntity($);
|
|
2123
2122
|
R !== void 0 && p.set(R, (p.get(R) ?? 0) + 1);
|
|
2124
2123
|
}
|
|
2125
2124
|
}
|
|
@@ -2127,12 +2126,12 @@ function Oi(e, t, i, n, s, r) {
|
|
|
2127
2126
|
const g = u.getProxy(c);
|
|
2128
2127
|
return s.set(u, (s.get(u) ?? 0) + 1), g;
|
|
2129
2128
|
}
|
|
2130
|
-
function
|
|
2131
|
-
for (const [u, y] of
|
|
2129
|
+
function ye(e, t, i, n, s, r, o, a, c, f, l) {
|
|
2130
|
+
for (const [u, y] of de(e))
|
|
2132
2131
|
if (!(n !== void 0 && !n.has(u)))
|
|
2133
|
-
if (
|
|
2132
|
+
if (he(t[u]) && (t[u] = V(t[u], o, a, c, f, l)), y instanceof _ && y._liveConfig !== void 0) {
|
|
2134
2133
|
const v = i[u];
|
|
2135
|
-
v instanceof
|
|
2134
|
+
v instanceof fe ? l ? v.append(t[u]) : v.reset(t[u]) : i[u] = ue(
|
|
2136
2135
|
y._liveConfig,
|
|
2137
2136
|
t[u],
|
|
2138
2137
|
s,
|
|
@@ -2141,10 +2140,10 @@ function pe(e, t, i, n, s, r, o, a, c, f, l) {
|
|
|
2141
2140
|
);
|
|
2142
2141
|
} else {
|
|
2143
2142
|
const v = t[u], p = i[u];
|
|
2144
|
-
if (
|
|
2143
|
+
if (ct(v) && ct(p)) {
|
|
2145
2144
|
const g = y instanceof _ && y.shape !== void 0 ? y.shape : void 0;
|
|
2146
2145
|
if (g !== void 0)
|
|
2147
|
-
|
|
2146
|
+
ye(
|
|
2148
2147
|
g,
|
|
2149
2148
|
v,
|
|
2150
2149
|
p,
|
|
@@ -2158,18 +2157,18 @@ function pe(e, t, i, n, s, r, o, a, c, f, l) {
|
|
|
2158
2157
|
l
|
|
2159
2158
|
);
|
|
2160
2159
|
else
|
|
2161
|
-
for (const
|
|
2162
|
-
p[
|
|
2160
|
+
for (const m of Object.keys(v))
|
|
2161
|
+
p[m] = v[m];
|
|
2163
2162
|
i[u] = p;
|
|
2164
2163
|
} else
|
|
2165
2164
|
i[u] = v;
|
|
2166
2165
|
}
|
|
2167
2166
|
}
|
|
2168
|
-
function
|
|
2169
|
-
for (const [f, l] of
|
|
2167
|
+
function pe(e, t, i, n, s, r, o, a, c) {
|
|
2168
|
+
for (const [f, l] of de(e))
|
|
2170
2169
|
if (f in t)
|
|
2171
|
-
if (
|
|
2172
|
-
t[f] =
|
|
2170
|
+
if (he(t[f]) && (t[f] = V(t[f], s, r, o, a, c)), l instanceof _ && l._liveConfig !== void 0)
|
|
2171
|
+
t[f] = ue(
|
|
2173
2172
|
l._liveConfig,
|
|
2174
2173
|
t[f],
|
|
2175
2174
|
i,
|
|
@@ -2178,32 +2177,32 @@ function ge(e, t, i, n, s, r, o, a, c) {
|
|
|
2178
2177
|
);
|
|
2179
2178
|
else {
|
|
2180
2179
|
const u = t[f];
|
|
2181
|
-
if (
|
|
2180
|
+
if (ct(u)) {
|
|
2182
2181
|
const y = l instanceof _ && l.shape !== void 0 ? l.shape : void 0;
|
|
2183
|
-
y !== void 0 &&
|
|
2182
|
+
y !== void 0 && pe(y, u, i, n, s, r, o, a, c);
|
|
2184
2183
|
}
|
|
2185
2184
|
}
|
|
2186
2185
|
}
|
|
2187
|
-
function
|
|
2188
|
-
return typeof e == "object" && e !== null && !Array.isArray(e) && Object.getPrototypeOf(e) ===
|
|
2186
|
+
function ct(e) {
|
|
2187
|
+
return typeof e == "object" && e !== null && !Array.isArray(e) && Object.getPrototypeOf(e) === le && !x.has(e);
|
|
2189
2188
|
}
|
|
2190
|
-
function
|
|
2189
|
+
function ji(e) {
|
|
2191
2190
|
if (e !== void 0)
|
|
2192
2191
|
return typeof e == "string" ? e : typeof e == "function" ? e() : e.value;
|
|
2193
2192
|
}
|
|
2194
|
-
function
|
|
2195
|
-
return
|
|
2193
|
+
function Oi(e) {
|
|
2194
|
+
return Ee(e);
|
|
2196
2195
|
}
|
|
2197
2196
|
function Mt(e) {
|
|
2198
2197
|
if (e === void 0)
|
|
2199
2198
|
return;
|
|
2200
2199
|
const t = {};
|
|
2201
2200
|
for (const [i, n] of Object.entries(e))
|
|
2202
|
-
|
|
2201
|
+
Oi(n) ? t[i] = n.value : t[i] = n;
|
|
2203
2202
|
return t;
|
|
2204
2203
|
}
|
|
2205
|
-
const
|
|
2206
|
-
class
|
|
2204
|
+
const wt = (e, t) => D([e.statics.id, t]);
|
|
2205
|
+
class Li {
|
|
2207
2206
|
entityMap;
|
|
2208
2207
|
queryInstances = /* @__PURE__ */ new Map();
|
|
2209
2208
|
mutationInstances = /* @__PURE__ */ new Map();
|
|
@@ -2220,7 +2219,7 @@ class qi {
|
|
|
2220
2219
|
networkUnsubscribe;
|
|
2221
2220
|
constructor(t = {}) {
|
|
2222
2221
|
const {
|
|
2223
|
-
store: i = new
|
|
2222
|
+
store: i = new Oe(new Re()),
|
|
2224
2223
|
log: n,
|
|
2225
2224
|
evictionMultiplier: s,
|
|
2226
2225
|
adapters: r,
|
|
@@ -2228,10 +2227,10 @@ class qi {
|
|
|
2228
2227
|
gcManager: a,
|
|
2229
2228
|
...c
|
|
2230
2229
|
} = t;
|
|
2231
|
-
this.isServer = typeof window > "u", this.store = i, this.context = { ...c, log: n ?? console, evictionMultiplier: s }, this.gcManager = t.gcManager ?? (this.isServer ? new
|
|
2230
|
+
this.isServer = typeof window > "u", this.store = i, this.context = { ...c, log: n ?? console, evictionMultiplier: s }, this.gcManager = t.gcManager ?? (this.isServer ? new De() : new Ae(this.handleEviction, s)), this.networkManager = t.networkManager ?? new ne(), this.entityMap = new li((u, y, v) => this.store.saveEntity(u, y, v));
|
|
2232
2231
|
for (const u of t.adapters ?? [])
|
|
2233
2232
|
this.adapters.set(u.constructor, u), u.register(this);
|
|
2234
|
-
const f = this.networkManager.getOnlineSignal(), l =
|
|
2233
|
+
const f = this.networkManager.getOnlineSignal(), l = be(() => f.value);
|
|
2235
2234
|
this.networkUnsubscribe = l.addListener(
|
|
2236
2235
|
() => {
|
|
2237
2236
|
const u = f.value;
|
|
@@ -2321,9 +2320,9 @@ class qi {
|
|
|
2321
2320
|
* that triggers fetches and prepopulates with cached data
|
|
2322
2321
|
*/
|
|
2323
2322
|
getQuery(t, i) {
|
|
2324
|
-
const n =
|
|
2323
|
+
const n = wt(t, i);
|
|
2325
2324
|
let s = this.queryInstances.get(n);
|
|
2326
|
-
return s === void 0 && (s = new
|
|
2325
|
+
return s === void 0 && (s = new yi(t, this, n, i), this.queryInstances.set(n, s)), s.relay;
|
|
2327
2326
|
}
|
|
2328
2327
|
/**
|
|
2329
2328
|
* Gets or creates a MutationResult for the given mutation definition.
|
|
@@ -2332,7 +2331,7 @@ class qi {
|
|
|
2332
2331
|
getMutation(t) {
|
|
2333
2332
|
const i = t.id;
|
|
2334
2333
|
let n = this.mutationInstances.get(i);
|
|
2335
|
-
return n === void 0 && (n = new
|
|
2334
|
+
return n === void 0 && (n = new pi(t, this), this.mutationInstances.set(i, n)), n.task;
|
|
2336
2335
|
}
|
|
2337
2336
|
/**
|
|
2338
2337
|
* Parse data: validates, formats, produces parsed entity data objects.
|
|
@@ -2340,7 +2339,7 @@ class qi {
|
|
|
2340
2339
|
*/
|
|
2341
2340
|
parseData(t, i, n) {
|
|
2342
2341
|
const s = this.context.log?.warn ?? (() => {
|
|
2343
|
-
}), r = new
|
|
2342
|
+
}), r = new rt();
|
|
2344
2343
|
return r.reset(this, n, s), { data: Zt(t, i, r), ctx: r };
|
|
2345
2344
|
}
|
|
2346
2345
|
/**
|
|
@@ -2349,7 +2348,7 @@ class qi {
|
|
|
2349
2348
|
* refs. Returns the reified data and root-level entity refs.
|
|
2350
2349
|
*/
|
|
2351
2350
|
applyRefs(t, i = !0, n = !1) {
|
|
2352
|
-
return
|
|
2351
|
+
return et(t.ctx, t.data, i, n);
|
|
2353
2352
|
}
|
|
2354
2353
|
/**
|
|
2355
2354
|
* Parse and apply data as a root entity. For non-entity results, injects
|
|
@@ -2358,7 +2357,7 @@ class qi {
|
|
|
2358
2357
|
*/
|
|
2359
2358
|
parseAndApplyRootEntity(t, i, n, s, r = !1, o) {
|
|
2360
2359
|
typeof n.idField == "symbol" && typeof t == "object" && t !== null && !("__entityRef" in t) && (t[jt] = i);
|
|
2361
|
-
const a = this.parseData(t, n, o), c =
|
|
2360
|
+
const a = this.parseData(t, n, o), c = et(a.ctx, a.data, s, r), f = x.get(c.data);
|
|
2362
2361
|
return this.entityMap.getEntity(f);
|
|
2363
2362
|
}
|
|
2364
2363
|
prepareEntity(t, i, n) {
|
|
@@ -2382,20 +2381,20 @@ class qi {
|
|
|
2382
2381
|
}
|
|
2383
2382
|
try {
|
|
2384
2383
|
const g = this.context.log?.warn ?? (() => {
|
|
2385
|
-
}),
|
|
2386
|
-
|
|
2384
|
+
}), m = new rt();
|
|
2385
|
+
m.reset(
|
|
2387
2386
|
this,
|
|
2388
2387
|
void 0,
|
|
2389
2388
|
g,
|
|
2390
2389
|
/* isPartialEvent */
|
|
2391
2390
|
!0
|
|
2392
2391
|
);
|
|
2393
|
-
const I =
|
|
2394
|
-
|
|
2392
|
+
const I = ei(l, s, m);
|
|
2393
|
+
et(m, I, !0);
|
|
2395
2394
|
} catch (g) {
|
|
2396
2395
|
if (this.context.log?.warn?.("Failed to apply mutation event", g), u === void 0) {
|
|
2397
|
-
const
|
|
2398
|
-
|
|
2396
|
+
const m = this.entityMap.getEntity(c);
|
|
2397
|
+
m !== void 0 && m.evict();
|
|
2399
2398
|
}
|
|
2400
2399
|
return;
|
|
2401
2400
|
}
|
|
@@ -2413,16 +2412,16 @@ class qi {
|
|
|
2413
2412
|
// ======================================================
|
|
2414
2413
|
invalidateQueries(t) {
|
|
2415
2414
|
for (const i of t) {
|
|
2416
|
-
const n = Array.isArray(i), s = n ? i[0] : i, r = n ? i[1] : void 0, a =
|
|
2415
|
+
const n = Array.isArray(i), s = n ? i[0] : i, r = n ? i[1] : void 0, a = K.for(s).statics.id;
|
|
2417
2416
|
for (const [, c] of this.queryInstances)
|
|
2418
|
-
c.def.statics.id === a && (r === void 0 ||
|
|
2417
|
+
c.def.statics.id === a && (r === void 0 || Si(c.resolvedParams, r)) && c.markStale();
|
|
2419
2418
|
}
|
|
2420
2419
|
}
|
|
2421
2420
|
// ======================================================
|
|
2422
2421
|
// In-Memory GC
|
|
2423
2422
|
// ======================================================
|
|
2424
2423
|
handleEviction = (t, i) => {
|
|
2425
|
-
if (i ===
|
|
2424
|
+
if (i === H.Query) {
|
|
2426
2425
|
const s = this.queryInstances.get(t);
|
|
2427
2426
|
if (s === void 0) return;
|
|
2428
2427
|
s.rootEntity?.evict(), this.queryInstances.delete(t);
|
|
@@ -2436,7 +2435,7 @@ class qi {
|
|
|
2436
2435
|
// ======================================================
|
|
2437
2436
|
getOrCreateMatcher(t) {
|
|
2438
2437
|
let i = this.constraintRegistry.get(t);
|
|
2439
|
-
return i === void 0 && (i = new
|
|
2438
|
+
return i === void 0 && (i = new Ei(), this.constraintRegistry.set(t, i)), i;
|
|
2440
2439
|
}
|
|
2441
2440
|
registerLiveCollection(t) {
|
|
2442
2441
|
for (const [i, n] of t._entityDefsByTypename)
|
|
@@ -2451,7 +2450,7 @@ class qi {
|
|
|
2451
2450
|
routeEvent(t, i, n, s, r, o, a) {
|
|
2452
2451
|
const c = this.constraintRegistry.get(t);
|
|
2453
2452
|
if (c === void 0) return;
|
|
2454
|
-
const f = r !== void 0 ? { ...i, [
|
|
2453
|
+
const f = r !== void 0 ? { ...i, [oe]: r } : i;
|
|
2455
2454
|
c.routeEvent(t, f, n, s, o, a);
|
|
2456
2455
|
}
|
|
2457
2456
|
destroy() {
|
|
@@ -2461,40 +2460,40 @@ class qi {
|
|
|
2461
2460
|
this.adapters.clear(), this.queryInstances.clear(), this.mutationInstances.clear(), this.constraintRegistry.clear(), this.typenameRegistry.clear(), this.mergedDefCache.clear();
|
|
2462
2461
|
}
|
|
2463
2462
|
}
|
|
2464
|
-
const
|
|
2465
|
-
function
|
|
2463
|
+
const Ri = Tt(void 0);
|
|
2464
|
+
function Si(e, t) {
|
|
2466
2465
|
if (e === void 0) return !1;
|
|
2467
2466
|
for (const i in t)
|
|
2468
2467
|
if (e[i] !== t[i]) return !1;
|
|
2469
2468
|
return !0;
|
|
2470
2469
|
}
|
|
2471
2470
|
export {
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
L,
|
|
2471
|
+
B as A,
|
|
2472
|
+
ht as E,
|
|
2473
|
+
Ae as G,
|
|
2474
|
+
q as L,
|
|
2476
2475
|
d as M,
|
|
2477
|
-
|
|
2476
|
+
ne as N,
|
|
2478
2477
|
jt as Q,
|
|
2479
|
-
|
|
2478
|
+
Y as R,
|
|
2480
2479
|
_ as V,
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2480
|
+
ut as a,
|
|
2481
|
+
ki as b,
|
|
2482
|
+
L as c,
|
|
2483
|
+
De as d,
|
|
2484
|
+
se as e,
|
|
2485
|
+
Fi as f,
|
|
2486
|
+
Li as g,
|
|
2487
|
+
Ri as h,
|
|
2488
|
+
hi as i,
|
|
2489
|
+
Mi as j,
|
|
2490
|
+
Pi as k,
|
|
2492
2491
|
Vt as l,
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2492
|
+
Me as m,
|
|
2493
|
+
z as n,
|
|
2494
|
+
ji as o,
|
|
2495
|
+
Ti as q,
|
|
2497
2496
|
zt as r,
|
|
2498
|
-
|
|
2497
|
+
Ze as t
|
|
2499
2498
|
};
|
|
2500
|
-
//# sourceMappingURL=QueryClient-
|
|
2499
|
+
//# sourceMappingURL=QueryClient-DrWSXg0y.js.map
|