@voltro/client 0.59.0 → 0.61.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 +83 -0
- package/dist/index.d.ts +21 -11
- package/dist/index.js +725 -701
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,31 +1,40 @@
|
|
|
1
1
|
import { C as e, S as t, _ as n, a as r, b as i, c as a, d as o, f as s, g as c, h as l, i as u, l as d, m as f, n as p, o as m, p as h, r as g, s as _, t as v, u as y, v as b, w as x, x as S, y as ee } from "./formData-He_L4ozH.js";
|
|
2
2
|
import { createContext as C, createElement as w, useCallback as T, useContext as E, useDebugValue as te, useEffect as D, useMemo as O, useRef as k, useState as A, useSyncExternalStore as j } from "react";
|
|
3
|
-
import { Cause as M, Context as ne, Duration as re, Effect as N, Exit as P, Fiber as F, Layer as I, ManagedRuntime as L,
|
|
3
|
+
import { Cause as M, Context as ne, Duration as re, Effect as N, Exit as P, Fiber as F, Layer as I, ManagedRuntime as L, Option as R, Schedule as z, Schema as ie, Stream as B } from "effect";
|
|
4
4
|
import * as ae from "@effect/platform/Headers";
|
|
5
|
-
import { RpcClient as
|
|
6
|
-
import { applyRowPatch as
|
|
7
|
-
import * as
|
|
8
|
-
import { jsx as
|
|
9
|
-
import { FormApi as
|
|
10
|
-
import { useStore as
|
|
11
|
-
import { ArrayFormatter as
|
|
5
|
+
import { RpcClient as V, RpcClientError as oe, RpcSerialization as se } from "@effect/rpc";
|
|
6
|
+
import { applyRowPatch as H, fieldIssuesOf as ce, pluginTag as le } from "@voltro/protocol";
|
|
7
|
+
import * as ue from "@effect/platform/Socket";
|
|
8
|
+
import { jsx as de } from "react/jsx-runtime";
|
|
9
|
+
import { FormApi as fe } from "@tanstack/form-core";
|
|
10
|
+
import { useStore as pe } from "@tanstack/react-store";
|
|
11
|
+
import { ArrayFormatter as me } from "effect/ParseResult";
|
|
12
12
|
//#region src/traceBus.ts
|
|
13
|
-
var
|
|
14
|
-
for (let t of
|
|
13
|
+
var he = /* @__PURE__ */ new Set(), ge = (e) => {
|
|
14
|
+
for (let t of he) try {
|
|
15
15
|
t(e);
|
|
16
16
|
} catch {}
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
}), U = (e) => {
|
|
17
|
+
}, _e = (e) => (he.add(e), () => {
|
|
18
|
+
he.delete(e);
|
|
19
|
+
}), ve = /* @__PURE__ */ new WeakMap(), ye = (e, t) => ((typeof e == "object" && e || typeof e == "function") && ve.set(e, t), e), U = (e, t) => {
|
|
20
|
+
if ((typeof e != "object" || !e) && typeof e != "function") return t;
|
|
21
|
+
let n = ve.get(e);
|
|
22
|
+
if (n !== void 0) return n;
|
|
23
|
+
try {
|
|
24
|
+
return oe.TypeId in e ? "transport" : t;
|
|
25
|
+
} catch {
|
|
26
|
+
return t;
|
|
27
|
+
}
|
|
28
|
+
}, W = (e) => {
|
|
20
29
|
let t = (e) => e == null ? "null" : typeof e == "string" ? JSON.stringify(e) : typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? `[${e.map(t).join(",")}]` : typeof e == "object" ? `{${Object.keys(e).sort().map((n) => `${JSON.stringify(n)}:${t(e[n])}`).join(",")}}` : String(e);
|
|
21
30
|
return t(e);
|
|
22
|
-
},
|
|
31
|
+
}, be = Object.freeze({
|
|
23
32
|
data: void 0,
|
|
24
33
|
revision: -1,
|
|
25
34
|
emittedAt: void 0,
|
|
26
35
|
error: void 0,
|
|
27
36
|
pendingPatches: 0
|
|
28
|
-
}),
|
|
37
|
+
}), xe = 5e3, Se = (e, t, n) => {
|
|
29
38
|
if (e._tag === "error") return !1;
|
|
30
39
|
if (e._tag === "delta") return !0;
|
|
31
40
|
try {
|
|
@@ -33,21 +42,21 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
33
42
|
} catch {
|
|
34
43
|
return !1;
|
|
35
44
|
}
|
|
36
|
-
},
|
|
45
|
+
}, Ce = 0, we = () => `patch_${++Ce}`, G = (e, t) => {
|
|
37
46
|
let n = e;
|
|
38
47
|
for (let e of t.split(".")) {
|
|
39
48
|
if (typeof n != "object" || !n) return;
|
|
40
49
|
n = n[e];
|
|
41
50
|
}
|
|
42
51
|
return n;
|
|
43
|
-
},
|
|
52
|
+
}, Te = (e, t, n) => {
|
|
44
53
|
let r = t.split("."), i = (e) => typeof e == "object" && e && !Array.isArray(e) ? { ...e } : {}, a = i(e), o = a;
|
|
45
54
|
for (let e = 0; e < r.length - 1; e += 1) o[r[e]] = i(o[r[e]]), o = o[r[e]];
|
|
46
55
|
return o[r[r.length - 1]] = n, a;
|
|
47
|
-
},
|
|
56
|
+
}, Ee = (e, t) => {
|
|
48
57
|
let n = e.by ?? "id", r = e.identify ? e.identify(t) : typeof t[n] == "string" ? t[n] : typeof t.id == "string" ? t.id : void 0, i = r === void 0 ? [] : Array.isArray(r) ? r : [r];
|
|
49
58
|
return i.length === 0 ? null : new Set(i);
|
|
50
|
-
},
|
|
59
|
+
}, De = (e, t, n) => {
|
|
51
60
|
let r = e.path, i = e.by ?? "id";
|
|
52
61
|
if (e.op === "insert") {
|
|
53
62
|
let a = e.shapeItem ?? e.shape, o = a ? {
|
|
@@ -60,11 +69,11 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
60
69
|
optimistic: !0
|
|
61
70
|
}, s = e.order ?? "append";
|
|
62
71
|
return (e) => {
|
|
63
|
-
let t = Array.isArray(
|
|
64
|
-
return
|
|
72
|
+
let t = Array.isArray(G(e, r)) ? G(e, r) : [];
|
|
73
|
+
return Te(e ?? {}, r, s === "append" ? [...t, o] : [o, ...t]);
|
|
65
74
|
};
|
|
66
75
|
}
|
|
67
|
-
let a =
|
|
76
|
+
let a = Ee(e, t);
|
|
68
77
|
if (a === null) return null;
|
|
69
78
|
if (e.op === "update") {
|
|
70
79
|
let n = e.shapeItem ?? e.shape, o = n ? (e) => ({
|
|
@@ -78,24 +87,24 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
78
87
|
optimistic: !0
|
|
79
88
|
});
|
|
80
89
|
return (e) => {
|
|
81
|
-
let t =
|
|
90
|
+
let t = G(e, r);
|
|
82
91
|
if (!Array.isArray(t)) {
|
|
83
92
|
if (typeof t != "object" || !t) return e;
|
|
84
93
|
let n = t;
|
|
85
|
-
return a.has(n[i]) ?
|
|
94
|
+
return a.has(n[i]) ? Te(e, r, o(n)) : e;
|
|
86
95
|
}
|
|
87
|
-
return
|
|
96
|
+
return Te(e, r, t.map((e) => a.has(e[i]) ? o(e) : e));
|
|
88
97
|
};
|
|
89
98
|
}
|
|
90
99
|
return (e) => {
|
|
91
|
-
let t = Array.isArray(
|
|
92
|
-
return
|
|
100
|
+
let t = Array.isArray(G(e, r)) ? G(e, r) : [];
|
|
101
|
+
return Te(e, r, t.filter((e) => !a.has(e[i])));
|
|
93
102
|
};
|
|
94
|
-
},
|
|
103
|
+
}, Oe = (e, t, n) => {
|
|
95
104
|
if (e.op === "insert") return n;
|
|
96
105
|
let r = t.id;
|
|
97
106
|
return typeof r == "string" && r.length > 0 ? r : null;
|
|
98
|
-
},
|
|
107
|
+
}, ke = (e, t, n, r) => {
|
|
99
108
|
let { anchorColumn: i, targetColumn: a } = e, o = new Set(n.map((e) => String(e)));
|
|
100
109
|
return (e) => {
|
|
101
110
|
if (!Array.isArray(e)) return e;
|
|
@@ -126,8 +135,8 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
126
135
|
}));
|
|
127
136
|
return c ? n : e;
|
|
128
137
|
};
|
|
129
|
-
},
|
|
130
|
-
if (e.path !== void 0) return
|
|
138
|
+
}, Ae = (e, t, n) => {
|
|
139
|
+
if (e.path !== void 0) return De(e, t, n);
|
|
131
140
|
switch (e.op) {
|
|
132
141
|
case "insert": {
|
|
133
142
|
let r = e.shape ? {
|
|
@@ -145,7 +154,7 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
145
154
|
};
|
|
146
155
|
}
|
|
147
156
|
case "update": {
|
|
148
|
-
let n =
|
|
157
|
+
let n = Ee(e, t);
|
|
149
158
|
if (n === null) return null;
|
|
150
159
|
let r = e.shape, i = r ? (e) => ({
|
|
151
160
|
...r(t, e),
|
|
@@ -168,7 +177,7 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
168
177
|
};
|
|
169
178
|
}
|
|
170
179
|
case "delete": {
|
|
171
|
-
let n =
|
|
180
|
+
let n = Ee(e, t);
|
|
172
181
|
return n === null ? null : (e) => {
|
|
173
182
|
if (!Array.isArray(e)) {
|
|
174
183
|
let t = e;
|
|
@@ -178,7 +187,7 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
178
187
|
};
|
|
179
188
|
}
|
|
180
189
|
}
|
|
181
|
-
},
|
|
190
|
+
}, je = 5e3, Me = class {
|
|
182
191
|
entries = /* @__PURE__ */ new Map();
|
|
183
192
|
inactiveTtlMs;
|
|
184
193
|
onChangeHook;
|
|
@@ -186,20 +195,20 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
186
195
|
mirror;
|
|
187
196
|
mergeCell;
|
|
188
197
|
constructor(e = {}) {
|
|
189
|
-
this.inactiveTtlMs = e.inactiveTtlMs ??
|
|
198
|
+
this.inactiveTtlMs = e.inactiveTtlMs ?? je, this.onChangeHook = e.onChange, this.errorBus = e.errorBus, this.mirror = e.mirror, this.mergeCell = e.mergeCell;
|
|
190
199
|
}
|
|
191
200
|
subscribe(e, t, n, r, i = {}) {
|
|
192
|
-
let a =
|
|
201
|
+
let a = W(e), o = typeof e[0] == "string" ? e[0] : void 0, s = this.entries.get(a);
|
|
193
202
|
return s && s.evictionTimer !== null && (clearTimeout(s.evictionTimer), s.evictionTimer = null), s ? (s.fiber === null && (s.fetch = t, s.runtime = n, this.startFiber(s, t, n)), s.source === void 0 && i.source !== void 0 && (s.source = i.source)) : s = this.create(a, o, t, n, i.source), s.subscribers.add(r), {
|
|
194
203
|
getSnapshot: () => this.getSnapshot(a),
|
|
195
204
|
unsubscribe: () => this.unsubscribe(a, r)
|
|
196
205
|
};
|
|
197
206
|
}
|
|
198
207
|
update(e, t, n) {
|
|
199
|
-
let r =
|
|
208
|
+
let r = W(e), i = typeof e[0] == "string" ? e[0] : void 0, a = this.entries.get(r);
|
|
200
209
|
a ||= this.createStub(r, i);
|
|
201
210
|
let o = {
|
|
202
|
-
id:
|
|
211
|
+
id: we(),
|
|
203
212
|
mutationId: n,
|
|
204
213
|
reducer: t
|
|
205
214
|
};
|
|
@@ -213,7 +222,7 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
213
222
|
for (let i of this.entries.values()) {
|
|
214
223
|
if (i.tag !== e) continue;
|
|
215
224
|
let a = {
|
|
216
|
-
id: `forTag-${++
|
|
225
|
+
id: `forTag-${++Ce}`,
|
|
217
226
|
mutationId: n,
|
|
218
227
|
reducer: t
|
|
219
228
|
};
|
|
@@ -230,16 +239,17 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
230
239
|
confirmByMutation(e) {
|
|
231
240
|
let t = !1;
|
|
232
241
|
for (let n of this.entries.values()) for (let r of n.state.patches) r.mutationId === e && r.confirmed !== !0 && (r.confirmed = !0, t = !0);
|
|
233
|
-
t && setTimeout(() => this.resyncUnechoedMutation(e),
|
|
242
|
+
t && setTimeout(() => this.resyncUnechoedMutation(e), xe);
|
|
234
243
|
}
|
|
235
244
|
resyncUnechoedMutation(e) {
|
|
236
245
|
for (let t of this.entries.values()) {
|
|
237
246
|
if (!t.state.patches.some((t) => t.mutationId === e && t.confirmed === !0)) continue;
|
|
238
|
-
let n = t.tag ?? t.key, r = `optimistic patch for ${n} got no superseding server event within ${
|
|
247
|
+
let n = t.tag ?? t.key, r = `optimistic patch for ${n} got no superseding server event within ${xe}ms — the write is confirmed, so the preview is KEPT. Check reactivity for this query's source table.`;
|
|
239
248
|
this.errorBus?.emit({
|
|
240
249
|
source: "subscription",
|
|
241
250
|
tag: n,
|
|
242
251
|
error: Error(r),
|
|
252
|
+
kind: "client",
|
|
243
253
|
...t.traceId === void 0 ? {} : { traceId: t.traceId }
|
|
244
254
|
}), console.warn(`[voltro] ${r}`, {
|
|
245
255
|
mutationId: e,
|
|
@@ -248,7 +258,7 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
248
258
|
}
|
|
249
259
|
}
|
|
250
260
|
autoApply(e, t, n) {
|
|
251
|
-
let r = `optimistic-${n}-${++
|
|
261
|
+
let r = `optimistic-${n}-${++Ce}`;
|
|
252
262
|
for (let i of e) {
|
|
253
263
|
for (let e of this.entries.values()) {
|
|
254
264
|
if (!(Array.isArray(e.source) ? e.source.includes(i.table) : e.source === i.table)) continue;
|
|
@@ -262,7 +272,7 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
262
272
|
if (!n) continue;
|
|
263
273
|
}
|
|
264
274
|
if (e.computed && i.op === "insert" && i.path === void 0) continue;
|
|
265
|
-
let a =
|
|
275
|
+
let a = Ae(i, t, r);
|
|
266
276
|
if (a === null) continue;
|
|
267
277
|
let o = {
|
|
268
278
|
id: `${r}-${e.key}`,
|
|
@@ -275,10 +285,10 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
275
285
|
if (e !== void 0) for (let [a, o] of Object.entries(e)) {
|
|
276
286
|
let e = t[a];
|
|
277
287
|
if (!Array.isArray(e)) continue;
|
|
278
|
-
let s =
|
|
288
|
+
let s = Oe(i, t, r);
|
|
279
289
|
if (s !== null) for (let t of this.entries.values()) {
|
|
280
290
|
if (!(Array.isArray(t.source) ? t.source.includes(o.junction) : t.source === o.junction) || t.computed) continue;
|
|
281
|
-
let i =
|
|
291
|
+
let i = ke(o, s, e.map((e) => String(e)), `${r}-${a}`);
|
|
282
292
|
t.state.patches.push({
|
|
283
293
|
id: `${r}-${a}-${t.key}`,
|
|
284
294
|
mutationId: n,
|
|
@@ -295,10 +305,10 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
295
305
|
n.state.patches = n.state.patches.filter((e) => e.id !== t), n.state.patches.length !== r && this.invalidate(n);
|
|
296
306
|
}
|
|
297
307
|
peek(e) {
|
|
298
|
-
return this.getSnapshot(
|
|
308
|
+
return this.getSnapshot(W(e));
|
|
299
309
|
}
|
|
300
310
|
getEntry(e) {
|
|
301
|
-
return this.entries.get(
|
|
311
|
+
return this.entries.get(W(e));
|
|
302
312
|
}
|
|
303
313
|
size() {
|
|
304
314
|
return this.entries.size;
|
|
@@ -399,12 +409,12 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
399
409
|
};
|
|
400
410
|
}
|
|
401
411
|
startFiber(e, t, n) {
|
|
402
|
-
let r = e.tag ?? e.key, i = t(), a =
|
|
412
|
+
let r = e.tag ?? e.key, i = t(), a = B.unwrapScoped(N.currentSpan.pipe(N.catchAll(() => N.succeed(void 0)), N.map((t) => (t && (e.traceId = t.traceId, ge({
|
|
403
413
|
traceId: t.traceId,
|
|
404
414
|
spanId: t.spanId,
|
|
405
415
|
source: "subscription",
|
|
406
416
|
tag: r
|
|
407
|
-
})), i)))).pipe(
|
|
417
|
+
})), i)))).pipe(B.withSpan(`client.subscription.${r}`, { attributes: { "rpc.tag": r } })), o = e.state.baseRevision >= 0 ? e.state.baseRevision : void 0, s = a.pipe(B.runForEach((t) => N.sync(() => {
|
|
408
418
|
let n = e.state.base;
|
|
409
419
|
if (t._tag === "snapshot") e.state.base = t.data, e.state.baseRevision = t.revision, e.state.baseEmittedAt = void 0, e.state.baseError = void 0, this.errorBus?.emitSuccess({
|
|
410
420
|
source: "subscription",
|
|
@@ -413,21 +423,22 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
413
423
|
else if (t._tag === "error") e.state.baseError = M.fail(t.error), typeof t.revision == "number" && (e.state.baseRevision = t.revision);
|
|
414
424
|
else {
|
|
415
425
|
let n = e.state.base;
|
|
416
|
-
Array.isArray(n) && (e.state.base =
|
|
426
|
+
Array.isArray(n) && (e.state.base = H(n, t.patch, this.mergeCell === void 0 ? {} : { mergeCell: this.mergeCell })), e.state.baseRevision = t.revision, e.state.baseEmittedAt = t.emittedAt, e.state.baseError = void 0;
|
|
417
427
|
}
|
|
418
|
-
e.state.patches.some((e) => e.confirmed === !0) &&
|
|
428
|
+
e.state.patches.some((e) => e.confirmed === !0) && Se(t, n, e.state.base) && (e.state.patches = e.state.patches.filter((e) => e.confirmed !== !0)), this.mirror !== void 0 && t._tag !== "error" && this.mirror.save(e.key, {
|
|
419
429
|
tag: e.tag,
|
|
420
430
|
data: e.state.base,
|
|
421
431
|
revision: e.state.baseRevision
|
|
422
432
|
}).catch(() => {}), this.invalidate(e);
|
|
423
433
|
})));
|
|
424
|
-
e.fiber = n.runFork(o === void 0 ? s : s.pipe(N.locallyWith(
|
|
434
|
+
e.fiber = n.runFork(o === void 0 ? s : s.pipe(N.locallyWith(V.currentHeaders, (e) => ae.set(e, "voltro-resume-from", String(o))))), e.fiber.addObserver((t) => {
|
|
425
435
|
if (P.isFailure(t) && !P.isInterrupted(t) && (e.state.baseRevision === -1 && (e.state.baseError = t.cause, this.invalidate(e)), this.errorBus)) {
|
|
426
|
-
let n = M.squash(t.cause);
|
|
436
|
+
let n = M.squash(t.cause), r = M.failureOption(t.cause);
|
|
427
437
|
this.errorBus.emit({
|
|
428
438
|
source: "subscription",
|
|
429
439
|
tag: e.tag ?? e.key,
|
|
430
440
|
error: n,
|
|
441
|
+
kind: R.isSome(r) ? U(r.value, "handler") : "unknown",
|
|
431
442
|
...e.traceId === void 0 ? {} : { traceId: e.traceId }
|
|
432
443
|
});
|
|
433
444
|
}
|
|
@@ -440,7 +451,7 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
440
451
|
}
|
|
441
452
|
getSnapshot(e) {
|
|
442
453
|
let t = this.entries.get(e);
|
|
443
|
-
if (!t) return
|
|
454
|
+
if (!t) return be;
|
|
444
455
|
if (t.state.cachedSnapshot !== null) return t.state.cachedSnapshot;
|
|
445
456
|
let n = t.state.base;
|
|
446
457
|
if (n !== void 0 && t.state.patches.length > 0) for (let e of t.state.patches) n = e.reducer(n);
|
|
@@ -463,26 +474,26 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
463
474
|
t && t.subscribers.size === 0 && (t.fiber && N.runFork(F.interrupt(t.fiber)), this.entries.delete(e.key));
|
|
464
475
|
}, this.inactiveTtlMs);
|
|
465
476
|
}
|
|
466
|
-
},
|
|
477
|
+
}, Ne = class extends Me {
|
|
467
478
|
subscribe(e, t, n, r, i = {}) {
|
|
468
479
|
return {
|
|
469
480
|
getSnapshot: () => this.peek(e),
|
|
470
481
|
unsubscribe: () => {}
|
|
471
482
|
};
|
|
472
483
|
}
|
|
473
|
-
},
|
|
474
|
-
for (let t of
|
|
484
|
+
}, Pe = /* @__PURE__ */ new Set(), Fe = (e) => {
|
|
485
|
+
for (let t of Pe) try {
|
|
475
486
|
t(e);
|
|
476
487
|
} catch {}
|
|
477
|
-
},
|
|
478
|
-
|
|
479
|
-
}),
|
|
480
|
-
|
|
488
|
+
}, Ie = (e) => (Pe.add(e), () => {
|
|
489
|
+
Pe.delete(e);
|
|
490
|
+
}), Le = (e, t) => {
|
|
491
|
+
Fe({
|
|
481
492
|
error: e,
|
|
482
493
|
source: "manual",
|
|
483
494
|
...t ? { context: t } : {}
|
|
484
495
|
});
|
|
485
|
-
},
|
|
496
|
+
}, Re = class {
|
|
486
497
|
#e = /* @__PURE__ */ new Set();
|
|
487
498
|
#t = /* @__PURE__ */ new Set();
|
|
488
499
|
on(e) {
|
|
@@ -494,11 +505,12 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
494
505
|
for (let t of this.#e) try {
|
|
495
506
|
t(e);
|
|
496
507
|
} catch {}
|
|
497
|
-
|
|
508
|
+
Fe({
|
|
498
509
|
error: e.error,
|
|
499
510
|
source: `rpc.${e.source}`,
|
|
500
511
|
context: {
|
|
501
512
|
rpcTag: e.tag,
|
|
513
|
+
rpcErrorKind: e.kind,
|
|
502
514
|
...e.traceId === void 0 ? {} : { traceId: e.traceId }
|
|
503
515
|
}
|
|
504
516
|
});
|
|
@@ -513,60 +525,60 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
513
525
|
t(e);
|
|
514
526
|
} catch {}
|
|
515
527
|
}
|
|
516
|
-
},
|
|
528
|
+
}, ze = C(null), Be = () => {
|
|
517
529
|
throw Error("Voltro: rpc / cache calls are not invokable on a not-yet-resolved api — either during SSR, or in the client boot window before the api client resolves");
|
|
518
|
-
},
|
|
519
|
-
get: (e, t) =>
|
|
530
|
+
}, Ve = new Proxy(() => Be(), {
|
|
531
|
+
get: (e, t) => Ve,
|
|
520
532
|
has: () => !0,
|
|
521
|
-
apply: () =>
|
|
522
|
-
}),
|
|
523
|
-
|
|
524
|
-
},
|
|
525
|
-
|
|
526
|
-
},
|
|
533
|
+
apply: () => Be()
|
|
534
|
+
}), He = Symbol.for("@voltro/client/ssrDescriptors"), Ue = globalThis, We = Ue[He] ?? (Ue[He] = { byApi: /* @__PURE__ */ new Map() }), Ge = (e, t) => {
|
|
535
|
+
We.byApi.set(e, t);
|
|
536
|
+
}, Ke = (e) => We.byApi.get(e), qe = () => {
|
|
537
|
+
We.byApi.clear();
|
|
538
|
+
}, Je = {
|
|
527
539
|
runtime: { runPromiseExit: () => Promise.resolve(P.die(/* @__PURE__ */ Error("Voltro: mutations are not invokable during SSR"))) },
|
|
528
|
-
cache: new
|
|
529
|
-
client:
|
|
540
|
+
cache: new Ne(),
|
|
541
|
+
client: Ve,
|
|
530
542
|
descriptors: {},
|
|
531
543
|
inspectBaseUrl: "",
|
|
532
|
-
errorBus: new
|
|
533
|
-
},
|
|
544
|
+
errorBus: new Re()
|
|
545
|
+
}, Ye = {
|
|
534
546
|
get: (e) => {
|
|
535
|
-
let t =
|
|
536
|
-
return t === void 0 ?
|
|
537
|
-
...
|
|
547
|
+
let t = Ke(e);
|
|
548
|
+
return t === void 0 ? Je : {
|
|
549
|
+
...Je,
|
|
538
550
|
descriptors: t
|
|
539
551
|
};
|
|
540
552
|
},
|
|
541
553
|
names: []
|
|
542
|
-
},
|
|
543
|
-
|
|
544
|
-
},
|
|
545
|
-
let e = E(
|
|
546
|
-
return e ? (
|
|
547
|
-
|
|
548
|
-
}, 0)),
|
|
549
|
-
},
|
|
550
|
-
let t =
|
|
554
|
+
}, Xe = !1, Ze = !1, K = null, Qe = () => {
|
|
555
|
+
Xe = !1, Ze = !1, K !== null && (clearTimeout(K), K = null);
|
|
556
|
+
}, $e = () => {
|
|
557
|
+
let e = E(ze);
|
|
558
|
+
return e ? (Ze || (Ze = !0, K !== null && (clearTimeout(K), K = null)), e) : (typeof window < "u" && !Xe && !Ze && K === null && process.env.NODE_ENV !== "production" && (K = setTimeout(() => {
|
|
559
|
+
K = null, !(Xe || Ze) && (Xe = !0, console.warn("useFrameworkRuntimes: no <FrameworkRuntimesProvider> in the tree — returning a loading baseline (subscriptions read `undefined`, mutations are no-ops). If this is not an intentional lazy/conditional mount, mount your app via @voltro/web mount() or wrap the subtree in <VoltroRuntimeProvider>."));
|
|
560
|
+
}, 0)), Ye);
|
|
561
|
+
}, q = (e) => {
|
|
562
|
+
let t = $e(), n = t.demand;
|
|
551
563
|
return D(() => {
|
|
552
564
|
n?.(e);
|
|
553
565
|
}, [n, e]), t.get(e);
|
|
554
|
-
},
|
|
566
|
+
}, et = (e) => typeof e.runtime?.runFork != "function", tt = async (e) => {
|
|
555
567
|
let { name: t, wsUrl: n, group: r, headers: i, webSocketConstructor: a } = e;
|
|
556
568
|
class o extends ne.Tag(`@voltro/client/AppClient/${t}`)() {}
|
|
557
|
-
let s = I.succeed(
|
|
569
|
+
let s = I.succeed(ue.WebSocketConstructor, (e, t) => a(e, t)), c = V.layerProtocolSocket().pipe(I.provide(se.layerJson), I.provide(ue.layerWebSocket(n)), I.provide(s)), l = typeof i == "function" ? await i() : i, u = I.scoped(o, V.make(r)).pipe(I.provide(c)), d = l ? I.locallyScoped(V.currentHeaders, ae.fromInput(l)) : I.empty, f = L.make(I.merge(u, d));
|
|
558
570
|
try {
|
|
559
|
-
let e = await f.runPromise(o), t = new
|
|
571
|
+
let e = await f.runPromise(o), t = new Re();
|
|
560
572
|
return {
|
|
561
573
|
runtime: f,
|
|
562
574
|
client: e,
|
|
563
|
-
cache: new
|
|
575
|
+
cache: new Me({ errorBus: t }),
|
|
564
576
|
errorBus: t
|
|
565
577
|
};
|
|
566
578
|
} catch (e) {
|
|
567
579
|
throw f.dispose(), e;
|
|
568
580
|
}
|
|
569
|
-
},
|
|
581
|
+
}, nt = (e) => Math.min(500 * 2 ** Math.min(e - 1, 4), 5e3), rt = () => ({
|
|
570
582
|
resolved: null,
|
|
571
583
|
retryToken: 0,
|
|
572
584
|
failureCount: 0,
|
|
@@ -575,15 +587,15 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
575
587
|
everOpened: !1,
|
|
576
588
|
wedgeStop: null,
|
|
577
589
|
subjectMayHaveChanged: !1
|
|
578
|
-
}),
|
|
590
|
+
}), it = (e) => {
|
|
579
591
|
e.wedgeStop !== null && (e.wedgeStop(), e.wedgeStop = null);
|
|
580
|
-
},
|
|
592
|
+
}, at = (e) => {
|
|
581
593
|
e.cache.destroy(e.runtime), e.runtime.dispose();
|
|
582
|
-
},
|
|
583
|
-
let t = e.apis, n = e.buildClient, r = e.onChange, i = e.retryDelayMs ??
|
|
594
|
+
}, ot = (e) => {
|
|
595
|
+
let t = e.apis, n = e.buildClient, r = e.onChange, i = e.retryDelayMs ?? nt, a = e.stableWindowMs ?? 5e3, o = e.scheduler?.setTimeout ?? ((e, t) => setTimeout(e, t)), s = e.scheduler?.clearTimeout ?? ((e) => {
|
|
584
596
|
clearTimeout(e);
|
|
585
597
|
}), c = e.scheduler?.queueMicrotask ?? queueMicrotask, l = e.onReconnecting, u = e.wedgeBackstop, d = /* @__PURE__ */ new Map();
|
|
586
|
-
for (let e of t) d.set(e.name,
|
|
598
|
+
for (let e of t) d.set(e.name, rt());
|
|
587
599
|
let f = !1, p = /* @__PURE__ */ new Set(), m = (e, t) => {
|
|
588
600
|
let n = o(() => {
|
|
589
601
|
p.delete(n), e();
|
|
@@ -609,7 +621,7 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
609
621
|
if (!t) return;
|
|
610
622
|
let r = t.generation, i = () => {
|
|
611
623
|
if (f || t.generation !== r) return;
|
|
612
|
-
t.everOpened = !0,
|
|
624
|
+
t.everOpened = !0, it(t), t.retryToken++;
|
|
613
625
|
let e = t.failureCount;
|
|
614
626
|
m(() => {
|
|
615
627
|
f || t.failureCount === e && (t.failureCount = 0);
|
|
@@ -620,11 +632,11 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
620
632
|
try {
|
|
621
633
|
let a = await n(e, r, i, o);
|
|
622
634
|
if (f || t.generation !== r) {
|
|
623
|
-
|
|
635
|
+
at(a);
|
|
624
636
|
return;
|
|
625
637
|
}
|
|
626
638
|
let s = t.resolved;
|
|
627
|
-
s && !t.subjectMayHaveChanged && a.cache.seedStaleFrom(s.cache), t.subjectMayHaveChanged = !1, t.resolved = a, t.reconnectStatusDispose &&= (t.reconnectStatusDispose(), null), h(), s &&
|
|
639
|
+
s && !t.subjectMayHaveChanged && a.cache.seedStaleFrom(s.cache), t.subjectMayHaveChanged = !1, t.resolved = a, t.reconnectStatusDispose &&= (t.reconnectStatusDispose(), null), h(), s && at(s);
|
|
628
640
|
} catch {
|
|
629
641
|
if (f || t.generation !== r) return;
|
|
630
642
|
g(e);
|
|
@@ -632,7 +644,7 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
632
644
|
}, v = (e) => {
|
|
633
645
|
if (!f) for (let n of t) {
|
|
634
646
|
let t = d.get(n.name);
|
|
635
|
-
t && (e && (t.subjectMayHaveChanged = !0), t.retryToken += 1, t.generation += 1, t.failureCount = 0,
|
|
647
|
+
t && (e && (t.subjectMayHaveChanged = !0), t.retryToken += 1, t.generation += 1, t.failureCount = 0, it(t), _(n));
|
|
636
648
|
}
|
|
637
649
|
};
|
|
638
650
|
return t.length === 0 ? (r(/* @__PURE__ */ new Map(), !0), {
|
|
@@ -649,7 +661,7 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
649
661
|
f = !0;
|
|
650
662
|
for (let e of p) s(e);
|
|
651
663
|
p.clear();
|
|
652
|
-
for (let [, e] of d) e.resolved &&
|
|
664
|
+
for (let [, e] of d) e.resolved && at(e.resolved), e.reconnectStatusDispose && e.reconnectStatusDispose(), it(e);
|
|
653
665
|
d.clear();
|
|
654
666
|
}
|
|
655
667
|
},
|
|
@@ -660,7 +672,7 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
660
672
|
v(!1);
|
|
661
673
|
}
|
|
662
674
|
});
|
|
663
|
-
},
|
|
675
|
+
}, st = ({ apis: e, children: t, demand: n }) => {
|
|
664
676
|
let r = O(() => ({
|
|
665
677
|
get: (t) => {
|
|
666
678
|
let n = e.get(t);
|
|
@@ -673,45 +685,45 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
673
685
|
names: Array.from(e.keys()),
|
|
674
686
|
...n === void 0 ? {} : { demand: n }
|
|
675
687
|
}), [e]);
|
|
676
|
-
return /* @__PURE__ */
|
|
688
|
+
return /* @__PURE__ */ de(ze.Provider, {
|
|
677
689
|
value: r,
|
|
678
690
|
children: t
|
|
679
691
|
});
|
|
680
|
-
},
|
|
681
|
-
let e = globalThis, t = e[
|
|
692
|
+
}, ct = Symbol.for("@voltro/client/storeStorageProvider"), lt = () => {
|
|
693
|
+
let e = globalThis, t = e[ct];
|
|
682
694
|
if (t !== void 0) return t;
|
|
683
695
|
let n = {
|
|
684
696
|
provider: void 0,
|
|
685
697
|
used: !1
|
|
686
698
|
};
|
|
687
|
-
return e[
|
|
688
|
-
},
|
|
699
|
+
return e[ct] = n, n;
|
|
700
|
+
}, ut = (e) => {
|
|
689
701
|
if (typeof window > "u") return null;
|
|
690
702
|
try {
|
|
691
703
|
return (e === "session" ? window.sessionStorage : window.localStorage) ?? null;
|
|
692
704
|
} catch {
|
|
693
705
|
return null;
|
|
694
706
|
}
|
|
695
|
-
},
|
|
696
|
-
let t =
|
|
707
|
+
}, dt = (e) => {
|
|
708
|
+
let t = lt();
|
|
697
709
|
t.used && e !== null && console.warn("[voltro] setStoreStorage() was called after a persisted store had already read. That store booted against the previous backing store and will not be re-read. Install storage before the first render — on React Native, after awaiting hydrate()."), t.provider = e ?? void 0;
|
|
698
|
-
},
|
|
699
|
-
let t =
|
|
700
|
-
return t.used = !0, (t.provider ??
|
|
701
|
-
},
|
|
702
|
-
let e =
|
|
710
|
+
}, ft = (e) => {
|
|
711
|
+
let t = lt();
|
|
712
|
+
return t.used = !0, (t.provider ?? ut)(e);
|
|
713
|
+
}, pt = () => {
|
|
714
|
+
let e = lt();
|
|
703
715
|
e.provider = void 0, e.used = !1;
|
|
704
|
-
},
|
|
716
|
+
}, mt = (e, t) => {
|
|
705
717
|
if (Object.is(e, t)) return !0;
|
|
706
718
|
if (typeof e != "object" || typeof t != "object" || e === null || t === null || Array.isArray(e) !== Array.isArray(t)) return !1;
|
|
707
719
|
let n = Object.keys(e), r = Object.keys(t);
|
|
708
720
|
if (n.length !== r.length) return !1;
|
|
709
721
|
for (let r of n) if (!Object.prototype.hasOwnProperty.call(t, r) || !Object.is(e[r], t[r])) return !1;
|
|
710
722
|
return !0;
|
|
711
|
-
},
|
|
712
|
-
|
|
713
|
-
},
|
|
714
|
-
let r =
|
|
723
|
+
}, ht = 50, gt = /* @__PURE__ */ new Set(), _t = (e, t) => {
|
|
724
|
+
gt.has(e) || (gt.add(e), console.warn(t));
|
|
725
|
+
}, vt = "\0global", yt = null, bt = (e, t, n) => {
|
|
726
|
+
let r = yt?.() ?? null;
|
|
715
727
|
if (r === null) return n;
|
|
716
728
|
let i = n;
|
|
717
729
|
for (let n of r.seeds) n.store === e && n.key === t && (i = {
|
|
@@ -719,9 +731,9 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
719
731
|
...n.value
|
|
720
732
|
});
|
|
721
733
|
return i;
|
|
722
|
-
},
|
|
734
|
+
}, xt = (e, t) => {
|
|
723
735
|
let n = e(), r = /* @__PURE__ */ new Set(), i = 0, a = 0, o, s, c = () => {
|
|
724
|
-
if (i >=
|
|
736
|
+
if (i >= ht) throw i = 0, Error(`defineStore: notification depth exceeded ${ht} — a subscriber writes a NEW value every time it is notified, so the store can never settle. Look for a listener calling set() with something derived from the current state without converging.`);
|
|
725
737
|
i += 1;
|
|
726
738
|
try {
|
|
727
739
|
for (let e of [...r]) e();
|
|
@@ -742,20 +754,20 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
742
754
|
if (typeof i?.then == "function") throw a === 1 && o !== void 0 && (n = o), --a, a === 0 && (o = void 0, s = void 0), Error(`defineStore: batch('${e}') was given an async function. A batch is synchronous — everything after the first await would land outside it. Await the work first, then batch the writes: \`const r = await load(); store.batch('${e}', () => { … })\`.`);
|
|
743
755
|
if (--a, a > 0) return;
|
|
744
756
|
let l = o, u = s;
|
|
745
|
-
o = void 0, s = void 0, !
|
|
757
|
+
o = void 0, s = void 0, !mt(l, n) && (t(l, n, u), c());
|
|
746
758
|
},
|
|
747
759
|
set: (e, r) => {
|
|
748
760
|
let i = typeof e == "function" ? e(n) : {
|
|
749
761
|
...n,
|
|
750
762
|
...e
|
|
751
763
|
};
|
|
752
|
-
if (
|
|
764
|
+
if (mt(i, n)) return;
|
|
753
765
|
let o = n;
|
|
754
766
|
n = i, !(a > 0) && (t(o, i, r), c());
|
|
755
767
|
},
|
|
756
768
|
reset: () => {
|
|
757
769
|
let r = e();
|
|
758
|
-
if (
|
|
770
|
+
if (mt(r, n)) return;
|
|
759
771
|
let i = n;
|
|
760
772
|
n = r, !(a > 0) && (t(i, r, "reset"), c());
|
|
761
773
|
},
|
|
@@ -763,51 +775,51 @@ var H = /* @__PURE__ */ new Set(), me = (e) => {
|
|
|
763
775
|
r.delete(e);
|
|
764
776
|
})
|
|
765
777
|
};
|
|
766
|
-
},
|
|
767
|
-
|
|
768
|
-
}),
|
|
769
|
-
|
|
770
|
-
},
|
|
771
|
-
let n =
|
|
778
|
+
}, St = 200, Ct = [], wt = /* @__PURE__ */ new Set(), Tt = [], Et = () => Tt, Dt = (e) => (wt.add(e), () => {
|
|
779
|
+
wt.delete(e);
|
|
780
|
+
}), Ot = () => {
|
|
781
|
+
Ct.length = 0, Tt = [];
|
|
782
|
+
}, kt = (e, t) => {
|
|
783
|
+
let n = Ct[e];
|
|
772
784
|
if (n === void 0) return !1;
|
|
773
|
-
let r =
|
|
785
|
+
let r = Nt.get(n.store);
|
|
774
786
|
if (r === void 0) return !1;
|
|
775
787
|
let i = t === "before" ? n.prev : n.next;
|
|
776
|
-
|
|
788
|
+
jt = !0;
|
|
777
789
|
try {
|
|
778
790
|
r.set(() => i, n.key, `travel:${t}`);
|
|
779
791
|
} finally {
|
|
780
|
-
|
|
792
|
+
jt = !1;
|
|
781
793
|
}
|
|
782
794
|
return !0;
|
|
783
|
-
},
|
|
784
|
-
|
|
785
|
-
for (let e of [...
|
|
786
|
-
},
|
|
787
|
-
|
|
788
|
-
})),
|
|
789
|
-
function
|
|
795
|
+
}, At = !1, jt = !1, Mt = (e) => {
|
|
796
|
+
Ct.push(e), Ct.length > St && Ct.shift(), Tt = [...Ct];
|
|
797
|
+
for (let e of [...wt]) e();
|
|
798
|
+
}, Nt = /* @__PURE__ */ new Map(), Pt = /* @__PURE__ */ new Map(), Ft = 0, It = !1, Lt = /* @__PURE__ */ new Map(), Rt = () => (It || (It = !0, queueMicrotask(() => {
|
|
799
|
+
Ft += 1, It = !1;
|
|
800
|
+
})), Ft), zt = Bt(((/* @__PURE__ */ Error()).stack ?? "").split("\n")[1] ?? "") ?? "";
|
|
801
|
+
function Bt(e) {
|
|
790
802
|
let t = e.trim().replace(/^at\s+/, ""), n = /\(([^()]+)\)\s*$/.exec(t)?.[1] ?? t;
|
|
791
803
|
return n.length > 0 ? n : void 0;
|
|
792
804
|
}
|
|
793
|
-
var
|
|
805
|
+
var Vt = () => {
|
|
794
806
|
let e = (/* @__PURE__ */ Error()).stack;
|
|
795
807
|
if (typeof e != "string") return "<unknown>";
|
|
796
808
|
for (let t of e.split("\n").slice(1)) {
|
|
797
|
-
let e =
|
|
809
|
+
let e = Bt(t);
|
|
798
810
|
if (e === void 0) continue;
|
|
799
811
|
let n = e.replace(/:\d+:\d+$/, "");
|
|
800
|
-
if (
|
|
812
|
+
if (zt === "" || n !== zt.replace(/:\d+:\d+$/, "")) return n;
|
|
801
813
|
}
|
|
802
814
|
return "<unknown>";
|
|
803
|
-
},
|
|
804
|
-
let r =
|
|
815
|
+
}, Ht = () => [...Nt.values()], Ut = (e, t, n) => {
|
|
816
|
+
let r = Vt(), i = Rt(), a = Nt.get(e);
|
|
805
817
|
if (a !== void 0) {
|
|
806
|
-
let t =
|
|
818
|
+
let t = Pt.get(e) ?? "<unknown>", n = Lt.get(e) === i;
|
|
807
819
|
if (r !== "<unknown>" && r === t && !n) return a;
|
|
808
820
|
throw Error(`defineStore: '${e}' is already defined. Store names are the devtools + seed key, so two stores sharing one name would silently share state. Rename one.\n first: ${t}\n second: ${r}`);
|
|
809
821
|
}
|
|
810
|
-
let o = n?.persist, s = () =>
|
|
822
|
+
let o = n?.persist, s = () => ft(o?.storage === "session" ? "session" : "local"), c = () => {
|
|
811
823
|
let e = s();
|
|
812
824
|
if (e === null || o === void 0) return;
|
|
813
825
|
let t;
|
|
@@ -832,28 +844,28 @@ var Lt = () => {
|
|
|
832
844
|
t.setItem(o.key, JSON.stringify(n));
|
|
833
845
|
} catch {}
|
|
834
846
|
}, u = /* @__PURE__ */ new Map(), d = (n) => {
|
|
835
|
-
let r = n ??
|
|
847
|
+
let r = n ?? vt, i = u.get(r);
|
|
836
848
|
if (i === void 0) {
|
|
837
849
|
let a = n;
|
|
838
|
-
i =
|
|
850
|
+
i = xt(o !== void 0 && n === void 0 ? () => {
|
|
839
851
|
let e = t();
|
|
840
852
|
return f = e, {
|
|
841
853
|
...e,
|
|
842
854
|
...c() ?? {}
|
|
843
855
|
};
|
|
844
856
|
} : t, (t, n, r) => {
|
|
845
|
-
if (o !== void 0 && a === void 0 && l(n), !
|
|
857
|
+
if (o !== void 0 && a === void 0 && l(n), !At && !jt) {
|
|
846
858
|
let e = m(a);
|
|
847
859
|
e.steps.length = e.cursor, e.steps.push({
|
|
848
860
|
prev: t,
|
|
849
861
|
next: n
|
|
850
862
|
}), e.steps.length > h && e.steps.shift(), e.cursor = e.steps.length;
|
|
851
863
|
}
|
|
852
|
-
|
|
864
|
+
Mt({
|
|
853
865
|
store: e,
|
|
854
866
|
...a === void 0 ? {} : { key: a },
|
|
855
867
|
...r === void 0 ? {} : { label: r },
|
|
856
|
-
...
|
|
868
|
+
...At || jt ? { isUndo: !0 } : {},
|
|
857
869
|
prev: t,
|
|
858
870
|
next: n,
|
|
859
871
|
at: Date.now()
|
|
@@ -862,7 +874,7 @@ var Lt = () => {
|
|
|
862
874
|
}
|
|
863
875
|
return i;
|
|
864
876
|
}, f, p = /* @__PURE__ */ new Map(), m = (e) => {
|
|
865
|
-
let t = e ??
|
|
877
|
+
let t = e ?? vt, n = p.get(t);
|
|
866
878
|
return n === void 0 && (n = {
|
|
867
879
|
steps: [],
|
|
868
880
|
cursor: 0
|
|
@@ -894,12 +906,12 @@ var Lt = () => {
|
|
|
894
906
|
let n = o.current;
|
|
895
907
|
if (n.has && Object.is(n.state, t)) return n.value;
|
|
896
908
|
let r = i.current(t), s = a.current, c = n.has && (s ? s(n.value, r) : Object.is(n.value, r));
|
|
897
|
-
if (process.env.NODE_ENV !== "production" && s === void 0 && n.has && !c && typeof r == "object" && r &&
|
|
909
|
+
if (process.env.NODE_ENV !== "production" && s === void 0 && n.has && !c && typeof r == "object" && r && mt(n.value, r)) {
|
|
898
910
|
let t = !0;
|
|
899
911
|
try {
|
|
900
912
|
t = !Object.is(i.current(n.state), n.value);
|
|
901
913
|
} catch {}
|
|
902
|
-
|
|
914
|
+
_t(e, t ? `[@voltro/client] ${e}.use(): the selector returns a NEW object each call, so the default identity check never sees it as unchanged and this component re-renders on EVERY store change.\n Pass \`{ equals: shallow }\` (exported from @voltro/client), or select a primitive.` : `[@voltro/client] ${e}.use(): this component re-renders on store changes that do not change what it selects. The selector is stable — it returns the same reference for the same state — and the STORE is writing a new value that is equal one level deep (a fresh \`[]\` or \`{}\`, say).\n Pass \`{ equals: shallow }\` (exported from @voltro/client), or stop writing an equal value.`);
|
|
903
915
|
}
|
|
904
916
|
let l = c ? n.value : r;
|
|
905
917
|
return o.current = {
|
|
@@ -916,7 +928,7 @@ var Lt = () => {
|
|
|
916
928
|
r,
|
|
917
929
|
c,
|
|
918
930
|
l
|
|
919
|
-
]), p = T(() => s(r.get()), [r, s]), m = T(() => s(
|
|
931
|
+
]), p = T(() => s(r.get()), [r, s]), m = T(() => s(bt(e, n?.key, n?.key === void 0 && f !== void 0 ? f : r.get())), [
|
|
920
932
|
r,
|
|
921
933
|
n?.key,
|
|
922
934
|
s
|
|
@@ -934,11 +946,11 @@ var Lt = () => {
|
|
|
934
946
|
undo: (e) => {
|
|
935
947
|
let t = m(e);
|
|
936
948
|
if (t.cursor === 0) return !1;
|
|
937
|
-
--t.cursor,
|
|
949
|
+
--t.cursor, At = !0;
|
|
938
950
|
try {
|
|
939
951
|
d(e).set(() => t.steps[t.cursor].prev, "undo");
|
|
940
952
|
} finally {
|
|
941
|
-
|
|
953
|
+
At = !1;
|
|
942
954
|
}
|
|
943
955
|
return !0;
|
|
944
956
|
},
|
|
@@ -946,11 +958,11 @@ var Lt = () => {
|
|
|
946
958
|
let t = m(e);
|
|
947
959
|
if (t.cursor >= t.steps.length) return !1;
|
|
948
960
|
let n = t.steps[t.cursor];
|
|
949
|
-
t.cursor += 1,
|
|
961
|
+
t.cursor += 1, At = !0;
|
|
950
962
|
try {
|
|
951
963
|
d(e).set(() => n.next, "redo");
|
|
952
964
|
} finally {
|
|
953
|
-
|
|
965
|
+
At = !1;
|
|
954
966
|
}
|
|
955
967
|
return !0;
|
|
956
968
|
},
|
|
@@ -962,27 +974,27 @@ var Lt = () => {
|
|
|
962
974
|
release: (e) => {
|
|
963
975
|
u.delete(e), p.delete(e);
|
|
964
976
|
},
|
|
965
|
-
keys: () => [...u.keys()].filter((e) => e !==
|
|
977
|
+
keys: () => [...u.keys()].filter((e) => e !== vt)
|
|
966
978
|
};
|
|
967
|
-
return
|
|
968
|
-
},
|
|
969
|
-
|
|
970
|
-
},
|
|
971
|
-
|
|
972
|
-
},
|
|
973
|
-
let r =
|
|
979
|
+
return Nt.set(e, b), Pt.set(e, r), Lt.set(e, i), b;
|
|
980
|
+
}, Wt = () => {
|
|
981
|
+
Nt.clear(), Pt.clear(), Lt.clear(), gt.clear();
|
|
982
|
+
}, Gt = () => ({ seeds: [] }), Kt = (e) => {
|
|
983
|
+
yt = e;
|
|
984
|
+
}, qt = (e, t, n) => {
|
|
985
|
+
let r = yt?.() ?? null;
|
|
974
986
|
if (r === null) throw Error(`seedStore('${e.name}') was called outside a server render. Seeding exists to put a value into the SSR hydration payload; on the client, set the store directly instead. (If this IS server code, the render did not install a seed bag — that is a framework bug.)`);
|
|
975
987
|
r.seeds.push({
|
|
976
988
|
store: e.name,
|
|
977
989
|
...n?.key === void 0 ? {} : { key: n.key },
|
|
978
990
|
value: t
|
|
979
991
|
});
|
|
980
|
-
},
|
|
992
|
+
}, Jt = (e) => {
|
|
981
993
|
if (e !== void 0) for (let t of e) {
|
|
982
|
-
let e =
|
|
994
|
+
let e = Nt.get(t.store);
|
|
983
995
|
e !== void 0 && e.set(t.value, t.key);
|
|
984
996
|
}
|
|
985
|
-
},
|
|
997
|
+
}, J = (e, t) => {
|
|
986
998
|
let n = t.split("."), r = e;
|
|
987
999
|
for (let e = 0; e < n.length; e++) {
|
|
988
1000
|
let i = n[e];
|
|
@@ -1001,15 +1013,15 @@ var Lt = () => {
|
|
|
1001
1013
|
}
|
|
1002
1014
|
if (typeof r != "function") throw Error(`@voltro/client: rpc tag ${JSON.stringify(t)} did not resolve to a callable method.`);
|
|
1003
1015
|
return r;
|
|
1004
|
-
},
|
|
1016
|
+
}, Yt = Object.freeze({
|
|
1005
1017
|
data: void 0,
|
|
1006
1018
|
revision: -1,
|
|
1007
1019
|
emittedAt: void 0,
|
|
1008
1020
|
error: void 0,
|
|
1009
1021
|
pendingPatches: 0
|
|
1010
|
-
}),
|
|
1011
|
-
function
|
|
1012
|
-
let i = r.skip === !0, { runtime: a, cache: o, client: s, descriptors: c } =
|
|
1022
|
+
}), Xt = () => Yt;
|
|
1023
|
+
function Y(e, t, n = {}, r = {}) {
|
|
1024
|
+
let i = r.skip === !0, { runtime: a, cache: o, client: s, descriptors: c } = q(e), l = c[t]?.source, u = k(n);
|
|
1013
1025
|
u.current = n;
|
|
1014
1026
|
let d = k(s);
|
|
1015
1027
|
d.current = s;
|
|
@@ -1017,7 +1029,7 @@ function J(e, t, n = {}, r = {}) {
|
|
|
1017
1029
|
let e = u.current;
|
|
1018
1030
|
return {
|
|
1019
1031
|
queryKey: [t, e],
|
|
1020
|
-
fetch: () =>
|
|
1032
|
+
fetch: () => J(d.current, t)(e)
|
|
1021
1033
|
};
|
|
1022
1034
|
}, [t, f]), m = p.queryKey, h = T((e) => i ? () => {} : o.subscribe(p.queryKey, p.fetch, a, e, l === void 0 ? {} : { source: l }).unsubscribe, [
|
|
1023
1035
|
o,
|
|
@@ -1025,11 +1037,11 @@ function J(e, t, n = {}, r = {}) {
|
|
|
1025
1037
|
l,
|
|
1026
1038
|
i,
|
|
1027
1039
|
p
|
|
1028
|
-
]), g = T(() => i ?
|
|
1040
|
+
]), g = T(() => i ? Yt : o.peek(m), [
|
|
1029
1041
|
o,
|
|
1030
1042
|
i,
|
|
1031
1043
|
m
|
|
1032
|
-
]), _ = j(h, g,
|
|
1044
|
+
]), _ = j(h, g, Xt), v = _.data !== void 0, y = v && (Array.isArray(_.data) ? _.data.length === 0 : _.data === null), b = {
|
|
1033
1045
|
revision: _.revision,
|
|
1034
1046
|
emittedAt: _.emittedAt,
|
|
1035
1047
|
error: _.error,
|
|
@@ -1086,34 +1098,35 @@ function J(e, t, n = {}, r = {}) {
|
|
|
1086
1098
|
}
|
|
1087
1099
|
//#endregion
|
|
1088
1100
|
//#region src/awaitResolvedApi.ts
|
|
1089
|
-
var
|
|
1090
|
-
if (!
|
|
1091
|
-
let r = Date.now() +
|
|
1092
|
-
for (; Date.now() < r;) if (await new Promise((e) => setTimeout(e, 16)), !
|
|
1093
|
-
throw Error(`Voltro: the api "${t}" did not resolve within ${
|
|
1094
|
-
},
|
|
1101
|
+
var Zt = 15e3, X = async (e, t, n) => {
|
|
1102
|
+
if (!et(e.current)) return e.current;
|
|
1103
|
+
let r = Date.now() + Zt;
|
|
1104
|
+
for (; Date.now() < r;) if (await new Promise((e) => setTimeout(e, 16)), !et(e.current)) return e.current;
|
|
1105
|
+
throw Error(`Voltro: the api "${t}" did not resolve within ${Zt}ms, so ${n} was never sent. This is not the boot window — that is waited out. Check that "${t}" is a configured api name and that its client could connect.`);
|
|
1106
|
+
}, Z = async (e, t) => {
|
|
1095
1107
|
let n = await e.runPromiseExit(t);
|
|
1096
1108
|
if (P.isSuccess(n)) return n.value;
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1109
|
+
let r = M.squash(n.cause), i = M.failureOption(n.cause);
|
|
1110
|
+
throw ye(r, R.isSome(i) ? U(i.value, "handler") : "unknown");
|
|
1111
|
+
}, Qt = 100, Q = [], $t = /* @__PURE__ */ new Set(), en = [], tn = () => {
|
|
1112
|
+
en = Q.slice();
|
|
1113
|
+
}, nn = () => {
|
|
1114
|
+
tn();
|
|
1115
|
+
for (let e of $t) try {
|
|
1103
1116
|
e();
|
|
1104
1117
|
} catch {}
|
|
1105
|
-
},
|
|
1118
|
+
}, rn = (e) => {
|
|
1106
1119
|
let t = {
|
|
1107
1120
|
...e,
|
|
1108
1121
|
status: "pending",
|
|
1109
1122
|
startedAt: Date.now()
|
|
1110
1123
|
};
|
|
1111
|
-
|
|
1112
|
-
},
|
|
1113
|
-
let n =
|
|
1124
|
+
Q.unshift(t), Q.length > Qt && (Q.length = Qt), nn();
|
|
1125
|
+
}, an = (e, t) => {
|
|
1126
|
+
let n = Q.findIndex((t) => t.id === e);
|
|
1114
1127
|
if (n === -1) return;
|
|
1115
|
-
let r =
|
|
1116
|
-
|
|
1128
|
+
let r = Q[n], i = Date.now();
|
|
1129
|
+
Q[n] = t.status === "success" ? {
|
|
1117
1130
|
...r,
|
|
1118
1131
|
status: "success",
|
|
1119
1132
|
output: t.output,
|
|
@@ -1125,12 +1138,12 @@ var qt = 15e3, Y = async (e, t, n) => {
|
|
|
1125
1138
|
error: t.error,
|
|
1126
1139
|
settledAt: i,
|
|
1127
1140
|
durationMs: i - r.startedAt
|
|
1128
|
-
},
|
|
1129
|
-
},
|
|
1130
|
-
|
|
1131
|
-
}),
|
|
1132
|
-
|
|
1133
|
-
},
|
|
1141
|
+
}, nn();
|
|
1142
|
+
}, on = () => en, sn = (e) => ($t.add(e), () => {
|
|
1143
|
+
$t.delete(e);
|
|
1144
|
+
}), cn = () => {
|
|
1145
|
+
Q.length !== 0 && (Q.length = 0, nn());
|
|
1146
|
+
}, ln = (e, t) => {
|
|
1134
1147
|
if (t === void 0 || typeof e != "object" || !e) return e;
|
|
1135
1148
|
try {
|
|
1136
1149
|
Object.defineProperty(e, "__voltroTraceId", {
|
|
@@ -1140,117 +1153,124 @@ var qt = 15e3, Y = async (e, t, n) => {
|
|
|
1140
1153
|
});
|
|
1141
1154
|
} catch {}
|
|
1142
1155
|
return e;
|
|
1143
|
-
},
|
|
1144
|
-
|
|
1145
|
-
},
|
|
1156
|
+
}, un, dn = (e) => {
|
|
1157
|
+
un = e;
|
|
1158
|
+
}, fn = () => un, pn = (e, t, n) => typeof e == "function" ? e(t, n) : e, mn = 0, hn = () => `mut_${++mn}`, gn = 0, _n = () => {
|
|
1146
1159
|
let e = typeof crypto < "u" ? crypto : void 0;
|
|
1147
|
-
return e && typeof e.randomUUID == "function" ? e.randomUUID() : `idem_${Date.now().toString(36)}_${
|
|
1148
|
-
},
|
|
1160
|
+
return e && typeof e.randomUUID == "function" ? e.randomUUID() : `idem_${Date.now().toString(36)}_${gn += 1}`;
|
|
1161
|
+
}, vn = (e, t) => e.pipe(N.locallyWith(V.currentHeaders, (e) => ae.set(e, "idempotency-key", t))), yn = (e, t) => ({
|
|
1149
1162
|
update: (n, r) => {
|
|
1150
1163
|
e.update(n, r, t);
|
|
1151
1164
|
},
|
|
1152
1165
|
forTag: (n, r) => e.forTag(n, r, t)
|
|
1153
|
-
}),
|
|
1154
|
-
let n =
|
|
1155
|
-
|
|
1156
|
-
let
|
|
1166
|
+
}), bn = (e, t) => {
|
|
1167
|
+
let n = q(e), { descriptors: r } = n, i = k(n);
|
|
1168
|
+
i.current = n;
|
|
1169
|
+
let a = r[t], o = a?.targets;
|
|
1157
1170
|
if (process.env.NODE_ENV !== "production") {
|
|
1158
|
-
let n =
|
|
1171
|
+
let n = a?.kind;
|
|
1159
1172
|
n !== void 0 && n !== "mutation" && console.error(`[@voltro/client] useMutation('${e}', '${t}') targets a ${n}, not a mutation. Use ${n === "action" ? "useAction" : n === "workflow" ? "useWorkflow" : `the ${n} hook`} instead.`);
|
|
1160
1173
|
}
|
|
1161
|
-
let [
|
|
1162
|
-
let
|
|
1174
|
+
let [s, c] = A(!1), [l, u] = A(void 0), [d, f] = A(void 0), p = k(null), m = k(!1), h = T(async (n, r) => {
|
|
1175
|
+
let a = r?.onError !== void 0 || r?.notify?.error !== void 0, s = (e) => {
|
|
1163
1176
|
r?.onError?.(e, n);
|
|
1164
|
-
let t =
|
|
1165
|
-
t !== void 0 &&
|
|
1177
|
+
let t = pn(r?.notify?.error, e, n);
|
|
1178
|
+
t !== void 0 && un?.error(t);
|
|
1166
1179
|
};
|
|
1167
|
-
|
|
1168
|
-
let
|
|
1180
|
+
c(!0), u(void 0);
|
|
1181
|
+
let l, d, h;
|
|
1169
1182
|
try {
|
|
1170
|
-
({runtime:
|
|
1183
|
+
({runtime: l, cache: d, client: h} = await X(i, e, t));
|
|
1171
1184
|
} catch (e) {
|
|
1172
|
-
if (
|
|
1185
|
+
if (c(!1), u(e), i.current.errorBus.emit({
|
|
1186
|
+
source: "mutation",
|
|
1187
|
+
tag: t,
|
|
1188
|
+
error: e,
|
|
1189
|
+
kind: "client"
|
|
1190
|
+
}), a) return s(e);
|
|
1173
1191
|
throw e;
|
|
1174
1192
|
}
|
|
1175
|
-
let
|
|
1176
|
-
|
|
1177
|
-
id:
|
|
1193
|
+
let g = hn(), _ = r?.idempotencyKey ?? _n();
|
|
1194
|
+
rn({
|
|
1195
|
+
id: g,
|
|
1178
1196
|
apiName: e,
|
|
1179
1197
|
tag: t,
|
|
1180
1198
|
input: n
|
|
1181
1199
|
});
|
|
1182
|
-
let
|
|
1183
|
-
if (
|
|
1184
|
-
|
|
1200
|
+
let v = p.current, y = m.current;
|
|
1201
|
+
if (v) try {
|
|
1202
|
+
v(yn(d, g), n);
|
|
1185
1203
|
} catch (e) {
|
|
1186
|
-
if (
|
|
1204
|
+
if (u(e), c(!1), d.revertByMutation(g), an(g, {
|
|
1187
1205
|
status: "error",
|
|
1188
1206
|
error: e
|
|
1189
|
-
}),
|
|
1207
|
+
}), a) return s(e);
|
|
1190
1208
|
throw e;
|
|
1191
1209
|
}
|
|
1192
|
-
else !
|
|
1193
|
-
let x;
|
|
1210
|
+
else !y && o && o.length > 0 && d.autoApply(o, n, g);
|
|
1211
|
+
let b, x = !1;
|
|
1194
1212
|
try {
|
|
1195
|
-
let a =
|
|
1196
|
-
|
|
1213
|
+
let a = J(h, t), o = N.currentSpan.pipe(N.tap((e) => N.sync(() => {
|
|
1214
|
+
b = e.traceId, ge({
|
|
1197
1215
|
traceId: e.traceId,
|
|
1198
1216
|
spanId: e.spanId,
|
|
1199
1217
|
source: "mutation",
|
|
1200
1218
|
tag: t
|
|
1201
1219
|
});
|
|
1202
|
-
})), N.catchAll(() => N.void), N.zipRight(
|
|
1220
|
+
})), N.catchAll(() => N.void), N.zipRight(vn(a(n), _))).pipe(N.withSpan(`client.mutation.${t}`, { attributes: {
|
|
1203
1221
|
"voltro.api": e,
|
|
1204
|
-
"voltro.mutationId":
|
|
1222
|
+
"voltro.mutationId": g,
|
|
1205
1223
|
"rpc.tag": t
|
|
1206
|
-
} }))
|
|
1207
|
-
|
|
1224
|
+
} }));
|
|
1225
|
+
x = !0;
|
|
1226
|
+
let s = await Z(l, o);
|
|
1227
|
+
f(s), an(g, {
|
|
1208
1228
|
status: "success",
|
|
1209
1229
|
output: s
|
|
1210
|
-
}), i.emitSuccess({
|
|
1230
|
+
}), i.current.errorBus.emitSuccess({
|
|
1211
1231
|
source: "mutation",
|
|
1212
1232
|
tag: t
|
|
1213
|
-
}),
|
|
1214
|
-
let c =
|
|
1215
|
-
return c !== void 0 &&
|
|
1233
|
+
}), d.confirmByMutation(g), r?.onSuccess?.(s, n);
|
|
1234
|
+
let c = pn(r?.notify?.success, s, n);
|
|
1235
|
+
return c !== void 0 && un?.success(c), s;
|
|
1216
1236
|
} catch (e) {
|
|
1217
|
-
let n =
|
|
1218
|
-
if (
|
|
1237
|
+
let n = ln(e, b);
|
|
1238
|
+
if (u(n), an(g, {
|
|
1219
1239
|
status: "error",
|
|
1220
1240
|
error: n
|
|
1221
|
-
}),
|
|
1241
|
+
}), d.revertByMutation(g), i.current.errorBus.emit({
|
|
1222
1242
|
source: "mutation",
|
|
1223
1243
|
tag: t,
|
|
1224
1244
|
error: n,
|
|
1225
|
-
|
|
1226
|
-
|
|
1245
|
+
kind: x ? U(e, "handler") : "client",
|
|
1246
|
+
...b === void 0 ? {} : { traceId: b }
|
|
1247
|
+
}), a) return s(n);
|
|
1227
1248
|
throw n;
|
|
1228
1249
|
} finally {
|
|
1229
|
-
|
|
1250
|
+
c(!1);
|
|
1230
1251
|
}
|
|
1231
1252
|
}, [
|
|
1232
1253
|
e,
|
|
1233
1254
|
t,
|
|
1234
|
-
|
|
1235
|
-
i
|
|
1255
|
+
o
|
|
1236
1256
|
]);
|
|
1237
1257
|
return O(() => {
|
|
1238
1258
|
let e = {
|
|
1239
|
-
mutate:
|
|
1240
|
-
pending:
|
|
1241
|
-
error:
|
|
1242
|
-
data:
|
|
1243
|
-
withOptimistic: (t) => (
|
|
1244
|
-
withoutOptimistic: () => (
|
|
1259
|
+
mutate: h,
|
|
1260
|
+
pending: s,
|
|
1261
|
+
error: l,
|
|
1262
|
+
data: d,
|
|
1263
|
+
withOptimistic: (t) => (p.current = t, e),
|
|
1264
|
+
withoutOptimistic: () => (m.current = !0, e)
|
|
1245
1265
|
};
|
|
1246
1266
|
return e;
|
|
1247
1267
|
}, [
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1268
|
+
h,
|
|
1269
|
+
s,
|
|
1270
|
+
l,
|
|
1271
|
+
d
|
|
1252
1272
|
]);
|
|
1253
|
-
},
|
|
1273
|
+
}, xn = (e, t) => {
|
|
1254
1274
|
if (t === void 0 || typeof e != "object" || !e) return e;
|
|
1255
1275
|
try {
|
|
1256
1276
|
Object.defineProperty(e, "__voltroTraceId", {
|
|
@@ -1260,89 +1280,88 @@ var qt = 15e3, Y = async (e, t, n) => {
|
|
|
1260
1280
|
});
|
|
1261
1281
|
} catch {}
|
|
1262
1282
|
return e;
|
|
1263
|
-
},
|
|
1264
|
-
let n =
|
|
1265
|
-
if (
|
|
1283
|
+
}, Sn = (e, t, n) => typeof e == "function" ? e(t, n) : e, Cn = 0, wn = () => `act_${++Cn}`, Tn = (e, t) => {
|
|
1284
|
+
let n = q(e), { descriptors: r } = n, i = k(n);
|
|
1285
|
+
if (i.current = n, process.env.NODE_ENV !== "production") {
|
|
1266
1286
|
let n = r[t]?.kind;
|
|
1267
1287
|
n !== void 0 && n !== "action" && console.error(`[@voltro/client] useAction('${e}', '${t}') targets a ${n}, not an action. Use ${n === "mutation" ? "useMutation" : n === "workflow" ? "useWorkflow" : `the ${n} hook`} instead.`);
|
|
1268
1288
|
}
|
|
1269
|
-
let [
|
|
1270
|
-
let
|
|
1271
|
-
|
|
1272
|
-
let
|
|
1273
|
-
|
|
1274
|
-
id:
|
|
1289
|
+
let [a, o] = A(!1), [s, c] = A(void 0), [l, u] = A(void 0), d = T(async (n, r) => {
|
|
1290
|
+
let a = r?.onError !== void 0 || r?.notify?.error !== void 0;
|
|
1291
|
+
o(!0), c(void 0);
|
|
1292
|
+
let s = wn(), l = r?.idempotencyKey ?? _n();
|
|
1293
|
+
rn({
|
|
1294
|
+
id: s,
|
|
1275
1295
|
apiName: e,
|
|
1276
1296
|
tag: t,
|
|
1277
1297
|
input: n
|
|
1278
1298
|
});
|
|
1279
|
-
let f;
|
|
1299
|
+
let d, f = !1;
|
|
1280
1300
|
try {
|
|
1281
|
-
let { runtime:
|
|
1282
|
-
|
|
1301
|
+
let { runtime: a, client: o } = await X(i, e, t), c = J(o, t), p = N.currentSpan.pipe(N.tap((e) => N.sync(() => {
|
|
1302
|
+
d = e.traceId, ge({
|
|
1283
1303
|
traceId: e.traceId,
|
|
1284
1304
|
spanId: e.spanId,
|
|
1285
1305
|
source: "action",
|
|
1286
1306
|
tag: t
|
|
1287
1307
|
});
|
|
1288
|
-
})), N.catchAll(() => N.void), N.zipRight(
|
|
1308
|
+
})), N.catchAll(() => N.void), N.zipRight(vn(c(n), l))).pipe(N.withSpan(`client.action.${t}`, { attributes: {
|
|
1289
1309
|
"voltro.api": e,
|
|
1290
|
-
"voltro.actionId":
|
|
1310
|
+
"voltro.actionId": s,
|
|
1291
1311
|
"rpc.tag": t
|
|
1292
|
-
} }))
|
|
1293
|
-
|
|
1312
|
+
} }));
|
|
1313
|
+
f = !0;
|
|
1314
|
+
let m = await Z(a, p);
|
|
1315
|
+
u(m), an(s, {
|
|
1294
1316
|
status: "success",
|
|
1295
|
-
output:
|
|
1296
|
-
}), i.emitSuccess({
|
|
1317
|
+
output: m
|
|
1318
|
+
}), i.current.errorBus.emitSuccess({
|
|
1297
1319
|
source: "action",
|
|
1298
1320
|
tag: t
|
|
1299
|
-
}), r?.onSuccess?.(
|
|
1300
|
-
let
|
|
1301
|
-
return
|
|
1321
|
+
}), r?.onSuccess?.(m, n);
|
|
1322
|
+
let h = Sn(r?.notify?.success, m, n);
|
|
1323
|
+
return h !== void 0 && fn()?.success(h), m;
|
|
1302
1324
|
} catch (e) {
|
|
1303
|
-
let
|
|
1304
|
-
if (
|
|
1325
|
+
let o = xn(e, d);
|
|
1326
|
+
if (c(o), an(s, {
|
|
1305
1327
|
status: "error",
|
|
1306
|
-
error:
|
|
1307
|
-
}), i.emit({
|
|
1328
|
+
error: o
|
|
1329
|
+
}), i.current.errorBus.emit({
|
|
1308
1330
|
source: "action",
|
|
1309
1331
|
tag: t,
|
|
1310
|
-
error:
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
e
|
|
1332
|
+
error: o,
|
|
1333
|
+
kind: f ? U(e, "handler") : "client",
|
|
1334
|
+
...d === void 0 ? {} : { traceId: d }
|
|
1335
|
+
}), a) {
|
|
1336
|
+
r?.onError?.(o, n);
|
|
1337
|
+
let e = Sn(r?.notify?.error, o, n);
|
|
1338
|
+
e !== void 0 && fn()?.error(e);
|
|
1316
1339
|
return;
|
|
1317
1340
|
}
|
|
1318
|
-
throw
|
|
1341
|
+
throw o;
|
|
1319
1342
|
} finally {
|
|
1320
|
-
|
|
1343
|
+
o(!1);
|
|
1321
1344
|
}
|
|
1322
|
-
}, [
|
|
1323
|
-
e,
|
|
1324
|
-
t,
|
|
1325
|
-
i
|
|
1326
|
-
]);
|
|
1345
|
+
}, [e, t]);
|
|
1327
1346
|
return O(() => ({
|
|
1328
|
-
run:
|
|
1329
|
-
pending:
|
|
1330
|
-
error:
|
|
1331
|
-
lastResult:
|
|
1347
|
+
run: d,
|
|
1348
|
+
pending: a,
|
|
1349
|
+
error: s,
|
|
1350
|
+
lastResult: l
|
|
1332
1351
|
}), [
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1352
|
+
d,
|
|
1353
|
+
a,
|
|
1354
|
+
s,
|
|
1355
|
+
l
|
|
1337
1356
|
]);
|
|
1338
|
-
},
|
|
1357
|
+
}, En = C(void 0), Dn = (e) => w(En.Provider, { value: e.messages }, e.children), On = () => E(En), kn = Symbol.for("voltro.client.formEngine"), An = C(void 0), jn = (e, t) => {
|
|
1339
1358
|
let n = e;
|
|
1340
1359
|
for (let e of t.split(".")) {
|
|
1341
1360
|
if (typeof n != "object" || !n) return;
|
|
1342
1361
|
n = n[e];
|
|
1343
1362
|
}
|
|
1344
1363
|
return n;
|
|
1345
|
-
},
|
|
1364
|
+
}, Mn = (e, t, n) => `vf-${e}-${t}-${n}`.replace(/[^a-zA-Z0-9_-]/g, "-"), Nn = {
|
|
1346
1365
|
isTouched: !1,
|
|
1347
1366
|
isBlurred: !1,
|
|
1348
1367
|
isDirty: !1,
|
|
@@ -1351,15 +1370,15 @@ var qt = 15e3, Y = async (e, t, n) => {
|
|
|
1351
1370
|
isValidating: !1,
|
|
1352
1371
|
errorMap: {},
|
|
1353
1372
|
errorSourceMap: {}
|
|
1354
|
-
},
|
|
1373
|
+
}, Pn = (e, t) => {
|
|
1355
1374
|
let n = e.find((e) => e.name === t);
|
|
1356
1375
|
if (n !== void 0) return n;
|
|
1357
1376
|
let r = /^(.+?)\.\d+\.(.+)$/.exec(t);
|
|
1358
1377
|
if (r !== null) return e.find((e) => e.name === r[1] && e.widget === "array")?.item?.find((e) => e.name === r[2]);
|
|
1359
|
-
},
|
|
1360
|
-
let r =
|
|
1378
|
+
}, Fn = (e, t, n) => {
|
|
1379
|
+
let r = q(e), a = k(void 0), o = typeof t == "function" ? t(a.current?.state?.values ?? n.defaults ?? {}) : t, s = k(o).current, c = bn(e, o), l = n.schema ?? r.descriptors[o]?.input;
|
|
1361
1380
|
process.env.NODE_ENV !== "production" && l === void 0 && console.error(`[@voltro/client] useFormBinding('${e}', '${t}'): no input schema. Pass options.schema, or mount the descriptor so its input reaches the client. Rendering no fields; submit skips client-side validation.`);
|
|
1362
|
-
let u = O(() => l ? x(l) : [], [l]), d =
|
|
1381
|
+
let u = O(() => l ? x(l) : [], [l]), d = On(), f = n.messages ?? d, p = O(() => ({
|
|
1363
1382
|
...n.locale === void 0 ? {} : { locale: n.locale },
|
|
1364
1383
|
...f === void 0 ? {} : { messages: f }
|
|
1365
1384
|
}), [n.locale, f]), m = k(n.asyncFields);
|
|
@@ -1386,7 +1405,7 @@ var qt = 15e3, Y = async (e, t, n) => {
|
|
|
1386
1405
|
let o = n.errorPath ?? {};
|
|
1387
1406
|
return a.map((t) => {
|
|
1388
1407
|
let n = o[t.path];
|
|
1389
|
-
return n === void 0 ? (
|
|
1408
|
+
return n === void 0 ? (jn(e, t.path) !== void 0 || t.path.includes("."), t) : {
|
|
1390
1409
|
...t,
|
|
1391
1410
|
path: n
|
|
1392
1411
|
};
|
|
@@ -1401,7 +1420,7 @@ var qt = 15e3, Y = async (e, t, n) => {
|
|
|
1401
1420
|
...ne(n.defaults),
|
|
1402
1421
|
...e.values
|
|
1403
1422
|
};
|
|
1404
|
-
a.current = new
|
|
1423
|
+
a.current = new fe({
|
|
1405
1424
|
onSubmit: ({ value: e }) => re.current(e),
|
|
1406
1425
|
defaultValues: t,
|
|
1407
1426
|
validators: { onChange: ({ value: e }) => {
|
|
@@ -1416,20 +1435,20 @@ var qt = 15e3, Y = async (e, t, n) => {
|
|
|
1416
1435
|
let N = a.current, P = N;
|
|
1417
1436
|
D(() => P.mount(), [P]);
|
|
1418
1437
|
let F = n.subscribe ?? "all";
|
|
1419
|
-
|
|
1420
|
-
let I = N.store.state.values, L = N.store.state, R = O(() => M(I), [M, I]),
|
|
1421
|
-
if (
|
|
1422
|
-
if (
|
|
1423
|
-
if (
|
|
1424
|
-
let t =
|
|
1425
|
-
return t === void 0 ? !1 :
|
|
1438
|
+
pe(N.store, (e) => F === "all" ? e : `${e.submissionAttempts}|${String(e.isSubmitting)}|${String(e.isDirty)}|${String(e.isTouched)}`);
|
|
1439
|
+
let I = N.store.state.values, L = N.store.state, R = O(() => M(I), [M, I]), z = n.isLoading === !0, ie = n.validate, B = ie?.onChange ?? "afterTouched", ae = ie?.onBlur ?? !0, V = L.submissionAttempts, oe = L.fieldMetaBase ?? {}, se = T((e) => {
|
|
1440
|
+
if (z) return !1;
|
|
1441
|
+
if (V > 0 || B === "always") return !0;
|
|
1442
|
+
if (B === "never") return !1;
|
|
1443
|
+
let t = oe[e];
|
|
1444
|
+
return t === void 0 ? !1 : ae ? t.isBlurred === !0 : t.isTouched === !0;
|
|
1426
1445
|
}, [
|
|
1446
|
+
V,
|
|
1427
1447
|
oe,
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
ae
|
|
1431
|
-
|
|
1432
|
-
]), V = T((e) => {
|
|
1448
|
+
z,
|
|
1449
|
+
B,
|
|
1450
|
+
ae
|
|
1451
|
+
]), H = T((e) => {
|
|
1433
1452
|
let t = y[e];
|
|
1434
1453
|
if (t !== void 0) return t;
|
|
1435
1454
|
let n = m.current?.[e];
|
|
@@ -1437,41 +1456,41 @@ var qt = 15e3, Y = async (e, t, n) => {
|
|
|
1437
1456
|
id: "validation.invalid",
|
|
1438
1457
|
fallback: "Invalid value"
|
|
1439
1458
|
}, _.current);
|
|
1440
|
-
if (!
|
|
1459
|
+
if (!se(e)) return;
|
|
1441
1460
|
let r = R.find((t) => t.path === e);
|
|
1442
1461
|
return r === void 0 ? void 0 : b(r, _.current);
|
|
1443
1462
|
}, [
|
|
1444
1463
|
y,
|
|
1445
|
-
|
|
1464
|
+
se,
|
|
1446
1465
|
R
|
|
1447
|
-
]),
|
|
1466
|
+
]), le = O(() => {
|
|
1448
1467
|
let e = {}, t = /* @__PURE__ */ new Set([...R.map((e) => e.path).filter((e) => e !== ""), ...Object.keys(y)]);
|
|
1449
1468
|
for (let [e, n] of Object.entries(m.current ?? {})) n.status === "invalid" && t.add(e);
|
|
1450
1469
|
for (let n of t) {
|
|
1451
|
-
let t =
|
|
1470
|
+
let t = H(n);
|
|
1452
1471
|
t !== void 0 && (e[n] = t);
|
|
1453
1472
|
}
|
|
1454
1473
|
return e;
|
|
1455
1474
|
}, [
|
|
1456
1475
|
R,
|
|
1457
1476
|
y,
|
|
1458
|
-
|
|
1459
|
-
]),
|
|
1477
|
+
H
|
|
1478
|
+
]), ue = T((e) => {
|
|
1460
1479
|
S((t) => {
|
|
1461
1480
|
if (!(e in t)) return t;
|
|
1462
1481
|
let n = { ...t };
|
|
1463
1482
|
return delete n[e], n;
|
|
1464
1483
|
});
|
|
1465
|
-
}, []),
|
|
1466
|
-
let n =
|
|
1484
|
+
}, []), de = T((t) => {
|
|
1485
|
+
let n = Pn(u, t), r = P.getFieldMeta(t), i = H(t), a = Mn(e, s, t), o = m.current?.[t], c = [i === void 0 ? void 0 : `${a}-error`, n?.description === void 0 ? void 0 : `${a}-help`].filter((e) => e !== void 0);
|
|
1467
1486
|
return {
|
|
1468
1487
|
value: P.getFieldValue(t),
|
|
1469
1488
|
setValue: (e) => {
|
|
1470
|
-
|
|
1489
|
+
ue(t), !Object.is(P.getFieldValue(t), e) && P.setFieldValue(t, e);
|
|
1471
1490
|
},
|
|
1472
1491
|
onBlur: () => {
|
|
1473
1492
|
P.setFieldMeta(t, (e) => ({
|
|
1474
|
-
...
|
|
1493
|
+
...Nn,
|
|
1475
1494
|
...e ?? {},
|
|
1476
1495
|
isTouched: !0,
|
|
1477
1496
|
isBlurred: !0
|
|
@@ -1498,11 +1517,11 @@ var qt = 15e3, Y = async (e, t, n) => {
|
|
|
1498
1517
|
}, [
|
|
1499
1518
|
e,
|
|
1500
1519
|
s,
|
|
1501
|
-
|
|
1520
|
+
ue,
|
|
1502
1521
|
P,
|
|
1503
1522
|
u,
|
|
1504
1523
|
y,
|
|
1505
|
-
|
|
1524
|
+
H
|
|
1506
1525
|
]), me = T((e) => ({
|
|
1507
1526
|
items: P.getFieldValue(e) ?? [],
|
|
1508
1527
|
push: (t) => {
|
|
@@ -1520,14 +1539,14 @@ var qt = 15e3, Y = async (e, t, n) => {
|
|
|
1520
1539
|
swap: (t, n) => {
|
|
1521
1540
|
P.swapFieldValues(e, t, n);
|
|
1522
1541
|
},
|
|
1523
|
-
field: (t, n) =>
|
|
1524
|
-
}), [P,
|
|
1525
|
-
|
|
1526
|
-
}, [
|
|
1542
|
+
field: (t, n) => de(`${e}.${t}.${n}`)
|
|
1543
|
+
}), [P, de]), he = T((e) => u.filter((t) => t.section === e), [u]), ge = T((e, t) => {
|
|
1544
|
+
ue(e), !Object.is(P.getFieldValue(e), t) && P.setFieldValue(e, t);
|
|
1545
|
+
}, [ue, P]), _e = T((e) => {
|
|
1527
1546
|
for (let [t, n] of Object.entries(e)) P.setFieldValue(t, n);
|
|
1528
|
-
}, [P]),
|
|
1547
|
+
}, [P]), ve = T((e) => {
|
|
1529
1548
|
S({}), w(void 0), te(void 0), j.current = void 0, e === void 0 ? P.reset() : P.reset(ne(e));
|
|
1530
|
-
}, [P, ne]),
|
|
1549
|
+
}, [P, ne]), ye = n.asyncTimeoutMs ?? 5e3, U = T(async () => {
|
|
1531
1550
|
let e = Date.now();
|
|
1532
1551
|
for (;;) {
|
|
1533
1552
|
let t = m.current;
|
|
@@ -1540,18 +1559,18 @@ var qt = 15e3, Y = async (e, t, n) => {
|
|
|
1540
1559
|
fallback: "Invalid value"
|
|
1541
1560
|
}, _.current)]));
|
|
1542
1561
|
}
|
|
1543
|
-
if (Date.now() - e >
|
|
1562
|
+
if (Date.now() - e > ye) return Object.fromEntries(r.map(([e]) => [e, b({
|
|
1544
1563
|
id: "validation.checking",
|
|
1545
1564
|
fallback: "Still checking…"
|
|
1546
1565
|
}, _.current)]));
|
|
1547
1566
|
await new Promise((e) => setTimeout(e, 50));
|
|
1548
1567
|
}
|
|
1549
|
-
}, [
|
|
1568
|
+
}, [ye]), W = T(() => {
|
|
1550
1569
|
let t = globalThis.document;
|
|
1551
1570
|
if (t?.getElementById === void 0) return;
|
|
1552
1571
|
let n = [...u.map((e) => e.name), ...Object.keys(y).filter((e) => !u.some((t) => t.name === e))];
|
|
1553
|
-
for (let r of n) if (
|
|
1554
|
-
t.getElementById(
|
|
1572
|
+
for (let r of n) if (H(r) !== void 0) {
|
|
1573
|
+
t.getElementById(Mn(e, s, r))?.focus?.();
|
|
1555
1574
|
return;
|
|
1556
1575
|
}
|
|
1557
1576
|
}, [
|
|
@@ -1559,9 +1578,9 @@ var qt = 15e3, Y = async (e, t, n) => {
|
|
|
1559
1578
|
s,
|
|
1560
1579
|
u,
|
|
1561
1580
|
y,
|
|
1562
|
-
|
|
1563
|
-
]),
|
|
1564
|
-
|
|
1581
|
+
H
|
|
1582
|
+
]), be = k(W);
|
|
1583
|
+
be.current = W;
|
|
1565
1584
|
let xe = T(async () => {
|
|
1566
1585
|
w(void 0), S({}), te(void 0), j.current = void 0;
|
|
1567
1586
|
let e, t = !1;
|
|
@@ -1569,7 +1588,7 @@ var qt = 15e3, Y = async (e, t, n) => {
|
|
|
1569
1588
|
t = !0, e = n;
|
|
1570
1589
|
}), t) throw e;
|
|
1571
1590
|
return j.current === void 0 && queueMicrotask(() => {
|
|
1572
|
-
|
|
1591
|
+
be.current();
|
|
1573
1592
|
}), j.current;
|
|
1574
1593
|
}, [P]);
|
|
1575
1594
|
re.current = (async (e) => {
|
|
@@ -1582,7 +1601,7 @@ var qt = 15e3, Y = async (e, t, n) => {
|
|
|
1582
1601
|
}
|
|
1583
1602
|
if (M(n).length > 0) {
|
|
1584
1603
|
queueMicrotask(() => {
|
|
1585
|
-
|
|
1604
|
+
be.current();
|
|
1586
1605
|
});
|
|
1587
1606
|
return;
|
|
1588
1607
|
}
|
|
@@ -1591,13 +1610,13 @@ var qt = 15e3, Y = async (e, t, n) => {
|
|
|
1591
1610
|
let e = ee(i, r);
|
|
1592
1611
|
e.dropped.length > 0 && process.env.NODE_ENV !== "production" && console.warn(`[@voltro/client] useFormBinding: dropped ${e.dropped.length} value(s) the mutation's input does not declare (${e.dropped.join(", ")}). The server refuses undeclared fields, so they are not sent. Map them with \`toInput\` if they belong in the write; ignore this if they are form-only state.`), r = e.input;
|
|
1593
1612
|
}
|
|
1594
|
-
let a = await
|
|
1613
|
+
let a = await U();
|
|
1595
1614
|
if (a !== void 0) {
|
|
1596
1615
|
S((e) => ({
|
|
1597
1616
|
...e,
|
|
1598
1617
|
...a
|
|
1599
1618
|
})), queueMicrotask(() => {
|
|
1600
|
-
|
|
1619
|
+
be.current();
|
|
1601
1620
|
});
|
|
1602
1621
|
return;
|
|
1603
1622
|
}
|
|
@@ -1625,141 +1644,141 @@ var qt = 15e3, Y = async (e, t, n) => {
|
|
|
1625
1644
|
...e,
|
|
1626
1645
|
...n
|
|
1627
1646
|
})), queueMicrotask(() => {
|
|
1628
|
-
|
|
1647
|
+
be.current();
|
|
1629
1648
|
});
|
|
1630
1649
|
}
|
|
1631
1650
|
});
|
|
1632
|
-
let Se = R.length === 0, Ce = Object.values(m.current ?? {}).some((e) => e.status === "checking"), we = E ?? c.error,
|
|
1633
|
-
for (let e of u) if (
|
|
1634
|
-
let e = Object.keys(
|
|
1651
|
+
let Se = R.length === 0, Ce = Object.values(m.current ?? {}).some((e) => e.status === "checking"), we = E ?? c.error, G = we !== void 0 && ce(we).length > 0 ? void 0 : we, Te = Object.keys(le).length, Ee = (() => {
|
|
1652
|
+
for (let e of u) if (le[e.name] !== void 0) return e.name;
|
|
1653
|
+
let e = Object.keys(le);
|
|
1635
1654
|
return e.length > 0 ? e[0] : void 0;
|
|
1636
|
-
})(),
|
|
1637
|
-
isDirty: !
|
|
1655
|
+
})(), De = {
|
|
1656
|
+
isDirty: !z && L.isDirty,
|
|
1638
1657
|
isPristine: L.isPristine,
|
|
1639
1658
|
isTouched: L.isTouched,
|
|
1640
1659
|
isValid: Se,
|
|
1641
1660
|
isValidating: Ce,
|
|
1642
|
-
canSubmit: Se && !Ce && !L.isSubmitting && !
|
|
1661
|
+
canSubmit: Se && !Ce && !L.isSubmitting && !z,
|
|
1643
1662
|
isSubmitting: L.isSubmitting,
|
|
1644
1663
|
isSubmitted: L.isSubmitted,
|
|
1645
1664
|
isSubmitSuccessful: L.isSubmitSuccessful && j.current !== void 0,
|
|
1646
1665
|
submissionAttempts: L.submissionAttempts,
|
|
1647
|
-
errorCount:
|
|
1648
|
-
firstInvalidPath:
|
|
1666
|
+
errorCount: Te,
|
|
1667
|
+
firstInvalidPath: Ee,
|
|
1649
1668
|
pending: c.pending,
|
|
1650
|
-
isLoading:
|
|
1651
|
-
submitError:
|
|
1669
|
+
isLoading: z,
|
|
1670
|
+
submitError: G,
|
|
1652
1671
|
data: c.data
|
|
1653
|
-
},
|
|
1672
|
+
}, Oe = {
|
|
1654
1673
|
fields: u,
|
|
1655
1674
|
values: I,
|
|
1656
|
-
errors:
|
|
1675
|
+
errors: le,
|
|
1657
1676
|
issues: R,
|
|
1658
1677
|
isValid: Se,
|
|
1659
1678
|
pending: c.pending,
|
|
1660
|
-
submitError:
|
|
1679
|
+
submitError: G,
|
|
1661
1680
|
formError: C,
|
|
1662
1681
|
data: c.data,
|
|
1663
|
-
setValue:
|
|
1664
|
-
setValues:
|
|
1665
|
-
reset:
|
|
1682
|
+
setValue: ge,
|
|
1683
|
+
setValues: _e,
|
|
1684
|
+
reset: ve,
|
|
1666
1685
|
submit: xe,
|
|
1667
|
-
field:
|
|
1686
|
+
field: de,
|
|
1668
1687
|
array: me,
|
|
1669
1688
|
section: he,
|
|
1670
|
-
state:
|
|
1671
|
-
focusFirstInvalid:
|
|
1689
|
+
state: De,
|
|
1690
|
+
focusFirstInvalid: W
|
|
1672
1691
|
};
|
|
1673
|
-
return Object.defineProperty(
|
|
1692
|
+
return Object.defineProperty(Oe, kn, {
|
|
1674
1693
|
value: {
|
|
1675
1694
|
store: N.store,
|
|
1676
|
-
field:
|
|
1695
|
+
field: de
|
|
1677
1696
|
},
|
|
1678
1697
|
enumerable: !1
|
|
1679
|
-
}),
|
|
1680
|
-
},
|
|
1681
|
-
function
|
|
1682
|
-
let n = E(
|
|
1698
|
+
}), Oe;
|
|
1699
|
+
}, In = (e) => w(An.Provider, { value: e.binding }, e.children), Ln = () => E(An);
|
|
1700
|
+
function Rn(e, t) {
|
|
1701
|
+
let n = E(An), r = typeof e == "string" ? void 0 : e, i = typeof e == "string" ? e : t, a = r ?? n;
|
|
1683
1702
|
if (a === void 0) throw Error("useFormField(path) found no form binding — mount <FormBindingProvider binding={form}> above this field, or call useFormField(form, path) with the binding in hand.");
|
|
1684
|
-
let o = a[
|
|
1703
|
+
let o = a[kn];
|
|
1685
1704
|
if (o === void 0) throw Error("useFormField: not a useFormBinding result");
|
|
1686
|
-
return
|
|
1705
|
+
return pe(o.store, (e) => {
|
|
1687
1706
|
let t = e.fieldMetaBase[i];
|
|
1688
|
-
return `${JSON.stringify(
|
|
1707
|
+
return `${JSON.stringify(jn(e.values, i))}|${t === void 0 ? "" : `${String(t.isTouched)}${String(t.isBlurred)}${JSON.stringify(t.errorMap)}`}|${e.submissionAttempts}`;
|
|
1689
1708
|
}), o.field(i);
|
|
1690
1709
|
}
|
|
1691
1710
|
//#endregion
|
|
1692
1711
|
//#region src/createHooks.ts
|
|
1693
|
-
var
|
|
1694
|
-
useSubscription: (t, n, r) =>
|
|
1695
|
-
useMutation: (t) =>
|
|
1696
|
-
useAction: (t) =>
|
|
1697
|
-
useFormBinding: (t, n) =>
|
|
1698
|
-
}),
|
|
1699
|
-
|
|
1700
|
-
},
|
|
1701
|
-
let i =
|
|
1712
|
+
var zn = Y, Bn = (e) => ({
|
|
1713
|
+
useSubscription: (t, n, r) => zn(e, t, n, r),
|
|
1714
|
+
useMutation: (t) => bn(e, t),
|
|
1715
|
+
useAction: (t) => Tn(e, t),
|
|
1716
|
+
useFormBinding: (t, n) => Fn(e, t, n ?? {})
|
|
1717
|
+
}), Vn = () => ({ seeds: [] }), Hn = null, Un = (e) => {
|
|
1718
|
+
Hn = e;
|
|
1719
|
+
}, Wn = /* @__PURE__ */ new Map(), Gn = (e, t) => `${e}\u0000${t}`, Kn = (e, t, n, r) => {
|
|
1720
|
+
let i = Hn?.() ?? null;
|
|
1702
1721
|
if (i === null) throw Error(`seedPreloadedSubscription('${e}', '${t}') was called outside a server render. Preload seeds exist to put a subscription's first value into the SSR hydration payload; on the client the live subscription already provides it. (If this IS server code, the render did not install a seed bag — that is a framework bug.)`);
|
|
1703
1722
|
i.seeds.push({
|
|
1704
1723
|
api: e,
|
|
1705
|
-
key:
|
|
1724
|
+
key: W([t, n]),
|
|
1706
1725
|
value: r
|
|
1707
1726
|
});
|
|
1708
|
-
},
|
|
1709
|
-
let r =
|
|
1727
|
+
}, qn = (e, t, n) => {
|
|
1728
|
+
let r = Hn?.() ?? null;
|
|
1710
1729
|
r !== null && r.seeds.push({
|
|
1711
1730
|
api: e,
|
|
1712
|
-
key:
|
|
1731
|
+
key: W([t, n]),
|
|
1713
1732
|
value: void 0,
|
|
1714
1733
|
failed: !0
|
|
1715
1734
|
});
|
|
1716
|
-
},
|
|
1717
|
-
if (e !== void 0) for (let t of e)
|
|
1735
|
+
}, Jn = (e) => {
|
|
1736
|
+
if (e !== void 0) for (let t of e) Wn.set(Gn(t.api, t.key), {
|
|
1718
1737
|
value: t.value,
|
|
1719
1738
|
failed: t.failed === !0
|
|
1720
1739
|
});
|
|
1721
|
-
},
|
|
1722
|
-
let r =
|
|
1740
|
+
}, Yn = (e, t, n) => {
|
|
1741
|
+
let r = W([t, n]), i = Hn?.() ?? null;
|
|
1723
1742
|
if (i !== null) {
|
|
1724
1743
|
for (let t of i.seeds) if (t.api === e && t.key === r) return t.failed === !0 ? void 0 : t.value;
|
|
1725
1744
|
return;
|
|
1726
1745
|
}
|
|
1727
|
-
let a =
|
|
1746
|
+
let a = Wn.get(Gn(e, r));
|
|
1728
1747
|
return a === void 0 || a.failed ? void 0 : a.value;
|
|
1729
|
-
},
|
|
1730
|
-
let r =
|
|
1748
|
+
}, Xn = (e, t, n) => {
|
|
1749
|
+
let r = W([t, n]), i = Hn?.() ?? null;
|
|
1731
1750
|
if (i !== null) {
|
|
1732
1751
|
for (let t of i.seeds) if (t.api === e && t.key === r) return t.failed === !0 ? "failed" : "seeded";
|
|
1733
1752
|
return "absent";
|
|
1734
1753
|
}
|
|
1735
|
-
let a =
|
|
1754
|
+
let a = Wn.get(Gn(e, r));
|
|
1736
1755
|
return a === void 0 ? "absent" : a.failed ? "failed" : "seeded";
|
|
1737
|
-
},
|
|
1738
|
-
|
|
1756
|
+
}, Zn = () => {
|
|
1757
|
+
Wn.clear();
|
|
1739
1758
|
};
|
|
1740
1759
|
//#endregion
|
|
1741
1760
|
//#region src/usePreloadedSubscription.ts
|
|
1742
|
-
function
|
|
1743
|
-
let i =
|
|
1761
|
+
function Qn(e, t, n = {}, r = {}) {
|
|
1762
|
+
let i = Yn(e, t, n), a = Y(e, t, n, i === void 0 ? r : {
|
|
1744
1763
|
...r,
|
|
1745
1764
|
initialSnapshot: i
|
|
1746
1765
|
});
|
|
1747
|
-
return
|
|
1766
|
+
return Xn(e, t, n) === "failed" ? {
|
|
1748
1767
|
...a,
|
|
1749
1768
|
preloadFailed: !0
|
|
1750
1769
|
} : a;
|
|
1751
1770
|
}
|
|
1752
1771
|
//#endregion
|
|
1753
1772
|
//#region src/useEvent.ts
|
|
1754
|
-
var
|
|
1773
|
+
var $n = {
|
|
1755
1774
|
status: "idle",
|
|
1756
1775
|
missed: 0,
|
|
1757
1776
|
lastMiss: void 0
|
|
1758
|
-
},
|
|
1777
|
+
}, er = class {
|
|
1759
1778
|
_tag = "EventStreamClosed";
|
|
1760
1779
|
};
|
|
1761
|
-
function
|
|
1762
|
-
let { skip: i = !1, apiName: a = "app", onMissed: o } = r, s =
|
|
1780
|
+
function tr(e, t, n, r = {}) {
|
|
1781
|
+
let { skip: i = !1, apiName: a = "app", onMissed: o } = r, s = q(a), { runtime: c, client: l } = s, [u, d] = A($n), f = k(n);
|
|
1763
1782
|
f.current = n;
|
|
1764
1783
|
let p = k(o);
|
|
1765
1784
|
p.current = o;
|
|
@@ -1783,10 +1802,10 @@ function Xn(e, t, n, r = {}) {
|
|
|
1783
1802
|
count: e,
|
|
1784
1803
|
reason: t
|
|
1785
1804
|
}));
|
|
1786
|
-
}, []), x = !i && _ !== null && !
|
|
1805
|
+
}, []), x = !i && _ !== null && !et(s);
|
|
1787
1806
|
return D(() => {
|
|
1788
1807
|
if (!x) {
|
|
1789
|
-
d(
|
|
1808
|
+
d($n);
|
|
1790
1809
|
return;
|
|
1791
1810
|
}
|
|
1792
1811
|
d((e) => ({
|
|
@@ -1798,18 +1817,18 @@ function Xn(e, t, n, r = {}) {
|
|
|
1798
1817
|
origin: e,
|
|
1799
1818
|
n: t
|
|
1800
1819
|
}));
|
|
1801
|
-
return
|
|
1820
|
+
return J(m.current, e.name)({
|
|
1802
1821
|
key: v.current,
|
|
1803
1822
|
...t.length > 0 ? { resume: t } : {}
|
|
1804
1823
|
});
|
|
1805
|
-
}), r =
|
|
1824
|
+
}), r = B.unwrap(n).pipe(B.tap(() => N.sync(() => {
|
|
1806
1825
|
t = 0;
|
|
1807
|
-
})),
|
|
1826
|
+
})), B.concat(B.fail(new er())), B.retry(z.exponential("250 millis", 2).pipe(z.either(z.spaced("30 seconds")), z.jittered, z.tapOutput(() => N.sync(() => {
|
|
1808
1827
|
t += 1, d((e) => ({
|
|
1809
1828
|
...e,
|
|
1810
1829
|
status: "connecting"
|
|
1811
1830
|
}));
|
|
1812
|
-
}))))), i = h.current.runFork(
|
|
1831
|
+
}))))), i = h.current.runFork(B.runForEach(r, (e) => N.sync(() => {
|
|
1813
1832
|
if (e._tag === "attached") {
|
|
1814
1833
|
d((e) => ({
|
|
1815
1834
|
...e,
|
|
@@ -1831,11 +1850,11 @@ function Xn(e, t, n, r = {}) {
|
|
|
1831
1850
|
_,
|
|
1832
1851
|
e.name,
|
|
1833
1852
|
b
|
|
1834
|
-
]), x ? u :
|
|
1853
|
+
]), x ? u : $n;
|
|
1835
1854
|
}
|
|
1836
1855
|
//#endregion
|
|
1837
1856
|
//#region src/sequence.ts
|
|
1838
|
-
var
|
|
1857
|
+
var nr = () => {
|
|
1839
1858
|
let e = (t) => ({
|
|
1840
1859
|
steps: t,
|
|
1841
1860
|
step: ((n, r, i) => e([...t, {
|
|
@@ -1847,7 +1866,7 @@ var Zn = () => {
|
|
|
1847
1866
|
}]))
|
|
1848
1867
|
});
|
|
1849
1868
|
return e([]);
|
|
1850
|
-
},
|
|
1869
|
+
}, rr = async (e, t = {}) => {
|
|
1851
1870
|
let n = {}, r = [];
|
|
1852
1871
|
for (let i of e.steps) {
|
|
1853
1872
|
if (i.when !== void 0 && !i.when(n)) {
|
|
@@ -1907,13 +1926,13 @@ var Zn = () => {
|
|
|
1907
1926
|
ok: !0,
|
|
1908
1927
|
data: n
|
|
1909
1928
|
};
|
|
1910
|
-
},
|
|
1929
|
+
}, ir = (e = {}) => {
|
|
1911
1930
|
let [t, n] = A(!1), [r, i] = A(void 0), [a, o] = A(void 0), s = k(e);
|
|
1912
1931
|
return s.current = e, {
|
|
1913
1932
|
run: T(async (e, t = {}) => {
|
|
1914
1933
|
n(!0), i(void 0), o(void 0);
|
|
1915
1934
|
try {
|
|
1916
|
-
let n = await
|
|
1935
|
+
let n = await rr(e, {
|
|
1917
1936
|
...s.current,
|
|
1918
1937
|
...t
|
|
1919
1938
|
});
|
|
@@ -1926,7 +1945,7 @@ var Zn = () => {
|
|
|
1926
1945
|
error: r,
|
|
1927
1946
|
failedStep: a
|
|
1928
1947
|
};
|
|
1929
|
-
},
|
|
1948
|
+
}, ar = "@voltro/plugin-storage", $ = (e) => le(ar, e), or = (e, t, n, r) => new Promise((i, a) => {
|
|
1930
1949
|
let o = new XMLHttpRequest();
|
|
1931
1950
|
if (o.open("PUT", e), o.upload.onprogress = (e) => {
|
|
1932
1951
|
e.lengthComputable && n(e.loaded / e.total);
|
|
@@ -1940,7 +1959,7 @@ var Zn = () => {
|
|
|
1940
1959
|
return;
|
|
1941
1960
|
}
|
|
1942
1961
|
r.addEventListener("abort", () => o.abort(), { once: !0 }), o.send(t);
|
|
1943
|
-
}),
|
|
1962
|
+
}), sr = (e, t, n, r, i, a) => new Promise((o, s) => {
|
|
1944
1963
|
let c = new XMLHttpRequest();
|
|
1945
1964
|
if (c.open("POST", e), c.setRequestHeader("content-type", t), c.upload.onprogress = (e) => {
|
|
1946
1965
|
e.lengthComputable && r(e.loaded / e.total);
|
|
@@ -1958,7 +1977,7 @@ var Zn = () => {
|
|
|
1958
1977
|
return;
|
|
1959
1978
|
}
|
|
1960
1979
|
i.addEventListener("abort", () => c.abort(), { once: !0 }), c.send(n);
|
|
1961
|
-
}),
|
|
1980
|
+
}), cr = (e, t, n, r, i) => new Promise((a, o) => {
|
|
1962
1981
|
let s = new XMLHttpRequest();
|
|
1963
1982
|
if (s.open("PUT", e), s.setRequestHeader("content-type", t), s.upload.onprogress = (e) => {
|
|
1964
1983
|
e.lengthComputable && r(e.loaded / e.total);
|
|
@@ -1969,7 +1988,7 @@ var Zn = () => {
|
|
|
1969
1988
|
return;
|
|
1970
1989
|
}
|
|
1971
1990
|
i.addEventListener("abort", () => s.abort(), { once: !0 }), s.send(n);
|
|
1972
|
-
}),
|
|
1991
|
+
}), lr = (e, t, n, r, i) => new Promise((a, o) => {
|
|
1973
1992
|
let s = new XMLHttpRequest();
|
|
1974
1993
|
if (s.open("POST", e), s.setRequestHeader("content-type", t), s.upload.onprogress = (e) => {
|
|
1975
1994
|
e.lengthComputable && r(e.loaded / e.total);
|
|
@@ -1985,62 +2004,64 @@ var Zn = () => {
|
|
|
1985
2004
|
return;
|
|
1986
2005
|
}
|
|
1987
2006
|
i.addEventListener("abort", () => s.abort(), { once: !0 }), s.send(n);
|
|
1988
|
-
}),
|
|
1989
|
-
let n =
|
|
1990
|
-
|
|
1991
|
-
let [
|
|
1992
|
-
|
|
1993
|
-
}, []),
|
|
1994
|
-
|
|
1995
|
-
}, []),
|
|
1996
|
-
let { runtime: s, client: c } = await
|
|
2007
|
+
}), ur = (e, t = {}) => {
|
|
2008
|
+
let n = q(e), { inspectBaseUrl: r } = n, i = k(n);
|
|
2009
|
+
i.current = n;
|
|
2010
|
+
let [a, o] = A(0), [s, c] = A("idle"), [l, u] = A(void 0), d = k(null), f = T(() => {
|
|
2011
|
+
o(0), c("idle"), u(void 0);
|
|
2012
|
+
}, []), p = T(() => {
|
|
2013
|
+
d.current?.abort();
|
|
2014
|
+
}, []), m = T((e) => /^https?:\/\//.test(e) ? e : `${r}${e}`, [r]), h = T(async (n, r, a, o) => {
|
|
2015
|
+
let { runtime: s, client: c } = await X(i, e, "storage.upload").catch((e) => {
|
|
2016
|
+
throw ye(e, "client");
|
|
2017
|
+
}), l = Math.max(0, r.retries ?? t.retries ?? 1), u = (n instanceof File, n.type || "application/octet-stream"), d = n instanceof File ? n.name : "blob", f = r.visibility ?? t.visibility, p = r.key ?? t.key, h = r.folder ?? t.folder, g = r.tags ?? t.tags, _ = {
|
|
1997
2018
|
...f ? { visibility: f } : {},
|
|
1998
|
-
...
|
|
2019
|
+
...h ? { folder: h } : {},
|
|
1999
2020
|
...g ? { tags: g } : {},
|
|
2000
2021
|
...r.alt ? { alt: r.alt } : {},
|
|
2001
2022
|
...r.caption ? { caption: r.caption } : {}
|
|
2002
2023
|
}, v = (e) => ({
|
|
2003
2024
|
id: e.id,
|
|
2004
|
-
url:
|
|
2025
|
+
url: m(e.url),
|
|
2005
2026
|
name: d,
|
|
2006
2027
|
mime: e.contentType,
|
|
2007
2028
|
size: e.size,
|
|
2008
2029
|
...e.width === void 0 ? {} : { width: e.width },
|
|
2009
2030
|
...e.height === void 0 ? {} : { height: e.height }
|
|
2010
2031
|
}), y = async () => {
|
|
2011
|
-
let e = r.mintTag ?? t.mintTag ?? $("mintUploadTicket"),
|
|
2032
|
+
let e = r.mintTag ?? t.mintTag ?? $("mintUploadTicket"), i = J(c, e), l = await Z(s, i({
|
|
2012
2033
|
contentType: u,
|
|
2013
2034
|
..._,
|
|
2014
2035
|
...p ? { key: p } : {}
|
|
2015
|
-
})), d = await
|
|
2036
|
+
})), d = await lr(m(l.uploadUrl), u, n, o, a);
|
|
2016
2037
|
return v(d);
|
|
2017
2038
|
}, b = async () => {
|
|
2018
|
-
let e = r.presignMintTag ?? t.presignMintTag ?? $("mintPresignedUpload"),
|
|
2039
|
+
let e = r.presignMintTag ?? t.presignMintTag ?? $("mintPresignedUpload"), i = r.finalizeTag ?? t.finalizeTag ?? $("finalizeUpload"), l;
|
|
2019
2040
|
try {
|
|
2020
|
-
let t =
|
|
2021
|
-
l = await
|
|
2041
|
+
let t = J(c, e);
|
|
2042
|
+
l = await Z(s, t({
|
|
2022
2043
|
contentType: u,
|
|
2023
2044
|
..._
|
|
2024
2045
|
}));
|
|
2025
2046
|
} catch {
|
|
2026
2047
|
return null;
|
|
2027
2048
|
}
|
|
2028
|
-
await
|
|
2029
|
-
let d =
|
|
2049
|
+
await cr(l.uploadUrl, u, n, o, a);
|
|
2050
|
+
let d = J(c, i), f = await Z(s, d({ finalizeToken: l.finalizeToken }));
|
|
2030
2051
|
return v(f);
|
|
2031
2052
|
}, x = async () => {
|
|
2032
|
-
let e = r.beginResumableTag ?? t.beginResumableTag ?? $("beginResumableUpload"),
|
|
2053
|
+
let e = r.beginResumableTag ?? t.beginResumableTag ?? $("beginResumableUpload"), i = J(c, e), l = n.size, d = r.chunkSize ?? t.chunkSize, f = await Z(s, i({
|
|
2033
2054
|
contentType: u,
|
|
2034
2055
|
size: l,
|
|
2035
2056
|
..._,
|
|
2036
2057
|
...d ? { chunkSize: d } : {}
|
|
2037
|
-
})), p =
|
|
2058
|
+
})), p = m(f.uploadUrl), h = Math.max(1, f.chunkSize), g = Math.max(1, Math.ceil(l / h)), y = Math.max(0, r.retries ?? t.retries ?? 1), b = 0, x = null;
|
|
2038
2059
|
for (let e = 0; e < g; e++) {
|
|
2039
|
-
let t = e *
|
|
2060
|
+
let t = e * h, r = Math.min(l, t + h), i = n.slice(t, r), s = e === g - 1, c = r - t, d = 0;
|
|
2040
2061
|
for (;;) {
|
|
2041
|
-
if (
|
|
2062
|
+
if (a.aborted) throw new DOMException("upload aborted", "AbortError");
|
|
2042
2063
|
try {
|
|
2043
|
-
let t = await
|
|
2064
|
+
let t = await sr(`${p}?${`token=${encodeURIComponent(f.resumableToken)}&index=${e}${s ? "&final=1" : ""}`}`, u, i, (e) => o((b + e * c) / l), a, s);
|
|
2044
2065
|
s && (x = t);
|
|
2045
2066
|
break;
|
|
2046
2067
|
} catch (e) {
|
|
@@ -2052,29 +2073,29 @@ var Zn = () => {
|
|
|
2052
2073
|
if (!x) throw Error("resumable upload produced no final reply");
|
|
2053
2074
|
return v(x);
|
|
2054
2075
|
}, S = async () => {
|
|
2055
|
-
let e = r.multipartBeginTag ?? t.multipartBeginTag ?? $("beginMultipartUpload"),
|
|
2076
|
+
let e = r.multipartBeginTag ?? t.multipartBeginTag ?? $("beginMultipartUpload"), i = r.multipartSignTag ?? t.multipartSignTag ?? $("signMultipartPart"), l = r.multipartCompleteTag ?? t.multipartCompleteTag ?? $("completeMultipartUpload"), f = r.multipartAbortTag ?? t.multipartAbortTag ?? $("abortMultipartUpload"), p = n.size, h = r.chunkSize ?? t.chunkSize, g;
|
|
2056
2077
|
try {
|
|
2057
|
-
let t =
|
|
2058
|
-
g = await
|
|
2078
|
+
let t = J(c, e);
|
|
2079
|
+
g = await Z(s, t({
|
|
2059
2080
|
contentType: u,
|
|
2060
2081
|
size: p,
|
|
2061
2082
|
..._,
|
|
2062
|
-
...
|
|
2083
|
+
...h ? { partSize: h } : {}
|
|
2063
2084
|
}));
|
|
2064
2085
|
} catch {
|
|
2065
2086
|
return null;
|
|
2066
2087
|
}
|
|
2067
|
-
let v =
|
|
2088
|
+
let v = J(c, i), y = J(c, l), b = J(c, f), x = Math.max(1, g.partSize), S = Math.max(1, Math.ceil(p / x)), ee = Math.max(0, r.retries ?? t.retries ?? 1), C = [], w = 0;
|
|
2068
2089
|
try {
|
|
2069
2090
|
for (let e = 0; e < S; e++) {
|
|
2070
|
-
let t = e * x, r = Math.min(p, t + x),
|
|
2091
|
+
let t = e * x, r = Math.min(p, t + x), i = n.slice(t, r), c = e + 1, l = r - t, u = 0;
|
|
2071
2092
|
for (;;) {
|
|
2072
|
-
if (
|
|
2093
|
+
if (a.aborted) throw new DOMException("upload aborted", "AbortError");
|
|
2073
2094
|
try {
|
|
2074
|
-
let { url: e } = await
|
|
2095
|
+
let { url: e } = await Z(s, v({
|
|
2075
2096
|
multipartToken: g.multipartToken,
|
|
2076
2097
|
partNumber: c
|
|
2077
|
-
})), t = await
|
|
2098
|
+
})), t = await or(e, i, (e) => o((w + e * l) / p), a);
|
|
2078
2099
|
C.push({
|
|
2079
2100
|
partNumber: c,
|
|
2080
2101
|
etag: t
|
|
@@ -2086,20 +2107,20 @@ var Zn = () => {
|
|
|
2086
2107
|
}
|
|
2087
2108
|
w += l, o(w / p);
|
|
2088
2109
|
}
|
|
2089
|
-
let e = await
|
|
2110
|
+
let e = await Z(s, y({
|
|
2090
2111
|
multipartToken: g.multipartToken,
|
|
2091
2112
|
parts: C
|
|
2092
2113
|
}));
|
|
2093
2114
|
return {
|
|
2094
2115
|
id: e.id,
|
|
2095
|
-
url:
|
|
2116
|
+
url: m(e.url),
|
|
2096
2117
|
name: d,
|
|
2097
2118
|
mime: u,
|
|
2098
2119
|
size: e.size
|
|
2099
2120
|
};
|
|
2100
2121
|
} catch (e) {
|
|
2101
2122
|
try {
|
|
2102
|
-
await
|
|
2123
|
+
await Z(s, b({ multipartToken: g.multipartToken }));
|
|
2103
2124
|
} catch {}
|
|
2104
2125
|
throw e;
|
|
2105
2126
|
}
|
|
@@ -2108,7 +2129,7 @@ var Zn = () => {
|
|
|
2108
2129
|
if ((r.prefer ?? t.prefer) === "resumable") return await x();
|
|
2109
2130
|
let ee = (r.prefer ?? t.prefer) === "presign", C;
|
|
2110
2131
|
for (let e = 0; e <= l; e++) {
|
|
2111
|
-
if (
|
|
2132
|
+
if (a.aborted) throw new DOMException("upload aborted", "AbortError");
|
|
2112
2133
|
try {
|
|
2113
2134
|
if (ee) {
|
|
2114
2135
|
let e = await b();
|
|
@@ -2122,7 +2143,7 @@ var Zn = () => {
|
|
|
2122
2143
|
throw C;
|
|
2123
2144
|
}, [
|
|
2124
2145
|
e,
|
|
2125
|
-
|
|
2146
|
+
m,
|
|
2126
2147
|
t.mintTag,
|
|
2127
2148
|
t.presignMintTag,
|
|
2128
2149
|
t.finalizeTag,
|
|
@@ -2138,88 +2159,85 @@ var Zn = () => {
|
|
|
2138
2159
|
t.folder,
|
|
2139
2160
|
t.tags,
|
|
2140
2161
|
t.retries
|
|
2141
|
-
]),
|
|
2162
|
+
]), g = T(async (e, n = {}) => {
|
|
2142
2163
|
let r = new AbortController();
|
|
2143
|
-
|
|
2164
|
+
d.current = r, c("uploading"), u(void 0), o(0);
|
|
2144
2165
|
try {
|
|
2145
|
-
let t = await
|
|
2146
|
-
return
|
|
2166
|
+
let t = await h(e, n, r.signal, o);
|
|
2167
|
+
return o(1), c("success"), t;
|
|
2147
2168
|
} catch (e) {
|
|
2148
|
-
throw
|
|
2169
|
+
throw c("error"), u(e), e instanceof DOMException && e.name === "AbortError" || i.current.errorBus.emit({
|
|
2149
2170
|
source: "action",
|
|
2150
2171
|
tag: n.mintTag ?? t.mintTag ?? $("mintUploadTicket"),
|
|
2151
|
-
error: e
|
|
2172
|
+
error: e,
|
|
2173
|
+
kind: U(e, "unknown")
|
|
2152
2174
|
}), e;
|
|
2153
2175
|
}
|
|
2154
|
-
}, [
|
|
2155
|
-
g,
|
|
2156
|
-
i,
|
|
2157
|
-
t.mintTag
|
|
2158
|
-
]), v = T(async (e, n = {}) => {
|
|
2176
|
+
}, [h, t.mintTag]), _ = T(async (e, n = {}) => {
|
|
2159
2177
|
if (e.length === 0) return [];
|
|
2160
2178
|
let r = new AbortController();
|
|
2161
|
-
|
|
2162
|
-
let a = Math.max(1, n.concurrency ?? t.concurrency ?? 3),
|
|
2179
|
+
d.current = r, c("uploading"), u(void 0), o(0);
|
|
2180
|
+
let a = Math.max(1, n.concurrency ?? t.concurrency ?? 3), s = Array(e.length), l = Array(e.length).fill(0), f = () => o(l.reduce((e, t) => e + t, 0) / e.length), p = 0, m = async () => {
|
|
2163
2181
|
for (;;) {
|
|
2164
2182
|
let t = p++;
|
|
2165
2183
|
if (t >= e.length) return;
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
}),
|
|
2184
|
+
s[t] = await h(e[t], n, r.signal, (e) => {
|
|
2185
|
+
l[t] = e, f();
|
|
2186
|
+
}), l[t] = 1, f();
|
|
2169
2187
|
}
|
|
2170
2188
|
};
|
|
2171
2189
|
try {
|
|
2172
|
-
return await Promise.all(Array.from({ length: Math.min(a, e.length) }, () => m())),
|
|
2190
|
+
return await Promise.all(Array.from({ length: Math.min(a, e.length) }, () => m())), o(1), c("success"), s;
|
|
2173
2191
|
} catch (e) {
|
|
2174
|
-
throw r.abort(),
|
|
2192
|
+
throw r.abort(), c("error"), u(e), e instanceof DOMException && e.name === "AbortError" || i.current.errorBus.emit({
|
|
2175
2193
|
source: "action",
|
|
2176
2194
|
tag: n.mintTag ?? t.mintTag ?? $("mintUploadTicket"),
|
|
2177
|
-
error: e
|
|
2195
|
+
error: e,
|
|
2196
|
+
kind: U(e, "unknown")
|
|
2178
2197
|
}), e;
|
|
2179
2198
|
}
|
|
2180
2199
|
}, [
|
|
2181
|
-
|
|
2182
|
-
i,
|
|
2200
|
+
h,
|
|
2183
2201
|
t.concurrency,
|
|
2184
2202
|
t.mintTag
|
|
2185
|
-
]),
|
|
2203
|
+
]), v = T((e, t = {}) => {
|
|
2186
2204
|
e.preventDefault();
|
|
2187
2205
|
let n = e.dataTransfer ? Array.from(e.dataTransfer.files) : [];
|
|
2188
|
-
return n.length ?
|
|
2189
|
-
}, [
|
|
2206
|
+
return n.length ? _(n, t) : Promise.resolve([]);
|
|
2207
|
+
}, [_]), y = T((e, t = {}) => {
|
|
2190
2208
|
let n = e.clipboardData ? Array.from(e.clipboardData.files) : [];
|
|
2191
|
-
return n.length ?
|
|
2192
|
-
}, [
|
|
2209
|
+
return n.length ? _(n, t) : Promise.resolve([]);
|
|
2210
|
+
}, [_]), b = O(() => ({
|
|
2193
2211
|
onDragOver: (e) => e.preventDefault(),
|
|
2194
2212
|
onDrop: (e) => {
|
|
2195
|
-
|
|
2213
|
+
v(e);
|
|
2196
2214
|
}
|
|
2197
|
-
}), [
|
|
2215
|
+
}), [v]);
|
|
2198
2216
|
return O(() => ({
|
|
2199
|
-
upload:
|
|
2200
|
-
uploadMany:
|
|
2201
|
-
progress:
|
|
2202
|
-
status:
|
|
2203
|
-
error:
|
|
2204
|
-
cancel:
|
|
2205
|
-
reset:
|
|
2206
|
-
onDrop:
|
|
2207
|
-
onPaste:
|
|
2208
|
-
dropzoneProps:
|
|
2217
|
+
upload: g,
|
|
2218
|
+
uploadMany: _,
|
|
2219
|
+
progress: a,
|
|
2220
|
+
status: s,
|
|
2221
|
+
error: l,
|
|
2222
|
+
cancel: p,
|
|
2223
|
+
reset: f,
|
|
2224
|
+
onDrop: v,
|
|
2225
|
+
onPaste: y,
|
|
2226
|
+
dropzoneProps: b
|
|
2209
2227
|
}), [
|
|
2228
|
+
g,
|
|
2210
2229
|
_,
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
u,
|
|
2215
|
-
m,
|
|
2230
|
+
a,
|
|
2231
|
+
s,
|
|
2232
|
+
l,
|
|
2216
2233
|
p,
|
|
2234
|
+
f,
|
|
2235
|
+
v,
|
|
2217
2236
|
y,
|
|
2218
|
-
b
|
|
2219
|
-
x
|
|
2237
|
+
b
|
|
2220
2238
|
]);
|
|
2221
|
-
},
|
|
2222
|
-
let n =
|
|
2239
|
+
}, dr = (e, t) => {
|
|
2240
|
+
let n = ur(e), r = Tn(e, t.action), [i, a] = A("idle"), [o, s] = A(void 0), [c, l] = A(void 0), u = k(t.extra);
|
|
2223
2241
|
u.current = t.extra;
|
|
2224
2242
|
let d = T(async (e) => {
|
|
2225
2243
|
l(void 0), s(void 0), a("uploading");
|
|
@@ -2262,9 +2280,9 @@ var Zn = () => {
|
|
|
2262
2280
|
f,
|
|
2263
2281
|
p
|
|
2264
2282
|
]);
|
|
2265
|
-
},
|
|
2266
|
-
let t =
|
|
2267
|
-
|
|
2283
|
+
}, fr = async (e) => {
|
|
2284
|
+
let t = J(e.client, e.tag), n = N.currentSpan.pipe(N.tap((t) => N.sync(() => {
|
|
2285
|
+
ge({
|
|
2268
2286
|
traceId: t.traceId,
|
|
2269
2287
|
spanId: t.spanId,
|
|
2270
2288
|
source: "mutation",
|
|
@@ -2274,9 +2292,9 @@ var Zn = () => {
|
|
|
2274
2292
|
"voltro.api": e.apiName,
|
|
2275
2293
|
"rpc.tag": e.tag
|
|
2276
2294
|
} }));
|
|
2277
|
-
return
|
|
2278
|
-
},
|
|
2279
|
-
let n =
|
|
2295
|
+
return Z(e.runtime, n);
|
|
2296
|
+
}, pr = (e, t) => {
|
|
2297
|
+
let n = q(e), { descriptors: r } = n, i = k(n);
|
|
2280
2298
|
if (i.current = n, process.env.NODE_ENV !== "production") {
|
|
2281
2299
|
let n = r[t]?.kind;
|
|
2282
2300
|
n !== void 0 && n !== "workflow" && console.error(`[@voltro/client] useWorkflow('${e}', '${t}') targets a ${n}, not a workflow. Use ${n === "mutation" ? "useMutation" : n === "action" ? "useAction" : `the ${n} hook`} instead.`);
|
|
@@ -2284,7 +2302,7 @@ var Zn = () => {
|
|
|
2284
2302
|
let [a, o] = A(!1), [s, c] = A(void 0), [l, u] = A(void 0), d = T(async (n) => {
|
|
2285
2303
|
o(!0), c(void 0);
|
|
2286
2304
|
try {
|
|
2287
|
-
let { runtime: r, client: a } = await
|
|
2305
|
+
let { runtime: r, client: a } = await X(i, e, t), o = await fr({
|
|
2288
2306
|
apiName: e,
|
|
2289
2307
|
runtime: r,
|
|
2290
2308
|
client: a,
|
|
@@ -2299,8 +2317,8 @@ var Zn = () => {
|
|
|
2299
2317
|
o(!1);
|
|
2300
2318
|
}
|
|
2301
2319
|
}, [e, t]), f = T(async (t) => {
|
|
2302
|
-
let { runtime: n, client: r } = await
|
|
2303
|
-
await
|
|
2320
|
+
let { runtime: n, client: r } = await X(i, e, "__voltro.workflow.cancel");
|
|
2321
|
+
await fr({
|
|
2304
2322
|
apiName: e,
|
|
2305
2323
|
runtime: n,
|
|
2306
2324
|
client: r,
|
|
@@ -2309,8 +2327,8 @@ var Zn = () => {
|
|
|
2309
2327
|
spanPrefix: "client.workflow.cancel"
|
|
2310
2328
|
});
|
|
2311
2329
|
}, [e]), p = T(async (t) => {
|
|
2312
|
-
let { runtime: n, client: r } = await
|
|
2313
|
-
await
|
|
2330
|
+
let { runtime: n, client: r } = await X(i, e, "__voltro.workflow.resume");
|
|
2331
|
+
await fr({
|
|
2314
2332
|
apiName: e,
|
|
2315
2333
|
runtime: n,
|
|
2316
2334
|
client: r,
|
|
@@ -2319,8 +2337,8 @@ var Zn = () => {
|
|
|
2319
2337
|
spanPrefix: "client.workflow.resume"
|
|
2320
2338
|
});
|
|
2321
2339
|
}, [e]), m = T(async (t, n, r) => {
|
|
2322
|
-
let { runtime: a, client: o } = await
|
|
2323
|
-
return
|
|
2340
|
+
let { runtime: a, client: o } = await X(i, e, "__voltro.workflow.signal");
|
|
2341
|
+
return fr({
|
|
2324
2342
|
apiName: e,
|
|
2325
2343
|
runtime: a,
|
|
2326
2344
|
client: o,
|
|
@@ -2333,8 +2351,8 @@ var Zn = () => {
|
|
|
2333
2351
|
spanPrefix: "client.workflow.signal"
|
|
2334
2352
|
});
|
|
2335
2353
|
}, [e]), h = T(async (t, n, r, a) => {
|
|
2336
|
-
let { runtime: o, client: s } = await
|
|
2337
|
-
return
|
|
2354
|
+
let { runtime: o, client: s } = await X(i, e, "__voltro.workflow.update");
|
|
2355
|
+
return fr({
|
|
2338
2356
|
apiName: e,
|
|
2339
2357
|
runtime: o,
|
|
2340
2358
|
client: s,
|
|
@@ -2367,13 +2385,13 @@ var Zn = () => {
|
|
|
2367
2385
|
s,
|
|
2368
2386
|
l
|
|
2369
2387
|
]);
|
|
2370
|
-
},
|
|
2371
|
-
let t =
|
|
2388
|
+
}, mr = (e) => {
|
|
2389
|
+
let t = q(e), n = k(t);
|
|
2372
2390
|
n.current = t;
|
|
2373
2391
|
let [r, i] = A(!1), [a, o] = A(void 0), [s, c] = A(void 0), l = T(async (t, r, a) => {
|
|
2374
2392
|
i(!0), o(void 0);
|
|
2375
2393
|
try {
|
|
2376
|
-
let { runtime: i, client: o } = await
|
|
2394
|
+
let { runtime: i, client: o } = await X(n, e, "__voltro.workflow.signal"), s = await fr({
|
|
2377
2395
|
apiName: e,
|
|
2378
2396
|
runtime: i,
|
|
2379
2397
|
client: o,
|
|
@@ -2403,13 +2421,13 @@ var Zn = () => {
|
|
|
2403
2421
|
a,
|
|
2404
2422
|
s
|
|
2405
2423
|
]);
|
|
2406
|
-
},
|
|
2407
|
-
let t =
|
|
2424
|
+
}, hr = (e) => {
|
|
2425
|
+
let t = q(e), n = k(t);
|
|
2408
2426
|
n.current = t;
|
|
2409
2427
|
let [r, i] = A(!1), [a, o] = A(void 0), [s, c] = A(void 0), l = T(async (t, r, a, s) => {
|
|
2410
2428
|
i(!0), o(void 0);
|
|
2411
2429
|
try {
|
|
2412
|
-
let { runtime: i, client: o } = await
|
|
2430
|
+
let { runtime: i, client: o } = await X(n, e, "__voltro.workflow.update"), l = await fr({
|
|
2413
2431
|
apiName: e,
|
|
2414
2432
|
runtime: i,
|
|
2415
2433
|
client: o,
|
|
@@ -2440,8 +2458,8 @@ var Zn = () => {
|
|
|
2440
2458
|
a,
|
|
2441
2459
|
s
|
|
2442
2460
|
]);
|
|
2443
|
-
},
|
|
2444
|
-
let n =
|
|
2461
|
+
}, gr = (e, t) => {
|
|
2462
|
+
let n = Y(e, "__voltro.workflow.run", t ? { id: t } : {}, { skip: t === void 0 });
|
|
2445
2463
|
return n.loading || n.idle || n.failed ? {
|
|
2446
2464
|
...n,
|
|
2447
2465
|
run: void 0
|
|
@@ -2449,8 +2467,8 @@ var Zn = () => {
|
|
|
2449
2467
|
...n,
|
|
2450
2468
|
run: n.data[0]
|
|
2451
2469
|
};
|
|
2452
|
-
},
|
|
2453
|
-
let r =
|
|
2470
|
+
}, _r = (e, t = {}, n = {}) => {
|
|
2471
|
+
let r = Y(e, "__voltro.workflow.runs", t, n);
|
|
2454
2472
|
return r.loading || r.idle || r.failed ? {
|
|
2455
2473
|
...r,
|
|
2456
2474
|
runs: []
|
|
@@ -2458,8 +2476,8 @@ var Zn = () => {
|
|
|
2458
2476
|
...r,
|
|
2459
2477
|
runs: r.data
|
|
2460
2478
|
};
|
|
2461
|
-
},
|
|
2462
|
-
let n =
|
|
2479
|
+
}, vr = (e, t) => {
|
|
2480
|
+
let n = Y(e, "__voltro.workflow.run.steps", t ? { runId: t } : {}, { skip: t === void 0 });
|
|
2463
2481
|
return n.loading || n.idle || n.failed ? {
|
|
2464
2482
|
...n,
|
|
2465
2483
|
steps: []
|
|
@@ -2467,8 +2485,8 @@ var Zn = () => {
|
|
|
2467
2485
|
...n,
|
|
2468
2486
|
steps: n.data
|
|
2469
2487
|
};
|
|
2470
|
-
},
|
|
2471
|
-
let n =
|
|
2488
|
+
}, yr = (e, t) => {
|
|
2489
|
+
let n = Y(e, "__voltro.workflow.run.events", t ? { runId: t } : {}, { skip: t === void 0 });
|
|
2472
2490
|
return n.loading || n.idle || n.failed ? {
|
|
2473
2491
|
...n,
|
|
2474
2492
|
events: []
|
|
@@ -2476,8 +2494,8 @@ var Zn = () => {
|
|
|
2476
2494
|
...n,
|
|
2477
2495
|
events: n.data
|
|
2478
2496
|
};
|
|
2479
|
-
},
|
|
2480
|
-
let r =
|
|
2497
|
+
}, br = yr, xr = (e, t = {}, n = {}) => {
|
|
2498
|
+
let r = Y(e, "__voltro.workflow.domainEvents", t, n);
|
|
2481
2499
|
return r.loading || r.idle || r.failed ? {
|
|
2482
2500
|
...r,
|
|
2483
2501
|
events: []
|
|
@@ -2485,8 +2503,8 @@ var Zn = () => {
|
|
|
2485
2503
|
...r,
|
|
2486
2504
|
events: r.data
|
|
2487
2505
|
};
|
|
2488
|
-
},
|
|
2489
|
-
let n =
|
|
2506
|
+
}, Sr = (e, t) => {
|
|
2507
|
+
let n = Y(e, "__voltro.workflow.event.deliveries", t ? { eventId: t } : {}, { skip: t === void 0 });
|
|
2490
2508
|
return n.loading || n.idle || n.failed ? {
|
|
2491
2509
|
...n,
|
|
2492
2510
|
deliveries: []
|
|
@@ -2494,42 +2512,42 @@ var Zn = () => {
|
|
|
2494
2512
|
...n,
|
|
2495
2513
|
deliveries: n.data
|
|
2496
2514
|
};
|
|
2497
|
-
},
|
|
2515
|
+
}, Cr = (e, t) => {
|
|
2498
2516
|
let n = e.payload;
|
|
2499
2517
|
if (!n || typeof n != "object") return;
|
|
2500
2518
|
let r = n[t];
|
|
2501
2519
|
return typeof r == "string" ? r : void 0;
|
|
2502
|
-
},
|
|
2520
|
+
}, wr = (e) => {
|
|
2503
2521
|
let t = e.payload;
|
|
2504
2522
|
if (!t || typeof t != "object") return;
|
|
2505
2523
|
let n = t.updateId;
|
|
2506
2524
|
return typeof n == "string" ? n : void 0;
|
|
2507
|
-
},
|
|
2525
|
+
}, Tr = (e) => {
|
|
2508
2526
|
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
2509
2527
|
for (let r of e) if (r.eventType === "signal-received") {
|
|
2510
|
-
let e =
|
|
2528
|
+
let e = Cr(r, "signalName");
|
|
2511
2529
|
e && t.add(e);
|
|
2512
2530
|
} else if (r.eventType === "update-completed" || r.eventType === "update-failed") {
|
|
2513
|
-
let e =
|
|
2531
|
+
let e = wr(r);
|
|
2514
2532
|
e && n.add(e);
|
|
2515
2533
|
}
|
|
2516
2534
|
for (let r = e.length - 1; r >= 0; --r) {
|
|
2517
2535
|
let i = e[r];
|
|
2518
2536
|
if (i.eventType === "signal-awaited") {
|
|
2519
|
-
let e =
|
|
2537
|
+
let e = Cr(i, "signalName");
|
|
2520
2538
|
if (e && !t.has(e)) return {
|
|
2521
2539
|
name: e,
|
|
2522
2540
|
kind: "signal"
|
|
2523
2541
|
};
|
|
2524
2542
|
} else if (i.eventType === "update-requested") {
|
|
2525
|
-
let e =
|
|
2543
|
+
let e = wr(i), t = Cr(i, "updateName");
|
|
2526
2544
|
if (t && (!e || !n.has(e))) return {
|
|
2527
2545
|
name: t,
|
|
2528
2546
|
kind: "update"
|
|
2529
2547
|
};
|
|
2530
2548
|
}
|
|
2531
2549
|
}
|
|
2532
|
-
},
|
|
2550
|
+
}, Er = (e) => e.find((e) => e.status === "running") || (e.length > 0 ? e[e.length - 1] : void 0), Dr = (e, t) => {
|
|
2533
2551
|
if (!e || e.status !== "failed") return;
|
|
2534
2552
|
let n = t.find((e) => e.status === "failed");
|
|
2535
2553
|
return {
|
|
@@ -2537,8 +2555,8 @@ var Zn = () => {
|
|
|
2537
2555
|
message: e.errorMessage,
|
|
2538
2556
|
step: n?.stepName
|
|
2539
2557
|
};
|
|
2540
|
-
},
|
|
2541
|
-
let n =
|
|
2558
|
+
}, Or = (e, t) => {
|
|
2559
|
+
let n = gr(e, t), r = vr(e, t), i = yr(e, t), a = pr(e, n.run?.tag ?? ""), o = n.run, s = r.steps, c = i.events, l = T(async () => {
|
|
2542
2560
|
if (!o) throw Error("useWorkflowRunState: no run loaded — cannot cancel");
|
|
2543
2561
|
await a.cancel({
|
|
2544
2562
|
workflowName: o.tag,
|
|
@@ -2562,9 +2580,9 @@ var Zn = () => {
|
|
|
2562
2580
|
status: o?.status,
|
|
2563
2581
|
steps: s,
|
|
2564
2582
|
events: c,
|
|
2565
|
-
currentStep:
|
|
2566
|
-
waitingFor: o?.status === "suspended" ?
|
|
2567
|
-
error:
|
|
2583
|
+
currentStep: Er(s),
|
|
2584
|
+
waitingFor: o?.status === "suspended" ? Tr(c) : void 0,
|
|
2585
|
+
error: Dr(o, s),
|
|
2568
2586
|
traceId: o?.traceId,
|
|
2569
2587
|
loading: n.data === void 0,
|
|
2570
2588
|
cancel: l,
|
|
@@ -2581,8 +2599,8 @@ var Zn = () => {
|
|
|
2581
2599
|
d,
|
|
2582
2600
|
f
|
|
2583
2601
|
]);
|
|
2584
|
-
},
|
|
2585
|
-
let { runtime: n, client: r } =
|
|
2602
|
+
}, kr = (e, t) => {
|
|
2603
|
+
let { runtime: n, client: r } = q(e), [i, a] = A([]), [o, s] = A("idle"), [c, l] = A(void 0), u = k(null), d = T(() => {
|
|
2586
2604
|
let e = u.current;
|
|
2587
2605
|
e && (u.current = null, n.runFork(F.interrupt(e)), s((e) => e === "streaming" ? "idle" : e));
|
|
2588
2606
|
}, [n]);
|
|
@@ -2593,7 +2611,7 @@ var Zn = () => {
|
|
|
2593
2611
|
start: T((e = {}) => {
|
|
2594
2612
|
let i = u.current;
|
|
2595
2613
|
i && n.runFork(F.interrupt(i)), a([]), l(void 0), s("streaming");
|
|
2596
|
-
let o =
|
|
2614
|
+
let o = J(r, t)(e), c = B.runForEach(o, (e) => N.sync(() => a((t) => [...t, e]))).pipe(N.matchCause({
|
|
2597
2615
|
onSuccess: () => {
|
|
2598
2616
|
s("done");
|
|
2599
2617
|
},
|
|
@@ -2609,7 +2627,7 @@ var Zn = () => {
|
|
|
2609
2627
|
]),
|
|
2610
2628
|
cancel: d
|
|
2611
2629
|
};
|
|
2612
|
-
},
|
|
2630
|
+
}, Ar = (e, t, n, r) => {
|
|
2613
2631
|
let i = 0, a = !1, o = (e) => N.sync(() => {
|
|
2614
2632
|
e.seq <= i || (i = e.seq, n.onEvent(e.event), r.isTerminal(e.event) && (a = !0));
|
|
2615
2633
|
}), s = (e) => {
|
|
@@ -2630,21 +2648,21 @@ var Zn = () => {
|
|
|
2630
2648
|
...t,
|
|
2631
2649
|
fromSeq: s
|
|
2632
2650
|
});
|
|
2633
|
-
return
|
|
2651
|
+
return B.runForEach(c, o).pipe(N.matchCauseEffect({
|
|
2634
2652
|
onSuccess: () => a ? N.sync(() => n.onStatus("done")) : l(r, s, void 0),
|
|
2635
2653
|
onFailure: (e) => M.isInterruptedOnly(e) ? N.void : a ? N.sync(() => n.onStatus("done")) : l(r, s, M.squash(e))
|
|
2636
2654
|
}));
|
|
2637
2655
|
});
|
|
2638
2656
|
return u(0);
|
|
2639
|
-
},
|
|
2657
|
+
}, jr = (e) => {
|
|
2640
2658
|
let t = e?._tag;
|
|
2641
2659
|
return t === "done" || t === "error";
|
|
2642
|
-
},
|
|
2643
|
-
let { runtime: r, client: i } =
|
|
2660
|
+
}, Mr = (e, t, n = {}) => {
|
|
2661
|
+
let { runtime: r, client: i } = q(e), [a, o] = A([]), [s, c] = A("idle"), [l, u] = A(0), [d, f] = A(void 0), p = k(null), m = {
|
|
2644
2662
|
maxReconnects: n.maxReconnects ?? 6,
|
|
2645
2663
|
backoffMs: n.backoffMs ?? 400,
|
|
2646
2664
|
maxBackoffMs: n.maxBackoffMs ?? 8e3,
|
|
2647
|
-
isTerminal: n.isTerminal ??
|
|
2665
|
+
isTerminal: n.isTerminal ?? jr
|
|
2648
2666
|
}, h = T(() => {
|
|
2649
2667
|
let e = p.current;
|
|
2650
2668
|
e && (p.current = null, r.runFork(F.interrupt(e)), c((e) => e === "streaming" || e === "reconnecting" ? "idle" : e));
|
|
@@ -2657,13 +2675,13 @@ var Zn = () => {
|
|
|
2657
2675
|
start: T((e = {}) => {
|
|
2658
2676
|
let n = p.current;
|
|
2659
2677
|
n && r.runFork(F.interrupt(n)), o([]), f(void 0), u(0), c("streaming");
|
|
2660
|
-
let a =
|
|
2678
|
+
let a = J(i, t), s = {
|
|
2661
2679
|
onEvent: (e) => o((t) => [...t, e]),
|
|
2662
2680
|
onStatus: c,
|
|
2663
2681
|
onReconnect: () => u((e) => e + 1),
|
|
2664
2682
|
onError: f
|
|
2665
2683
|
};
|
|
2666
|
-
p.current = r.runFork(
|
|
2684
|
+
p.current = r.runFork(Ar(a, e, s, m));
|
|
2667
2685
|
}, [
|
|
2668
2686
|
r,
|
|
2669
2687
|
i,
|
|
@@ -2675,13 +2693,13 @@ var Zn = () => {
|
|
|
2675
2693
|
]),
|
|
2676
2694
|
cancel: h
|
|
2677
2695
|
};
|
|
2678
|
-
},
|
|
2696
|
+
}, Nr = (e, t) => e.order - t.order || (e.stepOrder ?? 0) - (t.stepOrder ?? 0), Pr = (e) => {
|
|
2679
2697
|
for (let t = e.length - 1; t >= 0; --t) {
|
|
2680
2698
|
let n = e[t];
|
|
2681
2699
|
if (n.role === "user" && n.content) return n.content;
|
|
2682
2700
|
}
|
|
2683
|
-
},
|
|
2684
|
-
let { threadId: r } = n, i =
|
|
2701
|
+
}, Fr = (e, t, n) => {
|
|
2702
|
+
let { threadId: r } = n, i = Y(e, `${t}.messages`, { threadId: r }), a = Tn(e, `${t}.send`), o = O(() => [...i.data ?? []].sort(Nr), [i.data]), s = T((e, t = {}) => a.run({
|
|
2685
2703
|
threadId: r,
|
|
2686
2704
|
order: i.data?.length ?? 0,
|
|
2687
2705
|
prompt: e,
|
|
@@ -2691,7 +2709,7 @@ var Zn = () => {
|
|
|
2691
2709
|
r,
|
|
2692
2710
|
i.data
|
|
2693
2711
|
]), c = T(() => {
|
|
2694
|
-
let e =
|
|
2712
|
+
let e = Pr(o);
|
|
2695
2713
|
return e === void 0 ? void 0 : s(e);
|
|
2696
2714
|
}, [o, s]);
|
|
2697
2715
|
return O(() => ({
|
|
@@ -2711,8 +2729,8 @@ var Zn = () => {
|
|
|
2711
2729
|
s,
|
|
2712
2730
|
c
|
|
2713
2731
|
]);
|
|
2714
|
-
},
|
|
2715
|
-
let { events: n, status: r, error: i, start: a, cancel: o } =
|
|
2732
|
+
}, Ir = (e, t) => {
|
|
2733
|
+
let { events: n, status: r, error: i, start: a, cancel: o } = kr(e, t), [s, c] = A([]), l = k(null), u = O(() => n.filter((e) => e._tag === "token").map((e) => e.text ?? "").join(""), [n]);
|
|
2716
2734
|
return D(() => {
|
|
2717
2735
|
if (r !== "done" || l.current === null) return;
|
|
2718
2736
|
let e = l.current;
|
|
@@ -2738,8 +2756,8 @@ var Zn = () => {
|
|
|
2738
2756
|
}, [a]),
|
|
2739
2757
|
cancel: o
|
|
2740
2758
|
};
|
|
2741
|
-
},
|
|
2742
|
-
let n =
|
|
2759
|
+
}, Lr = (e, t) => {
|
|
2760
|
+
let n = Tn(e, t), [r, i] = A(void 0), a = T(async (e) => {
|
|
2743
2761
|
let t = await n.run({ question: e });
|
|
2744
2762
|
return i(t), t;
|
|
2745
2763
|
}, [n]), o = T(() => i(void 0), []);
|
|
@@ -2756,14 +2774,14 @@ var Zn = () => {
|
|
|
2756
2774
|
n.error,
|
|
2757
2775
|
o
|
|
2758
2776
|
]);
|
|
2759
|
-
},
|
|
2760
|
-
let { cache: t, runtime: n } =
|
|
2777
|
+
}, Rr = (e) => {
|
|
2778
|
+
let { cache: t, runtime: n } = q(e);
|
|
2761
2779
|
return T(() => {
|
|
2762
2780
|
t.refreshAll(n);
|
|
2763
2781
|
}, [t, n]);
|
|
2764
|
-
},
|
|
2782
|
+
}, zr = (e) => e?._tag === "Unauthenticated", Br = (e, t, n = {}) => {
|
|
2765
2783
|
let r = n.cooldownMs ?? 15e3, i = n.maxConsecutive ?? 3, a = n.now ?? (() => Date.now()), o = -Infinity, s = 0, c = e.on((e) => {
|
|
2766
|
-
if (!
|
|
2784
|
+
if (!zr(e.error) || s >= i) return;
|
|
2767
2785
|
let n = a();
|
|
2768
2786
|
n - o < r || (o = n, s += 1, t());
|
|
2769
2787
|
}), l = e.onSuccess(() => {
|
|
@@ -2777,18 +2795,18 @@ var Zn = () => {
|
|
|
2777
2795
|
s = 0;
|
|
2778
2796
|
}
|
|
2779
2797
|
};
|
|
2780
|
-
},
|
|
2781
|
-
let { errorBus: n } =
|
|
2798
|
+
}, Vr = (e, t) => {
|
|
2799
|
+
let { errorBus: n } = q(e);
|
|
2782
2800
|
D(() => n.on(t), [n, t]);
|
|
2783
|
-
},
|
|
2801
|
+
}, Hr = {
|
|
2784
2802
|
failed: [],
|
|
2785
2803
|
healthy: !0
|
|
2786
|
-
},
|
|
2787
|
-
let { errorBus: t } =
|
|
2804
|
+
}, Ur = (e) => {
|
|
2805
|
+
let { errorBus: t } = q(e), [n, r] = A(Hr);
|
|
2788
2806
|
return D(() => {
|
|
2789
2807
|
let e = /* @__PURE__ */ new Map(), n = () => {
|
|
2790
2808
|
let t = [...e.values()].sort((e, t) => t.at - e.at);
|
|
2791
|
-
r(t.length === 0 ?
|
|
2809
|
+
r(t.length === 0 ? Hr : {
|
|
2792
2810
|
failed: t,
|
|
2793
2811
|
healthy: !1
|
|
2794
2812
|
});
|
|
@@ -2806,16 +2824,16 @@ var Zn = () => {
|
|
|
2806
2824
|
i(), a();
|
|
2807
2825
|
};
|
|
2808
2826
|
}, [t]), n;
|
|
2809
|
-
},
|
|
2827
|
+
}, Wr = (e, t) => {
|
|
2810
2828
|
let n = globalThis, r = Symbol.for(`@voltro/web/context:${e}`), i = n[r];
|
|
2811
2829
|
if (i) return i;
|
|
2812
2830
|
let a = C(t);
|
|
2813
2831
|
return n[r] = a, a;
|
|
2814
|
-
},
|
|
2832
|
+
}, Gr = Wr("serverRequest", null), Kr = () => E(Gr), qr = ({ value: e, children: t }) => /* @__PURE__ */ de(Gr.Provider, {
|
|
2815
2833
|
value: e,
|
|
2816
2834
|
children: t
|
|
2817
|
-
}),
|
|
2818
|
-
let t =
|
|
2835
|
+
}), Jr = (e) => {
|
|
2836
|
+
let t = Kr();
|
|
2819
2837
|
return O(() => {
|
|
2820
2838
|
if (t !== null) return t.formFlash?.formKey === e ? t.formFlash : void 0;
|
|
2821
2839
|
if (typeof document > "u") return;
|
|
@@ -2827,13 +2845,13 @@ var Zn = () => {
|
|
|
2827
2845
|
return;
|
|
2828
2846
|
}
|
|
2829
2847
|
}, [t, e]);
|
|
2830
|
-
},
|
|
2848
|
+
}, Yr = (e, t, n) => e.map((e) => {
|
|
2831
2849
|
let r = String(e[n] ?? ""), i = e[t];
|
|
2832
2850
|
return {
|
|
2833
2851
|
value: r,
|
|
2834
2852
|
label: i == null ? r : String(i)
|
|
2835
2853
|
};
|
|
2836
|
-
}),
|
|
2854
|
+
}), Xr = (e, t, n = {}) => {
|
|
2837
2855
|
let r = n.debounceMs ?? 200, i = n.labelField ?? "name", a = n.valueField ?? "id", o = n.input ?? ((e) => ({ q: e })), [s, c] = A(n.initialTerm ?? ""), [l, u] = A(s);
|
|
2838
2856
|
D(() => {
|
|
2839
2857
|
if (s === l) return;
|
|
@@ -2844,7 +2862,7 @@ var Zn = () => {
|
|
|
2844
2862
|
l,
|
|
2845
2863
|
r
|
|
2846
2864
|
]);
|
|
2847
|
-
let d = n.skipUntilTerm === !0 && l.trim() === "", f =
|
|
2865
|
+
let d = n.skipUntilTerm === !0 && l.trim() === "", f = Y(e, t, O(() => o(l), [o, l]), { skip: d }), p = O(() => Yr(f.data ?? [], i, a), [
|
|
2848
2866
|
f.data,
|
|
2849
2867
|
i,
|
|
2850
2868
|
a
|
|
@@ -2855,8 +2873,8 @@ var Zn = () => {
|
|
|
2855
2873
|
term: s,
|
|
2856
2874
|
search: m
|
|
2857
2875
|
};
|
|
2858
|
-
},
|
|
2859
|
-
let i =
|
|
2876
|
+
}, Zr = (e, t) => e === t ? 0 : e == null ? 1 : t == null || e < t ? -1 : 1, Qr = (t, n, r = {}) => {
|
|
2877
|
+
let i = q(t), [a, o] = A(r.pageSize), s = Y(t, n, O(() => a === void 0 ? r.input ?? {} : {
|
|
2860
2878
|
...r.input,
|
|
2861
2879
|
limit: a
|
|
2862
2880
|
}, [r.input, a])), c = i.descriptors[n]?.output, l = T(() => {
|
|
@@ -2876,7 +2894,7 @@ var Zn = () => {
|
|
|
2876
2894
|
let e = s.data ?? [];
|
|
2877
2895
|
if (d === void 0) return e;
|
|
2878
2896
|
let t = d.direction === "asc" ? 1 : -1;
|
|
2879
|
-
return [...e].sort((e, n) =>
|
|
2897
|
+
return [...e].sort((e, n) => Zr(e[d.column], n[d.column]) * t);
|
|
2880
2898
|
}, [s.data, d]),
|
|
2881
2899
|
loading: s.data === void 0,
|
|
2882
2900
|
error: s.error,
|
|
@@ -2885,14 +2903,14 @@ var Zn = () => {
|
|
|
2885
2903
|
loadMore: l,
|
|
2886
2904
|
hasMore: a !== void 0 && (s.data?.length ?? 0) >= a
|
|
2887
2905
|
};
|
|
2888
|
-
},
|
|
2906
|
+
}, $r = (e, t, n, r) => {
|
|
2889
2907
|
let i = e.replace(/\/$/, ""), a = new URLSearchParams({
|
|
2890
2908
|
table: t,
|
|
2891
2909
|
id: n
|
|
2892
2910
|
});
|
|
2893
2911
|
return r !== void 0 && a.set("column", r), `${i}/_voltro/inspect/provenance?${a.toString()}`;
|
|
2894
|
-
},
|
|
2895
|
-
let { inspectBaseUrl: i } =
|
|
2912
|
+
}, ei = $r, ti = (e, t, n, r) => {
|
|
2913
|
+
let { inspectBaseUrl: i } = q(e), [a, o] = A({
|
|
2896
2914
|
data: void 0,
|
|
2897
2915
|
loading: !0,
|
|
2898
2916
|
error: void 0
|
|
@@ -2904,7 +2922,7 @@ var Zn = () => {
|
|
|
2904
2922
|
loading: !0,
|
|
2905
2923
|
error: void 0
|
|
2906
2924
|
});
|
|
2907
|
-
let a =
|
|
2925
|
+
let a = $r(i ?? "", t, n, r);
|
|
2908
2926
|
return fetch(a).then(async (e) => {
|
|
2909
2927
|
if (!e.ok) throw Error(`provenance fetch failed: HTTP ${e.status}`);
|
|
2910
2928
|
return await e.json();
|
|
@@ -2930,12 +2948,12 @@ var Zn = () => {
|
|
|
2930
2948
|
n,
|
|
2931
2949
|
r
|
|
2932
2950
|
]), a;
|
|
2933
|
-
},
|
|
2934
|
-
function
|
|
2935
|
-
return w(
|
|
2951
|
+
}, ni = "admin:full", ri = (e, t) => e.includes("admin:full") ? !0 : (typeof t == "string" ? [t] : t).every((t) => e.includes(t)), ii = (e, t) => t.length === 0 || e.includes("admin:full") ? !0 : t.some((t) => e.includes(t)), ai = C({ scopes: [] });
|
|
2952
|
+
function oi(e) {
|
|
2953
|
+
return w(ai.Provider, { value: { scopes: e.scopes } }, e.children);
|
|
2936
2954
|
}
|
|
2937
|
-
var
|
|
2938
|
-
let { inspectBaseUrl: t } =
|
|
2955
|
+
var si = () => E(ai), ci = (e) => ri(si().scopes, e), li = (e) => ii(si().scopes, e), ui = (e) => `${e.replace(/\/$/, "")}/_voltro/inspect/manifest`, di = (e) => {
|
|
2956
|
+
let { inspectBaseUrl: t } = q(e), [n, r] = A({
|
|
2939
2957
|
manifest: void 0,
|
|
2940
2958
|
loading: !0,
|
|
2941
2959
|
error: void 0
|
|
@@ -2946,7 +2964,7 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
2946
2964
|
manifest: void 0,
|
|
2947
2965
|
loading: !0,
|
|
2948
2966
|
error: void 0
|
|
2949
|
-
}), fetch(
|
|
2967
|
+
}), fetch(ui(t ?? "")).then(async (e) => {
|
|
2950
2968
|
if (!e.ok) throw Error(`manifest fetch failed: HTTP ${e.status}`);
|
|
2951
2969
|
return await e.json();
|
|
2952
2970
|
}).then((t) => {
|
|
@@ -2965,7 +2983,7 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
2965
2983
|
e = !0;
|
|
2966
2984
|
};
|
|
2967
2985
|
}, [e, t]), n;
|
|
2968
|
-
},
|
|
2986
|
+
}, fi = (e, t) => t.scope.length === 0 || (t.mode === "any" ? t.scope.some((t) => e.includes(t)) : t.scope.every((t) => e.includes(t))), pi = (e, t) => {
|
|
2969
2987
|
if (e === void 0) return "unknown";
|
|
2970
2988
|
if (t.includes("admin:full") || e.length === 0) return "allowed";
|
|
2971
2989
|
let n = !1;
|
|
@@ -2974,7 +2992,7 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
2974
2992
|
n = !0;
|
|
2975
2993
|
continue;
|
|
2976
2994
|
}
|
|
2977
|
-
if (!
|
|
2995
|
+
if (!fi(t, r)) {
|
|
2978
2996
|
if (r.resourceScoped) {
|
|
2979
2997
|
n = !0;
|
|
2980
2998
|
continue;
|
|
@@ -2983,13 +3001,13 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
2983
3001
|
}
|
|
2984
3002
|
}
|
|
2985
3003
|
return n ? "unknown" : "allowed";
|
|
2986
|
-
},
|
|
3004
|
+
}, mi = (e) => (e ?? []).flatMap((e) => e.kind === "scope" ? [...e.scope] : []), hi = (e) => {
|
|
2987
3005
|
for (let t of e ?? []) if (t.kind === "open") return t.reason;
|
|
2988
|
-
},
|
|
3006
|
+
}, gi = (e) => pi(e, si().scopes), _i = (e, t) => Array.isArray(e) ? e.includes(t) : e === t, vi = (e, t, n) => e.targets?.some((e) => e.table === t && e.op === n) ?? !1, yi = (e) => e === void 0 ? {} : {
|
|
2989
3007
|
tag: e.tag,
|
|
2990
3008
|
...e.guards === void 0 ? {} : { guards: e.guards }
|
|
2991
|
-
},
|
|
2992
|
-
let n = e.procedures.find((e) => e.kind === "query" &&
|
|
3009
|
+
}, bi = (e) => e.tables.filter((e) => !e.framework).map((t) => {
|
|
3010
|
+
let n = e.procedures.find((e) => e.kind === "query" && _i(e.source, t.name)), r = e.procedures.find((e) => e.kind === "mutation" && vi(e, t.name, "insert")), i = e.procedures.find((e) => e.kind === "mutation" && vi(e, t.name, "update")), a = e.procedures.find((e) => e.kind === "mutation" && vi(e, t.name, "delete")), o = t.pkColumn ?? (t.columns.some((e) => e.name === "id") ? "id" : void 0);
|
|
2993
3011
|
return {
|
|
2994
3012
|
table: t.name,
|
|
2995
3013
|
columns: t.columns.filter((e) => e.serverOnly !== !0),
|
|
@@ -2998,12 +3016,12 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
2998
3016
|
reactive: t.reactive,
|
|
2999
3017
|
...o === void 0 ? {} : { pkColumn: o },
|
|
3000
3018
|
editable: (t.editable ?? !0) && o !== void 0,
|
|
3001
|
-
list:
|
|
3002
|
-
create:
|
|
3003
|
-
update:
|
|
3004
|
-
delete:
|
|
3019
|
+
list: yi(n),
|
|
3020
|
+
create: yi(r),
|
|
3021
|
+
update: yi(i),
|
|
3022
|
+
delete: yi(a)
|
|
3005
3023
|
};
|
|
3006
|
-
}),
|
|
3024
|
+
}), xi = (e) => {
|
|
3007
3025
|
let [t, n] = A([]), [r, i] = A([]), a = T((e) => {
|
|
3008
3026
|
n((t) => [...t, e]), i([]);
|
|
3009
3027
|
}, []), o = T(async () => {
|
|
@@ -3031,8 +3049,8 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
3031
3049
|
o,
|
|
3032
3050
|
s
|
|
3033
3051
|
]);
|
|
3034
|
-
},
|
|
3035
|
-
let n = t?.limit, { data: r } =
|
|
3052
|
+
}, Si = "__voltro.undo.log", Ci = "__voltro.undo.apply", wi = "__voltro.undo.redo", Ti = (e, t) => {
|
|
3053
|
+
let n = t?.limit, { data: r } = Y(e, Si, n === void 0 ? {} : { limit: n }), i = bn(e, Ci), a = bn(e, wi), o = r ?? [], s = o.find((e) => !e.undone && !e.crossesAction), c = o.find((e) => e.undone), l = T(async (e) => {
|
|
3036
3054
|
await i.mutate({ invocationId: e });
|
|
3037
3055
|
}, [i]), u = T(async (e) => {
|
|
3038
3056
|
await a.mutate({ invocationId: e });
|
|
@@ -3051,21 +3069,21 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
3051
3069
|
undoLast: d,
|
|
3052
3070
|
redoLast: f
|
|
3053
3071
|
};
|
|
3054
|
-
},
|
|
3072
|
+
}, Ei = (e, t) => ({
|
|
3055
3073
|
name: e,
|
|
3056
3074
|
map: t
|
|
3057
|
-
}),
|
|
3075
|
+
}), Di = (e, t) => e === void 0 ? null : typeof e == "string" ? { event: e } : e(t), Oi = /* @__PURE__ */ new Set(["onMount", "onUnmount"]), ki = (e, t, n) => {
|
|
3058
3076
|
let r = { ...t };
|
|
3059
3077
|
for (let [i, a] of Object.entries(e.map)) {
|
|
3060
|
-
if (
|
|
3078
|
+
if (Oi.has(i) || a === void 0) continue;
|
|
3061
3079
|
let e = t[i];
|
|
3062
3080
|
r[i] = (...r) => {
|
|
3063
|
-
let i =
|
|
3081
|
+
let i = Di(a, t);
|
|
3064
3082
|
if (i !== null && n(i), typeof e == "function") return e(...r);
|
|
3065
3083
|
};
|
|
3066
3084
|
}
|
|
3067
3085
|
return r;
|
|
3068
|
-
},
|
|
3086
|
+
}, Ai = (e, t, n) => {
|
|
3069
3087
|
let r = k({
|
|
3070
3088
|
spec: e,
|
|
3071
3089
|
props: t,
|
|
@@ -3076,46 +3094,46 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
3076
3094
|
props: t,
|
|
3077
3095
|
sink: n
|
|
3078
3096
|
}, D(() => {
|
|
3079
|
-
let e = r.current, t =
|
|
3097
|
+
let e = r.current, t = Di(e.spec.map.onMount, e.props);
|
|
3080
3098
|
return t !== null && e.sink(t), () => {
|
|
3081
|
-
let e = r.current, t =
|
|
3099
|
+
let e = r.current, t = Di(e.spec.map.onUnmount, e.props);
|
|
3082
3100
|
t !== null && e.sink(t);
|
|
3083
3101
|
};
|
|
3084
|
-
}, []), O(() =>
|
|
3102
|
+
}, []), O(() => ki(e, t, n), [
|
|
3085
3103
|
e,
|
|
3086
3104
|
t,
|
|
3087
3105
|
n
|
|
3088
3106
|
]);
|
|
3089
|
-
},
|
|
3090
|
-
let n =
|
|
3107
|
+
}, ji = (e, t) => {
|
|
3108
|
+
let n = q(e).descriptors[t]?.input;
|
|
3091
3109
|
return O(() => n === void 0 ? [] : x(n), [n]);
|
|
3092
|
-
},
|
|
3093
|
-
let r =
|
|
3110
|
+
}, Mi = (t, n) => {
|
|
3111
|
+
let r = q(t).descriptors[n]?.output;
|
|
3094
3112
|
return O(() => r === void 0 ? [] : e(r), [r]);
|
|
3095
|
-
},
|
|
3113
|
+
}, Ni = (e, t) => {
|
|
3096
3114
|
if (e === t) return !0;
|
|
3097
3115
|
if (e.length !== t.length) return !1;
|
|
3098
3116
|
for (let n = 0; n < e.length; n += 1) if (!Object.is(e[n], t[n])) return !1;
|
|
3099
3117
|
return !0;
|
|
3100
|
-
},
|
|
3101
|
-
let n = k(null), r =
|
|
3102
|
-
return (n.current === null || !
|
|
3118
|
+
}, Pi = (e) => Object.keys(e).sort().map((t) => e[t]), Fi = (e, t) => {
|
|
3119
|
+
let n = k(null), r = Pi(e);
|
|
3120
|
+
return (n.current === null || !Ni(n.current.key, r)) && (n.current = {
|
|
3103
3121
|
key: r,
|
|
3104
3122
|
value: t(e)
|
|
3105
3123
|
}), n.current.value;
|
|
3106
|
-
},
|
|
3107
|
-
let i =
|
|
3124
|
+
}, Ii = (e, t, n, r = {}) => {
|
|
3125
|
+
let i = Y(e, t, { ...n }, r);
|
|
3108
3126
|
return O(() => ({
|
|
3109
3127
|
allowed: i.data?.allowed === !0,
|
|
3110
3128
|
pending: i.data === void 0
|
|
3111
3129
|
}), [i.data]);
|
|
3112
|
-
},
|
|
3113
|
-
let i =
|
|
3130
|
+
}, Li = (e, t, n, r = {}) => {
|
|
3131
|
+
let i = Y(e, t, { ...n }, r);
|
|
3114
3132
|
return O(() => ({
|
|
3115
3133
|
allowedIds: new Set(i.data?.allowedIds ?? []),
|
|
3116
3134
|
pending: i.data === void 0
|
|
3117
3135
|
}), [i.data]);
|
|
3118
|
-
},
|
|
3136
|
+
}, Ri = (e) => {
|
|
3119
3137
|
switch (e) {
|
|
3120
3138
|
case "select":
|
|
3121
3139
|
case "radio":
|
|
@@ -3131,26 +3149,26 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
3131
3149
|
case "switch": return "boolean";
|
|
3132
3150
|
default: return null;
|
|
3133
3151
|
}
|
|
3134
|
-
},
|
|
3152
|
+
}, zi = (e) => x(e).map((e) => {
|
|
3135
3153
|
if (e.name.includes(".")) return null;
|
|
3136
|
-
let t =
|
|
3154
|
+
let t = Ri(e.widget);
|
|
3137
3155
|
return t === null ? null : {
|
|
3138
3156
|
name: e.name,
|
|
3139
3157
|
label: e.label,
|
|
3140
3158
|
kind: t,
|
|
3141
3159
|
...e.options ? { options: e.options } : {}
|
|
3142
3160
|
};
|
|
3143
|
-
}).filter((e) => e !== null),
|
|
3161
|
+
}).filter((e) => e !== null), Bi = (e) => {
|
|
3144
3162
|
let t = {};
|
|
3145
3163
|
for (let [n, r] of Object.entries(e)) r === void 0 || r === "" || Array.isArray(r) && r.length === 0 || (t[n] = r);
|
|
3146
3164
|
return t;
|
|
3147
|
-
},
|
|
3148
|
-
let r =
|
|
3149
|
-
o((n) =>
|
|
3165
|
+
}, Vi = (e, t, n = {}) => {
|
|
3166
|
+
let r = q(e).descriptors[t]?.input, i = O(() => r === void 0 ? [] : zi(r), [r]), [a, o] = A(n.initial ?? {}), s = T((e, t) => {
|
|
3167
|
+
o((n) => Bi({
|
|
3150
3168
|
...n,
|
|
3151
3169
|
[e]: t
|
|
3152
3170
|
}));
|
|
3153
|
-
}, []), c = T(() => o({}), []), l =
|
|
3171
|
+
}, []), c = T(() => o({}), []), l = Y(e, t, O(() => Bi(a), [a]));
|
|
3154
3172
|
return {
|
|
3155
3173
|
filters: i,
|
|
3156
3174
|
values: a,
|
|
@@ -3161,20 +3179,20 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
3161
3179
|
loading: l.data === void 0,
|
|
3162
3180
|
error: l.error
|
|
3163
3181
|
};
|
|
3164
|
-
},
|
|
3165
|
-
let r =
|
|
3182
|
+
}, Hi = (e, t, n = {}) => {
|
|
3183
|
+
let r = Y(e, t, n), i = r.data;
|
|
3166
3184
|
return {
|
|
3167
3185
|
record: Array.isArray(i) ? i[0] : i,
|
|
3168
3186
|
loading: i === void 0,
|
|
3169
3187
|
error: r.error
|
|
3170
3188
|
};
|
|
3171
|
-
},
|
|
3189
|
+
}, Ui = (e, t = 300) => {
|
|
3172
3190
|
let [n, r] = A(e);
|
|
3173
3191
|
return D(() => {
|
|
3174
3192
|
let n = setTimeout(() => r(e), t);
|
|
3175
3193
|
return () => clearTimeout(n);
|
|
3176
3194
|
}, [e, t]), n;
|
|
3177
|
-
},
|
|
3195
|
+
}, Wi = (e) => {
|
|
3178
3196
|
let { value: t, debouncedValue: n, data: r, interpret: i, skipEmpty: a = !0 } = e;
|
|
3179
3197
|
if (a && t.trim() === "") return {
|
|
3180
3198
|
status: "idle",
|
|
@@ -3192,39 +3210,39 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
3192
3210
|
valid: o.valid,
|
|
3193
3211
|
message: o.message
|
|
3194
3212
|
};
|
|
3195
|
-
},
|
|
3196
|
-
let { input: i, interpret: a, debounceMs: o = 300, skipEmpty: s = !0 } = r, c =
|
|
3197
|
-
return
|
|
3213
|
+
}, Gi = (e, t, n, r) => {
|
|
3214
|
+
let { input: i, interpret: a, debounceMs: o = 300, skipEmpty: s = !0 } = r, c = Ui(n, o), l = s && c.trim() === "", u = Y(e, t, O(() => i ? i(c) : { value: c }, [i, c]), { skip: l });
|
|
3215
|
+
return Wi({
|
|
3198
3216
|
value: n,
|
|
3199
3217
|
debouncedValue: c,
|
|
3200
3218
|
data: l ? null : u.data,
|
|
3201
3219
|
interpret: a,
|
|
3202
3220
|
skipEmpty: s
|
|
3203
3221
|
});
|
|
3204
|
-
},
|
|
3222
|
+
}, Ki = (e, t) => ({
|
|
3205
3223
|
name: e,
|
|
3206
3224
|
payload: t
|
|
3207
|
-
}),
|
|
3225
|
+
}), qi = (e, t) => {
|
|
3208
3226
|
let n = ie.decodeUnknownEither(e.payload, { errors: "all" })(t);
|
|
3209
3227
|
if (n._tag === "Right") return {
|
|
3210
3228
|
valid: !0,
|
|
3211
3229
|
errors: {}
|
|
3212
3230
|
};
|
|
3213
3231
|
let r = {};
|
|
3214
|
-
for (let e of
|
|
3232
|
+
for (let e of me.formatErrorSync(n.left)) r[e.path.join(".") || "(root)"] = e.message;
|
|
3215
3233
|
return {
|
|
3216
3234
|
valid: !1,
|
|
3217
3235
|
errors: r
|
|
3218
3236
|
};
|
|
3219
|
-
},
|
|
3237
|
+
}, Ji = (e) => {
|
|
3220
3238
|
let t = new Map(e.map((e) => [e.name, e]));
|
|
3221
3239
|
return {
|
|
3222
3240
|
names: [...t.keys()].sort(),
|
|
3223
3241
|
get: (e) => t.get(e),
|
|
3224
3242
|
events: e
|
|
3225
3243
|
};
|
|
3226
|
-
},
|
|
3227
|
-
let n =
|
|
3244
|
+
}, Yi = (e, t) => {
|
|
3245
|
+
let n = Ji(e);
|
|
3228
3246
|
return {
|
|
3229
3247
|
track: (e, r) => {
|
|
3230
3248
|
let i = n.get(e);
|
|
@@ -3233,7 +3251,7 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
3233
3251
|
return;
|
|
3234
3252
|
}
|
|
3235
3253
|
if (process.env.NODE_ENV !== "production") {
|
|
3236
|
-
let t =
|
|
3254
|
+
let t = qi(i, r);
|
|
3237
3255
|
t.valid || console.error(`[@voltro/client] analytics.track('${e}'): payload failed its schema`, t.errors);
|
|
3238
3256
|
}
|
|
3239
3257
|
t({
|
|
@@ -3244,47 +3262,47 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
3244
3262
|
names: n.names,
|
|
3245
3263
|
catalog: n
|
|
3246
3264
|
};
|
|
3247
|
-
},
|
|
3248
|
-
let n =
|
|
3265
|
+
}, Xi = (e, t) => {
|
|
3266
|
+
let n = Tn(e, t);
|
|
3249
3267
|
return {
|
|
3250
3268
|
preview: T((e) => n.run(e), [n]),
|
|
3251
3269
|
diff: n.lastResult,
|
|
3252
3270
|
pending: n.pending,
|
|
3253
3271
|
error: n.error
|
|
3254
3272
|
};
|
|
3255
|
-
},
|
|
3273
|
+
}, Zi = (e, t, n, r) => [...e, {
|
|
3256
3274
|
id: t,
|
|
3257
3275
|
tag: n,
|
|
3258
3276
|
input: r,
|
|
3259
3277
|
status: "pending",
|
|
3260
3278
|
attempts: 0
|
|
3261
|
-
}],
|
|
3279
|
+
}], Qi = (e, t, n) => e.map((e) => e.id === t ? {
|
|
3262
3280
|
...e,
|
|
3263
3281
|
...n
|
|
3264
|
-
} : e),
|
|
3282
|
+
} : e), $i = (e, t) => Qi(e, t, { status: "sent" }), ea = (e, t, n) => e.map((e) => e.id === t ? {
|
|
3265
3283
|
...e,
|
|
3266
3284
|
status: "failed",
|
|
3267
3285
|
error: n,
|
|
3268
3286
|
attempts: e.attempts + 1
|
|
3269
|
-
} : e),
|
|
3287
|
+
} : e), ta = (e, t, n) => Qi(e, t, {
|
|
3270
3288
|
status: "conflict",
|
|
3271
3289
|
error: n
|
|
3272
|
-
}),
|
|
3290
|
+
}), na = (e, t, n) => e.map((e) => e.id === t && e.status === "conflict" ? {
|
|
3273
3291
|
...e,
|
|
3274
3292
|
input: n,
|
|
3275
3293
|
status: "pending",
|
|
3276
3294
|
error: void 0
|
|
3277
|
-
} : e),
|
|
3295
|
+
} : e), ra = (e) => e.filter((e) => e.status !== "sent"), ia = (e) => {
|
|
3278
3296
|
let t = [];
|
|
3279
3297
|
for (let n of e) {
|
|
3280
3298
|
if (n.status === "conflict") break;
|
|
3281
3299
|
(n.status === "pending" || n.status === "failed") && t.push(n);
|
|
3282
3300
|
}
|
|
3283
3301
|
return t;
|
|
3284
|
-
},
|
|
3302
|
+
}, aa = (e) => {
|
|
3285
3303
|
let t = e;
|
|
3286
3304
|
return t?.conflict === !0 || t?._tag === "UndoBoundaryError" && t?.boundary === "conflict";
|
|
3287
|
-
},
|
|
3305
|
+
}, oa = (e) => {
|
|
3288
3306
|
let [t, n] = A(e ?? (typeof navigator < "u" ? navigator.onLine : !0));
|
|
3289
3307
|
return D(() => {
|
|
3290
3308
|
if (e !== void 0) {
|
|
@@ -3297,8 +3315,8 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
3297
3315
|
window.removeEventListener("online", t), window.removeEventListener("offline", r);
|
|
3298
3316
|
};
|
|
3299
3317
|
}, [e]), t;
|
|
3300
|
-
},
|
|
3301
|
-
let { send: t, persistence: n, isConflict: r =
|
|
3318
|
+
}, sa = (e) => {
|
|
3319
|
+
let { send: t, persistence: n, isConflict: r = aa, idFor: i } = e, [a, o] = A([]), s = oa(e.online), c = k(a);
|
|
3302
3320
|
c.current = a;
|
|
3303
3321
|
let l = k(0), u = k(Math.random().toString(36).slice(2, 8)), d = k(n === void 0);
|
|
3304
3322
|
D(() => {
|
|
@@ -3312,27 +3330,27 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
3312
3330
|
e = !0;
|
|
3313
3331
|
};
|
|
3314
3332
|
}, [n]), D(() => {
|
|
3315
|
-
n === void 0 || !d.current || n.save(
|
|
3333
|
+
n === void 0 || !d.current || n.save(ra(a)).catch(() => {});
|
|
3316
3334
|
}, [n, a]);
|
|
3317
3335
|
let f = T((e, t) => {
|
|
3318
3336
|
let n = i?.() ?? `obx_${u.current}_${l.current++}_${e}`;
|
|
3319
|
-
o((r) =>
|
|
3337
|
+
o((r) => Zi(r, n, e, t));
|
|
3320
3338
|
}, [i]), p = T(async () => {
|
|
3321
|
-
for (let e of
|
|
3322
|
-
await t(e), o((t) =>
|
|
3339
|
+
for (let e of ia(c.current)) try {
|
|
3340
|
+
await t(e), o((t) => $i(t, e.id));
|
|
3323
3341
|
} catch (t) {
|
|
3324
3342
|
if (r(t)) {
|
|
3325
|
-
o((n) =>
|
|
3343
|
+
o((n) => ta(n, e.id, t));
|
|
3326
3344
|
break;
|
|
3327
3345
|
}
|
|
3328
|
-
o((n) =>
|
|
3346
|
+
o((n) => ea(n, e.id, t));
|
|
3329
3347
|
}
|
|
3330
3348
|
}, [t, r]);
|
|
3331
3349
|
D(() => {
|
|
3332
3350
|
s && p();
|
|
3333
3351
|
}, [s, p]);
|
|
3334
3352
|
let m = T((e, t) => {
|
|
3335
|
-
let n =
|
|
3353
|
+
let n = na(c.current, e, t);
|
|
3336
3354
|
c.current = n, o(n), s && p();
|
|
3337
3355
|
}, [s, p]);
|
|
3338
3356
|
return {
|
|
@@ -3344,7 +3362,7 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
3344
3362
|
conflicts: a.filter((e) => e.status === "conflict"),
|
|
3345
3363
|
resolveConflict: m
|
|
3346
3364
|
};
|
|
3347
|
-
},
|
|
3365
|
+
}, ca = (e) => {
|
|
3348
3366
|
let { scrollTop: t, viewportHeight: n, rowHeight: r, overscan: i = 5, total: a } = e, o = r > 0 ? r : 1, s = Math.max(0, Math.floor(t / o)), c = Math.ceil(n / o), l = Math.max(0, s - i), u = s + c + i, d = a === void 0 ? u : Math.min(u, a);
|
|
3349
3367
|
return {
|
|
3350
3368
|
startIndex: l,
|
|
@@ -3354,8 +3372,8 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
3354
3372
|
topSpacer: l * r,
|
|
3355
3373
|
bottomSpacer: a === void 0 ? 0 : Math.max(0, (a - d) * r)
|
|
3356
3374
|
};
|
|
3357
|
-
},
|
|
3358
|
-
let { rowHeight: r, viewportHeight: i, overscan: a, total: o, input: s } = n, [c, l] = A(0), u = O(() =>
|
|
3375
|
+
}, la = (e, t, n) => {
|
|
3376
|
+
let { rowHeight: r, viewportHeight: i, overscan: a, total: o, input: s } = n, [c, l] = A(0), u = O(() => ca({
|
|
3359
3377
|
scrollTop: c,
|
|
3360
3378
|
viewportHeight: i,
|
|
3361
3379
|
rowHeight: r,
|
|
@@ -3367,7 +3385,7 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
3367
3385
|
r,
|
|
3368
3386
|
a,
|
|
3369
3387
|
o
|
|
3370
|
-
]), d =
|
|
3388
|
+
]), d = Y(e, t, O(() => ({
|
|
3371
3389
|
...s,
|
|
3372
3390
|
offset: u.offset,
|
|
3373
3391
|
limit: u.limit
|
|
@@ -3387,8 +3405,8 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
3387
3405
|
loading: d.data === void 0,
|
|
3388
3406
|
error: d.error
|
|
3389
3407
|
};
|
|
3390
|
-
},
|
|
3391
|
-
let { errorBus: t } =
|
|
3408
|
+
}, ua = () => typeof navigator > "u" || navigator.onLine, da = (e) => {
|
|
3409
|
+
let { errorBus: t } = q(e), [n, r] = A(ua), [i, a] = A(0), [o, s] = A(void 0), c = k(!0);
|
|
3392
3410
|
D(() => (c.current = !0, () => {
|
|
3393
3411
|
c.current = !1;
|
|
3394
3412
|
}), []), D(() => {
|
|
@@ -3400,9 +3418,15 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
3400
3418
|
window.removeEventListener("online", e), window.removeEventListener("offline", t);
|
|
3401
3419
|
};
|
|
3402
3420
|
}, []), D(() => {
|
|
3403
|
-
if (t?.on) return
|
|
3404
|
-
|
|
3421
|
+
if (!t?.on) return;
|
|
3422
|
+
let e = t.on((e) => {
|
|
3423
|
+
c.current && (e.kind === "transport" ? (a((e) => e + 1), s(Date.now())) : e.kind === "handler" && a(0));
|
|
3424
|
+
}), n = t.onSuccess(() => {
|
|
3425
|
+
c.current && a(0);
|
|
3405
3426
|
});
|
|
3427
|
+
return () => {
|
|
3428
|
+
e(), n();
|
|
3429
|
+
};
|
|
3406
3430
|
}, [t]);
|
|
3407
3431
|
let l = T(() => {
|
|
3408
3432
|
a(0);
|
|
@@ -3414,7 +3438,7 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
3414
3438
|
lastFailureAt: o,
|
|
3415
3439
|
reportSuccess: l
|
|
3416
3440
|
};
|
|
3417
|
-
},
|
|
3441
|
+
}, fa = "__voltro.connections.list", pa = "__voltro.connections.start", ma = "__voltro.connections.submitToken", ha = "__voltro.connections.disconnect", ga = {
|
|
3418
3442
|
connectionId: "",
|
|
3419
3443
|
kind: "oauth2",
|
|
3420
3444
|
label: "",
|
|
@@ -3425,14 +3449,14 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
3425
3449
|
expiresAt: null,
|
|
3426
3450
|
lastError: null,
|
|
3427
3451
|
connectedAt: null
|
|
3428
|
-
},
|
|
3452
|
+
}, _a = (e, t) => {
|
|
3429
3453
|
if (t === "redirect") {
|
|
3430
3454
|
globalThis.location.assign(e);
|
|
3431
3455
|
return;
|
|
3432
3456
|
}
|
|
3433
3457
|
globalThis.open(e, "voltro-connect", "width=620,height=760,menubar=no,toolbar=no") === null && globalThis.location.assign(e);
|
|
3434
|
-
},
|
|
3435
|
-
let { data: t } =
|
|
3458
|
+
}, va = (e) => {
|
|
3459
|
+
let { data: t } = Y(e, fa, {}), n = Tn(e, pa), r = bn(e, ma), i = bn(e, ha), a = t ?? [], o = n.pending || r.pending || i.pending, s = T((e) => ({
|
|
3436
3460
|
...e,
|
|
3437
3461
|
connected: e.status === "connected",
|
|
3438
3462
|
needsAttention: e.status === "expired" || e.status === "revoked" || e.status === "error",
|
|
@@ -3440,7 +3464,7 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
3440
3464
|
connect: async (t) => {
|
|
3441
3465
|
if (e.kind !== "oauth2") throw Error(`connection "${e.connectionId}" is a personal-access-token connection — call submitToken(token), not connect().`);
|
|
3442
3466
|
let r = t?.redirectTo ?? `${globalThis.location.pathname}${globalThis.location.search}`;
|
|
3443
|
-
|
|
3467
|
+
_a((await n.run({
|
|
3444
3468
|
connectionId: e.connectionId,
|
|
3445
3469
|
redirectTo: r
|
|
3446
3470
|
})).authorizeUrl, t?.mode);
|
|
@@ -3470,10 +3494,10 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
3470
3494
|
get: c,
|
|
3471
3495
|
pending: o
|
|
3472
3496
|
};
|
|
3473
|
-
},
|
|
3474
|
-
let n =
|
|
3497
|
+
}, ya = (e, t) => {
|
|
3498
|
+
let n = va(e), r = n.get(t);
|
|
3475
3499
|
return O(() => r === void 0 ? {
|
|
3476
|
-
...
|
|
3500
|
+
...ga,
|
|
3477
3501
|
connectionId: t,
|
|
3478
3502
|
label: t,
|
|
3479
3503
|
connected: !1,
|
|
@@ -3498,6 +3522,6 @@ var ni = () => E(ei), ri = (e) => Qr(ni().scopes, e), ii = (e) => $r(ni().scopes
|
|
|
3498
3522
|
n.loading,
|
|
3499
3523
|
n.pending
|
|
3500
3524
|
]);
|
|
3501
|
-
},
|
|
3525
|
+
}, ba = "framework-client";
|
|
3502
3526
|
//#endregion
|
|
3503
|
-
export {
|
|
3527
|
+
export { ni as ADMIN_SCOPE, ba as CLIENT_NAME, fa as CONNECTIONS_LIST_TAG, ha as CONNECTION_DISCONNECT_TAG, pa as CONNECTION_START_TAG, ma as CONNECTION_SUBMIT_TOKEN_TAG, v as FORM_FLASH_SCRIPT_ID, p as FORM_KEY_FIELD, g as FORM_PATH_PREFIX, u as FORM_REDIRECT_FIELD, In as FormBindingProvider, ze as FrameworkRuntimesContext, st as FrameworkRuntimesProvider, Ne as LoadingSubscriptionCache, oi as PermissionProvider, _ as RICH_TEXT_MARKS, a as RICH_TEXT_MAX_NODES, d as RichTextDocument, Re as RpcErrorBus, Gr as ServerRequestContext, qr as ServerRequestProvider, Me as SubscriptionCache, Ci as UNDO_APPLY_TAG, Si as UNDO_LOG_TAG, wi as UNDO_REDO_TAG, Dn as ValidationMessagesProvider, Qe as _resetFrameworkRuntimesWarning, qe as _resetSsrDescriptors, Jn as applyPreloadSeeds, Jt as applyStoreSeeds, tt as buildApiRuntime, ri as canCall, ii as canCallAny, cn as clearMutations, ra as clearSent, Ot as clearStoreHistory, ca as computeWindow, Yi as createAnalytics, Bn as createHooks, pi as decideAccess, c as decodeFieldIssues, Ki as defineEvent, Ut as defineStore, Ei as defineTracking, Ht as definedStores, bi as deriveEntityAdmins, n as documentLocale, y as emptyRichTextDocument, Zi as enqueueEntry, Ji as eventCatalog, zi as filtersFromSchema, r as formActionPath, m as formDataToInput, S as formField, t as formSections, _n as freshIdempotencyKey, fn as getMutationNotifier, on as getMutations, Wr as globalContext, o as isRichTextDocument, s as isSafeHref, zr as isUnauthenticated, et as isUnresolvedApi, Vn as makePreloadSeedBag, Gt as makeStoreSeedBag, ui as manifestUrl, ta as markConflict, ea as markFailed, $i as markSent, hi as openAccessReason, h as parseRichText, ei as provenanceUrl, Fe as publishClientError, ge as publishClientTrace, Xn as readPreloadedSeedOutcome, Yn as readPreloadedSnapshot, Ge as registerSsrDescriptors, ia as replayable, Le as reportClientError, mi as requiredScopes, Zn as resetPreloadSeeds, Wt as resetStoreRegistryForTests, pt as resetStoreStorageForTest, J as resolveByTag, na as resolveConflictEntry, ft as resolveStoreStorage, Di as resolveTrackingEvent, b as resolveValidationMessage, ee as restrictToSchema, Ar as resumableConsumeProgram, f as richTextToPlainText, Yr as rowsToOptions, rr as runSequence, e as schemaToColumns, x as schemaToFields, Kn as seedPreloadedSubscription, qn as seedPreloadedSubscriptionFailure, qt as seedStore, nr as sequence, l as serializeRichText, dn as setMutationNotifier, Un as setPreloadSeedResolver, Kt as setStoreSeedResolver, dt as setStoreStorage, an as settleMutation, mt as shallow, Ni as shallowArrayEqual, Pi as sourceValues, Ve as ssrClientProxy, Ke as ssrDescriptorsFor, Je as ssrStubHandle, W as stableKey, ot as startApiSupervisor, rn as startMutation, Et as storeHistory, Ie as subscribeClientErrors, _e as subscribeClientTraces, sn as subscribeMutations, Dt as subscribeStoreHistory, Se as supersedesConfirmedPatches, kt as travelToStoreState, gi as useAccessDecision, Tn as useAction, Ir as useAgent, Fr as useAgentChat, kr as useAgentStream, Gi as useAsyncValidation, ci as useCan, li as useCanAny, di as useCapabilityManifest, ya as useConnection, da as useConnectionStatus, va as useConnections, Lr as useDataCopilot, Qr as useDataTable, Ui as useDebounced, Fi as useDerived, tr as useEvent, Fn as useFormBinding, Ln as useFormBindingContext, Rn as useFormField, Jr as useFormFlash, ji as useFormSkeleton, q as useFrameworkApi, $e as useFrameworkRuntimes, bn as useMutation, Vr as useOnRpcError, sa as useOutbox, si as usePermissions, Qn as usePreloadedSubscription, Xi as usePreview, ti as useProvenance, Xr as useQueryField, Vi as useQueryFilters, Hi as useRecord, Rr as useRefreshSubscriptions, Ii as useResourceCan, Li as useResourceCans, Mr as useResumableAgentStream, ir as useSequence, Kr as useServerRequest, Y as useSubscription, Ur as useSubscriptionHealth, Mi as useTableSkeleton, Ai as useTracking, dr as useTranscription, xi as useUndo, Ti as useUndoLog, ur as useUpload, On as useValidationMessages, la as useWindowedSubscription, pr as useWorkflow, xr as useWorkflowDomainEvents, Sr as useWorkflowEventDeliveries, br as useWorkflowEvents, gr as useWorkflowRun, yr as useWorkflowRunEvents, Or as useWorkflowRunState, vr as useWorkflowRunSteps, _r as useWorkflowRuns, mr as useWorkflowSignal, hr as useWorkflowUpdate, qi as validateEventPayload, i as validateFields, Wi as validationStatus, Br as wireAuthRefresh, vn as withIdempotencyKey, ki as wrapTrackedCallbacks };
|