fetchium 0.2.4 → 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 +19 -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-LrsiDsl7.js → development/mutation-w67Vpuvw.js} +2 -2
- package/dist/cjs/{production/mutation-LrsiDsl7.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-CUV5TC93.js → production/mutation-CgS9gXW7.js} +2 -2
- package/dist/cjs/{development/mutation-CUV5TC93.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 +3 -3
- package/dist/esm/QueryResult.d.ts.map +1 -1
- package/dist/esm/development/{QueryClient-WObL5AFz.js → QueryClient-C9tBdK1Z.js} +347 -330
- package/dist/esm/development/QueryClient-C9tBdK1Z.js.map +1 -0
- package/dist/esm/development/index.js +2 -2
- package/dist/esm/development/{mutation-C3e7FM9D.js → mutation-Dx63NCGk.js} +2 -2
- package/dist/esm/development/{mutation-C3e7FM9D.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-DqHBCvA1.js → QueryClient-D64xo0EA.js} +319 -304
- package/dist/esm/production/QueryClient-D64xo0EA.js.map +1 -0
- package/dist/esm/production/index.js +2 -2
- package/dist/esm/production/{mutation-BOc53DJi.js → mutation-Aw1JE7VO.js} +2 -2
- package/dist/esm/production/{mutation-BOc53DJi.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-DjKxdY2y.js +0 -2
- package/dist/cjs/development/QueryClient-DjKxdY2y.js.map +0 -1
- package/dist/cjs/production/QueryClient-YzaJT_2g.js +0 -2
- package/dist/cjs/production/QueryClient-YzaJT_2g.js.map +0 -1
- package/dist/esm/development/QueryClient-WObL5AFz.js.map +0 -1
- package/dist/esm/production/QueryClient-DqHBCvA1.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;
|
|
@@ -1386,7 +1401,7 @@ class di {
|
|
|
1386
1401
|
debounceTimer = void 0;
|
|
1387
1402
|
/** Resolved per-instance options (depend on actual params). */
|
|
1388
1403
|
config = void 0;
|
|
1389
|
-
retryConfig =
|
|
1404
|
+
retryConfig = _t(void 0);
|
|
1390
1405
|
/** Cancels in-flight fetches and retry waits. */
|
|
1391
1406
|
_abortController = void 0;
|
|
1392
1407
|
/** Cached execution context, recreated only when storageKey (params) changes. */
|
|
@@ -1407,13 +1422,13 @@ class di {
|
|
|
1407
1422
|
}
|
|
1408
1423
|
constructor(t, i, n, s) {
|
|
1409
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);
|
|
1410
|
-
const r =
|
|
1411
|
-
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(
|
|
1412
1427
|
(o) => {
|
|
1413
1428
|
this._relayState = o;
|
|
1414
1429
|
const a = () => {
|
|
1415
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;
|
|
1416
|
-
const f = this.config?.gcTime ??
|
|
1431
|
+
const f = this.config?.gcTime ?? Pt;
|
|
1417
1432
|
this.queryClient.gcManager.schedule(this.queryKey, f, z.Query);
|
|
1418
1433
|
}, c = (f = !1) => {
|
|
1419
1434
|
const { wasPaused: l, isPaused: u, initialized: y } = this;
|
|
@@ -1422,7 +1437,7 @@ class di {
|
|
|
1422
1437
|
return;
|
|
1423
1438
|
}
|
|
1424
1439
|
this._isActive = !0;
|
|
1425
|
-
const v =
|
|
1440
|
+
const v = Mt(this.params), p = mt(this.def, v), g = p !== this.storageKey;
|
|
1426
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());
|
|
1427
1442
|
};
|
|
1428
1443
|
return c(!0), {
|
|
@@ -1472,7 +1487,7 @@ class di {
|
|
|
1472
1487
|
if (!this.isPaused)
|
|
1473
1488
|
try {
|
|
1474
1489
|
if (n !== void 0 && this.setupSubscription(), n === void 0 || this.isStale) {
|
|
1475
|
-
if (await
|
|
1490
|
+
if (await oe(0), this.isPaused) return;
|
|
1476
1491
|
this.runQueryImmediately();
|
|
1477
1492
|
}
|
|
1478
1493
|
} catch (s) {
|
|
@@ -1580,21 +1595,21 @@ class di {
|
|
|
1580
1595
|
return Date.now() - this.updatedAt >= t;
|
|
1581
1596
|
}
|
|
1582
1597
|
get isPaused() {
|
|
1583
|
-
const t = this.config?.networkMode ??
|
|
1584
|
-
if (t ===
|
|
1598
|
+
const t = this.config?.networkMode ?? j.Online;
|
|
1599
|
+
if (t === j.Always)
|
|
1585
1600
|
return !1;
|
|
1586
1601
|
const i = this.queryClient.networkManager.getOnlineSignal().value;
|
|
1587
1602
|
switch (t) {
|
|
1588
|
-
case
|
|
1603
|
+
case j.Online:
|
|
1589
1604
|
return !i;
|
|
1590
|
-
case
|
|
1605
|
+
case j.OfflineFirst:
|
|
1591
1606
|
return !i && this.updatedAt === void 0;
|
|
1592
1607
|
default:
|
|
1593
1608
|
return !1;
|
|
1594
1609
|
}
|
|
1595
1610
|
}
|
|
1596
1611
|
}
|
|
1597
|
-
class
|
|
1612
|
+
class gi {
|
|
1598
1613
|
def;
|
|
1599
1614
|
queryClient;
|
|
1600
1615
|
_inFlight = !1;
|
|
@@ -1603,7 +1618,7 @@ class li {
|
|
|
1603
1618
|
this.def = t, this.queryClient = i, this.task = this.createTask();
|
|
1604
1619
|
}
|
|
1605
1620
|
createTask() {
|
|
1606
|
-
return
|
|
1621
|
+
return we(
|
|
1607
1622
|
async (t) => {
|
|
1608
1623
|
if (this._inFlight)
|
|
1609
1624
|
throw new Error("A mutation is already in progress. Await the previous call before starting a new one.");
|
|
@@ -1624,7 +1639,7 @@ class li {
|
|
|
1624
1639
|
return t;
|
|
1625
1640
|
const n = this.queryClient.getContext().log?.warn ?? (() => {
|
|
1626
1641
|
}), s = new st();
|
|
1627
|
-
return s.reset(void 0, void 0, n),
|
|
1642
|
+
return s.reset(void 0, void 0, n), Zt(t, i, s);
|
|
1628
1643
|
}
|
|
1629
1644
|
// ======================================================
|
|
1630
1645
|
// Effects processing
|
|
@@ -1650,7 +1665,7 @@ class li {
|
|
|
1650
1665
|
// Retry logic
|
|
1651
1666
|
// ======================================================
|
|
1652
1667
|
executeWithRetry(t) {
|
|
1653
|
-
const i =
|
|
1668
|
+
const i = _t(this.def.config?.retry, !0), n = this.queryClient.getAdapter(this.def.adapterClass);
|
|
1654
1669
|
if (!n.sendMutation)
|
|
1655
1670
|
throw new Error(
|
|
1656
1671
|
`Adapter "${this.def.adapterClass.name}" does not implement sendMutation(). Add a sendMutation() method to handle mutations.`
|
|
@@ -1665,24 +1680,24 @@ class li {
|
|
|
1665
1680
|
}, i);
|
|
1666
1681
|
}
|
|
1667
1682
|
}
|
|
1668
|
-
function
|
|
1683
|
+
function vi(e) {
|
|
1669
1684
|
return typeof e == "string" ? e : T(e).typenameValue;
|
|
1670
1685
|
}
|
|
1671
1686
|
function Z(e, t, i) {
|
|
1672
1687
|
if (e)
|
|
1673
1688
|
for (const [n, s] of e) {
|
|
1674
|
-
const r =
|
|
1689
|
+
const r = vi(n);
|
|
1675
1690
|
r !== void 0 && i.applyMutationEvent({ type: t, typename: r, data: s });
|
|
1676
1691
|
}
|
|
1677
1692
|
}
|
|
1678
|
-
const
|
|
1679
|
-
function
|
|
1693
|
+
const ae = "__eventSource";
|
|
1694
|
+
function ce(e) {
|
|
1680
1695
|
return { field: e, segments: e.indexOf(".") !== -1 ? e.split(".") : void 0 };
|
|
1681
1696
|
}
|
|
1682
|
-
function
|
|
1683
|
-
return e.map(
|
|
1697
|
+
function _i(e) {
|
|
1698
|
+
return e.map(ce);
|
|
1684
1699
|
}
|
|
1685
|
-
function
|
|
1700
|
+
function mi(e, t) {
|
|
1686
1701
|
if (t.segments === void 0) return e[t.field];
|
|
1687
1702
|
let i = e;
|
|
1688
1703
|
for (const n of t.segments) {
|
|
@@ -1691,16 +1706,16 @@ function pi(e, t) {
|
|
|
1691
1706
|
}
|
|
1692
1707
|
return i;
|
|
1693
1708
|
}
|
|
1694
|
-
function
|
|
1709
|
+
function fe(e, t) {
|
|
1695
1710
|
const i = [];
|
|
1696
1711
|
for (let n = 0; n < t.length; n++) {
|
|
1697
|
-
const s = t[n], r =
|
|
1712
|
+
const s = t[n], r = mi(e, s);
|
|
1698
1713
|
if (r === void 0) return;
|
|
1699
1714
|
i.push(s.field, r);
|
|
1700
1715
|
}
|
|
1701
1716
|
return D(i);
|
|
1702
1717
|
}
|
|
1703
|
-
function
|
|
1718
|
+
function wi(e, t) {
|
|
1704
1719
|
if (e === void 0) return;
|
|
1705
1720
|
const i = /* @__PURE__ */ new Map();
|
|
1706
1721
|
for (const [n, s] of e) {
|
|
@@ -1708,8 +1723,8 @@ function gi(e, t) {
|
|
|
1708
1723
|
let a = !0;
|
|
1709
1724
|
for (const [c, f] of r) {
|
|
1710
1725
|
let l;
|
|
1711
|
-
if (
|
|
1712
|
-
const u =
|
|
1726
|
+
if (qt(f)) {
|
|
1727
|
+
const u = Ut(f);
|
|
1713
1728
|
l = dt(u, t);
|
|
1714
1729
|
} else
|
|
1715
1730
|
l = f;
|
|
@@ -1723,17 +1738,17 @@ function gi(e, t) {
|
|
|
1723
1738
|
}
|
|
1724
1739
|
return i.size > 0 ? i : void 0;
|
|
1725
1740
|
}
|
|
1726
|
-
function
|
|
1741
|
+
function Dt(e, t) {
|
|
1727
1742
|
const i = e.get(t);
|
|
1728
1743
|
if (i !== void 0)
|
|
1729
1744
|
return i.map(([n]) => n).sort();
|
|
1730
1745
|
}
|
|
1731
|
-
class
|
|
1746
|
+
class Ei {
|
|
1732
1747
|
fields;
|
|
1733
1748
|
fieldPaths;
|
|
1734
1749
|
_bindings = /* @__PURE__ */ new Map();
|
|
1735
1750
|
constructor(t) {
|
|
1736
|
-
this.fields = t, this.fieldPaths = t.map(
|
|
1751
|
+
this.fields = t, this.fieldPaths = t.map(ce);
|
|
1737
1752
|
}
|
|
1738
1753
|
register(t, i) {
|
|
1739
1754
|
let n = this._bindings.get(t);
|
|
@@ -1750,38 +1765,38 @@ class vi {
|
|
|
1750
1765
|
return this._bindings.size === 0;
|
|
1751
1766
|
}
|
|
1752
1767
|
}
|
|
1753
|
-
function
|
|
1768
|
+
function It(e) {
|
|
1754
1769
|
return D(e);
|
|
1755
1770
|
}
|
|
1756
|
-
class
|
|
1771
|
+
class bi {
|
|
1757
1772
|
_groups = /* @__PURE__ */ new Map();
|
|
1758
1773
|
getOrCreateGroup(t) {
|
|
1759
|
-
const i =
|
|
1774
|
+
const i = It(t);
|
|
1760
1775
|
let n = this._groups.get(i);
|
|
1761
|
-
return n === void 0 && (n = new
|
|
1776
|
+
return n === void 0 && (n = new Ei(t), this._groups.set(i, n)), n;
|
|
1762
1777
|
}
|
|
1763
1778
|
register(t, i, n) {
|
|
1764
1779
|
this.getOrCreateGroup(i).register(t, n);
|
|
1765
1780
|
}
|
|
1766
1781
|
unregister(t, i, n) {
|
|
1767
|
-
const s =
|
|
1782
|
+
const s = It(i), r = this._groups.get(s);
|
|
1768
1783
|
r !== void 0 && (r.unregister(t, n), r.isEmpty && this._groups.delete(s));
|
|
1769
1784
|
}
|
|
1770
1785
|
registerBinding(t, i) {
|
|
1771
1786
|
const n = t._constraintHashes.get(i);
|
|
1772
1787
|
if (n === void 0) return;
|
|
1773
|
-
const s =
|
|
1788
|
+
const s = Dt(t._constraintFieldRefs, i);
|
|
1774
1789
|
s !== void 0 && this.register(n, s, t);
|
|
1775
1790
|
}
|
|
1776
1791
|
unregisterBinding(t, i) {
|
|
1777
1792
|
const n = t._constraintHashes.get(i);
|
|
1778
1793
|
if (n === void 0) return;
|
|
1779
|
-
const s =
|
|
1794
|
+
const s = Dt(t._constraintFieldRefs, i);
|
|
1780
1795
|
s !== void 0 && this.unregister(n, s, t);
|
|
1781
1796
|
}
|
|
1782
1797
|
routeEvent(t, i, n, s, r, o) {
|
|
1783
1798
|
for (const a of this._groups.values()) {
|
|
1784
|
-
const c =
|
|
1799
|
+
const c = fe(i, a.fieldPaths);
|
|
1785
1800
|
if (c === void 0) continue;
|
|
1786
1801
|
const f = a.getMatching(c);
|
|
1787
1802
|
if (f !== void 0)
|
|
@@ -1790,7 +1805,7 @@ class _i {
|
|
|
1790
1805
|
}
|
|
1791
1806
|
}
|
|
1792
1807
|
}
|
|
1793
|
-
function
|
|
1808
|
+
function Nt(e) {
|
|
1794
1809
|
const t = /* @__PURE__ */ new Set();
|
|
1795
1810
|
for (const i of e)
|
|
1796
1811
|
if (typeof i == "object" && i !== null) {
|
|
@@ -1799,7 +1814,7 @@ function Dt(e) {
|
|
|
1799
1814
|
}
|
|
1800
1815
|
return t;
|
|
1801
1816
|
}
|
|
1802
|
-
class
|
|
1817
|
+
class ue {
|
|
1803
1818
|
_queryClient;
|
|
1804
1819
|
_parent;
|
|
1805
1820
|
_constraintHashes;
|
|
@@ -1849,7 +1864,7 @@ class ce {
|
|
|
1849
1864
|
i !== -1 && t.splice(i, 1);
|
|
1850
1865
|
}
|
|
1851
1866
|
}
|
|
1852
|
-
class
|
|
1867
|
+
class Ci {
|
|
1853
1868
|
_notifier;
|
|
1854
1869
|
_items;
|
|
1855
1870
|
_keys;
|
|
@@ -1857,9 +1872,9 @@ class mi {
|
|
|
1857
1872
|
_queryClient;
|
|
1858
1873
|
_parent;
|
|
1859
1874
|
constructor(t, i, n, s, r, o) {
|
|
1860
|
-
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;
|
|
1861
1876
|
const a = s !== void 0 && r !== void 0, c = o !== void 0;
|
|
1862
|
-
(a || c) && (this._outputSignal =
|
|
1877
|
+
(a || c) && (this._outputSignal = Ee(() => {
|
|
1863
1878
|
this._notifier.consume();
|
|
1864
1879
|
let f = this._items;
|
|
1865
1880
|
if (a) {
|
|
@@ -1879,7 +1894,7 @@ class mi {
|
|
|
1879
1894
|
l.push(u);
|
|
1880
1895
|
continue;
|
|
1881
1896
|
}
|
|
1882
|
-
v.consume(),
|
|
1897
|
+
v.consume(), fe(v.data, s) === r && l.push(u);
|
|
1883
1898
|
}
|
|
1884
1899
|
f = l;
|
|
1885
1900
|
}
|
|
@@ -1924,7 +1939,7 @@ class mi {
|
|
|
1924
1939
|
}
|
|
1925
1940
|
reset(t) {
|
|
1926
1941
|
const i = this._items, n = Array.isArray(t) ? t : [];
|
|
1927
|
-
this._items = n, this._keys =
|
|
1942
|
+
this._items = n, this._keys = Nt(n);
|
|
1928
1943
|
for (const s of n)
|
|
1929
1944
|
if (typeof s == "object" && s !== null) {
|
|
1930
1945
|
const r = k(s);
|
|
@@ -1960,7 +1975,7 @@ class mi {
|
|
|
1960
1975
|
return -1;
|
|
1961
1976
|
}
|
|
1962
1977
|
}
|
|
1963
|
-
class
|
|
1978
|
+
class xi {
|
|
1964
1979
|
_notifier;
|
|
1965
1980
|
_value;
|
|
1966
1981
|
_createdKeys;
|
|
@@ -2001,16 +2016,16 @@ class wi {
|
|
|
2001
2016
|
append(t) {
|
|
2002
2017
|
}
|
|
2003
2018
|
}
|
|
2004
|
-
function
|
|
2019
|
+
function de(e, t, i, n, s) {
|
|
2005
2020
|
let r = e.constraintFieldRefs;
|
|
2006
2021
|
if (r === void 0) {
|
|
2007
2022
|
r = /* @__PURE__ */ new Map();
|
|
2008
2023
|
for (const f of e.entityDefs) {
|
|
2009
2024
|
const l = f.typenameValue;
|
|
2010
|
-
l !== void 0 && r.set(l, [[
|
|
2025
|
+
l !== void 0 && r.set(l, [[ae, i.key]]);
|
|
2011
2026
|
}
|
|
2012
2027
|
}
|
|
2013
|
-
const o =
|
|
2028
|
+
const o = wi(r, n) ?? /* @__PURE__ */ new Map();
|
|
2014
2029
|
let a;
|
|
2015
2030
|
if (e.type === ft.Array) {
|
|
2016
2031
|
let f, l;
|
|
@@ -2020,11 +2035,11 @@ function fe(e, t, i, n, s) {
|
|
|
2020
2035
|
if (y !== void 0) {
|
|
2021
2036
|
l = y;
|
|
2022
2037
|
const v = e.constraintFieldRefs.get(u);
|
|
2023
|
-
v !== void 0 && (f =
|
|
2038
|
+
v !== void 0 && (f = _i(v.map(([p]) => p)));
|
|
2024
2039
|
break;
|
|
2025
2040
|
}
|
|
2026
2041
|
}
|
|
2027
|
-
a = new
|
|
2042
|
+
a = new Ci(
|
|
2028
2043
|
s,
|
|
2029
2044
|
i,
|
|
2030
2045
|
Array.isArray(t) ? t : [],
|
|
@@ -2033,7 +2048,7 @@ function fe(e, t, i, n, s) {
|
|
|
2033
2048
|
e.sort
|
|
2034
2049
|
);
|
|
2035
2050
|
} else
|
|
2036
|
-
a = new
|
|
2051
|
+
a = new xi(
|
|
2037
2052
|
s,
|
|
2038
2053
|
i,
|
|
2039
2054
|
t,
|
|
@@ -2041,7 +2056,7 @@ function fe(e, t, i, n, s) {
|
|
|
2041
2056
|
e.onUpdate,
|
|
2042
2057
|
e.onDelete
|
|
2043
2058
|
);
|
|
2044
|
-
const c = new
|
|
2059
|
+
const c = new ue(
|
|
2045
2060
|
e.entityDefs,
|
|
2046
2061
|
r,
|
|
2047
2062
|
s,
|
|
@@ -2051,7 +2066,7 @@ function fe(e, t, i, n, s) {
|
|
|
2051
2066
|
);
|
|
2052
2067
|
return i.liveCollections.push(c), s.registerLiveCollection(c), c;
|
|
2053
2068
|
}
|
|
2054
|
-
const
|
|
2069
|
+
const le = Object.entries, he = Object.prototype;
|
|
2055
2070
|
function tt(e, t, i, n = !1) {
|
|
2056
2071
|
const s = e.queryClient;
|
|
2057
2072
|
s.currentParseId++;
|
|
@@ -2062,7 +2077,7 @@ function U(e, t, i, n, s, r) {
|
|
|
2062
2077
|
if (typeof e != "object" || e === null) return e;
|
|
2063
2078
|
const o = t.get(e);
|
|
2064
2079
|
if (o !== void 0)
|
|
2065
|
-
return
|
|
2080
|
+
return Oi(o, t, i, n, s, r);
|
|
2066
2081
|
if (Array.isArray(e)) {
|
|
2067
2082
|
for (let a = 0; a < e.length; a++) {
|
|
2068
2083
|
const c = e[a];
|
|
@@ -2070,7 +2085,7 @@ function U(e, t, i, n, s, r) {
|
|
|
2070
2085
|
}
|
|
2071
2086
|
return e;
|
|
2072
2087
|
}
|
|
2073
|
-
if (Object.getPrototypeOf(e) ===
|
|
2088
|
+
if (Object.getPrototypeOf(e) === he && !x.has(e)) {
|
|
2074
2089
|
const a = e;
|
|
2075
2090
|
for (const c of Object.keys(a)) {
|
|
2076
2091
|
const f = a[c];
|
|
@@ -2079,12 +2094,12 @@ function U(e, t, i, n, s, r) {
|
|
|
2079
2094
|
}
|
|
2080
2095
|
return e;
|
|
2081
2096
|
}
|
|
2082
|
-
function
|
|
2097
|
+
function ye(e) {
|
|
2083
2098
|
return typeof e == "object" && e !== null && !(e instanceof q) && !x.has(e);
|
|
2084
2099
|
}
|
|
2085
|
-
function
|
|
2100
|
+
function Oi(e, t, i, n, s, r) {
|
|
2086
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();
|
|
2087
|
-
if (v ? (
|
|
2102
|
+
if (v ? (pe(
|
|
2088
2103
|
l,
|
|
2089
2104
|
a,
|
|
2090
2105
|
y,
|
|
@@ -2096,7 +2111,7 @@ function Ei(e, t, i, n, s, r) {
|
|
|
2096
2111
|
n,
|
|
2097
2112
|
p,
|
|
2098
2113
|
r
|
|
2099
|
-
), u.notify()) :
|
|
2114
|
+
), u.notify()) : ge(l, a, u, a, t, i, n, p, r), r && u.liveCollections.length > 0)
|
|
2100
2115
|
for (const w of u.liveCollections) {
|
|
2101
2116
|
const I = w.instance.getRawValue();
|
|
2102
2117
|
if (Array.isArray(I))
|
|
@@ -2112,12 +2127,12 @@ function Ei(e, t, i, n, s, r) {
|
|
|
2112
2127
|
const g = u.getProxy(c);
|
|
2113
2128
|
return s.set(u, (s.get(u) ?? 0) + 1), g;
|
|
2114
2129
|
}
|
|
2115
|
-
function
|
|
2116
|
-
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))
|
|
2117
2132
|
if (!(n !== void 0 && !n.has(u)))
|
|
2118
|
-
if (
|
|
2133
|
+
if (ye(t[u]) && (t[u] = U(t[u], o, a, c, f, l)), y instanceof _ && y._liveConfig !== void 0) {
|
|
2119
2134
|
const v = i[u];
|
|
2120
|
-
v instanceof
|
|
2135
|
+
v instanceof ue ? l ? v.append(t[u]) : v.reset(t[u]) : i[u] = de(
|
|
2121
2136
|
y._liveConfig,
|
|
2122
2137
|
t[u],
|
|
2123
2138
|
s,
|
|
@@ -2129,7 +2144,7 @@ function he(e, t, i, n, s, r, o, a, c, f, l) {
|
|
|
2129
2144
|
if (at(v) && at(p)) {
|
|
2130
2145
|
const g = y instanceof _ && y.shape !== void 0 ? y.shape : void 0;
|
|
2131
2146
|
if (g !== void 0)
|
|
2132
|
-
|
|
2147
|
+
pe(
|
|
2133
2148
|
g,
|
|
2134
2149
|
v,
|
|
2135
2150
|
p,
|
|
@@ -2150,11 +2165,11 @@ function he(e, t, i, n, s, r, o, a, c, f, l) {
|
|
|
2150
2165
|
i[u] = v;
|
|
2151
2166
|
}
|
|
2152
2167
|
}
|
|
2153
|
-
function
|
|
2154
|
-
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))
|
|
2155
2170
|
if (f in t)
|
|
2156
|
-
if (
|
|
2157
|
-
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(
|
|
2158
2173
|
l._liveConfig,
|
|
2159
2174
|
t[f],
|
|
2160
2175
|
i,
|
|
@@ -2165,30 +2180,30 @@ function ye(e, t, i, n, s, r, o, a, c) {
|
|
|
2165
2180
|
const u = t[f];
|
|
2166
2181
|
if (at(u)) {
|
|
2167
2182
|
const y = l instanceof _ && l.shape !== void 0 ? l.shape : void 0;
|
|
2168
|
-
y !== void 0 &&
|
|
2183
|
+
y !== void 0 && ge(y, u, i, n, s, r, o, a, c);
|
|
2169
2184
|
}
|
|
2170
2185
|
}
|
|
2171
2186
|
}
|
|
2172
2187
|
function at(e) {
|
|
2173
|
-
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);
|
|
2174
2189
|
}
|
|
2175
|
-
function
|
|
2190
|
+
function Li(e) {
|
|
2176
2191
|
if (e !== void 0)
|
|
2177
2192
|
return typeof e == "string" ? e : typeof e == "function" ? e() : e.value;
|
|
2178
2193
|
}
|
|
2179
|
-
function
|
|
2180
|
-
return
|
|
2194
|
+
function Ri(e) {
|
|
2195
|
+
return be(e);
|
|
2181
2196
|
}
|
|
2182
|
-
function
|
|
2197
|
+
function Mt(e) {
|
|
2183
2198
|
if (e === void 0)
|
|
2184
2199
|
return;
|
|
2185
2200
|
const t = {};
|
|
2186
2201
|
for (const [i, n] of Object.entries(e))
|
|
2187
|
-
|
|
2202
|
+
Ri(n) ? t[i] = n.value : t[i] = n;
|
|
2188
2203
|
return t;
|
|
2189
2204
|
}
|
|
2190
|
-
const
|
|
2191
|
-
class
|
|
2205
|
+
const mt = (e, t) => D([e.statics.id, t]);
|
|
2206
|
+
class qi {
|
|
2192
2207
|
entityMap;
|
|
2193
2208
|
queryInstances = /* @__PURE__ */ new Map();
|
|
2194
2209
|
mutationInstances = /* @__PURE__ */ new Map();
|
|
@@ -2205,7 +2220,7 @@ class Ti {
|
|
|
2205
2220
|
networkUnsubscribe;
|
|
2206
2221
|
constructor(t = {}) {
|
|
2207
2222
|
const {
|
|
2208
|
-
store: i = new
|
|
2223
|
+
store: i = new Re(new Se()),
|
|
2209
2224
|
log: n,
|
|
2210
2225
|
evictionMultiplier: s,
|
|
2211
2226
|
adapters: r,
|
|
@@ -2213,10 +2228,10 @@ class Ti {
|
|
|
2213
2228
|
gcManager: a,
|
|
2214
2229
|
...c
|
|
2215
2230
|
} = t;
|
|
2216
|
-
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));
|
|
2217
2232
|
for (const u of t.adapters ?? [])
|
|
2218
2233
|
this.adapters.set(u.constructor, u), u.register(this);
|
|
2219
|
-
const f = this.networkManager.getOnlineSignal(), l =
|
|
2234
|
+
const f = this.networkManager.getOnlineSignal(), l = Ce(() => f.value);
|
|
2220
2235
|
this.networkUnsubscribe = l.addListener(
|
|
2221
2236
|
() => {
|
|
2222
2237
|
const u = f.value;
|
|
@@ -2295,7 +2310,7 @@ class Ti {
|
|
|
2295
2310
|
activateQuery(t) {
|
|
2296
2311
|
const { def: i, queryKey: n, storageKey: s, config: r } = t;
|
|
2297
2312
|
this.store.activateQuery(i, s);
|
|
2298
|
-
const o = r?.gcTime ??
|
|
2313
|
+
const o = r?.gcTime ?? Pt;
|
|
2299
2314
|
this.gcManager.cancel(n, o);
|
|
2300
2315
|
}
|
|
2301
2316
|
loadCachedQuery(t, i) {
|
|
@@ -2306,9 +2321,9 @@ class Ti {
|
|
|
2306
2321
|
* that triggers fetches and prepopulates with cached data
|
|
2307
2322
|
*/
|
|
2308
2323
|
getQuery(t, i) {
|
|
2309
|
-
const n =
|
|
2324
|
+
const n = mt(t, i);
|
|
2310
2325
|
let s = this.queryInstances.get(n);
|
|
2311
|
-
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;
|
|
2312
2327
|
}
|
|
2313
2328
|
/**
|
|
2314
2329
|
* Gets or creates a MutationResult for the given mutation definition.
|
|
@@ -2317,7 +2332,7 @@ class Ti {
|
|
|
2317
2332
|
getMutation(t) {
|
|
2318
2333
|
const i = t.id;
|
|
2319
2334
|
let n = this.mutationInstances.get(i);
|
|
2320
|
-
return n === void 0 && (n = new
|
|
2335
|
+
return n === void 0 && (n = new gi(t, this), this.mutationInstances.set(i, n)), n.task;
|
|
2321
2336
|
}
|
|
2322
2337
|
/**
|
|
2323
2338
|
* Parse data: validates, formats, produces parsed entity data objects.
|
|
@@ -2326,7 +2341,7 @@ class Ti {
|
|
|
2326
2341
|
parseData(t, i, n) {
|
|
2327
2342
|
const s = this.context.log?.warn ?? (() => {
|
|
2328
2343
|
}), r = new st();
|
|
2329
|
-
return r.reset(this, n, s), { data:
|
|
2344
|
+
return r.reset(this, n, s), { data: Zt(t, i, r), ctx: r };
|
|
2330
2345
|
}
|
|
2331
2346
|
/**
|
|
2332
2347
|
* Apply entities from parseData() via a single depth-first walk: creates/
|
|
@@ -2342,7 +2357,7 @@ class Ti {
|
|
|
2342
2357
|
* found in the store by the standard entity pipeline).
|
|
2343
2358
|
*/
|
|
2344
2359
|
parseAndApplyRootEntity(t, i, n, s, r = !1, o) {
|
|
2345
|
-
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);
|
|
2346
2361
|
const a = this.parseData(t, n, o), c = tt(a.ctx, a.data, s, r), f = x.get(c.data);
|
|
2347
2362
|
return this.entityMap.getEntity(f);
|
|
2348
2363
|
}
|
|
@@ -2375,7 +2390,7 @@ class Ti {
|
|
|
2375
2390
|
/* isPartialEvent */
|
|
2376
2391
|
!0
|
|
2377
2392
|
);
|
|
2378
|
-
const I =
|
|
2393
|
+
const I = ii(l, s, w);
|
|
2379
2394
|
tt(w, I, !0);
|
|
2380
2395
|
} catch (g) {
|
|
2381
2396
|
if (this.context.log?.warn?.("Failed to apply mutation event", g), u === void 0) {
|
|
@@ -2400,7 +2415,7 @@ class Ti {
|
|
|
2400
2415
|
for (const i of t) {
|
|
2401
2416
|
const n = Array.isArray(i), s = n ? i[0] : i, r = n ? i[1] : void 0, a = V.for(s).statics.id;
|
|
2402
2417
|
for (const [, c] of this.queryInstances)
|
|
2403
|
-
c.def.statics.id === a && (r === void 0 ||
|
|
2418
|
+
c.def.statics.id === a && (r === void 0 || Ai(c.resolvedParams, r)) && c.markStale();
|
|
2404
2419
|
}
|
|
2405
2420
|
}
|
|
2406
2421
|
// ======================================================
|
|
@@ -2421,7 +2436,7 @@ class Ti {
|
|
|
2421
2436
|
// ======================================================
|
|
2422
2437
|
getOrCreateMatcher(t) {
|
|
2423
2438
|
let i = this.constraintRegistry.get(t);
|
|
2424
|
-
return i === void 0 && (i = new
|
|
2439
|
+
return i === void 0 && (i = new bi(), this.constraintRegistry.set(t, i)), i;
|
|
2425
2440
|
}
|
|
2426
2441
|
registerLiveCollection(t) {
|
|
2427
2442
|
for (const [i, n] of t._entityDefsByTypename)
|
|
@@ -2436,7 +2451,7 @@ class Ti {
|
|
|
2436
2451
|
routeEvent(t, i, n, s, r, o, a) {
|
|
2437
2452
|
const c = this.constraintRegistry.get(t);
|
|
2438
2453
|
if (c === void 0) return;
|
|
2439
|
-
const f = r !== void 0 ? { ...i, [
|
|
2454
|
+
const f = r !== void 0 ? { ...i, [ae]: r } : i;
|
|
2440
2455
|
c.routeEvent(t, f, n, s, o, a);
|
|
2441
2456
|
}
|
|
2442
2457
|
destroy() {
|
|
@@ -2446,8 +2461,8 @@ class Ti {
|
|
|
2446
2461
|
this.adapters.clear(), this.queryInstances.clear(), this.mutationInstances.clear(), this.constraintRegistry.clear(), this.typenameRegistry.clear(), this.mergedDefCache.clear();
|
|
2447
2462
|
}
|
|
2448
2463
|
}
|
|
2449
|
-
const
|
|
2450
|
-
function
|
|
2464
|
+
const Si = Tt(void 0);
|
|
2465
|
+
function Ai(e, t) {
|
|
2451
2466
|
if (e === void 0) return !1;
|
|
2452
2467
|
for (const i in t)
|
|
2453
2468
|
if (e[i] !== t[i]) return !1;
|
|
@@ -2455,31 +2470,31 @@ function xi(e, t) {
|
|
|
2455
2470
|
}
|
|
2456
2471
|
export {
|
|
2457
2472
|
Q as A,
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2473
|
+
lt as E,
|
|
2474
|
+
De as G,
|
|
2475
|
+
L,
|
|
2461
2476
|
d as M,
|
|
2462
|
-
|
|
2463
|
-
|
|
2477
|
+
se as N,
|
|
2478
|
+
jt as Q,
|
|
2464
2479
|
B as R,
|
|
2465
2480
|
_ as V,
|
|
2466
2481
|
ft as a,
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
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,
|
|
2479
2494
|
W as n,
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2495
|
+
Li as o,
|
|
2496
|
+
Pi as q,
|
|
2497
|
+
zt as r,
|
|
2498
|
+
ti as t
|
|
2484
2499
|
};
|
|
2485
|
-
//# sourceMappingURL=QueryClient-
|
|
2500
|
+
//# sourceMappingURL=QueryClient-D64xo0EA.js.map
|