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