fetchium 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/development/QueryClient-CbG-qdpt.js +2 -0
- package/dist/cjs/development/QueryClient-CbG-qdpt.js.map +1 -0
- package/dist/cjs/development/index.js +1 -1
- package/dist/cjs/{production/mutation-CgS9gXW7.js → development/mutation-CFkoRirO.js} +2 -2
- package/dist/cjs/{production/mutation-CgS9gXW7.js.map → development/mutation-CFkoRirO.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-DGCBmyPp.js +2 -0
- package/dist/cjs/production/QueryClient-DGCBmyPp.js.map +1 -0
- package/dist/cjs/production/index.js +1 -1
- package/dist/cjs/{development/mutation-w67Vpuvw.js → production/mutation-B0wMYfHP.js} +2 -2
- package/dist/cjs/{development/mutation-w67Vpuvw.js.map → production/mutation-B0wMYfHP.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/EntityInstance.d.ts.map +1 -1
- package/dist/esm/QueryResult.d.ts +5 -5
- package/dist/esm/QueryResult.d.ts.map +1 -1
- package/dist/esm/development/{QueryClient-C9tBdK1Z.js → QueryClient-BZY2FTv3.js} +594 -592
- package/dist/esm/development/QueryClient-BZY2FTv3.js.map +1 -0
- package/dist/esm/development/index.js +2 -2
- package/dist/esm/development/{mutation-Dx63NCGk.js → mutation-Dot2Ejg6.js} +2 -2
- package/dist/esm/development/{mutation-Dx63NCGk.js.map → mutation-Dot2Ejg6.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-D64xo0EA.js → QueryClient-WtzRneAd.js} +469 -465
- package/dist/esm/production/QueryClient-WtzRneAd.js.map +1 -0
- package/dist/esm/production/index.js +2 -2
- package/dist/esm/production/{mutation-Aw1JE7VO.js → mutation-AXg513Dg.js} +2 -2
- package/dist/esm/production/{mutation-Aw1JE7VO.js.map → mutation-AXg513Dg.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 +3 -3
- 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-QKhS8mhg.js +0 -2
- package/dist/cjs/development/QueryClient-QKhS8mhg.js.map +0 -1
- package/dist/cjs/production/QueryClient-DIAqDTHF.js +0 -2
- package/dist/cjs/production/QueryClient-DIAqDTHF.js.map +0 -1
- package/dist/esm/development/QueryClient-C9tBdK1Z.js.map +0 -1
- package/dist/esm/production/QueryClient-D64xo0EA.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { notifier as
|
|
2
|
-
import { registerCustomHash as
|
|
3
|
-
import { d as
|
|
4
|
-
import { SyncQueryStore as
|
|
5
|
-
var
|
|
6
|
-
const
|
|
7
|
-
var
|
|
8
|
-
class
|
|
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
|
+
import { registerCustomHash as Ce, hashValue as D, registerCustomSnapshot as xe } from "signalium/utils";
|
|
3
|
+
import { d as jt } from "./shared-DcuVH8Pf.js";
|
|
4
|
+
import { SyncQueryStore as Oe, MemoryPersistentStore as Se } from "./stores/sync.js";
|
|
5
|
+
var L = /* @__PURE__ */ ((e) => (e.Always = "always", e.Online = "online", e.OfflineFirst = "offlineFirst", e))(L || {}), d = /* @__PURE__ */ ((e) => (e[e.UNDEFINED = 1] = "UNDEFINED", e[e.NULL = 2] = "NULL", e[e.NUMBER = 4] = "NUMBER", e[e.STRING = 8] = "STRING", e[e.BOOLEAN = 16] = "BOOLEAN", e[e.OBJECT = 32] = "OBJECT", e[e.ARRAY = 64] = "ARRAY", e[e.ID = 128] = "ID", e[e.RECORD = 256] = "RECORD", e[e.UNION = 512] = "UNION", e[e.ENTITY = 1024] = "ENTITY", e[e.HAS_FORMAT = 4096] = "HAS_FORMAT", e[e.IS_EAGER_FORMAT = 8192] = "IS_EAGER_FORMAT", e[e.PARSE_RESULT = 16384] = "PARSE_RESULT", e[e.LIVE = 32768] = "LIVE", e))(d || {});
|
|
6
|
+
const B = /* @__PURE__ */ Symbol("array"), Y = /* @__PURE__ */ Symbol("record"), Lt = /* @__PURE__ */ Symbol("QUERY_ID");
|
|
7
|
+
var dt = /* @__PURE__ */ ((e) => (e[e.Array = 0] = "Array", e[e.Value = 1] = "Value", e))(dt || {});
|
|
8
|
+
class q {
|
|
9
9
|
type;
|
|
10
10
|
entityDefs;
|
|
11
11
|
constraintFieldRefs;
|
|
@@ -18,7 +18,7 @@ class L {
|
|
|
18
18
|
this.type = t, this.entityDefs = i, this.constraintFieldRefs = n, this.sort = s, this.valueType = r, this.onCreate = o, this.onUpdate = a, this.onDelete = c;
|
|
19
19
|
}
|
|
20
20
|
static array(t, i, n) {
|
|
21
|
-
return new
|
|
21
|
+
return new q(
|
|
22
22
|
0,
|
|
23
23
|
t,
|
|
24
24
|
i,
|
|
@@ -30,7 +30,7 @@ class L {
|
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
static value(t, i, n, s, r, o) {
|
|
33
|
-
return new
|
|
33
|
+
return new q(
|
|
34
34
|
1,
|
|
35
35
|
t,
|
|
36
36
|
i,
|
|
@@ -43,11 +43,11 @@ class L {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
const x = /* @__PURE__ */ new WeakMap();
|
|
46
|
-
function
|
|
46
|
+
function F(e) {
|
|
47
47
|
return x.get(e);
|
|
48
48
|
}
|
|
49
|
-
var
|
|
50
|
-
class
|
|
49
|
+
var 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
|
}
|
|
@@ -70,7 +70,7 @@ class Ae {
|
|
|
70
70
|
clearInterval(this._intervalId);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
class
|
|
73
|
+
class Ae {
|
|
74
74
|
_buckets = /* @__PURE__ */ new Map();
|
|
75
75
|
_nextTickEntries = /* @__PURE__ */ new Map();
|
|
76
76
|
_nextTickScheduled = !1;
|
|
@@ -88,7 +88,7 @@ class De {
|
|
|
88
88
|
}
|
|
89
89
|
const { _buckets: s } = this;
|
|
90
90
|
let r = s.get(i);
|
|
91
|
-
r || (r = new
|
|
91
|
+
r || (r = new 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) {
|
|
@@ -113,7 +113,7 @@ class De {
|
|
|
113
113
|
t.clear(), i.clear();
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
class
|
|
116
|
+
class De {
|
|
117
117
|
schedule(t, i, n) {
|
|
118
118
|
}
|
|
119
119
|
cancel(t, i) {
|
|
@@ -121,50 +121,50 @@ class Ie {
|
|
|
121
121
|
destroy() {
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
const
|
|
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
|
-
[
|
|
128
|
-
[
|
|
127
|
+
[G]: !0,
|
|
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
|
-
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 qt([...i, t]);
|
|
143
143
|
},
|
|
144
144
|
has(e, t) {
|
|
145
|
-
return t ===
|
|
145
|
+
return t === G || t === M;
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
|
-
function qt(e) {
|
|
149
|
-
return typeof e == "object" && e !== null && e[Y] === !0;
|
|
150
|
-
}
|
|
151
148
|
function Ut(e) {
|
|
152
|
-
return e[
|
|
149
|
+
return typeof e == "object" && e !== null && e[G] === !0;
|
|
153
150
|
}
|
|
154
151
|
function Vt(e) {
|
|
152
|
+
return e[M];
|
|
153
|
+
}
|
|
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
|
-
function
|
|
166
|
-
const t = e[
|
|
167
|
-
e[
|
|
165
|
+
function Me(e) {
|
|
166
|
+
const t = e[lt];
|
|
167
|
+
e[W]();
|
|
168
168
|
const i = {};
|
|
169
169
|
for (const r of Object.getOwnPropertyNames(t))
|
|
170
170
|
i[r] = t[r];
|
|
@@ -180,7 +180,7 @@ function ke(e) {
|
|
|
180
180
|
}
|
|
181
181
|
return { fields: i, methods: n };
|
|
182
182
|
}
|
|
183
|
-
function
|
|
183
|
+
function ht(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
|
|
191
|
+
function ke(e, t) {
|
|
192
192
|
return e.replace(Ne, (i, n) => {
|
|
193
|
-
const s = n.split("."), r =
|
|
193
|
+
const s = n.split("."), r = ht(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 (Ut(e))
|
|
199
|
+
return ht(Vt(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 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
|
-
o[a] =
|
|
216
|
-
o.params = t, o.context = i;
|
|
215
|
+
o[a] = z(c, r);
|
|
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
|
-
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 Qt(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 $t(e, t, i) {
|
|
|
244
244
|
let f = !0;
|
|
245
245
|
for (const l of e) {
|
|
246
246
|
const u = l?.[r];
|
|
247
|
-
u !== void 0 ? (o++, a === void 0 && (a = u),
|
|
247
|
+
u !== void 0 ? (o++, a === void 0 && (a = u), Fe(u) ? c.push(u.shape) : (f = !1, c.push(void 0))) : (f = !1, c.push(void 0));
|
|
248
248
|
}
|
|
249
249
|
if (f && o > 0) {
|
|
250
|
-
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) {
|
|
@@ -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(X, (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 pt(e, t) {
|
|
368
368
|
return new _(e, t);
|
|
369
369
|
}
|
|
370
|
+
function Pe(e) {
|
|
371
|
+
return pt(d.ARRAY, e);
|
|
372
|
+
}
|
|
370
373
|
function je(e) {
|
|
371
|
-
return
|
|
374
|
+
return pt(d.RECORD | d.OBJECT, e);
|
|
372
375
|
}
|
|
373
376
|
function Le(e) {
|
|
374
|
-
return
|
|
375
|
-
}
|
|
376
|
-
function qe(e) {
|
|
377
|
-
return ht(d.PARSE_RESULT, e);
|
|
377
|
+
return 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,17 +393,17 @@ function Qt(e, t) {
|
|
|
393
393
|
s = o, r = a;
|
|
394
394
|
break;
|
|
395
395
|
case "object":
|
|
396
|
-
if (a instanceof
|
|
396
|
+
if (a instanceof X || 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 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 Ct(e, t, i) {
|
|
|
416
416
|
}
|
|
417
417
|
const r = s.shape;
|
|
418
418
|
if (r !== void 0)
|
|
419
|
-
for (const o of [...
|
|
419
|
+
for (const o of [...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(
|
|
@@ -425,13 +425,13 @@ function Ct(e, t, i) {
|
|
|
425
425
|
t[o] = a;
|
|
426
426
|
}
|
|
427
427
|
} else if ((n & d.ARRAY) !== 0) {
|
|
428
|
-
if (t[
|
|
428
|
+
if (t[B] !== void 0)
|
|
429
429
|
throw new Error("Array shape already defined");
|
|
430
|
-
t[
|
|
430
|
+
t[B] = e.shape;
|
|
431
431
|
} else if ((n & d.RECORD) !== 0) {
|
|
432
|
-
if (t[
|
|
432
|
+
if (t[Y] !== void 0)
|
|
433
433
|
throw new Error("Record shape already defined");
|
|
434
|
-
t[
|
|
434
|
+
t[Y] = e.shape;
|
|
435
435
|
} else {
|
|
436
436
|
const s = e.typenameField, r = e.typenameValue;
|
|
437
437
|
if (r === void 0)
|
|
@@ -444,7 +444,7 @@ function Ct(e, t, i) {
|
|
|
444
444
|
}
|
|
445
445
|
return i;
|
|
446
446
|
}
|
|
447
|
-
function
|
|
447
|
+
function 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 yt(...e) {
|
|
|
464
464
|
s = l;
|
|
465
465
|
continue;
|
|
466
466
|
}
|
|
467
|
-
n === 2 && (o = /* @__PURE__ */ Object.create(null), a =
|
|
467
|
+
n === 2 && (o = /* @__PURE__ */ Object.create(null), a = 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,64 +473,64 @@ function yt(...e) {
|
|
|
473
473
|
const f = i | c | d.UNION;
|
|
474
474
|
return new _(f, o, r, a);
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function 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
|
-
const
|
|
485
|
+
const Ue = /* @__PURE__ */ new WeakMap(), Ve = /* @__PURE__ */ new WeakMap(), Ke = /* @__PURE__ */ new WeakMap();
|
|
486
|
+
function $e(e) {
|
|
487
|
+
return vt(e, d.UNDEFINED | d.NULL, Ke);
|
|
488
|
+
}
|
|
486
489
|
function Qe(e) {
|
|
487
|
-
return
|
|
490
|
+
return vt(e, d.UNDEFINED, Ue);
|
|
488
491
|
}
|
|
489
492
|
function Be(e) {
|
|
490
|
-
return
|
|
493
|
+
return vt(e, d.NULL, Ve);
|
|
491
494
|
}
|
|
492
495
|
function Ye(e) {
|
|
493
|
-
return pt(e, d.NULL, Ke);
|
|
494
|
-
}
|
|
495
|
-
function Ge(e) {
|
|
496
496
|
return e;
|
|
497
497
|
}
|
|
498
|
-
function
|
|
498
|
+
function Ge(e) {
|
|
499
499
|
return /* @__PURE__ */ new Set([e]);
|
|
500
500
|
}
|
|
501
|
-
const
|
|
502
|
-
|
|
503
|
-
const
|
|
504
|
-
let
|
|
505
|
-
const
|
|
506
|
-
class
|
|
501
|
+
const Yt = ((...e) => new Set(e));
|
|
502
|
+
Yt.caseInsensitive = (...e) => new X(e);
|
|
503
|
+
const Gt = 16;
|
|
504
|
+
let We = 0;
|
|
505
|
+
const ot = [], Wt = [], zt = /* @__PURE__ */ new Map(), Z = /* @__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 = 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
|
-
function
|
|
522
|
-
const t =
|
|
521
|
+
function ze(e) {
|
|
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
|
|
528
|
-
const r =
|
|
529
|
-
|
|
530
|
-
const o = s?.eager ?? !0, c = r <<
|
|
531
|
-
|
|
527
|
+
function Ht(e, t, i, n, s) {
|
|
528
|
+
const r = We++;
|
|
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
|
|
562
|
-
function
|
|
563
|
-
let t =
|
|
561
|
+
const St = /* @__PURE__ */ new WeakMap();
|
|
562
|
+
function P(e) {
|
|
563
|
+
let t = St.get(e);
|
|
564
564
|
if (t === void 0) {
|
|
565
|
-
const i = new e(), n = i[
|
|
566
|
-
i[
|
|
565
|
+
const i = new e(), n = i[lt] ?? i;
|
|
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 !==
|
|
574
|
-
const u =
|
|
575
|
-
for (const y of
|
|
573
|
+
if (f !== yt && typeof f == "function") {
|
|
574
|
+
const u = P(f).shape;
|
|
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,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 = 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
|
-
function
|
|
590
|
-
return
|
|
589
|
+
function He(e) {
|
|
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))
|
|
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 Ht(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 Xt(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 = Xt(e), n = i.length === 1 ? i[0] : gt(...i.map((o) => o)), s = d.ARRAY | d.LIVE, r = new _(s, n);
|
|
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
|
-
function
|
|
627
|
-
const n =
|
|
628
|
-
return o._liveConfig =
|
|
626
|
+
function Xe(e, t, i) {
|
|
627
|
+
const n = Xt(t), s = e, r = d.LIVE, o = new _(r, void 0);
|
|
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,
|
|
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: Yt,
|
|
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: gt,
|
|
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 Zt = 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 Ot(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
|
}
|
|
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 (Zt(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 _t = Object.entries, ti = () => {
|
|
709
709
|
};
|
|
710
|
-
class
|
|
710
|
+
class at {
|
|
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 te(e, t, i) {
|
|
724
|
+
return k(e, t, i, "");
|
|
725
725
|
}
|
|
726
|
-
function
|
|
727
|
-
return
|
|
726
|
+
function ei(e, t, i) {
|
|
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
|
-
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 Rt(e, t, i, n) {
|
|
|
742
742
|
}
|
|
743
743
|
throw o;
|
|
744
744
|
}
|
|
745
|
-
return new
|
|
745
|
+
return new U(t, s, !1);
|
|
746
746
|
}
|
|
747
|
-
function
|
|
747
|
+
function k(e, t, i, n) {
|
|
748
748
|
const s = t;
|
|
749
|
-
if (s instanceof
|
|
749
|
+
if (s instanceof X) {
|
|
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 ? At(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 === dt.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 ? 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
|
-
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 : 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") {
|
|
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 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 {
|
|
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 te(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 ie(e, t, i, n) {
|
|
828
|
+
for (const [s, r] of _t(e))
|
|
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
|
|
837
|
-
e[r] =
|
|
836
|
+
for (const [r, o] of _t(s))
|
|
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,14 +867,14 @@ function vt(e, t, i) {
|
|
|
867
867
|
};
|
|
868
868
|
i.seen.set(c, u), i.seenByKey.set(r, u);
|
|
869
869
|
const y = `[[${t.typenameValue}:${o}]]`, v = t.shape;
|
|
870
|
-
for (const [p, g] of
|
|
871
|
-
l && !(p in e) || (c[p] =
|
|
870
|
+
for (const [p, g] of _t(v))
|
|
871
|
+
l && !(p in e) || (c[p] = k(e[p], g, i, `${y}.${p}`));
|
|
872
872
|
return c;
|
|
873
873
|
}
|
|
874
|
-
function
|
|
875
|
-
return
|
|
874
|
+
function ni(e, t) {
|
|
875
|
+
return si(e, t.shape, t.typenameField);
|
|
876
876
|
}
|
|
877
|
-
function
|
|
877
|
+
function si(e, t, i) {
|
|
878
878
|
if (t === void 0) return !0;
|
|
879
879
|
for (const n of Object.keys(t)) {
|
|
880
880
|
if (n === i) continue;
|
|
@@ -889,22 +889,22 @@ function ri(e, t, i) {
|
|
|
889
889
|
}
|
|
890
890
|
return !0;
|
|
891
891
|
}
|
|
892
|
-
const
|
|
892
|
+
const ri = Object.prototype, Q = /* @__PURE__ */ new WeakMap();
|
|
893
893
|
function A(e) {
|
|
894
894
|
if (typeof e != "object" || e === null) return e;
|
|
895
|
-
if (
|
|
895
|
+
if (Z.has(e)) return A(e.getValue());
|
|
896
896
|
if (x.has(e)) return e;
|
|
897
897
|
if (Array.isArray(e)) {
|
|
898
|
-
let t =
|
|
899
|
-
return t === void 0 && (t = new Proxy(e,
|
|
898
|
+
let t = Q.get(e);
|
|
899
|
+
return t === void 0 && (t = new Proxy(e, oi), Q.set(e, t)), t;
|
|
900
900
|
}
|
|
901
|
-
if (Object.getPrototypeOf(e) ===
|
|
902
|
-
let t =
|
|
903
|
-
return t === void 0 && (t = new Proxy(e,
|
|
901
|
+
if (Object.getPrototypeOf(e) === ri) {
|
|
902
|
+
let t = Q.get(e);
|
|
903
|
+
return t === void 0 && (t = new Proxy(e, ai), Q.set(e, t)), t;
|
|
904
904
|
}
|
|
905
905
|
return e;
|
|
906
906
|
}
|
|
907
|
-
const
|
|
907
|
+
const oi = {
|
|
908
908
|
get(e, t, i) {
|
|
909
909
|
if (typeof t == "string") {
|
|
910
910
|
const n = Number(t);
|
|
@@ -919,7 +919,7 @@ const ai = {
|
|
|
919
919
|
deleteProperty() {
|
|
920
920
|
return !1;
|
|
921
921
|
}
|
|
922
|
-
},
|
|
922
|
+
}, ai = {
|
|
923
923
|
get(e, t, i) {
|
|
924
924
|
return typeof t == "string" ? A(e[t]) : Reflect.get(e, t, i);
|
|
925
925
|
},
|
|
@@ -938,7 +938,7 @@ const ai = {
|
|
|
938
938
|
getOwnPropertyDescriptor(e, t) {
|
|
939
939
|
return Object.getOwnPropertyDescriptor(e, t);
|
|
940
940
|
}
|
|
941
|
-
},
|
|
941
|
+
}, ci = (e, t, i) => {
|
|
942
942
|
const n = e, s = Object.keys(n), r = t !== null && typeof t == "object" && !Array.isArray(t) ? t : void 0;
|
|
943
943
|
let o = !r || Object.keys(r).length !== s.length;
|
|
944
944
|
const a = {};
|
|
@@ -948,13 +948,12 @@ const ai = {
|
|
|
948
948
|
typeof l == "function" ? u = l : u = i(l, r?.[f]), a[f] = u, !o && u !== r?.[f] && (o = !0);
|
|
949
949
|
}
|
|
950
950
|
return o ? a : r;
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
class ui {
|
|
951
|
+
};
|
|
952
|
+
xe(
|
|
953
|
+
yt,
|
|
954
|
+
ci
|
|
955
|
+
);
|
|
956
|
+
class fi {
|
|
958
957
|
_notifier;
|
|
959
958
|
_queryClient;
|
|
960
959
|
_proxies = /* @__PURE__ */ new Map();
|
|
@@ -972,7 +971,7 @@ class ui {
|
|
|
972
971
|
_extraMethods;
|
|
973
972
|
_extraGetters;
|
|
974
973
|
constructor(t, i, n, s, r, o) {
|
|
975
|
-
this._notifier =
|
|
974
|
+
this._notifier = H(), this._queryClient = o, this.key = t, this.typename = i, this.id = n, this.idField = s, this.data = r, this.entityRefs = void 0;
|
|
976
975
|
}
|
|
977
976
|
retain() {
|
|
978
977
|
this.refCount++;
|
|
@@ -983,7 +982,7 @@ class ui {
|
|
|
983
982
|
if (--this.refCount > 0 || this.refCount < 0)
|
|
984
983
|
return;
|
|
985
984
|
const t = this._entityCache?.gcTime;
|
|
986
|
-
t !== void 0 ? this._queryClient.gcManager.schedule(this.key, t,
|
|
985
|
+
t !== void 0 ? this._queryClient.gcManager.schedule(this.key, t, J.Entity) : this.evict();
|
|
987
986
|
}
|
|
988
987
|
evict() {
|
|
989
988
|
const t = this.liveCollections.slice();
|
|
@@ -1017,13 +1016,13 @@ class ui {
|
|
|
1017
1016
|
getProxy(t) {
|
|
1018
1017
|
const i = t;
|
|
1019
1018
|
let n = this._proxies.get(i);
|
|
1020
|
-
return n === void 0 && (n =
|
|
1019
|
+
return n === void 0 && (n = di(this, this.key, t, this._notifier, this._queryClient), this._proxies.set(i, n)), n;
|
|
1021
1020
|
}
|
|
1022
1021
|
get proxy() {
|
|
1023
1022
|
return this._proxies.values().next().value;
|
|
1024
1023
|
}
|
|
1025
1024
|
satisfiesDef(t) {
|
|
1026
|
-
return this.satisfiedDefs.has(t) ? !0 :
|
|
1025
|
+
return this.satisfiedDefs.has(t) ? !0 : ni(this.data, t) ? (this.satisfiedDefs.add(t), !0) : !1;
|
|
1027
1026
|
}
|
|
1028
1027
|
save() {
|
|
1029
1028
|
this._queryClient.entityMap.save(this);
|
|
@@ -1035,7 +1034,7 @@ class ui {
|
|
|
1035
1034
|
this._notifier.consume();
|
|
1036
1035
|
}
|
|
1037
1036
|
}
|
|
1038
|
-
function
|
|
1037
|
+
function ui(e, t, i) {
|
|
1039
1038
|
const n = [];
|
|
1040
1039
|
for (const s of e) {
|
|
1041
1040
|
if (typeof s != "object" || s === null) continue;
|
|
@@ -1046,83 +1045,83 @@ function di(e, t, i) {
|
|
|
1046
1045
|
}
|
|
1047
1046
|
return n;
|
|
1048
1047
|
}
|
|
1049
|
-
function
|
|
1050
|
-
const r = i.shape ?? {}, o = i, a = o._methods, c = o._entityClass, f = o._entityConfig, l = c ? c.prototype :
|
|
1051
|
-
|
|
1048
|
+
function di(e, t, i, n, s) {
|
|
1049
|
+
const r = i.shape ?? {}, o = i, a = o._methods, c = o._entityClass, f = o._entityConfig, l = c ? c.prototype : yt.prototype;
|
|
1050
|
+
i.typenameField;
|
|
1052
1051
|
const u = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), v = () => ({ __entityRef: t });
|
|
1053
1052
|
let p;
|
|
1054
|
-
f?.hasSubscribe && a && "__subscribe" in a && (p =
|
|
1055
|
-
const h = (
|
|
1056
|
-
|
|
1057
|
-
},
|
|
1058
|
-
return E.value = g,
|
|
1053
|
+
f?.hasSubscribe && a && "__subscribe" in a && (p = Ft((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;
|
|
1059
1058
|
}));
|
|
1060
1059
|
let g;
|
|
1061
|
-
const
|
|
1062
|
-
if (
|
|
1060
|
+
const m = Object.keys(r);
|
|
1061
|
+
if (m.includes("__typename") || m.push("__typename"), a)
|
|
1063
1062
|
for (const E of Object.keys(a))
|
|
1064
|
-
|
|
1065
|
-
let
|
|
1066
|
-
function
|
|
1063
|
+
m.includes(E) || m.push(E);
|
|
1064
|
+
let N, O = m;
|
|
1065
|
+
function $() {
|
|
1067
1066
|
const E = e._extraMethods;
|
|
1068
|
-
if (E !==
|
|
1069
|
-
if (
|
|
1070
|
-
for (const
|
|
1071
|
-
O.includes(
|
|
1067
|
+
if (E !== N) {
|
|
1068
|
+
if (N = E, O = m.slice(), E !== void 0)
|
|
1069
|
+
for (const b of Object.keys(E))
|
|
1070
|
+
O.includes(b) || O.push(b);
|
|
1072
1071
|
const h = e._extraGetters;
|
|
1073
1072
|
if (h !== void 0)
|
|
1074
|
-
for (const
|
|
1075
|
-
O.includes(
|
|
1073
|
+
for (const b of Object.keys(h))
|
|
1074
|
+
O.includes(b) || O.push(b);
|
|
1076
1075
|
}
|
|
1077
1076
|
return O;
|
|
1078
1077
|
}
|
|
1079
|
-
const
|
|
1078
|
+
const S = {
|
|
1080
1079
|
getPrototypeOf() {
|
|
1081
1080
|
return l;
|
|
1082
1081
|
},
|
|
1083
|
-
get(E, h) {
|
|
1084
|
-
if (typeof h == "symbol") return;
|
|
1082
|
+
get(E, h, b) {
|
|
1083
|
+
if (typeof h == "symbol") return Reflect.get(l, h, b);
|
|
1085
1084
|
if (h === "toJSON") return v;
|
|
1086
1085
|
if (h === "__context") return s.getContext();
|
|
1087
1086
|
if (h === "__typename") return e.typename;
|
|
1088
1087
|
if (p?.value, n.consume(), typeof h == "string") {
|
|
1089
|
-
const
|
|
1090
|
-
if (
|
|
1091
|
-
return
|
|
1092
|
-
const
|
|
1093
|
-
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) {
|
|
1094
1093
|
let C = u.get(h);
|
|
1095
|
-
return C || (C =
|
|
1094
|
+
return C || (C = R[h].bind(g), u.set(h, C)), C;
|
|
1096
1095
|
}
|
|
1097
1096
|
if (a && h in a) {
|
|
1098
1097
|
let C = u.get(h);
|
|
1099
1098
|
return C || (C = _e(g, a[h].bind(g)), u.set(h, C)), C;
|
|
1100
1099
|
}
|
|
1101
1100
|
}
|
|
1102
|
-
const
|
|
1103
|
-
if (typeof
|
|
1104
|
-
return A(
|
|
1105
|
-
if (Array.isArray(
|
|
1106
|
-
const
|
|
1107
|
-
if (
|
|
1108
|
-
const
|
|
1109
|
-
if (
|
|
1110
|
-
const C =
|
|
1101
|
+
const w = e.data[h];
|
|
1102
|
+
if (typeof w == "object" && w !== null && Z.has(w))
|
|
1103
|
+
return A(w.getValue());
|
|
1104
|
+
if (Array.isArray(w) && typeof h == "string") {
|
|
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;
|
|
1111
1110
|
if (C !== void 0) {
|
|
1112
|
-
const
|
|
1113
|
-
if (
|
|
1114
|
-
const
|
|
1115
|
-
if (
|
|
1116
|
-
return A(
|
|
1117
|
-
const
|
|
1118
|
-
return y.set(h, { source:
|
|
1111
|
+
const 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);
|
|
1119
1118
|
}
|
|
1120
1119
|
}
|
|
1121
1120
|
}
|
|
1122
1121
|
}
|
|
1123
|
-
return A(
|
|
1122
|
+
return A(w);
|
|
1124
1123
|
}
|
|
1125
|
-
return A(
|
|
1124
|
+
return A(w);
|
|
1126
1125
|
},
|
|
1127
1126
|
set() {
|
|
1128
1127
|
return !1;
|
|
@@ -1130,36 +1129,36 @@ function li(e, t, i, n, s) {
|
|
|
1130
1129
|
has(E, h) {
|
|
1131
1130
|
if (h === "__typename") return !0;
|
|
1132
1131
|
if (typeof h == "string") {
|
|
1133
|
-
const
|
|
1134
|
-
if (
|
|
1135
|
-
const
|
|
1136
|
-
if (
|
|
1132
|
+
const b = e._extraGetters;
|
|
1133
|
+
if (b && h in b) return !0;
|
|
1134
|
+
const w = e._extraMethods;
|
|
1135
|
+
if (w && h in w || a && h in a) return !0;
|
|
1137
1136
|
}
|
|
1138
1137
|
return h in r;
|
|
1139
1138
|
},
|
|
1140
1139
|
ownKeys() {
|
|
1141
|
-
return
|
|
1140
|
+
return $();
|
|
1142
1141
|
},
|
|
1143
1142
|
getOwnPropertyDescriptor(E, h) {
|
|
1144
1143
|
if (h === "__typename")
|
|
1145
1144
|
return { enumerable: !0, configurable: !0, value: e.typename, writable: !1 };
|
|
1146
1145
|
if (h in r)
|
|
1147
|
-
return { enumerable: !0, configurable: !0, value:
|
|
1146
|
+
return { enumerable: !0, configurable: !0, value: S.get(E, h, g), writable: !1 };
|
|
1148
1147
|
if (typeof h == "string") {
|
|
1149
|
-
const
|
|
1150
|
-
if (m && h in m)
|
|
1151
|
-
return { enumerable: !0, configurable: !0, value: R.get(E, h, g), writable: !1 };
|
|
1152
|
-
const b = e._extraMethods;
|
|
1148
|
+
const b = e._extraGetters;
|
|
1153
1149
|
if (b && h in b)
|
|
1154
|
-
return { enumerable: !0, configurable: !0, value:
|
|
1150
|
+
return { enumerable: !0, configurable: !0, value: S.get(E, h, g), writable: !1 };
|
|
1151
|
+
const w = e._extraMethods;
|
|
1152
|
+
if (w && h in w)
|
|
1153
|
+
return { enumerable: !0, configurable: !0, value: S.get(E, h, g), writable: !1 };
|
|
1155
1154
|
if (a && h in a)
|
|
1156
|
-
return { enumerable: !1, configurable: !0, value:
|
|
1155
|
+
return { enumerable: !1, configurable: !0, value: S.get(E, h, g), writable: !1 };
|
|
1157
1156
|
}
|
|
1158
1157
|
}
|
|
1159
1158
|
};
|
|
1160
|
-
return g = new Proxy({},
|
|
1159
|
+
return g = new Proxy({}, S), x.set(g, t), ve(g, s), g;
|
|
1161
1160
|
}
|
|
1162
|
-
class
|
|
1161
|
+
class li {
|
|
1163
1162
|
instances = /* @__PURE__ */ new Map();
|
|
1164
1163
|
persistEntity;
|
|
1165
1164
|
constructor(t) {
|
|
@@ -1181,7 +1180,7 @@ class hi {
|
|
|
1181
1180
|
if (typeof a != "string" && typeof a != "number")
|
|
1182
1181
|
throw new Error(`Entity id must be string or number: ${n.typenameValue}`);
|
|
1183
1182
|
const c = n;
|
|
1184
|
-
r = new
|
|
1183
|
+
r = new fi(t, n.typenameValue, a, o, i, s), r._entityCache = c._entityCache, this.instances.set(t, r);
|
|
1185
1184
|
}
|
|
1186
1185
|
return r.parseId = s.currentParseId, r;
|
|
1187
1186
|
}
|
|
@@ -1203,7 +1202,7 @@ class se {
|
|
|
1203
1202
|
eventListenersAttached = !1;
|
|
1204
1203
|
constructor(t) {
|
|
1205
1204
|
const i = t ?? this.detectOnlineStatus();
|
|
1206
|
-
this.onlineSignal =
|
|
1205
|
+
this.onlineSignal = Tt(i), this.canAttachListeners() && this.attachEventListeners();
|
|
1207
1206
|
}
|
|
1208
1207
|
/**
|
|
1209
1208
|
* Returns true if the network is currently online
|
|
@@ -1262,7 +1261,7 @@ class se {
|
|
|
1262
1261
|
}
|
|
1263
1262
|
}
|
|
1264
1263
|
class re {
|
|
1265
|
-
static onlineSignal =
|
|
1264
|
+
static onlineSignal = Tt(!0);
|
|
1266
1265
|
get isOnline() {
|
|
1267
1266
|
return !0;
|
|
1268
1267
|
}
|
|
@@ -1276,14 +1275,14 @@ class re {
|
|
|
1276
1275
|
destroy() {
|
|
1277
1276
|
}
|
|
1278
1277
|
}
|
|
1279
|
-
const
|
|
1280
|
-
function
|
|
1278
|
+
const hi = new se(), ki = Pt(hi);
|
|
1279
|
+
function wt(e, t = typeof window > "u") {
|
|
1281
1280
|
let i;
|
|
1282
1281
|
e === !1 ? i = 0 : e === void 0 || e === !0 ? i = t ? 0 : 3 : typeof e == "number" ? i = e : i = e.retries;
|
|
1283
1282
|
const n = typeof e == "object" && e.retryDelay ? e.retryDelay : (s) => 1e3 * Math.pow(2, s);
|
|
1284
1283
|
return { retries: i, retryDelay: n };
|
|
1285
1284
|
}
|
|
1286
|
-
class
|
|
1285
|
+
class Fi {
|
|
1287
1286
|
static cache;
|
|
1288
1287
|
/**
|
|
1289
1288
|
* The adapter class responsible for sending requests for this query type.
|
|
@@ -1293,27 +1292,27 @@ class Ti {
|
|
|
1293
1292
|
params;
|
|
1294
1293
|
config;
|
|
1295
1294
|
constructor() {
|
|
1296
|
-
return
|
|
1295
|
+
return Kt(this);
|
|
1297
1296
|
}
|
|
1298
1297
|
}
|
|
1299
|
-
const
|
|
1300
|
-
class
|
|
1298
|
+
const Dt = /* @__PURE__ */ new WeakMap();
|
|
1299
|
+
class K {
|
|
1301
1300
|
constructor(t, i) {
|
|
1302
1301
|
this.captured = i, this.statics = t;
|
|
1303
1302
|
}
|
|
1304
1303
|
statics;
|
|
1305
1304
|
createExecutionContext(t, i) {
|
|
1306
|
-
return
|
|
1305
|
+
return st(this.captured, t, i);
|
|
1307
1306
|
}
|
|
1308
1307
|
resolveOptions(t) {
|
|
1309
|
-
const { methods: i } = this.captured, n = i.getConfig ? i.getConfig.call(t) : t.config, s =
|
|
1308
|
+
const { methods: i } = this.captured, n = i.getConfig ? i.getConfig.call(t) : t.config, s = wt(n?.retry);
|
|
1310
1309
|
return { config: n, retryConfig: s };
|
|
1311
1310
|
}
|
|
1312
1311
|
static for(t) {
|
|
1313
|
-
let i =
|
|
1312
|
+
let i = Dt.get(t);
|
|
1314
1313
|
if (i !== void 0)
|
|
1315
1314
|
return i;
|
|
1316
|
-
const n = new t(), s =
|
|
1315
|
+
const n = new t(), s = Me(n), r = String(s.methods.getIdentityKey.call(s.fields)), o = s.fields.result, a = o instanceof _ ? o : Ze.object(o), c = (a.mask & d.ENTITY) !== 0, f = t.cache, l = s.fields.fetchNext, u = t.adapter;
|
|
1317
1316
|
if (!u)
|
|
1318
1317
|
throw new Error(
|
|
1319
1318
|
`Query class "${t.name}" must define a static \`adapter\` property. Extend RESTQuery (from fetchium/rest) or set \`static adapter = MyAdapter\` on your query class.`
|
|
@@ -1325,27 +1324,27 @@ class V {
|
|
|
1325
1324
|
void 0,
|
|
1326
1325
|
r,
|
|
1327
1326
|
// typenameValue — unique per query class
|
|
1328
|
-
|
|
1327
|
+
Lt
|
|
1329
1328
|
// idField — symbol, injected onto payload before parse
|
|
1330
1329
|
);
|
|
1331
|
-
return i = new
|
|
1330
|
+
return i = new K(
|
|
1332
1331
|
{ id: r, shape: v, cache: f, rawFetchNext: l, hasSendNext: y, isEntityResult: c, adapterClass: u },
|
|
1333
1332
|
s
|
|
1334
|
-
),
|
|
1333
|
+
), Dt.set(t, i), i;
|
|
1335
1334
|
}
|
|
1336
1335
|
}
|
|
1337
|
-
const
|
|
1338
|
-
const i =
|
|
1339
|
-
return
|
|
1336
|
+
const Ti = (e, t) => {
|
|
1337
|
+
const i = K.for(e);
|
|
1338
|
+
return Et(i, t);
|
|
1340
1339
|
};
|
|
1341
|
-
function
|
|
1342
|
-
const i =
|
|
1340
|
+
function Pi(e, ...t) {
|
|
1341
|
+
const i = K.for(e), n = me(Si);
|
|
1343
1342
|
if (n === void 0)
|
|
1344
1343
|
throw new Error("QueryClient not found");
|
|
1345
1344
|
const s = t[0];
|
|
1346
1345
|
return n.getQuery(i, s);
|
|
1347
1346
|
}
|
|
1348
|
-
function
|
|
1347
|
+
function ct(e) {
|
|
1349
1348
|
if (e.reason !== void 0) return e.reason;
|
|
1350
1349
|
if (typeof DOMException < "u")
|
|
1351
1350
|
return new DOMException("The operation was aborted", "AbortError");
|
|
@@ -1355,25 +1354,25 @@ function rt(e) {
|
|
|
1355
1354
|
function oe(e, t) {
|
|
1356
1355
|
return new Promise((i, n) => {
|
|
1357
1356
|
if (t?.aborted) {
|
|
1358
|
-
n(
|
|
1357
|
+
n(ct(t));
|
|
1359
1358
|
return;
|
|
1360
1359
|
}
|
|
1361
1360
|
const s = setTimeout(i, e);
|
|
1362
1361
|
t?.addEventListener(
|
|
1363
1362
|
"abort",
|
|
1364
1363
|
() => {
|
|
1365
|
-
clearTimeout(s), n(
|
|
1364
|
+
clearTimeout(s), n(ct(t));
|
|
1366
1365
|
},
|
|
1367
1366
|
{ once: !0 }
|
|
1368
1367
|
);
|
|
1369
1368
|
});
|
|
1370
1369
|
}
|
|
1371
|
-
async function
|
|
1370
|
+
async function ft(e, t, i) {
|
|
1372
1371
|
const n = Math.max(0, t.retries);
|
|
1373
1372
|
let s;
|
|
1374
1373
|
for (let r = 0; r <= n; r++) {
|
|
1375
1374
|
if (i?.aborted)
|
|
1376
|
-
throw
|
|
1375
|
+
throw ct(i);
|
|
1377
1376
|
try {
|
|
1378
1377
|
return await e();
|
|
1379
1378
|
} catch (o) {
|
|
@@ -1383,7 +1382,7 @@ async function ot(e, t, i) {
|
|
|
1383
1382
|
}
|
|
1384
1383
|
throw s;
|
|
1385
1384
|
}
|
|
1386
|
-
class
|
|
1385
|
+
class yi {
|
|
1387
1386
|
def;
|
|
1388
1387
|
queryKey;
|
|
1389
1388
|
storageKey = -1;
|
|
@@ -1394,14 +1393,24 @@ class pi {
|
|
|
1394
1393
|
updatedAt = void 0;
|
|
1395
1394
|
params = void 0;
|
|
1396
1395
|
unsubscribe = void 0;
|
|
1396
|
+
lastSubscribeFn = void 0;
|
|
1397
1397
|
_relayState = void 0;
|
|
1398
1398
|
_isActive = !1;
|
|
1399
1399
|
wasPaused = !1;
|
|
1400
1400
|
currentParams = void 0;
|
|
1401
1401
|
debounceTimer = void 0;
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
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
|
+
}
|
|
1405
1414
|
/** Cancels in-flight fetches and retry waits. */
|
|
1406
1415
|
_abortController = void 0;
|
|
1407
1416
|
/** Cached execution context, recreated only when storageKey (params) changes. */
|
|
@@ -1422,14 +1431,14 @@ class pi {
|
|
|
1422
1431
|
}
|
|
1423
1432
|
constructor(t, i, n, s) {
|
|
1424
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);
|
|
1425
|
-
const r =
|
|
1426
|
-
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(
|
|
1427
1436
|
(o) => {
|
|
1428
1437
|
this._relayState = o;
|
|
1429
1438
|
const a = () => {
|
|
1430
|
-
this._isActive = !1, clearTimeout(this.debounceTimer), this.debounceTimer = void 0, this._abortController?.abort(), this._abortController = void 0, this._fetchNextAbort?.abort(), this._fetchNextAbort = void 0, this._fetchNextPromise = void 0, this.unsubscribe?.(), this.unsubscribe = void 0;
|
|
1431
|
-
const f = this.config?.gcTime ??
|
|
1432
|
-
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);
|
|
1433
1442
|
}, c = (f = !1) => {
|
|
1434
1443
|
const { wasPaused: l, isPaused: u, initialized: y } = this;
|
|
1435
1444
|
if (this.wasPaused = u, u && !l && y) {
|
|
@@ -1437,8 +1446,8 @@ class pi {
|
|
|
1437
1446
|
return;
|
|
1438
1447
|
}
|
|
1439
1448
|
this._isActive = !0;
|
|
1440
|
-
const v =
|
|
1441
|
-
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());
|
|
1442
1451
|
};
|
|
1443
1452
|
return c(!0), {
|
|
1444
1453
|
update: c,
|
|
@@ -1486,7 +1495,7 @@ class pi {
|
|
|
1486
1495
|
}
|
|
1487
1496
|
if (!this.isPaused)
|
|
1488
1497
|
try {
|
|
1489
|
-
if (n !== void 0 && this.
|
|
1498
|
+
if (n !== void 0 && this.reconcileSubscription(), n === void 0 || this.isStale) {
|
|
1490
1499
|
if (await oe(0), this.isPaused) return;
|
|
1491
1500
|
this.runQueryImmediately();
|
|
1492
1501
|
}
|
|
@@ -1494,10 +1503,9 @@ class pi {
|
|
|
1494
1503
|
i.setError(s);
|
|
1495
1504
|
}
|
|
1496
1505
|
}
|
|
1497
|
-
|
|
1498
|
-
this.unsubscribe?.(), this.unsubscribe = void 0;
|
|
1506
|
+
reconcileSubscription() {
|
|
1499
1507
|
const t = this.config?.subscribe;
|
|
1500
|
-
if (!t) return;
|
|
1508
|
+
if (t === this.lastSubscribeFn || (this.unsubscribe?.(), this.unsubscribe = void 0, this.lastSubscribeFn = t, !t)) return;
|
|
1501
1509
|
const i = this._executionCtx;
|
|
1502
1510
|
this.unsubscribe = t.call(i, (n) => {
|
|
1503
1511
|
n.__eventSource = this.queryKey, this.queryClient.applyMutationEvent(n);
|
|
@@ -1507,23 +1515,19 @@ class pi {
|
|
|
1507
1515
|
return (this._executionCtx === void 0 || this._executionCtxKey !== this.storageKey) && (this._executionCtxKey = this.storageKey, this._executionCtx = this.def.createExecutionContext(
|
|
1508
1516
|
this.currentParams ?? {},
|
|
1509
1517
|
this.queryClient.getContext()
|
|
1510
|
-
), this._executionCtx.refetch = () => this.refetch(), this._executionCtx.rawFetchNext = this.def.statics.rawFetchNext
|
|
1511
|
-
}
|
|
1512
|
-
resolveAndApplyOptions() {
|
|
1513
|
-
const t = this.def.resolveOptions(this._executionCtx);
|
|
1514
|
-
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;
|
|
1515
1519
|
}
|
|
1516
1520
|
async runQuery() {
|
|
1517
1521
|
const t = this.def;
|
|
1518
1522
|
if (this.isPaused)
|
|
1519
1523
|
throw new Error("Query is paused due to network status");
|
|
1520
1524
|
const i = this.getOrCreateExecutionContext(), n = this.queryClient.getAdapter(t.statics.adapterClass), s = this._abortController?.signal ?? new AbortController().signal;
|
|
1521
|
-
return
|
|
1525
|
+
return ft(
|
|
1522
1526
|
async () => {
|
|
1523
1527
|
const r = await n.send(i, s);
|
|
1524
1528
|
this.updatedAt = Date.now();
|
|
1525
1529
|
const o = this.applyData(r, !0);
|
|
1526
|
-
return this.saveQueryMetadata(), this.
|
|
1530
|
+
return this.saveQueryMetadata(), this.reconcileSubscription(), o;
|
|
1527
1531
|
},
|
|
1528
1532
|
this.retryConfig,
|
|
1529
1533
|
s
|
|
@@ -1574,7 +1578,7 @@ class pi {
|
|
|
1574
1578
|
const i = this._fetchNextAbort.signal, n = this.getOrCreateExecutionContext();
|
|
1575
1579
|
n.resultData = this.rootEntity.data;
|
|
1576
1580
|
const s = this.queryClient.getAdapter(t.statics.adapterClass);
|
|
1577
|
-
return
|
|
1581
|
+
return ft(
|
|
1578
1582
|
async () => {
|
|
1579
1583
|
const r = await s.sendNext(n, i);
|
|
1580
1584
|
this.updatedAt = Date.now();
|
|
@@ -1595,21 +1599,21 @@ class pi {
|
|
|
1595
1599
|
return Date.now() - this.updatedAt >= t;
|
|
1596
1600
|
}
|
|
1597
1601
|
get isPaused() {
|
|
1598
|
-
const t = this.config?.networkMode ??
|
|
1599
|
-
if (t ===
|
|
1602
|
+
const t = this.config?.networkMode ?? L.Online;
|
|
1603
|
+
if (t === L.Always)
|
|
1600
1604
|
return !1;
|
|
1601
1605
|
const i = this.queryClient.networkManager.getOnlineSignal().value;
|
|
1602
1606
|
switch (t) {
|
|
1603
|
-
case
|
|
1607
|
+
case L.Online:
|
|
1604
1608
|
return !i;
|
|
1605
|
-
case
|
|
1609
|
+
case L.OfflineFirst:
|
|
1606
1610
|
return !i && this.updatedAt === void 0;
|
|
1607
1611
|
default:
|
|
1608
1612
|
return !1;
|
|
1609
1613
|
}
|
|
1610
1614
|
}
|
|
1611
1615
|
}
|
|
1612
|
-
class
|
|
1616
|
+
class pi {
|
|
1613
1617
|
def;
|
|
1614
1618
|
queryClient;
|
|
1615
1619
|
_inFlight = !1;
|
|
@@ -1638,8 +1642,8 @@ class gi {
|
|
|
1638
1642
|
if (!(i instanceof _))
|
|
1639
1643
|
return t;
|
|
1640
1644
|
const n = this.queryClient.getContext().log?.warn ?? (() => {
|
|
1641
|
-
}), s = new
|
|
1642
|
-
return s.reset(void 0, void 0, n),
|
|
1645
|
+
}), s = new at();
|
|
1646
|
+
return s.reset(void 0, void 0, n), te(t, i, s);
|
|
1643
1647
|
}
|
|
1644
1648
|
// ======================================================
|
|
1645
1649
|
// Effects processing
|
|
@@ -1647,7 +1651,7 @@ class gi {
|
|
|
1647
1651
|
processEffects(t, i) {
|
|
1648
1652
|
let n;
|
|
1649
1653
|
if (this.def.hasGetEffects) {
|
|
1650
|
-
const r =
|
|
1654
|
+
const r = st(
|
|
1651
1655
|
this.def.captured,
|
|
1652
1656
|
t ?? {},
|
|
1653
1657
|
this.queryClient.getContext()
|
|
@@ -1655,23 +1659,23 @@ class gi {
|
|
|
1655
1659
|
r.result = i, n = r.getEffects();
|
|
1656
1660
|
} else if (this.def.effects !== void 0) {
|
|
1657
1661
|
const r = { params: t, result: i };
|
|
1658
|
-
n =
|
|
1662
|
+
n = z(this.def.effects, r);
|
|
1659
1663
|
}
|
|
1660
1664
|
if (n === void 0) return;
|
|
1661
1665
|
const s = this.queryClient;
|
|
1662
|
-
|
|
1666
|
+
et(n.creates, "create", s), et(n.updates, "update", s), et(n.deletes, "delete", s), n.invalidates && s.invalidateQueries(n.invalidates);
|
|
1663
1667
|
}
|
|
1664
1668
|
// ======================================================
|
|
1665
1669
|
// Retry logic
|
|
1666
1670
|
// ======================================================
|
|
1667
1671
|
executeWithRetry(t) {
|
|
1668
|
-
const i =
|
|
1672
|
+
const i = wt(this.def.config?.retry, !0), n = this.queryClient.getAdapter(this.def.adapterClass);
|
|
1669
1673
|
if (!n.sendMutation)
|
|
1670
1674
|
throw new Error(
|
|
1671
1675
|
`Adapter "${this.def.adapterClass.name}" does not implement sendMutation(). Add a sendMutation() method to handle mutations.`
|
|
1672
1676
|
);
|
|
1673
|
-
return
|
|
1674
|
-
const s = new AbortController(), r =
|
|
1677
|
+
return ft(async () => {
|
|
1678
|
+
const s = new AbortController(), r = st(
|
|
1675
1679
|
this.def.captured,
|
|
1676
1680
|
t ?? {},
|
|
1677
1681
|
this.queryClient.getContext()
|
|
@@ -1680,13 +1684,13 @@ class gi {
|
|
|
1680
1684
|
}, i);
|
|
1681
1685
|
}
|
|
1682
1686
|
}
|
|
1683
|
-
function
|
|
1684
|
-
return typeof e == "string" ? e :
|
|
1687
|
+
function gi(e) {
|
|
1688
|
+
return typeof e == "string" ? e : P(e).typenameValue;
|
|
1685
1689
|
}
|
|
1686
|
-
function
|
|
1690
|
+
function et(e, t, i) {
|
|
1687
1691
|
if (e)
|
|
1688
1692
|
for (const [n, s] of e) {
|
|
1689
|
-
const r =
|
|
1693
|
+
const r = gi(n);
|
|
1690
1694
|
r !== void 0 && i.applyMutationEvent({ type: t, typename: r, data: s });
|
|
1691
1695
|
}
|
|
1692
1696
|
}
|
|
@@ -1694,10 +1698,10 @@ const ae = "__eventSource";
|
|
|
1694
1698
|
function ce(e) {
|
|
1695
1699
|
return { field: e, segments: e.indexOf(".") !== -1 ? e.split(".") : void 0 };
|
|
1696
1700
|
}
|
|
1697
|
-
function
|
|
1701
|
+
function vi(e) {
|
|
1698
1702
|
return e.map(ce);
|
|
1699
1703
|
}
|
|
1700
|
-
function
|
|
1704
|
+
function _i(e, t) {
|
|
1701
1705
|
if (t.segments === void 0) return e[t.field];
|
|
1702
1706
|
let i = e;
|
|
1703
1707
|
for (const n of t.segments) {
|
|
@@ -1709,13 +1713,13 @@ function mi(e, t) {
|
|
|
1709
1713
|
function fe(e, t) {
|
|
1710
1714
|
const i = [];
|
|
1711
1715
|
for (let n = 0; n < t.length; n++) {
|
|
1712
|
-
const s = t[n], r =
|
|
1716
|
+
const s = t[n], r = _i(e, s);
|
|
1713
1717
|
if (r === void 0) return;
|
|
1714
1718
|
i.push(s.field, r);
|
|
1715
1719
|
}
|
|
1716
1720
|
return D(i);
|
|
1717
1721
|
}
|
|
1718
|
-
function
|
|
1722
|
+
function mi(e, t) {
|
|
1719
1723
|
if (e === void 0) return;
|
|
1720
1724
|
const i = /* @__PURE__ */ new Map();
|
|
1721
1725
|
for (const [n, s] of e) {
|
|
@@ -1723,9 +1727,9 @@ function wi(e, t) {
|
|
|
1723
1727
|
let a = !0;
|
|
1724
1728
|
for (const [c, f] of r) {
|
|
1725
1729
|
let l;
|
|
1726
|
-
if (
|
|
1727
|
-
const u =
|
|
1728
|
-
l =
|
|
1730
|
+
if (Ut(f)) {
|
|
1731
|
+
const u = Vt(f);
|
|
1732
|
+
l = ht(u, t);
|
|
1729
1733
|
} else
|
|
1730
1734
|
l = f;
|
|
1731
1735
|
if (l === void 0) {
|
|
@@ -1738,12 +1742,12 @@ function wi(e, t) {
|
|
|
1738
1742
|
}
|
|
1739
1743
|
return i.size > 0 ? i : void 0;
|
|
1740
1744
|
}
|
|
1741
|
-
function
|
|
1745
|
+
function Nt(e, t) {
|
|
1742
1746
|
const i = e.get(t);
|
|
1743
1747
|
if (i !== void 0)
|
|
1744
1748
|
return i.map(([n]) => n).sort();
|
|
1745
1749
|
}
|
|
1746
|
-
class
|
|
1750
|
+
class wi {
|
|
1747
1751
|
fields;
|
|
1748
1752
|
fieldPaths;
|
|
1749
1753
|
_bindings = /* @__PURE__ */ new Map();
|
|
@@ -1768,12 +1772,12 @@ class Ei {
|
|
|
1768
1772
|
function It(e) {
|
|
1769
1773
|
return D(e);
|
|
1770
1774
|
}
|
|
1771
|
-
class
|
|
1775
|
+
class Ei {
|
|
1772
1776
|
_groups = /* @__PURE__ */ new Map();
|
|
1773
1777
|
getOrCreateGroup(t) {
|
|
1774
1778
|
const i = It(t);
|
|
1775
1779
|
let n = this._groups.get(i);
|
|
1776
|
-
return n === void 0 && (n = new
|
|
1780
|
+
return n === void 0 && (n = new wi(t), this._groups.set(i, n)), n;
|
|
1777
1781
|
}
|
|
1778
1782
|
register(t, i, n) {
|
|
1779
1783
|
this.getOrCreateGroup(i).register(t, n);
|
|
@@ -1785,13 +1789,13 @@ class bi {
|
|
|
1785
1789
|
registerBinding(t, i) {
|
|
1786
1790
|
const n = t._constraintHashes.get(i);
|
|
1787
1791
|
if (n === void 0) return;
|
|
1788
|
-
const s =
|
|
1792
|
+
const s = Nt(t._constraintFieldRefs, i);
|
|
1789
1793
|
s !== void 0 && this.register(n, s, t);
|
|
1790
1794
|
}
|
|
1791
1795
|
unregisterBinding(t, i) {
|
|
1792
1796
|
const n = t._constraintHashes.get(i);
|
|
1793
1797
|
if (n === void 0) return;
|
|
1794
|
-
const s =
|
|
1798
|
+
const s = Nt(t._constraintFieldRefs, i);
|
|
1795
1799
|
s !== void 0 && this.unregister(n, s, t);
|
|
1796
1800
|
}
|
|
1797
1801
|
routeEvent(t, i, n, s, r, o) {
|
|
@@ -1805,11 +1809,11 @@ class bi {
|
|
|
1805
1809
|
}
|
|
1806
1810
|
}
|
|
1807
1811
|
}
|
|
1808
|
-
function
|
|
1812
|
+
function Mt(e) {
|
|
1809
1813
|
const t = /* @__PURE__ */ new Set();
|
|
1810
1814
|
for (const i of e)
|
|
1811
1815
|
if (typeof i == "object" && i !== null) {
|
|
1812
|
-
const n =
|
|
1816
|
+
const n = F(i);
|
|
1813
1817
|
n !== void 0 && t.add(n);
|
|
1814
1818
|
}
|
|
1815
1819
|
return t;
|
|
@@ -1825,7 +1829,7 @@ class ue {
|
|
|
1825
1829
|
this._queryClient = n, this._parent = s, this._constraintHashes = r, this._constraintFieldRefs = i, this.instance = o, this._entityDefsByTypename = /* @__PURE__ */ new Map();
|
|
1826
1830
|
for (const a of t)
|
|
1827
1831
|
a.typenameValue !== void 0 && this._entityDefsByTypename.set(a.typenameValue, a);
|
|
1828
|
-
|
|
1832
|
+
Z.add(this);
|
|
1829
1833
|
}
|
|
1830
1834
|
getValue() {
|
|
1831
1835
|
return this.instance.getValue();
|
|
@@ -1864,7 +1868,7 @@ class ue {
|
|
|
1864
1868
|
i !== -1 && t.splice(i, 1);
|
|
1865
1869
|
}
|
|
1866
1870
|
}
|
|
1867
|
-
class
|
|
1871
|
+
class bi {
|
|
1868
1872
|
_notifier;
|
|
1869
1873
|
_items;
|
|
1870
1874
|
_keys;
|
|
@@ -1872,9 +1876,9 @@ class Ci {
|
|
|
1872
1876
|
_queryClient;
|
|
1873
1877
|
_parent;
|
|
1874
1878
|
constructor(t, i, n, s, r, o) {
|
|
1875
|
-
this._notifier =
|
|
1879
|
+
this._notifier = H(), this._items = n, this._keys = Mt(n), this._queryClient = t, this._parent = i;
|
|
1876
1880
|
const a = s !== void 0 && r !== void 0, c = o !== void 0;
|
|
1877
|
-
(a || c) && (this._outputSignal =
|
|
1881
|
+
(a || c) && (this._outputSignal = nt(() => {
|
|
1878
1882
|
this._notifier.consume();
|
|
1879
1883
|
let f = this._items;
|
|
1880
1884
|
if (a) {
|
|
@@ -1884,7 +1888,7 @@ class Ci {
|
|
|
1884
1888
|
l.push(u);
|
|
1885
1889
|
continue;
|
|
1886
1890
|
}
|
|
1887
|
-
const y =
|
|
1891
|
+
const y = F(u);
|
|
1888
1892
|
if (y === void 0) {
|
|
1889
1893
|
l.push(u);
|
|
1890
1894
|
continue;
|
|
@@ -1939,10 +1943,10 @@ class Ci {
|
|
|
1939
1943
|
}
|
|
1940
1944
|
reset(t) {
|
|
1941
1945
|
const i = this._items, n = Array.isArray(t) ? t : [];
|
|
1942
|
-
this._items = n, this._keys =
|
|
1946
|
+
this._items = n, this._keys = Mt(n);
|
|
1943
1947
|
for (const s of n)
|
|
1944
1948
|
if (typeof s == "object" && s !== null) {
|
|
1945
|
-
const r =
|
|
1949
|
+
const r = F(s);
|
|
1946
1950
|
if (r !== void 0) {
|
|
1947
1951
|
const o = this._queryClient.entityMap.getEntity(r);
|
|
1948
1952
|
o !== void 0 && this._parent.addChildRef(o);
|
|
@@ -1950,7 +1954,7 @@ class Ci {
|
|
|
1950
1954
|
}
|
|
1951
1955
|
for (const s of i)
|
|
1952
1956
|
if (typeof s == "object" && s !== null) {
|
|
1953
|
-
const r =
|
|
1957
|
+
const r = F(s);
|
|
1954
1958
|
if (r !== void 0) {
|
|
1955
1959
|
const o = this._queryClient.entityMap.getEntity(r);
|
|
1956
1960
|
o !== void 0 && this._parent.removeChildRef(o);
|
|
@@ -1962,20 +1966,20 @@ class Ci {
|
|
|
1962
1966
|
if (Array.isArray(t))
|
|
1963
1967
|
for (const i of t) {
|
|
1964
1968
|
if (typeof i != "object" || i === null) continue;
|
|
1965
|
-
const n =
|
|
1969
|
+
const n = F(i);
|
|
1966
1970
|
n !== void 0 && this.add(n, i);
|
|
1967
1971
|
}
|
|
1968
1972
|
}
|
|
1969
1973
|
_findIndex(t) {
|
|
1970
1974
|
for (let i = 0; i < this._items.length; i++) {
|
|
1971
1975
|
const n = this._items[i];
|
|
1972
|
-
if (typeof n == "object" && n !== null &&
|
|
1976
|
+
if (typeof n == "object" && n !== null && F(n) === t)
|
|
1973
1977
|
return i;
|
|
1974
1978
|
}
|
|
1975
1979
|
return -1;
|
|
1976
1980
|
}
|
|
1977
1981
|
}
|
|
1978
|
-
class
|
|
1982
|
+
class Ci {
|
|
1979
1983
|
_notifier;
|
|
1980
1984
|
_value;
|
|
1981
1985
|
_createdKeys;
|
|
@@ -1986,7 +1990,7 @@ class xi {
|
|
|
1986
1990
|
_onUpdate;
|
|
1987
1991
|
_onDelete;
|
|
1988
1992
|
constructor(t, i, n, s, r, o) {
|
|
1989
|
-
this._notifier =
|
|
1993
|
+
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;
|
|
1990
1994
|
}
|
|
1991
1995
|
onEvent(t, i, n, s) {
|
|
1992
1996
|
switch (s) {
|
|
@@ -2025,9 +2029,9 @@ function de(e, t, i, n, s) {
|
|
|
2025
2029
|
l !== void 0 && r.set(l, [[ae, i.key]]);
|
|
2026
2030
|
}
|
|
2027
2031
|
}
|
|
2028
|
-
const o =
|
|
2032
|
+
const o = mi(r, n) ?? /* @__PURE__ */ new Map();
|
|
2029
2033
|
let a;
|
|
2030
|
-
if (e.type ===
|
|
2034
|
+
if (e.type === dt.Array) {
|
|
2031
2035
|
let f, l;
|
|
2032
2036
|
if (e.constraintFieldRefs !== void 0 && o.size > 0 && o.size === 1)
|
|
2033
2037
|
for (const [u] of e.constraintFieldRefs) {
|
|
@@ -2035,11 +2039,11 @@ function de(e, t, i, n, s) {
|
|
|
2035
2039
|
if (y !== void 0) {
|
|
2036
2040
|
l = y;
|
|
2037
2041
|
const v = e.constraintFieldRefs.get(u);
|
|
2038
|
-
v !== void 0 && (f =
|
|
2042
|
+
v !== void 0 && (f = vi(v.map(([p]) => p)));
|
|
2039
2043
|
break;
|
|
2040
2044
|
}
|
|
2041
2045
|
}
|
|
2042
|
-
a = new
|
|
2046
|
+
a = new bi(
|
|
2043
2047
|
s,
|
|
2044
2048
|
i,
|
|
2045
2049
|
Array.isArray(t) ? t : [],
|
|
@@ -2048,7 +2052,7 @@ function de(e, t, i, n, s) {
|
|
|
2048
2052
|
e.sort
|
|
2049
2053
|
);
|
|
2050
2054
|
} else
|
|
2051
|
-
a = new
|
|
2055
|
+
a = new Ci(
|
|
2052
2056
|
s,
|
|
2053
2057
|
i,
|
|
2054
2058
|
t,
|
|
@@ -2067,21 +2071,21 @@ function de(e, t, i, n, s) {
|
|
|
2067
2071
|
return i.liveCollections.push(c), s.registerLiveCollection(c), c;
|
|
2068
2072
|
}
|
|
2069
2073
|
const le = Object.entries, he = Object.prototype;
|
|
2070
|
-
function
|
|
2074
|
+
function it(e, t, i, n = !1) {
|
|
2071
2075
|
const s = e.queryClient;
|
|
2072
2076
|
s.currentParseId++;
|
|
2073
2077
|
const r = e.seen, o = /* @__PURE__ */ new Map();
|
|
2074
|
-
return { data:
|
|
2078
|
+
return { data: V(t, r, s, i, o, n), entityRefs: o };
|
|
2075
2079
|
}
|
|
2076
|
-
function
|
|
2080
|
+
function V(e, t, i, n, s, r) {
|
|
2077
2081
|
if (typeof e != "object" || e === null) return e;
|
|
2078
2082
|
const o = t.get(e);
|
|
2079
2083
|
if (o !== void 0)
|
|
2080
|
-
return
|
|
2084
|
+
return xi(o, t, i, n, s, r);
|
|
2081
2085
|
if (Array.isArray(e)) {
|
|
2082
2086
|
for (let a = 0; a < e.length; a++) {
|
|
2083
2087
|
const c = e[a];
|
|
2084
|
-
typeof c == "object" && c !== null && !(c instanceof
|
|
2088
|
+
typeof c == "object" && c !== null && !(c instanceof U) && !x.has(c) && (e[a] = V(c, t, i, n, s, r));
|
|
2085
2089
|
}
|
|
2086
2090
|
return e;
|
|
2087
2091
|
}
|
|
@@ -2089,15 +2093,15 @@ function U(e, t, i, n, s, r) {
|
|
|
2089
2093
|
const a = e;
|
|
2090
2094
|
for (const c of Object.keys(a)) {
|
|
2091
2095
|
const f = a[c];
|
|
2092
|
-
typeof f == "object" && f !== null && !(f instanceof
|
|
2096
|
+
typeof f == "object" && f !== null && !(f instanceof U) && !x.has(f) && (a[c] = V(f, t, i, n, s, r));
|
|
2093
2097
|
}
|
|
2094
2098
|
}
|
|
2095
2099
|
return e;
|
|
2096
2100
|
}
|
|
2097
2101
|
function ye(e) {
|
|
2098
|
-
return typeof e == "object" && e !== null && !(e instanceof
|
|
2102
|
+
return typeof e == "object" && e !== null && !(e instanceof U) && !x.has(e);
|
|
2099
2103
|
}
|
|
2100
|
-
function
|
|
2104
|
+
function xi(e, t, i, n, s, r) {
|
|
2101
2105
|
const { key: o, data: a, shape: c, rawKeys: f } = e, l = c.shape, u = i.prepareEntity(o, a, c), y = u.data, v = y !== a, p = v && f !== void 0 && u.entityRefs !== void 0 ? new Map(u.entityRefs) : /* @__PURE__ */ new Map();
|
|
2102
2106
|
if (v ? (pe(
|
|
2103
2107
|
l,
|
|
@@ -2112,15 +2116,15 @@ function Oi(e, t, i, n, s, r) {
|
|
|
2112
2116
|
p,
|
|
2113
2117
|
r
|
|
2114
2118
|
), u.notify()) : ge(l, a, u, a, t, i, n, p, r), r && u.liveCollections.length > 0)
|
|
2115
|
-
for (const
|
|
2116
|
-
const
|
|
2117
|
-
if (Array.isArray(
|
|
2118
|
-
for (const O of
|
|
2119
|
+
for (const m of u.liveCollections) {
|
|
2120
|
+
const N = m.instance.getRawValue();
|
|
2121
|
+
if (Array.isArray(N))
|
|
2122
|
+
for (const O of N) {
|
|
2119
2123
|
if (typeof O != "object" || O === null) continue;
|
|
2120
|
-
const
|
|
2121
|
-
if (
|
|
2122
|
-
const
|
|
2123
|
-
|
|
2124
|
+
const $ = x.get(O);
|
|
2125
|
+
if ($ === void 0) continue;
|
|
2126
|
+
const S = i.entityMap.getEntity($);
|
|
2127
|
+
S !== void 0 && p.set(S, (p.get(S) ?? 0) + 1);
|
|
2124
2128
|
}
|
|
2125
2129
|
}
|
|
2126
2130
|
u.setChildRefs(p.size > 0 ? p : void 0, n);
|
|
@@ -2130,7 +2134,7 @@ function Oi(e, t, i, n, s, r) {
|
|
|
2130
2134
|
function pe(e, t, i, n, s, r, o, a, c, f, l) {
|
|
2131
2135
|
for (const [u, y] of le(e))
|
|
2132
2136
|
if (!(n !== void 0 && !n.has(u)))
|
|
2133
|
-
if (ye(t[u]) && (t[u] =
|
|
2137
|
+
if (ye(t[u]) && (t[u] = V(t[u], o, a, c, f, l)), y instanceof _ && y._liveConfig !== void 0) {
|
|
2134
2138
|
const v = i[u];
|
|
2135
2139
|
v instanceof ue ? l ? v.append(t[u]) : v.reset(t[u]) : i[u] = de(
|
|
2136
2140
|
y._liveConfig,
|
|
@@ -2141,7 +2145,7 @@ function pe(e, t, i, n, s, r, o, a, c, f, l) {
|
|
|
2141
2145
|
);
|
|
2142
2146
|
} else {
|
|
2143
2147
|
const v = t[u], p = i[u];
|
|
2144
|
-
if (
|
|
2148
|
+
if (ut(v) && ut(p)) {
|
|
2145
2149
|
const g = y instanceof _ && y.shape !== void 0 ? y.shape : void 0;
|
|
2146
2150
|
if (g !== void 0)
|
|
2147
2151
|
pe(
|
|
@@ -2158,8 +2162,8 @@ function pe(e, t, i, n, s, r, o, a, c, f, l) {
|
|
|
2158
2162
|
l
|
|
2159
2163
|
);
|
|
2160
2164
|
else
|
|
2161
|
-
for (const
|
|
2162
|
-
p[
|
|
2165
|
+
for (const m of Object.keys(v))
|
|
2166
|
+
p[m] = v[m];
|
|
2163
2167
|
i[u] = p;
|
|
2164
2168
|
} else
|
|
2165
2169
|
i[u] = v;
|
|
@@ -2168,7 +2172,7 @@ function pe(e, t, i, n, s, r, o, a, c, f, l) {
|
|
|
2168
2172
|
function ge(e, t, i, n, s, r, o, a, c) {
|
|
2169
2173
|
for (const [f, l] of le(e))
|
|
2170
2174
|
if (f in t)
|
|
2171
|
-
if (ye(t[f]) && (t[f] =
|
|
2175
|
+
if (ye(t[f]) && (t[f] = V(t[f], s, r, o, a, c)), l instanceof _ && l._liveConfig !== void 0)
|
|
2172
2176
|
t[f] = de(
|
|
2173
2177
|
l._liveConfig,
|
|
2174
2178
|
t[f],
|
|
@@ -2178,32 +2182,32 @@ function ge(e, t, i, n, s, r, o, a, c) {
|
|
|
2178
2182
|
);
|
|
2179
2183
|
else {
|
|
2180
2184
|
const u = t[f];
|
|
2181
|
-
if (
|
|
2185
|
+
if (ut(u)) {
|
|
2182
2186
|
const y = l instanceof _ && l.shape !== void 0 ? l.shape : void 0;
|
|
2183
2187
|
y !== void 0 && ge(y, u, i, n, s, r, o, a, c);
|
|
2184
2188
|
}
|
|
2185
2189
|
}
|
|
2186
2190
|
}
|
|
2187
|
-
function
|
|
2191
|
+
function ut(e) {
|
|
2188
2192
|
return typeof e == "object" && e !== null && !Array.isArray(e) && Object.getPrototypeOf(e) === he && !x.has(e);
|
|
2189
2193
|
}
|
|
2190
|
-
function
|
|
2194
|
+
function ji(e) {
|
|
2191
2195
|
if (e !== void 0)
|
|
2192
2196
|
return typeof e == "string" ? e : typeof e == "function" ? e() : e.value;
|
|
2193
2197
|
}
|
|
2194
|
-
function
|
|
2195
|
-
return
|
|
2198
|
+
function Oi(e) {
|
|
2199
|
+
return Ee(e);
|
|
2196
2200
|
}
|
|
2197
|
-
function
|
|
2201
|
+
function kt(e) {
|
|
2198
2202
|
if (e === void 0)
|
|
2199
2203
|
return;
|
|
2200
2204
|
const t = {};
|
|
2201
2205
|
for (const [i, n] of Object.entries(e))
|
|
2202
|
-
|
|
2206
|
+
Oi(n) ? t[i] = n.value : t[i] = n;
|
|
2203
2207
|
return t;
|
|
2204
2208
|
}
|
|
2205
|
-
const
|
|
2206
|
-
class
|
|
2209
|
+
const Et = (e, t) => D([e.statics.id, t]);
|
|
2210
|
+
class Li {
|
|
2207
2211
|
entityMap;
|
|
2208
2212
|
queryInstances = /* @__PURE__ */ new Map();
|
|
2209
2213
|
mutationInstances = /* @__PURE__ */ new Map();
|
|
@@ -2220,7 +2224,7 @@ class qi {
|
|
|
2220
2224
|
networkUnsubscribe;
|
|
2221
2225
|
constructor(t = {}) {
|
|
2222
2226
|
const {
|
|
2223
|
-
store: i = new
|
|
2227
|
+
store: i = new Oe(new Se()),
|
|
2224
2228
|
log: n,
|
|
2225
2229
|
evictionMultiplier: s,
|
|
2226
2230
|
adapters: r,
|
|
@@ -2228,10 +2232,10 @@ class qi {
|
|
|
2228
2232
|
gcManager: a,
|
|
2229
2233
|
...c
|
|
2230
2234
|
} = t;
|
|
2231
|
-
this.isServer = typeof window > "u", this.store = i, this.context = { ...c, log: n ?? console, evictionMultiplier: s }, this.gcManager = t.gcManager ?? (this.isServer ? new
|
|
2235
|
+
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));
|
|
2232
2236
|
for (const u of t.adapters ?? [])
|
|
2233
2237
|
this.adapters.set(u.constructor, u), u.register(this);
|
|
2234
|
-
const f = this.networkManager.getOnlineSignal(), l =
|
|
2238
|
+
const f = this.networkManager.getOnlineSignal(), l = be(() => f.value);
|
|
2235
2239
|
this.networkUnsubscribe = l.addListener(
|
|
2236
2240
|
() => {
|
|
2237
2241
|
const u = f.value;
|
|
@@ -2310,7 +2314,7 @@ class qi {
|
|
|
2310
2314
|
activateQuery(t) {
|
|
2311
2315
|
const { def: i, queryKey: n, storageKey: s, config: r } = t;
|
|
2312
2316
|
this.store.activateQuery(i, s);
|
|
2313
|
-
const o = r?.gcTime ??
|
|
2317
|
+
const o = r?.gcTime ?? jt;
|
|
2314
2318
|
this.gcManager.cancel(n, o);
|
|
2315
2319
|
}
|
|
2316
2320
|
loadCachedQuery(t, i) {
|
|
@@ -2321,9 +2325,9 @@ class qi {
|
|
|
2321
2325
|
* that triggers fetches and prepopulates with cached data
|
|
2322
2326
|
*/
|
|
2323
2327
|
getQuery(t, i) {
|
|
2324
|
-
const n =
|
|
2328
|
+
const n = Et(t, i);
|
|
2325
2329
|
let s = this.queryInstances.get(n);
|
|
2326
|
-
return s === void 0 && (s = new
|
|
2330
|
+
return s === void 0 && (s = new yi(t, this, n, i), this.queryInstances.set(n, s)), s.relay;
|
|
2327
2331
|
}
|
|
2328
2332
|
/**
|
|
2329
2333
|
* Gets or creates a MutationResult for the given mutation definition.
|
|
@@ -2332,7 +2336,7 @@ class qi {
|
|
|
2332
2336
|
getMutation(t) {
|
|
2333
2337
|
const i = t.id;
|
|
2334
2338
|
let n = this.mutationInstances.get(i);
|
|
2335
|
-
return n === void 0 && (n = new
|
|
2339
|
+
return n === void 0 && (n = new pi(t, this), this.mutationInstances.set(i, n)), n.task;
|
|
2336
2340
|
}
|
|
2337
2341
|
/**
|
|
2338
2342
|
* Parse data: validates, formats, produces parsed entity data objects.
|
|
@@ -2340,8 +2344,8 @@ class qi {
|
|
|
2340
2344
|
*/
|
|
2341
2345
|
parseData(t, i, n) {
|
|
2342
2346
|
const s = this.context.log?.warn ?? (() => {
|
|
2343
|
-
}), r = new
|
|
2344
|
-
return r.reset(this, n, s), { data:
|
|
2347
|
+
}), r = new at();
|
|
2348
|
+
return r.reset(this, n, s), { data: te(t, i, r), ctx: r };
|
|
2345
2349
|
}
|
|
2346
2350
|
/**
|
|
2347
2351
|
* Apply entities from parseData() via a single depth-first walk: creates/
|
|
@@ -2349,7 +2353,7 @@ class qi {
|
|
|
2349
2353
|
* refs. Returns the reified data and root-level entity refs.
|
|
2350
2354
|
*/
|
|
2351
2355
|
applyRefs(t, i = !0, n = !1) {
|
|
2352
|
-
return
|
|
2356
|
+
return it(t.ctx, t.data, i, n);
|
|
2353
2357
|
}
|
|
2354
2358
|
/**
|
|
2355
2359
|
* Parse and apply data as a root entity. For non-entity results, injects
|
|
@@ -2357,8 +2361,8 @@ class qi {
|
|
|
2357
2361
|
* found in the store by the standard entity pipeline).
|
|
2358
2362
|
*/
|
|
2359
2363
|
parseAndApplyRootEntity(t, i, n, s, r = !1, o) {
|
|
2360
|
-
typeof n.idField == "symbol" && typeof t == "object" && t !== null && !("__entityRef" in t) && (t[
|
|
2361
|
-
const a = this.parseData(t, n, o), c =
|
|
2364
|
+
typeof n.idField == "symbol" && typeof t == "object" && t !== null && !("__entityRef" in t) && (t[Lt] = i);
|
|
2365
|
+
const a = this.parseData(t, n, o), c = it(a.ctx, a.data, s, r), f = x.get(c.data);
|
|
2362
2366
|
return this.entityMap.getEntity(f);
|
|
2363
2367
|
}
|
|
2364
2368
|
prepareEntity(t, i, n) {
|
|
@@ -2382,20 +2386,20 @@ class qi {
|
|
|
2382
2386
|
}
|
|
2383
2387
|
try {
|
|
2384
2388
|
const g = this.context.log?.warn ?? (() => {
|
|
2385
|
-
}),
|
|
2386
|
-
|
|
2389
|
+
}), m = new at();
|
|
2390
|
+
m.reset(
|
|
2387
2391
|
this,
|
|
2388
2392
|
void 0,
|
|
2389
2393
|
g,
|
|
2390
2394
|
/* isPartialEvent */
|
|
2391
2395
|
!0
|
|
2392
2396
|
);
|
|
2393
|
-
const
|
|
2394
|
-
|
|
2397
|
+
const N = ei(l, s, m);
|
|
2398
|
+
it(m, N, !0);
|
|
2395
2399
|
} catch (g) {
|
|
2396
2400
|
if (this.context.log?.warn?.("Failed to apply mutation event", g), u === void 0) {
|
|
2397
|
-
const
|
|
2398
|
-
|
|
2401
|
+
const m = this.entityMap.getEntity(c);
|
|
2402
|
+
m !== void 0 && m.evict();
|
|
2399
2403
|
}
|
|
2400
2404
|
return;
|
|
2401
2405
|
}
|
|
@@ -2413,16 +2417,16 @@ class qi {
|
|
|
2413
2417
|
// ======================================================
|
|
2414
2418
|
invalidateQueries(t) {
|
|
2415
2419
|
for (const i of t) {
|
|
2416
|
-
const n = Array.isArray(i), s = n ? i[0] : i, r = n ? i[1] : void 0, a =
|
|
2420
|
+
const n = Array.isArray(i), s = n ? i[0] : i, r = n ? i[1] : void 0, a = K.for(s).statics.id;
|
|
2417
2421
|
for (const [, c] of this.queryInstances)
|
|
2418
|
-
c.def.statics.id === a && (r === void 0 ||
|
|
2422
|
+
c.def.statics.id === a && (r === void 0 || Ri(c.resolvedParams, r)) && c.markStale();
|
|
2419
2423
|
}
|
|
2420
2424
|
}
|
|
2421
2425
|
// ======================================================
|
|
2422
2426
|
// In-Memory GC
|
|
2423
2427
|
// ======================================================
|
|
2424
2428
|
handleEviction = (t, i) => {
|
|
2425
|
-
if (i ===
|
|
2429
|
+
if (i === J.Query) {
|
|
2426
2430
|
const s = this.queryInstances.get(t);
|
|
2427
2431
|
if (s === void 0) return;
|
|
2428
2432
|
s.rootEntity?.evict(), this.queryInstances.delete(t);
|
|
@@ -2436,7 +2440,7 @@ class qi {
|
|
|
2436
2440
|
// ======================================================
|
|
2437
2441
|
getOrCreateMatcher(t) {
|
|
2438
2442
|
let i = this.constraintRegistry.get(t);
|
|
2439
|
-
return i === void 0 && (i = new
|
|
2443
|
+
return i === void 0 && (i = new Ei(), this.constraintRegistry.set(t, i)), i;
|
|
2440
2444
|
}
|
|
2441
2445
|
registerLiveCollection(t) {
|
|
2442
2446
|
for (const [i, n] of t._entityDefsByTypename)
|
|
@@ -2461,40 +2465,40 @@ class qi {
|
|
|
2461
2465
|
this.adapters.clear(), this.queryInstances.clear(), this.mutationInstances.clear(), this.constraintRegistry.clear(), this.typenameRegistry.clear(), this.mergedDefCache.clear();
|
|
2462
2466
|
}
|
|
2463
2467
|
}
|
|
2464
|
-
const Si =
|
|
2465
|
-
function
|
|
2468
|
+
const Si = Pt(void 0);
|
|
2469
|
+
function Ri(e, t) {
|
|
2466
2470
|
if (e === void 0) return !1;
|
|
2467
2471
|
for (const i in t)
|
|
2468
2472
|
if (e[i] !== t[i]) return !1;
|
|
2469
2473
|
return !0;
|
|
2470
2474
|
}
|
|
2471
2475
|
export {
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
L,
|
|
2476
|
+
B as A,
|
|
2477
|
+
yt as E,
|
|
2478
|
+
Ae as G,
|
|
2479
|
+
q as L,
|
|
2476
2480
|
d as M,
|
|
2477
2481
|
se as N,
|
|
2478
|
-
|
|
2479
|
-
|
|
2482
|
+
Lt as Q,
|
|
2483
|
+
Y as R,
|
|
2480
2484
|
_ as V,
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
+
dt as a,
|
|
2486
|
+
ki as b,
|
|
2487
|
+
L as c,
|
|
2488
|
+
De as d,
|
|
2485
2489
|
re as e,
|
|
2486
|
-
|
|
2487
|
-
|
|
2490
|
+
Fi as f,
|
|
2491
|
+
Li as g,
|
|
2488
2492
|
Si as h,
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2493
|
+
hi as i,
|
|
2494
|
+
Mi as j,
|
|
2495
|
+
Pi as k,
|
|
2496
|
+
Kt as l,
|
|
2497
|
+
Me as m,
|
|
2498
|
+
z as n,
|
|
2499
|
+
ji as o,
|
|
2500
|
+
Ti as q,
|
|
2501
|
+
Ht as r,
|
|
2502
|
+
Ze as t
|
|
2499
2503
|
};
|
|
2500
|
-
//# sourceMappingURL=QueryClient-
|
|
2504
|
+
//# sourceMappingURL=QueryClient-WtzRneAd.js.map
|