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 Z, relay as Lt, setScopeOwner as Ce, reactiveMethod as Se, signal as Ut, context as qt, getContext as Oe, reactiveSignal as st, task as Re, isSignal as xe, watcher as Ae } from "signalium";
|
|
2
|
+
import { registerCustomHash as Ne, hashValue as N, registerCustomSnapshot as De } from "signalium/utils";
|
|
3
|
+
import { d as Vt } from "./shared-DcuVH8Pf.js";
|
|
4
|
+
import { SyncQueryStore as Ie, MemoryPersistentStore as Fe } from "./stores/sync.js";
|
|
5
|
+
var K = /* @__PURE__ */ ((e) => (e.Always = "always", e.Online = "online", e.OfflineFirst = "offlineFirst", e))(K || {}), 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 F = /* @__PURE__ */ Symbol("array"), k = /* @__PURE__ */ Symbol("record"), Kt = /* @__PURE__ */ Symbol("QUERY_ID");
|
|
7
|
+
var ht = /* @__PURE__ */ ((e) => (e[e.Array = 0] = "Array", e[e.Value = 1] = "Value", e))(ht || {});
|
|
8
|
+
class Q {
|
|
9
9
|
type;
|
|
10
10
|
entityDefs;
|
|
11
11
|
constraintFieldRefs;
|
|
@@ -18,7 +18,7 @@ class B {
|
|
|
18
18
|
this.type = t, this.entityDefs = n, this.constraintFieldRefs = i, this.sort = r, this.valueType = s, this.onCreate = o, this.onUpdate = a, this.onDelete = c;
|
|
19
19
|
}
|
|
20
20
|
static array(t, n, i) {
|
|
21
|
-
return new
|
|
21
|
+
return new Q(
|
|
22
22
|
0,
|
|
23
23
|
t,
|
|
24
24
|
n,
|
|
@@ -30,7 +30,7 @@ class B {
|
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
static value(t, n, i, r, s, o) {
|
|
33
|
-
return new
|
|
33
|
+
return new Q(
|
|
34
34
|
1,
|
|
35
35
|
t,
|
|
36
36
|
n,
|
|
@@ -43,11 +43,11 @@ class B {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
const S = /* @__PURE__ */ new WeakMap();
|
|
46
|
-
function
|
|
46
|
+
function P(e) {
|
|
47
47
|
return S.get(e);
|
|
48
48
|
}
|
|
49
|
-
var
|
|
50
|
-
class
|
|
49
|
+
var tt = /* @__PURE__ */ ((e) => (e[e.Query = 0] = "Query", e[e.Entity = 1] = "Entity", e))(tt || {});
|
|
50
|
+
class ke {
|
|
51
51
|
constructor(t, n, i) {
|
|
52
52
|
this._onEvict = n, this._intervalId = setInterval(this._tick, t * 6e4 * i);
|
|
53
53
|
}
|
|
@@ -70,7 +70,7 @@ class Me {
|
|
|
70
70
|
clearInterval(this._intervalId);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
class
|
|
73
|
+
class Me {
|
|
74
74
|
_buckets = /* @__PURE__ */ new Map();
|
|
75
75
|
_nextTickEntries = /* @__PURE__ */ new Map();
|
|
76
76
|
_nextTickScheduled = !1;
|
|
@@ -88,7 +88,7 @@ class Te {
|
|
|
88
88
|
}
|
|
89
89
|
const { _buckets: r } = this;
|
|
90
90
|
let s = r.get(n);
|
|
91
|
-
s || (s = new
|
|
91
|
+
s || (s = new ke(n, this._onEvict, this._multiplier), r.set(n, s)), s.schedule(t, i);
|
|
92
92
|
}
|
|
93
93
|
cancel(t, n) {
|
|
94
94
|
if (n !== 1 / 0) {
|
|
@@ -113,7 +113,7 @@ class Te {
|
|
|
113
113
|
t.clear(), n.clear();
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
class
|
|
116
|
+
class Te {
|
|
117
117
|
schedule(t, n, i) {
|
|
118
118
|
}
|
|
119
119
|
cancel(t, n) {
|
|
@@ -121,37 +121,37 @@ class Pe {
|
|
|
121
121
|
destroy() {
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
const
|
|
125
|
-
function
|
|
124
|
+
const z = /* @__PURE__ */ Symbol("fieldRef"), I = /* @__PURE__ */ Symbol("fieldRefPath"), yt = /* @__PURE__ */ Symbol("DEFINITION_TARGET"), J = /* @__PURE__ */ Symbol("CANCEL_PROXY"), Pe = /\[([^\]]+)\]/g;
|
|
125
|
+
function Bt(e) {
|
|
126
126
|
const t = {
|
|
127
|
-
[
|
|
128
|
-
[
|
|
127
|
+
[z]: !0,
|
|
128
|
+
[I]: e
|
|
129
129
|
};
|
|
130
|
-
return new Proxy(t,
|
|
130
|
+
return new Proxy(t, je);
|
|
131
131
|
}
|
|
132
|
-
const
|
|
132
|
+
const je = {
|
|
133
133
|
get(e, t) {
|
|
134
|
-
if (t ===
|
|
135
|
-
if (t ===
|
|
134
|
+
if (t === z) return !0;
|
|
135
|
+
if (t === I) return e[I];
|
|
136
136
|
if (t === Symbol.toPrimitive || t === "toString" || t === "valueOf") {
|
|
137
|
-
const i = e[
|
|
137
|
+
const i = e[I];
|
|
138
138
|
return () => `[${i.join(".")}]`;
|
|
139
139
|
}
|
|
140
140
|
if (typeof t == "symbol") return;
|
|
141
|
-
const n = e[
|
|
142
|
-
return
|
|
141
|
+
const n = e[I];
|
|
142
|
+
return Bt([...n, t]);
|
|
143
143
|
},
|
|
144
144
|
has(e, t) {
|
|
145
|
-
return t ===
|
|
145
|
+
return t === z || t === I;
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
|
-
function Bt(e) {
|
|
149
|
-
return typeof e == "object" && e !== null && e[W] === !0;
|
|
150
|
-
}
|
|
151
148
|
function Qt(e) {
|
|
152
|
-
return e[
|
|
149
|
+
return typeof e == "object" && e !== null && e[z] === !0;
|
|
153
150
|
}
|
|
154
151
|
function Yt(e) {
|
|
152
|
+
return e[I];
|
|
153
|
+
}
|
|
154
|
+
function Gt(e) {
|
|
155
155
|
let t = !1;
|
|
156
156
|
return new Proxy(e, {
|
|
157
157
|
set(n, i, r) {
|
|
@@ -160,15 +160,15 @@ function Yt(e) {
|
|
|
160
160
|
get(n, i) {
|
|
161
161
|
if (t)
|
|
162
162
|
throw new Error("Definition proxy accessed after extraction. Avoid arrow functions that capture `this`.");
|
|
163
|
-
return i ===
|
|
163
|
+
return i === yt ? n : i === J ? () => {
|
|
164
164
|
t = !0;
|
|
165
|
-
} : typeof i == "symbol" ? n[i] :
|
|
165
|
+
} : typeof i == "symbol" ? n[i] : Bt([i]);
|
|
166
166
|
}
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
|
-
function
|
|
170
|
-
const t = e[
|
|
171
|
-
e[
|
|
169
|
+
function $e(e) {
|
|
170
|
+
const t = e[yt];
|
|
171
|
+
e[J]();
|
|
172
172
|
const n = {};
|
|
173
173
|
for (const s of Object.getOwnPropertyNames(t))
|
|
174
174
|
n[s] = t[s];
|
|
@@ -184,7 +184,7 @@ function Le(e) {
|
|
|
184
184
|
}
|
|
185
185
|
return { fields: n, methods: i };
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function pt(e, t) {
|
|
188
188
|
let n = t;
|
|
189
189
|
for (const i of e) {
|
|
190
190
|
if (n == null) return;
|
|
@@ -192,44 +192,44 @@ function lt(e, t) {
|
|
|
192
192
|
}
|
|
193
193
|
return n;
|
|
194
194
|
}
|
|
195
|
-
function
|
|
196
|
-
return e.replace(
|
|
197
|
-
const r = i.split("."), s =
|
|
195
|
+
function Le(e, t) {
|
|
196
|
+
return e.replace(Pe, (n, i) => {
|
|
197
|
+
const r = i.split("."), s = pt(r, t);
|
|
198
198
|
return s != null ? encodeURIComponent(String(s)) : "";
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
|
-
function
|
|
202
|
-
if (
|
|
203
|
-
return
|
|
201
|
+
function X(e, t) {
|
|
202
|
+
if (Qt(e))
|
|
203
|
+
return pt(Yt(e), t);
|
|
204
204
|
if (typeof e == "string")
|
|
205
|
-
return
|
|
205
|
+
return Le(e, t);
|
|
206
206
|
if (Array.isArray(e))
|
|
207
|
-
return e.map((n) =>
|
|
207
|
+
return e.map((n) => X(n, t));
|
|
208
208
|
if (typeof e == "object" && e !== null && Object.getPrototypeOf(e) === Object.prototype) {
|
|
209
209
|
const n = {};
|
|
210
210
|
for (const i of Object.keys(e))
|
|
211
|
-
n[i] =
|
|
211
|
+
n[i] = X(e[i], t);
|
|
212
212
|
return n;
|
|
213
213
|
}
|
|
214
214
|
return e;
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function ot(e, t, n) {
|
|
217
217
|
const i = e.fields, r = e.methods, s = { params: t }, o = {};
|
|
218
218
|
for (const [a, c] of Object.entries(i))
|
|
219
|
-
o[a] =
|
|
220
|
-
o.params = t, o.context = n;
|
|
219
|
+
o[a] = X(c, s);
|
|
220
|
+
o.params = t, o.context = n, o.responseNotifier = Z();
|
|
221
221
|
for (const [a, c] of Object.entries(r))
|
|
222
222
|
o[a] = c.bind(o);
|
|
223
223
|
return o;
|
|
224
224
|
}
|
|
225
|
-
class
|
|
225
|
+
class gt {
|
|
226
226
|
static cache;
|
|
227
227
|
constructor() {
|
|
228
|
-
return
|
|
228
|
+
return Gt(this);
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
const
|
|
232
|
-
let
|
|
231
|
+
const Ht = Object.entries, at = Object.keys;
|
|
232
|
+
let Wt = () => {
|
|
233
233
|
};
|
|
234
234
|
{
|
|
235
235
|
const t = (i, r) => {
|
|
@@ -249,37 +249,37 @@ let Ht = () => {
|
|
|
249
249
|
if (typeof i == "string") return i === r;
|
|
250
250
|
if (i instanceof Set && r instanceof Set)
|
|
251
251
|
return t(i, r);
|
|
252
|
-
if (i instanceof
|
|
252
|
+
if (i instanceof v && r instanceof v) {
|
|
253
253
|
const s = i.mask, o = r.mask;
|
|
254
254
|
if ((s & 65535) !== (o & 65535)) return !1;
|
|
255
255
|
const a = s >> 16, c = o >> 16;
|
|
256
256
|
if (a !== 0 && c !== 0 && a !== c) return !1;
|
|
257
257
|
if (i.shape === r.shape) return !0;
|
|
258
258
|
if (i.shape !== void 0 && r.shape !== void 0 && typeof i.shape == "object" && typeof r.shape == "object") {
|
|
259
|
-
const f = i.shape,
|
|
259
|
+
const f = i.shape, l = r.shape;
|
|
260
260
|
for (const u of Object.keys(f))
|
|
261
|
-
if (u in
|
|
262
|
-
for (const u of Object.keys(
|
|
263
|
-
if (u in f && !n(f[u],
|
|
261
|
+
if (u in l && !n(f[u], l[u])) return !1;
|
|
262
|
+
for (const u of Object.keys(l))
|
|
263
|
+
if (u in f && !n(f[u], l[u])) return !1;
|
|
264
264
|
}
|
|
265
265
|
return !0;
|
|
266
266
|
}
|
|
267
267
|
return !1;
|
|
268
268
|
};
|
|
269
|
-
|
|
269
|
+
Wt = (i, r, s, o) => {
|
|
270
270
|
if (!n(s, o))
|
|
271
271
|
throw new Error(
|
|
272
272
|
`[fetchium] Entity typename '${i}' has incompatible type for field '${r}' across different entity definitions`
|
|
273
273
|
);
|
|
274
274
|
};
|
|
275
275
|
}
|
|
276
|
-
function
|
|
277
|
-
return typeof e == "number" ? e | d.UNDEFINED : e instanceof
|
|
276
|
+
function xt(e) {
|
|
277
|
+
return typeof e == "number" ? e | d.UNDEFINED : e instanceof v ? (e.mask & d.UNDEFINED) !== 0 ? e : v.cloneWith(e, d.UNDEFINED) : e;
|
|
278
278
|
}
|
|
279
|
-
function
|
|
280
|
-
return e instanceof
|
|
279
|
+
function At(e) {
|
|
280
|
+
return e instanceof v && (e.mask & d.OBJECT) !== 0 && (e.mask & (d.ENTITY | d.ARRAY | d.UNION | d.RECORD | d.LIVE)) === 0;
|
|
281
281
|
}
|
|
282
|
-
function
|
|
282
|
+
function zt(e, t, n) {
|
|
283
283
|
const i = /* @__PURE__ */ new Set();
|
|
284
284
|
for (const s of e)
|
|
285
285
|
if (s !== void 0)
|
|
@@ -290,19 +290,19 @@ function Wt(e, t, n) {
|
|
|
290
290
|
let o = 0, a;
|
|
291
291
|
const c = [];
|
|
292
292
|
let f = !0;
|
|
293
|
-
for (const
|
|
294
|
-
const u =
|
|
295
|
-
u !== void 0 ? (o++, a === void 0 && (a = u), a !== void 0 && u !== a && !
|
|
293
|
+
for (const l of e) {
|
|
294
|
+
const u = l?.[s];
|
|
295
|
+
u !== void 0 ? (o++, a === void 0 && (a = u), a !== void 0 && u !== a && !At(u) && Wt(n, s, a, u), At(u) ? c.push(u.shape) : (f = !1, c.push(void 0))) : (f = !1, c.push(void 0));
|
|
296
296
|
}
|
|
297
297
|
if (f && o > 0) {
|
|
298
|
-
const
|
|
299
|
-
r[s] = o < t ?
|
|
298
|
+
const l = zt(c, t, n), u = new v(d.OBJECT, l);
|
|
299
|
+
r[s] = o < t ? xt(u) : u;
|
|
300
300
|
} else
|
|
301
|
-
r[s] = o < t ?
|
|
301
|
+
r[s] = o < t ? xt(a) : a;
|
|
302
302
|
}
|
|
303
303
|
return r;
|
|
304
304
|
}
|
|
305
|
-
class
|
|
305
|
+
class v {
|
|
306
306
|
mask;
|
|
307
307
|
shape;
|
|
308
308
|
typenameField = void 0;
|
|
@@ -336,7 +336,7 @@ class m {
|
|
|
336
336
|
}
|
|
337
337
|
static merge(t) {
|
|
338
338
|
if (t.length === 1) return t[0];
|
|
339
|
-
const n = t.length, i = t.map((f) => f.shape), r = t[0].typenameValue ?? "(unknown)", s =
|
|
339
|
+
const n = t.length, i = t.map((f) => f.shape), r = t[0].typenameValue ?? "(unknown)", s = zt(i, n, r);
|
|
340
340
|
let o, a, c;
|
|
341
341
|
for (const f of t) {
|
|
342
342
|
if (o === void 0 && f.idField !== void 0)
|
|
@@ -347,7 +347,7 @@ class m {
|
|
|
347
347
|
);
|
|
348
348
|
a === void 0 && (a = f.typenameField), c === void 0 && (c = f.typenameValue);
|
|
349
349
|
}
|
|
350
|
-
return new
|
|
350
|
+
return new v(
|
|
351
351
|
d.ENTITY | d.OBJECT,
|
|
352
352
|
s,
|
|
353
353
|
void 0,
|
|
@@ -357,7 +357,7 @@ class m {
|
|
|
357
357
|
);
|
|
358
358
|
}
|
|
359
359
|
static cloneWith(t, n) {
|
|
360
|
-
const i = new
|
|
360
|
+
const i = new v(
|
|
361
361
|
n | t.mask,
|
|
362
362
|
t.shape,
|
|
363
363
|
t.values,
|
|
@@ -368,7 +368,7 @@ class m {
|
|
|
368
368
|
return i._methods = t._methods, i._entityConfig = t._entityConfig, i._entityClass = t._entityClass, i._entityCache = t._entityCache, i._liveConfig = t._liveConfig, i;
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
|
-
class
|
|
371
|
+
class L extends Set {
|
|
372
372
|
lowercaseMap;
|
|
373
373
|
// lowercase -> canonical (strings only)
|
|
374
374
|
constructor(t) {
|
|
@@ -403,28 +403,28 @@ class $ extends Set {
|
|
|
403
403
|
return t;
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
|
-
const
|
|
407
|
-
|
|
408
|
-
let t =
|
|
406
|
+
const Ue = 1128875347;
|
|
407
|
+
Ne(L, (e) => {
|
|
408
|
+
let t = Ue;
|
|
409
409
|
for (const n of e)
|
|
410
410
|
t += N(n);
|
|
411
411
|
return t >>> 0;
|
|
412
412
|
});
|
|
413
|
-
function
|
|
414
|
-
return new
|
|
413
|
+
function vt(e, t) {
|
|
414
|
+
return new v(e, t);
|
|
415
|
+
}
|
|
416
|
+
function qe(e) {
|
|
417
|
+
return vt(d.ARRAY, e);
|
|
415
418
|
}
|
|
416
419
|
function Ve(e) {
|
|
417
|
-
return
|
|
420
|
+
return vt(d.RECORD | d.OBJECT, e);
|
|
418
421
|
}
|
|
419
422
|
function Ke(e) {
|
|
420
|
-
return
|
|
421
|
-
}
|
|
422
|
-
function Be(e) {
|
|
423
|
-
return pt(d.PARSE_RESULT, e);
|
|
423
|
+
return vt(d.PARSE_RESULT, e);
|
|
424
424
|
}
|
|
425
|
-
function
|
|
425
|
+
function Jt(e, t) {
|
|
426
426
|
let n = e, i, r, s;
|
|
427
|
-
for (const [o, a] of
|
|
427
|
+
for (const [o, a] of Ht(t))
|
|
428
428
|
switch (typeof a) {
|
|
429
429
|
case "number":
|
|
430
430
|
if ((a & d.ID) !== 0) {
|
|
@@ -439,17 +439,17 @@ function zt(e, t) {
|
|
|
439
439
|
r = o, s = a;
|
|
440
440
|
break;
|
|
441
441
|
case "object":
|
|
442
|
-
if (a instanceof
|
|
442
|
+
if (a instanceof L || a instanceof Set)
|
|
443
443
|
break;
|
|
444
444
|
a.mask & d.LIVE && (n |= d.LIVE);
|
|
445
445
|
break;
|
|
446
446
|
}
|
|
447
|
-
return new
|
|
447
|
+
return new v(n, t, void 0, r, s, i);
|
|
448
448
|
}
|
|
449
|
-
function
|
|
450
|
-
return
|
|
449
|
+
function Be(e) {
|
|
450
|
+
return Jt(d.OBJECT, e);
|
|
451
451
|
}
|
|
452
|
-
function
|
|
452
|
+
function Nt(e, t, n) {
|
|
453
453
|
const i = e.mask;
|
|
454
454
|
if ((i & d.UNION) !== 0) {
|
|
455
455
|
const r = e;
|
|
@@ -462,7 +462,7 @@ function At(e, t, n) {
|
|
|
462
462
|
}
|
|
463
463
|
const s = r.shape;
|
|
464
464
|
if (s !== void 0)
|
|
465
|
-
for (const o of [...
|
|
465
|
+
for (const o of [...at(s), F, k]) {
|
|
466
466
|
const a = s[o];
|
|
467
467
|
if (t[o] !== void 0 && t[o] !== a)
|
|
468
468
|
throw new Error(
|
|
@@ -471,9 +471,9 @@ function At(e, t, n) {
|
|
|
471
471
|
t[o] = a;
|
|
472
472
|
}
|
|
473
473
|
} else if ((i & d.ARRAY) !== 0) {
|
|
474
|
-
if (t[
|
|
474
|
+
if (t[F] !== void 0)
|
|
475
475
|
throw new Error("Array shape already defined");
|
|
476
|
-
t[
|
|
476
|
+
t[F] = e.shape;
|
|
477
477
|
} else if ((i & d.RECORD) !== 0) {
|
|
478
478
|
if (t[k] !== void 0)
|
|
479
479
|
throw new Error("Record shape already defined");
|
|
@@ -490,97 +490,97 @@ function At(e, t, n) {
|
|
|
490
490
|
}
|
|
491
491
|
return n;
|
|
492
492
|
}
|
|
493
|
-
function
|
|
493
|
+
function mt(...e) {
|
|
494
494
|
const t = e;
|
|
495
495
|
let n = 0, i = 0, r, s, o, a, c = 0;
|
|
496
|
-
for (const
|
|
497
|
-
if (typeof
|
|
498
|
-
n |=
|
|
496
|
+
for (const l of t) {
|
|
497
|
+
if (typeof l == "number") {
|
|
498
|
+
n |= l;
|
|
499
499
|
continue;
|
|
500
500
|
}
|
|
501
|
-
if (
|
|
501
|
+
if (l instanceof Set) {
|
|
502
502
|
if (s === void 0)
|
|
503
|
-
s = new Set(
|
|
503
|
+
s = new Set(l);
|
|
504
504
|
else
|
|
505
|
-
for (const u of
|
|
505
|
+
for (const u of l)
|
|
506
506
|
s.add(u);
|
|
507
507
|
continue;
|
|
508
508
|
}
|
|
509
|
-
if (i++, c |=
|
|
510
|
-
r =
|
|
509
|
+
if (i++, c |= l.mask, i === 1) {
|
|
510
|
+
r = l;
|
|
511
511
|
continue;
|
|
512
512
|
}
|
|
513
|
-
i === 2 && (o = /* @__PURE__ */ Object.create(null), a =
|
|
513
|
+
i === 2 && (o = /* @__PURE__ */ Object.create(null), a = Nt(r, o, a)), a = Nt(l, o, a);
|
|
514
514
|
}
|
|
515
515
|
if (i === 0)
|
|
516
|
-
return s === void 0 ? n : n === 0 ? s : new
|
|
516
|
+
return s === void 0 ? n : n === 0 ? s : new v(n | d.UNION, void 0, s);
|
|
517
517
|
if (i === 1)
|
|
518
|
-
return
|
|
518
|
+
return v.cloneWith(r, n);
|
|
519
519
|
const f = n | c | d.UNION;
|
|
520
|
-
return new
|
|
520
|
+
return new v(f, o, s, a);
|
|
521
521
|
}
|
|
522
|
-
function
|
|
522
|
+
function _t(e, t, n) {
|
|
523
523
|
const i = e;
|
|
524
524
|
if (typeof i == "number")
|
|
525
525
|
return i | t;
|
|
526
526
|
if (i instanceof Set)
|
|
527
|
-
return
|
|
527
|
+
return mt(e, t);
|
|
528
528
|
let r = n.get(i);
|
|
529
|
-
return r === void 0 && (r =
|
|
529
|
+
return r === void 0 && (r = v.cloneWith(i, t), n.set(i, r)), r;
|
|
530
|
+
}
|
|
531
|
+
const Qe = /* @__PURE__ */ new WeakMap(), Ye = /* @__PURE__ */ new WeakMap(), Ge = /* @__PURE__ */ new WeakMap();
|
|
532
|
+
function He(e) {
|
|
533
|
+
return _t(e, d.UNDEFINED | d.NULL, Ge);
|
|
530
534
|
}
|
|
531
|
-
const Ye = /* @__PURE__ */ new WeakMap(), Ge = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakMap();
|
|
532
535
|
function We(e) {
|
|
533
|
-
return
|
|
536
|
+
return _t(e, d.UNDEFINED, Qe);
|
|
534
537
|
}
|
|
535
538
|
function ze(e) {
|
|
536
|
-
return
|
|
539
|
+
return _t(e, d.NULL, Ye);
|
|
537
540
|
}
|
|
538
541
|
function Je(e) {
|
|
539
|
-
return mt(e, d.NULL, Ge);
|
|
540
|
-
}
|
|
541
|
-
function Xe(e) {
|
|
542
542
|
return e;
|
|
543
543
|
}
|
|
544
|
-
function
|
|
544
|
+
function Xe(e) {
|
|
545
545
|
return /* @__PURE__ */ new Set([e]);
|
|
546
546
|
}
|
|
547
|
-
const
|
|
548
|
-
|
|
549
|
-
const
|
|
550
|
-
let
|
|
551
|
-
const
|
|
552
|
-
class
|
|
547
|
+
const Xt = ((...e) => new Set(e));
|
|
548
|
+
Xt.caseInsensitive = (...e) => new L(e);
|
|
549
|
+
const wt = 16;
|
|
550
|
+
let Ze = 0;
|
|
551
|
+
const ct = [], Zt = [], te = /* @__PURE__ */ new Map(), ee = /* @__PURE__ */ new Map(), et = /* @__PURE__ */ new WeakSet();
|
|
552
|
+
class Y {
|
|
553
553
|
_raw;
|
|
554
554
|
_formatted;
|
|
555
555
|
_parsed;
|
|
556
556
|
_formatId;
|
|
557
557
|
constructor(t, n, i) {
|
|
558
|
-
this._raw = t, this._formatId = n, i ? (this._formatted =
|
|
558
|
+
this._raw = t, this._formatId = n, i ? (this._formatted = ct[n](t), this._parsed = !0) : this._parsed = !1, et.add(this);
|
|
559
559
|
}
|
|
560
560
|
getValue() {
|
|
561
|
-
return this._parsed || (this._formatted =
|
|
561
|
+
return this._parsed || (this._formatted = ct[this._formatId](this._raw), this._parsed = !0), this._formatted;
|
|
562
562
|
}
|
|
563
563
|
toJSON() {
|
|
564
|
-
return this._parsed ?
|
|
564
|
+
return this._parsed ? Zt[this._formatId](this._formatted) : this._raw;
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
|
-
function
|
|
568
|
-
const t =
|
|
567
|
+
function tn(e) {
|
|
568
|
+
const t = te.get(e);
|
|
569
569
|
if (t === void 0)
|
|
570
570
|
throw new Error(`Format ${e} not registered`);
|
|
571
571
|
return t;
|
|
572
572
|
}
|
|
573
|
-
function
|
|
574
|
-
const t = e >>
|
|
575
|
-
return
|
|
573
|
+
function Dt(e) {
|
|
574
|
+
const t = e >> wt;
|
|
575
|
+
return ee.get(t);
|
|
576
576
|
}
|
|
577
|
-
function
|
|
578
|
-
const s =
|
|
579
|
-
|
|
580
|
-
const o = r?.eager ?? !0, c = s <<
|
|
581
|
-
|
|
577
|
+
function ne(e, t, n, i, r) {
|
|
578
|
+
const s = Ze++;
|
|
579
|
+
ct[s] = n, Zt[s] = i, ee.set(s, e);
|
|
580
|
+
const o = r?.eager ?? !0, c = s << wt | t | d.HAS_FORMAT | (o ? d.IS_EAGER_FORMAT : 0);
|
|
581
|
+
te.set(e, c);
|
|
582
582
|
}
|
|
583
|
-
|
|
583
|
+
ne(
|
|
584
584
|
"date",
|
|
585
585
|
d.STRING,
|
|
586
586
|
(e) => {
|
|
@@ -597,7 +597,7 @@ ee(
|
|
|
597
597
|
return `${t}-${n}-${i}`;
|
|
598
598
|
}
|
|
599
599
|
);
|
|
600
|
-
|
|
600
|
+
ne(
|
|
601
601
|
"date-time",
|
|
602
602
|
d.STRING,
|
|
603
603
|
(e) => {
|
|
@@ -608,52 +608,52 @@ ee(
|
|
|
608
608
|
},
|
|
609
609
|
(e) => e.toISOString()
|
|
610
610
|
);
|
|
611
|
-
const
|
|
612
|
-
function
|
|
613
|
-
let t =
|
|
611
|
+
const It = /* @__PURE__ */ new WeakMap();
|
|
612
|
+
function $(e) {
|
|
613
|
+
let t = It.get(e);
|
|
614
614
|
if (t === void 0) {
|
|
615
|
-
const n = new e(), i = n[
|
|
616
|
-
n[
|
|
615
|
+
const n = new e(), i = n[yt] ?? n;
|
|
616
|
+
n[J] && n[J]();
|
|
617
617
|
const r = {};
|
|
618
|
-
for (const [f,
|
|
619
|
-
if (!(typeof
|
|
618
|
+
for (const [f, l] of Ht(i)) {
|
|
619
|
+
if (!(typeof l == "number" || typeof l == "string" || l instanceof Set || l instanceof v || l instanceof L))
|
|
620
620
|
throw new Error(
|
|
621
|
-
`[fetchium] Entity '${e.name}' field '${f}' has an invalid type definition. All entity fields must be type definitions (e.g. t.string, t.number, t.entity(...), etc). Got: ${typeof
|
|
621
|
+
`[fetchium] Entity '${e.name}' field '${f}' has an invalid type definition. All entity fields must be type definitions (e.g. t.string, t.number, t.entity(...), etc). Got: ${typeof l == "object" ? l?.constructor?.name ?? typeof l : typeof l}`
|
|
622
622
|
);
|
|
623
|
-
r[f] =
|
|
623
|
+
r[f] = l;
|
|
624
624
|
}
|
|
625
625
|
const s = Object.getPrototypeOf(e.prototype);
|
|
626
626
|
if (s != null) {
|
|
627
627
|
const f = s.constructor;
|
|
628
|
-
if (f !==
|
|
629
|
-
const u =
|
|
630
|
-
for (const
|
|
631
|
-
if (
|
|
632
|
-
throw new Error(`Cannot extend: field '${
|
|
628
|
+
if (f !== gt && typeof f == "function") {
|
|
629
|
+
const u = $(f).shape;
|
|
630
|
+
for (const h of at(u))
|
|
631
|
+
if (h in r && r[h] !== u[h])
|
|
632
|
+
throw new Error(`Cannot extend: field '${h}' already exists in type definition`);
|
|
633
633
|
}
|
|
634
634
|
}
|
|
635
635
|
const o = {}, a = e.prototype;
|
|
636
636
|
for (const f of Object.getOwnPropertyNames(a))
|
|
637
637
|
f !== "constructor" && typeof a[f] == "function" && (o[f] = a[f]);
|
|
638
|
-
t =
|
|
638
|
+
t = Jt(d.ENTITY | d.OBJECT, r), t._entityClass = e, at(o).length > 0 && (t._methods = o), typeof o.__subscribe == "function" && (t._entityConfig = { hasSubscribe: !0 });
|
|
639
639
|
const c = e;
|
|
640
|
-
c.cache && (t._entityCache = c.cache),
|
|
640
|
+
c.cache && (t._entityCache = c.cache), It.set(e, t);
|
|
641
641
|
}
|
|
642
642
|
return t;
|
|
643
643
|
}
|
|
644
|
-
function
|
|
645
|
-
return
|
|
644
|
+
function en(e) {
|
|
645
|
+
return $(e);
|
|
646
646
|
}
|
|
647
|
-
function
|
|
647
|
+
function ie(e, t) {
|
|
648
648
|
if (t == null) return;
|
|
649
649
|
const n = /* @__PURE__ */ new Map();
|
|
650
650
|
if (Array.isArray(t))
|
|
651
651
|
for (const i of t) {
|
|
652
|
-
const [r, s] = i, a =
|
|
652
|
+
const [r, s] = i, a = $(r).typenameValue;
|
|
653
653
|
if (a === void 0) continue;
|
|
654
654
|
const c = [];
|
|
655
|
-
for (const [f,
|
|
656
|
-
c.push([f,
|
|
655
|
+
for (const [f, l] of Object.entries(s))
|
|
656
|
+
c.push([f, l]);
|
|
657
657
|
c.length > 0 && n.set(a, c);
|
|
658
658
|
}
|
|
659
659
|
else {
|
|
@@ -667,53 +667,53 @@ function ne(e, t) {
|
|
|
667
667
|
}
|
|
668
668
|
return n.size > 0 ? n : void 0;
|
|
669
669
|
}
|
|
670
|
-
function
|
|
671
|
-
return Array.isArray(e) ? e.map((t) =>
|
|
670
|
+
function re(e) {
|
|
671
|
+
return Array.isArray(e) ? e.map((t) => $(t)) : [$(e)];
|
|
672
672
|
}
|
|
673
|
-
function
|
|
674
|
-
const n =
|
|
675
|
-
return s._liveConfig =
|
|
673
|
+
function nn(e, t) {
|
|
674
|
+
const n = re(e), i = n.length === 1 ? n[0] : mt(...n.map((o) => o)), r = d.ARRAY | d.LIVE, s = new v(r, i);
|
|
675
|
+
return s._liveConfig = Q.array(
|
|
676
676
|
n,
|
|
677
|
-
|
|
677
|
+
ie(n, t?.constraints),
|
|
678
678
|
t?.sort
|
|
679
679
|
), s;
|
|
680
680
|
}
|
|
681
|
-
function
|
|
682
|
-
const i =
|
|
683
|
-
return o._liveConfig =
|
|
681
|
+
function rn(e, t, n) {
|
|
682
|
+
const i = re(t), r = e, s = d.LIVE, o = new v(s, void 0);
|
|
683
|
+
return o._liveConfig = Q.value(
|
|
684
684
|
i,
|
|
685
|
-
|
|
685
|
+
ie(i, n?.constraints),
|
|
686
686
|
r,
|
|
687
687
|
n.onCreate,
|
|
688
688
|
n.onUpdate,
|
|
689
689
|
n.onDelete
|
|
690
690
|
), o;
|
|
691
691
|
}
|
|
692
|
-
const
|
|
693
|
-
format:
|
|
694
|
-
typename:
|
|
695
|
-
const:
|
|
696
|
-
enum:
|
|
692
|
+
const sn = {
|
|
693
|
+
format: tn,
|
|
694
|
+
typename: Je,
|
|
695
|
+
const: Xe,
|
|
696
|
+
enum: Xt,
|
|
697
697
|
id: d.ID | d.STRING | d.NUMBER,
|
|
698
698
|
string: d.STRING,
|
|
699
699
|
number: d.NUMBER,
|
|
700
700
|
boolean: d.BOOLEAN,
|
|
701
701
|
null: d.NULL,
|
|
702
702
|
undefined: d.UNDEFINED,
|
|
703
|
-
array:
|
|
704
|
-
object:
|
|
705
|
-
record:
|
|
706
|
-
union:
|
|
707
|
-
nullish:
|
|
708
|
-
optional:
|
|
709
|
-
nullable:
|
|
710
|
-
result:
|
|
711
|
-
entity:
|
|
712
|
-
liveArray:
|
|
713
|
-
liveValue:
|
|
703
|
+
array: qe,
|
|
704
|
+
object: Be,
|
|
705
|
+
record: Ve,
|
|
706
|
+
union: mt,
|
|
707
|
+
nullish: He,
|
|
708
|
+
optional: We,
|
|
709
|
+
nullable: ze,
|
|
710
|
+
result: Ke,
|
|
711
|
+
entity: en,
|
|
712
|
+
liveArray: nn,
|
|
713
|
+
liveValue: rn
|
|
714
714
|
};
|
|
715
|
-
function
|
|
716
|
-
if (e instanceof
|
|
715
|
+
function B(e) {
|
|
716
|
+
if (e instanceof L)
|
|
717
717
|
return Array.from(e).map((i) => typeof i == "string" ? `"${i}"` : String(i)).join(" | ");
|
|
718
718
|
if (e instanceof Set)
|
|
719
719
|
return Array.from(e).map((i) => typeof i == "string" ? `"${i}"` : String(i)).join(" | ");
|
|
@@ -723,7 +723,7 @@ function K(e) {
|
|
|
723
723
|
return String(e);
|
|
724
724
|
if (typeof e == "number") {
|
|
725
725
|
if ((e & d.HAS_FORMAT) !== 0) {
|
|
726
|
-
const r =
|
|
726
|
+
const r = Dt(e);
|
|
727
727
|
if (r)
|
|
728
728
|
return `"${r}"`;
|
|
729
729
|
}
|
|
@@ -739,12 +739,12 @@ function K(e) {
|
|
|
739
739
|
i.push(o);
|
|
740
740
|
}
|
|
741
741
|
if (n.shape !== void 0) {
|
|
742
|
-
n.shape[
|
|
742
|
+
n.shape[F] !== void 0 && i.push(`Array<${B(n.shape[F])}>`), n.shape[k] !== void 0 && i.push(`Record<string, ${B(n.shape[k])}>`);
|
|
743
743
|
for (const [s, o] of Object.entries(n.shape))
|
|
744
|
-
s !==
|
|
744
|
+
s !== F && s !== k && i.push(s);
|
|
745
745
|
}
|
|
746
746
|
if (t = n.mask, (t & d.HAS_FORMAT) !== 0) {
|
|
747
|
-
const s =
|
|
747
|
+
const s = Dt(t);
|
|
748
748
|
s && i.push(`"${s}"`);
|
|
749
749
|
}
|
|
750
750
|
return t & d.UNDEFINED && i.push("undefined"), t & d.NULL && i.push("null"), t & d.NUMBER && i.push("number"), t & d.STRING && i.push("string"), t & d.BOOLEAN && i.push("boolean"), i.length === 0 ? "union" : i.join(" | ");
|
|
@@ -753,11 +753,11 @@ function K(e) {
|
|
|
753
753
|
return `Entity<${e.typenameValue}>`;
|
|
754
754
|
if (t & d.ARRAY) {
|
|
755
755
|
const n = e.shape;
|
|
756
|
-
return `Array<${
|
|
756
|
+
return `Array<${B(n)}>`;
|
|
757
757
|
}
|
|
758
758
|
if (t & d.RECORD) {
|
|
759
759
|
const n = e.shape;
|
|
760
|
-
return `Record<string, ${
|
|
760
|
+
return `Record<string, ${B(n)}>`;
|
|
761
761
|
}
|
|
762
762
|
if (t & d.OBJECT) {
|
|
763
763
|
const n = e.typenameValue;
|
|
@@ -765,13 +765,13 @@ function K(e) {
|
|
|
765
765
|
}
|
|
766
766
|
return "unknown";
|
|
767
767
|
}
|
|
768
|
-
function
|
|
768
|
+
function V(e, t, n) {
|
|
769
769
|
return new TypeError(
|
|
770
|
-
`Validation error at ${e}: expected ${
|
|
770
|
+
`Validation error at ${e}: expected ${B(t)}, got ${typeof n == "object" ? n === null ? "null" : Array.isArray(n) ? "array" : "object" : typeof n}`
|
|
771
771
|
);
|
|
772
772
|
}
|
|
773
|
-
const
|
|
774
|
-
function
|
|
773
|
+
const se = Array.isArray;
|
|
774
|
+
function Ft(e) {
|
|
775
775
|
if (e === null) return d.NULL;
|
|
776
776
|
switch (typeof e) {
|
|
777
777
|
case "number":
|
|
@@ -783,44 +783,44 @@ function Dt(e) {
|
|
|
783
783
|
case "undefined":
|
|
784
784
|
return d.UNDEFINED;
|
|
785
785
|
case "object":
|
|
786
|
-
return
|
|
786
|
+
return se(e) ? d.ARRAY : d.OBJECT;
|
|
787
787
|
default:
|
|
788
788
|
throw new Error(`Invalid type: ${typeof e}`);
|
|
789
789
|
}
|
|
790
790
|
}
|
|
791
|
-
function
|
|
792
|
-
return
|
|
791
|
+
function $n(e) {
|
|
792
|
+
return j(e);
|
|
793
793
|
}
|
|
794
|
-
function
|
|
794
|
+
function j(e) {
|
|
795
795
|
if (e === null || typeof e != "object")
|
|
796
796
|
return e;
|
|
797
|
-
if (
|
|
798
|
-
return e.map((n) =>
|
|
797
|
+
if (se(e))
|
|
798
|
+
return e.map((n) => j(n));
|
|
799
799
|
if (e instanceof Date)
|
|
800
800
|
return new Date(e.getTime());
|
|
801
801
|
if (e instanceof Map) {
|
|
802
802
|
const n = /* @__PURE__ */ new Map();
|
|
803
803
|
for (const [i, r] of e)
|
|
804
|
-
n.set(
|
|
804
|
+
n.set(j(i), j(r));
|
|
805
805
|
return n;
|
|
806
806
|
}
|
|
807
807
|
if (e instanceof Set) {
|
|
808
808
|
const n = /* @__PURE__ */ new Set();
|
|
809
809
|
for (const i of e)
|
|
810
|
-
n.add(
|
|
810
|
+
n.add(j(i));
|
|
811
811
|
return n;
|
|
812
812
|
}
|
|
813
813
|
const t = {};
|
|
814
814
|
for (const n of Object.keys(e))
|
|
815
|
-
t[n] =
|
|
815
|
+
t[n] = j(e[n]);
|
|
816
816
|
return t;
|
|
817
817
|
}
|
|
818
|
-
const
|
|
818
|
+
const Et = Object.entries, on = () => {
|
|
819
819
|
};
|
|
820
|
-
class
|
|
820
|
+
class ft {
|
|
821
821
|
queryClient = void 0;
|
|
822
822
|
preloadedEntities = void 0;
|
|
823
|
-
warn =
|
|
823
|
+
warn = on;
|
|
824
824
|
/** When true, missing optional fields on existing entities are set to
|
|
825
825
|
* undefined. False for mutation events (truly partial payloads). */
|
|
826
826
|
isPartialEvent = !1;
|
|
@@ -830,17 +830,17 @@ class ot {
|
|
|
830
830
|
this.queryClient = t, this.preloadedEntities = n, this.warn = i, this.isPartialEvent = r, t !== void 0 && (this.seen === void 0 ? (this.seen = /* @__PURE__ */ new Map(), this.seenByKey = /* @__PURE__ */ new Map()) : (this.seen.clear(), this.seenByKey.clear()));
|
|
831
831
|
}
|
|
832
832
|
}
|
|
833
|
-
function
|
|
834
|
-
return
|
|
833
|
+
function oe(e, t, n) {
|
|
834
|
+
return M(e, t, n, "");
|
|
835
835
|
}
|
|
836
|
-
function
|
|
837
|
-
return
|
|
836
|
+
function an(e, t, n) {
|
|
837
|
+
return bt(e, t, n);
|
|
838
838
|
}
|
|
839
|
-
function
|
|
840
|
-
const r = e >>
|
|
839
|
+
function kt(e, t, n, i) {
|
|
840
|
+
const r = e >> wt;
|
|
841
841
|
if ((e & d.IS_EAGER_FORMAT) !== 0)
|
|
842
842
|
try {
|
|
843
|
-
return new
|
|
843
|
+
return new Y(t, r, !0);
|
|
844
844
|
} catch (o) {
|
|
845
845
|
if ((e & d.UNDEFINED) !== 0) {
|
|
846
846
|
n.warn("Invalid formatted value for optional type, defaulting to undefined", {
|
|
@@ -852,58 +852,58 @@ function It(e, t, n, i) {
|
|
|
852
852
|
}
|
|
853
853
|
throw o;
|
|
854
854
|
}
|
|
855
|
-
return new
|
|
855
|
+
return new Y(t, r, !1);
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function M(e, t, n, i) {
|
|
858
858
|
const r = t;
|
|
859
|
-
if (r instanceof
|
|
859
|
+
if (r instanceof L) {
|
|
860
860
|
const c = r.get(e);
|
|
861
|
-
if (c === void 0) throw
|
|
861
|
+
if (c === void 0) throw V(i, r, e);
|
|
862
862
|
return c;
|
|
863
863
|
}
|
|
864
864
|
if (r instanceof Set) {
|
|
865
|
-
if (!r.has(e)) throw
|
|
865
|
+
if (!r.has(e)) throw V(i, r, e);
|
|
866
866
|
return e;
|
|
867
867
|
}
|
|
868
868
|
if (typeof r == "string") {
|
|
869
869
|
if (e == null) return r;
|
|
870
|
-
if (e !== r) throw
|
|
870
|
+
if (e !== r) throw V(i, r, e);
|
|
871
871
|
return e;
|
|
872
872
|
}
|
|
873
873
|
if (typeof r == "number") {
|
|
874
|
-
const c =
|
|
874
|
+
const c = Ft(e);
|
|
875
875
|
if ((r & c) === 0) {
|
|
876
876
|
if ((r & d.UNDEFINED) !== 0) {
|
|
877
877
|
n.warn("Invalid value for optional type, defaulting to undefined", { value: e, path: i });
|
|
878
878
|
return;
|
|
879
879
|
}
|
|
880
|
-
throw
|
|
880
|
+
throw V(i, r, e);
|
|
881
881
|
}
|
|
882
|
-
return (r & d.HAS_FORMAT) !== 0 && e !== null && e !== void 0 ?
|
|
882
|
+
return (r & d.HAS_FORMAT) !== 0 && e !== null && e !== void 0 ? kt(r, e, n, i) : e;
|
|
883
883
|
}
|
|
884
884
|
const s = r.mask, o = r._liveConfig;
|
|
885
|
-
if (o !== void 0 && o.type ===
|
|
886
|
-
return o.valueType !== void 0 ?
|
|
885
|
+
if (o !== void 0 && o.type === ht.Value)
|
|
886
|
+
return o.valueType !== void 0 ? M(e, o.valueType, n, i) : e;
|
|
887
887
|
if ((s & d.PARSE_RESULT) !== 0)
|
|
888
888
|
try {
|
|
889
|
-
return { success: !0, value:
|
|
889
|
+
return { success: !0, value: M(e, r.shape, n, i) };
|
|
890
890
|
} catch (c) {
|
|
891
891
|
return { success: !1, error: c instanceof Error ? c : new Error(String(c)) };
|
|
892
892
|
}
|
|
893
|
-
const a =
|
|
893
|
+
const a = Ft(e);
|
|
894
894
|
if ((s & a) === 0 && !r.values?.has(e)) {
|
|
895
895
|
if ((s & d.UNDEFINED) !== 0) {
|
|
896
896
|
n.warn("Invalid value for optional type, defaulting to undefined", { value: e, path: i });
|
|
897
897
|
return;
|
|
898
898
|
}
|
|
899
|
-
throw
|
|
899
|
+
throw V(i, s, e);
|
|
900
900
|
}
|
|
901
|
-
return a < d.OBJECT ? (s & d.HAS_FORMAT) !== 0 && e !== null && e !== void 0 ?
|
|
901
|
+
return a < d.OBJECT ? (s & d.HAS_FORMAT) !== 0 && e !== null && e !== void 0 ? kt(s, e, n, i) : e : (s & d.UNION) !== 0 ? cn(a, e, r, n, i) : a === d.ARRAY ? ae(e, r.shape, n, i) : (s & d.RECORD) !== 0 ? ce(e, r.shape, n, i) : (s & d.ENTITY) !== 0 && n.queryClient !== void 0 ? bt(e, r, n) : fe(e, r, n, i);
|
|
902
902
|
}
|
|
903
|
-
function
|
|
903
|
+
function cn(e, t, n, i, r) {
|
|
904
904
|
if (e === d.ARRAY) {
|
|
905
|
-
const s = n.shape[
|
|
906
|
-
return s === void 0 || typeof s == "number" ? t :
|
|
905
|
+
const s = n.shape[F];
|
|
906
|
+
return s === void 0 || typeof s == "number" ? t : ae(t, s, i, r);
|
|
907
907
|
} else {
|
|
908
908
|
const s = n.typenameField, o = s ? t[s] : void 0;
|
|
909
909
|
if (o === void 0 || typeof o != "string") {
|
|
@@ -912,19 +912,19 @@ function fn(e, t, n, i, r) {
|
|
|
912
912
|
throw new Error(
|
|
913
913
|
`Typename field '${s}' is required for union discrimination but was not found in the data`
|
|
914
914
|
);
|
|
915
|
-
return
|
|
915
|
+
return ce(t, c, i, r);
|
|
916
916
|
}
|
|
917
917
|
const a = n.shape[o];
|
|
918
918
|
if (a === void 0 || typeof a == "number")
|
|
919
919
|
throw new Error(`Unknown typename '${o}' in union`);
|
|
920
|
-
return a.mask & d.ENTITY && i.queryClient !== void 0 ?
|
|
920
|
+
return a.mask & d.ENTITY && i.queryClient !== void 0 ? bt(t, a, i) : fe(t, a, i, r);
|
|
921
921
|
}
|
|
922
922
|
}
|
|
923
|
-
function
|
|
923
|
+
function ae(e, t, n, i) {
|
|
924
924
|
const r = [];
|
|
925
925
|
for (let s = 0; s < e.length; s++)
|
|
926
926
|
try {
|
|
927
|
-
r.push(
|
|
927
|
+
r.push(M(e[s], t, n, `${i}[${s}]`));
|
|
928
928
|
} catch (o) {
|
|
929
929
|
n.warn("Failed to parse array item, filtering out", {
|
|
930
930
|
index: s,
|
|
@@ -934,20 +934,20 @@ function oe(e, t, n, i) {
|
|
|
934
934
|
}
|
|
935
935
|
return r;
|
|
936
936
|
}
|
|
937
|
-
function
|
|
938
|
-
for (const [r, s] of
|
|
939
|
-
e[r] =
|
|
937
|
+
function ce(e, t, n, i) {
|
|
938
|
+
for (const [r, s] of Et(e))
|
|
939
|
+
e[r] = M(s, t, n, `${i}["${r}"]`);
|
|
940
940
|
return e;
|
|
941
941
|
}
|
|
942
|
-
function
|
|
942
|
+
function fe(e, t, n, i) {
|
|
943
943
|
if (S.has(e))
|
|
944
944
|
return e;
|
|
945
945
|
const r = t.shape;
|
|
946
|
-
for (const [s, o] of
|
|
947
|
-
e[s] =
|
|
946
|
+
for (const [s, o] of Et(r))
|
|
947
|
+
e[s] = M(e[s], o, n, `${i}.${s}`);
|
|
948
948
|
return e;
|
|
949
949
|
}
|
|
950
|
-
function
|
|
950
|
+
function bt(e, t, n) {
|
|
951
951
|
const i = n.queryClient, r = n.preloadedEntities;
|
|
952
952
|
let s, o;
|
|
953
953
|
if (r !== void 0)
|
|
@@ -962,34 +962,34 @@ function wt(e, t, n) {
|
|
|
962
962
|
if (a !== void 0)
|
|
963
963
|
return a.data;
|
|
964
964
|
if (r !== void 0) {
|
|
965
|
-
const
|
|
966
|
-
if (
|
|
965
|
+
const _ = i.entityMap.getEntity(s)?.data ?? r.get(s);
|
|
966
|
+
if (_ === void 0)
|
|
967
967
|
throw new Error(`Cached entity ${s} not found in preloaded map`);
|
|
968
|
-
e =
|
|
968
|
+
e = _;
|
|
969
969
|
}
|
|
970
970
|
const c = {};
|
|
971
971
|
typeof t.idField == "symbol" && (c[t.idField] = o);
|
|
972
|
-
const f = i.entityMap.getEntity(s),
|
|
972
|
+
const f = i.entityMap.getEntity(s), l = n.isPartialEvent && f !== void 0, u = {
|
|
973
973
|
key: s,
|
|
974
974
|
shape: t,
|
|
975
975
|
data: c,
|
|
976
|
-
rawKeys:
|
|
976
|
+
rawKeys: l ? new Set(Object.keys(e)) : void 0
|
|
977
977
|
};
|
|
978
978
|
n.seen.set(c, u), n.seenByKey.set(s, u);
|
|
979
|
-
const
|
|
980
|
-
for (const [p,
|
|
981
|
-
|
|
979
|
+
const h = `[[${t.typenameValue}:${o}]]`, g = t.shape;
|
|
980
|
+
for (const [p, _] of Et(g))
|
|
981
|
+
l && !(p in e) || (c[p] = M(e[p], _, n, `${h}.${p}`));
|
|
982
982
|
return c;
|
|
983
983
|
}
|
|
984
|
-
function
|
|
985
|
-
return
|
|
984
|
+
function fn(e, t) {
|
|
985
|
+
return un(e, t.shape, t.typenameField);
|
|
986
986
|
}
|
|
987
|
-
function
|
|
987
|
+
function un(e, t, n) {
|
|
988
988
|
if (t === void 0) return !0;
|
|
989
989
|
for (const i of Object.keys(t)) {
|
|
990
990
|
if (i === n) continue;
|
|
991
991
|
const r = t[i];
|
|
992
|
-
if (r instanceof
|
|
992
|
+
if (r instanceof v) {
|
|
993
993
|
if ((r.mask & d.UNDEFINED) !== 0) continue;
|
|
994
994
|
if (!(i in e) || e[i] === void 0) return !1;
|
|
995
995
|
} else if (typeof r == "number") {
|
|
@@ -999,18 +999,18 @@ function dn(e, t, n) {
|
|
|
999
999
|
}
|
|
1000
1000
|
return !0;
|
|
1001
1001
|
}
|
|
1002
|
-
const
|
|
1003
|
-
function
|
|
1002
|
+
const dn = Object.prototype, W = /* @__PURE__ */ new WeakMap();
|
|
1003
|
+
function A(e) {
|
|
1004
1004
|
if (typeof e != "object" || e === null) return e;
|
|
1005
|
-
if (
|
|
1005
|
+
if (et.has(e)) return A(e.getValue());
|
|
1006
1006
|
if (S.has(e)) return e;
|
|
1007
1007
|
if (Array.isArray(e)) {
|
|
1008
|
-
let t =
|
|
1009
|
-
return t === void 0 && (t = new Proxy(e, ln),
|
|
1008
|
+
let t = W.get(e);
|
|
1009
|
+
return t === void 0 && (t = new Proxy(e, ln), W.set(e, t)), t;
|
|
1010
1010
|
}
|
|
1011
|
-
if (Object.getPrototypeOf(e) ===
|
|
1012
|
-
let t =
|
|
1013
|
-
return t === void 0 && (t = new Proxy(e,
|
|
1011
|
+
if (Object.getPrototypeOf(e) === dn) {
|
|
1012
|
+
let t = W.get(e);
|
|
1013
|
+
return t === void 0 && (t = new Proxy(e, hn), W.set(e, t)), t;
|
|
1014
1014
|
}
|
|
1015
1015
|
return e;
|
|
1016
1016
|
}
|
|
@@ -1019,7 +1019,7 @@ const ln = {
|
|
|
1019
1019
|
if (typeof t == "string") {
|
|
1020
1020
|
const i = Number(t);
|
|
1021
1021
|
if (Number.isInteger(i) && i >= 0 && i < e.length)
|
|
1022
|
-
return
|
|
1022
|
+
return A(e[i]);
|
|
1023
1023
|
}
|
|
1024
1024
|
return Reflect.get(e, t, n);
|
|
1025
1025
|
},
|
|
@@ -1029,9 +1029,9 @@ const ln = {
|
|
|
1029
1029
|
deleteProperty() {
|
|
1030
1030
|
throw new Error("Cannot mutate a read-only array");
|
|
1031
1031
|
}
|
|
1032
|
-
},
|
|
1032
|
+
}, hn = {
|
|
1033
1033
|
get(e, t, n) {
|
|
1034
|
-
return typeof t == "string" ?
|
|
1034
|
+
return typeof t == "string" ? A(e[t]) : Reflect.get(e, t, n);
|
|
1035
1035
|
},
|
|
1036
1036
|
set() {
|
|
1037
1037
|
throw new Error("Cannot mutate a read-only object");
|
|
@@ -1048,23 +1048,22 @@ const ln = {
|
|
|
1048
1048
|
getOwnPropertyDescriptor(e, t) {
|
|
1049
1049
|
return Object.getOwnPropertyDescriptor(e, t);
|
|
1050
1050
|
}
|
|
1051
|
-
},
|
|
1051
|
+
}, yn = (e, t, n) => {
|
|
1052
1052
|
const i = e, r = Object.keys(i), s = t !== null && typeof t == "object" && !Array.isArray(t) ? t : void 0;
|
|
1053
1053
|
let o = !s || Object.keys(s).length !== r.length;
|
|
1054
1054
|
const a = {};
|
|
1055
1055
|
for (let c = 0; c < r.length; c++) {
|
|
1056
|
-
const f = r[c],
|
|
1056
|
+
const f = r[c], l = i[f];
|
|
1057
1057
|
let u;
|
|
1058
|
-
typeof
|
|
1058
|
+
typeof l == "function" ? u = l : u = n(l, s?.[f]), a[f] = u, !o && u !== s?.[f] && (o = !0);
|
|
1059
1059
|
}
|
|
1060
1060
|
return o ? a : s;
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
class gn {
|
|
1061
|
+
};
|
|
1062
|
+
De(
|
|
1063
|
+
gt,
|
|
1064
|
+
yn
|
|
1065
|
+
);
|
|
1066
|
+
class pn {
|
|
1068
1067
|
_notifier;
|
|
1069
1068
|
_queryClient;
|
|
1070
1069
|
_proxies = /* @__PURE__ */ new Map();
|
|
@@ -1082,7 +1081,7 @@ class gn {
|
|
|
1082
1081
|
_extraMethods;
|
|
1083
1082
|
_extraGetters;
|
|
1084
1083
|
constructor(t, n, i, r, s, o) {
|
|
1085
|
-
this._notifier =
|
|
1084
|
+
this._notifier = Z(), this._queryClient = o, this.key = t, this.typename = n, this.id = i, this.idField = r, this.data = s, this.entityRefs = void 0;
|
|
1086
1085
|
}
|
|
1087
1086
|
retain() {
|
|
1088
1087
|
this.refCount++;
|
|
@@ -1094,7 +1093,7 @@ class gn {
|
|
|
1094
1093
|
if (this.refCount < 0)
|
|
1095
1094
|
throw new Error(`Entity ${this.typename}:${this.id} released more times than retained`);
|
|
1096
1095
|
const t = this._entityCache?.gcTime;
|
|
1097
|
-
t !== void 0 ? this._queryClient.gcManager.schedule(this.key, t,
|
|
1096
|
+
t !== void 0 ? this._queryClient.gcManager.schedule(this.key, t, tt.Entity) : this.evict();
|
|
1098
1097
|
}
|
|
1099
1098
|
evict() {
|
|
1100
1099
|
const t = this.liveCollections.slice();
|
|
@@ -1134,7 +1133,7 @@ class gn {
|
|
|
1134
1133
|
return this._proxies.values().next().value;
|
|
1135
1134
|
}
|
|
1136
1135
|
satisfiesDef(t) {
|
|
1137
|
-
return this.satisfiedDefs.has(t) ? !0 :
|
|
1136
|
+
return this.satisfiedDefs.has(t) ? !0 : fn(this.data, t) ? (this.satisfiedDefs.add(t), !0) : !1;
|
|
1138
1137
|
}
|
|
1139
1138
|
save() {
|
|
1140
1139
|
this._queryClient.entityMap.save(this);
|
|
@@ -1146,7 +1145,7 @@ class gn {
|
|
|
1146
1145
|
this._notifier.consume();
|
|
1147
1146
|
}
|
|
1148
1147
|
}
|
|
1149
|
-
function
|
|
1148
|
+
function gn(e, t, n) {
|
|
1150
1149
|
const i = [];
|
|
1151
1150
|
for (const r of e) {
|
|
1152
1151
|
if (typeof r != "object" || r === null) continue;
|
|
@@ -1158,84 +1157,82 @@ function mn(e, t, n) {
|
|
|
1158
1157
|
return i;
|
|
1159
1158
|
}
|
|
1160
1159
|
function vn(e, t, n, i, r) {
|
|
1161
|
-
const s = n.shape ?? {}, o = n, a = o._methods, c = o._entityClass, f = o._entityConfig,
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
}, _ = a.__subscribe.call(v, y);
|
|
1169
|
-
return E.value = v, _;
|
|
1160
|
+
const s = n.shape ?? {}, o = n, a = o._methods, c = o._entityClass, f = o._entityConfig, l = c ? c.prototype : gt.prototype, u = n.typenameField, h = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), p = () => ({ __entityRef: t });
|
|
1161
|
+
let _;
|
|
1162
|
+
f?.hasSubscribe && a && "__subscribe" in a && (_ = Lt((E) => {
|
|
1163
|
+
const y = (w) => {
|
|
1164
|
+
w.__eventSource = t, r.applyMutationEvent(w);
|
|
1165
|
+
}, b = a.__subscribe.call(m, y);
|
|
1166
|
+
return E.value = m, b;
|
|
1170
1167
|
}));
|
|
1171
|
-
let
|
|
1168
|
+
let m;
|
|
1172
1169
|
if (u && !(u in s))
|
|
1173
1170
|
throw new Error(`typenameField "${u}" must be declared in the entity shape`);
|
|
1174
1171
|
const O = Object.keys(s);
|
|
1175
1172
|
if (O.includes("__typename") || O.push("__typename"), a)
|
|
1176
1173
|
for (const E of Object.keys(a))
|
|
1177
1174
|
O.includes(E) || O.push(E);
|
|
1178
|
-
let
|
|
1179
|
-
function
|
|
1175
|
+
let T, R = O;
|
|
1176
|
+
function U() {
|
|
1180
1177
|
const E = e._extraMethods;
|
|
1181
|
-
if (E !==
|
|
1182
|
-
if (
|
|
1183
|
-
for (const
|
|
1184
|
-
R.includes(
|
|
1178
|
+
if (E !== T) {
|
|
1179
|
+
if (T = E, R = O.slice(), E !== void 0)
|
|
1180
|
+
for (const b of Object.keys(E))
|
|
1181
|
+
R.includes(b) || R.push(b);
|
|
1185
1182
|
const y = e._extraGetters;
|
|
1186
1183
|
if (y !== void 0)
|
|
1187
|
-
for (const
|
|
1188
|
-
R.includes(
|
|
1184
|
+
for (const b of Object.keys(y))
|
|
1185
|
+
R.includes(b) || R.push(b);
|
|
1189
1186
|
}
|
|
1190
1187
|
return R;
|
|
1191
1188
|
}
|
|
1192
|
-
const
|
|
1189
|
+
const q = {
|
|
1193
1190
|
getPrototypeOf() {
|
|
1194
|
-
return
|
|
1191
|
+
return l;
|
|
1195
1192
|
},
|
|
1196
|
-
get(E, y) {
|
|
1197
|
-
if (typeof y == "symbol") return;
|
|
1193
|
+
get(E, y, b) {
|
|
1194
|
+
if (typeof y == "symbol") return Reflect.get(l, y, b);
|
|
1198
1195
|
if (y === "toJSON") return p;
|
|
1199
1196
|
if (y === "__context") return r.getContext();
|
|
1200
1197
|
if (y === "__typename") return e.typename;
|
|
1201
|
-
if (
|
|
1202
|
-
const
|
|
1203
|
-
if (
|
|
1204
|
-
return
|
|
1205
|
-
const
|
|
1206
|
-
if (
|
|
1207
|
-
let C =
|
|
1208
|
-
return C || (C =
|
|
1198
|
+
if (_?.value, i.consume(), typeof y == "string") {
|
|
1199
|
+
const D = e._extraGetters;
|
|
1200
|
+
if (D !== void 0 && y in D)
|
|
1201
|
+
return D[y]();
|
|
1202
|
+
const x = e._extraMethods;
|
|
1203
|
+
if (x !== void 0 && y in x) {
|
|
1204
|
+
let C = h.get(y);
|
|
1205
|
+
return C || (C = x[y].bind(m), h.set(y, C)), C;
|
|
1209
1206
|
}
|
|
1210
1207
|
if (a && y in a) {
|
|
1211
|
-
let C =
|
|
1212
|
-
return C || (C = Se(
|
|
1208
|
+
let C = h.get(y);
|
|
1209
|
+
return C || (C = Se(m, a[y].bind(m)), h.set(y, C)), C;
|
|
1213
1210
|
}
|
|
1214
1211
|
}
|
|
1215
|
-
const
|
|
1216
|
-
if (typeof
|
|
1217
|
-
return
|
|
1218
|
-
if (Array.isArray(
|
|
1219
|
-
const
|
|
1220
|
-
if (
|
|
1221
|
-
const
|
|
1222
|
-
if (
|
|
1223
|
-
const C =
|
|
1212
|
+
const w = e.data[y];
|
|
1213
|
+
if (typeof w == "object" && w !== null && et.has(w))
|
|
1214
|
+
return A(w.getValue());
|
|
1215
|
+
if (Array.isArray(w) && typeof y == "string") {
|
|
1216
|
+
const D = s[y];
|
|
1217
|
+
if (D instanceof v && (D.mask & d.ARRAY) !== 0) {
|
|
1218
|
+
const x = D.shape;
|
|
1219
|
+
if (x instanceof v && (x.mask & d.ENTITY) !== 0) {
|
|
1220
|
+
const C = x.typenameValue;
|
|
1224
1221
|
if (C !== void 0) {
|
|
1225
|
-
const
|
|
1226
|
-
if (
|
|
1227
|
-
const
|
|
1228
|
-
if (
|
|
1229
|
-
return
|
|
1230
|
-
const
|
|
1231
|
-
return g.set(y, { source:
|
|
1222
|
+
const Ot = r.getEntityDefsForTypename(C);
|
|
1223
|
+
if (Ot !== void 0 && Ot.length > 1) {
|
|
1224
|
+
const nt = g.get(y);
|
|
1225
|
+
if (nt !== void 0 && nt.source === w)
|
|
1226
|
+
return A(nt.filtered);
|
|
1227
|
+
const Rt = gn(w, x, r);
|
|
1228
|
+
return g.set(y, { source: w, filtered: Rt }), A(Rt);
|
|
1232
1229
|
}
|
|
1233
1230
|
}
|
|
1234
1231
|
}
|
|
1235
1232
|
}
|
|
1236
|
-
return
|
|
1233
|
+
return A(w);
|
|
1237
1234
|
}
|
|
1238
|
-
return
|
|
1235
|
+
return A(w);
|
|
1239
1236
|
},
|
|
1240
1237
|
set() {
|
|
1241
1238
|
throw new Error("Entity properties are read-only");
|
|
@@ -1243,36 +1240,36 @@ function vn(e, t, n, i, r) {
|
|
|
1243
1240
|
has(E, y) {
|
|
1244
1241
|
if (y === "__typename") return !0;
|
|
1245
1242
|
if (typeof y == "string") {
|
|
1246
|
-
const
|
|
1247
|
-
if (
|
|
1248
|
-
const
|
|
1249
|
-
if (
|
|
1243
|
+
const b = e._extraGetters;
|
|
1244
|
+
if (b && y in b) return !0;
|
|
1245
|
+
const w = e._extraMethods;
|
|
1246
|
+
if (w && y in w || a && y in a) return !0;
|
|
1250
1247
|
}
|
|
1251
1248
|
return y in s;
|
|
1252
1249
|
},
|
|
1253
1250
|
ownKeys() {
|
|
1254
|
-
return
|
|
1251
|
+
return U();
|
|
1255
1252
|
},
|
|
1256
1253
|
getOwnPropertyDescriptor(E, y) {
|
|
1257
1254
|
if (y === "__typename")
|
|
1258
1255
|
return { enumerable: !0, configurable: !0, value: e.typename, writable: !1 };
|
|
1259
1256
|
if (y in s)
|
|
1260
|
-
return { enumerable: !0, configurable: !0, value:
|
|
1257
|
+
return { enumerable: !0, configurable: !0, value: q.get(E, y, m), writable: !1 };
|
|
1261
1258
|
if (typeof y == "string") {
|
|
1262
|
-
const
|
|
1263
|
-
if (_ && y in _)
|
|
1264
|
-
return { enumerable: !0, configurable: !0, value: U.get(E, y, v), writable: !1 };
|
|
1265
|
-
const b = e._extraMethods;
|
|
1259
|
+
const b = e._extraGetters;
|
|
1266
1260
|
if (b && y in b)
|
|
1267
|
-
return { enumerable: !0, configurable: !0, value:
|
|
1261
|
+
return { enumerable: !0, configurable: !0, value: q.get(E, y, m), writable: !1 };
|
|
1262
|
+
const w = e._extraMethods;
|
|
1263
|
+
if (w && y in w)
|
|
1264
|
+
return { enumerable: !0, configurable: !0, value: q.get(E, y, m), writable: !1 };
|
|
1268
1265
|
if (a && y in a)
|
|
1269
|
-
return { enumerable: !1, configurable: !0, value:
|
|
1266
|
+
return { enumerable: !1, configurable: !0, value: q.get(E, y, m), writable: !1 };
|
|
1270
1267
|
}
|
|
1271
1268
|
}
|
|
1272
1269
|
};
|
|
1273
|
-
return
|
|
1270
|
+
return m = new Proxy({}, q), S.set(m, t), Ce(m, r), m;
|
|
1274
1271
|
}
|
|
1275
|
-
class
|
|
1272
|
+
class mn {
|
|
1276
1273
|
instances = /* @__PURE__ */ new Map();
|
|
1277
1274
|
persistEntity;
|
|
1278
1275
|
constructor(t) {
|
|
@@ -1294,7 +1291,7 @@ class _n {
|
|
|
1294
1291
|
if (typeof a != "string" && typeof a != "number")
|
|
1295
1292
|
throw new Error(`Entity id must be string or number: ${i.typenameValue}`);
|
|
1296
1293
|
const c = i;
|
|
1297
|
-
s = new
|
|
1294
|
+
s = new pn(t, i.typenameValue, a, o, n, r), s._entityCache = c._entityCache, this.instances.set(t, s);
|
|
1298
1295
|
}
|
|
1299
1296
|
return s.parseId = r.currentParseId, s;
|
|
1300
1297
|
}
|
|
@@ -1316,7 +1313,7 @@ class ue {
|
|
|
1316
1313
|
eventListenersAttached = !1;
|
|
1317
1314
|
constructor(t) {
|
|
1318
1315
|
const n = t ?? this.detectOnlineStatus();
|
|
1319
|
-
this.onlineSignal =
|
|
1316
|
+
this.onlineSignal = Ut(n), this.canAttachListeners() && this.attachEventListeners();
|
|
1320
1317
|
}
|
|
1321
1318
|
/**
|
|
1322
1319
|
* Returns true if the network is currently online
|
|
@@ -1375,7 +1372,7 @@ class ue {
|
|
|
1375
1372
|
}
|
|
1376
1373
|
}
|
|
1377
1374
|
class de {
|
|
1378
|
-
static onlineSignal =
|
|
1375
|
+
static onlineSignal = Ut(!0);
|
|
1379
1376
|
get isOnline() {
|
|
1380
1377
|
return !0;
|
|
1381
1378
|
}
|
|
@@ -1389,14 +1386,14 @@ class de {
|
|
|
1389
1386
|
destroy() {
|
|
1390
1387
|
}
|
|
1391
1388
|
}
|
|
1392
|
-
const
|
|
1393
|
-
function
|
|
1389
|
+
const _n = new ue(), Ln = qt(_n);
|
|
1390
|
+
function Ct(e, t = typeof window > "u") {
|
|
1394
1391
|
let n;
|
|
1395
1392
|
e === !1 ? n = 0 : e === void 0 || e === !0 ? n = t ? 0 : 3 : typeof e == "number" ? n = e : n = e.retries;
|
|
1396
1393
|
const i = typeof e == "object" && e.retryDelay ? e.retryDelay : (r) => 1e3 * Math.pow(2, r);
|
|
1397
1394
|
return { retries: n, retryDelay: i };
|
|
1398
1395
|
}
|
|
1399
|
-
class
|
|
1396
|
+
class Un {
|
|
1400
1397
|
static cache;
|
|
1401
1398
|
/**
|
|
1402
1399
|
* The adapter class responsible for sending requests for this query type.
|
|
@@ -1406,99 +1403,99 @@ class qn {
|
|
|
1406
1403
|
params;
|
|
1407
1404
|
config;
|
|
1408
1405
|
constructor() {
|
|
1409
|
-
return
|
|
1406
|
+
return Gt(this);
|
|
1410
1407
|
}
|
|
1411
1408
|
}
|
|
1412
|
-
const
|
|
1413
|
-
class
|
|
1409
|
+
const Mt = /* @__PURE__ */ new WeakMap();
|
|
1410
|
+
class H {
|
|
1414
1411
|
constructor(t, n) {
|
|
1415
1412
|
this.captured = n, this.statics = t;
|
|
1416
1413
|
}
|
|
1417
1414
|
statics;
|
|
1418
1415
|
createExecutionContext(t, n) {
|
|
1419
|
-
return
|
|
1416
|
+
return ot(this.captured, t, n);
|
|
1420
1417
|
}
|
|
1421
1418
|
resolveOptions(t) {
|
|
1422
|
-
const { methods: n } = this.captured, i = n.getConfig ? n.getConfig.call(t) : t.config, r =
|
|
1419
|
+
const { methods: n } = this.captured, i = n.getConfig ? n.getConfig.call(t) : t.config, r = Ct(i?.retry);
|
|
1423
1420
|
return { config: i, retryConfig: r };
|
|
1424
1421
|
}
|
|
1425
1422
|
static for(t) {
|
|
1426
|
-
let n =
|
|
1423
|
+
let n = Mt.get(t);
|
|
1427
1424
|
if (n !== void 0)
|
|
1428
1425
|
return n;
|
|
1429
|
-
const i = new t(), r =
|
|
1426
|
+
const i = new t(), r = $e(i), s = String(r.methods.getIdentityKey.call(r.fields)), o = r.fields.result, a = o instanceof v ? o : sn.object(o), c = (a.mask & d.ENTITY) !== 0, f = t.cache, l = r.fields.fetchNext, u = t.adapter;
|
|
1430
1427
|
if (!u)
|
|
1431
1428
|
throw new Error(
|
|
1432
1429
|
`Query class "${t.name}" must define a static \`adapter\` property. Extend RESTQuery (from fetchium/rest) or set \`static adapter = MyAdapter\` on your query class.`
|
|
1433
1430
|
);
|
|
1434
|
-
const
|
|
1431
|
+
const h = typeof u.prototype.sendNext == "function", g = c ? a : new v(
|
|
1435
1432
|
d.ENTITY | d.OBJECT,
|
|
1436
1433
|
a.shape,
|
|
1437
1434
|
void 0,
|
|
1438
1435
|
void 0,
|
|
1439
1436
|
s,
|
|
1440
1437
|
// typenameValue — unique per query class
|
|
1441
|
-
|
|
1438
|
+
Kt
|
|
1442
1439
|
// idField — symbol, injected onto payload before parse
|
|
1443
1440
|
);
|
|
1444
|
-
return n = new
|
|
1445
|
-
{ id: s, shape: g, cache: f, rawFetchNext:
|
|
1441
|
+
return n = new H(
|
|
1442
|
+
{ id: s, shape: g, cache: f, rawFetchNext: l, hasSendNext: h, isEntityResult: c, adapterClass: u },
|
|
1446
1443
|
r
|
|
1447
|
-
),
|
|
1444
|
+
), Mt.set(t, n), n;
|
|
1448
1445
|
}
|
|
1449
1446
|
}
|
|
1450
|
-
const
|
|
1451
|
-
const n =
|
|
1452
|
-
return
|
|
1447
|
+
const qn = (e, t) => {
|
|
1448
|
+
const n = H.for(e);
|
|
1449
|
+
return St(n, t);
|
|
1453
1450
|
};
|
|
1454
|
-
function
|
|
1455
|
-
const n =
|
|
1451
|
+
function Vn(e, ...t) {
|
|
1452
|
+
const n = H.for(e), i = Oe(Fn);
|
|
1456
1453
|
if (i === void 0)
|
|
1457
1454
|
throw new Error("QueryClient not found");
|
|
1458
1455
|
const r = t[0];
|
|
1459
1456
|
return i.getQuery(n, r);
|
|
1460
1457
|
}
|
|
1461
|
-
function
|
|
1458
|
+
function ut(e) {
|
|
1462
1459
|
if (e.reason !== void 0) return e.reason;
|
|
1463
1460
|
if (typeof DOMException < "u")
|
|
1464
1461
|
return new DOMException("The operation was aborted", "AbortError");
|
|
1465
1462
|
const t = new Error("The operation was aborted");
|
|
1466
1463
|
return t.name = "AbortError", t;
|
|
1467
1464
|
}
|
|
1468
|
-
function
|
|
1465
|
+
function le(e, t) {
|
|
1469
1466
|
return new Promise((n, i) => {
|
|
1470
1467
|
if (t?.aborted) {
|
|
1471
|
-
i(
|
|
1468
|
+
i(ut(t));
|
|
1472
1469
|
return;
|
|
1473
1470
|
}
|
|
1474
1471
|
const r = setTimeout(n, e);
|
|
1475
1472
|
t?.addEventListener(
|
|
1476
1473
|
"abort",
|
|
1477
1474
|
() => {
|
|
1478
|
-
clearTimeout(r), i(
|
|
1475
|
+
clearTimeout(r), i(ut(t));
|
|
1479
1476
|
},
|
|
1480
1477
|
{ once: !0 }
|
|
1481
1478
|
);
|
|
1482
1479
|
});
|
|
1483
1480
|
}
|
|
1484
|
-
async function
|
|
1481
|
+
async function dt(e, t, n) {
|
|
1485
1482
|
if (t.retries < 0)
|
|
1486
1483
|
throw new Error("retries must be non-negative");
|
|
1487
1484
|
const i = Math.max(0, t.retries);
|
|
1488
1485
|
let r;
|
|
1489
1486
|
for (let s = 0; s <= i; s++) {
|
|
1490
1487
|
if (n?.aborted)
|
|
1491
|
-
throw
|
|
1488
|
+
throw ut(n);
|
|
1492
1489
|
try {
|
|
1493
1490
|
return await e();
|
|
1494
1491
|
} catch (o) {
|
|
1495
1492
|
if (r = o, s >= i) throw o;
|
|
1496
|
-
await
|
|
1493
|
+
await le(t.retryDelay(s), n);
|
|
1497
1494
|
}
|
|
1498
1495
|
}
|
|
1499
1496
|
throw r;
|
|
1500
1497
|
}
|
|
1501
|
-
class
|
|
1498
|
+
class wn {
|
|
1502
1499
|
def;
|
|
1503
1500
|
queryKey;
|
|
1504
1501
|
storageKey = -1;
|
|
@@ -1509,14 +1506,24 @@ class En {
|
|
|
1509
1506
|
updatedAt = void 0;
|
|
1510
1507
|
params = void 0;
|
|
1511
1508
|
unsubscribe = void 0;
|
|
1509
|
+
lastSubscribeFn = void 0;
|
|
1512
1510
|
_relayState = void 0;
|
|
1513
1511
|
_isActive = !1;
|
|
1514
1512
|
wasPaused = !1;
|
|
1515
1513
|
currentParams = void 0;
|
|
1516
1514
|
debounceTimer = void 0;
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1515
|
+
// Invalidates on any signal consumed by getConfig() (such as
|
|
1516
|
+
// responseNotifier, fired by the adapter after each fetch). Param
|
|
1517
|
+
// changes are handled separately: getOrCreateExecutionContext
|
|
1518
|
+
// replaces this wholesale to force recomputation against the new ctx.
|
|
1519
|
+
_resolvedOptions = st(() => this.def.resolveOptions(this._executionCtx));
|
|
1520
|
+
get config() {
|
|
1521
|
+
if (this._executionCtx !== void 0)
|
|
1522
|
+
return this._resolvedOptions.value.config;
|
|
1523
|
+
}
|
|
1524
|
+
get retryConfig() {
|
|
1525
|
+
return this._executionCtx === void 0 ? Ct(void 0) : this._resolvedOptions.value.retryConfig;
|
|
1526
|
+
}
|
|
1520
1527
|
/** Cancels in-flight fetches and retry waits. */
|
|
1521
1528
|
_abortController = void 0;
|
|
1522
1529
|
/** Cached execution context, recreated only when storageKey (params) changes. */
|
|
@@ -1539,23 +1546,23 @@ class En {
|
|
|
1539
1546
|
}
|
|
1540
1547
|
constructor(t, n, i, r) {
|
|
1541
1548
|
this.def = t, this.queryClient = n, this.queryKey = i, this.params = r, this._extraMethods = { __refetch: this.refetch }, t.statics.hasSendNext && (this._extraMethods.__fetchNext = this.fetchNext);
|
|
1542
|
-
const s =
|
|
1543
|
-
this._queryId = s !== void 0 ? N(s) : 0, this.relay =
|
|
1549
|
+
const s = $t(r);
|
|
1550
|
+
this._queryId = s !== void 0 ? N(s) : 0, this.relay = Lt(
|
|
1544
1551
|
(o) => {
|
|
1545
1552
|
this._relayState = o;
|
|
1546
1553
|
const a = () => {
|
|
1547
|
-
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;
|
|
1548
|
-
const f = this.config?.gcTime ??
|
|
1549
|
-
this.queryClient.gcManager.schedule(this.queryKey, f,
|
|
1554
|
+
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;
|
|
1555
|
+
const f = this.config?.gcTime ?? Vt;
|
|
1556
|
+
this.queryClient.gcManager.schedule(this.queryKey, f, tt.Query);
|
|
1550
1557
|
}, c = (f = !1) => {
|
|
1551
|
-
const { wasPaused:
|
|
1552
|
-
if (this.wasPaused = u, u && !
|
|
1558
|
+
const { wasPaused: l, isPaused: u, initialized: h } = this;
|
|
1559
|
+
if (this.wasPaused = u, u && !l && h) {
|
|
1553
1560
|
a();
|
|
1554
1561
|
return;
|
|
1555
1562
|
}
|
|
1556
1563
|
this._isActive = !0;
|
|
1557
|
-
const g =
|
|
1558
|
-
|
|
1564
|
+
const g = $t(this.params), p = St(this.def, g), _ = p !== this.storageKey;
|
|
1565
|
+
_ && (this.currentParams = g, 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()) : _ && (this.lastSubscribeFn = void 0, this.reconcileSubscription(), this.runDebounced()) : (this.queryClient.activateQuery(this), this.initialize());
|
|
1559
1566
|
};
|
|
1560
1567
|
return c(!0), {
|
|
1561
1568
|
update: c,
|
|
@@ -1603,18 +1610,17 @@ class En {
|
|
|
1603
1610
|
}
|
|
1604
1611
|
if (!this.isPaused)
|
|
1605
1612
|
try {
|
|
1606
|
-
if (i !== void 0 && this.
|
|
1607
|
-
if (await
|
|
1613
|
+
if (i !== void 0 && this.reconcileSubscription(), i === void 0 || this.isStale) {
|
|
1614
|
+
if (await le(0), this.isPaused) return;
|
|
1608
1615
|
this.runQueryImmediately();
|
|
1609
1616
|
}
|
|
1610
1617
|
} catch (r) {
|
|
1611
1618
|
n.setError(r);
|
|
1612
1619
|
}
|
|
1613
1620
|
}
|
|
1614
|
-
|
|
1615
|
-
this.unsubscribe?.(), this.unsubscribe = void 0;
|
|
1621
|
+
reconcileSubscription() {
|
|
1616
1622
|
const t = this.config?.subscribe;
|
|
1617
|
-
if (!t) return;
|
|
1623
|
+
if (t === this.lastSubscribeFn || (this.unsubscribe?.(), this.unsubscribe = void 0, this.lastSubscribeFn = t, !t)) return;
|
|
1618
1624
|
const n = this._executionCtx;
|
|
1619
1625
|
this.unsubscribe = t.call(n, (i) => {
|
|
1620
1626
|
i.__eventSource = this.queryKey, this.queryClient.applyMutationEvent(i);
|
|
@@ -1624,23 +1630,19 @@ class En {
|
|
|
1624
1630
|
return (this._executionCtx === void 0 || this._executionCtxKey !== this.storageKey) && (this._executionCtxKey = this.storageKey, this._executionCtx = this.def.createExecutionContext(
|
|
1625
1631
|
this.currentParams ?? {},
|
|
1626
1632
|
this.queryClient.getContext()
|
|
1627
|
-
), this._executionCtx.refetch = () => this.refetch(), this._executionCtx.rawFetchNext = this.def.statics.rawFetchNext
|
|
1628
|
-
}
|
|
1629
|
-
resolveAndApplyOptions() {
|
|
1630
|
-
const t = this.def.resolveOptions(this._executionCtx);
|
|
1631
|
-
this.config = t.config, this.retryConfig = t.retryConfig;
|
|
1633
|
+
), this._executionCtx.refetch = () => this.refetch(), this._executionCtx.rawFetchNext = this.def.statics.rawFetchNext, this._resolvedOptions = st(() => this.def.resolveOptions(this._executionCtx))), this._executionCtx;
|
|
1632
1634
|
}
|
|
1633
1635
|
async runQuery() {
|
|
1634
1636
|
const t = this.def;
|
|
1635
1637
|
if (this.isPaused)
|
|
1636
1638
|
throw new Error("Query is paused due to network status");
|
|
1637
1639
|
const n = this.getOrCreateExecutionContext(), i = this.queryClient.getAdapter(t.statics.adapterClass), r = this._abortController?.signal ?? new AbortController().signal;
|
|
1638
|
-
return
|
|
1640
|
+
return dt(
|
|
1639
1641
|
async () => {
|
|
1640
1642
|
const s = await i.send(n, r);
|
|
1641
1643
|
this.updatedAt = Date.now();
|
|
1642
1644
|
const o = this.applyData(s, !0);
|
|
1643
|
-
return this.saveQueryMetadata(), this.
|
|
1645
|
+
return this.saveQueryMetadata(), this.reconcileSubscription(), o;
|
|
1644
1646
|
},
|
|
1645
1647
|
this.retryConfig,
|
|
1646
1648
|
r
|
|
@@ -1691,7 +1693,7 @@ class En {
|
|
|
1691
1693
|
const n = this._fetchNextAbort.signal, i = this.getOrCreateExecutionContext();
|
|
1692
1694
|
i.resultData = this.rootEntity.data;
|
|
1693
1695
|
const r = this.queryClient.getAdapter(t.statics.adapterClass);
|
|
1694
|
-
return
|
|
1696
|
+
return dt(
|
|
1695
1697
|
async () => {
|
|
1696
1698
|
const s = await r.sendNext(i, n);
|
|
1697
1699
|
this.updatedAt = Date.now();
|
|
@@ -1712,21 +1714,21 @@ class En {
|
|
|
1712
1714
|
return Date.now() - this.updatedAt >= t;
|
|
1713
1715
|
}
|
|
1714
1716
|
get isPaused() {
|
|
1715
|
-
const t = this.config?.networkMode ??
|
|
1716
|
-
if (t ===
|
|
1717
|
+
const t = this.config?.networkMode ?? K.Online;
|
|
1718
|
+
if (t === K.Always)
|
|
1717
1719
|
return !1;
|
|
1718
1720
|
const n = this.queryClient.networkManager.getOnlineSignal().value;
|
|
1719
1721
|
switch (t) {
|
|
1720
|
-
case
|
|
1722
|
+
case K.Online:
|
|
1721
1723
|
return !n;
|
|
1722
|
-
case
|
|
1724
|
+
case K.OfflineFirst:
|
|
1723
1725
|
return !n && this.updatedAt === void 0;
|
|
1724
1726
|
default:
|
|
1725
1727
|
return !1;
|
|
1726
1728
|
}
|
|
1727
1729
|
}
|
|
1728
1730
|
}
|
|
1729
|
-
class
|
|
1731
|
+
class En {
|
|
1730
1732
|
def;
|
|
1731
1733
|
queryClient;
|
|
1732
1734
|
_inFlight = !1;
|
|
@@ -1752,11 +1754,11 @@ class bn {
|
|
|
1752
1754
|
}
|
|
1753
1755
|
validateResponse(t) {
|
|
1754
1756
|
const n = this.def.responseShape;
|
|
1755
|
-
if (!(n instanceof
|
|
1757
|
+
if (!(n instanceof v))
|
|
1756
1758
|
return t;
|
|
1757
1759
|
const i = this.queryClient.getContext().log?.warn ?? (() => {
|
|
1758
|
-
}), r = new
|
|
1759
|
-
return r.reset(void 0, void 0, i),
|
|
1760
|
+
}), r = new ft();
|
|
1761
|
+
return r.reset(void 0, void 0, i), oe(t, n, r);
|
|
1760
1762
|
}
|
|
1761
1763
|
// ======================================================
|
|
1762
1764
|
// Effects processing
|
|
@@ -1764,7 +1766,7 @@ class bn {
|
|
|
1764
1766
|
processEffects(t, n) {
|
|
1765
1767
|
let i;
|
|
1766
1768
|
if (this.def.hasGetEffects) {
|
|
1767
|
-
const s =
|
|
1769
|
+
const s = ot(
|
|
1768
1770
|
this.def.captured,
|
|
1769
1771
|
t ?? {},
|
|
1770
1772
|
this.queryClient.getContext()
|
|
@@ -1772,23 +1774,23 @@ class bn {
|
|
|
1772
1774
|
s.result = n, i = s.getEffects();
|
|
1773
1775
|
} else if (this.def.effects !== void 0) {
|
|
1774
1776
|
const s = { params: t, result: n };
|
|
1775
|
-
i =
|
|
1777
|
+
i = X(this.def.effects, s);
|
|
1776
1778
|
}
|
|
1777
1779
|
if (i === void 0) return;
|
|
1778
1780
|
const r = this.queryClient;
|
|
1779
|
-
|
|
1781
|
+
it(i.creates, "create", r), it(i.updates, "update", r), it(i.deletes, "delete", r), i.invalidates && r.invalidateQueries(i.invalidates);
|
|
1780
1782
|
}
|
|
1781
1783
|
// ======================================================
|
|
1782
1784
|
// Retry logic
|
|
1783
1785
|
// ======================================================
|
|
1784
1786
|
executeWithRetry(t) {
|
|
1785
|
-
const n =
|
|
1787
|
+
const n = Ct(this.def.config?.retry, !0), i = this.queryClient.getAdapter(this.def.adapterClass);
|
|
1786
1788
|
if (!i.sendMutation)
|
|
1787
1789
|
throw new Error(
|
|
1788
1790
|
`Adapter "${this.def.adapterClass.name}" does not implement sendMutation(). Add a sendMutation() method to handle mutations.`
|
|
1789
1791
|
);
|
|
1790
|
-
return
|
|
1791
|
-
const r = new AbortController(), s =
|
|
1792
|
+
return dt(async () => {
|
|
1793
|
+
const r = new AbortController(), s = ot(
|
|
1792
1794
|
this.def.captured,
|
|
1793
1795
|
t ?? {},
|
|
1794
1796
|
this.queryClient.getContext()
|
|
@@ -1797,24 +1799,24 @@ class bn {
|
|
|
1797
1799
|
}, n);
|
|
1798
1800
|
}
|
|
1799
1801
|
}
|
|
1800
|
-
function
|
|
1801
|
-
return typeof e == "string" ? e :
|
|
1802
|
+
function bn(e) {
|
|
1803
|
+
return typeof e == "string" ? e : $(e).typenameValue;
|
|
1802
1804
|
}
|
|
1803
|
-
function
|
|
1805
|
+
function it(e, t, n) {
|
|
1804
1806
|
if (e)
|
|
1805
1807
|
for (const [i, r] of e) {
|
|
1806
|
-
const s =
|
|
1808
|
+
const s = bn(i);
|
|
1807
1809
|
s !== void 0 && n.applyMutationEvent({ type: t, typename: s, data: r });
|
|
1808
1810
|
}
|
|
1809
1811
|
}
|
|
1810
|
-
const
|
|
1812
|
+
const he = "__eventSource";
|
|
1811
1813
|
function ye(e) {
|
|
1812
1814
|
return { field: e, segments: e.indexOf(".") !== -1 ? e.split(".") : void 0 };
|
|
1813
1815
|
}
|
|
1814
|
-
function
|
|
1816
|
+
function Cn(e) {
|
|
1815
1817
|
return e.map(ye);
|
|
1816
1818
|
}
|
|
1817
|
-
function
|
|
1819
|
+
function Sn(e, t) {
|
|
1818
1820
|
if (t.segments === void 0) return e[t.field];
|
|
1819
1821
|
let n = e;
|
|
1820
1822
|
for (const i of t.segments) {
|
|
@@ -1826,41 +1828,41 @@ function On(e, t) {
|
|
|
1826
1828
|
function pe(e, t) {
|
|
1827
1829
|
const n = [];
|
|
1828
1830
|
for (let i = 0; i < t.length; i++) {
|
|
1829
|
-
const r = t[i], s =
|
|
1831
|
+
const r = t[i], s = Sn(e, r);
|
|
1830
1832
|
if (s === void 0) return;
|
|
1831
1833
|
n.push(r.field, s);
|
|
1832
1834
|
}
|
|
1833
1835
|
return N(n);
|
|
1834
1836
|
}
|
|
1835
|
-
function
|
|
1837
|
+
function On(e, t) {
|
|
1836
1838
|
if (e === void 0) return;
|
|
1837
1839
|
const n = /* @__PURE__ */ new Map();
|
|
1838
1840
|
for (const [i, r] of e) {
|
|
1839
1841
|
const s = r.slice().sort((c, f) => c[0] < f[0] ? -1 : c[0] > f[0] ? 1 : 0), o = [];
|
|
1840
1842
|
let a = !0;
|
|
1841
1843
|
for (const [c, f] of s) {
|
|
1842
|
-
let
|
|
1843
|
-
if (
|
|
1844
|
-
const u =
|
|
1845
|
-
|
|
1844
|
+
let l;
|
|
1845
|
+
if (Qt(f)) {
|
|
1846
|
+
const u = Yt(f);
|
|
1847
|
+
l = pt(u, t);
|
|
1846
1848
|
} else
|
|
1847
|
-
|
|
1848
|
-
if (
|
|
1849
|
+
l = f;
|
|
1850
|
+
if (l === void 0) {
|
|
1849
1851
|
a = !1;
|
|
1850
1852
|
break;
|
|
1851
1853
|
}
|
|
1852
|
-
o.push(c,
|
|
1854
|
+
o.push(c, l);
|
|
1853
1855
|
}
|
|
1854
1856
|
a && n.set(i, N(o));
|
|
1855
1857
|
}
|
|
1856
1858
|
return n.size > 0 ? n : void 0;
|
|
1857
1859
|
}
|
|
1858
|
-
function
|
|
1860
|
+
function Tt(e, t) {
|
|
1859
1861
|
const n = e.get(t);
|
|
1860
1862
|
if (n !== void 0)
|
|
1861
1863
|
return n.map(([i]) => i).sort();
|
|
1862
1864
|
}
|
|
1863
|
-
class
|
|
1865
|
+
class Rn {
|
|
1864
1866
|
fields;
|
|
1865
1867
|
fieldPaths;
|
|
1866
1868
|
_bindings = /* @__PURE__ */ new Map();
|
|
@@ -1882,33 +1884,33 @@ class An {
|
|
|
1882
1884
|
return this._bindings.size === 0;
|
|
1883
1885
|
}
|
|
1884
1886
|
}
|
|
1885
|
-
function
|
|
1887
|
+
function Pt(e) {
|
|
1886
1888
|
return N(e);
|
|
1887
1889
|
}
|
|
1888
1890
|
class xn {
|
|
1889
1891
|
_groups = /* @__PURE__ */ new Map();
|
|
1890
1892
|
getOrCreateGroup(t) {
|
|
1891
|
-
const n =
|
|
1893
|
+
const n = Pt(t);
|
|
1892
1894
|
let i = this._groups.get(n);
|
|
1893
|
-
return i === void 0 && (i = new
|
|
1895
|
+
return i === void 0 && (i = new Rn(t), this._groups.set(n, i)), i;
|
|
1894
1896
|
}
|
|
1895
1897
|
register(t, n, i) {
|
|
1896
1898
|
this.getOrCreateGroup(n).register(t, i);
|
|
1897
1899
|
}
|
|
1898
1900
|
unregister(t, n, i) {
|
|
1899
|
-
const r =
|
|
1901
|
+
const r = Pt(n), s = this._groups.get(r);
|
|
1900
1902
|
s !== void 0 && (s.unregister(t, i), s.isEmpty && this._groups.delete(r));
|
|
1901
1903
|
}
|
|
1902
1904
|
registerBinding(t, n) {
|
|
1903
1905
|
const i = t._constraintHashes.get(n);
|
|
1904
1906
|
if (i === void 0) return;
|
|
1905
|
-
const r =
|
|
1907
|
+
const r = Tt(t._constraintFieldRefs, n);
|
|
1906
1908
|
r !== void 0 && this.register(i, r, t);
|
|
1907
1909
|
}
|
|
1908
1910
|
unregisterBinding(t, n) {
|
|
1909
1911
|
const i = t._constraintHashes.get(n);
|
|
1910
1912
|
if (i === void 0) return;
|
|
1911
|
-
const r =
|
|
1913
|
+
const r = Tt(t._constraintFieldRefs, n);
|
|
1912
1914
|
r !== void 0 && this.unregister(i, r, t);
|
|
1913
1915
|
}
|
|
1914
1916
|
routeEvent(t, n, i, r, s, o) {
|
|
@@ -1917,16 +1919,16 @@ class xn {
|
|
|
1917
1919
|
if (c === void 0) continue;
|
|
1918
1920
|
const f = a.getMatching(c);
|
|
1919
1921
|
if (f !== void 0)
|
|
1920
|
-
for (const
|
|
1921
|
-
|
|
1922
|
+
for (const l of f)
|
|
1923
|
+
l.onEvent(t, i, r, s, o);
|
|
1922
1924
|
}
|
|
1923
1925
|
}
|
|
1924
1926
|
}
|
|
1925
|
-
function
|
|
1927
|
+
function jt(e) {
|
|
1926
1928
|
const t = /* @__PURE__ */ new Set();
|
|
1927
1929
|
for (const n of e)
|
|
1928
1930
|
if (typeof n == "object" && n !== null) {
|
|
1929
|
-
const i =
|
|
1931
|
+
const i = P(n);
|
|
1930
1932
|
i !== void 0 && t.add(i);
|
|
1931
1933
|
}
|
|
1932
1934
|
return t;
|
|
@@ -1942,7 +1944,7 @@ class ge {
|
|
|
1942
1944
|
this._queryClient = i, this._parent = r, this._constraintHashes = s, this._constraintFieldRefs = n, this.instance = o, this._entityDefsByTypename = /* @__PURE__ */ new Map();
|
|
1943
1945
|
for (const a of t)
|
|
1944
1946
|
a.typenameValue !== void 0 && this._entityDefsByTypename.set(a.typenameValue, a);
|
|
1945
|
-
|
|
1947
|
+
et.add(this);
|
|
1946
1948
|
}
|
|
1947
1949
|
getValue() {
|
|
1948
1950
|
return this.instance.getValue();
|
|
@@ -1981,7 +1983,7 @@ class ge {
|
|
|
1981
1983
|
n !== -1 && t.splice(n, 1);
|
|
1982
1984
|
}
|
|
1983
1985
|
}
|
|
1984
|
-
class
|
|
1986
|
+
class An {
|
|
1985
1987
|
_notifier;
|
|
1986
1988
|
_items;
|
|
1987
1989
|
_keys;
|
|
@@ -1989,31 +1991,31 @@ class Nn {
|
|
|
1989
1991
|
_queryClient;
|
|
1990
1992
|
_parent;
|
|
1991
1993
|
constructor(t, n, i, r, s, o) {
|
|
1992
|
-
this._notifier =
|
|
1994
|
+
this._notifier = Z(), this._items = i, this._keys = jt(i), this._queryClient = t, this._parent = n;
|
|
1993
1995
|
const a = r !== void 0 && s !== void 0, c = o !== void 0;
|
|
1994
|
-
(a || c) && (this._outputSignal =
|
|
1996
|
+
(a || c) && (this._outputSignal = st(() => {
|
|
1995
1997
|
this._notifier.consume();
|
|
1996
1998
|
let f = this._items;
|
|
1997
1999
|
if (a) {
|
|
1998
|
-
const
|
|
2000
|
+
const l = [];
|
|
1999
2001
|
for (const u of f) {
|
|
2000
2002
|
if (typeof u != "object" || u === null) {
|
|
2001
|
-
|
|
2003
|
+
l.push(u);
|
|
2002
2004
|
continue;
|
|
2003
2005
|
}
|
|
2004
|
-
const
|
|
2005
|
-
if (
|
|
2006
|
-
|
|
2006
|
+
const h = P(u);
|
|
2007
|
+
if (h === void 0) {
|
|
2008
|
+
l.push(u);
|
|
2007
2009
|
continue;
|
|
2008
2010
|
}
|
|
2009
|
-
const g = t.entityMap.getEntity(
|
|
2011
|
+
const g = t.entityMap.getEntity(h);
|
|
2010
2012
|
if (g === void 0) {
|
|
2011
|
-
|
|
2013
|
+
l.push(u);
|
|
2012
2014
|
continue;
|
|
2013
2015
|
}
|
|
2014
|
-
g.consume(), pe(g.data, r) === s &&
|
|
2016
|
+
g.consume(), pe(g.data, r) === s && l.push(u);
|
|
2015
2017
|
}
|
|
2016
|
-
f =
|
|
2018
|
+
f = l;
|
|
2017
2019
|
}
|
|
2018
2020
|
return c && (f = (f === this._items ? f.slice() : f).sort(o)), f;
|
|
2019
2021
|
}));
|
|
@@ -2056,10 +2058,10 @@ class Nn {
|
|
|
2056
2058
|
}
|
|
2057
2059
|
reset(t) {
|
|
2058
2060
|
const n = this._items, i = Array.isArray(t) ? t : [];
|
|
2059
|
-
this._items = i, this._keys =
|
|
2061
|
+
this._items = i, this._keys = jt(i);
|
|
2060
2062
|
for (const r of i)
|
|
2061
2063
|
if (typeof r == "object" && r !== null) {
|
|
2062
|
-
const s =
|
|
2064
|
+
const s = P(r);
|
|
2063
2065
|
if (s !== void 0) {
|
|
2064
2066
|
const o = this._queryClient.entityMap.getEntity(s);
|
|
2065
2067
|
o !== void 0 && this._parent.addChildRef(o);
|
|
@@ -2067,7 +2069,7 @@ class Nn {
|
|
|
2067
2069
|
}
|
|
2068
2070
|
for (const r of n)
|
|
2069
2071
|
if (typeof r == "object" && r !== null) {
|
|
2070
|
-
const s =
|
|
2072
|
+
const s = P(r);
|
|
2071
2073
|
if (s !== void 0) {
|
|
2072
2074
|
const o = this._queryClient.entityMap.getEntity(s);
|
|
2073
2075
|
o !== void 0 && this._parent.removeChildRef(o);
|
|
@@ -2079,20 +2081,20 @@ class Nn {
|
|
|
2079
2081
|
if (Array.isArray(t))
|
|
2080
2082
|
for (const n of t) {
|
|
2081
2083
|
if (typeof n != "object" || n === null) continue;
|
|
2082
|
-
const i =
|
|
2084
|
+
const i = P(n);
|
|
2083
2085
|
i !== void 0 && this.add(i, n);
|
|
2084
2086
|
}
|
|
2085
2087
|
}
|
|
2086
2088
|
_findIndex(t) {
|
|
2087
2089
|
for (let n = 0; n < this._items.length; n++) {
|
|
2088
2090
|
const i = this._items[n];
|
|
2089
|
-
if (typeof i == "object" && i !== null &&
|
|
2091
|
+
if (typeof i == "object" && i !== null && P(i) === t)
|
|
2090
2092
|
return n;
|
|
2091
2093
|
}
|
|
2092
2094
|
return -1;
|
|
2093
2095
|
}
|
|
2094
2096
|
}
|
|
2095
|
-
class
|
|
2097
|
+
class Nn {
|
|
2096
2098
|
_notifier;
|
|
2097
2099
|
_value;
|
|
2098
2100
|
_createdKeys;
|
|
@@ -2103,7 +2105,7 @@ class Dn {
|
|
|
2103
2105
|
_onUpdate;
|
|
2104
2106
|
_onDelete;
|
|
2105
2107
|
constructor(t, n, i, r, s, o) {
|
|
2106
|
-
this._notifier =
|
|
2108
|
+
this._notifier = Z(), this._value = i, this._createdKeys = /* @__PURE__ */ new Set(), this._deletedKeys = /* @__PURE__ */ new Set(), this._queryClient = t, this._parent = n, this._onCreate = r, this._onUpdate = s, this._onDelete = o;
|
|
2107
2109
|
}
|
|
2108
2110
|
onEvent(t, n, i, r) {
|
|
2109
2111
|
switch (r) {
|
|
@@ -2133,39 +2135,39 @@ class Dn {
|
|
|
2133
2135
|
append(t) {
|
|
2134
2136
|
}
|
|
2135
2137
|
}
|
|
2136
|
-
function
|
|
2138
|
+
function ve(e, t, n, i, r) {
|
|
2137
2139
|
let s = e.constraintFieldRefs;
|
|
2138
2140
|
if (s === void 0) {
|
|
2139
2141
|
s = /* @__PURE__ */ new Map();
|
|
2140
2142
|
for (const f of e.entityDefs) {
|
|
2141
|
-
const
|
|
2142
|
-
|
|
2143
|
+
const l = f.typenameValue;
|
|
2144
|
+
l !== void 0 && s.set(l, [[he, n.key]]);
|
|
2143
2145
|
}
|
|
2144
2146
|
}
|
|
2145
|
-
const o =
|
|
2147
|
+
const o = On(s, i) ?? /* @__PURE__ */ new Map();
|
|
2146
2148
|
let a;
|
|
2147
|
-
if (e.type ===
|
|
2148
|
-
let f,
|
|
2149
|
+
if (e.type === ht.Array) {
|
|
2150
|
+
let f, l;
|
|
2149
2151
|
if (e.constraintFieldRefs !== void 0 && o.size > 0 && o.size === 1)
|
|
2150
2152
|
for (const [u] of e.constraintFieldRefs) {
|
|
2151
|
-
const
|
|
2152
|
-
if (
|
|
2153
|
-
|
|
2153
|
+
const h = o.get(u);
|
|
2154
|
+
if (h !== void 0) {
|
|
2155
|
+
l = h;
|
|
2154
2156
|
const g = e.constraintFieldRefs.get(u);
|
|
2155
|
-
g !== void 0 && (f =
|
|
2157
|
+
g !== void 0 && (f = Cn(g.map(([p]) => p)));
|
|
2156
2158
|
break;
|
|
2157
2159
|
}
|
|
2158
2160
|
}
|
|
2159
|
-
a = new
|
|
2161
|
+
a = new An(
|
|
2160
2162
|
r,
|
|
2161
2163
|
n,
|
|
2162
2164
|
Array.isArray(t) ? t : [],
|
|
2163
2165
|
f,
|
|
2164
|
-
|
|
2166
|
+
l,
|
|
2165
2167
|
e.sort
|
|
2166
2168
|
);
|
|
2167
2169
|
} else
|
|
2168
|
-
a = new
|
|
2170
|
+
a = new Nn(
|
|
2169
2171
|
r,
|
|
2170
2172
|
n,
|
|
2171
2173
|
t,
|
|
@@ -2183,22 +2185,22 @@ function me(e, t, n, i, r) {
|
|
|
2183
2185
|
);
|
|
2184
2186
|
return n.liveCollections.push(c), r.registerLiveCollection(c), c;
|
|
2185
2187
|
}
|
|
2186
|
-
const
|
|
2187
|
-
function
|
|
2188
|
+
const me = Object.entries, _e = Object.prototype;
|
|
2189
|
+
function rt(e, t, n, i = !1) {
|
|
2188
2190
|
const r = e.queryClient;
|
|
2189
2191
|
r.currentParseId++;
|
|
2190
2192
|
const s = e.seen, o = /* @__PURE__ */ new Map();
|
|
2191
|
-
return { data:
|
|
2193
|
+
return { data: G(t, s, r, n, o, i), entityRefs: o };
|
|
2192
2194
|
}
|
|
2193
|
-
function
|
|
2195
|
+
function G(e, t, n, i, r, s) {
|
|
2194
2196
|
if (typeof e != "object" || e === null) return e;
|
|
2195
2197
|
const o = t.get(e);
|
|
2196
2198
|
if (o !== void 0)
|
|
2197
|
-
return
|
|
2199
|
+
return Dn(o, t, n, i, r, s);
|
|
2198
2200
|
if (Array.isArray(e)) {
|
|
2199
2201
|
for (let a = 0; a < e.length; a++) {
|
|
2200
2202
|
const c = e[a];
|
|
2201
|
-
typeof c == "object" && c !== null && !(c instanceof
|
|
2203
|
+
typeof c == "object" && c !== null && !(c instanceof Y) && !S.has(c) && (e[a] = G(c, t, n, i, r, s));
|
|
2202
2204
|
}
|
|
2203
2205
|
return e;
|
|
2204
2206
|
}
|
|
@@ -2206,51 +2208,51 @@ function Y(e, t, n, i, r, s) {
|
|
|
2206
2208
|
const a = e;
|
|
2207
2209
|
for (const c of Object.keys(a)) {
|
|
2208
2210
|
const f = a[c];
|
|
2209
|
-
typeof f == "object" && f !== null && !(f instanceof
|
|
2211
|
+
typeof f == "object" && f !== null && !(f instanceof Y) && !S.has(f) && (a[c] = G(f, t, n, i, r, s));
|
|
2210
2212
|
}
|
|
2211
2213
|
}
|
|
2212
2214
|
return e;
|
|
2213
2215
|
}
|
|
2214
2216
|
function we(e) {
|
|
2215
|
-
return typeof e == "object" && e !== null && !(e instanceof
|
|
2217
|
+
return typeof e == "object" && e !== null && !(e instanceof Y) && !S.has(e);
|
|
2216
2218
|
}
|
|
2217
|
-
function
|
|
2218
|
-
const { key: o, data: a, shape: c, rawKeys: f } = e,
|
|
2219
|
+
function Dn(e, t, n, i, r, s) {
|
|
2220
|
+
const { key: o, data: a, shape: c, rawKeys: f } = e, l = c.shape, u = n.prepareEntity(o, a, c), h = u.data, g = h !== a, p = g && f !== void 0 && u.entityRefs !== void 0 ? new Map(u.entityRefs) : /* @__PURE__ */ new Map();
|
|
2219
2221
|
if (g ? (Ee(
|
|
2220
|
-
h,
|
|
2221
|
-
a,
|
|
2222
2222
|
l,
|
|
2223
|
+
a,
|
|
2224
|
+
h,
|
|
2223
2225
|
f,
|
|
2224
2226
|
u,
|
|
2225
|
-
|
|
2227
|
+
h,
|
|
2226
2228
|
t,
|
|
2227
2229
|
n,
|
|
2228
2230
|
i,
|
|
2229
2231
|
p,
|
|
2230
2232
|
s
|
|
2231
|
-
), u.notify()) : be(
|
|
2232
|
-
for (const
|
|
2233
|
-
const O =
|
|
2233
|
+
), u.notify()) : be(l, a, u, a, t, n, i, p, s), s && u.liveCollections.length > 0)
|
|
2234
|
+
for (const m of u.liveCollections) {
|
|
2235
|
+
const O = m.instance.getRawValue();
|
|
2234
2236
|
if (Array.isArray(O))
|
|
2235
|
-
for (const
|
|
2236
|
-
if (typeof
|
|
2237
|
-
const R = S.get(
|
|
2237
|
+
for (const T of O) {
|
|
2238
|
+
if (typeof T != "object" || T === null) continue;
|
|
2239
|
+
const R = S.get(T);
|
|
2238
2240
|
if (R === void 0) continue;
|
|
2239
|
-
const
|
|
2240
|
-
|
|
2241
|
+
const U = n.entityMap.getEntity(R);
|
|
2242
|
+
U !== void 0 && p.set(U, (p.get(U) ?? 0) + 1);
|
|
2241
2243
|
}
|
|
2242
2244
|
}
|
|
2243
2245
|
u.setChildRefs(p.size > 0 ? p : void 0, i);
|
|
2244
|
-
const
|
|
2245
|
-
return r.set(u, (r.get(u) ?? 0) + 1),
|
|
2246
|
+
const _ = u.getProxy(c);
|
|
2247
|
+
return r.set(u, (r.get(u) ?? 0) + 1), _;
|
|
2246
2248
|
}
|
|
2247
|
-
function Ee(e, t, n, i, r, s, o, a, c, f,
|
|
2248
|
-
for (const [u,
|
|
2249
|
+
function Ee(e, t, n, i, r, s, o, a, c, f, l) {
|
|
2250
|
+
for (const [u, h] of me(e))
|
|
2249
2251
|
if (!(i !== void 0 && !i.has(u)))
|
|
2250
|
-
if (we(t[u]) && (t[u] =
|
|
2252
|
+
if (we(t[u]) && (t[u] = G(t[u], o, a, c, f, l)), h instanceof v && h._liveConfig !== void 0) {
|
|
2251
2253
|
const g = n[u];
|
|
2252
|
-
g instanceof ge ?
|
|
2253
|
-
|
|
2254
|
+
g instanceof ge ? l ? g.append(t[u]) : g.reset(t[u]) : n[u] = ve(
|
|
2255
|
+
h._liveConfig,
|
|
2254
2256
|
t[u],
|
|
2255
2257
|
r,
|
|
2256
2258
|
s,
|
|
@@ -2258,11 +2260,11 @@ function Ee(e, t, n, i, r, s, o, a, c, f, h) {
|
|
|
2258
2260
|
);
|
|
2259
2261
|
} else {
|
|
2260
2262
|
const g = t[u], p = n[u];
|
|
2261
|
-
if (
|
|
2262
|
-
const
|
|
2263
|
-
if (
|
|
2263
|
+
if (lt(g) && lt(p)) {
|
|
2264
|
+
const _ = h instanceof v && h.shape !== void 0 ? h.shape : void 0;
|
|
2265
|
+
if (_ !== void 0)
|
|
2264
2266
|
Ee(
|
|
2265
|
-
|
|
2267
|
+
_,
|
|
2266
2268
|
g,
|
|
2267
2269
|
p,
|
|
2268
2270
|
void 0,
|
|
@@ -2272,22 +2274,22 @@ function Ee(e, t, n, i, r, s, o, a, c, f, h) {
|
|
|
2272
2274
|
a,
|
|
2273
2275
|
c,
|
|
2274
2276
|
f,
|
|
2275
|
-
|
|
2277
|
+
l
|
|
2276
2278
|
);
|
|
2277
2279
|
else
|
|
2278
|
-
for (const
|
|
2279
|
-
p[
|
|
2280
|
+
for (const m of Object.keys(g))
|
|
2281
|
+
p[m] = g[m];
|
|
2280
2282
|
n[u] = p;
|
|
2281
2283
|
} else
|
|
2282
2284
|
n[u] = g;
|
|
2283
2285
|
}
|
|
2284
2286
|
}
|
|
2285
2287
|
function be(e, t, n, i, r, s, o, a, c) {
|
|
2286
|
-
for (const [f,
|
|
2288
|
+
for (const [f, l] of me(e))
|
|
2287
2289
|
if (f in t)
|
|
2288
|
-
if (we(t[f]) && (t[f] =
|
|
2289
|
-
t[f] =
|
|
2290
|
-
|
|
2290
|
+
if (we(t[f]) && (t[f] = G(t[f], r, s, o, a, c)), l instanceof v && l._liveConfig !== void 0)
|
|
2291
|
+
t[f] = ve(
|
|
2292
|
+
l._liveConfig,
|
|
2291
2293
|
t[f],
|
|
2292
2294
|
n,
|
|
2293
2295
|
i,
|
|
@@ -2295,32 +2297,32 @@ function be(e, t, n, i, r, s, o, a, c) {
|
|
|
2295
2297
|
);
|
|
2296
2298
|
else {
|
|
2297
2299
|
const u = t[f];
|
|
2298
|
-
if (
|
|
2299
|
-
const
|
|
2300
|
-
|
|
2300
|
+
if (lt(u)) {
|
|
2301
|
+
const h = l instanceof v && l.shape !== void 0 ? l.shape : void 0;
|
|
2302
|
+
h !== void 0 && be(h, u, n, i, r, s, o, a, c);
|
|
2301
2303
|
}
|
|
2302
2304
|
}
|
|
2303
2305
|
}
|
|
2304
|
-
function
|
|
2306
|
+
function lt(e) {
|
|
2305
2307
|
return typeof e == "object" && e !== null && !Array.isArray(e) && Object.getPrototypeOf(e) === _e && !S.has(e);
|
|
2306
2308
|
}
|
|
2307
|
-
function
|
|
2309
|
+
function Kn(e) {
|
|
2308
2310
|
if (e !== void 0)
|
|
2309
2311
|
return typeof e == "string" ? e : typeof e == "function" ? e() : e.value;
|
|
2310
2312
|
}
|
|
2311
|
-
function
|
|
2313
|
+
function In(e) {
|
|
2312
2314
|
return xe(e);
|
|
2313
2315
|
}
|
|
2314
|
-
function
|
|
2316
|
+
function $t(e) {
|
|
2315
2317
|
if (e === void 0)
|
|
2316
2318
|
return;
|
|
2317
2319
|
const t = {};
|
|
2318
2320
|
for (const [n, i] of Object.entries(e))
|
|
2319
|
-
|
|
2321
|
+
In(i) ? t[n] = i.value : t[n] = i;
|
|
2320
2322
|
return t;
|
|
2321
2323
|
}
|
|
2322
|
-
const
|
|
2323
|
-
class
|
|
2324
|
+
const St = (e, t) => N([e.statics.id, t]);
|
|
2325
|
+
class Bn {
|
|
2324
2326
|
entityMap;
|
|
2325
2327
|
queryInstances = /* @__PURE__ */ new Map();
|
|
2326
2328
|
mutationInstances = /* @__PURE__ */ new Map();
|
|
@@ -2337,7 +2339,7 @@ class Qn {
|
|
|
2337
2339
|
networkUnsubscribe;
|
|
2338
2340
|
constructor(t = {}) {
|
|
2339
2341
|
const {
|
|
2340
|
-
store: n = new
|
|
2342
|
+
store: n = new Ie(new Fe()),
|
|
2341
2343
|
log: i,
|
|
2342
2344
|
evictionMultiplier: r,
|
|
2343
2345
|
adapters: s,
|
|
@@ -2345,15 +2347,15 @@ class Qn {
|
|
|
2345
2347
|
gcManager: a,
|
|
2346
2348
|
...c
|
|
2347
2349
|
} = t;
|
|
2348
|
-
this.isServer = typeof window > "u", this.store = n, this.context = { ...c, log: i ?? console, evictionMultiplier: r }, this.gcManager = t.gcManager ?? (this.isServer ? new
|
|
2350
|
+
this.isServer = typeof window > "u", this.store = n, this.context = { ...c, log: i ?? console, evictionMultiplier: r }, this.gcManager = t.gcManager ?? (this.isServer ? new Te() : new Me(this.handleEviction, r)), this.networkManager = t.networkManager ?? new ue(), this.entityMap = new mn((u, h, g) => this.store.saveEntity(u, h, g));
|
|
2349
2351
|
for (const u of t.adapters ?? [])
|
|
2350
2352
|
this.adapters.set(u.constructor, u), u.register(this);
|
|
2351
|
-
const f = this.networkManager.getOnlineSignal(),
|
|
2352
|
-
this.networkUnsubscribe =
|
|
2353
|
+
const f = this.networkManager.getOnlineSignal(), l = Ae(() => f.value);
|
|
2354
|
+
this.networkUnsubscribe = l.addListener(
|
|
2353
2355
|
() => {
|
|
2354
2356
|
const u = f.value;
|
|
2355
|
-
for (const
|
|
2356
|
-
|
|
2357
|
+
for (const h of this.adapters.values())
|
|
2358
|
+
h.onNetworkStatusChange?.(u);
|
|
2357
2359
|
},
|
|
2358
2360
|
{ skipInitial: !0 }
|
|
2359
2361
|
), this.store.purgeStaleQueries?.();
|
|
@@ -2424,7 +2426,7 @@ class Qn {
|
|
|
2424
2426
|
if (n !== void 0) return n;
|
|
2425
2427
|
const i = this.typenameRegistry.get(t);
|
|
2426
2428
|
if (i !== void 0)
|
|
2427
|
-
return n =
|
|
2429
|
+
return n = v.merge(i), this.mergedDefCache.set(t, n), n;
|
|
2428
2430
|
}
|
|
2429
2431
|
saveQueryData(t, n, i, r, s) {
|
|
2430
2432
|
const o = s !== void 0 && s.size > 0 ? new Set([...s.keys()].map((a) => a.key)) : void 0;
|
|
@@ -2433,7 +2435,7 @@ class Qn {
|
|
|
2433
2435
|
activateQuery(t) {
|
|
2434
2436
|
const { def: n, queryKey: i, storageKey: r, config: s } = t;
|
|
2435
2437
|
this.store.activateQuery(n, r);
|
|
2436
|
-
const o = s?.gcTime ??
|
|
2438
|
+
const o = s?.gcTime ?? Vt;
|
|
2437
2439
|
this.gcManager.cancel(i, o);
|
|
2438
2440
|
}
|
|
2439
2441
|
loadCachedQuery(t, n) {
|
|
@@ -2444,9 +2446,9 @@ class Qn {
|
|
|
2444
2446
|
* that triggers fetches and prepopulates with cached data
|
|
2445
2447
|
*/
|
|
2446
2448
|
getQuery(t, n) {
|
|
2447
|
-
const i =
|
|
2449
|
+
const i = St(t, n);
|
|
2448
2450
|
let r = this.queryInstances.get(i);
|
|
2449
|
-
return r === void 0 && (r = new
|
|
2451
|
+
return r === void 0 && (r = new wn(t, this, i, n), this.queryInstances.set(i, r)), r.relay;
|
|
2450
2452
|
}
|
|
2451
2453
|
/**
|
|
2452
2454
|
* Gets or creates a MutationResult for the given mutation definition.
|
|
@@ -2455,7 +2457,7 @@ class Qn {
|
|
|
2455
2457
|
getMutation(t) {
|
|
2456
2458
|
const n = t.id;
|
|
2457
2459
|
let i = this.mutationInstances.get(n);
|
|
2458
|
-
return i === void 0 && (i = new
|
|
2460
|
+
return i === void 0 && (i = new En(t, this), this.mutationInstances.set(n, i)), i.task;
|
|
2459
2461
|
}
|
|
2460
2462
|
/**
|
|
2461
2463
|
* Parse data: validates, formats, produces parsed entity data objects.
|
|
@@ -2463,8 +2465,8 @@ class Qn {
|
|
|
2463
2465
|
*/
|
|
2464
2466
|
parseData(t, n, i) {
|
|
2465
2467
|
const r = this.context.log?.warn ?? (() => {
|
|
2466
|
-
}), s = new
|
|
2467
|
-
return s.reset(this, i, r), { data:
|
|
2468
|
+
}), s = new ft();
|
|
2469
|
+
return s.reset(this, i, r), { data: oe(t, n, s), ctx: s };
|
|
2468
2470
|
}
|
|
2469
2471
|
/**
|
|
2470
2472
|
* Apply entities from parseData() via a single depth-first walk: creates/
|
|
@@ -2472,7 +2474,7 @@ class Qn {
|
|
|
2472
2474
|
* refs. Returns the reified data and root-level entity refs.
|
|
2473
2475
|
*/
|
|
2474
2476
|
applyRefs(t, n = !0, i = !1) {
|
|
2475
|
-
return
|
|
2477
|
+
return rt(t.ctx, t.data, n, i);
|
|
2476
2478
|
}
|
|
2477
2479
|
/**
|
|
2478
2480
|
* Parse and apply data as a root entity. For non-entity results, injects
|
|
@@ -2480,8 +2482,8 @@ class Qn {
|
|
|
2480
2482
|
* found in the store by the standard entity pipeline).
|
|
2481
2483
|
*/
|
|
2482
2484
|
parseAndApplyRootEntity(t, n, i, r, s = !1, o) {
|
|
2483
|
-
typeof i.idField == "symbol" && typeof t == "object" && t !== null && !("__entityRef" in t) && (t[
|
|
2484
|
-
const a = this.parseData(t, i, o), c =
|
|
2485
|
+
typeof i.idField == "symbol" && typeof t == "object" && t !== null && !("__entityRef" in t) && (t[Kt] = n);
|
|
2486
|
+
const a = this.parseData(t, i, o), c = rt(a.ctx, a.data, r, s), f = S.get(c.data);
|
|
2485
2487
|
return this.entityMap.getEntity(f);
|
|
2486
2488
|
}
|
|
2487
2489
|
prepareEntity(t, n, i) {
|
|
@@ -2497,55 +2499,55 @@ class Qn {
|
|
|
2497
2499
|
if (s === void 0 || typeof s == "symbol") return;
|
|
2498
2500
|
const o = t.data, a = t.id !== void 0 ? t.id : n === "delete" && (typeof o == "string" || typeof o == "number") ? o : o[s];
|
|
2499
2501
|
if (a === void 0) return;
|
|
2500
|
-
const c = N([i, a]), f = t.__eventSource,
|
|
2502
|
+
const c = N([i, a]), f = t.__eventSource, l = typeof o == "object" && o !== null ? o : {}, u = this.entityMap.getEntity(c);
|
|
2501
2503
|
if (n === "delete") {
|
|
2502
|
-
const
|
|
2503
|
-
this.routeEvent(i,
|
|
2504
|
+
const _ = u !== void 0 ? u.data : l;
|
|
2505
|
+
this.routeEvent(i, _, c, n, f, void 0, _);
|
|
2504
2506
|
return;
|
|
2505
2507
|
}
|
|
2506
2508
|
try {
|
|
2507
|
-
const
|
|
2508
|
-
}),
|
|
2509
|
-
|
|
2509
|
+
const _ = this.context.log?.warn ?? (() => {
|
|
2510
|
+
}), m = new ft();
|
|
2511
|
+
m.reset(
|
|
2510
2512
|
this,
|
|
2511
2513
|
void 0,
|
|
2512
|
-
|
|
2514
|
+
_,
|
|
2513
2515
|
/* isPartialEvent */
|
|
2514
2516
|
!0
|
|
2515
2517
|
);
|
|
2516
|
-
const O =
|
|
2517
|
-
|
|
2518
|
-
} catch (
|
|
2519
|
-
if (this.context.log?.warn?.("Failed to apply mutation event",
|
|
2520
|
-
const
|
|
2521
|
-
|
|
2518
|
+
const O = an(l, r, m);
|
|
2519
|
+
rt(m, O, !0);
|
|
2520
|
+
} catch (_) {
|
|
2521
|
+
if (this.context.log?.warn?.("Failed to apply mutation event", _), u === void 0) {
|
|
2522
|
+
const m = this.entityMap.getEntity(c);
|
|
2523
|
+
m !== void 0 && m.evict();
|
|
2522
2524
|
}
|
|
2523
2525
|
return;
|
|
2524
2526
|
}
|
|
2525
|
-
const
|
|
2526
|
-
if (
|
|
2527
|
-
this.entityMap.save(
|
|
2527
|
+
const h = this.entityMap.getEntity(c);
|
|
2528
|
+
if (h === void 0) return;
|
|
2529
|
+
this.entityMap.save(h);
|
|
2528
2530
|
const g = u === void 0;
|
|
2529
2531
|
let p = !1;
|
|
2530
|
-
this.routeEvent(i,
|
|
2532
|
+
this.routeEvent(i, h.data, c, n, f, () => {
|
|
2531
2533
|
p = !0;
|
|
2532
|
-
}), g && !p &&
|
|
2534
|
+
}), g && !p && h.evict();
|
|
2533
2535
|
}
|
|
2534
2536
|
// ======================================================
|
|
2535
2537
|
// Query Invalidation
|
|
2536
2538
|
// ======================================================
|
|
2537
2539
|
invalidateQueries(t) {
|
|
2538
2540
|
for (const n of t) {
|
|
2539
|
-
const i = Array.isArray(n), r = i ? n[0] : n, s = i ? n[1] : void 0, a =
|
|
2541
|
+
const i = Array.isArray(n), r = i ? n[0] : n, s = i ? n[1] : void 0, a = H.for(r).statics.id;
|
|
2540
2542
|
for (const [, c] of this.queryInstances)
|
|
2541
|
-
c.def.statics.id === a && (s === void 0 ||
|
|
2543
|
+
c.def.statics.id === a && (s === void 0 || kn(c.resolvedParams, s)) && c.markStale();
|
|
2542
2544
|
}
|
|
2543
2545
|
}
|
|
2544
2546
|
// ======================================================
|
|
2545
2547
|
// In-Memory GC
|
|
2546
2548
|
// ======================================================
|
|
2547
2549
|
handleEviction = (t, n) => {
|
|
2548
|
-
if (n ===
|
|
2550
|
+
if (n === tt.Query) {
|
|
2549
2551
|
const r = this.queryInstances.get(t);
|
|
2550
2552
|
if (r === void 0) return;
|
|
2551
2553
|
r.rootEntity?.evict(), this.queryInstances.delete(t);
|
|
@@ -2574,7 +2576,7 @@ class Qn {
|
|
|
2574
2576
|
routeEvent(t, n, i, r, s, o, a) {
|
|
2575
2577
|
const c = this.constraintRegistry.get(t);
|
|
2576
2578
|
if (c === void 0) return;
|
|
2577
|
-
const f = s !== void 0 ? { ...n, [
|
|
2579
|
+
const f = s !== void 0 ? { ...n, [he]: s } : n;
|
|
2578
2580
|
c.routeEvent(t, f, i, r, o, a);
|
|
2579
2581
|
}
|
|
2580
2582
|
destroy() {
|
|
@@ -2584,40 +2586,40 @@ class Qn {
|
|
|
2584
2586
|
this.adapters.clear(), this.queryInstances.clear(), this.mutationInstances.clear(), this.constraintRegistry.clear(), this.typenameRegistry.clear(), this.mergedDefCache.clear();
|
|
2585
2587
|
}
|
|
2586
2588
|
}
|
|
2587
|
-
const Fn =
|
|
2588
|
-
function
|
|
2589
|
+
const Fn = qt(void 0);
|
|
2590
|
+
function kn(e, t) {
|
|
2589
2591
|
if (e === void 0) return !1;
|
|
2590
2592
|
for (const n in t)
|
|
2591
2593
|
if (e[n] !== t[n]) return !1;
|
|
2592
2594
|
return !0;
|
|
2593
2595
|
}
|
|
2594
2596
|
export {
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2597
|
+
F as A,
|
|
2598
|
+
gt as E,
|
|
2599
|
+
Me as G,
|
|
2600
|
+
Q as L,
|
|
2599
2601
|
d as M,
|
|
2600
2602
|
ue as N,
|
|
2601
|
-
|
|
2603
|
+
Kt as Q,
|
|
2602
2604
|
k as R,
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2605
|
+
v as V,
|
|
2606
|
+
ht as a,
|
|
2607
|
+
Ln as b,
|
|
2608
|
+
K as c,
|
|
2609
|
+
Te as d,
|
|
2608
2610
|
de as e,
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
+
Un as f,
|
|
2612
|
+
Bn as g,
|
|
2611
2613
|
Fn as h,
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2614
|
+
_n as i,
|
|
2615
|
+
$n as j,
|
|
2616
|
+
Vn as k,
|
|
2617
|
+
Gt as l,
|
|
2618
|
+
$e as m,
|
|
2619
|
+
X as n,
|
|
2620
|
+
Kn as o,
|
|
2621
|
+
qn as q,
|
|
2622
|
+
ne as r,
|
|
2623
|
+
sn as t
|
|
2622
2624
|
};
|
|
2623
|
-
//# sourceMappingURL=QueryClient-
|
|
2625
|
+
//# sourceMappingURL=QueryClient-BZY2FTv3.js.map
|