fetchium 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/dist/cjs/development/QueryClient-QKhS8mhg.js +2 -0
- package/dist/cjs/development/QueryClient-QKhS8mhg.js.map +1 -0
- package/dist/cjs/development/index.js +1 -1
- package/dist/cjs/{production/mutation-Bleah98u.js → development/mutation-w67Vpuvw.js} +2 -2
- package/dist/cjs/{production/mutation-Bleah98u.js.map → development/mutation-w67Vpuvw.js.map} +1 -1
- package/dist/cjs/development/react/index.js +1 -1
- package/dist/cjs/development/react/index.js.map +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-DIAqDTHF.js +2 -0
- package/dist/cjs/production/QueryClient-DIAqDTHF.js.map +1 -0
- package/dist/cjs/production/index.js +1 -1
- package/dist/cjs/{development/mutation-GI_gTQEB.js → production/mutation-CgS9gXW7.js} +2 -2
- package/dist/cjs/{development/mutation-GI_gTQEB.js.map → production/mutation-CgS9gXW7.js.map} +1 -1
- package/dist/cjs/production/react/index.js +1 -1
- package/dist/cjs/production/react/index.js.map +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/QueryResult.d.ts +4 -3
- package/dist/esm/QueryResult.d.ts.map +1 -1
- package/dist/esm/development/{QueryClient-CmMSNSpt.js → QueryClient-C9tBdK1Z.js} +351 -332
- package/dist/esm/development/QueryClient-C9tBdK1Z.js.map +1 -0
- package/dist/esm/development/index.js +2 -2
- package/dist/esm/development/{mutation-BAM3eYqd.js → mutation-Dx63NCGk.js} +2 -2
- package/dist/esm/development/{mutation-BAM3eYqd.js.map → mutation-Dx63NCGk.js.map} +1 -1
- package/dist/esm/development/react/index.js +5 -36
- package/dist/esm/development/react/index.js.map +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-3aWu_mJE.js → QueryClient-D64xo0EA.js} +323 -306
- package/dist/esm/production/QueryClient-D64xo0EA.js.map +1 -0
- package/dist/esm/production/index.js +2 -2
- package/dist/esm/production/{mutation-YpiJLNWU.js → mutation-Aw1JE7VO.js} +2 -2
- package/dist/esm/production/{mutation-YpiJLNWU.js.map → mutation-Aw1JE7VO.js.map} +1 -1
- package/dist/esm/production/react/index.js +5 -36
- package/dist/esm/production/react/index.js.map +1 -1
- package/dist/esm/production/rest/index.js +2 -2
- package/dist/esm/production/topic/index.js +1 -1
- package/dist/esm/react/use-query.d.ts +8 -0
- package/dist/esm/react/use-query.d.ts.map +1 -1
- package/dist/esm/types.d.ts +3 -3
- package/dist/esm/types.d.ts.map +1 -1
- package/package.json +6 -6
- package/plugin/docs/api/fetchium-react.md +5 -4
- package/plugin/docs/api/fetchium.md +2 -2
- package/dist/cjs/development/QueryClient-Ce5Mnumb.js +0 -2
- package/dist/cjs/development/QueryClient-Ce5Mnumb.js.map +0 -1
- package/dist/cjs/production/QueryClient-BXGk-5PR.js +0 -2
- package/dist/cjs/production/QueryClient-BXGk-5PR.js.map +0 -1
- package/dist/esm/development/QueryClient-CmMSNSpt.js.map +0 -1
- package/dist/esm/production/QueryClient-3aWu_mJE.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { notifier as ct, relay as
|
|
2
|
-
import { registerCustomHash as
|
|
3
|
-
import { d as
|
|
4
|
-
import { SyncQueryStore as
|
|
5
|
-
var
|
|
6
|
-
const Q = /* @__PURE__ */ Symbol("array"), B = /* @__PURE__ */ Symbol("record"),
|
|
1
|
+
import { notifier as ct, relay as kt, setScopeOwner as ve, reactiveMethod as _e, signal as Ft, context as Tt, getContext as me, task as we, reactiveSignal as Ee, isSignal as be, watcher as Ce } from "signalium";
|
|
2
|
+
import { registerCustomHash as xe, hashValue as D, registerCustomSnapshot as Oe } from "signalium/utils";
|
|
3
|
+
import { d as Pt } from "./shared-DcuVH8Pf.js";
|
|
4
|
+
import { SyncQueryStore as Re, MemoryPersistentStore as Se } from "./stores/sync.js";
|
|
5
|
+
var j = /* @__PURE__ */ ((e) => (e.Always = "always", e.Online = "online", e.OfflineFirst = "offlineFirst", e))(j || {}), 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 Q = /* @__PURE__ */ Symbol("array"), B = /* @__PURE__ */ Symbol("record"), jt = /* @__PURE__ */ Symbol("QUERY_ID");
|
|
7
7
|
var ft = /* @__PURE__ */ ((e) => (e[e.Array = 0] = "Array", e[e.Value = 1] = "Value", e))(ft || {});
|
|
8
|
-
class
|
|
8
|
+
class L {
|
|
9
9
|
type;
|
|
10
10
|
entityDefs;
|
|
11
11
|
constraintFieldRefs;
|
|
@@ -18,7 +18,7 @@ class j {
|
|
|
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 L(
|
|
22
22
|
0,
|
|
23
23
|
t,
|
|
24
24
|
i,
|
|
@@ -30,7 +30,7 @@ class j {
|
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
static value(t, i, n, s, r, o) {
|
|
33
|
-
return new
|
|
33
|
+
return new L(
|
|
34
34
|
1,
|
|
35
35
|
t,
|
|
36
36
|
i,
|
|
@@ -47,7 +47,7 @@ function k(e) {
|
|
|
47
47
|
return x.get(e);
|
|
48
48
|
}
|
|
49
49
|
var z = /* @__PURE__ */ ((e) => (e[e.Query = 0] = "Query", e[e.Entity = 1] = "Entity", e))(z || {});
|
|
50
|
-
class
|
|
50
|
+
class Ae {
|
|
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 Oe {
|
|
|
70
70
|
clearInterval(this._intervalId);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
class
|
|
73
|
+
class De {
|
|
74
74
|
_buckets = /* @__PURE__ */ new Map();
|
|
75
75
|
_nextTickEntries = /* @__PURE__ */ new Map();
|
|
76
76
|
_nextTickScheduled = !1;
|
|
@@ -88,7 +88,7 @@ class Re {
|
|
|
88
88
|
}
|
|
89
89
|
const { _buckets: s } = this;
|
|
90
90
|
let r = s.get(i);
|
|
91
|
-
r || (r = new
|
|
91
|
+
r || (r = new Ae(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 Re {
|
|
|
113
113
|
t.clear(), i.clear();
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
class
|
|
116
|
+
class Ie {
|
|
117
117
|
schedule(t, i, n) {
|
|
118
118
|
}
|
|
119
119
|
cancel(t, i) {
|
|
@@ -121,15 +121,15 @@ class Se {
|
|
|
121
121
|
destroy() {
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
const Y = /* @__PURE__ */ Symbol("fieldRef"), N = /* @__PURE__ */ Symbol("fieldRefPath"), ut = /* @__PURE__ */ Symbol("DEFINITION_TARGET"), G = /* @__PURE__ */ Symbol("CANCEL_PROXY"),
|
|
125
|
-
function
|
|
124
|
+
const Y = /* @__PURE__ */ Symbol("fieldRef"), N = /* @__PURE__ */ Symbol("fieldRefPath"), ut = /* @__PURE__ */ Symbol("DEFINITION_TARGET"), G = /* @__PURE__ */ Symbol("CANCEL_PROXY"), Ne = /\[([^\]]+)\]/g;
|
|
125
|
+
function Lt(e) {
|
|
126
126
|
const t = {
|
|
127
127
|
[Y]: !0,
|
|
128
128
|
[N]: e
|
|
129
129
|
};
|
|
130
|
-
return new Proxy(t,
|
|
130
|
+
return new Proxy(t, Me);
|
|
131
131
|
}
|
|
132
|
-
const
|
|
132
|
+
const Me = {
|
|
133
133
|
get(e, t) {
|
|
134
134
|
if (t === Y) return !0;
|
|
135
135
|
if (t === N) return e[N];
|
|
@@ -139,30 +139,30 @@ const De = {
|
|
|
139
139
|
}
|
|
140
140
|
if (typeof t == "symbol") return;
|
|
141
141
|
const i = e[N];
|
|
142
|
-
return
|
|
142
|
+
return Lt([...i, t]);
|
|
143
143
|
},
|
|
144
144
|
has(e, t) {
|
|
145
145
|
return t === Y || t === N;
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
|
-
function
|
|
148
|
+
function qt(e) {
|
|
149
149
|
return typeof e == "object" && e !== null && e[Y] === !0;
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function Ut(e) {
|
|
152
152
|
return e[N];
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function Vt(e) {
|
|
155
155
|
return new Proxy(e, {
|
|
156
156
|
set(t, i, n) {
|
|
157
157
|
return t[i] = n, !0;
|
|
158
158
|
},
|
|
159
159
|
get(t, i) {
|
|
160
160
|
return i === ut ? t : i === G ? () => {
|
|
161
|
-
} : typeof i == "symbol" ? t[i] :
|
|
161
|
+
} : typeof i == "symbol" ? t[i] : Lt([i]);
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
|
-
function
|
|
165
|
+
function ke(e) {
|
|
166
166
|
const t = e[ut];
|
|
167
167
|
e[G]();
|
|
168
168
|
const i = {};
|
|
@@ -188,17 +188,17 @@ function dt(e, t) {
|
|
|
188
188
|
}
|
|
189
189
|
return i;
|
|
190
190
|
}
|
|
191
|
-
function
|
|
192
|
-
return e.replace(
|
|
191
|
+
function Fe(e, t) {
|
|
192
|
+
return e.replace(Ne, (i, n) => {
|
|
193
193
|
const s = n.split("."), r = dt(s, t);
|
|
194
194
|
return r != null ? encodeURIComponent(String(r)) : "";
|
|
195
195
|
});
|
|
196
196
|
}
|
|
197
197
|
function W(e, t) {
|
|
198
|
-
if (
|
|
199
|
-
return dt(
|
|
198
|
+
if (qt(e))
|
|
199
|
+
return dt(Ut(e), t);
|
|
200
200
|
if (typeof e == "string")
|
|
201
|
-
return
|
|
201
|
+
return Fe(e, t);
|
|
202
202
|
if (Array.isArray(e))
|
|
203
203
|
return e.map((i) => W(i, t));
|
|
204
204
|
if (typeof e == "object" && e !== null && Object.getPrototypeOf(e) === Object.prototype) {
|
|
@@ -218,20 +218,20 @@ function et(e, t, i) {
|
|
|
218
218
|
o[a] = c.bind(o);
|
|
219
219
|
return o;
|
|
220
220
|
}
|
|
221
|
-
class
|
|
221
|
+
class lt {
|
|
222
222
|
static cache;
|
|
223
223
|
constructor() {
|
|
224
|
-
return
|
|
224
|
+
return Vt(this);
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
|
-
const
|
|
228
|
-
function
|
|
227
|
+
const Kt = Object.entries, it = Object.keys;
|
|
228
|
+
function bt(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 Te(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
|
-
function
|
|
234
|
+
function $t(e, t, i) {
|
|
235
235
|
const n = /* @__PURE__ */ new Set();
|
|
236
236
|
for (const r of e)
|
|
237
237
|
if (r !== void 0)
|
|
@@ -244,13 +244,13 @@ function Kt(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), Te(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
|
-
const l =
|
|
251
|
-
s[r] = o < t ?
|
|
250
|
+
const l = $t(c, t), u = new _(d.OBJECT, l);
|
|
251
|
+
s[r] = o < t ? bt(u) : u;
|
|
252
252
|
} else
|
|
253
|
-
s[r] = o < t ?
|
|
253
|
+
s[r] = o < t ? bt(a) : a;
|
|
254
254
|
}
|
|
255
255
|
return s;
|
|
256
256
|
}
|
|
@@ -290,7 +290,7 @@ class _ {
|
|
|
290
290
|
if (t.length === 1) return t[0];
|
|
291
291
|
const i = t.length, n = t.map((c) => c.shape);
|
|
292
292
|
t[0].typenameValue;
|
|
293
|
-
const s =
|
|
293
|
+
const s = $t(n, i);
|
|
294
294
|
let r, o, a;
|
|
295
295
|
for (const c of t) {
|
|
296
296
|
if (r === void 0 && c.idField !== void 0)
|
|
@@ -357,28 +357,28 @@ class H extends Set {
|
|
|
357
357
|
return t;
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
const
|
|
361
|
-
|
|
362
|
-
let t =
|
|
360
|
+
const Pe = 1128875347;
|
|
361
|
+
xe(H, (e) => {
|
|
362
|
+
let t = Pe;
|
|
363
363
|
for (const i of e)
|
|
364
364
|
t += D(i);
|
|
365
365
|
return t >>> 0;
|
|
366
366
|
});
|
|
367
|
-
function
|
|
367
|
+
function ht(e, t) {
|
|
368
368
|
return new _(e, t);
|
|
369
369
|
}
|
|
370
|
-
function
|
|
371
|
-
return
|
|
370
|
+
function je(e) {
|
|
371
|
+
return ht(d.ARRAY, e);
|
|
372
372
|
}
|
|
373
|
-
function
|
|
374
|
-
return
|
|
373
|
+
function Le(e) {
|
|
374
|
+
return ht(d.RECORD | d.OBJECT, e);
|
|
375
375
|
}
|
|
376
|
-
function
|
|
377
|
-
return
|
|
376
|
+
function qe(e) {
|
|
377
|
+
return ht(d.PARSE_RESULT, e);
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function Qt(e, t) {
|
|
380
380
|
let i = e, n, s, r;
|
|
381
|
-
for (const [o, a] of
|
|
381
|
+
for (const [o, a] of Kt(t))
|
|
382
382
|
switch (typeof a) {
|
|
383
383
|
case "number":
|
|
384
384
|
if ((a & d.ID) !== 0) {
|
|
@@ -400,10 +400,10 @@ function $t(e, t) {
|
|
|
400
400
|
}
|
|
401
401
|
return new _(i, t, void 0, s, r, n);
|
|
402
402
|
}
|
|
403
|
-
function
|
|
404
|
-
return
|
|
403
|
+
function Ue(e) {
|
|
404
|
+
return Qt(d.OBJECT, e);
|
|
405
405
|
}
|
|
406
|
-
function
|
|
406
|
+
function Ct(e, t, i) {
|
|
407
407
|
const n = e.mask;
|
|
408
408
|
if ((n & d.UNION) !== 0) {
|
|
409
409
|
const s = e;
|
|
@@ -444,7 +444,7 @@ function bt(e, t, i) {
|
|
|
444
444
|
}
|
|
445
445
|
return i;
|
|
446
446
|
}
|
|
447
|
-
function
|
|
447
|
+
function yt(...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 ht(...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 = Ct(s, o, a)), a = Ct(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,36 +473,36 @@ function ht(...e) {
|
|
|
473
473
|
const f = i | c | d.UNION;
|
|
474
474
|
return new _(f, o, r, a);
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function pt(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 yt(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
|
|
486
|
-
function
|
|
487
|
-
return
|
|
485
|
+
const Ve = /* @__PURE__ */ new WeakMap(), Ke = /* @__PURE__ */ new WeakMap(), $e = /* @__PURE__ */ new WeakMap();
|
|
486
|
+
function Qe(e) {
|
|
487
|
+
return pt(e, d.UNDEFINED | d.NULL, $e);
|
|
488
488
|
}
|
|
489
|
-
function
|
|
490
|
-
return
|
|
489
|
+
function Be(e) {
|
|
490
|
+
return pt(e, d.UNDEFINED, Ve);
|
|
491
491
|
}
|
|
492
|
-
function
|
|
493
|
-
return
|
|
492
|
+
function Ye(e) {
|
|
493
|
+
return pt(e, d.NULL, Ke);
|
|
494
494
|
}
|
|
495
|
-
function
|
|
495
|
+
function Ge(e) {
|
|
496
496
|
return e;
|
|
497
497
|
}
|
|
498
|
-
function
|
|
498
|
+
function We(e) {
|
|
499
499
|
return /* @__PURE__ */ new Set([e]);
|
|
500
500
|
}
|
|
501
|
-
const
|
|
502
|
-
|
|
503
|
-
const
|
|
504
|
-
let
|
|
505
|
-
const nt = [],
|
|
501
|
+
const Bt = ((...e) => new Set(e));
|
|
502
|
+
Bt.caseInsensitive = (...e) => new H(e);
|
|
503
|
+
const Yt = 16;
|
|
504
|
+
let ze = 0;
|
|
505
|
+
const nt = [], Gt = [], Wt = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new WeakSet();
|
|
506
506
|
class q {
|
|
507
507
|
_raw;
|
|
508
508
|
_formatted;
|
|
@@ -515,22 +515,22 @@ class q {
|
|
|
515
515
|
return this._parsed || (this._formatted = nt[this._formatId](this._raw), this._parsed = !0), this._formatted;
|
|
516
516
|
}
|
|
517
517
|
toJSON() {
|
|
518
|
-
return this._parsed ?
|
|
518
|
+
return this._parsed ? Gt[this._formatId](this._formatted) : this._raw;
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
|
-
function
|
|
522
|
-
const t =
|
|
521
|
+
function He(e) {
|
|
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
|
-
function
|
|
528
|
-
const r =
|
|
529
|
-
nt[r] = i,
|
|
530
|
-
const o = s?.eager ?? !0, c = r <<
|
|
531
|
-
|
|
527
|
+
function zt(e, t, i, n, s) {
|
|
528
|
+
const r = ze++;
|
|
529
|
+
nt[r] = i, Gt[r] = n;
|
|
530
|
+
const o = s?.eager ?? !0, c = r << Yt | t | d.HAS_FORMAT | (o ? d.IS_EAGER_FORMAT : 0);
|
|
531
|
+
Wt.set(e, c);
|
|
532
532
|
}
|
|
533
|
-
|
|
533
|
+
zt(
|
|
534
534
|
"date",
|
|
535
535
|
d.STRING,
|
|
536
536
|
(e) => {
|
|
@@ -547,7 +547,7 @@ Wt(
|
|
|
547
547
|
return `${t}-${i}-${n}`;
|
|
548
548
|
}
|
|
549
549
|
);
|
|
550
|
-
|
|
550
|
+
zt(
|
|
551
551
|
"date-time",
|
|
552
552
|
d.STRING,
|
|
553
553
|
(e) => {
|
|
@@ -558,19 +558,19 @@ Wt(
|
|
|
558
558
|
},
|
|
559
559
|
(e) => e.toISOString()
|
|
560
560
|
);
|
|
561
|
-
const
|
|
561
|
+
const xt = /* @__PURE__ */ new WeakMap();
|
|
562
562
|
function T(e) {
|
|
563
|
-
let t =
|
|
563
|
+
let t = xt.get(e);
|
|
564
564
|
if (t === void 0) {
|
|
565
565
|
const i = new e(), n = i[ut] ?? i;
|
|
566
566
|
i[G] && i[G]();
|
|
567
567
|
const s = {};
|
|
568
|
-
for (const [f, l] of
|
|
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 !==
|
|
573
|
+
if (f !== lt && typeof f == "function") {
|
|
574
574
|
const u = T(f).shape;
|
|
575
575
|
for (const y of it(u))
|
|
576
576
|
if (y in s && s[y] !== u[y])
|
|
@@ -580,16 +580,16 @@ 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 =
|
|
583
|
+
t = Qt(d.ENTITY | d.OBJECT, s), t._entityClass = e, it(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), xt.set(e, t);
|
|
586
586
|
}
|
|
587
587
|
return t;
|
|
588
588
|
}
|
|
589
|
-
function
|
|
589
|
+
function Je(e) {
|
|
590
590
|
return T(e);
|
|
591
591
|
}
|
|
592
|
-
function
|
|
592
|
+
function Ht(e, t) {
|
|
593
593
|
if (t == null) return;
|
|
594
594
|
const i = /* @__PURE__ */ new Map();
|
|
595
595
|
if (Array.isArray(t))
|
|
@@ -612,56 +612,56 @@ function zt(e, t) {
|
|
|
612
612
|
}
|
|
613
613
|
return i.size > 0 ? i : void 0;
|
|
614
614
|
}
|
|
615
|
-
function
|
|
615
|
+
function Jt(e) {
|
|
616
616
|
return Array.isArray(e) ? e.map((t) => T(t)) : [T(e)];
|
|
617
617
|
}
|
|
618
|
-
function
|
|
619
|
-
const i =
|
|
620
|
-
return r._liveConfig =
|
|
618
|
+
function Xe(e, t) {
|
|
619
|
+
const i = Jt(e), n = i.length === 1 ? i[0] : yt(...i.map((o) => o)), s = d.ARRAY | d.LIVE, r = new _(s, n);
|
|
620
|
+
return r._liveConfig = L.array(
|
|
621
621
|
i,
|
|
622
|
-
|
|
622
|
+
Ht(i, t?.constraints),
|
|
623
623
|
t?.sort
|
|
624
624
|
), r;
|
|
625
625
|
}
|
|
626
|
-
function
|
|
627
|
-
const n =
|
|
628
|
-
return o._liveConfig =
|
|
626
|
+
function Ze(e, t, i) {
|
|
627
|
+
const n = Jt(t), s = e, r = d.LIVE, o = new _(r, void 0);
|
|
628
|
+
return o._liveConfig = L.value(
|
|
629
629
|
n,
|
|
630
|
-
|
|
630
|
+
Ht(n, i?.constraints),
|
|
631
631
|
s,
|
|
632
632
|
i.onCreate,
|
|
633
633
|
i.onUpdate,
|
|
634
634
|
i.onDelete
|
|
635
635
|
), o;
|
|
636
636
|
}
|
|
637
|
-
const
|
|
638
|
-
format:
|
|
639
|
-
typename:
|
|
640
|
-
const:
|
|
641
|
-
enum:
|
|
637
|
+
const ti = {
|
|
638
|
+
format: He,
|
|
639
|
+
typename: Ge,
|
|
640
|
+
const: We,
|
|
641
|
+
enum: Bt,
|
|
642
642
|
id: d.ID | d.STRING | d.NUMBER,
|
|
643
643
|
string: d.STRING,
|
|
644
644
|
number: d.NUMBER,
|
|
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: je,
|
|
649
|
+
object: Ue,
|
|
650
|
+
record: Le,
|
|
651
|
+
union: yt,
|
|
652
|
+
nullish: Qe,
|
|
653
|
+
optional: Be,
|
|
654
|
+
nullable: Ye,
|
|
655
|
+
result: qe,
|
|
656
|
+
entity: Je,
|
|
657
|
+
liveArray: Xe,
|
|
658
|
+
liveValue: Ze
|
|
659
659
|
};
|
|
660
660
|
function P(e, t, i) {
|
|
661
661
|
return new TypeError(`Validation error at ${e}`);
|
|
662
662
|
}
|
|
663
|
-
const
|
|
664
|
-
function
|
|
663
|
+
const Xt = Array.isArray;
|
|
664
|
+
function Ot(e) {
|
|
665
665
|
if (e === null) return d.NULL;
|
|
666
666
|
switch (typeof e) {
|
|
667
667
|
case "number":
|
|
@@ -673,18 +673,18 @@ function xt(e) {
|
|
|
673
673
|
case "undefined":
|
|
674
674
|
return d.UNDEFINED;
|
|
675
675
|
case "object":
|
|
676
|
-
return
|
|
676
|
+
return Xt(e) ? d.ARRAY : d.OBJECT;
|
|
677
677
|
default:
|
|
678
678
|
throw new Error(`Invalid type: ${typeof e}`);
|
|
679
679
|
}
|
|
680
680
|
}
|
|
681
|
-
function
|
|
681
|
+
function ki(e) {
|
|
682
682
|
return F(e);
|
|
683
683
|
}
|
|
684
684
|
function F(e) {
|
|
685
685
|
if (e === null || typeof e != "object")
|
|
686
686
|
return e;
|
|
687
|
-
if (
|
|
687
|
+
if (Xt(e))
|
|
688
688
|
return e.map((i) => F(i));
|
|
689
689
|
if (e instanceof Date)
|
|
690
690
|
return new Date(e.getTime());
|
|
@@ -705,12 +705,12 @@ function F(e) {
|
|
|
705
705
|
t[i] = F(e[i]);
|
|
706
706
|
return t;
|
|
707
707
|
}
|
|
708
|
-
const
|
|
708
|
+
const gt = Object.entries, ei = () => {
|
|
709
709
|
};
|
|
710
710
|
class st {
|
|
711
711
|
queryClient = void 0;
|
|
712
712
|
preloadedEntities = void 0;
|
|
713
|
-
warn =
|
|
713
|
+
warn = ei;
|
|
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;
|
|
@@ -720,14 +720,14 @@ class st {
|
|
|
720
720
|
this.queryClient = t, this.preloadedEntities = i, this.warn = n, this.isPartialEvent = s, t !== void 0 && (this.seen === void 0 ? (this.seen = /* @__PURE__ */ new Map(), this.seenByKey = /* @__PURE__ */ new Map()) : (this.seen.clear(), this.seenByKey.clear()));
|
|
721
721
|
}
|
|
722
722
|
}
|
|
723
|
-
function
|
|
723
|
+
function Zt(e, t, i) {
|
|
724
724
|
return M(e, t, i, "");
|
|
725
725
|
}
|
|
726
|
-
function
|
|
727
|
-
return
|
|
726
|
+
function ii(e, t, i) {
|
|
727
|
+
return vt(e, t, i);
|
|
728
728
|
}
|
|
729
|
-
function
|
|
730
|
-
const s = e >>
|
|
729
|
+
function Rt(e, t, i, n) {
|
|
730
|
+
const s = e >> Yt;
|
|
731
731
|
if ((e & d.IS_EAGER_FORMAT) !== 0)
|
|
732
732
|
try {
|
|
733
733
|
return new q(t, s, !0);
|
|
@@ -761,7 +761,7 @@ function M(e, t, i, n) {
|
|
|
761
761
|
return e;
|
|
762
762
|
}
|
|
763
763
|
if (typeof s == "number") {
|
|
764
|
-
const c =
|
|
764
|
+
const c = Ot(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 });
|
|
@@ -769,7 +769,7 @@ function M(e, t, i, n) {
|
|
|
769
769
|
}
|
|
770
770
|
throw P(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 ? Rt(s, e, i, n) : e;
|
|
773
773
|
}
|
|
774
774
|
const r = s.mask, o = s._liveConfig;
|
|
775
775
|
if (o !== void 0 && o.type === ft.Value)
|
|
@@ -780,7 +780,7 @@ function M(e, t, 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 = Ot(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 });
|
|
@@ -788,12 +788,12 @@ function M(e, t, i, n) {
|
|
|
788
788
|
}
|
|
789
789
|
throw P(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 ? Rt(r, e, i, n) : e : (r & d.UNION) !== 0 ? ni(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 ? vt(e, s, i) : ie(e, s, i, n);
|
|
792
792
|
}
|
|
793
|
-
function
|
|
793
|
+
function ni(e, t, i, n, s) {
|
|
794
794
|
if (e === d.ARRAY) {
|
|
795
795
|
const r = i.shape[Q];
|
|
796
|
-
return r === void 0 || typeof r == "number" ? t :
|
|
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") {
|
|
@@ -802,15 +802,15 @@ function ti(e, t, i, n, s) {
|
|
|
802
802
|
throw new Error(
|
|
803
803
|
`Typename field '${r}' is required for union discrimination but was not found in the data`
|
|
804
804
|
);
|
|
805
|
-
return
|
|
805
|
+
return ee(t, c, n, s);
|
|
806
806
|
}
|
|
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 ? vt(t, a, n) : ie(t, a, n, s);
|
|
811
811
|
}
|
|
812
812
|
}
|
|
813
|
-
function
|
|
813
|
+
function te(e, t, i, n) {
|
|
814
814
|
const s = [];
|
|
815
815
|
for (let r = 0; r < e.length; r++)
|
|
816
816
|
try {
|
|
@@ -824,20 +824,20 @@ function Zt(e, t, i, n) {
|
|
|
824
824
|
}
|
|
825
825
|
return s;
|
|
826
826
|
}
|
|
827
|
-
function
|
|
828
|
-
for (const [s, r] of
|
|
827
|
+
function ee(e, t, i, n) {
|
|
828
|
+
for (const [s, r] of gt(e))
|
|
829
829
|
e[s] = M(r, t, i, `${n}["${s}"]`);
|
|
830
830
|
return e;
|
|
831
831
|
}
|
|
832
|
-
function
|
|
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
|
|
836
|
+
for (const [r, o] of gt(s))
|
|
837
837
|
e[r] = M(e[r], o, i, `${n}.${r}`);
|
|
838
838
|
return e;
|
|
839
839
|
}
|
|
840
|
-
function
|
|
840
|
+
function vt(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 gt(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
|
|
870
|
+
for (const [p, g] of gt(v))
|
|
871
871
|
l && !(p in e) || (c[p] = M(e[p], g, i, `${y}.${p}`));
|
|
872
872
|
return c;
|
|
873
873
|
}
|
|
874
|
-
function
|
|
875
|
-
return
|
|
874
|
+
function si(e, t) {
|
|
875
|
+
return ri(e, t.shape, t.typenameField);
|
|
876
876
|
}
|
|
877
|
-
function
|
|
877
|
+
function ri(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 ii(e, t, i) {
|
|
|
889
889
|
}
|
|
890
890
|
return !0;
|
|
891
891
|
}
|
|
892
|
-
const
|
|
892
|
+
const oi = Object.prototype, $ = /* @__PURE__ */ new WeakMap();
|
|
893
893
|
function A(e) {
|
|
894
894
|
if (typeof e != "object" || e === null) return e;
|
|
895
895
|
if (J.has(e)) return A(e.getValue());
|
|
896
896
|
if (x.has(e)) return e;
|
|
897
897
|
if (Array.isArray(e)) {
|
|
898
898
|
let t = $.get(e);
|
|
899
|
-
return t === void 0 && (t = new Proxy(e,
|
|
899
|
+
return t === void 0 && (t = new Proxy(e, ai), $.set(e, t)), t;
|
|
900
900
|
}
|
|
901
|
-
if (Object.getPrototypeOf(e) ===
|
|
901
|
+
if (Object.getPrototypeOf(e) === oi) {
|
|
902
902
|
let t = $.get(e);
|
|
903
|
-
return t === void 0 && (t = new Proxy(e,
|
|
903
|
+
return t === void 0 && (t = new Proxy(e, ci), $.set(e, t)), t;
|
|
904
904
|
}
|
|
905
905
|
return e;
|
|
906
906
|
}
|
|
907
|
-
const
|
|
907
|
+
const ai = {
|
|
908
908
|
get(e, t, i) {
|
|
909
909
|
if (typeof t == "string") {
|
|
910
910
|
const n = Number(t);
|
|
@@ -919,7 +919,7 @@ const si = {
|
|
|
919
919
|
deleteProperty() {
|
|
920
920
|
return !1;
|
|
921
921
|
}
|
|
922
|
-
},
|
|
922
|
+
}, ci = {
|
|
923
923
|
get(e, t, i) {
|
|
924
924
|
return typeof t == "string" ? A(e[t]) : Reflect.get(e, t, i);
|
|
925
925
|
},
|
|
@@ -938,8 +938,23 @@ const si = {
|
|
|
938
938
|
getOwnPropertyDescriptor(e, t) {
|
|
939
939
|
return Object.getOwnPropertyDescriptor(e, t);
|
|
940
940
|
}
|
|
941
|
-
}
|
|
942
|
-
|
|
941
|
+
}, fi = (e, t, i) => {
|
|
942
|
+
const n = e, s = Object.keys(n), r = t !== null && typeof t == "object" && !Array.isArray(t) ? t : void 0;
|
|
943
|
+
let o = !r || Object.keys(r).length !== s.length;
|
|
944
|
+
const a = {};
|
|
945
|
+
for (let c = 0; c < s.length; c++) {
|
|
946
|
+
const f = s[c], l = n[f];
|
|
947
|
+
let u;
|
|
948
|
+
typeof l == "function" ? u = l : u = i(l, r?.[f]), a[f] = u, !o && u !== r?.[f] && (o = !0);
|
|
949
|
+
}
|
|
950
|
+
return o ? a : r;
|
|
951
|
+
}, St = /* @__PURE__ */ new WeakSet();
|
|
952
|
+
function ne(e) {
|
|
953
|
+
const t = e.prototype;
|
|
954
|
+
St.has(t) || (St.add(t), Oe(e, fi));
|
|
955
|
+
}
|
|
956
|
+
ne(lt);
|
|
957
|
+
class ui {
|
|
943
958
|
_notifier;
|
|
944
959
|
_queryClient;
|
|
945
960
|
_proxies = /* @__PURE__ */ new Map();
|
|
@@ -1002,13 +1017,13 @@ class oi {
|
|
|
1002
1017
|
getProxy(t) {
|
|
1003
1018
|
const i = t;
|
|
1004
1019
|
let n = this._proxies.get(i);
|
|
1005
|
-
return n === void 0 && (n =
|
|
1020
|
+
return n === void 0 && (n = li(this, this.key, t, this._notifier, this._queryClient), this._proxies.set(i, n)), n;
|
|
1006
1021
|
}
|
|
1007
1022
|
get proxy() {
|
|
1008
1023
|
return this._proxies.values().next().value;
|
|
1009
1024
|
}
|
|
1010
1025
|
satisfiesDef(t) {
|
|
1011
|
-
return this.satisfiedDefs.has(t) ? !0 :
|
|
1026
|
+
return this.satisfiedDefs.has(t) ? !0 : si(this.data, t) ? (this.satisfiedDefs.add(t), !0) : !1;
|
|
1012
1027
|
}
|
|
1013
1028
|
save() {
|
|
1014
1029
|
this._queryClient.entityMap.save(this);
|
|
@@ -1020,7 +1035,7 @@ class oi {
|
|
|
1020
1035
|
this._notifier.consume();
|
|
1021
1036
|
}
|
|
1022
1037
|
}
|
|
1023
|
-
function
|
|
1038
|
+
function di(e, t, i) {
|
|
1024
1039
|
const n = [];
|
|
1025
1040
|
for (const s of e) {
|
|
1026
1041
|
if (typeof s != "object" || s === null) continue;
|
|
@@ -1031,12 +1046,12 @@ function ai(e, t, i) {
|
|
|
1031
1046
|
}
|
|
1032
1047
|
return n;
|
|
1033
1048
|
}
|
|
1034
|
-
function
|
|
1035
|
-
const r = i.shape ?? {}, o = i, a = o._methods, c = o._entityClass, f = o._entityConfig, l = c ? c.prototype :
|
|
1036
|
-
i.typenameField;
|
|
1049
|
+
function li(e, t, i, n, s) {
|
|
1050
|
+
const r = i.shape ?? {}, o = i, a = o._methods, c = o._entityClass, f = o._entityConfig, l = c ? c.prototype : lt.prototype;
|
|
1051
|
+
c !== void 0 && ne(c), i.typenameField;
|
|
1037
1052
|
const u = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), v = () => ({ __entityRef: t });
|
|
1038
1053
|
let p;
|
|
1039
|
-
f?.hasSubscribe && a && "__subscribe" in a && (p =
|
|
1054
|
+
f?.hasSubscribe && a && "__subscribe" in a && (p = kt((E) => {
|
|
1040
1055
|
const h = (b) => {
|
|
1041
1056
|
b.__eventSource = t, s.applyMutationEvent(b);
|
|
1042
1057
|
}, m = a.__subscribe.call(g, h);
|
|
@@ -1081,7 +1096,7 @@ function ci(e, t, i, n, s) {
|
|
|
1081
1096
|
}
|
|
1082
1097
|
if (a && h in a) {
|
|
1083
1098
|
let C = u.get(h);
|
|
1084
|
-
return C || (C =
|
|
1099
|
+
return C || (C = _e(g, a[h].bind(g)), u.set(h, C)), C;
|
|
1085
1100
|
}
|
|
1086
1101
|
}
|
|
1087
1102
|
const m = e.data[h];
|
|
@@ -1094,13 +1109,13 @@ function ci(e, t, i, n, s) {
|
|
|
1094
1109
|
if (S instanceof _ && (S.mask & d.ENTITY) !== 0) {
|
|
1095
1110
|
const C = S.typenameValue;
|
|
1096
1111
|
if (C !== void 0) {
|
|
1097
|
-
const
|
|
1098
|
-
if (
|
|
1112
|
+
const wt = s.getEntityDefsForTypename(C);
|
|
1113
|
+
if (wt !== void 0 && wt.length > 1) {
|
|
1099
1114
|
const X = y.get(h);
|
|
1100
1115
|
if (X !== void 0 && X.source === m)
|
|
1101
1116
|
return A(X.filtered);
|
|
1102
|
-
const
|
|
1103
|
-
return y.set(h, { source: m, filtered:
|
|
1117
|
+
const Et = di(m, S, s);
|
|
1118
|
+
return y.set(h, { source: m, filtered: Et }), A(Et);
|
|
1104
1119
|
}
|
|
1105
1120
|
}
|
|
1106
1121
|
}
|
|
@@ -1142,9 +1157,9 @@ function ci(e, t, i, n, s) {
|
|
|
1142
1157
|
}
|
|
1143
1158
|
}
|
|
1144
1159
|
};
|
|
1145
|
-
return g = new Proxy({}, R), x.set(g, t),
|
|
1160
|
+
return g = new Proxy({}, R), x.set(g, t), ve(g, s), g;
|
|
1146
1161
|
}
|
|
1147
|
-
class
|
|
1162
|
+
class hi {
|
|
1148
1163
|
instances = /* @__PURE__ */ new Map();
|
|
1149
1164
|
persistEntity;
|
|
1150
1165
|
constructor(t) {
|
|
@@ -1166,7 +1181,7 @@ class fi {
|
|
|
1166
1181
|
if (typeof a != "string" && typeof a != "number")
|
|
1167
1182
|
throw new Error(`Entity id must be string or number: ${n.typenameValue}`);
|
|
1168
1183
|
const c = n;
|
|
1169
|
-
r = new
|
|
1184
|
+
r = new ui(t, n.typenameValue, a, o, i, s), r._entityCache = c._entityCache, this.instances.set(t, r);
|
|
1170
1185
|
}
|
|
1171
1186
|
return r.parseId = s.currentParseId, r;
|
|
1172
1187
|
}
|
|
@@ -1182,13 +1197,13 @@ class fi {
|
|
|
1182
1197
|
this.persistEntity(t.key, t.data, i);
|
|
1183
1198
|
}
|
|
1184
1199
|
}
|
|
1185
|
-
class
|
|
1200
|
+
class se {
|
|
1186
1201
|
onlineSignal;
|
|
1187
1202
|
manualOverride = void 0;
|
|
1188
1203
|
eventListenersAttached = !1;
|
|
1189
1204
|
constructor(t) {
|
|
1190
1205
|
const i = t ?? this.detectOnlineStatus();
|
|
1191
|
-
this.onlineSignal =
|
|
1206
|
+
this.onlineSignal = Ft(i), this.canAttachListeners() && this.attachEventListeners();
|
|
1192
1207
|
}
|
|
1193
1208
|
/**
|
|
1194
1209
|
* Returns true if the network is currently online
|
|
@@ -1246,8 +1261,8 @@ class ie {
|
|
|
1246
1261
|
}, window.addEventListener("online", this.handleOnline), window.addEventListener("offline", this.handleOffline), this.eventListenersAttached = !0);
|
|
1247
1262
|
}
|
|
1248
1263
|
}
|
|
1249
|
-
class
|
|
1250
|
-
static onlineSignal =
|
|
1264
|
+
class re {
|
|
1265
|
+
static onlineSignal = Ft(!0);
|
|
1251
1266
|
get isOnline() {
|
|
1252
1267
|
return !0;
|
|
1253
1268
|
}
|
|
@@ -1256,19 +1271,19 @@ class ne {
|
|
|
1256
1271
|
clearManualOverride() {
|
|
1257
1272
|
}
|
|
1258
1273
|
getOnlineSignal() {
|
|
1259
|
-
return
|
|
1274
|
+
return re.onlineSignal;
|
|
1260
1275
|
}
|
|
1261
1276
|
destroy() {
|
|
1262
1277
|
}
|
|
1263
1278
|
}
|
|
1264
|
-
const
|
|
1265
|
-
function
|
|
1279
|
+
const yi = new se(), Fi = Tt(yi);
|
|
1280
|
+
function _t(e, t = typeof window > "u") {
|
|
1266
1281
|
let i;
|
|
1267
1282
|
e === !1 ? i = 0 : e === void 0 || e === !0 ? i = t ? 0 : 3 : typeof e == "number" ? i = e : i = e.retries;
|
|
1268
1283
|
const n = typeof e == "object" && e.retryDelay ? e.retryDelay : (s) => 1e3 * Math.pow(2, s);
|
|
1269
1284
|
return { retries: i, retryDelay: n };
|
|
1270
1285
|
}
|
|
1271
|
-
class
|
|
1286
|
+
class Ti {
|
|
1272
1287
|
static cache;
|
|
1273
1288
|
/**
|
|
1274
1289
|
* The adapter class responsible for sending requests for this query type.
|
|
@@ -1278,10 +1293,10 @@ class Ni {
|
|
|
1278
1293
|
params;
|
|
1279
1294
|
config;
|
|
1280
1295
|
constructor() {
|
|
1281
|
-
return
|
|
1296
|
+
return Vt(this);
|
|
1282
1297
|
}
|
|
1283
1298
|
}
|
|
1284
|
-
const
|
|
1299
|
+
const At = /* @__PURE__ */ new WeakMap();
|
|
1285
1300
|
class V {
|
|
1286
1301
|
constructor(t, i) {
|
|
1287
1302
|
this.captured = i, this.statics = t;
|
|
@@ -1291,14 +1306,14 @@ class V {
|
|
|
1291
1306
|
return et(this.captured, t, i);
|
|
1292
1307
|
}
|
|
1293
1308
|
resolveOptions(t) {
|
|
1294
|
-
const { methods: i } = this.captured, n = i.getConfig ? i.getConfig.call(t) : t.config, s =
|
|
1309
|
+
const { methods: i } = this.captured, n = i.getConfig ? i.getConfig.call(t) : t.config, s = _t(n?.retry);
|
|
1295
1310
|
return { config: n, retryConfig: s };
|
|
1296
1311
|
}
|
|
1297
1312
|
static for(t) {
|
|
1298
|
-
let i =
|
|
1313
|
+
let i = At.get(t);
|
|
1299
1314
|
if (i !== void 0)
|
|
1300
1315
|
return i;
|
|
1301
|
-
const n = new t(), s =
|
|
1316
|
+
const n = new t(), s = ke(n), r = String(s.methods.getIdentityKey.call(s.fields)), o = s.fields.result, a = o instanceof _ ? o : ti.object(o), c = (a.mask & d.ENTITY) !== 0, f = t.cache, l = s.fields.fetchNext, u = t.adapter;
|
|
1302
1317
|
if (!u)
|
|
1303
1318
|
throw new Error(
|
|
1304
1319
|
`Query class "${t.name}" must define a static \`adapter\` property. Extend RESTQuery (from fetchium/rest) or set \`static adapter = MyAdapter\` on your query class.`
|
|
@@ -1310,21 +1325,21 @@ class V {
|
|
|
1310
1325
|
void 0,
|
|
1311
1326
|
r,
|
|
1312
1327
|
// typenameValue — unique per query class
|
|
1313
|
-
|
|
1328
|
+
jt
|
|
1314
1329
|
// idField — symbol, injected onto payload before parse
|
|
1315
1330
|
);
|
|
1316
1331
|
return i = new V(
|
|
1317
1332
|
{ id: r, shape: v, cache: f, rawFetchNext: l, hasSendNext: y, isEntityResult: c, adapterClass: u },
|
|
1318
1333
|
s
|
|
1319
|
-
),
|
|
1334
|
+
), At.set(t, i), i;
|
|
1320
1335
|
}
|
|
1321
1336
|
}
|
|
1322
|
-
const
|
|
1337
|
+
const Pi = (e, t) => {
|
|
1323
1338
|
const i = V.for(e);
|
|
1324
|
-
return
|
|
1339
|
+
return mt(i, t);
|
|
1325
1340
|
};
|
|
1326
|
-
function
|
|
1327
|
-
const i = V.for(e), n =
|
|
1341
|
+
function ji(e, ...t) {
|
|
1342
|
+
const i = V.for(e), n = me(Si);
|
|
1328
1343
|
if (n === void 0)
|
|
1329
1344
|
throw new Error("QueryClient not found");
|
|
1330
1345
|
const s = t[0];
|
|
@@ -1337,7 +1352,7 @@ function rt(e) {
|
|
|
1337
1352
|
const t = new Error("The operation was aborted");
|
|
1338
1353
|
return t.name = "AbortError", t;
|
|
1339
1354
|
}
|
|
1340
|
-
function
|
|
1355
|
+
function oe(e, t) {
|
|
1341
1356
|
return new Promise((i, n) => {
|
|
1342
1357
|
if (t?.aborted) {
|
|
1343
1358
|
n(rt(t));
|
|
@@ -1363,12 +1378,12 @@ async function ot(e, t, i) {
|
|
|
1363
1378
|
return await e();
|
|
1364
1379
|
} catch (o) {
|
|
1365
1380
|
if (s = o, r >= n) throw o;
|
|
1366
|
-
await
|
|
1381
|
+
await oe(t.retryDelay(r), i);
|
|
1367
1382
|
}
|
|
1368
1383
|
}
|
|
1369
1384
|
throw s;
|
|
1370
1385
|
}
|
|
1371
|
-
class
|
|
1386
|
+
class pi {
|
|
1372
1387
|
def;
|
|
1373
1388
|
queryKey;
|
|
1374
1389
|
storageKey = -1;
|
|
@@ -1380,12 +1395,13 @@ class di {
|
|
|
1380
1395
|
params = void 0;
|
|
1381
1396
|
unsubscribe = void 0;
|
|
1382
1397
|
_relayState = void 0;
|
|
1398
|
+
_isActive = !1;
|
|
1383
1399
|
wasPaused = !1;
|
|
1384
1400
|
currentParams = void 0;
|
|
1385
1401
|
debounceTimer = void 0;
|
|
1386
1402
|
/** Resolved per-instance options (depend on actual params). */
|
|
1387
1403
|
config = void 0;
|
|
1388
|
-
retryConfig =
|
|
1404
|
+
retryConfig = _t(void 0);
|
|
1389
1405
|
/** Cancels in-flight fetches and retry waits. */
|
|
1390
1406
|
_abortController = void 0;
|
|
1391
1407
|
/** Cached execution context, recreated only when storageKey (params) changes. */
|
|
@@ -1406,13 +1422,13 @@ class di {
|
|
|
1406
1422
|
}
|
|
1407
1423
|
constructor(t, i, n, s) {
|
|
1408
1424
|
this.def = t, this.queryClient = i, this.queryKey = n, this.params = s, this._extraMethods = { __refetch: this.refetch }, t.statics.hasSendNext && (this._extraMethods.__fetchNext = this.fetchNext);
|
|
1409
|
-
const r =
|
|
1410
|
-
this._queryId = r !== void 0 ? D(r) : 0, this.relay =
|
|
1425
|
+
const r = Mt(s);
|
|
1426
|
+
this._queryId = r !== void 0 ? D(r) : 0, this.relay = kt(
|
|
1411
1427
|
(o) => {
|
|
1412
1428
|
this._relayState = o;
|
|
1413
1429
|
const a = () => {
|
|
1414
|
-
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;
|
|
1415
|
-
const f = this.config?.gcTime ??
|
|
1430
|
+
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
|
+
const f = this.config?.gcTime ?? Pt;
|
|
1416
1432
|
this.queryClient.gcManager.schedule(this.queryKey, f, z.Query);
|
|
1417
1433
|
}, c = (f = !1) => {
|
|
1418
1434
|
const { wasPaused: l, isPaused: u, initialized: y } = this;
|
|
@@ -1420,7 +1436,8 @@ class di {
|
|
|
1420
1436
|
a();
|
|
1421
1437
|
return;
|
|
1422
1438
|
}
|
|
1423
|
-
|
|
1439
|
+
this._isActive = !0;
|
|
1440
|
+
const v = Mt(this.params), p = mt(this.def, v), g = p !== this.storageKey;
|
|
1424
1441
|
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());
|
|
1425
1442
|
};
|
|
1426
1443
|
return c(!0), {
|
|
@@ -1470,7 +1487,7 @@ class di {
|
|
|
1470
1487
|
if (!this.isPaused)
|
|
1471
1488
|
try {
|
|
1472
1489
|
if (n !== void 0 && this.setupSubscription(), n === void 0 || this.isStale) {
|
|
1473
|
-
if (await
|
|
1490
|
+
if (await oe(0), this.isPaused) return;
|
|
1474
1491
|
this.runQueryImmediately();
|
|
1475
1492
|
}
|
|
1476
1493
|
} catch (s) {
|
|
@@ -1527,7 +1544,7 @@ class di {
|
|
|
1527
1544
|
// ======================================================
|
|
1528
1545
|
refetch = () => this.relayState.isPending ? this.relay : (this.runQueryImmediately(), this.relay);
|
|
1529
1546
|
markStale() {
|
|
1530
|
-
this.updatedAt = 0;
|
|
1547
|
+
this.updatedAt = 0, this._isActive && !this.isPaused && this.runDebounced();
|
|
1531
1548
|
}
|
|
1532
1549
|
get resolvedParams() {
|
|
1533
1550
|
return this.currentParams;
|
|
@@ -1578,21 +1595,21 @@ class di {
|
|
|
1578
1595
|
return Date.now() - this.updatedAt >= t;
|
|
1579
1596
|
}
|
|
1580
1597
|
get isPaused() {
|
|
1581
|
-
const t = this.config?.networkMode ??
|
|
1582
|
-
if (t ===
|
|
1598
|
+
const t = this.config?.networkMode ?? j.Online;
|
|
1599
|
+
if (t === j.Always)
|
|
1583
1600
|
return !1;
|
|
1584
1601
|
const i = this.queryClient.networkManager.getOnlineSignal().value;
|
|
1585
1602
|
switch (t) {
|
|
1586
|
-
case
|
|
1603
|
+
case j.Online:
|
|
1587
1604
|
return !i;
|
|
1588
|
-
case
|
|
1605
|
+
case j.OfflineFirst:
|
|
1589
1606
|
return !i && this.updatedAt === void 0;
|
|
1590
1607
|
default:
|
|
1591
1608
|
return !1;
|
|
1592
1609
|
}
|
|
1593
1610
|
}
|
|
1594
1611
|
}
|
|
1595
|
-
class
|
|
1612
|
+
class gi {
|
|
1596
1613
|
def;
|
|
1597
1614
|
queryClient;
|
|
1598
1615
|
_inFlight = !1;
|
|
@@ -1601,7 +1618,7 @@ class li {
|
|
|
1601
1618
|
this.def = t, this.queryClient = i, this.task = this.createTask();
|
|
1602
1619
|
}
|
|
1603
1620
|
createTask() {
|
|
1604
|
-
return
|
|
1621
|
+
return we(
|
|
1605
1622
|
async (t) => {
|
|
1606
1623
|
if (this._inFlight)
|
|
1607
1624
|
throw new Error("A mutation is already in progress. Await the previous call before starting a new one.");
|
|
@@ -1622,7 +1639,7 @@ class li {
|
|
|
1622
1639
|
return t;
|
|
1623
1640
|
const n = this.queryClient.getContext().log?.warn ?? (() => {
|
|
1624
1641
|
}), s = new st();
|
|
1625
|
-
return s.reset(void 0, void 0, n),
|
|
1642
|
+
return s.reset(void 0, void 0, n), Zt(t, i, s);
|
|
1626
1643
|
}
|
|
1627
1644
|
// ======================================================
|
|
1628
1645
|
// Effects processing
|
|
@@ -1648,7 +1665,7 @@ class li {
|
|
|
1648
1665
|
// Retry logic
|
|
1649
1666
|
// ======================================================
|
|
1650
1667
|
executeWithRetry(t) {
|
|
1651
|
-
const i =
|
|
1668
|
+
const i = _t(this.def.config?.retry, !0), n = this.queryClient.getAdapter(this.def.adapterClass);
|
|
1652
1669
|
if (!n.sendMutation)
|
|
1653
1670
|
throw new Error(
|
|
1654
1671
|
`Adapter "${this.def.adapterClass.name}" does not implement sendMutation(). Add a sendMutation() method to handle mutations.`
|
|
@@ -1663,24 +1680,24 @@ class li {
|
|
|
1663
1680
|
}, i);
|
|
1664
1681
|
}
|
|
1665
1682
|
}
|
|
1666
|
-
function
|
|
1683
|
+
function vi(e) {
|
|
1667
1684
|
return typeof e == "string" ? e : T(e).typenameValue;
|
|
1668
1685
|
}
|
|
1669
1686
|
function Z(e, t, i) {
|
|
1670
1687
|
if (e)
|
|
1671
1688
|
for (const [n, s] of e) {
|
|
1672
|
-
const r =
|
|
1689
|
+
const r = vi(n);
|
|
1673
1690
|
r !== void 0 && i.applyMutationEvent({ type: t, typename: r, data: s });
|
|
1674
1691
|
}
|
|
1675
1692
|
}
|
|
1676
|
-
const
|
|
1677
|
-
function
|
|
1693
|
+
const ae = "__eventSource";
|
|
1694
|
+
function ce(e) {
|
|
1678
1695
|
return { field: e, segments: e.indexOf(".") !== -1 ? e.split(".") : void 0 };
|
|
1679
1696
|
}
|
|
1680
|
-
function
|
|
1681
|
-
return e.map(
|
|
1697
|
+
function _i(e) {
|
|
1698
|
+
return e.map(ce);
|
|
1682
1699
|
}
|
|
1683
|
-
function
|
|
1700
|
+
function mi(e, t) {
|
|
1684
1701
|
if (t.segments === void 0) return e[t.field];
|
|
1685
1702
|
let i = e;
|
|
1686
1703
|
for (const n of t.segments) {
|
|
@@ -1689,16 +1706,16 @@ function pi(e, t) {
|
|
|
1689
1706
|
}
|
|
1690
1707
|
return i;
|
|
1691
1708
|
}
|
|
1692
|
-
function
|
|
1709
|
+
function fe(e, t) {
|
|
1693
1710
|
const i = [];
|
|
1694
1711
|
for (let n = 0; n < t.length; n++) {
|
|
1695
|
-
const s = t[n], r =
|
|
1712
|
+
const s = t[n], r = mi(e, s);
|
|
1696
1713
|
if (r === void 0) return;
|
|
1697
1714
|
i.push(s.field, r);
|
|
1698
1715
|
}
|
|
1699
1716
|
return D(i);
|
|
1700
1717
|
}
|
|
1701
|
-
function
|
|
1718
|
+
function wi(e, t) {
|
|
1702
1719
|
if (e === void 0) return;
|
|
1703
1720
|
const i = /* @__PURE__ */ new Map();
|
|
1704
1721
|
for (const [n, s] of e) {
|
|
@@ -1706,8 +1723,8 @@ function gi(e, t) {
|
|
|
1706
1723
|
let a = !0;
|
|
1707
1724
|
for (const [c, f] of r) {
|
|
1708
1725
|
let l;
|
|
1709
|
-
if (
|
|
1710
|
-
const u =
|
|
1726
|
+
if (qt(f)) {
|
|
1727
|
+
const u = Ut(f);
|
|
1711
1728
|
l = dt(u, t);
|
|
1712
1729
|
} else
|
|
1713
1730
|
l = f;
|
|
@@ -1721,17 +1738,17 @@ function gi(e, t) {
|
|
|
1721
1738
|
}
|
|
1722
1739
|
return i.size > 0 ? i : void 0;
|
|
1723
1740
|
}
|
|
1724
|
-
function
|
|
1741
|
+
function Dt(e, t) {
|
|
1725
1742
|
const i = e.get(t);
|
|
1726
1743
|
if (i !== void 0)
|
|
1727
1744
|
return i.map(([n]) => n).sort();
|
|
1728
1745
|
}
|
|
1729
|
-
class
|
|
1746
|
+
class Ei {
|
|
1730
1747
|
fields;
|
|
1731
1748
|
fieldPaths;
|
|
1732
1749
|
_bindings = /* @__PURE__ */ new Map();
|
|
1733
1750
|
constructor(t) {
|
|
1734
|
-
this.fields = t, this.fieldPaths = t.map(
|
|
1751
|
+
this.fields = t, this.fieldPaths = t.map(ce);
|
|
1735
1752
|
}
|
|
1736
1753
|
register(t, i) {
|
|
1737
1754
|
let n = this._bindings.get(t);
|
|
@@ -1748,38 +1765,38 @@ class vi {
|
|
|
1748
1765
|
return this._bindings.size === 0;
|
|
1749
1766
|
}
|
|
1750
1767
|
}
|
|
1751
|
-
function
|
|
1768
|
+
function It(e) {
|
|
1752
1769
|
return D(e);
|
|
1753
1770
|
}
|
|
1754
|
-
class
|
|
1771
|
+
class bi {
|
|
1755
1772
|
_groups = /* @__PURE__ */ new Map();
|
|
1756
1773
|
getOrCreateGroup(t) {
|
|
1757
|
-
const i =
|
|
1774
|
+
const i = It(t);
|
|
1758
1775
|
let n = this._groups.get(i);
|
|
1759
|
-
return n === void 0 && (n = new
|
|
1776
|
+
return n === void 0 && (n = new Ei(t), this._groups.set(i, n)), n;
|
|
1760
1777
|
}
|
|
1761
1778
|
register(t, i, n) {
|
|
1762
1779
|
this.getOrCreateGroup(i).register(t, n);
|
|
1763
1780
|
}
|
|
1764
1781
|
unregister(t, i, n) {
|
|
1765
|
-
const s =
|
|
1782
|
+
const s = It(i), r = this._groups.get(s);
|
|
1766
1783
|
r !== void 0 && (r.unregister(t, n), r.isEmpty && this._groups.delete(s));
|
|
1767
1784
|
}
|
|
1768
1785
|
registerBinding(t, i) {
|
|
1769
1786
|
const n = t._constraintHashes.get(i);
|
|
1770
1787
|
if (n === void 0) return;
|
|
1771
|
-
const s =
|
|
1788
|
+
const s = Dt(t._constraintFieldRefs, i);
|
|
1772
1789
|
s !== void 0 && this.register(n, s, t);
|
|
1773
1790
|
}
|
|
1774
1791
|
unregisterBinding(t, i) {
|
|
1775
1792
|
const n = t._constraintHashes.get(i);
|
|
1776
1793
|
if (n === void 0) return;
|
|
1777
|
-
const s =
|
|
1794
|
+
const s = Dt(t._constraintFieldRefs, i);
|
|
1778
1795
|
s !== void 0 && this.unregister(n, s, t);
|
|
1779
1796
|
}
|
|
1780
1797
|
routeEvent(t, i, n, s, r, o) {
|
|
1781
1798
|
for (const a of this._groups.values()) {
|
|
1782
|
-
const c =
|
|
1799
|
+
const c = fe(i, a.fieldPaths);
|
|
1783
1800
|
if (c === void 0) continue;
|
|
1784
1801
|
const f = a.getMatching(c);
|
|
1785
1802
|
if (f !== void 0)
|
|
@@ -1788,7 +1805,7 @@ class _i {
|
|
|
1788
1805
|
}
|
|
1789
1806
|
}
|
|
1790
1807
|
}
|
|
1791
|
-
function
|
|
1808
|
+
function Nt(e) {
|
|
1792
1809
|
const t = /* @__PURE__ */ new Set();
|
|
1793
1810
|
for (const i of e)
|
|
1794
1811
|
if (typeof i == "object" && i !== null) {
|
|
@@ -1797,7 +1814,7 @@ function Dt(e) {
|
|
|
1797
1814
|
}
|
|
1798
1815
|
return t;
|
|
1799
1816
|
}
|
|
1800
|
-
class
|
|
1817
|
+
class ue {
|
|
1801
1818
|
_queryClient;
|
|
1802
1819
|
_parent;
|
|
1803
1820
|
_constraintHashes;
|
|
@@ -1847,7 +1864,7 @@ class ce {
|
|
|
1847
1864
|
i !== -1 && t.splice(i, 1);
|
|
1848
1865
|
}
|
|
1849
1866
|
}
|
|
1850
|
-
class
|
|
1867
|
+
class Ci {
|
|
1851
1868
|
_notifier;
|
|
1852
1869
|
_items;
|
|
1853
1870
|
_keys;
|
|
@@ -1855,9 +1872,9 @@ class mi {
|
|
|
1855
1872
|
_queryClient;
|
|
1856
1873
|
_parent;
|
|
1857
1874
|
constructor(t, i, n, s, r, o) {
|
|
1858
|
-
this._notifier = ct(), this._items = n, this._keys =
|
|
1875
|
+
this._notifier = ct(), this._items = n, this._keys = Nt(n), this._queryClient = t, this._parent = i;
|
|
1859
1876
|
const a = s !== void 0 && r !== void 0, c = o !== void 0;
|
|
1860
|
-
(a || c) && (this._outputSignal =
|
|
1877
|
+
(a || c) && (this._outputSignal = Ee(() => {
|
|
1861
1878
|
this._notifier.consume();
|
|
1862
1879
|
let f = this._items;
|
|
1863
1880
|
if (a) {
|
|
@@ -1877,7 +1894,7 @@ class mi {
|
|
|
1877
1894
|
l.push(u);
|
|
1878
1895
|
continue;
|
|
1879
1896
|
}
|
|
1880
|
-
v.consume(),
|
|
1897
|
+
v.consume(), fe(v.data, s) === r && l.push(u);
|
|
1881
1898
|
}
|
|
1882
1899
|
f = l;
|
|
1883
1900
|
}
|
|
@@ -1922,7 +1939,7 @@ class mi {
|
|
|
1922
1939
|
}
|
|
1923
1940
|
reset(t) {
|
|
1924
1941
|
const i = this._items, n = Array.isArray(t) ? t : [];
|
|
1925
|
-
this._items = n, this._keys =
|
|
1942
|
+
this._items = n, this._keys = Nt(n);
|
|
1926
1943
|
for (const s of n)
|
|
1927
1944
|
if (typeof s == "object" && s !== null) {
|
|
1928
1945
|
const r = k(s);
|
|
@@ -1958,7 +1975,7 @@ class mi {
|
|
|
1958
1975
|
return -1;
|
|
1959
1976
|
}
|
|
1960
1977
|
}
|
|
1961
|
-
class
|
|
1978
|
+
class xi {
|
|
1962
1979
|
_notifier;
|
|
1963
1980
|
_value;
|
|
1964
1981
|
_createdKeys;
|
|
@@ -1999,16 +2016,16 @@ class wi {
|
|
|
1999
2016
|
append(t) {
|
|
2000
2017
|
}
|
|
2001
2018
|
}
|
|
2002
|
-
function
|
|
2019
|
+
function de(e, t, i, n, s) {
|
|
2003
2020
|
let r = e.constraintFieldRefs;
|
|
2004
2021
|
if (r === void 0) {
|
|
2005
2022
|
r = /* @__PURE__ */ new Map();
|
|
2006
2023
|
for (const f of e.entityDefs) {
|
|
2007
2024
|
const l = f.typenameValue;
|
|
2008
|
-
l !== void 0 && r.set(l, [[
|
|
2025
|
+
l !== void 0 && r.set(l, [[ae, i.key]]);
|
|
2009
2026
|
}
|
|
2010
2027
|
}
|
|
2011
|
-
const o =
|
|
2028
|
+
const o = wi(r, n) ?? /* @__PURE__ */ new Map();
|
|
2012
2029
|
let a;
|
|
2013
2030
|
if (e.type === ft.Array) {
|
|
2014
2031
|
let f, l;
|
|
@@ -2018,11 +2035,11 @@ function fe(e, t, i, n, s) {
|
|
|
2018
2035
|
if (y !== void 0) {
|
|
2019
2036
|
l = y;
|
|
2020
2037
|
const v = e.constraintFieldRefs.get(u);
|
|
2021
|
-
v !== void 0 && (f =
|
|
2038
|
+
v !== void 0 && (f = _i(v.map(([p]) => p)));
|
|
2022
2039
|
break;
|
|
2023
2040
|
}
|
|
2024
2041
|
}
|
|
2025
|
-
a = new
|
|
2042
|
+
a = new Ci(
|
|
2026
2043
|
s,
|
|
2027
2044
|
i,
|
|
2028
2045
|
Array.isArray(t) ? t : [],
|
|
@@ -2031,7 +2048,7 @@ function fe(e, t, i, n, s) {
|
|
|
2031
2048
|
e.sort
|
|
2032
2049
|
);
|
|
2033
2050
|
} else
|
|
2034
|
-
a = new
|
|
2051
|
+
a = new xi(
|
|
2035
2052
|
s,
|
|
2036
2053
|
i,
|
|
2037
2054
|
t,
|
|
@@ -2039,7 +2056,7 @@ function fe(e, t, i, n, s) {
|
|
|
2039
2056
|
e.onUpdate,
|
|
2040
2057
|
e.onDelete
|
|
2041
2058
|
);
|
|
2042
|
-
const c = new
|
|
2059
|
+
const c = new ue(
|
|
2043
2060
|
e.entityDefs,
|
|
2044
2061
|
r,
|
|
2045
2062
|
s,
|
|
@@ -2049,7 +2066,7 @@ function fe(e, t, i, n, s) {
|
|
|
2049
2066
|
);
|
|
2050
2067
|
return i.liveCollections.push(c), s.registerLiveCollection(c), c;
|
|
2051
2068
|
}
|
|
2052
|
-
const
|
|
2069
|
+
const le = Object.entries, he = Object.prototype;
|
|
2053
2070
|
function tt(e, t, i, n = !1) {
|
|
2054
2071
|
const s = e.queryClient;
|
|
2055
2072
|
s.currentParseId++;
|
|
@@ -2060,7 +2077,7 @@ function U(e, t, i, n, s, r) {
|
|
|
2060
2077
|
if (typeof e != "object" || e === null) return e;
|
|
2061
2078
|
const o = t.get(e);
|
|
2062
2079
|
if (o !== void 0)
|
|
2063
|
-
return
|
|
2080
|
+
return Oi(o, t, i, n, s, r);
|
|
2064
2081
|
if (Array.isArray(e)) {
|
|
2065
2082
|
for (let a = 0; a < e.length; a++) {
|
|
2066
2083
|
const c = e[a];
|
|
@@ -2068,7 +2085,7 @@ function U(e, t, i, n, s, r) {
|
|
|
2068
2085
|
}
|
|
2069
2086
|
return e;
|
|
2070
2087
|
}
|
|
2071
|
-
if (Object.getPrototypeOf(e) ===
|
|
2088
|
+
if (Object.getPrototypeOf(e) === he && !x.has(e)) {
|
|
2072
2089
|
const a = e;
|
|
2073
2090
|
for (const c of Object.keys(a)) {
|
|
2074
2091
|
const f = a[c];
|
|
@@ -2077,12 +2094,12 @@ function U(e, t, i, n, s, r) {
|
|
|
2077
2094
|
}
|
|
2078
2095
|
return e;
|
|
2079
2096
|
}
|
|
2080
|
-
function
|
|
2097
|
+
function ye(e) {
|
|
2081
2098
|
return typeof e == "object" && e !== null && !(e instanceof q) && !x.has(e);
|
|
2082
2099
|
}
|
|
2083
|
-
function
|
|
2100
|
+
function Oi(e, t, i, n, s, r) {
|
|
2084
2101
|
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();
|
|
2085
|
-
if (v ? (
|
|
2102
|
+
if (v ? (pe(
|
|
2086
2103
|
l,
|
|
2087
2104
|
a,
|
|
2088
2105
|
y,
|
|
@@ -2094,7 +2111,7 @@ function Ei(e, t, i, n, s, r) {
|
|
|
2094
2111
|
n,
|
|
2095
2112
|
p,
|
|
2096
2113
|
r
|
|
2097
|
-
), u.notify()) :
|
|
2114
|
+
), u.notify()) : ge(l, a, u, a, t, i, n, p, r), r && u.liveCollections.length > 0)
|
|
2098
2115
|
for (const w of u.liveCollections) {
|
|
2099
2116
|
const I = w.instance.getRawValue();
|
|
2100
2117
|
if (Array.isArray(I))
|
|
@@ -2110,12 +2127,12 @@ function Ei(e, t, i, n, s, r) {
|
|
|
2110
2127
|
const g = u.getProxy(c);
|
|
2111
2128
|
return s.set(u, (s.get(u) ?? 0) + 1), g;
|
|
2112
2129
|
}
|
|
2113
|
-
function
|
|
2114
|
-
for (const [u, y] of
|
|
2130
|
+
function pe(e, t, i, n, s, r, o, a, c, f, l) {
|
|
2131
|
+
for (const [u, y] of le(e))
|
|
2115
2132
|
if (!(n !== void 0 && !n.has(u)))
|
|
2116
|
-
if (
|
|
2133
|
+
if (ye(t[u]) && (t[u] = U(t[u], o, a, c, f, l)), y instanceof _ && y._liveConfig !== void 0) {
|
|
2117
2134
|
const v = i[u];
|
|
2118
|
-
v instanceof
|
|
2135
|
+
v instanceof ue ? l ? v.append(t[u]) : v.reset(t[u]) : i[u] = de(
|
|
2119
2136
|
y._liveConfig,
|
|
2120
2137
|
t[u],
|
|
2121
2138
|
s,
|
|
@@ -2127,7 +2144,7 @@ function he(e, t, i, n, s, r, o, a, c, f, l) {
|
|
|
2127
2144
|
if (at(v) && at(p)) {
|
|
2128
2145
|
const g = y instanceof _ && y.shape !== void 0 ? y.shape : void 0;
|
|
2129
2146
|
if (g !== void 0)
|
|
2130
|
-
|
|
2147
|
+
pe(
|
|
2131
2148
|
g,
|
|
2132
2149
|
v,
|
|
2133
2150
|
p,
|
|
@@ -2148,11 +2165,11 @@ function he(e, t, i, n, s, r, o, a, c, f, l) {
|
|
|
2148
2165
|
i[u] = v;
|
|
2149
2166
|
}
|
|
2150
2167
|
}
|
|
2151
|
-
function
|
|
2152
|
-
for (const [f, l] of
|
|
2168
|
+
function ge(e, t, i, n, s, r, o, a, c) {
|
|
2169
|
+
for (const [f, l] of le(e))
|
|
2153
2170
|
if (f in t)
|
|
2154
|
-
if (
|
|
2155
|
-
t[f] =
|
|
2171
|
+
if (ye(t[f]) && (t[f] = U(t[f], s, r, o, a, c)), l instanceof _ && l._liveConfig !== void 0)
|
|
2172
|
+
t[f] = de(
|
|
2156
2173
|
l._liveConfig,
|
|
2157
2174
|
t[f],
|
|
2158
2175
|
i,
|
|
@@ -2163,30 +2180,30 @@ function ye(e, t, i, n, s, r, o, a, c) {
|
|
|
2163
2180
|
const u = t[f];
|
|
2164
2181
|
if (at(u)) {
|
|
2165
2182
|
const y = l instanceof _ && l.shape !== void 0 ? l.shape : void 0;
|
|
2166
|
-
y !== void 0 &&
|
|
2183
|
+
y !== void 0 && ge(y, u, i, n, s, r, o, a, c);
|
|
2167
2184
|
}
|
|
2168
2185
|
}
|
|
2169
2186
|
}
|
|
2170
2187
|
function at(e) {
|
|
2171
|
-
return typeof e == "object" && e !== null && !Array.isArray(e) && Object.getPrototypeOf(e) ===
|
|
2188
|
+
return typeof e == "object" && e !== null && !Array.isArray(e) && Object.getPrototypeOf(e) === he && !x.has(e);
|
|
2172
2189
|
}
|
|
2173
|
-
function
|
|
2190
|
+
function Li(e) {
|
|
2174
2191
|
if (e !== void 0)
|
|
2175
2192
|
return typeof e == "string" ? e : typeof e == "function" ? e() : e.value;
|
|
2176
2193
|
}
|
|
2177
|
-
function
|
|
2178
|
-
return
|
|
2194
|
+
function Ri(e) {
|
|
2195
|
+
return be(e);
|
|
2179
2196
|
}
|
|
2180
|
-
function
|
|
2197
|
+
function Mt(e) {
|
|
2181
2198
|
if (e === void 0)
|
|
2182
2199
|
return;
|
|
2183
2200
|
const t = {};
|
|
2184
2201
|
for (const [i, n] of Object.entries(e))
|
|
2185
|
-
|
|
2202
|
+
Ri(n) ? t[i] = n.value : t[i] = n;
|
|
2186
2203
|
return t;
|
|
2187
2204
|
}
|
|
2188
|
-
const
|
|
2189
|
-
class
|
|
2205
|
+
const mt = (e, t) => D([e.statics.id, t]);
|
|
2206
|
+
class qi {
|
|
2190
2207
|
entityMap;
|
|
2191
2208
|
queryInstances = /* @__PURE__ */ new Map();
|
|
2192
2209
|
mutationInstances = /* @__PURE__ */ new Map();
|
|
@@ -2203,7 +2220,7 @@ class Ti {
|
|
|
2203
2220
|
networkUnsubscribe;
|
|
2204
2221
|
constructor(t = {}) {
|
|
2205
2222
|
const {
|
|
2206
|
-
store: i = new
|
|
2223
|
+
store: i = new Re(new Se()),
|
|
2207
2224
|
log: n,
|
|
2208
2225
|
evictionMultiplier: s,
|
|
2209
2226
|
adapters: r,
|
|
@@ -2211,10 +2228,10 @@ class Ti {
|
|
|
2211
2228
|
gcManager: a,
|
|
2212
2229
|
...c
|
|
2213
2230
|
} = t;
|
|
2214
|
-
this.isServer = typeof window > "u", this.store = i, this.context = { ...c, log: n ?? console, evictionMultiplier: s }, this.gcManager = t.gcManager ?? (this.isServer ? new
|
|
2231
|
+
this.isServer = typeof window > "u", this.store = i, this.context = { ...c, log: n ?? console, evictionMultiplier: s }, this.gcManager = t.gcManager ?? (this.isServer ? new Ie() : new De(this.handleEviction, s)), this.networkManager = t.networkManager ?? new se(), this.entityMap = new hi((u, y, v) => this.store.saveEntity(u, y, v));
|
|
2215
2232
|
for (const u of t.adapters ?? [])
|
|
2216
2233
|
this.adapters.set(u.constructor, u), u.register(this);
|
|
2217
|
-
const f = this.networkManager.getOnlineSignal(), l =
|
|
2234
|
+
const f = this.networkManager.getOnlineSignal(), l = Ce(() => f.value);
|
|
2218
2235
|
this.networkUnsubscribe = l.addListener(
|
|
2219
2236
|
() => {
|
|
2220
2237
|
const u = f.value;
|
|
@@ -2293,7 +2310,7 @@ class Ti {
|
|
|
2293
2310
|
activateQuery(t) {
|
|
2294
2311
|
const { def: i, queryKey: n, storageKey: s, config: r } = t;
|
|
2295
2312
|
this.store.activateQuery(i, s);
|
|
2296
|
-
const o = r?.gcTime ??
|
|
2313
|
+
const o = r?.gcTime ?? Pt;
|
|
2297
2314
|
this.gcManager.cancel(n, o);
|
|
2298
2315
|
}
|
|
2299
2316
|
loadCachedQuery(t, i) {
|
|
@@ -2304,9 +2321,9 @@ class Ti {
|
|
|
2304
2321
|
* that triggers fetches and prepopulates with cached data
|
|
2305
2322
|
*/
|
|
2306
2323
|
getQuery(t, i) {
|
|
2307
|
-
const n =
|
|
2324
|
+
const n = mt(t, i);
|
|
2308
2325
|
let s = this.queryInstances.get(n);
|
|
2309
|
-
return s === void 0 && (s = new
|
|
2326
|
+
return s === void 0 && (s = new pi(t, this, n, i), this.queryInstances.set(n, s)), s.relay;
|
|
2310
2327
|
}
|
|
2311
2328
|
/**
|
|
2312
2329
|
* Gets or creates a MutationResult for the given mutation definition.
|
|
@@ -2315,7 +2332,7 @@ class Ti {
|
|
|
2315
2332
|
getMutation(t) {
|
|
2316
2333
|
const i = t.id;
|
|
2317
2334
|
let n = this.mutationInstances.get(i);
|
|
2318
|
-
return n === void 0 && (n = new
|
|
2335
|
+
return n === void 0 && (n = new gi(t, this), this.mutationInstances.set(i, n)), n.task;
|
|
2319
2336
|
}
|
|
2320
2337
|
/**
|
|
2321
2338
|
* Parse data: validates, formats, produces parsed entity data objects.
|
|
@@ -2324,7 +2341,7 @@ class Ti {
|
|
|
2324
2341
|
parseData(t, i, n) {
|
|
2325
2342
|
const s = this.context.log?.warn ?? (() => {
|
|
2326
2343
|
}), r = new st();
|
|
2327
|
-
return r.reset(this, n, s), { data:
|
|
2344
|
+
return r.reset(this, n, s), { data: Zt(t, i, r), ctx: r };
|
|
2328
2345
|
}
|
|
2329
2346
|
/**
|
|
2330
2347
|
* Apply entities from parseData() via a single depth-first walk: creates/
|
|
@@ -2340,7 +2357,7 @@ class Ti {
|
|
|
2340
2357
|
* found in the store by the standard entity pipeline).
|
|
2341
2358
|
*/
|
|
2342
2359
|
parseAndApplyRootEntity(t, i, n, s, r = !1, o) {
|
|
2343
|
-
typeof n.idField == "symbol" && typeof t == "object" && t !== null && !("__entityRef" in t) && (t[
|
|
2360
|
+
typeof n.idField == "symbol" && typeof t == "object" && t !== null && !("__entityRef" in t) && (t[jt] = i);
|
|
2344
2361
|
const a = this.parseData(t, n, o), c = tt(a.ctx, a.data, s, r), f = x.get(c.data);
|
|
2345
2362
|
return this.entityMap.getEntity(f);
|
|
2346
2363
|
}
|
|
@@ -2373,7 +2390,7 @@ class Ti {
|
|
|
2373
2390
|
/* isPartialEvent */
|
|
2374
2391
|
!0
|
|
2375
2392
|
);
|
|
2376
|
-
const I =
|
|
2393
|
+
const I = ii(l, s, w);
|
|
2377
2394
|
tt(w, I, !0);
|
|
2378
2395
|
} catch (g) {
|
|
2379
2396
|
if (this.context.log?.warn?.("Failed to apply mutation event", g), u === void 0) {
|
|
@@ -2398,7 +2415,7 @@ class Ti {
|
|
|
2398
2415
|
for (const i of t) {
|
|
2399
2416
|
const n = Array.isArray(i), s = n ? i[0] : i, r = n ? i[1] : void 0, a = V.for(s).statics.id;
|
|
2400
2417
|
for (const [, c] of this.queryInstances)
|
|
2401
|
-
c.def.statics.id === a && (r === void 0 ||
|
|
2418
|
+
c.def.statics.id === a && (r === void 0 || Ai(c.resolvedParams, r)) && c.markStale();
|
|
2402
2419
|
}
|
|
2403
2420
|
}
|
|
2404
2421
|
// ======================================================
|
|
@@ -2419,7 +2436,7 @@ class Ti {
|
|
|
2419
2436
|
// ======================================================
|
|
2420
2437
|
getOrCreateMatcher(t) {
|
|
2421
2438
|
let i = this.constraintRegistry.get(t);
|
|
2422
|
-
return i === void 0 && (i = new
|
|
2439
|
+
return i === void 0 && (i = new bi(), this.constraintRegistry.set(t, i)), i;
|
|
2423
2440
|
}
|
|
2424
2441
|
registerLiveCollection(t) {
|
|
2425
2442
|
for (const [i, n] of t._entityDefsByTypename)
|
|
@@ -2434,7 +2451,7 @@ class Ti {
|
|
|
2434
2451
|
routeEvent(t, i, n, s, r, o, a) {
|
|
2435
2452
|
const c = this.constraintRegistry.get(t);
|
|
2436
2453
|
if (c === void 0) return;
|
|
2437
|
-
const f = r !== void 0 ? { ...i, [
|
|
2454
|
+
const f = r !== void 0 ? { ...i, [ae]: r } : i;
|
|
2438
2455
|
c.routeEvent(t, f, n, s, o, a);
|
|
2439
2456
|
}
|
|
2440
2457
|
destroy() {
|
|
@@ -2444,8 +2461,8 @@ class Ti {
|
|
|
2444
2461
|
this.adapters.clear(), this.queryInstances.clear(), this.mutationInstances.clear(), this.constraintRegistry.clear(), this.typenameRegistry.clear(), this.mergedDefCache.clear();
|
|
2445
2462
|
}
|
|
2446
2463
|
}
|
|
2447
|
-
const
|
|
2448
|
-
function
|
|
2464
|
+
const Si = Tt(void 0);
|
|
2465
|
+
function Ai(e, t) {
|
|
2449
2466
|
if (e === void 0) return !1;
|
|
2450
2467
|
for (const i in t)
|
|
2451
2468
|
if (e[i] !== t[i]) return !1;
|
|
@@ -2453,31 +2470,31 @@ function xi(e, t) {
|
|
|
2453
2470
|
}
|
|
2454
2471
|
export {
|
|
2455
2472
|
Q as A,
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2473
|
+
lt as E,
|
|
2474
|
+
De as G,
|
|
2475
|
+
L,
|
|
2459
2476
|
d as M,
|
|
2460
|
-
|
|
2461
|
-
|
|
2477
|
+
se as N,
|
|
2478
|
+
jt as Q,
|
|
2462
2479
|
B as R,
|
|
2463
2480
|
_ as V,
|
|
2464
2481
|
ft as a,
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2482
|
+
Fi as b,
|
|
2483
|
+
j as c,
|
|
2484
|
+
Ie as d,
|
|
2485
|
+
re as e,
|
|
2486
|
+
Ti as f,
|
|
2487
|
+
qi as g,
|
|
2488
|
+
Si as h,
|
|
2489
|
+
yi as i,
|
|
2490
|
+
ki as j,
|
|
2491
|
+
ji as k,
|
|
2492
|
+
Vt as l,
|
|
2493
|
+
ke as m,
|
|
2477
2494
|
W as n,
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2495
|
+
Li as o,
|
|
2496
|
+
Pi as q,
|
|
2497
|
+
zt as r,
|
|
2498
|
+
ti as t
|
|
2482
2499
|
};
|
|
2483
|
-
//# sourceMappingURL=QueryClient-
|
|
2500
|
+
//# sourceMappingURL=QueryClient-D64xo0EA.js.map
|