fetchium 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/development/QueryClient-D_e76rYS.js +2 -0
- package/dist/cjs/development/QueryClient-D_e76rYS.js.map +1 -0
- package/dist/cjs/development/index.js +1 -1
- package/dist/cjs/{production/mutation-CjSajlTU.js → development/mutation-bq06T6Wg.js} +2 -2
- package/dist/cjs/{production/mutation-CjSajlTU.js.map → development/mutation-bq06T6Wg.js.map} +1 -1
- package/dist/cjs/development/react/index.js +1 -1
- package/dist/cjs/development/rest/index.js +1 -1
- package/dist/cjs/development/rest/index.js.map +1 -1
- package/dist/cjs/development/topic/index.js +1 -1
- package/dist/cjs/production/QueryClient-BPdrfgtE.js +2 -0
- package/dist/cjs/production/QueryClient-BPdrfgtE.js.map +1 -0
- package/dist/cjs/production/index.js +1 -1
- package/dist/cjs/{development/mutation-OJNwoJcf.js → production/mutation-BVVlcTsK.js} +2 -2
- package/dist/cjs/{development/mutation-OJNwoJcf.js.map → production/mutation-BVVlcTsK.js.map} +1 -1
- package/dist/cjs/production/react/index.js +1 -1
- package/dist/cjs/production/rest/index.js +1 -1
- package/dist/cjs/production/rest/index.js.map +1 -1
- package/dist/cjs/production/topic/index.js +1 -1
- package/dist/esm/QueryResult.d.ts +5 -5
- package/dist/esm/QueryResult.d.ts.map +1 -1
- package/dist/esm/development/{QueryClient-DfxP7pt2.js → QueryClient-CkO_s9Uh.js} +347 -338
- package/dist/esm/development/QueryClient-CkO_s9Uh.js.map +1 -0
- package/dist/esm/development/index.js +2 -2
- package/dist/esm/development/{mutation-DZAq7Pbu.js → mutation-SZTEGudR.js} +2 -2
- package/dist/esm/development/{mutation-DZAq7Pbu.js.map → mutation-SZTEGudR.js.map} +1 -1
- package/dist/esm/development/react/index.js +1 -1
- package/dist/esm/development/rest/index.js +8 -8
- package/dist/esm/development/rest/index.js.map +1 -1
- package/dist/esm/development/topic/index.js +1 -1
- package/dist/esm/fieldRef.d.ts.map +1 -1
- package/dist/esm/production/{QueryClient-DrWSXg0y.js → QueryClient--PrsE8Kj.js} +286 -277
- package/dist/esm/production/QueryClient--PrsE8Kj.js.map +1 -0
- package/dist/esm/production/index.js +2 -2
- package/dist/esm/production/{mutation-B8dmX5lz.js → mutation-20F2qe90.js} +2 -2
- package/dist/esm/production/{mutation-B8dmX5lz.js.map → mutation-20F2qe90.js.map} +1 -1
- package/dist/esm/production/react/index.js +1 -1
- package/dist/esm/production/rest/index.js +8 -8
- package/dist/esm/production/rest/index.js.map +1 -1
- package/dist/esm/production/topic/index.js +1 -1
- package/dist/esm/rest/RESTQuery.d.ts +2 -0
- package/dist/esm/rest/RESTQuery.d.ts.map +1 -1
- package/dist/esm/rest/RESTQueryAdapter.d.ts.map +1 -1
- package/package.json +1 -1
- package/plugin/docs/api/fetchium.md +16 -15
- package/plugin/docs/core/queries.md +10 -3
- package/plugin/docs/reference/rest-queries.md +1 -1
- package/dist/cjs/development/QueryClient-BefSCMoE.js +0 -2
- package/dist/cjs/development/QueryClient-BefSCMoE.js.map +0 -1
- package/dist/cjs/production/QueryClient-rbPYznie.js +0 -2
- package/dist/cjs/production/QueryClient-rbPYznie.js.map +0 -1
- package/dist/esm/development/QueryClient-DfxP7pt2.js.map +0 -1
- package/dist/esm/production/QueryClient-DrWSXg0y.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { notifier as
|
|
1
|
+
import { notifier as H, relay as Ft, setScopeOwner as ve, reactiveMethod as _e, signal as Tt, context as Pt, getContext as me, reactiveSignal as nt, task as we, isSignal as Ee, watcher as be } from "signalium";
|
|
2
2
|
import { registerCustomHash as Ce, hashValue as D, registerCustomSnapshot as xe } from "signalium/utils";
|
|
3
|
-
import { d as
|
|
4
|
-
import { SyncQueryStore as Oe, MemoryPersistentStore as
|
|
3
|
+
import { d as jt } from "./shared-DcuVH8Pf.js";
|
|
4
|
+
import { SyncQueryStore as Oe, MemoryPersistentStore as Se } from "./stores/sync.js";
|
|
5
5
|
var L = /* @__PURE__ */ ((e) => (e.Always = "always", e.Online = "online", e.OfflineFirst = "offlineFirst", e))(L || {}), d = /* @__PURE__ */ ((e) => (e[e.UNDEFINED = 1] = "UNDEFINED", e[e.NULL = 2] = "NULL", e[e.NUMBER = 4] = "NUMBER", e[e.STRING = 8] = "STRING", e[e.BOOLEAN = 16] = "BOOLEAN", e[e.OBJECT = 32] = "OBJECT", e[e.ARRAY = 64] = "ARRAY", e[e.ID = 128] = "ID", e[e.RECORD = 256] = "RECORD", e[e.UNION = 512] = "UNION", e[e.ENTITY = 1024] = "ENTITY", e[e.HAS_FORMAT = 4096] = "HAS_FORMAT", e[e.IS_EAGER_FORMAT = 8192] = "IS_EAGER_FORMAT", e[e.PARSE_RESULT = 16384] = "PARSE_RESULT", e[e.LIVE = 32768] = "LIVE", e))(d || {});
|
|
6
|
-
const B = /* @__PURE__ */ Symbol("array"), Y = /* @__PURE__ */ Symbol("record"),
|
|
7
|
-
var
|
|
6
|
+
const B = /* @__PURE__ */ Symbol("array"), Y = /* @__PURE__ */ Symbol("record"), Lt = /* @__PURE__ */ Symbol("QUERY_ID");
|
|
7
|
+
var dt = /* @__PURE__ */ ((e) => (e[e.Array = 0] = "Array", e[e.Value = 1] = "Value", e))(dt || {});
|
|
8
8
|
class q {
|
|
9
9
|
type;
|
|
10
10
|
entityDefs;
|
|
@@ -46,8 +46,8 @@ const x = /* @__PURE__ */ new WeakMap();
|
|
|
46
46
|
function F(e) {
|
|
47
47
|
return x.get(e);
|
|
48
48
|
}
|
|
49
|
-
var
|
|
50
|
-
class
|
|
49
|
+
var J = /* @__PURE__ */ ((e) => (e[e.Query = 0] = "Query", e[e.Entity = 1] = "Entity", e))(J || {});
|
|
50
|
+
class Re {
|
|
51
51
|
constructor(t, i, n) {
|
|
52
52
|
this._onEvict = i, this._intervalId = setInterval(this._tick, t * 6e4 * n);
|
|
53
53
|
}
|
|
@@ -88,7 +88,7 @@ class Ae {
|
|
|
88
88
|
}
|
|
89
89
|
const { _buckets: s } = this;
|
|
90
90
|
let r = s.get(i);
|
|
91
|
-
r || (r = new
|
|
91
|
+
r || (r = new Re(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) {
|
|
@@ -121,15 +121,15 @@ class De {
|
|
|
121
121
|
destroy() {
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
const G = /* @__PURE__ */ Symbol("fieldRef"), M = /* @__PURE__ */ Symbol("fieldRefPath"),
|
|
125
|
-
function
|
|
124
|
+
const G = /* @__PURE__ */ Symbol("fieldRef"), M = /* @__PURE__ */ Symbol("fieldRefPath"), lt = /* @__PURE__ */ Symbol("DEFINITION_TARGET"), W = /* @__PURE__ */ Symbol("CANCEL_PROXY"), Ne = /\[([^\]]+)\]/g;
|
|
125
|
+
function qt(e) {
|
|
126
126
|
const t = {
|
|
127
127
|
[G]: !0,
|
|
128
128
|
[M]: e
|
|
129
129
|
};
|
|
130
|
-
return new Proxy(t,
|
|
130
|
+
return new Proxy(t, Ie);
|
|
131
131
|
}
|
|
132
|
-
const
|
|
132
|
+
const Ie = {
|
|
133
133
|
get(e, t) {
|
|
134
134
|
if (t === G) return !0;
|
|
135
135
|
if (t === M) return e[M];
|
|
@@ -139,31 +139,31 @@ const Ne = {
|
|
|
139
139
|
}
|
|
140
140
|
if (typeof t == "symbol") return;
|
|
141
141
|
const i = e[M];
|
|
142
|
-
return
|
|
142
|
+
return qt([...i, t]);
|
|
143
143
|
},
|
|
144
144
|
has(e, t) {
|
|
145
145
|
return t === G || t === M;
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
|
-
function
|
|
148
|
+
function Ut(e) {
|
|
149
149
|
return typeof e == "object" && e !== null && e[G] === !0;
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function Vt(e) {
|
|
152
152
|
return e[M];
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function Kt(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
|
-
return i ===
|
|
161
|
-
} : typeof i == "symbol" ? t[i] :
|
|
160
|
+
return i === lt ? t : i === W ? () => {
|
|
161
|
+
} : typeof i == "symbol" ? t[i] : qt([i]);
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
165
|
function Me(e) {
|
|
166
|
-
const t = e[
|
|
166
|
+
const t = e[lt];
|
|
167
167
|
e[W]();
|
|
168
168
|
const i = {};
|
|
169
169
|
for (const r of Object.getOwnPropertyNames(t))
|
|
@@ -180,7 +180,7 @@ function Me(e) {
|
|
|
180
180
|
}
|
|
181
181
|
return { fields: i, methods: n };
|
|
182
182
|
}
|
|
183
|
-
function
|
|
183
|
+
function ht(e, t) {
|
|
184
184
|
let i = t;
|
|
185
185
|
for (const n of e) {
|
|
186
186
|
if (i == null) return;
|
|
@@ -189,14 +189,14 @@ function lt(e, t) {
|
|
|
189
189
|
return i;
|
|
190
190
|
}
|
|
191
191
|
function ke(e, t) {
|
|
192
|
-
return e.replace(
|
|
193
|
-
const s = n.split("."), r =
|
|
192
|
+
return e.replace(Ne, (i, n) => {
|
|
193
|
+
const s = n.split("."), r = ht(s, t);
|
|
194
194
|
return r != null ? encodeURIComponent(String(r)) : "";
|
|
195
195
|
});
|
|
196
196
|
}
|
|
197
197
|
function z(e, t) {
|
|
198
|
-
if (
|
|
199
|
-
return
|
|
198
|
+
if (Ut(e))
|
|
199
|
+
return ht(Vt(e), t);
|
|
200
200
|
if (typeof e == "string")
|
|
201
201
|
return ke(e, t);
|
|
202
202
|
if (Array.isArray(e))
|
|
@@ -209,29 +209,29 @@ function z(e, t) {
|
|
|
209
209
|
}
|
|
210
210
|
return e;
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function st(e, t, i) {
|
|
213
213
|
const n = e.fields, s = e.methods, r = { params: t }, o = {};
|
|
214
214
|
for (const [a, c] of Object.entries(n))
|
|
215
215
|
o[a] = z(c, r);
|
|
216
|
-
o.params = t, o.context = i;
|
|
216
|
+
o.params = t, o.context = i, o.responseNotifier = H();
|
|
217
217
|
for (const [a, c] of Object.entries(s))
|
|
218
218
|
o[a] = c.bind(o);
|
|
219
219
|
return o;
|
|
220
220
|
}
|
|
221
|
-
class
|
|
221
|
+
class yt {
|
|
222
222
|
static cache;
|
|
223
223
|
constructor() {
|
|
224
|
-
return
|
|
224
|
+
return Kt(this);
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
|
-
const
|
|
228
|
-
function
|
|
227
|
+
const $t = Object.entries, rt = Object.keys;
|
|
228
|
+
function xt(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
231
|
function Fe(e) {
|
|
232
232
|
return e instanceof _ && (e.mask & d.OBJECT) !== 0 && (e.mask & (d.ENTITY | d.ARRAY | d.UNION | d.RECORD | d.LIVE)) === 0;
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function Qt(e, t, i) {
|
|
235
235
|
const n = /* @__PURE__ */ new Set();
|
|
236
236
|
for (const r of e)
|
|
237
237
|
if (r !== void 0)
|
|
@@ -247,10 +247,10 @@ function $t(e, t, i) {
|
|
|
247
247
|
u !== void 0 ? (o++, a === void 0 && (a = u), Fe(u) ? c.push(u.shape) : (f = !1, c.push(void 0))) : (f = !1, c.push(void 0));
|
|
248
248
|
}
|
|
249
249
|
if (f && o > 0) {
|
|
250
|
-
const l =
|
|
251
|
-
s[r] = o < t ?
|
|
250
|
+
const l = Qt(c, t), u = new _(d.OBJECT, l);
|
|
251
|
+
s[r] = o < t ? xt(u) : u;
|
|
252
252
|
} else
|
|
253
|
-
s[r] = o < t ?
|
|
253
|
+
s[r] = o < t ? xt(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 = Qt(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)
|
|
@@ -322,7 +322,7 @@ class _ {
|
|
|
322
322
|
return n._methods = t._methods, n._entityConfig = t._entityConfig, n._entityClass = t._entityClass, n._entityCache = t._entityCache, n._liveConfig = t._liveConfig, n;
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
|
-
class
|
|
325
|
+
class X extends Set {
|
|
326
326
|
lowercaseMap;
|
|
327
327
|
// lowercase -> canonical (strings only)
|
|
328
328
|
constructor(t) {
|
|
@@ -358,27 +358,27 @@ class J extends Set {
|
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
360
|
const Te = 1128875347;
|
|
361
|
-
Ce(
|
|
361
|
+
Ce(X, (e) => {
|
|
362
362
|
let t = Te;
|
|
363
363
|
for (const i of e)
|
|
364
364
|
t += D(i);
|
|
365
365
|
return t >>> 0;
|
|
366
366
|
});
|
|
367
|
-
function
|
|
367
|
+
function pt(e, t) {
|
|
368
368
|
return new _(e, t);
|
|
369
369
|
}
|
|
370
370
|
function Pe(e) {
|
|
371
|
-
return
|
|
371
|
+
return pt(d.ARRAY, e);
|
|
372
372
|
}
|
|
373
373
|
function je(e) {
|
|
374
|
-
return
|
|
374
|
+
return pt(d.RECORD | d.OBJECT, e);
|
|
375
375
|
}
|
|
376
376
|
function Le(e) {
|
|
377
|
-
return
|
|
377
|
+
return pt(d.PARSE_RESULT, e);
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function Bt(e, t) {
|
|
380
380
|
let i = e, n, s, r;
|
|
381
|
-
for (const [o, a] of
|
|
381
|
+
for (const [o, a] of $t(t))
|
|
382
382
|
switch (typeof a) {
|
|
383
383
|
case "number":
|
|
384
384
|
if ((a & d.ID) !== 0) {
|
|
@@ -393,7 +393,7 @@ function Qt(e, t) {
|
|
|
393
393
|
s = o, r = a;
|
|
394
394
|
break;
|
|
395
395
|
case "object":
|
|
396
|
-
if (a instanceof
|
|
396
|
+
if (a instanceof X || a instanceof Set)
|
|
397
397
|
break;
|
|
398
398
|
a.mask & d.LIVE && (i |= d.LIVE);
|
|
399
399
|
break;
|
|
@@ -401,9 +401,9 @@ function Qt(e, t) {
|
|
|
401
401
|
return new _(i, t, void 0, s, r, n);
|
|
402
402
|
}
|
|
403
403
|
function qe(e) {
|
|
404
|
-
return
|
|
404
|
+
return Bt(d.OBJECT, e);
|
|
405
405
|
}
|
|
406
|
-
function
|
|
406
|
+
function Ot(e, t, i) {
|
|
407
407
|
const n = e.mask;
|
|
408
408
|
if ((n & d.UNION) !== 0) {
|
|
409
409
|
const s = e;
|
|
@@ -416,7 +416,7 @@ function xt(e, t, i) {
|
|
|
416
416
|
}
|
|
417
417
|
const r = s.shape;
|
|
418
418
|
if (r !== void 0)
|
|
419
|
-
for (const o of [...
|
|
419
|
+
for (const o of [...rt(r), B, Y]) {
|
|
420
420
|
const a = r[o];
|
|
421
421
|
if (t[o] !== void 0 && t[o] !== a)
|
|
422
422
|
throw new Error(
|
|
@@ -444,7 +444,7 @@ function xt(e, t, i) {
|
|
|
444
444
|
}
|
|
445
445
|
return i;
|
|
446
446
|
}
|
|
447
|
-
function
|
|
447
|
+
function gt(...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 pt(...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 = Ot(s, o, a)), a = Ot(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,24 +473,24 @@ function pt(...e) {
|
|
|
473
473
|
const f = i | c | d.UNION;
|
|
474
474
|
return new _(f, o, r, a);
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function vt(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 gt(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
485
|
const Ue = /* @__PURE__ */ new WeakMap(), Ve = /* @__PURE__ */ new WeakMap(), Ke = /* @__PURE__ */ new WeakMap();
|
|
486
486
|
function $e(e) {
|
|
487
|
-
return
|
|
487
|
+
return vt(e, d.UNDEFINED | d.NULL, Ke);
|
|
488
488
|
}
|
|
489
489
|
function Qe(e) {
|
|
490
|
-
return
|
|
490
|
+
return vt(e, d.UNDEFINED, Ue);
|
|
491
491
|
}
|
|
492
492
|
function Be(e) {
|
|
493
|
-
return
|
|
493
|
+
return vt(e, d.NULL, Ve);
|
|
494
494
|
}
|
|
495
495
|
function Ye(e) {
|
|
496
496
|
return e;
|
|
@@ -498,39 +498,39 @@ function Ye(e) {
|
|
|
498
498
|
function Ge(e) {
|
|
499
499
|
return /* @__PURE__ */ new Set([e]);
|
|
500
500
|
}
|
|
501
|
-
const
|
|
502
|
-
|
|
503
|
-
const
|
|
501
|
+
const Yt = ((...e) => new Set(e));
|
|
502
|
+
Yt.caseInsensitive = (...e) => new X(e);
|
|
503
|
+
const Gt = 16;
|
|
504
504
|
let We = 0;
|
|
505
|
-
const
|
|
505
|
+
const ot = [], Wt = [], zt = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new WeakSet();
|
|
506
506
|
class U {
|
|
507
507
|
_raw;
|
|
508
508
|
_formatted;
|
|
509
509
|
_parsed;
|
|
510
510
|
_formatId;
|
|
511
511
|
constructor(t, i, n) {
|
|
512
|
-
this._raw = t, this._formatId = i, n ? (this._formatted =
|
|
512
|
+
this._raw = t, this._formatId = i, n ? (this._formatted = ot[i](t), this._parsed = !0) : this._parsed = !1, Z.add(this);
|
|
513
513
|
}
|
|
514
514
|
getValue() {
|
|
515
|
-
return this._parsed || (this._formatted =
|
|
515
|
+
return this._parsed || (this._formatted = ot[this._formatId](this._raw), this._parsed = !0), this._formatted;
|
|
516
516
|
}
|
|
517
517
|
toJSON() {
|
|
518
|
-
return this._parsed ?
|
|
518
|
+
return this._parsed ? Wt[this._formatId](this._formatted) : this._raw;
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
521
|
function ze(e) {
|
|
522
|
-
const t =
|
|
522
|
+
const t = zt.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
|
|
527
|
+
function Ht(e, t, i, n, s) {
|
|
528
528
|
const r = We++;
|
|
529
|
-
|
|
530
|
-
const o = s?.eager ?? !0, c = r <<
|
|
531
|
-
|
|
529
|
+
ot[r] = i, Wt[r] = n;
|
|
530
|
+
const o = s?.eager ?? !0, c = r << Gt | t | d.HAS_FORMAT | (o ? d.IS_EAGER_FORMAT : 0);
|
|
531
|
+
zt.set(e, c);
|
|
532
532
|
}
|
|
533
|
-
|
|
533
|
+
Ht(
|
|
534
534
|
"date",
|
|
535
535
|
d.STRING,
|
|
536
536
|
(e) => {
|
|
@@ -547,7 +547,7 @@ zt(
|
|
|
547
547
|
return `${t}-${i}-${n}`;
|
|
548
548
|
}
|
|
549
549
|
);
|
|
550
|
-
|
|
550
|
+
Ht(
|
|
551
551
|
"date-time",
|
|
552
552
|
d.STRING,
|
|
553
553
|
(e) => {
|
|
@@ -558,21 +558,21 @@ zt(
|
|
|
558
558
|
},
|
|
559
559
|
(e) => e.toISOString()
|
|
560
560
|
);
|
|
561
|
-
const
|
|
561
|
+
const St = /* @__PURE__ */ new WeakMap();
|
|
562
562
|
function P(e) {
|
|
563
|
-
let t =
|
|
563
|
+
let t = St.get(e);
|
|
564
564
|
if (t === void 0) {
|
|
565
|
-
const i = new e(), n = i[
|
|
565
|
+
const i = new e(), n = i[lt] ?? i;
|
|
566
566
|
i[W] && i[W]();
|
|
567
567
|
const s = {};
|
|
568
|
-
for (const [f, l] of
|
|
568
|
+
for (const [f, l] of $t(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 !== yt && typeof f == "function") {
|
|
574
574
|
const u = P(f).shape;
|
|
575
|
-
for (const y of
|
|
575
|
+
for (const y of rt(u))
|
|
576
576
|
if (y in s && s[y] !== u[y])
|
|
577
577
|
throw new Error(`Cannot extend: field '${y}' already exists in type definition`);
|
|
578
578
|
}
|
|
@@ -580,16 +580,16 @@ function P(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 = Bt(d.ENTITY | d.OBJECT, s), t._entityClass = e, rt(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), St.set(e, t);
|
|
586
586
|
}
|
|
587
587
|
return t;
|
|
588
588
|
}
|
|
589
589
|
function He(e) {
|
|
590
590
|
return P(e);
|
|
591
591
|
}
|
|
592
|
-
function
|
|
592
|
+
function Jt(e, t) {
|
|
593
593
|
if (t == null) return;
|
|
594
594
|
const i = /* @__PURE__ */ new Map();
|
|
595
595
|
if (Array.isArray(t))
|
|
@@ -612,22 +612,22 @@ function Ht(e, t) {
|
|
|
612
612
|
}
|
|
613
613
|
return i.size > 0 ? i : void 0;
|
|
614
614
|
}
|
|
615
|
-
function
|
|
615
|
+
function Xt(e) {
|
|
616
616
|
return Array.isArray(e) ? e.map((t) => P(t)) : [P(e)];
|
|
617
617
|
}
|
|
618
618
|
function Je(e, t) {
|
|
619
|
-
const i =
|
|
619
|
+
const i = Xt(e), n = i.length === 1 ? i[0] : gt(...i.map((o) => o)), s = d.ARRAY | d.LIVE, r = new _(s, n);
|
|
620
620
|
return r._liveConfig = q.array(
|
|
621
621
|
i,
|
|
622
|
-
|
|
622
|
+
Jt(i, t?.constraints),
|
|
623
623
|
t?.sort
|
|
624
624
|
), r;
|
|
625
625
|
}
|
|
626
626
|
function Xe(e, t, i) {
|
|
627
|
-
const n =
|
|
627
|
+
const n = Xt(t), s = e, r = d.LIVE, o = new _(r, void 0);
|
|
628
628
|
return o._liveConfig = q.value(
|
|
629
629
|
n,
|
|
630
|
-
|
|
630
|
+
Jt(n, i?.constraints),
|
|
631
631
|
s,
|
|
632
632
|
i.onCreate,
|
|
633
633
|
i.onUpdate,
|
|
@@ -638,7 +638,7 @@ const Ze = {
|
|
|
638
638
|
format: ze,
|
|
639
639
|
typename: Ye,
|
|
640
640
|
const: Ge,
|
|
641
|
-
enum:
|
|
641
|
+
enum: Yt,
|
|
642
642
|
id: d.ID | d.STRING | d.NUMBER,
|
|
643
643
|
string: d.STRING,
|
|
644
644
|
number: d.NUMBER,
|
|
@@ -648,7 +648,7 @@ const Ze = {
|
|
|
648
648
|
array: Pe,
|
|
649
649
|
object: qe,
|
|
650
650
|
record: je,
|
|
651
|
-
union:
|
|
651
|
+
union: gt,
|
|
652
652
|
nullish: $e,
|
|
653
653
|
optional: Qe,
|
|
654
654
|
nullable: Be,
|
|
@@ -660,7 +660,7 @@ const Ze = {
|
|
|
660
660
|
function j(e, t, i) {
|
|
661
661
|
return new TypeError(`Validation error at ${e}`);
|
|
662
662
|
}
|
|
663
|
-
const
|
|
663
|
+
const Zt = Array.isArray;
|
|
664
664
|
function Rt(e) {
|
|
665
665
|
if (e === null) return d.NULL;
|
|
666
666
|
switch (typeof e) {
|
|
@@ -673,7 +673,7 @@ function Rt(e) {
|
|
|
673
673
|
case "undefined":
|
|
674
674
|
return d.UNDEFINED;
|
|
675
675
|
case "object":
|
|
676
|
-
return
|
|
676
|
+
return Zt(e) ? d.ARRAY : d.OBJECT;
|
|
677
677
|
default:
|
|
678
678
|
throw new Error(`Invalid type: ${typeof e}`);
|
|
679
679
|
}
|
|
@@ -684,7 +684,7 @@ function Mi(e) {
|
|
|
684
684
|
function T(e) {
|
|
685
685
|
if (e === null || typeof e != "object")
|
|
686
686
|
return e;
|
|
687
|
-
if (
|
|
687
|
+
if (Zt(e))
|
|
688
688
|
return e.map((i) => T(i));
|
|
689
689
|
if (e instanceof Date)
|
|
690
690
|
return new Date(e.getTime());
|
|
@@ -705,9 +705,9 @@ function T(e) {
|
|
|
705
705
|
t[i] = T(e[i]);
|
|
706
706
|
return t;
|
|
707
707
|
}
|
|
708
|
-
const
|
|
708
|
+
const _t = Object.entries, ti = () => {
|
|
709
709
|
};
|
|
710
|
-
class
|
|
710
|
+
class at {
|
|
711
711
|
queryClient = void 0;
|
|
712
712
|
preloadedEntities = void 0;
|
|
713
713
|
warn = ti;
|
|
@@ -720,14 +720,14 @@ class rt {
|
|
|
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 te(e, t, i) {
|
|
724
724
|
return k(e, t, i, "");
|
|
725
725
|
}
|
|
726
726
|
function ei(e, t, i) {
|
|
727
|
-
return
|
|
727
|
+
return mt(e, t, i);
|
|
728
728
|
}
|
|
729
|
-
function
|
|
730
|
-
const s = e >>
|
|
729
|
+
function At(e, t, i, n) {
|
|
730
|
+
const s = e >> Gt;
|
|
731
731
|
if ((e & d.IS_EAGER_FORMAT) !== 0)
|
|
732
732
|
try {
|
|
733
733
|
return new U(t, s, !0);
|
|
@@ -746,7 +746,7 @@ function St(e, t, i, n) {
|
|
|
746
746
|
}
|
|
747
747
|
function k(e, t, i, n) {
|
|
748
748
|
const s = t;
|
|
749
|
-
if (s instanceof
|
|
749
|
+
if (s instanceof X) {
|
|
750
750
|
const c = s.get(e);
|
|
751
751
|
if (c === void 0) throw j(n);
|
|
752
752
|
return c;
|
|
@@ -769,10 +769,10 @@ function k(e, t, i, n) {
|
|
|
769
769
|
}
|
|
770
770
|
throw j(n);
|
|
771
771
|
}
|
|
772
|
-
return (s & d.HAS_FORMAT) !== 0 && e !== null && e !== void 0 ?
|
|
772
|
+
return (s & d.HAS_FORMAT) !== 0 && e !== null && e !== void 0 ? At(s, e, i, n) : e;
|
|
773
773
|
}
|
|
774
774
|
const r = s.mask, o = s._liveConfig;
|
|
775
|
-
if (o !== void 0 && o.type ===
|
|
775
|
+
if (o !== void 0 && o.type === dt.Value)
|
|
776
776
|
return o.valueType !== void 0 ? k(e, o.valueType, i, n) : e;
|
|
777
777
|
if ((r & d.PARSE_RESULT) !== 0)
|
|
778
778
|
try {
|
|
@@ -788,12 +788,12 @@ function k(e, t, i, n) {
|
|
|
788
788
|
}
|
|
789
789
|
throw j(n);
|
|
790
790
|
}
|
|
791
|
-
return a < d.OBJECT ? (r & d.HAS_FORMAT) !== 0 && e !== null && e !== void 0 ?
|
|
791
|
+
return a < d.OBJECT ? (r & d.HAS_FORMAT) !== 0 && e !== null && e !== void 0 ? At(r, e, i, n) : e : (r & d.UNION) !== 0 ? ii(a, e, s, i, n) : a === d.ARRAY ? ee(e, s.shape, i, n) : (r & d.RECORD) !== 0 ? ie(e, s.shape, i, n) : (r & d.ENTITY) !== 0 && i.queryClient !== void 0 ? mt(e, s, i) : ne(e, s, i, n);
|
|
792
792
|
}
|
|
793
793
|
function ii(e, t, i, n, s) {
|
|
794
794
|
if (e === d.ARRAY) {
|
|
795
795
|
const r = i.shape[B];
|
|
796
|
-
return r === void 0 || typeof r == "number" ? t :
|
|
796
|
+
return r === void 0 || typeof r == "number" ? t : ee(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 ii(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 ie(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 ? mt(t, a, n) : ne(t, a, n, s);
|
|
811
811
|
}
|
|
812
812
|
}
|
|
813
|
-
function
|
|
813
|
+
function ee(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 te(e, t, i, n) {
|
|
|
824
824
|
}
|
|
825
825
|
return s;
|
|
826
826
|
}
|
|
827
|
-
function
|
|
828
|
-
for (const [s, r] of
|
|
827
|
+
function ie(e, t, i, n) {
|
|
828
|
+
for (const [s, r] of _t(e))
|
|
829
829
|
e[s] = k(r, t, i, `${n}["${s}"]`);
|
|
830
830
|
return e;
|
|
831
831
|
}
|
|
832
|
-
function
|
|
832
|
+
function ne(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 _t(s))
|
|
837
837
|
e[r] = k(e[r], o, i, `${n}.${r}`);
|
|
838
838
|
return e;
|
|
839
839
|
}
|
|
840
|
-
function
|
|
840
|
+
function mt(e, t, i) {
|
|
841
841
|
const n = i.queryClient, s = i.preloadedEntities;
|
|
842
842
|
let r, o;
|
|
843
843
|
if (s !== void 0)
|
|
@@ -867,7 +867,7 @@ function _t(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 _t(v))
|
|
871
871
|
l && !(p in e) || (c[p] = k(e[p], g, i, `${y}.${p}`));
|
|
872
872
|
return c;
|
|
873
873
|
}
|
|
@@ -892,7 +892,7 @@ function si(e, t, i) {
|
|
|
892
892
|
const ri = Object.prototype, Q = /* @__PURE__ */ new WeakMap();
|
|
893
893
|
function A(e) {
|
|
894
894
|
if (typeof e != "object" || e === null) return e;
|
|
895
|
-
if (
|
|
895
|
+
if (Z.has(e)) return A(e.getValue());
|
|
896
896
|
if (x.has(e)) return e;
|
|
897
897
|
if (Array.isArray(e)) {
|
|
898
898
|
let t = Q.get(e);
|
|
@@ -950,7 +950,7 @@ const oi = {
|
|
|
950
950
|
return o ? a : r;
|
|
951
951
|
};
|
|
952
952
|
xe(
|
|
953
|
-
|
|
953
|
+
yt,
|
|
954
954
|
ci
|
|
955
955
|
);
|
|
956
956
|
class fi {
|
|
@@ -971,7 +971,7 @@ class fi {
|
|
|
971
971
|
_extraMethods;
|
|
972
972
|
_extraGetters;
|
|
973
973
|
constructor(t, i, n, s, r, o) {
|
|
974
|
-
this._notifier =
|
|
974
|
+
this._notifier = H(), this._queryClient = o, this.key = t, this.typename = i, this.id = n, this.idField = s, this.data = r, this.entityRefs = void 0;
|
|
975
975
|
}
|
|
976
976
|
retain() {
|
|
977
977
|
this.refCount++;
|
|
@@ -982,7 +982,7 @@ class fi {
|
|
|
982
982
|
if (--this.refCount > 0 || this.refCount < 0)
|
|
983
983
|
return;
|
|
984
984
|
const t = this._entityCache?.gcTime;
|
|
985
|
-
t !== void 0 ? this._queryClient.gcManager.schedule(this.key, t,
|
|
985
|
+
t !== void 0 ? this._queryClient.gcManager.schedule(this.key, t, J.Entity) : this.evict();
|
|
986
986
|
}
|
|
987
987
|
evict() {
|
|
988
988
|
const t = this.liveCollections.slice();
|
|
@@ -1046,11 +1046,11 @@ function ui(e, t, i) {
|
|
|
1046
1046
|
return n;
|
|
1047
1047
|
}
|
|
1048
1048
|
function di(e, t, i, n, s) {
|
|
1049
|
-
const r = i.shape ?? {}, o = i, a = o._methods, c = o._entityClass, f = o._entityConfig, l = c ? c.prototype :
|
|
1049
|
+
const r = i.shape ?? {}, o = i, a = o._methods, c = o._entityClass, f = o._entityConfig, l = c ? c.prototype : yt.prototype;
|
|
1050
1050
|
i.typenameField;
|
|
1051
1051
|
const u = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), v = () => ({ __entityRef: t });
|
|
1052
1052
|
let p;
|
|
1053
|
-
f?.hasSubscribe && a && "__subscribe" in a && (p =
|
|
1053
|
+
f?.hasSubscribe && a && "__subscribe" in a && (p = Ft((E) => {
|
|
1054
1054
|
const h = (w) => {
|
|
1055
1055
|
w.__eventSource = t, s.applyMutationEvent(w);
|
|
1056
1056
|
}, b = a.__subscribe.call(g, h);
|
|
@@ -1061,11 +1061,11 @@ function di(e, t, i, n, s) {
|
|
|
1061
1061
|
if (m.includes("__typename") || m.push("__typename"), a)
|
|
1062
1062
|
for (const E of Object.keys(a))
|
|
1063
1063
|
m.includes(E) || m.push(E);
|
|
1064
|
-
let
|
|
1064
|
+
let N, O = m;
|
|
1065
1065
|
function $() {
|
|
1066
1066
|
const E = e._extraMethods;
|
|
1067
|
-
if (E !==
|
|
1068
|
-
if (
|
|
1067
|
+
if (E !== N) {
|
|
1068
|
+
if (N = E, O = m.slice(), E !== void 0)
|
|
1069
1069
|
for (const b of Object.keys(E))
|
|
1070
1070
|
O.includes(b) || O.push(b);
|
|
1071
1071
|
const h = e._extraGetters;
|
|
@@ -1075,7 +1075,7 @@ function di(e, t, i, n, s) {
|
|
|
1075
1075
|
}
|
|
1076
1076
|
return O;
|
|
1077
1077
|
}
|
|
1078
|
-
const
|
|
1078
|
+
const S = {
|
|
1079
1079
|
getPrototypeOf() {
|
|
1080
1080
|
return l;
|
|
1081
1081
|
},
|
|
@@ -1085,36 +1085,36 @@ function di(e, t, i, n, s) {
|
|
|
1085
1085
|
if (h === "__context") return s.getContext();
|
|
1086
1086
|
if (h === "__typename") return e.typename;
|
|
1087
1087
|
if (p?.value, n.consume(), typeof h == "string") {
|
|
1088
|
-
const
|
|
1089
|
-
if (
|
|
1090
|
-
return
|
|
1091
|
-
const
|
|
1092
|
-
if (
|
|
1088
|
+
const I = e._extraGetters;
|
|
1089
|
+
if (I !== void 0 && h in I)
|
|
1090
|
+
return I[h]();
|
|
1091
|
+
const R = e._extraMethods;
|
|
1092
|
+
if (R !== void 0 && h in R) {
|
|
1093
1093
|
let C = u.get(h);
|
|
1094
|
-
return C || (C =
|
|
1094
|
+
return C || (C = R[h].bind(g), u.set(h, C)), C;
|
|
1095
1095
|
}
|
|
1096
1096
|
if (a && h in a) {
|
|
1097
1097
|
let C = u.get(h);
|
|
1098
|
-
return C || (C =
|
|
1098
|
+
return C || (C = _e(g, a[h].bind(g)), u.set(h, C)), C;
|
|
1099
1099
|
}
|
|
1100
1100
|
}
|
|
1101
1101
|
const w = e.data[h];
|
|
1102
|
-
if (typeof w == "object" && w !== null &&
|
|
1102
|
+
if (typeof w == "object" && w !== null && Z.has(w))
|
|
1103
1103
|
return A(w.getValue());
|
|
1104
1104
|
if (Array.isArray(w) && typeof h == "string") {
|
|
1105
|
-
const
|
|
1106
|
-
if (
|
|
1107
|
-
const
|
|
1108
|
-
if (
|
|
1109
|
-
const C =
|
|
1105
|
+
const I = r[h];
|
|
1106
|
+
if (I instanceof _ && (I.mask & d.ARRAY) !== 0) {
|
|
1107
|
+
const R = I.shape;
|
|
1108
|
+
if (R instanceof _ && (R.mask & d.ENTITY) !== 0) {
|
|
1109
|
+
const C = R.typenameValue;
|
|
1110
1110
|
if (C !== void 0) {
|
|
1111
|
-
const
|
|
1112
|
-
if (
|
|
1113
|
-
const
|
|
1114
|
-
if (
|
|
1115
|
-
return A(
|
|
1116
|
-
const
|
|
1117
|
-
return y.set(h, { source: w, filtered:
|
|
1111
|
+
const bt = s.getEntityDefsForTypename(C);
|
|
1112
|
+
if (bt !== void 0 && bt.length > 1) {
|
|
1113
|
+
const tt = y.get(h);
|
|
1114
|
+
if (tt !== void 0 && tt.source === w)
|
|
1115
|
+
return A(tt.filtered);
|
|
1116
|
+
const Ct = ui(w, R, s);
|
|
1117
|
+
return y.set(h, { source: w, filtered: Ct }), A(Ct);
|
|
1118
1118
|
}
|
|
1119
1119
|
}
|
|
1120
1120
|
}
|
|
@@ -1143,20 +1143,20 @@ function di(e, t, i, n, s) {
|
|
|
1143
1143
|
if (h === "__typename")
|
|
1144
1144
|
return { enumerable: !0, configurable: !0, value: e.typename, writable: !1 };
|
|
1145
1145
|
if (h in r)
|
|
1146
|
-
return { enumerable: !0, configurable: !0, value:
|
|
1146
|
+
return { enumerable: !0, configurable: !0, value: S.get(E, h, g), writable: !1 };
|
|
1147
1147
|
if (typeof h == "string") {
|
|
1148
1148
|
const b = e._extraGetters;
|
|
1149
1149
|
if (b && h in b)
|
|
1150
|
-
return { enumerable: !0, configurable: !0, value:
|
|
1150
|
+
return { enumerable: !0, configurable: !0, value: S.get(E, h, g), writable: !1 };
|
|
1151
1151
|
const w = e._extraMethods;
|
|
1152
1152
|
if (w && h in w)
|
|
1153
|
-
return { enumerable: !0, configurable: !0, value:
|
|
1153
|
+
return { enumerable: !0, configurable: !0, value: S.get(E, h, g), writable: !1 };
|
|
1154
1154
|
if (a && h in a)
|
|
1155
|
-
return { enumerable: !1, configurable: !0, value:
|
|
1155
|
+
return { enumerable: !1, configurable: !0, value: S.get(E, h, g), writable: !1 };
|
|
1156
1156
|
}
|
|
1157
1157
|
}
|
|
1158
1158
|
};
|
|
1159
|
-
return g = new Proxy({},
|
|
1159
|
+
return g = new Proxy({}, S), x.set(g, t), ve(g, s), g;
|
|
1160
1160
|
}
|
|
1161
1161
|
class li {
|
|
1162
1162
|
instances = /* @__PURE__ */ new Map();
|
|
@@ -1196,13 +1196,13 @@ class li {
|
|
|
1196
1196
|
this.persistEntity(t.key, t.data, i);
|
|
1197
1197
|
}
|
|
1198
1198
|
}
|
|
1199
|
-
class
|
|
1199
|
+
class se {
|
|
1200
1200
|
onlineSignal;
|
|
1201
1201
|
manualOverride = void 0;
|
|
1202
1202
|
eventListenersAttached = !1;
|
|
1203
1203
|
constructor(t) {
|
|
1204
1204
|
const i = t ?? this.detectOnlineStatus();
|
|
1205
|
-
this.onlineSignal =
|
|
1205
|
+
this.onlineSignal = Tt(i), this.canAttachListeners() && this.attachEventListeners();
|
|
1206
1206
|
}
|
|
1207
1207
|
/**
|
|
1208
1208
|
* Returns true if the network is currently online
|
|
@@ -1260,8 +1260,8 @@ class ne {
|
|
|
1260
1260
|
}, window.addEventListener("online", this.handleOnline), window.addEventListener("offline", this.handleOffline), this.eventListenersAttached = !0);
|
|
1261
1261
|
}
|
|
1262
1262
|
}
|
|
1263
|
-
class
|
|
1264
|
-
static onlineSignal =
|
|
1263
|
+
class re {
|
|
1264
|
+
static onlineSignal = Tt(!0);
|
|
1265
1265
|
get isOnline() {
|
|
1266
1266
|
return !0;
|
|
1267
1267
|
}
|
|
@@ -1270,13 +1270,13 @@ class se {
|
|
|
1270
1270
|
clearManualOverride() {
|
|
1271
1271
|
}
|
|
1272
1272
|
getOnlineSignal() {
|
|
1273
|
-
return
|
|
1273
|
+
return re.onlineSignal;
|
|
1274
1274
|
}
|
|
1275
1275
|
destroy() {
|
|
1276
1276
|
}
|
|
1277
1277
|
}
|
|
1278
|
-
const hi = new
|
|
1279
|
-
function
|
|
1278
|
+
const hi = new se(), ki = Pt(hi);
|
|
1279
|
+
function wt(e, t = typeof window > "u") {
|
|
1280
1280
|
let i;
|
|
1281
1281
|
e === !1 ? i = 0 : e === void 0 || e === !0 ? i = t ? 0 : 3 : typeof e == "number" ? i = e : i = e.retries;
|
|
1282
1282
|
const n = typeof e == "object" && e.retryDelay ? e.retryDelay : (s) => 1e3 * Math.pow(2, s);
|
|
@@ -1292,24 +1292,24 @@ class Fi {
|
|
|
1292
1292
|
params;
|
|
1293
1293
|
config;
|
|
1294
1294
|
constructor() {
|
|
1295
|
-
return
|
|
1295
|
+
return Kt(this);
|
|
1296
1296
|
}
|
|
1297
1297
|
}
|
|
1298
|
-
const
|
|
1298
|
+
const Dt = /* @__PURE__ */ new WeakMap();
|
|
1299
1299
|
class K {
|
|
1300
1300
|
constructor(t, i) {
|
|
1301
1301
|
this.captured = i, this.statics = t;
|
|
1302
1302
|
}
|
|
1303
1303
|
statics;
|
|
1304
1304
|
createExecutionContext(t, i) {
|
|
1305
|
-
return
|
|
1305
|
+
return st(this.captured, t, i);
|
|
1306
1306
|
}
|
|
1307
1307
|
resolveOptions(t) {
|
|
1308
|
-
const { methods: i } = this.captured, n = i.getConfig ? i.getConfig.call(t) : t.config, s =
|
|
1308
|
+
const { methods: i } = this.captured, n = i.getConfig ? i.getConfig.call(t) : t.config, s = wt(n?.retry);
|
|
1309
1309
|
return { config: n, retryConfig: s };
|
|
1310
1310
|
}
|
|
1311
1311
|
static for(t) {
|
|
1312
|
-
let i =
|
|
1312
|
+
let i = Dt.get(t);
|
|
1313
1313
|
if (i !== void 0)
|
|
1314
1314
|
return i;
|
|
1315
1315
|
const n = new t(), s = Me(n), r = String(s.methods.getIdentityKey.call(s.fields)), o = s.fields.result, a = o instanceof _ ? o : Ze.object(o), c = (a.mask & d.ENTITY) !== 0, f = t.cache, l = s.fields.fetchNext, u = t.adapter;
|
|
@@ -1324,60 +1324,60 @@ class K {
|
|
|
1324
1324
|
void 0,
|
|
1325
1325
|
r,
|
|
1326
1326
|
// typenameValue — unique per query class
|
|
1327
|
-
|
|
1327
|
+
Lt
|
|
1328
1328
|
// idField — symbol, injected onto payload before parse
|
|
1329
1329
|
);
|
|
1330
1330
|
return i = new K(
|
|
1331
1331
|
{ id: r, shape: v, cache: f, rawFetchNext: l, hasSendNext: y, isEntityResult: c, adapterClass: u },
|
|
1332
1332
|
s
|
|
1333
|
-
),
|
|
1333
|
+
), Dt.set(t, i), i;
|
|
1334
1334
|
}
|
|
1335
1335
|
}
|
|
1336
1336
|
const Ti = (e, t) => {
|
|
1337
1337
|
const i = K.for(e);
|
|
1338
|
-
return
|
|
1338
|
+
return Et(i, t);
|
|
1339
1339
|
};
|
|
1340
1340
|
function Pi(e, ...t) {
|
|
1341
|
-
const i = K.for(e), n =
|
|
1341
|
+
const i = K.for(e), n = me(Si);
|
|
1342
1342
|
if (n === void 0)
|
|
1343
1343
|
throw new Error("QueryClient not found");
|
|
1344
1344
|
const s = t[0];
|
|
1345
1345
|
return n.getQuery(i, s);
|
|
1346
1346
|
}
|
|
1347
|
-
function
|
|
1347
|
+
function ct(e) {
|
|
1348
1348
|
if (e.reason !== void 0) return e.reason;
|
|
1349
1349
|
if (typeof DOMException < "u")
|
|
1350
1350
|
return new DOMException("The operation was aborted", "AbortError");
|
|
1351
1351
|
const t = new Error("The operation was aborted");
|
|
1352
1352
|
return t.name = "AbortError", t;
|
|
1353
1353
|
}
|
|
1354
|
-
function
|
|
1354
|
+
function oe(e, t) {
|
|
1355
1355
|
return new Promise((i, n) => {
|
|
1356
1356
|
if (t?.aborted) {
|
|
1357
|
-
n(
|
|
1357
|
+
n(ct(t));
|
|
1358
1358
|
return;
|
|
1359
1359
|
}
|
|
1360
1360
|
const s = setTimeout(i, e);
|
|
1361
1361
|
t?.addEventListener(
|
|
1362
1362
|
"abort",
|
|
1363
1363
|
() => {
|
|
1364
|
-
clearTimeout(s), n(
|
|
1364
|
+
clearTimeout(s), n(ct(t));
|
|
1365
1365
|
},
|
|
1366
1366
|
{ once: !0 }
|
|
1367
1367
|
);
|
|
1368
1368
|
});
|
|
1369
1369
|
}
|
|
1370
|
-
async function
|
|
1370
|
+
async function ft(e, t, i) {
|
|
1371
1371
|
const n = Math.max(0, t.retries);
|
|
1372
1372
|
let s;
|
|
1373
1373
|
for (let r = 0; r <= n; r++) {
|
|
1374
1374
|
if (i?.aborted)
|
|
1375
|
-
throw
|
|
1375
|
+
throw ct(i);
|
|
1376
1376
|
try {
|
|
1377
1377
|
return await e();
|
|
1378
1378
|
} catch (o) {
|
|
1379
1379
|
if (s = o, r >= n) throw o;
|
|
1380
|
-
await
|
|
1380
|
+
await oe(t.retryDelay(r), i);
|
|
1381
1381
|
}
|
|
1382
1382
|
}
|
|
1383
1383
|
throw s;
|
|
@@ -1393,14 +1393,24 @@ class yi {
|
|
|
1393
1393
|
updatedAt = void 0;
|
|
1394
1394
|
params = void 0;
|
|
1395
1395
|
unsubscribe = void 0;
|
|
1396
|
+
lastSubscribeFn = void 0;
|
|
1396
1397
|
_relayState = void 0;
|
|
1397
1398
|
_isActive = !1;
|
|
1398
1399
|
wasPaused = !1;
|
|
1399
1400
|
currentParams = void 0;
|
|
1400
1401
|
debounceTimer = void 0;
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1402
|
+
// Invalidates on any signal consumed by getConfig() (such as
|
|
1403
|
+
// responseNotifier, fired by the adapter after each fetch). Param
|
|
1404
|
+
// changes are handled separately: getOrCreateExecutionContext
|
|
1405
|
+
// replaces this wholesale to force recomputation against the new ctx.
|
|
1406
|
+
_resolvedOptions = nt(() => this.def.resolveOptions(this._executionCtx));
|
|
1407
|
+
get config() {
|
|
1408
|
+
if (this._executionCtx !== void 0)
|
|
1409
|
+
return this._resolvedOptions.value.config;
|
|
1410
|
+
}
|
|
1411
|
+
get retryConfig() {
|
|
1412
|
+
return this._executionCtx === void 0 ? wt(void 0) : this._resolvedOptions.value.retryConfig;
|
|
1413
|
+
}
|
|
1404
1414
|
/** Cancels in-flight fetches and retry waits. */
|
|
1405
1415
|
_abortController = void 0;
|
|
1406
1416
|
/** Cached execution context, recreated only when storageKey (params) changes. */
|
|
@@ -1421,14 +1431,14 @@ class yi {
|
|
|
1421
1431
|
}
|
|
1422
1432
|
constructor(t, i, n, s) {
|
|
1423
1433
|
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);
|
|
1424
|
-
const r =
|
|
1425
|
-
this._queryId = r !== void 0 ? D(r) : 0, this.relay =
|
|
1434
|
+
const r = kt(s);
|
|
1435
|
+
this._queryId = r !== void 0 ? D(r) : 0, this.relay = Ft(
|
|
1426
1436
|
(o) => {
|
|
1427
1437
|
this._relayState = o;
|
|
1428
1438
|
const a = () => {
|
|
1429
|
-
this._isActive = !1, clearTimeout(this.debounceTimer), this.debounceTimer = void 0, this._abortController?.abort(), this._abortController = void 0, this._fetchNextAbort?.abort(), this._fetchNextAbort = void 0, this._fetchNextPromise = void 0, this.unsubscribe?.(), this.unsubscribe = void 0;
|
|
1430
|
-
const f = this.config?.gcTime ??
|
|
1431
|
-
this.queryClient.gcManager.schedule(this.queryKey, f,
|
|
1439
|
+
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, this.lastSubscribeFn = void 0;
|
|
1440
|
+
const f = this.config?.gcTime ?? jt;
|
|
1441
|
+
this.queryClient.gcManager.schedule(this.queryKey, f, J.Query);
|
|
1432
1442
|
}, c = (f = !1) => {
|
|
1433
1443
|
const { wasPaused: l, isPaused: u, initialized: y } = this;
|
|
1434
1444
|
if (this.wasPaused = u, u && !l && y) {
|
|
@@ -1436,8 +1446,8 @@ class yi {
|
|
|
1436
1446
|
return;
|
|
1437
1447
|
}
|
|
1438
1448
|
this._isActive = !0;
|
|
1439
|
-
const v =
|
|
1440
|
-
g && (this.currentParams = v, this.storageKey = p), this.getOrCreateExecutionContext(), this.initialized ? l || f ? (this.queryClient.activateQuery(this), f && this.updatedAt !== void 0 && this.
|
|
1449
|
+
const v = kt(this.params), p = Et(this.def, v), g = p !== this.storageKey;
|
|
1450
|
+
g && (this.currentParams = v, this.storageKey = p), this.getOrCreateExecutionContext(), this.initialized ? l || f ? (this.queryClient.activateQuery(this), f && this.updatedAt !== void 0 && this.reconcileSubscription(), this.relayState.isPending && this._abortController === void 0 ? this.runQueryImmediately() : (this.config?.refreshStaleOnReconnect ?? !0) && this.isStale && this.runDebounced()) : g && (this.lastSubscribeFn = void 0, this.reconcileSubscription(), this.runDebounced()) : (this.queryClient.activateQuery(this), this.initialize());
|
|
1441
1451
|
};
|
|
1442
1452
|
return c(!0), {
|
|
1443
1453
|
update: c,
|
|
@@ -1485,18 +1495,17 @@ class yi {
|
|
|
1485
1495
|
}
|
|
1486
1496
|
if (!this.isPaused)
|
|
1487
1497
|
try {
|
|
1488
|
-
if (n !== void 0 && this.
|
|
1489
|
-
if (await
|
|
1498
|
+
if (n !== void 0 && this.reconcileSubscription(), n === void 0 || this.isStale) {
|
|
1499
|
+
if (await oe(0), this.isPaused) return;
|
|
1490
1500
|
this.runQueryImmediately();
|
|
1491
1501
|
}
|
|
1492
1502
|
} catch (s) {
|
|
1493
1503
|
i.setError(s);
|
|
1494
1504
|
}
|
|
1495
1505
|
}
|
|
1496
|
-
|
|
1497
|
-
this.unsubscribe?.(), this.unsubscribe = void 0;
|
|
1506
|
+
reconcileSubscription() {
|
|
1498
1507
|
const t = this.config?.subscribe;
|
|
1499
|
-
if (!t) return;
|
|
1508
|
+
if (t === this.lastSubscribeFn || (this.unsubscribe?.(), this.unsubscribe = void 0, this.lastSubscribeFn = t, !t)) return;
|
|
1500
1509
|
const i = this._executionCtx;
|
|
1501
1510
|
this.unsubscribe = t.call(i, (n) => {
|
|
1502
1511
|
n.__eventSource = this.queryKey, this.queryClient.applyMutationEvent(n);
|
|
@@ -1506,23 +1515,23 @@ class yi {
|
|
|
1506
1515
|
return (this._executionCtx === void 0 || this._executionCtxKey !== this.storageKey) && (this._executionCtxKey = this.storageKey, this._executionCtx = this.def.createExecutionContext(
|
|
1507
1516
|
this.currentParams ?? {},
|
|
1508
1517
|
this.queryClient.getContext()
|
|
1509
|
-
), this._executionCtx.refetch = () => this.refetch(), this._executionCtx.rawFetchNext = this.def.statics.rawFetchNext
|
|
1510
|
-
}
|
|
1511
|
-
resolveAndApplyOptions() {
|
|
1512
|
-
const t = this.def.resolveOptions(this._executionCtx);
|
|
1513
|
-
this.config = t.config, this.retryConfig = t.retryConfig;
|
|
1518
|
+
), this._executionCtx.refetch = () => this.refetch(), this._executionCtx.rawFetchNext = this.def.statics.rawFetchNext, this._resolvedOptions = nt(() => this.def.resolveOptions(this._executionCtx))), this._executionCtx;
|
|
1514
1519
|
}
|
|
1515
1520
|
async runQuery() {
|
|
1516
1521
|
const t = this.def;
|
|
1517
1522
|
if (this.isPaused)
|
|
1518
1523
|
throw new Error("Query is paused due to network status");
|
|
1519
1524
|
const i = this.getOrCreateExecutionContext(), n = this.queryClient.getAdapter(t.statics.adapterClass), s = this._abortController?.signal ?? new AbortController().signal;
|
|
1520
|
-
return
|
|
1525
|
+
return ft(
|
|
1521
1526
|
async () => {
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1527
|
+
try {
|
|
1528
|
+
const r = await n.send(i, s);
|
|
1529
|
+
this.updatedAt = Date.now();
|
|
1530
|
+
const o = this.applyData(r, !0);
|
|
1531
|
+
return this.saveQueryMetadata(), o;
|
|
1532
|
+
} finally {
|
|
1533
|
+
this.reconcileSubscription();
|
|
1534
|
+
}
|
|
1526
1535
|
},
|
|
1527
1536
|
this.retryConfig,
|
|
1528
1537
|
s
|
|
@@ -1573,7 +1582,7 @@ class yi {
|
|
|
1573
1582
|
const i = this._fetchNextAbort.signal, n = this.getOrCreateExecutionContext();
|
|
1574
1583
|
n.resultData = this.rootEntity.data;
|
|
1575
1584
|
const s = this.queryClient.getAdapter(t.statics.adapterClass);
|
|
1576
|
-
return
|
|
1585
|
+
return ft(
|
|
1577
1586
|
async () => {
|
|
1578
1587
|
const r = await s.sendNext(n, i);
|
|
1579
1588
|
this.updatedAt = Date.now();
|
|
@@ -1617,7 +1626,7 @@ class pi {
|
|
|
1617
1626
|
this.def = t, this.queryClient = i, this.task = this.createTask();
|
|
1618
1627
|
}
|
|
1619
1628
|
createTask() {
|
|
1620
|
-
return
|
|
1629
|
+
return we(
|
|
1621
1630
|
async (t) => {
|
|
1622
1631
|
if (this._inFlight)
|
|
1623
1632
|
throw new Error("A mutation is already in progress. Await the previous call before starting a new one.");
|
|
@@ -1637,8 +1646,8 @@ class pi {
|
|
|
1637
1646
|
if (!(i instanceof _))
|
|
1638
1647
|
return t;
|
|
1639
1648
|
const n = this.queryClient.getContext().log?.warn ?? (() => {
|
|
1640
|
-
}), s = new
|
|
1641
|
-
return s.reset(void 0, void 0, n),
|
|
1649
|
+
}), s = new at();
|
|
1650
|
+
return s.reset(void 0, void 0, n), te(t, i, s);
|
|
1642
1651
|
}
|
|
1643
1652
|
// ======================================================
|
|
1644
1653
|
// Effects processing
|
|
@@ -1646,7 +1655,7 @@ class pi {
|
|
|
1646
1655
|
processEffects(t, i) {
|
|
1647
1656
|
let n;
|
|
1648
1657
|
if (this.def.hasGetEffects) {
|
|
1649
|
-
const r =
|
|
1658
|
+
const r = st(
|
|
1650
1659
|
this.def.captured,
|
|
1651
1660
|
t ?? {},
|
|
1652
1661
|
this.queryClient.getContext()
|
|
@@ -1658,19 +1667,19 @@ class pi {
|
|
|
1658
1667
|
}
|
|
1659
1668
|
if (n === void 0) return;
|
|
1660
1669
|
const s = this.queryClient;
|
|
1661
|
-
|
|
1670
|
+
et(n.creates, "create", s), et(n.updates, "update", s), et(n.deletes, "delete", s), n.invalidates && s.invalidateQueries(n.invalidates);
|
|
1662
1671
|
}
|
|
1663
1672
|
// ======================================================
|
|
1664
1673
|
// Retry logic
|
|
1665
1674
|
// ======================================================
|
|
1666
1675
|
executeWithRetry(t) {
|
|
1667
|
-
const i =
|
|
1676
|
+
const i = wt(this.def.config?.retry, !0), n = this.queryClient.getAdapter(this.def.adapterClass);
|
|
1668
1677
|
if (!n.sendMutation)
|
|
1669
1678
|
throw new Error(
|
|
1670
1679
|
`Adapter "${this.def.adapterClass.name}" does not implement sendMutation(). Add a sendMutation() method to handle mutations.`
|
|
1671
1680
|
);
|
|
1672
|
-
return
|
|
1673
|
-
const s = new AbortController(), r =
|
|
1681
|
+
return ft(async () => {
|
|
1682
|
+
const s = new AbortController(), r = st(
|
|
1674
1683
|
this.def.captured,
|
|
1675
1684
|
t ?? {},
|
|
1676
1685
|
this.queryClient.getContext()
|
|
@@ -1682,19 +1691,19 @@ class pi {
|
|
|
1682
1691
|
function gi(e) {
|
|
1683
1692
|
return typeof e == "string" ? e : P(e).typenameValue;
|
|
1684
1693
|
}
|
|
1685
|
-
function
|
|
1694
|
+
function et(e, t, i) {
|
|
1686
1695
|
if (e)
|
|
1687
1696
|
for (const [n, s] of e) {
|
|
1688
1697
|
const r = gi(n);
|
|
1689
1698
|
r !== void 0 && i.applyMutationEvent({ type: t, typename: r, data: s });
|
|
1690
1699
|
}
|
|
1691
1700
|
}
|
|
1692
|
-
const
|
|
1693
|
-
function
|
|
1701
|
+
const ae = "__eventSource";
|
|
1702
|
+
function ce(e) {
|
|
1694
1703
|
return { field: e, segments: e.indexOf(".") !== -1 ? e.split(".") : void 0 };
|
|
1695
1704
|
}
|
|
1696
1705
|
function vi(e) {
|
|
1697
|
-
return e.map(
|
|
1706
|
+
return e.map(ce);
|
|
1698
1707
|
}
|
|
1699
1708
|
function _i(e, t) {
|
|
1700
1709
|
if (t.segments === void 0) return e[t.field];
|
|
@@ -1705,7 +1714,7 @@ function _i(e, t) {
|
|
|
1705
1714
|
}
|
|
1706
1715
|
return i;
|
|
1707
1716
|
}
|
|
1708
|
-
function
|
|
1717
|
+
function fe(e, t) {
|
|
1709
1718
|
const i = [];
|
|
1710
1719
|
for (let n = 0; n < t.length; n++) {
|
|
1711
1720
|
const s = t[n], r = _i(e, s);
|
|
@@ -1722,9 +1731,9 @@ function mi(e, t) {
|
|
|
1722
1731
|
let a = !0;
|
|
1723
1732
|
for (const [c, f] of r) {
|
|
1724
1733
|
let l;
|
|
1725
|
-
if (
|
|
1726
|
-
const u =
|
|
1727
|
-
l =
|
|
1734
|
+
if (Ut(f)) {
|
|
1735
|
+
const u = Vt(f);
|
|
1736
|
+
l = ht(u, t);
|
|
1728
1737
|
} else
|
|
1729
1738
|
l = f;
|
|
1730
1739
|
if (l === void 0) {
|
|
@@ -1737,7 +1746,7 @@ function mi(e, t) {
|
|
|
1737
1746
|
}
|
|
1738
1747
|
return i.size > 0 ? i : void 0;
|
|
1739
1748
|
}
|
|
1740
|
-
function
|
|
1749
|
+
function Nt(e, t) {
|
|
1741
1750
|
const i = e.get(t);
|
|
1742
1751
|
if (i !== void 0)
|
|
1743
1752
|
return i.map(([n]) => n).sort();
|
|
@@ -1747,7 +1756,7 @@ class wi {
|
|
|
1747
1756
|
fieldPaths;
|
|
1748
1757
|
_bindings = /* @__PURE__ */ new Map();
|
|
1749
1758
|
constructor(t) {
|
|
1750
|
-
this.fields = t, this.fieldPaths = t.map(
|
|
1759
|
+
this.fields = t, this.fieldPaths = t.map(ce);
|
|
1751
1760
|
}
|
|
1752
1761
|
register(t, i) {
|
|
1753
1762
|
let n = this._bindings.get(t);
|
|
@@ -1784,18 +1793,18 @@ class Ei {
|
|
|
1784
1793
|
registerBinding(t, i) {
|
|
1785
1794
|
const n = t._constraintHashes.get(i);
|
|
1786
1795
|
if (n === void 0) return;
|
|
1787
|
-
const s =
|
|
1796
|
+
const s = Nt(t._constraintFieldRefs, i);
|
|
1788
1797
|
s !== void 0 && this.register(n, s, t);
|
|
1789
1798
|
}
|
|
1790
1799
|
unregisterBinding(t, i) {
|
|
1791
1800
|
const n = t._constraintHashes.get(i);
|
|
1792
1801
|
if (n === void 0) return;
|
|
1793
|
-
const s =
|
|
1802
|
+
const s = Nt(t._constraintFieldRefs, i);
|
|
1794
1803
|
s !== void 0 && this.unregister(n, s, t);
|
|
1795
1804
|
}
|
|
1796
1805
|
routeEvent(t, i, n, s, r, o) {
|
|
1797
1806
|
for (const a of this._groups.values()) {
|
|
1798
|
-
const c =
|
|
1807
|
+
const c = fe(i, a.fieldPaths);
|
|
1799
1808
|
if (c === void 0) continue;
|
|
1800
1809
|
const f = a.getMatching(c);
|
|
1801
1810
|
if (f !== void 0)
|
|
@@ -1804,7 +1813,7 @@ class Ei {
|
|
|
1804
1813
|
}
|
|
1805
1814
|
}
|
|
1806
1815
|
}
|
|
1807
|
-
function
|
|
1816
|
+
function Mt(e) {
|
|
1808
1817
|
const t = /* @__PURE__ */ new Set();
|
|
1809
1818
|
for (const i of e)
|
|
1810
1819
|
if (typeof i == "object" && i !== null) {
|
|
@@ -1813,7 +1822,7 @@ function Nt(e) {
|
|
|
1813
1822
|
}
|
|
1814
1823
|
return t;
|
|
1815
1824
|
}
|
|
1816
|
-
class
|
|
1825
|
+
class ue {
|
|
1817
1826
|
_queryClient;
|
|
1818
1827
|
_parent;
|
|
1819
1828
|
_constraintHashes;
|
|
@@ -1824,7 +1833,7 @@ class fe {
|
|
|
1824
1833
|
this._queryClient = n, this._parent = s, this._constraintHashes = r, this._constraintFieldRefs = i, this.instance = o, this._entityDefsByTypename = /* @__PURE__ */ new Map();
|
|
1825
1834
|
for (const a of t)
|
|
1826
1835
|
a.typenameValue !== void 0 && this._entityDefsByTypename.set(a.typenameValue, a);
|
|
1827
|
-
|
|
1836
|
+
Z.add(this);
|
|
1828
1837
|
}
|
|
1829
1838
|
getValue() {
|
|
1830
1839
|
return this.instance.getValue();
|
|
@@ -1871,9 +1880,9 @@ class bi {
|
|
|
1871
1880
|
_queryClient;
|
|
1872
1881
|
_parent;
|
|
1873
1882
|
constructor(t, i, n, s, r, o) {
|
|
1874
|
-
this._notifier =
|
|
1883
|
+
this._notifier = H(), this._items = n, this._keys = Mt(n), this._queryClient = t, this._parent = i;
|
|
1875
1884
|
const a = s !== void 0 && r !== void 0, c = o !== void 0;
|
|
1876
|
-
(a || c) && (this._outputSignal =
|
|
1885
|
+
(a || c) && (this._outputSignal = nt(() => {
|
|
1877
1886
|
this._notifier.consume();
|
|
1878
1887
|
let f = this._items;
|
|
1879
1888
|
if (a) {
|
|
@@ -1893,7 +1902,7 @@ class bi {
|
|
|
1893
1902
|
l.push(u);
|
|
1894
1903
|
continue;
|
|
1895
1904
|
}
|
|
1896
|
-
v.consume(),
|
|
1905
|
+
v.consume(), fe(v.data, s) === r && l.push(u);
|
|
1897
1906
|
}
|
|
1898
1907
|
f = l;
|
|
1899
1908
|
}
|
|
@@ -1938,7 +1947,7 @@ class bi {
|
|
|
1938
1947
|
}
|
|
1939
1948
|
reset(t) {
|
|
1940
1949
|
const i = this._items, n = Array.isArray(t) ? t : [];
|
|
1941
|
-
this._items = n, this._keys =
|
|
1950
|
+
this._items = n, this._keys = Mt(n);
|
|
1942
1951
|
for (const s of n)
|
|
1943
1952
|
if (typeof s == "object" && s !== null) {
|
|
1944
1953
|
const r = F(s);
|
|
@@ -1985,7 +1994,7 @@ class Ci {
|
|
|
1985
1994
|
_onUpdate;
|
|
1986
1995
|
_onDelete;
|
|
1987
1996
|
constructor(t, i, n, s, r, o) {
|
|
1988
|
-
this._notifier =
|
|
1997
|
+
this._notifier = H(), this._value = n, this._createdKeys = /* @__PURE__ */ new Set(), this._deletedKeys = /* @__PURE__ */ new Set(), this._queryClient = t, this._parent = i, this._onCreate = s, this._onUpdate = r, this._onDelete = o;
|
|
1989
1998
|
}
|
|
1990
1999
|
onEvent(t, i, n, s) {
|
|
1991
2000
|
switch (s) {
|
|
@@ -2015,18 +2024,18 @@ class Ci {
|
|
|
2015
2024
|
append(t) {
|
|
2016
2025
|
}
|
|
2017
2026
|
}
|
|
2018
|
-
function
|
|
2027
|
+
function de(e, t, i, n, s) {
|
|
2019
2028
|
let r = e.constraintFieldRefs;
|
|
2020
2029
|
if (r === void 0) {
|
|
2021
2030
|
r = /* @__PURE__ */ new Map();
|
|
2022
2031
|
for (const f of e.entityDefs) {
|
|
2023
2032
|
const l = f.typenameValue;
|
|
2024
|
-
l !== void 0 && r.set(l, [[
|
|
2033
|
+
l !== void 0 && r.set(l, [[ae, i.key]]);
|
|
2025
2034
|
}
|
|
2026
2035
|
}
|
|
2027
2036
|
const o = mi(r, n) ?? /* @__PURE__ */ new Map();
|
|
2028
2037
|
let a;
|
|
2029
|
-
if (e.type ===
|
|
2038
|
+
if (e.type === dt.Array) {
|
|
2030
2039
|
let f, l;
|
|
2031
2040
|
if (e.constraintFieldRefs !== void 0 && o.size > 0 && o.size === 1)
|
|
2032
2041
|
for (const [u] of e.constraintFieldRefs) {
|
|
@@ -2055,7 +2064,7 @@ function ue(e, t, i, n, s) {
|
|
|
2055
2064
|
e.onUpdate,
|
|
2056
2065
|
e.onDelete
|
|
2057
2066
|
);
|
|
2058
|
-
const c = new
|
|
2067
|
+
const c = new ue(
|
|
2059
2068
|
e.entityDefs,
|
|
2060
2069
|
r,
|
|
2061
2070
|
s,
|
|
@@ -2065,8 +2074,8 @@ function ue(e, t, i, n, s) {
|
|
|
2065
2074
|
);
|
|
2066
2075
|
return i.liveCollections.push(c), s.registerLiveCollection(c), c;
|
|
2067
2076
|
}
|
|
2068
|
-
const
|
|
2069
|
-
function
|
|
2077
|
+
const le = Object.entries, he = Object.prototype;
|
|
2078
|
+
function it(e, t, i, n = !1) {
|
|
2070
2079
|
const s = e.queryClient;
|
|
2071
2080
|
s.currentParseId++;
|
|
2072
2081
|
const r = e.seen, o = /* @__PURE__ */ new Map();
|
|
@@ -2084,7 +2093,7 @@ function V(e, t, i, n, s, r) {
|
|
|
2084
2093
|
}
|
|
2085
2094
|
return e;
|
|
2086
2095
|
}
|
|
2087
|
-
if (Object.getPrototypeOf(e) ===
|
|
2096
|
+
if (Object.getPrototypeOf(e) === he && !x.has(e)) {
|
|
2088
2097
|
const a = e;
|
|
2089
2098
|
for (const c of Object.keys(a)) {
|
|
2090
2099
|
const f = a[c];
|
|
@@ -2093,12 +2102,12 @@ function V(e, t, i, n, s, r) {
|
|
|
2093
2102
|
}
|
|
2094
2103
|
return e;
|
|
2095
2104
|
}
|
|
2096
|
-
function
|
|
2105
|
+
function ye(e) {
|
|
2097
2106
|
return typeof e == "object" && e !== null && !(e instanceof U) && !x.has(e);
|
|
2098
2107
|
}
|
|
2099
2108
|
function xi(e, t, i, n, s, r) {
|
|
2100
2109
|
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();
|
|
2101
|
-
if (v ? (
|
|
2110
|
+
if (v ? (pe(
|
|
2102
2111
|
l,
|
|
2103
2112
|
a,
|
|
2104
2113
|
y,
|
|
@@ -2110,28 +2119,28 @@ function xi(e, t, i, n, s, r) {
|
|
|
2110
2119
|
n,
|
|
2111
2120
|
p,
|
|
2112
2121
|
r
|
|
2113
|
-
), u.notify()) :
|
|
2122
|
+
), u.notify()) : ge(l, a, u, a, t, i, n, p, r), r && u.liveCollections.length > 0)
|
|
2114
2123
|
for (const m of u.liveCollections) {
|
|
2115
|
-
const
|
|
2116
|
-
if (Array.isArray(
|
|
2117
|
-
for (const O of
|
|
2124
|
+
const N = m.instance.getRawValue();
|
|
2125
|
+
if (Array.isArray(N))
|
|
2126
|
+
for (const O of N) {
|
|
2118
2127
|
if (typeof O != "object" || O === null) continue;
|
|
2119
2128
|
const $ = x.get(O);
|
|
2120
2129
|
if ($ === void 0) continue;
|
|
2121
|
-
const
|
|
2122
|
-
|
|
2130
|
+
const S = i.entityMap.getEntity($);
|
|
2131
|
+
S !== void 0 && p.set(S, (p.get(S) ?? 0) + 1);
|
|
2123
2132
|
}
|
|
2124
2133
|
}
|
|
2125
2134
|
u.setChildRefs(p.size > 0 ? p : void 0, n);
|
|
2126
2135
|
const g = u.getProxy(c);
|
|
2127
2136
|
return s.set(u, (s.get(u) ?? 0) + 1), g;
|
|
2128
2137
|
}
|
|
2129
|
-
function
|
|
2130
|
-
for (const [u, y] of
|
|
2138
|
+
function pe(e, t, i, n, s, r, o, a, c, f, l) {
|
|
2139
|
+
for (const [u, y] of le(e))
|
|
2131
2140
|
if (!(n !== void 0 && !n.has(u)))
|
|
2132
|
-
if (
|
|
2141
|
+
if (ye(t[u]) && (t[u] = V(t[u], o, a, c, f, l)), y instanceof _ && y._liveConfig !== void 0) {
|
|
2133
2142
|
const v = i[u];
|
|
2134
|
-
v instanceof
|
|
2143
|
+
v instanceof ue ? l ? v.append(t[u]) : v.reset(t[u]) : i[u] = de(
|
|
2135
2144
|
y._liveConfig,
|
|
2136
2145
|
t[u],
|
|
2137
2146
|
s,
|
|
@@ -2140,10 +2149,10 @@ function ye(e, t, i, n, s, r, o, a, c, f, l) {
|
|
|
2140
2149
|
);
|
|
2141
2150
|
} else {
|
|
2142
2151
|
const v = t[u], p = i[u];
|
|
2143
|
-
if (
|
|
2152
|
+
if (ut(v) && ut(p)) {
|
|
2144
2153
|
const g = y instanceof _ && y.shape !== void 0 ? y.shape : void 0;
|
|
2145
2154
|
if (g !== void 0)
|
|
2146
|
-
|
|
2155
|
+
pe(
|
|
2147
2156
|
g,
|
|
2148
2157
|
v,
|
|
2149
2158
|
p,
|
|
@@ -2164,11 +2173,11 @@ function ye(e, t, i, n, s, r, o, a, c, f, l) {
|
|
|
2164
2173
|
i[u] = v;
|
|
2165
2174
|
}
|
|
2166
2175
|
}
|
|
2167
|
-
function
|
|
2168
|
-
for (const [f, l] of
|
|
2176
|
+
function ge(e, t, i, n, s, r, o, a, c) {
|
|
2177
|
+
for (const [f, l] of le(e))
|
|
2169
2178
|
if (f in t)
|
|
2170
|
-
if (
|
|
2171
|
-
t[f] =
|
|
2179
|
+
if (ye(t[f]) && (t[f] = V(t[f], s, r, o, a, c)), l instanceof _ && l._liveConfig !== void 0)
|
|
2180
|
+
t[f] = de(
|
|
2172
2181
|
l._liveConfig,
|
|
2173
2182
|
t[f],
|
|
2174
2183
|
i,
|
|
@@ -2177,14 +2186,14 @@ function pe(e, t, i, n, s, r, o, a, c) {
|
|
|
2177
2186
|
);
|
|
2178
2187
|
else {
|
|
2179
2188
|
const u = t[f];
|
|
2180
|
-
if (
|
|
2189
|
+
if (ut(u)) {
|
|
2181
2190
|
const y = l instanceof _ && l.shape !== void 0 ? l.shape : void 0;
|
|
2182
|
-
y !== void 0 &&
|
|
2191
|
+
y !== void 0 && ge(y, u, i, n, s, r, o, a, c);
|
|
2183
2192
|
}
|
|
2184
2193
|
}
|
|
2185
2194
|
}
|
|
2186
|
-
function
|
|
2187
|
-
return typeof e == "object" && e !== null && !Array.isArray(e) && Object.getPrototypeOf(e) ===
|
|
2195
|
+
function ut(e) {
|
|
2196
|
+
return typeof e == "object" && e !== null && !Array.isArray(e) && Object.getPrototypeOf(e) === he && !x.has(e);
|
|
2188
2197
|
}
|
|
2189
2198
|
function ji(e) {
|
|
2190
2199
|
if (e !== void 0)
|
|
@@ -2193,7 +2202,7 @@ function ji(e) {
|
|
|
2193
2202
|
function Oi(e) {
|
|
2194
2203
|
return Ee(e);
|
|
2195
2204
|
}
|
|
2196
|
-
function
|
|
2205
|
+
function kt(e) {
|
|
2197
2206
|
if (e === void 0)
|
|
2198
2207
|
return;
|
|
2199
2208
|
const t = {};
|
|
@@ -2201,7 +2210,7 @@ function Mt(e) {
|
|
|
2201
2210
|
Oi(n) ? t[i] = n.value : t[i] = n;
|
|
2202
2211
|
return t;
|
|
2203
2212
|
}
|
|
2204
|
-
const
|
|
2213
|
+
const Et = (e, t) => D([e.statics.id, t]);
|
|
2205
2214
|
class Li {
|
|
2206
2215
|
entityMap;
|
|
2207
2216
|
queryInstances = /* @__PURE__ */ new Map();
|
|
@@ -2219,7 +2228,7 @@ class Li {
|
|
|
2219
2228
|
networkUnsubscribe;
|
|
2220
2229
|
constructor(t = {}) {
|
|
2221
2230
|
const {
|
|
2222
|
-
store: i = new Oe(new
|
|
2231
|
+
store: i = new Oe(new Se()),
|
|
2223
2232
|
log: n,
|
|
2224
2233
|
evictionMultiplier: s,
|
|
2225
2234
|
adapters: r,
|
|
@@ -2227,7 +2236,7 @@ class Li {
|
|
|
2227
2236
|
gcManager: a,
|
|
2228
2237
|
...c
|
|
2229
2238
|
} = t;
|
|
2230
|
-
this.isServer = typeof window > "u", this.store = i, this.context = { ...c, log: n ?? console, evictionMultiplier: s }, this.gcManager = t.gcManager ?? (this.isServer ? new De() : new Ae(this.handleEviction, s)), this.networkManager = t.networkManager ?? new
|
|
2239
|
+
this.isServer = typeof window > "u", this.store = i, this.context = { ...c, log: n ?? console, evictionMultiplier: s }, this.gcManager = t.gcManager ?? (this.isServer ? new De() : new Ae(this.handleEviction, s)), this.networkManager = t.networkManager ?? new se(), this.entityMap = new li((u, y, v) => this.store.saveEntity(u, y, v));
|
|
2231
2240
|
for (const u of t.adapters ?? [])
|
|
2232
2241
|
this.adapters.set(u.constructor, u), u.register(this);
|
|
2233
2242
|
const f = this.networkManager.getOnlineSignal(), l = be(() => f.value);
|
|
@@ -2309,7 +2318,7 @@ class Li {
|
|
|
2309
2318
|
activateQuery(t) {
|
|
2310
2319
|
const { def: i, queryKey: n, storageKey: s, config: r } = t;
|
|
2311
2320
|
this.store.activateQuery(i, s);
|
|
2312
|
-
const o = r?.gcTime ??
|
|
2321
|
+
const o = r?.gcTime ?? jt;
|
|
2313
2322
|
this.gcManager.cancel(n, o);
|
|
2314
2323
|
}
|
|
2315
2324
|
loadCachedQuery(t, i) {
|
|
@@ -2320,7 +2329,7 @@ class Li {
|
|
|
2320
2329
|
* that triggers fetches and prepopulates with cached data
|
|
2321
2330
|
*/
|
|
2322
2331
|
getQuery(t, i) {
|
|
2323
|
-
const n =
|
|
2332
|
+
const n = Et(t, i);
|
|
2324
2333
|
let s = this.queryInstances.get(n);
|
|
2325
2334
|
return s === void 0 && (s = new yi(t, this, n, i), this.queryInstances.set(n, s)), s.relay;
|
|
2326
2335
|
}
|
|
@@ -2339,8 +2348,8 @@ class Li {
|
|
|
2339
2348
|
*/
|
|
2340
2349
|
parseData(t, i, n) {
|
|
2341
2350
|
const s = this.context.log?.warn ?? (() => {
|
|
2342
|
-
}), r = new
|
|
2343
|
-
return r.reset(this, n, s), { data:
|
|
2351
|
+
}), r = new at();
|
|
2352
|
+
return r.reset(this, n, s), { data: te(t, i, r), ctx: r };
|
|
2344
2353
|
}
|
|
2345
2354
|
/**
|
|
2346
2355
|
* Apply entities from parseData() via a single depth-first walk: creates/
|
|
@@ -2348,7 +2357,7 @@ class Li {
|
|
|
2348
2357
|
* refs. Returns the reified data and root-level entity refs.
|
|
2349
2358
|
*/
|
|
2350
2359
|
applyRefs(t, i = !0, n = !1) {
|
|
2351
|
-
return
|
|
2360
|
+
return it(t.ctx, t.data, i, n);
|
|
2352
2361
|
}
|
|
2353
2362
|
/**
|
|
2354
2363
|
* Parse and apply data as a root entity. For non-entity results, injects
|
|
@@ -2356,8 +2365,8 @@ class Li {
|
|
|
2356
2365
|
* found in the store by the standard entity pipeline).
|
|
2357
2366
|
*/
|
|
2358
2367
|
parseAndApplyRootEntity(t, i, n, s, r = !1, o) {
|
|
2359
|
-
typeof n.idField == "symbol" && typeof t == "object" && t !== null && !("__entityRef" in t) && (t[
|
|
2360
|
-
const a = this.parseData(t, n, o), c =
|
|
2368
|
+
typeof n.idField == "symbol" && typeof t == "object" && t !== null && !("__entityRef" in t) && (t[Lt] = i);
|
|
2369
|
+
const a = this.parseData(t, n, o), c = it(a.ctx, a.data, s, r), f = x.get(c.data);
|
|
2361
2370
|
return this.entityMap.getEntity(f);
|
|
2362
2371
|
}
|
|
2363
2372
|
prepareEntity(t, i, n) {
|
|
@@ -2381,7 +2390,7 @@ class Li {
|
|
|
2381
2390
|
}
|
|
2382
2391
|
try {
|
|
2383
2392
|
const g = this.context.log?.warn ?? (() => {
|
|
2384
|
-
}), m = new
|
|
2393
|
+
}), m = new at();
|
|
2385
2394
|
m.reset(
|
|
2386
2395
|
this,
|
|
2387
2396
|
void 0,
|
|
@@ -2389,8 +2398,8 @@ class Li {
|
|
|
2389
2398
|
/* isPartialEvent */
|
|
2390
2399
|
!0
|
|
2391
2400
|
);
|
|
2392
|
-
const
|
|
2393
|
-
|
|
2401
|
+
const N = ei(l, s, m);
|
|
2402
|
+
it(m, N, !0);
|
|
2394
2403
|
} catch (g) {
|
|
2395
2404
|
if (this.context.log?.warn?.("Failed to apply mutation event", g), u === void 0) {
|
|
2396
2405
|
const m = this.entityMap.getEntity(c);
|
|
@@ -2414,14 +2423,14 @@ class Li {
|
|
|
2414
2423
|
for (const i of t) {
|
|
2415
2424
|
const n = Array.isArray(i), s = n ? i[0] : i, r = n ? i[1] : void 0, a = K.for(s).statics.id;
|
|
2416
2425
|
for (const [, c] of this.queryInstances)
|
|
2417
|
-
c.def.statics.id === a && (r === void 0 ||
|
|
2426
|
+
c.def.statics.id === a && (r === void 0 || Ri(c.resolvedParams, r)) && c.markStale();
|
|
2418
2427
|
}
|
|
2419
2428
|
}
|
|
2420
2429
|
// ======================================================
|
|
2421
2430
|
// In-Memory GC
|
|
2422
2431
|
// ======================================================
|
|
2423
2432
|
handleEviction = (t, i) => {
|
|
2424
|
-
if (i ===
|
|
2433
|
+
if (i === J.Query) {
|
|
2425
2434
|
const s = this.queryInstances.get(t);
|
|
2426
2435
|
if (s === void 0) return;
|
|
2427
2436
|
s.rootEntity?.evict(), this.queryInstances.delete(t);
|
|
@@ -2450,7 +2459,7 @@ class Li {
|
|
|
2450
2459
|
routeEvent(t, i, n, s, r, o, a) {
|
|
2451
2460
|
const c = this.constraintRegistry.get(t);
|
|
2452
2461
|
if (c === void 0) return;
|
|
2453
|
-
const f = r !== void 0 ? { ...i, [
|
|
2462
|
+
const f = r !== void 0 ? { ...i, [ae]: r } : i;
|
|
2454
2463
|
c.routeEvent(t, f, n, s, o, a);
|
|
2455
2464
|
}
|
|
2456
2465
|
destroy() {
|
|
@@ -2460,8 +2469,8 @@ class Li {
|
|
|
2460
2469
|
this.adapters.clear(), this.queryInstances.clear(), this.mutationInstances.clear(), this.constraintRegistry.clear(), this.typenameRegistry.clear(), this.mergedDefCache.clear();
|
|
2461
2470
|
}
|
|
2462
2471
|
}
|
|
2463
|
-
const
|
|
2464
|
-
function
|
|
2472
|
+
const Si = Pt(void 0);
|
|
2473
|
+
function Ri(e, t) {
|
|
2465
2474
|
if (e === void 0) return !1;
|
|
2466
2475
|
for (const i in t)
|
|
2467
2476
|
if (e[i] !== t[i]) return !1;
|
|
@@ -2469,31 +2478,31 @@ function Si(e, t) {
|
|
|
2469
2478
|
}
|
|
2470
2479
|
export {
|
|
2471
2480
|
B as A,
|
|
2472
|
-
|
|
2481
|
+
yt as E,
|
|
2473
2482
|
Ae as G,
|
|
2474
2483
|
q as L,
|
|
2475
2484
|
d as M,
|
|
2476
|
-
|
|
2477
|
-
|
|
2485
|
+
se as N,
|
|
2486
|
+
Lt as Q,
|
|
2478
2487
|
Y as R,
|
|
2479
2488
|
_ as V,
|
|
2480
|
-
|
|
2489
|
+
dt as a,
|
|
2481
2490
|
ki as b,
|
|
2482
2491
|
L as c,
|
|
2483
2492
|
De as d,
|
|
2484
|
-
|
|
2493
|
+
re as e,
|
|
2485
2494
|
Fi as f,
|
|
2486
2495
|
Li as g,
|
|
2487
|
-
|
|
2496
|
+
Si as h,
|
|
2488
2497
|
hi as i,
|
|
2489
2498
|
Mi as j,
|
|
2490
2499
|
Pi as k,
|
|
2491
|
-
|
|
2500
|
+
Kt as l,
|
|
2492
2501
|
Me as m,
|
|
2493
2502
|
z as n,
|
|
2494
2503
|
ji as o,
|
|
2495
2504
|
Ti as q,
|
|
2496
|
-
|
|
2505
|
+
Ht as r,
|
|
2497
2506
|
Ze as t
|
|
2498
2507
|
};
|
|
2499
|
-
//# sourceMappingURL=QueryClient
|
|
2508
|
+
//# sourceMappingURL=QueryClient--PrsE8Kj.js.map
|