@voltro/client 0.27.0 → 0.29.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 +513 -0
- package/dist/index.d.ts +71 -7
- package/dist/index.js +429 -393
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -10,32 +10,32 @@ var w = /* @__PURE__ */ new Set(), T = (e) => {
|
|
|
10
10
|
for (let t of w) try {
|
|
11
11
|
t(e);
|
|
12
12
|
} catch {}
|
|
13
|
-
},
|
|
13
|
+
}, ee = (e) => (w.add(e), () => {
|
|
14
14
|
w.delete(e);
|
|
15
|
-
}),
|
|
15
|
+
}), E = (e) => {
|
|
16
16
|
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);
|
|
17
17
|
return t(e);
|
|
18
|
-
},
|
|
18
|
+
}, D = Object.freeze({
|
|
19
19
|
data: void 0,
|
|
20
20
|
revision: -1,
|
|
21
21
|
emittedAt: void 0,
|
|
22
22
|
error: void 0,
|
|
23
23
|
pendingPatches: 0
|
|
24
|
-
}),
|
|
24
|
+
}), te = 5e3, ne = 0, re = () => `patch_${++ne}`, O = (e, t) => {
|
|
25
25
|
let n = e;
|
|
26
26
|
for (let e of t.split(".")) {
|
|
27
27
|
if (typeof n != "object" || !n) return;
|
|
28
28
|
n = n[e];
|
|
29
29
|
}
|
|
30
30
|
return n;
|
|
31
|
-
},
|
|
31
|
+
}, ie = (e, t, n) => {
|
|
32
32
|
let r = t.split("."), i = (e) => typeof e == "object" && e && !Array.isArray(e) ? { ...e } : {}, a = i(e), o = a;
|
|
33
33
|
for (let e = 0; e < r.length - 1; e += 1) o[r[e]] = i(o[r[e]]), o = o[r[e]];
|
|
34
34
|
return o[r[r.length - 1]] = n, a;
|
|
35
|
-
},
|
|
35
|
+
}, ae = (e, t) => {
|
|
36
36
|
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];
|
|
37
37
|
return i.length === 0 ? null : new Set(i);
|
|
38
|
-
},
|
|
38
|
+
}, oe = (e, t, n) => {
|
|
39
39
|
let r = e.path, i = e.by ?? "id";
|
|
40
40
|
if (e.op === "insert") {
|
|
41
41
|
let a = e.shapeItem ?? e.shape, o = a ? {
|
|
@@ -48,11 +48,11 @@ var w = /* @__PURE__ */ new Set(), T = (e) => {
|
|
|
48
48
|
optimistic: !0
|
|
49
49
|
}, s = e.order ?? "append";
|
|
50
50
|
return (e) => {
|
|
51
|
-
let t = Array.isArray(
|
|
52
|
-
return
|
|
51
|
+
let t = Array.isArray(O(e, r)) ? O(e, r) : [];
|
|
52
|
+
return ie(e ?? {}, r, s === "append" ? [...t, o] : [o, ...t]);
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
let a =
|
|
55
|
+
let a = ae(e, t);
|
|
56
56
|
if (a === null) return null;
|
|
57
57
|
if (e.op === "update") {
|
|
58
58
|
let n = e.shapeItem ?? e.shape, o = n ? (e) => ({
|
|
@@ -66,16 +66,16 @@ var w = /* @__PURE__ */ new Set(), T = (e) => {
|
|
|
66
66
|
optimistic: !0
|
|
67
67
|
});
|
|
68
68
|
return (e) => {
|
|
69
|
-
let t = Array.isArray(
|
|
70
|
-
return
|
|
69
|
+
let t = Array.isArray(O(e, r)) ? O(e, r) : [];
|
|
70
|
+
return ie(e, r, t.map((e) => a.has(e[i]) ? o(e) : e));
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
73
|
return (e) => {
|
|
74
|
-
let t = Array.isArray(
|
|
75
|
-
return
|
|
74
|
+
let t = Array.isArray(O(e, r)) ? O(e, r) : [];
|
|
75
|
+
return ie(e, r, t.filter((e) => !a.has(e[i])));
|
|
76
76
|
};
|
|
77
|
-
},
|
|
78
|
-
if (e.path !== void 0) return
|
|
77
|
+
}, se = (e, t, n) => {
|
|
78
|
+
if (e.path !== void 0) return oe(e, t, n);
|
|
79
79
|
switch (e.op) {
|
|
80
80
|
case "insert": {
|
|
81
81
|
let r = e.shape ? {
|
|
@@ -93,7 +93,7 @@ var w = /* @__PURE__ */ new Set(), T = (e) => {
|
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
case "update": {
|
|
96
|
-
let n =
|
|
96
|
+
let n = ae(e, t);
|
|
97
97
|
if (n === null) return null;
|
|
98
98
|
let r = e.shape, i = r ? (e) => ({
|
|
99
99
|
...r(t, e),
|
|
@@ -110,30 +110,30 @@ var w = /* @__PURE__ */ new Set(), T = (e) => {
|
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
case "delete": {
|
|
113
|
-
let n =
|
|
113
|
+
let n = ae(e, t);
|
|
114
114
|
return n === null ? null : (e) => (Array.isArray(e) ? e : []).filter((e) => !n.has(e.id));
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
},
|
|
117
|
+
}, ce = 5e3, le = class {
|
|
118
118
|
entries = /* @__PURE__ */ new Map();
|
|
119
119
|
inactiveTtlMs;
|
|
120
120
|
onChangeHook;
|
|
121
121
|
errorBus;
|
|
122
122
|
constructor(e = {}) {
|
|
123
|
-
this.inactiveTtlMs = e.inactiveTtlMs ??
|
|
123
|
+
this.inactiveTtlMs = e.inactiveTtlMs ?? ce, this.onChangeHook = e.onChange, this.errorBus = e.errorBus;
|
|
124
124
|
}
|
|
125
125
|
subscribe(e, t, n, r, i = {}) {
|
|
126
|
-
let a =
|
|
126
|
+
let a = E(e), o = typeof e[0] == "string" ? e[0] : void 0, s = this.entries.get(a);
|
|
127
127
|
return s && s.evictionTimer !== null && (clearTimeout(s.evictionTimer), s.evictionTimer = null), s ? (s.fiber === null && (s.fetch = t, 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), {
|
|
128
128
|
getSnapshot: () => this.getSnapshot(a),
|
|
129
129
|
unsubscribe: () => this.unsubscribe(a, r)
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
132
|
update(e, t, n) {
|
|
133
|
-
let r =
|
|
133
|
+
let r = E(e), i = typeof e[0] == "string" ? e[0] : void 0, a = this.entries.get(r);
|
|
134
134
|
a ||= this.createStub(r, i);
|
|
135
135
|
let o = {
|
|
136
|
-
id:
|
|
136
|
+
id: re(),
|
|
137
137
|
mutationId: n,
|
|
138
138
|
reducer: t
|
|
139
139
|
};
|
|
@@ -147,7 +147,7 @@ var w = /* @__PURE__ */ new Set(), T = (e) => {
|
|
|
147
147
|
for (let i of this.entries.values()) {
|
|
148
148
|
if (i.tag !== e) continue;
|
|
149
149
|
let a = {
|
|
150
|
-
id: `forTag-${++
|
|
150
|
+
id: `forTag-${++ne}`,
|
|
151
151
|
mutationId: n,
|
|
152
152
|
reducer: t
|
|
153
153
|
};
|
|
@@ -164,10 +164,10 @@ var w = /* @__PURE__ */ new Set(), T = (e) => {
|
|
|
164
164
|
confirmByMutation(e) {
|
|
165
165
|
let t = !1;
|
|
166
166
|
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);
|
|
167
|
-
t && setTimeout(() => this.revertByMutation(e),
|
|
167
|
+
t && setTimeout(() => this.revertByMutation(e), te);
|
|
168
168
|
}
|
|
169
169
|
autoApply(e, t, n) {
|
|
170
|
-
let r = `optimistic-${n}-${++
|
|
170
|
+
let r = `optimistic-${n}-${++ne}`;
|
|
171
171
|
for (let i of e) for (let e of this.entries.values()) {
|
|
172
172
|
if (!(Array.isArray(e.source) ? e.source.includes(i.table) : e.source === i.table)) continue;
|
|
173
173
|
if (i.match !== void 0) {
|
|
@@ -180,7 +180,7 @@ var w = /* @__PURE__ */ new Set(), T = (e) => {
|
|
|
180
180
|
if (!n) continue;
|
|
181
181
|
}
|
|
182
182
|
if (e.computed && i.op === "insert" && i.path === void 0) continue;
|
|
183
|
-
let a =
|
|
183
|
+
let a = se(i, t, r);
|
|
184
184
|
if (a === null) continue;
|
|
185
185
|
let o = {
|
|
186
186
|
id: `${r}-${e.key}`,
|
|
@@ -197,10 +197,10 @@ var w = /* @__PURE__ */ new Set(), T = (e) => {
|
|
|
197
197
|
n.state.patches = n.state.patches.filter((e) => e.id !== t), n.state.patches.length !== r && this.invalidate(n);
|
|
198
198
|
}
|
|
199
199
|
peek(e) {
|
|
200
|
-
return this.getSnapshot(
|
|
200
|
+
return this.getSnapshot(E(e));
|
|
201
201
|
}
|
|
202
202
|
getEntry(e) {
|
|
203
|
-
return this.entries.get(
|
|
203
|
+
return this.entries.get(E(e));
|
|
204
204
|
}
|
|
205
205
|
size() {
|
|
206
206
|
return this.entries.size;
|
|
@@ -302,7 +302,7 @@ var w = /* @__PURE__ */ new Set(), T = (e) => {
|
|
|
302
302
|
}
|
|
303
303
|
getSnapshot(e) {
|
|
304
304
|
let t = this.entries.get(e);
|
|
305
|
-
if (!t) return
|
|
305
|
+
if (!t) return D;
|
|
306
306
|
if (t.state.cachedSnapshot !== null) return t.state.cachedSnapshot;
|
|
307
307
|
let n = t.state.base;
|
|
308
308
|
if (n !== void 0 && t.state.patches.length > 0) for (let e of t.state.patches) n = e.reducer(n);
|
|
@@ -322,14 +322,14 @@ var w = /* @__PURE__ */ new Set(), T = (e) => {
|
|
|
322
322
|
t && t.subscribers.size === 0 && (t.fiber && f.runFork(m.interrupt(t.fiber)), this.entries.delete(e));
|
|
323
323
|
}, this.inactiveTtlMs)));
|
|
324
324
|
}
|
|
325
|
-
},
|
|
325
|
+
}, ue = class extends le {
|
|
326
326
|
subscribe(e, t, n, r, i = {}) {
|
|
327
327
|
return {
|
|
328
328
|
getSnapshot: () => this.peek(e),
|
|
329
329
|
unsubscribe: () => {}
|
|
330
330
|
};
|
|
331
331
|
}
|
|
332
|
-
},
|
|
332
|
+
}, de = class {
|
|
333
333
|
#e = /* @__PURE__ */ new Set();
|
|
334
334
|
on(e) {
|
|
335
335
|
return this.#e.add(e), () => {
|
|
@@ -341,30 +341,30 @@ var w = /* @__PURE__ */ new Set(), T = (e) => {
|
|
|
341
341
|
t(e);
|
|
342
342
|
} catch {}
|
|
343
343
|
}
|
|
344
|
-
},
|
|
344
|
+
}, k = e(null), fe = () => {
|
|
345
345
|
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");
|
|
346
|
-
},
|
|
347
|
-
get: (e, t) =>
|
|
346
|
+
}, A = new Proxy(() => fe(), {
|
|
347
|
+
get: (e, t) => A,
|
|
348
348
|
has: () => !0,
|
|
349
|
-
apply: () =>
|
|
349
|
+
apply: () => fe()
|
|
350
350
|
}), pe = {
|
|
351
351
|
runtime: { runPromise: () => Promise.reject(/* @__PURE__ */ Error("Voltro: mutations are not invokable during SSR")) },
|
|
352
|
-
cache: new
|
|
353
|
-
client:
|
|
352
|
+
cache: new ue(),
|
|
353
|
+
client: A,
|
|
354
354
|
descriptors: {},
|
|
355
355
|
inspectBaseUrl: "",
|
|
356
|
-
errorBus: new
|
|
356
|
+
errorBus: new de()
|
|
357
357
|
}, me = {
|
|
358
358
|
get: () => pe,
|
|
359
359
|
names: []
|
|
360
360
|
}, j = !1, M = !1, N = null, he = () => {
|
|
361
361
|
j = !1, M = !1, N !== null && (clearTimeout(N), N = null);
|
|
362
362
|
}, ge = () => {
|
|
363
|
-
let e = r(
|
|
363
|
+
let e = r(k);
|
|
364
364
|
return e ? (M || (M = !0, N !== null && (clearTimeout(N), N = null)), e) : (typeof window < "u" && !j && !M && N === null && process.env.NODE_ENV !== "production" && (N = setTimeout(() => {
|
|
365
365
|
N = null, !(j || M) && (j = !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>."));
|
|
366
366
|
}, 0)), me);
|
|
367
|
-
}, P = (e) => ge().get(e),
|
|
367
|
+
}, P = (e) => ge().get(e), F = (e) => typeof e.runtime?.runFork != "function", _e = ({ apis: e, children: t }) => {
|
|
368
368
|
let n = o(() => ({
|
|
369
369
|
get: (t) => {
|
|
370
370
|
let n = e.get(t);
|
|
@@ -376,21 +376,21 @@ var w = /* @__PURE__ */ new Set(), T = (e) => {
|
|
|
376
376
|
},
|
|
377
377
|
names: Array.from(e.keys())
|
|
378
378
|
}), [e]);
|
|
379
|
-
return /* @__PURE__ */ b(
|
|
379
|
+
return /* @__PURE__ */ b(k.Provider, {
|
|
380
380
|
value: n,
|
|
381
381
|
children: t
|
|
382
382
|
});
|
|
383
|
-
},
|
|
383
|
+
}, I = (e, t) => {
|
|
384
384
|
if (Object.is(e, t)) return !0;
|
|
385
385
|
if (typeof e != "object" || typeof t != "object" || e === null || t === null || Array.isArray(e) !== Array.isArray(t)) return !1;
|
|
386
386
|
let n = Object.keys(e), r = Object.keys(t);
|
|
387
387
|
if (n.length !== r.length) return !1;
|
|
388
388
|
for (let r of n) if (!Object.prototype.hasOwnProperty.call(t, r) || !Object.is(e[r], t[r])) return !1;
|
|
389
389
|
return !0;
|
|
390
|
-
},
|
|
391
|
-
|
|
392
|
-
},
|
|
393
|
-
let r =
|
|
390
|
+
}, ve = 50, ye = /* @__PURE__ */ new Set(), be = (e, t) => {
|
|
391
|
+
ye.has(e) || (ye.add(e), console.warn(t));
|
|
392
|
+
}, xe = "\0global", Se = null, Ce = (e, t, n) => {
|
|
393
|
+
let r = Se?.() ?? null;
|
|
394
394
|
if (r === null) return n;
|
|
395
395
|
let i = n;
|
|
396
396
|
for (let n of r.seeds) n.store !== e || n.key !== t || (i = {
|
|
@@ -398,9 +398,9 @@ var w = /* @__PURE__ */ new Set(), T = (e) => {
|
|
|
398
398
|
...n.value
|
|
399
399
|
});
|
|
400
400
|
return i;
|
|
401
|
-
},
|
|
401
|
+
}, we = (e, t) => {
|
|
402
402
|
let n = e(), r = /* @__PURE__ */ new Set(), i = 0, a = 0, o, s, c = () => {
|
|
403
|
-
if (i >=
|
|
403
|
+
if (i >= ve) throw i = 0, Error(`defineStore: notification depth exceeded ${ve} — 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.`);
|
|
404
404
|
i += 1;
|
|
405
405
|
try {
|
|
406
406
|
for (let e of [...r]) e();
|
|
@@ -421,20 +421,20 @@ var w = /* @__PURE__ */ new Set(), T = (e) => {
|
|
|
421
421
|
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}', () => { … })\`.`);
|
|
422
422
|
if (--a, a > 0) return;
|
|
423
423
|
let l = o, u = s;
|
|
424
|
-
o = void 0, s = void 0, !
|
|
424
|
+
o = void 0, s = void 0, !I(l, n) && (t(l, n, u), c());
|
|
425
425
|
},
|
|
426
426
|
set: (e, r) => {
|
|
427
427
|
let i = typeof e == "function" ? e(n) : {
|
|
428
428
|
...n,
|
|
429
429
|
...e
|
|
430
430
|
};
|
|
431
|
-
if (
|
|
431
|
+
if (I(i, n)) return;
|
|
432
432
|
let o = n;
|
|
433
433
|
n = i, !(a > 0) && (t(o, i, r), c());
|
|
434
434
|
},
|
|
435
435
|
reset: () => {
|
|
436
436
|
let r = e();
|
|
437
|
-
if (
|
|
437
|
+
if (I(r, n)) return;
|
|
438
438
|
let i = n;
|
|
439
439
|
n = r, !(a > 0) && (t(i, r, "reset"), c());
|
|
440
440
|
},
|
|
@@ -442,47 +442,47 @@ var w = /* @__PURE__ */ new Set(), T = (e) => {
|
|
|
442
442
|
r.delete(e);
|
|
443
443
|
})
|
|
444
444
|
};
|
|
445
|
-
},
|
|
446
|
-
|
|
447
|
-
}),
|
|
448
|
-
|
|
449
|
-
},
|
|
450
|
-
let n =
|
|
445
|
+
}, Te = 200, L = [], Ee = /* @__PURE__ */ new Set(), R = [], De = () => R, Oe = (e) => (Ee.add(e), () => {
|
|
446
|
+
Ee.delete(e);
|
|
447
|
+
}), ke = () => {
|
|
448
|
+
L.length = 0, R = [];
|
|
449
|
+
}, Ae = (e, t) => {
|
|
450
|
+
let n = L[e];
|
|
451
451
|
if (n === void 0) return !1;
|
|
452
|
-
let r =
|
|
452
|
+
let r = V.get(n.store);
|
|
453
453
|
if (r === void 0) return !1;
|
|
454
454
|
let i = t === "before" ? n.prev : n.next;
|
|
455
|
-
|
|
455
|
+
B = !0;
|
|
456
456
|
try {
|
|
457
457
|
r.set(() => i, n.key, `travel:${t}`);
|
|
458
458
|
} finally {
|
|
459
|
-
|
|
459
|
+
B = !1;
|
|
460
460
|
}
|
|
461
461
|
return !0;
|
|
462
|
-
},
|
|
463
|
-
|
|
464
|
-
for (let e of [...
|
|
465
|
-
},
|
|
466
|
-
|
|
467
|
-
})),
|
|
468
|
-
function
|
|
462
|
+
}, z = !1, B = !1, je = (e) => {
|
|
463
|
+
L.push(e), L.length > Te && L.shift(), R = [...L];
|
|
464
|
+
for (let e of [...Ee]) e();
|
|
465
|
+
}, V = /* @__PURE__ */ new Map(), Me = /* @__PURE__ */ new Map(), Ne = 0, Pe = !1, Fe = /* @__PURE__ */ new Map(), Ie = () => (Pe || (Pe = !0, queueMicrotask(() => {
|
|
466
|
+
Ne += 1, Pe = !1;
|
|
467
|
+
})), Ne), Le = Re(((/* @__PURE__ */ Error()).stack ?? "").split("\n")[1] ?? "") ?? "";
|
|
468
|
+
function Re(e) {
|
|
469
469
|
let t = e.trim().replace(/^at\s+/, ""), n = /\(([^()]+)\)\s*$/.exec(t)?.[1] ?? t;
|
|
470
470
|
return n.length > 0 ? n : void 0;
|
|
471
471
|
}
|
|
472
|
-
var
|
|
472
|
+
var ze = () => {
|
|
473
473
|
let e = (/* @__PURE__ */ Error()).stack;
|
|
474
474
|
if (typeof e != "string") return "<unknown>";
|
|
475
475
|
for (let t of e.split("\n").slice(1)) {
|
|
476
|
-
let e =
|
|
476
|
+
let e = Re(t);
|
|
477
477
|
if (e === void 0) continue;
|
|
478
478
|
let n = e.replace(/:\d+:\d+$/, "");
|
|
479
|
-
if (!(
|
|
479
|
+
if (!(Le !== "" && n === Le.replace(/:\d+:\d+$/, ""))) return n;
|
|
480
480
|
}
|
|
481
481
|
return "<unknown>";
|
|
482
|
-
},
|
|
483
|
-
let a =
|
|
482
|
+
}, Be = () => [...V.values()], Ve = (e, t, r) => {
|
|
483
|
+
let a = ze(), o = Ie(), c = V.get(e);
|
|
484
484
|
if (c !== void 0) {
|
|
485
|
-
let t =
|
|
485
|
+
let t = Me.get(e) ?? "<unknown>", n = Fe.get(e) === o;
|
|
486
486
|
if (a !== "<unknown>" && a === t && !n) return c;
|
|
487
487
|
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: ${a}`);
|
|
488
488
|
}
|
|
@@ -518,28 +518,28 @@ var Be = () => {
|
|
|
518
518
|
t.setItem(u.key, JSON.stringify(n));
|
|
519
519
|
} catch {}
|
|
520
520
|
}, m = /* @__PURE__ */ new Map(), h = (n) => {
|
|
521
|
-
let r = n ??
|
|
521
|
+
let r = n ?? xe, i = m.get(r);
|
|
522
522
|
if (i === void 0) {
|
|
523
523
|
let a = n;
|
|
524
|
-
i =
|
|
524
|
+
i = we(u !== void 0 && n === void 0 ? () => {
|
|
525
525
|
let e = t();
|
|
526
526
|
return g = e, {
|
|
527
527
|
...e,
|
|
528
528
|
...f() ?? {}
|
|
529
529
|
};
|
|
530
530
|
} : t, (t, n, r) => {
|
|
531
|
-
if (u !== void 0 && a === void 0 && p(n), !
|
|
531
|
+
if (u !== void 0 && a === void 0 && p(n), !z && !B) {
|
|
532
532
|
let e = v(a);
|
|
533
533
|
e.steps.length = e.cursor, e.steps.push({
|
|
534
534
|
prev: t,
|
|
535
535
|
next: n
|
|
536
536
|
}), e.steps.length > y && e.steps.shift(), e.cursor = e.steps.length;
|
|
537
537
|
}
|
|
538
|
-
|
|
538
|
+
je({
|
|
539
539
|
store: e,
|
|
540
540
|
...a === void 0 ? {} : { key: a },
|
|
541
541
|
...r === void 0 ? {} : { label: r },
|
|
542
|
-
...
|
|
542
|
+
...z || B ? { isUndo: !0 } : {},
|
|
543
543
|
prev: t,
|
|
544
544
|
next: n,
|
|
545
545
|
at: Date.now()
|
|
@@ -548,7 +548,7 @@ var Be = () => {
|
|
|
548
548
|
}
|
|
549
549
|
return i;
|
|
550
550
|
}, g, _ = /* @__PURE__ */ new Map(), v = (e) => {
|
|
551
|
-
let t = e ??
|
|
551
|
+
let t = e ?? xe, n = _.get(t);
|
|
552
552
|
return n === void 0 && (n = {
|
|
553
553
|
steps: [],
|
|
554
554
|
cursor: 0
|
|
@@ -580,7 +580,7 @@ var Be = () => {
|
|
|
580
580
|
let n = u.current;
|
|
581
581
|
if (n.has && Object.is(n.state, t)) return n.value;
|
|
582
582
|
let r = o.current(t), i = c.current, a = n.has && (i ? i(n.value, r) : Object.is(n.value, r));
|
|
583
|
-
process.env.NODE_ENV !== "production" && i === void 0 && n.has && !a && typeof r == "object" && r &&
|
|
583
|
+
process.env.NODE_ENV !== "production" && i === void 0 && n.has && !a && typeof r == "object" && r && I(n.value, r) && be(e, `[@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.`);
|
|
584
584
|
let s = a ? n.value : r;
|
|
585
585
|
return u.current = {
|
|
586
586
|
state: t,
|
|
@@ -596,7 +596,7 @@ var Be = () => {
|
|
|
596
596
|
a,
|
|
597
597
|
f,
|
|
598
598
|
p
|
|
599
|
-
]), n(() => d(a.get()), [a, d]), n(() => d(
|
|
599
|
+
]), n(() => d(a.get()), [a, d]), n(() => d(Ce(e, r?.key, r?.key === void 0 && g !== void 0 ? g : a.get())), [
|
|
600
600
|
a,
|
|
601
601
|
r?.key,
|
|
602
602
|
d
|
|
@@ -614,11 +614,11 @@ var Be = () => {
|
|
|
614
614
|
undo: (e) => {
|
|
615
615
|
let t = v(e);
|
|
616
616
|
if (t.cursor === 0) return !1;
|
|
617
|
-
--t.cursor,
|
|
617
|
+
--t.cursor, z = !0;
|
|
618
618
|
try {
|
|
619
619
|
h(e).set(() => t.steps[t.cursor].prev, "undo");
|
|
620
620
|
} finally {
|
|
621
|
-
|
|
621
|
+
z = !1;
|
|
622
622
|
}
|
|
623
623
|
return !0;
|
|
624
624
|
},
|
|
@@ -626,11 +626,11 @@ var Be = () => {
|
|
|
626
626
|
let t = v(e);
|
|
627
627
|
if (t.cursor >= t.steps.length) return !1;
|
|
628
628
|
let n = t.steps[t.cursor];
|
|
629
|
-
t.cursor += 1,
|
|
629
|
+
t.cursor += 1, z = !0;
|
|
630
630
|
try {
|
|
631
631
|
h(e).set(() => n.next, "redo");
|
|
632
632
|
} finally {
|
|
633
|
-
|
|
633
|
+
z = !1;
|
|
634
634
|
}
|
|
635
635
|
return !0;
|
|
636
636
|
},
|
|
@@ -642,27 +642,27 @@ var Be = () => {
|
|
|
642
642
|
release: (e) => {
|
|
643
643
|
m.delete(e), _.delete(e);
|
|
644
644
|
},
|
|
645
|
-
keys: () => [...m.keys()].filter((e) => e !==
|
|
645
|
+
keys: () => [...m.keys()].filter((e) => e !== xe)
|
|
646
646
|
};
|
|
647
|
-
return
|
|
648
|
-
},
|
|
649
|
-
|
|
650
|
-
},
|
|
651
|
-
|
|
652
|
-
},
|
|
653
|
-
let r =
|
|
647
|
+
return V.set(e, w), Me.set(e, a), Fe.set(e, o), w;
|
|
648
|
+
}, He = () => {
|
|
649
|
+
V.clear(), Me.clear(), Fe.clear(), ye.clear();
|
|
650
|
+
}, Ue = () => ({ seeds: [] }), We = (e) => {
|
|
651
|
+
Se = e;
|
|
652
|
+
}, Ge = (e, t, n) => {
|
|
653
|
+
let r = Se?.() ?? null;
|
|
654
654
|
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.)`);
|
|
655
655
|
r.seeds.push({
|
|
656
656
|
store: e.name,
|
|
657
657
|
...n?.key === void 0 ? {} : { key: n.key },
|
|
658
658
|
value: t
|
|
659
659
|
});
|
|
660
|
-
},
|
|
660
|
+
}, Ke = (e) => {
|
|
661
661
|
if (e !== void 0) for (let t of e) {
|
|
662
|
-
let e =
|
|
662
|
+
let e = V.get(t.store);
|
|
663
663
|
e !== void 0 && e.set(t.value, t.key);
|
|
664
664
|
}
|
|
665
|
-
},
|
|
665
|
+
}, H = (e, t) => {
|
|
666
666
|
let n = t.split("."), r = e;
|
|
667
667
|
for (let e = 0; e < n.length; e++) {
|
|
668
668
|
let i = n[e];
|
|
@@ -681,29 +681,29 @@ var Be = () => {
|
|
|
681
681
|
}
|
|
682
682
|
if (typeof r != "function") throw Error(`@voltro/client: rpc tag ${JSON.stringify(t)} did not resolve to a callable method.`);
|
|
683
683
|
return r;
|
|
684
|
-
},
|
|
684
|
+
}, qe = Object.freeze({
|
|
685
685
|
data: void 0,
|
|
686
686
|
revision: -1,
|
|
687
687
|
emittedAt: void 0,
|
|
688
688
|
error: void 0,
|
|
689
689
|
pendingPatches: 0
|
|
690
|
-
}),
|
|
691
|
-
function
|
|
690
|
+
}), Je = () => qe;
|
|
691
|
+
function U(e, t, r = {}, i = {}) {
|
|
692
692
|
let a = i.skip === !0, { runtime: c, cache: u, client: d, descriptors: f } = P(e), p = f[t]?.source, m = s(r);
|
|
693
693
|
m.current = r;
|
|
694
694
|
let h = s(d);
|
|
695
695
|
h.current = d;
|
|
696
|
-
let g = s(() =>
|
|
696
|
+
let g = s(() => H(h.current, t)(m.current)), _ = o(() => [t, m.current], [t, o(() => JSON.stringify(Object.entries(r).sort(([e], [t]) => e.localeCompare(t))), [r])]), v = l(n((e) => a ? () => {} : u.subscribe(_, g.current, c, e, p === void 0 ? {} : { source: p }).unsubscribe, [
|
|
697
697
|
u,
|
|
698
698
|
c,
|
|
699
699
|
p,
|
|
700
700
|
a,
|
|
701
701
|
_
|
|
702
|
-
]), n(() => a ?
|
|
702
|
+
]), n(() => a ? qe : u.peek(_), [
|
|
703
703
|
u,
|
|
704
704
|
a,
|
|
705
705
|
_
|
|
706
|
-
]),
|
|
706
|
+
]), Je), y = v.data !== void 0, b = y && (Array.isArray(v.data) ? v.data.length === 0 : v.data === null), x = {
|
|
707
707
|
revision: v.revision,
|
|
708
708
|
emittedAt: v.emittedAt,
|
|
709
709
|
error: v.error,
|
|
@@ -746,16 +746,49 @@ function H(e, t, r = {}, i = {}) {
|
|
|
746
746
|
};
|
|
747
747
|
}
|
|
748
748
|
//#endregion
|
|
749
|
+
//#region src/preloadSeed.ts
|
|
750
|
+
var Ye = () => ({ seeds: [] }), Xe = null, Ze = (e) => {
|
|
751
|
+
Xe = e;
|
|
752
|
+
}, Qe = /* @__PURE__ */ new Map(), $e = (e, t) => `${e}\u0000${t}`, et = (e, t, n, r) => {
|
|
753
|
+
let i = Xe?.() ?? null;
|
|
754
|
+
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.)`);
|
|
755
|
+
i.seeds.push({
|
|
756
|
+
api: e,
|
|
757
|
+
key: E([t, n]),
|
|
758
|
+
value: r
|
|
759
|
+
});
|
|
760
|
+
}, tt = (e) => {
|
|
761
|
+
if (e !== void 0) for (let t of e) Qe.set($e(t.api, t.key), t.value);
|
|
762
|
+
}, nt = (e, t, n) => {
|
|
763
|
+
let r = E([t, n]), i = Xe?.() ?? null;
|
|
764
|
+
if (i !== null) {
|
|
765
|
+
for (let t of i.seeds) if (t.api === e && t.key === r) return t.value;
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
return Qe.get($e(e, r));
|
|
769
|
+
}, rt = () => {
|
|
770
|
+
Qe.clear();
|
|
771
|
+
};
|
|
772
|
+
//#endregion
|
|
773
|
+
//#region src/usePreloadedSubscription.ts
|
|
774
|
+
function it(e, t, n = {}, r = {}) {
|
|
775
|
+
let i = nt(e, t, n);
|
|
776
|
+
return U(e, t, n, i === void 0 ? r : {
|
|
777
|
+
...r,
|
|
778
|
+
initialSnapshot: i
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
//#endregion
|
|
749
782
|
//#region src/useEvent.ts
|
|
750
|
-
var
|
|
783
|
+
var at = {
|
|
751
784
|
status: "idle",
|
|
752
785
|
missed: 0,
|
|
753
786
|
lastMiss: void 0
|
|
754
|
-
},
|
|
787
|
+
}, ot = class {
|
|
755
788
|
_tag = "EventStreamClosed";
|
|
756
789
|
};
|
|
757
|
-
function
|
|
758
|
-
let { skip: o = !1, apiName: l = "app", onMissed: u } = i, d = P(l), { runtime: p, client: m } = d, [h, _] = c(
|
|
790
|
+
function st(e, t, r, i = {}) {
|
|
791
|
+
let { skip: o = !1, apiName: l = "app", onMissed: u } = i, d = P(l), { runtime: p, client: m } = d, [h, _] = c(at), y = s(r);
|
|
759
792
|
y.current = r;
|
|
760
793
|
let b = s(u);
|
|
761
794
|
b.current = u;
|
|
@@ -765,9 +798,9 @@ function Ze(e, t, r, i = {}) {
|
|
|
765
798
|
S.current = p;
|
|
766
799
|
let C = s(/* @__PURE__ */ new Map()), w = t === null ? null : JSON.stringify(Object.entries(t).sort(([e], [t]) => e < t ? -1 : 1)), T = s(t);
|
|
767
800
|
T.current = t;
|
|
768
|
-
let
|
|
769
|
-
|
|
770
|
-
let
|
|
801
|
+
let ee = s(null);
|
|
802
|
+
ee.current !== w && (ee.current = w, C.current = /* @__PURE__ */ new Map());
|
|
803
|
+
let E = n((e, t) => {
|
|
771
804
|
e <= 0 || (_((n) => ({
|
|
772
805
|
...n,
|
|
773
806
|
missed: n.missed + e,
|
|
@@ -779,10 +812,10 @@ function Ze(e, t, r, i = {}) {
|
|
|
779
812
|
count: e,
|
|
780
813
|
reason: t
|
|
781
814
|
}));
|
|
782
|
-
}, []),
|
|
815
|
+
}, []), D = !o && w !== null && !F(d);
|
|
783
816
|
return a(() => {
|
|
784
|
-
if (!
|
|
785
|
-
_(
|
|
817
|
+
if (!D) {
|
|
818
|
+
_(at);
|
|
786
819
|
return;
|
|
787
820
|
}
|
|
788
821
|
_((e) => ({
|
|
@@ -794,13 +827,13 @@ function Ze(e, t, r, i = {}) {
|
|
|
794
827
|
origin: e,
|
|
795
828
|
n: t
|
|
796
829
|
}));
|
|
797
|
-
return
|
|
830
|
+
return H(x.current, e.name)({
|
|
798
831
|
key: T.current,
|
|
799
832
|
...t.length > 0 ? { resume: t } : {}
|
|
800
833
|
});
|
|
801
834
|
}), r = v.unwrap(n).pipe(v.tap(() => f.sync(() => {
|
|
802
835
|
t = 0;
|
|
803
|
-
})), v.concat(v.fail(new
|
|
836
|
+
})), v.concat(v.fail(new ot())), v.retry(g.exponential("250 millis", 2).pipe(g.either(g.spaced("30 seconds")), g.jittered, g.tapOutput(() => f.sync(() => {
|
|
804
837
|
t += 1, _((e) => ({
|
|
805
838
|
...e,
|
|
806
839
|
status: "connecting"
|
|
@@ -814,7 +847,7 @@ function Ze(e, t, r, i = {}) {
|
|
|
814
847
|
return;
|
|
815
848
|
}
|
|
816
849
|
if (e._tag === "gap") {
|
|
817
|
-
|
|
850
|
+
E(e.missed, e.reason);
|
|
818
851
|
return;
|
|
819
852
|
}
|
|
820
853
|
C.current.set(e.origin, Math.max(C.current.get(e.origin) ?? 0, e.n)), y.current(e.payload);
|
|
@@ -823,15 +856,15 @@ function Ze(e, t, r, i = {}) {
|
|
|
823
856
|
S.current.runFork(i.interruptAsFork(i.id()));
|
|
824
857
|
};
|
|
825
858
|
}, [
|
|
826
|
-
|
|
859
|
+
D,
|
|
827
860
|
w,
|
|
828
861
|
e.name,
|
|
829
|
-
|
|
830
|
-
]),
|
|
862
|
+
E
|
|
863
|
+
]), D ? h : at;
|
|
831
864
|
}
|
|
832
865
|
//#endregion
|
|
833
866
|
//#region src/sequence.ts
|
|
834
|
-
var
|
|
867
|
+
var ct = () => {
|
|
835
868
|
let e = (t) => ({
|
|
836
869
|
steps: t,
|
|
837
870
|
step: ((n, r, i) => e([...t, {
|
|
@@ -843,7 +876,7 @@ var Qe = () => {
|
|
|
843
876
|
}]))
|
|
844
877
|
});
|
|
845
878
|
return e([]);
|
|
846
|
-
},
|
|
879
|
+
}, lt = async (e, t = {}) => {
|
|
847
880
|
let n = {}, r = [];
|
|
848
881
|
for (let i of e.steps) {
|
|
849
882
|
if (i.when !== void 0 && !i.when(n)) {
|
|
@@ -903,13 +936,13 @@ var Qe = () => {
|
|
|
903
936
|
ok: !0,
|
|
904
937
|
data: n
|
|
905
938
|
};
|
|
906
|
-
},
|
|
939
|
+
}, ut = (e = {}) => {
|
|
907
940
|
let [t, r] = c(!1), [i, a] = c(void 0), [o, l] = c(void 0), u = s(e);
|
|
908
941
|
return u.current = e, {
|
|
909
942
|
run: n(async (e, t = {}) => {
|
|
910
943
|
r(!0), a(void 0), l(void 0);
|
|
911
944
|
try {
|
|
912
|
-
let n = await
|
|
945
|
+
let n = await lt(e, {
|
|
913
946
|
...u.current,
|
|
914
947
|
...t
|
|
915
948
|
});
|
|
@@ -922,21 +955,21 @@ var Qe = () => {
|
|
|
922
955
|
error: i,
|
|
923
956
|
failedStep: o
|
|
924
957
|
};
|
|
925
|
-
},
|
|
926
|
-
|
|
927
|
-
},
|
|
928
|
-
|
|
929
|
-
for (let e of
|
|
958
|
+
}, dt = 100, W = [], ft = /* @__PURE__ */ new Set(), pt = [], mt = () => {
|
|
959
|
+
pt = W.slice();
|
|
960
|
+
}, ht = () => {
|
|
961
|
+
mt();
|
|
962
|
+
for (let e of ft) try {
|
|
930
963
|
e();
|
|
931
964
|
} catch {}
|
|
932
|
-
},
|
|
965
|
+
}, G = (e) => {
|
|
933
966
|
let t = {
|
|
934
967
|
...e,
|
|
935
968
|
status: "pending",
|
|
936
969
|
startedAt: Date.now()
|
|
937
970
|
};
|
|
938
|
-
W.unshift(t), W.length >
|
|
939
|
-
},
|
|
971
|
+
W.unshift(t), W.length > dt && (W.length = dt), ht();
|
|
972
|
+
}, K = (e, t) => {
|
|
940
973
|
let n = W.findIndex((t) => t.id === e);
|
|
941
974
|
if (n === -1) return;
|
|
942
975
|
let r = W[n], i = Date.now();
|
|
@@ -952,12 +985,12 @@ var Qe = () => {
|
|
|
952
985
|
error: t.error,
|
|
953
986
|
settledAt: i,
|
|
954
987
|
durationMs: i - r.startedAt
|
|
955
|
-
},
|
|
956
|
-
},
|
|
957
|
-
|
|
958
|
-
}),
|
|
959
|
-
W.length !== 0 && (W.length = 0,
|
|
960
|
-
},
|
|
988
|
+
}, ht();
|
|
989
|
+
}, gt = () => pt, _t = (e) => (ft.add(e), () => {
|
|
990
|
+
ft.delete(e);
|
|
991
|
+
}), vt = () => {
|
|
992
|
+
W.length !== 0 && (W.length = 0, ht());
|
|
993
|
+
}, yt = (e, t) => {
|
|
961
994
|
if (t === void 0 || typeof e != "object" || !e) return e;
|
|
962
995
|
try {
|
|
963
996
|
Object.defineProperty(e, "__voltroTraceId", {
|
|
@@ -967,17 +1000,17 @@ var Qe = () => {
|
|
|
967
1000
|
});
|
|
968
1001
|
} catch {}
|
|
969
1002
|
return e;
|
|
970
|
-
},
|
|
971
|
-
|
|
972
|
-
},
|
|
1003
|
+
}, q, bt = (e) => {
|
|
1004
|
+
q = e;
|
|
1005
|
+
}, xt = () => q, St = (e, t, n) => typeof e == "function" ? e(t, n) : e, Ct = 0, wt = () => `mut_${++Ct}`, Tt = 0, Et = () => {
|
|
973
1006
|
let e = typeof crypto < "u" ? crypto : void 0;
|
|
974
|
-
return e && typeof e.randomUUID == "function" ? e.randomUUID() : `idem_${Date.now().toString(36)}_${
|
|
975
|
-
},
|
|
1007
|
+
return e && typeof e.randomUUID == "function" ? e.randomUUID() : `idem_${Date.now().toString(36)}_${Tt += 1}`;
|
|
1008
|
+
}, Dt = (e, t) => e.pipe(f.locallyWith(S.currentHeaders, (e) => x.set(e, "idempotency-key", t))), Ot = (e, t) => ({
|
|
976
1009
|
update: (n, r) => {
|
|
977
1010
|
e.update(n, r, t);
|
|
978
1011
|
},
|
|
979
1012
|
forTag: (n, r) => e.forTag(n, r, t)
|
|
980
|
-
}),
|
|
1013
|
+
}), J = (e, t) => {
|
|
981
1014
|
let { runtime: r, cache: i, client: a, descriptors: l, errorBus: u } = P(e), d = l[t], p = d?.targets;
|
|
982
1015
|
if (process.env.NODE_ENV !== "production") {
|
|
983
1016
|
let n = d?.kind;
|
|
@@ -986,12 +1019,12 @@ var Qe = () => {
|
|
|
986
1019
|
let [m, h] = c(!1), [g, _] = c(void 0), [v, y] = c(void 0), b = s(null), x = s(!1), S = n(async (n, o) => {
|
|
987
1020
|
let s = o?.onError !== void 0 || o?.notify?.error !== void 0, c = (e) => {
|
|
988
1021
|
o?.onError?.(e, n);
|
|
989
|
-
let t =
|
|
990
|
-
t !== void 0 &&
|
|
1022
|
+
let t = St(o?.notify?.error, e, n);
|
|
1023
|
+
t !== void 0 && q?.error(t);
|
|
991
1024
|
};
|
|
992
1025
|
h(!0), _(void 0);
|
|
993
|
-
let l =
|
|
994
|
-
|
|
1026
|
+
let l = wt(), d = o?.idempotencyKey ?? Et();
|
|
1027
|
+
G({
|
|
995
1028
|
id: l,
|
|
996
1029
|
apiName: e,
|
|
997
1030
|
tag: t,
|
|
@@ -999,9 +1032,9 @@ var Qe = () => {
|
|
|
999
1032
|
});
|
|
1000
1033
|
let m = b.current, g = x.current;
|
|
1001
1034
|
if (m) try {
|
|
1002
|
-
m(
|
|
1035
|
+
m(Ot(i, l), n);
|
|
1003
1036
|
} catch (e) {
|
|
1004
|
-
if (_(e), h(!1), i.revertByMutation(l),
|
|
1037
|
+
if (_(e), h(!1), i.revertByMutation(l), K(l, {
|
|
1005
1038
|
status: "error",
|
|
1006
1039
|
error: e
|
|
1007
1040
|
}), s) return c(e);
|
|
@@ -1010,27 +1043,27 @@ var Qe = () => {
|
|
|
1010
1043
|
else !g && p && p.length > 0 && i.autoApply(p, n, l);
|
|
1011
1044
|
let v;
|
|
1012
1045
|
try {
|
|
1013
|
-
let s =
|
|
1046
|
+
let s = H(a, t), c = f.currentSpan.pipe(f.tap((e) => f.sync(() => {
|
|
1014
1047
|
v = e.traceId, T({
|
|
1015
1048
|
traceId: e.traceId,
|
|
1016
1049
|
spanId: e.spanId,
|
|
1017
1050
|
source: "mutation",
|
|
1018
1051
|
tag: t
|
|
1019
1052
|
});
|
|
1020
|
-
})), f.catchAll(() => f.void), f.zipRight(
|
|
1053
|
+
})), f.catchAll(() => f.void), f.zipRight(Dt(s(n), d))).pipe(f.withSpan(`client.mutation.${t}`, { attributes: {
|
|
1021
1054
|
"voltro.api": e,
|
|
1022
1055
|
"voltro.mutationId": l,
|
|
1023
1056
|
"rpc.tag": t
|
|
1024
1057
|
} })), u = await r.runPromise(c);
|
|
1025
|
-
y(u),
|
|
1058
|
+
y(u), K(l, {
|
|
1026
1059
|
status: "success",
|
|
1027
1060
|
output: u
|
|
1028
1061
|
}), i.confirmByMutation(l), o?.onSuccess?.(u, n);
|
|
1029
|
-
let p =
|
|
1030
|
-
return p !== void 0 &&
|
|
1062
|
+
let p = St(o?.notify?.success, u, n);
|
|
1063
|
+
return p !== void 0 && q?.success(p), u;
|
|
1031
1064
|
} catch (e) {
|
|
1032
|
-
let n =
|
|
1033
|
-
if (_(n),
|
|
1065
|
+
let n = yt(e, v);
|
|
1066
|
+
if (_(n), K(l, {
|
|
1034
1067
|
status: "error",
|
|
1035
1068
|
error: n
|
|
1036
1069
|
}), i.revertByMutation(l), u.emit({
|
|
@@ -1067,7 +1100,7 @@ var Qe = () => {
|
|
|
1067
1100
|
g,
|
|
1068
1101
|
v
|
|
1069
1102
|
]);
|
|
1070
|
-
},
|
|
1103
|
+
}, kt = (e, t) => {
|
|
1071
1104
|
if (t === void 0 || typeof e != "object" || !e) return e;
|
|
1072
1105
|
try {
|
|
1073
1106
|
Object.defineProperty(e, "__voltroTraceId", {
|
|
@@ -1077,81 +1110,84 @@ var Qe = () => {
|
|
|
1077
1110
|
});
|
|
1078
1111
|
} catch {}
|
|
1079
1112
|
return e;
|
|
1080
|
-
},
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1113
|
+
}, At = (e, t, n) => typeof e == "function" ? e(t, n) : e, jt = 0, Mt = () => `act_${++jt}`, Nt = 15e3, Pt = async (e, t, n) => {
|
|
1114
|
+
if (!F(e.current)) return e.current;
|
|
1115
|
+
let r = Date.now() + Nt;
|
|
1116
|
+
for (; Date.now() < r;) if (await new Promise((e) => setTimeout(e, 16)), !F(e.current)) return e.current;
|
|
1117
|
+
throw Error(`Voltro: the api "${t}" did not resolve within ${Nt}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.`);
|
|
1118
|
+
}, Y = (e, t) => {
|
|
1119
|
+
let r = P(e), { descriptors: i, errorBus: a } = r, l = s(r);
|
|
1120
|
+
if (l.current = r, process.env.NODE_ENV !== "production") {
|
|
1121
|
+
let n = i[t]?.kind;
|
|
1084
1122
|
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.`);
|
|
1085
1123
|
}
|
|
1086
|
-
let [
|
|
1087
|
-
let
|
|
1088
|
-
|
|
1089
|
-
let
|
|
1090
|
-
|
|
1091
|
-
id:
|
|
1124
|
+
let [u, d] = c(!1), [p, m] = c(void 0), [h, g] = c(void 0), _ = n(async (n, r) => {
|
|
1125
|
+
let i = r?.onError !== void 0 || r?.notify?.error !== void 0;
|
|
1126
|
+
d(!0), m(void 0);
|
|
1127
|
+
let o = Mt(), s = r?.idempotencyKey ?? Et();
|
|
1128
|
+
G({
|
|
1129
|
+
id: o,
|
|
1092
1130
|
apiName: e,
|
|
1093
1131
|
tag: t,
|
|
1094
1132
|
input: n
|
|
1095
1133
|
});
|
|
1096
|
-
let
|
|
1134
|
+
let c;
|
|
1097
1135
|
try {
|
|
1098
|
-
let
|
|
1099
|
-
|
|
1136
|
+
let { runtime: i, client: a } = await Pt(l, e, t), u = H(a, t), d = f.currentSpan.pipe(f.tap((e) => f.sync(() => {
|
|
1137
|
+
c = e.traceId, T({
|
|
1100
1138
|
traceId: e.traceId,
|
|
1101
1139
|
spanId: e.spanId,
|
|
1102
1140
|
source: "action",
|
|
1103
1141
|
tag: t
|
|
1104
1142
|
});
|
|
1105
|
-
})), f.catchAll(() => f.void), f.zipRight(
|
|
1143
|
+
})), f.catchAll(() => f.void), f.zipRight(Dt(u(n), s))).pipe(f.withSpan(`client.action.${t}`, { attributes: {
|
|
1106
1144
|
"voltro.api": e,
|
|
1107
|
-
"voltro.actionId":
|
|
1145
|
+
"voltro.actionId": o,
|
|
1108
1146
|
"rpc.tag": t
|
|
1109
|
-
} })),
|
|
1110
|
-
|
|
1147
|
+
} })), p = await i.runPromise(d);
|
|
1148
|
+
g(p), K(o, {
|
|
1111
1149
|
status: "success",
|
|
1112
|
-
output:
|
|
1113
|
-
}),
|
|
1114
|
-
let
|
|
1115
|
-
return
|
|
1150
|
+
output: p
|
|
1151
|
+
}), r?.onSuccess?.(p, n);
|
|
1152
|
+
let m = At(r?.notify?.success, p, n);
|
|
1153
|
+
return m !== void 0 && xt()?.success(m), p;
|
|
1116
1154
|
} catch (e) {
|
|
1117
|
-
let
|
|
1118
|
-
if (
|
|
1155
|
+
let s = kt(e, c);
|
|
1156
|
+
if (m(s), K(o, {
|
|
1119
1157
|
status: "error",
|
|
1120
|
-
error:
|
|
1121
|
-
}),
|
|
1158
|
+
error: s
|
|
1159
|
+
}), a.emit({
|
|
1122
1160
|
source: "action",
|
|
1123
1161
|
tag: t,
|
|
1124
|
-
error:
|
|
1125
|
-
...
|
|
1126
|
-
}),
|
|
1127
|
-
|
|
1128
|
-
let e =
|
|
1129
|
-
e !== void 0 &&
|
|
1162
|
+
error: s,
|
|
1163
|
+
...c === void 0 ? {} : { traceId: c }
|
|
1164
|
+
}), i) {
|
|
1165
|
+
r?.onError?.(s, n);
|
|
1166
|
+
let e = At(r?.notify?.error, s, n);
|
|
1167
|
+
e !== void 0 && xt()?.error(e);
|
|
1130
1168
|
return;
|
|
1131
1169
|
}
|
|
1132
|
-
throw
|
|
1170
|
+
throw s;
|
|
1133
1171
|
} finally {
|
|
1134
|
-
|
|
1172
|
+
d(!1);
|
|
1135
1173
|
}
|
|
1136
1174
|
}, [
|
|
1137
|
-
r,
|
|
1138
|
-
i,
|
|
1139
1175
|
e,
|
|
1140
1176
|
t,
|
|
1141
|
-
|
|
1177
|
+
a
|
|
1142
1178
|
]);
|
|
1143
1179
|
return o(() => ({
|
|
1144
|
-
run:
|
|
1145
|
-
pending:
|
|
1146
|
-
error:
|
|
1147
|
-
lastResult:
|
|
1180
|
+
run: _,
|
|
1181
|
+
pending: u,
|
|
1182
|
+
error: p,
|
|
1183
|
+
lastResult: h
|
|
1148
1184
|
}), [
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1185
|
+
_,
|
|
1186
|
+
u,
|
|
1187
|
+
p,
|
|
1188
|
+
h
|
|
1153
1189
|
]);
|
|
1154
|
-
},
|
|
1190
|
+
}, Ft = "storage.mintUploadTicket", It = "storage.mintPresignedUpload", Lt = "storage.finalizeUpload", Rt = "storage.beginResumableUpload", zt = "storage.beginMultipartUpload", Bt = "storage.signMultipartPart", Vt = "storage.completeMultipartUpload", Ht = "storage.abortMultipartUpload", Ut = (e, t, n, r) => new Promise((i, a) => {
|
|
1155
1191
|
let o = new XMLHttpRequest();
|
|
1156
1192
|
if (o.open("PUT", e), o.upload.onprogress = (e) => {
|
|
1157
1193
|
e.lengthComputable && n(e.loaded / e.total);
|
|
@@ -1165,7 +1201,7 @@ var Qe = () => {
|
|
|
1165
1201
|
return;
|
|
1166
1202
|
}
|
|
1167
1203
|
r.addEventListener("abort", () => o.abort(), { once: !0 }), o.send(t);
|
|
1168
|
-
}),
|
|
1204
|
+
}), Wt = (e, t, n, r, i, a) => new Promise((o, s) => {
|
|
1169
1205
|
let c = new XMLHttpRequest();
|
|
1170
1206
|
if (c.open("POST", e), c.setRequestHeader("content-type", t), c.upload.onprogress = (e) => {
|
|
1171
1207
|
e.lengthComputable && r(e.loaded / e.total);
|
|
@@ -1183,7 +1219,7 @@ var Qe = () => {
|
|
|
1183
1219
|
return;
|
|
1184
1220
|
}
|
|
1185
1221
|
i.addEventListener("abort", () => c.abort(), { once: !0 }), c.send(n);
|
|
1186
|
-
}),
|
|
1222
|
+
}), Gt = (e, t, n, r, i) => new Promise((a, o) => {
|
|
1187
1223
|
let s = new XMLHttpRequest();
|
|
1188
1224
|
if (s.open("PUT", e), s.setRequestHeader("content-type", t), s.upload.onprogress = (e) => {
|
|
1189
1225
|
e.lengthComputable && r(e.loaded / e.total);
|
|
@@ -1194,7 +1230,7 @@ var Qe = () => {
|
|
|
1194
1230
|
return;
|
|
1195
1231
|
}
|
|
1196
1232
|
i.addEventListener("abort", () => s.abort(), { once: !0 }), s.send(n);
|
|
1197
|
-
}),
|
|
1233
|
+
}), Kt = (e, t, n, r, i) => new Promise((a, o) => {
|
|
1198
1234
|
let s = new XMLHttpRequest();
|
|
1199
1235
|
if (s.open("POST", e), s.setRequestHeader("content-type", t), s.upload.onprogress = (e) => {
|
|
1200
1236
|
e.lengthComputable && r(e.loaded / e.total);
|
|
@@ -1210,7 +1246,7 @@ var Qe = () => {
|
|
|
1210
1246
|
return;
|
|
1211
1247
|
}
|
|
1212
1248
|
i.addEventListener("abort", () => s.abort(), { once: !0 }), s.send(n);
|
|
1213
|
-
}),
|
|
1249
|
+
}), qt = (e, t = {}) => {
|
|
1214
1250
|
let { runtime: r, client: i, inspectBaseUrl: a, errorBus: l } = P(e), [u, d] = c(0), [f, p] = c("idle"), [m, h] = c(void 0), g = s(null), _ = n(() => {
|
|
1215
1251
|
d(0), p("idle"), h(void 0);
|
|
1216
1252
|
}, []), v = n(() => {
|
|
@@ -1231,16 +1267,16 @@ var Qe = () => {
|
|
|
1231
1267
|
...e.width === void 0 ? {} : { width: e.width },
|
|
1232
1268
|
...e.height === void 0 ? {} : { height: e.height }
|
|
1233
1269
|
}), g = async () => {
|
|
1234
|
-
let s = n.mintTag ?? t.mintTag ??
|
|
1270
|
+
let s = n.mintTag ?? t.mintTag ?? Ft, l = H(i, s), u = await r.runPromise(l({
|
|
1235
1271
|
contentType: c,
|
|
1236
1272
|
...m,
|
|
1237
1273
|
...d ? { key: d } : {}
|
|
1238
|
-
})), f = await
|
|
1274
|
+
})), f = await Kt(y(u.uploadUrl), c, e, o, a);
|
|
1239
1275
|
return h(f);
|
|
1240
1276
|
}, _ = async () => {
|
|
1241
|
-
let s = n.presignMintTag ?? t.presignMintTag ??
|
|
1277
|
+
let s = n.presignMintTag ?? t.presignMintTag ?? It, l = n.finalizeTag ?? t.finalizeTag ?? Lt, u;
|
|
1242
1278
|
try {
|
|
1243
|
-
let e =
|
|
1279
|
+
let e = H(i, s);
|
|
1244
1280
|
u = await r.runPromise(e({
|
|
1245
1281
|
contentType: c,
|
|
1246
1282
|
...m
|
|
@@ -1248,11 +1284,11 @@ var Qe = () => {
|
|
|
1248
1284
|
} catch {
|
|
1249
1285
|
return null;
|
|
1250
1286
|
}
|
|
1251
|
-
await
|
|
1252
|
-
let d =
|
|
1287
|
+
await Gt(u.uploadUrl, c, e, o, a);
|
|
1288
|
+
let d = H(i, l), f = await r.runPromise(d({ finalizeToken: u.finalizeToken }));
|
|
1253
1289
|
return h(f);
|
|
1254
1290
|
}, v = async () => {
|
|
1255
|
-
let s = n.beginResumableTag ?? t.beginResumableTag ??
|
|
1291
|
+
let s = n.beginResumableTag ?? t.beginResumableTag ?? Rt, l = H(i, s), u = e.size, d = n.chunkSize ?? t.chunkSize, f = await r.runPromise(l({
|
|
1256
1292
|
contentType: c,
|
|
1257
1293
|
size: u,
|
|
1258
1294
|
...m,
|
|
@@ -1263,7 +1299,7 @@ var Qe = () => {
|
|
|
1263
1299
|
for (;;) {
|
|
1264
1300
|
if (a.aborted) throw new DOMException("upload aborted", "AbortError");
|
|
1265
1301
|
try {
|
|
1266
|
-
let e = await
|
|
1302
|
+
let e = await Wt(`${p}?${`token=${encodeURIComponent(f.resumableToken)}&index=${t}${s ? "&final=1" : ""}`}`, c, i, (e) => o((b + e * l) / u), a, s);
|
|
1267
1303
|
s && (x = e);
|
|
1268
1304
|
break;
|
|
1269
1305
|
} catch (e) {
|
|
@@ -1275,9 +1311,9 @@ var Qe = () => {
|
|
|
1275
1311
|
if (!x) throw Error("resumable upload produced no final reply");
|
|
1276
1312
|
return h(x);
|
|
1277
1313
|
}, b = async () => {
|
|
1278
|
-
let s = n.multipartBeginTag ?? t.multipartBeginTag ??
|
|
1314
|
+
let s = n.multipartBeginTag ?? t.multipartBeginTag ?? zt, u = n.multipartSignTag ?? t.multipartSignTag ?? Bt, d = n.multipartCompleteTag ?? t.multipartCompleteTag ?? Vt, f = n.multipartAbortTag ?? t.multipartAbortTag ?? Ht, p = e.size, h = n.chunkSize ?? t.chunkSize, g;
|
|
1279
1315
|
try {
|
|
1280
|
-
let e =
|
|
1316
|
+
let e = H(i, s);
|
|
1281
1317
|
g = await r.runPromise(e({
|
|
1282
1318
|
contentType: c,
|
|
1283
1319
|
size: p,
|
|
@@ -1287,7 +1323,7 @@ var Qe = () => {
|
|
|
1287
1323
|
} catch {
|
|
1288
1324
|
return null;
|
|
1289
1325
|
}
|
|
1290
|
-
let _ =
|
|
1326
|
+
let _ = H(i, u), v = H(i, d), b = H(i, f), x = Math.max(1, g.partSize), S = Math.max(1, Math.ceil(p / x)), C = Math.max(0, n.retries ?? t.retries ?? 1), w = [], T = 0;
|
|
1291
1327
|
try {
|
|
1292
1328
|
for (let t = 0; t < S; t++) {
|
|
1293
1329
|
let n = t * x, i = Math.min(p, n + x), s = e.slice(n, i), c = t + 1, l = i - n, u = 0;
|
|
@@ -1297,7 +1333,7 @@ var Qe = () => {
|
|
|
1297
1333
|
let { url: e } = await r.runPromise(_({
|
|
1298
1334
|
multipartToken: g.multipartToken,
|
|
1299
1335
|
partNumber: c
|
|
1300
|
-
})), t = await
|
|
1336
|
+
})), t = await Ut(e, s, (e) => o((T + e * l) / p), a);
|
|
1301
1337
|
w.push({
|
|
1302
1338
|
partNumber: c,
|
|
1303
1339
|
etag: t
|
|
@@ -1371,7 +1407,7 @@ var Qe = () => {
|
|
|
1371
1407
|
} catch (e) {
|
|
1372
1408
|
throw p("error"), h(e), e instanceof DOMException && e.name === "AbortError" || l.emit({
|
|
1373
1409
|
source: "action",
|
|
1374
|
-
tag: n.mintTag ?? t.mintTag ??
|
|
1410
|
+
tag: n.mintTag ?? t.mintTag ?? Ft,
|
|
1375
1411
|
error: e
|
|
1376
1412
|
}), e;
|
|
1377
1413
|
}
|
|
@@ -1397,7 +1433,7 @@ var Qe = () => {
|
|
|
1397
1433
|
} catch (e) {
|
|
1398
1434
|
throw r.abort(), p("error"), h(e), e instanceof DOMException && e.name === "AbortError" || l.emit({
|
|
1399
1435
|
source: "action",
|
|
1400
|
-
tag: n.mintTag ?? t.mintTag ??
|
|
1436
|
+
tag: n.mintTag ?? t.mintTag ?? Ft,
|
|
1401
1437
|
error: e
|
|
1402
1438
|
}), e;
|
|
1403
1439
|
}
|
|
@@ -1442,8 +1478,8 @@ var Qe = () => {
|
|
|
1442
1478
|
w,
|
|
1443
1479
|
T
|
|
1444
1480
|
]);
|
|
1445
|
-
},
|
|
1446
|
-
let t =
|
|
1481
|
+
}, X = async (e) => {
|
|
1482
|
+
let t = H(e.client, e.tag), n = f.currentSpan.pipe(f.tap((t) => f.sync(() => {
|
|
1447
1483
|
T({
|
|
1448
1484
|
traceId: t.traceId,
|
|
1449
1485
|
spanId: t.spanId,
|
|
@@ -1455,7 +1491,7 @@ var Qe = () => {
|
|
|
1455
1491
|
"rpc.tag": e.tag
|
|
1456
1492
|
} }));
|
|
1457
1493
|
return e.runtime.runPromise(n);
|
|
1458
|
-
},
|
|
1494
|
+
}, Jt = (e, t) => {
|
|
1459
1495
|
let { runtime: r, client: i, descriptors: a } = P(e);
|
|
1460
1496
|
if (process.env.NODE_ENV !== "production") {
|
|
1461
1497
|
let n = a[t]?.kind;
|
|
@@ -1464,7 +1500,7 @@ var Qe = () => {
|
|
|
1464
1500
|
let [s, l] = c(!1), [u, d] = c(void 0), [f, p] = c(void 0), m = n(async (n) => {
|
|
1465
1501
|
l(!0), d(void 0);
|
|
1466
1502
|
try {
|
|
1467
|
-
let a = await
|
|
1503
|
+
let a = await X({
|
|
1468
1504
|
apiName: e,
|
|
1469
1505
|
runtime: r,
|
|
1470
1506
|
client: i,
|
|
@@ -1484,7 +1520,7 @@ var Qe = () => {
|
|
|
1484
1520
|
i,
|
|
1485
1521
|
t
|
|
1486
1522
|
]), h = n(async (t) => {
|
|
1487
|
-
await
|
|
1523
|
+
await X({
|
|
1488
1524
|
apiName: e,
|
|
1489
1525
|
runtime: r,
|
|
1490
1526
|
client: i,
|
|
@@ -1497,7 +1533,7 @@ var Qe = () => {
|
|
|
1497
1533
|
r,
|
|
1498
1534
|
i
|
|
1499
1535
|
]), g = n(async (t) => {
|
|
1500
|
-
await
|
|
1536
|
+
await X({
|
|
1501
1537
|
apiName: e,
|
|
1502
1538
|
runtime: r,
|
|
1503
1539
|
client: i,
|
|
@@ -1509,7 +1545,7 @@ var Qe = () => {
|
|
|
1509
1545
|
e,
|
|
1510
1546
|
r,
|
|
1511
1547
|
i
|
|
1512
|
-
]), _ = n(async (t, n, a) =>
|
|
1548
|
+
]), _ = n(async (t, n, a) => X({
|
|
1513
1549
|
apiName: e,
|
|
1514
1550
|
runtime: r,
|
|
1515
1551
|
client: i,
|
|
@@ -1524,7 +1560,7 @@ var Qe = () => {
|
|
|
1524
1560
|
e,
|
|
1525
1561
|
r,
|
|
1526
1562
|
i
|
|
1527
|
-
]), v = n(async (t, n, a, o) =>
|
|
1563
|
+
]), v = n(async (t, n, a, o) => X({
|
|
1528
1564
|
apiName: e,
|
|
1529
1565
|
runtime: r,
|
|
1530
1566
|
client: i,
|
|
@@ -1560,11 +1596,11 @@ var Qe = () => {
|
|
|
1560
1596
|
u,
|
|
1561
1597
|
f
|
|
1562
1598
|
]);
|
|
1563
|
-
},
|
|
1599
|
+
}, Yt = (e) => {
|
|
1564
1600
|
let { runtime: t, client: r } = P(e), [i, a] = c(!1), [s, l] = c(void 0), [u, d] = c(void 0), f = n(async (n, i, o) => {
|
|
1565
1601
|
a(!0), l(void 0);
|
|
1566
1602
|
try {
|
|
1567
|
-
let a = await
|
|
1603
|
+
let a = await X({
|
|
1568
1604
|
apiName: e,
|
|
1569
1605
|
runtime: t,
|
|
1570
1606
|
client: r,
|
|
@@ -1598,11 +1634,11 @@ var Qe = () => {
|
|
|
1598
1634
|
s,
|
|
1599
1635
|
u
|
|
1600
1636
|
]);
|
|
1601
|
-
},
|
|
1637
|
+
}, Xt = (e) => {
|
|
1602
1638
|
let { runtime: t, client: r } = P(e), [i, a] = c(!1), [s, l] = c(void 0), [u, d] = c(void 0), f = n(async (n, i, o, s) => {
|
|
1603
1639
|
a(!0), l(void 0);
|
|
1604
1640
|
try {
|
|
1605
|
-
let a = await
|
|
1641
|
+
let a = await X({
|
|
1606
1642
|
apiName: e,
|
|
1607
1643
|
runtime: t,
|
|
1608
1644
|
client: r,
|
|
@@ -1637,8 +1673,8 @@ var Qe = () => {
|
|
|
1637
1673
|
s,
|
|
1638
1674
|
u
|
|
1639
1675
|
]);
|
|
1640
|
-
},
|
|
1641
|
-
let n =
|
|
1676
|
+
}, Zt = (e, t) => {
|
|
1677
|
+
let n = U(e, "__voltro.workflow.run", t ? { id: t } : {}, { skip: t === void 0 });
|
|
1642
1678
|
return n.loading || n.idle ? {
|
|
1643
1679
|
...n,
|
|
1644
1680
|
run: void 0
|
|
@@ -1646,8 +1682,8 @@ var Qe = () => {
|
|
|
1646
1682
|
...n,
|
|
1647
1683
|
run: n.data[0]
|
|
1648
1684
|
};
|
|
1649
|
-
},
|
|
1650
|
-
let r =
|
|
1685
|
+
}, Qt = (e, t = {}, n = {}) => {
|
|
1686
|
+
let r = U(e, "__voltro.workflow.runs", t, n);
|
|
1651
1687
|
return r.loading || r.idle ? {
|
|
1652
1688
|
...r,
|
|
1653
1689
|
runs: []
|
|
@@ -1655,8 +1691,8 @@ var Qe = () => {
|
|
|
1655
1691
|
...r,
|
|
1656
1692
|
runs: r.data
|
|
1657
1693
|
};
|
|
1658
|
-
},
|
|
1659
|
-
let n =
|
|
1694
|
+
}, $t = (e, t) => {
|
|
1695
|
+
let n = U(e, "__voltro.workflow.run.steps", t ? { runId: t } : {}, { skip: t === void 0 });
|
|
1660
1696
|
return n.loading || n.idle ? {
|
|
1661
1697
|
...n,
|
|
1662
1698
|
steps: []
|
|
@@ -1664,8 +1700,8 @@ var Qe = () => {
|
|
|
1664
1700
|
...n,
|
|
1665
1701
|
steps: n.data
|
|
1666
1702
|
};
|
|
1667
|
-
},
|
|
1668
|
-
let n =
|
|
1703
|
+
}, en = (e, t) => {
|
|
1704
|
+
let n = U(e, "__voltro.workflow.run.events", t ? { runId: t } : {}, { skip: t === void 0 });
|
|
1669
1705
|
return n.loading || n.idle ? {
|
|
1670
1706
|
...n,
|
|
1671
1707
|
events: []
|
|
@@ -1673,8 +1709,8 @@ var Qe = () => {
|
|
|
1673
1709
|
...n,
|
|
1674
1710
|
events: n.data
|
|
1675
1711
|
};
|
|
1676
|
-
},
|
|
1677
|
-
let r =
|
|
1712
|
+
}, tn = en, nn = (e, t = {}, n = {}) => {
|
|
1713
|
+
let r = U(e, "__voltro.workflow.domainEvents", t, n);
|
|
1678
1714
|
return r.loading || r.idle ? {
|
|
1679
1715
|
...r,
|
|
1680
1716
|
events: []
|
|
@@ -1682,8 +1718,8 @@ var Qe = () => {
|
|
|
1682
1718
|
...r,
|
|
1683
1719
|
events: r.data
|
|
1684
1720
|
};
|
|
1685
|
-
},
|
|
1686
|
-
let n =
|
|
1721
|
+
}, rn = (e, t) => {
|
|
1722
|
+
let n = U(e, "__voltro.workflow.event.deliveries", t ? { eventId: t } : {}, { skip: t === void 0 });
|
|
1687
1723
|
return n.loading || n.idle ? {
|
|
1688
1724
|
...n,
|
|
1689
1725
|
deliveries: []
|
|
@@ -1691,42 +1727,42 @@ var Qe = () => {
|
|
|
1691
1727
|
...n,
|
|
1692
1728
|
deliveries: n.data
|
|
1693
1729
|
};
|
|
1694
|
-
},
|
|
1730
|
+
}, an = (e, t) => {
|
|
1695
1731
|
let n = e.payload;
|
|
1696
1732
|
if (!n || typeof n != "object") return;
|
|
1697
1733
|
let r = n[t];
|
|
1698
1734
|
return typeof r == "string" ? r : void 0;
|
|
1699
|
-
},
|
|
1735
|
+
}, on = (e) => {
|
|
1700
1736
|
let t = e.payload;
|
|
1701
1737
|
if (!t || typeof t != "object") return;
|
|
1702
1738
|
let n = t.updateId;
|
|
1703
1739
|
return typeof n == "string" ? n : void 0;
|
|
1704
|
-
},
|
|
1740
|
+
}, sn = (e) => {
|
|
1705
1741
|
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
1706
1742
|
for (let r of e) if (r.eventType === "signal-received") {
|
|
1707
|
-
let e =
|
|
1743
|
+
let e = an(r, "signalName");
|
|
1708
1744
|
e && t.add(e);
|
|
1709
1745
|
} else if (r.eventType === "update-completed" || r.eventType === "update-failed") {
|
|
1710
|
-
let e =
|
|
1746
|
+
let e = on(r);
|
|
1711
1747
|
e && n.add(e);
|
|
1712
1748
|
}
|
|
1713
1749
|
for (let r = e.length - 1; r >= 0; --r) {
|
|
1714
1750
|
let i = e[r];
|
|
1715
1751
|
if (i.eventType === "signal-awaited") {
|
|
1716
|
-
let e =
|
|
1752
|
+
let e = an(i, "signalName");
|
|
1717
1753
|
if (e && !t.has(e)) return {
|
|
1718
1754
|
name: e,
|
|
1719
1755
|
kind: "signal"
|
|
1720
1756
|
};
|
|
1721
1757
|
} else if (i.eventType === "update-requested") {
|
|
1722
|
-
let e =
|
|
1758
|
+
let e = on(i), t = an(i, "updateName");
|
|
1723
1759
|
if (t && (!e || !n.has(e))) return {
|
|
1724
1760
|
name: t,
|
|
1725
1761
|
kind: "update"
|
|
1726
1762
|
};
|
|
1727
1763
|
}
|
|
1728
1764
|
}
|
|
1729
|
-
},
|
|
1765
|
+
}, cn = (e) => e.find((e) => e.status === "running") || (e.length > 0 ? e[e.length - 1] : void 0), ln = (e, t) => {
|
|
1730
1766
|
if (!e || e.status !== "failed") return;
|
|
1731
1767
|
let n = t.find((e) => e.status === "failed");
|
|
1732
1768
|
return {
|
|
@@ -1734,8 +1770,8 @@ var Qe = () => {
|
|
|
1734
1770
|
message: e.errorMessage,
|
|
1735
1771
|
step: n?.stepName
|
|
1736
1772
|
};
|
|
1737
|
-
},
|
|
1738
|
-
let r =
|
|
1773
|
+
}, un = (e, t) => {
|
|
1774
|
+
let r = Zt(e, t), i = $t(e, t), a = en(e, t), s = Jt(e, r.run?.tag ?? ""), c = r.run, l = i.steps, u = a.events, d = n(async () => {
|
|
1739
1775
|
if (!c) throw Error("useWorkflowRunState: no run loaded — cannot cancel");
|
|
1740
1776
|
await s.cancel({
|
|
1741
1777
|
workflowName: c.tag,
|
|
@@ -1759,9 +1795,9 @@ var Qe = () => {
|
|
|
1759
1795
|
status: c?.status,
|
|
1760
1796
|
steps: l,
|
|
1761
1797
|
events: u,
|
|
1762
|
-
currentStep:
|
|
1763
|
-
waitingFor: c?.status === "suspended" ?
|
|
1764
|
-
error:
|
|
1798
|
+
currentStep: cn(l),
|
|
1799
|
+
waitingFor: c?.status === "suspended" ? sn(u) : void 0,
|
|
1800
|
+
error: ln(c, l),
|
|
1765
1801
|
traceId: c?.traceId,
|
|
1766
1802
|
loading: r.data === void 0,
|
|
1767
1803
|
cancel: d,
|
|
@@ -1778,7 +1814,7 @@ var Qe = () => {
|
|
|
1778
1814
|
p,
|
|
1779
1815
|
m
|
|
1780
1816
|
]);
|
|
1781
|
-
},
|
|
1817
|
+
}, dn = (e, t) => {
|
|
1782
1818
|
let { runtime: r, client: i } = P(e), [a, o] = c([]), [l, d] = c("idle"), [p, h] = c(void 0), g = s(null), _ = n(() => {
|
|
1783
1819
|
let e = g.current;
|
|
1784
1820
|
e && (g.current = null, r.runFork(m.interrupt(e)), d((e) => e === "streaming" ? "idle" : e));
|
|
@@ -1790,7 +1826,7 @@ var Qe = () => {
|
|
|
1790
1826
|
start: n((e = {}) => {
|
|
1791
1827
|
let n = g.current;
|
|
1792
1828
|
n && r.runFork(m.interrupt(n)), o([]), h(void 0), d("streaming");
|
|
1793
|
-
let a =
|
|
1829
|
+
let a = H(i, t)(e), s = v.runForEach(a, (e) => f.sync(() => o((t) => [...t, e]))).pipe(f.matchCause({
|
|
1794
1830
|
onSuccess: () => {
|
|
1795
1831
|
d("done");
|
|
1796
1832
|
},
|
|
@@ -1806,7 +1842,7 @@ var Qe = () => {
|
|
|
1806
1842
|
]),
|
|
1807
1843
|
cancel: _
|
|
1808
1844
|
};
|
|
1809
|
-
},
|
|
1845
|
+
}, fn = (e, t, n, r) => {
|
|
1810
1846
|
let i = 0, a = !1, o = (e) => f.sync(() => {
|
|
1811
1847
|
e.seq <= i || (i = e.seq, n.onEvent(e.event), r.isTerminal(e.event) && (a = !0));
|
|
1812
1848
|
}), s = (e, t, a) => {
|
|
@@ -1829,15 +1865,15 @@ var Qe = () => {
|
|
|
1829
1865
|
}));
|
|
1830
1866
|
});
|
|
1831
1867
|
return c(0);
|
|
1832
|
-
},
|
|
1868
|
+
}, pn = (e) => {
|
|
1833
1869
|
let t = e?._tag;
|
|
1834
1870
|
return t === "done" || t === "error";
|
|
1835
|
-
},
|
|
1871
|
+
}, mn = (e, t, r = {}) => {
|
|
1836
1872
|
let { runtime: i, client: a } = P(e), [o, l] = c([]), [u, d] = c("idle"), [f, p] = c(0), [h, g] = c(void 0), _ = s(null), v = {
|
|
1837
1873
|
maxReconnects: r.maxReconnects ?? 6,
|
|
1838
1874
|
backoffMs: r.backoffMs ?? 400,
|
|
1839
1875
|
maxBackoffMs: r.maxBackoffMs ?? 8e3,
|
|
1840
|
-
isTerminal: r.isTerminal ??
|
|
1876
|
+
isTerminal: r.isTerminal ?? pn
|
|
1841
1877
|
}, y = n(() => {
|
|
1842
1878
|
let e = _.current;
|
|
1843
1879
|
e && (_.current = null, i.runFork(m.interrupt(e)), d((e) => e === "streaming" || e === "reconnecting" ? "idle" : e));
|
|
@@ -1850,13 +1886,13 @@ var Qe = () => {
|
|
|
1850
1886
|
start: n((e = {}) => {
|
|
1851
1887
|
let n = _.current;
|
|
1852
1888
|
n && i.runFork(m.interrupt(n)), l([]), g(void 0), p(0), d("streaming");
|
|
1853
|
-
let r =
|
|
1889
|
+
let r = H(a, t), o = {
|
|
1854
1890
|
onEvent: (e) => l((t) => [...t, e]),
|
|
1855
1891
|
onStatus: d,
|
|
1856
1892
|
onReconnect: () => p((e) => e + 1),
|
|
1857
1893
|
onError: g
|
|
1858
1894
|
};
|
|
1859
|
-
_.current = i.runFork(
|
|
1895
|
+
_.current = i.runFork(fn(r, e, o, v));
|
|
1860
1896
|
}, [
|
|
1861
1897
|
i,
|
|
1862
1898
|
a,
|
|
@@ -1868,13 +1904,13 @@ var Qe = () => {
|
|
|
1868
1904
|
]),
|
|
1869
1905
|
cancel: y
|
|
1870
1906
|
};
|
|
1871
|
-
},
|
|
1907
|
+
}, hn = (e, t) => e.order - t.order || (e.stepOrder ?? 0) - (t.stepOrder ?? 0), gn = (e) => {
|
|
1872
1908
|
for (let t = e.length - 1; t >= 0; --t) {
|
|
1873
1909
|
let n = e[t];
|
|
1874
1910
|
if (n.role === "user" && n.content) return n.content;
|
|
1875
1911
|
}
|
|
1876
|
-
},
|
|
1877
|
-
let { threadId: i } = r, a =
|
|
1912
|
+
}, _n = (e, t, r) => {
|
|
1913
|
+
let { threadId: i } = r, a = U(e, `${t}.messages`, { threadId: i }), s = Y(e, `${t}.send`), c = o(() => [...a.data ?? []].sort(hn), [a.data]), l = n((e, t = {}) => s.run({
|
|
1878
1914
|
threadId: i,
|
|
1879
1915
|
order: a.data?.length ?? 0,
|
|
1880
1916
|
prompt: e,
|
|
@@ -1884,7 +1920,7 @@ var Qe = () => {
|
|
|
1884
1920
|
i,
|
|
1885
1921
|
a.data
|
|
1886
1922
|
]), u = n(() => {
|
|
1887
|
-
let e =
|
|
1923
|
+
let e = gn(c);
|
|
1888
1924
|
return e === void 0 ? void 0 : l(e);
|
|
1889
1925
|
}, [c, l]);
|
|
1890
1926
|
return o(() => ({
|
|
@@ -1904,8 +1940,8 @@ var Qe = () => {
|
|
|
1904
1940
|
l,
|
|
1905
1941
|
u
|
|
1906
1942
|
]);
|
|
1907
|
-
},
|
|
1908
|
-
let { events: r, status: i, error: l, start: u, cancel: d } =
|
|
1943
|
+
}, vn = (e, t) => {
|
|
1944
|
+
let { events: r, status: i, error: l, start: u, cancel: d } = dn(e, t), [f, p] = c([]), m = s(null), h = o(() => r.filter((e) => e._tag === "token").map((e) => e.text ?? "").join(""), [r]);
|
|
1909
1945
|
return a(() => {
|
|
1910
1946
|
if (i !== "done" || m.current === null) return;
|
|
1911
1947
|
let e = m.current;
|
|
@@ -1931,8 +1967,8 @@ var Qe = () => {
|
|
|
1931
1967
|
}, [u]),
|
|
1932
1968
|
cancel: d
|
|
1933
1969
|
};
|
|
1934
|
-
},
|
|
1935
|
-
let r =
|
|
1970
|
+
}, yn = (e, t) => {
|
|
1971
|
+
let r = Y(e, t), [i, a] = c(void 0), s = n(async (e) => {
|
|
1936
1972
|
let t = await r.run({ question: e });
|
|
1937
1973
|
return a(t), t;
|
|
1938
1974
|
}, [r]), l = n(() => a(void 0), []);
|
|
@@ -1949,43 +1985,43 @@ var Qe = () => {
|
|
|
1949
1985
|
r.error,
|
|
1950
1986
|
l
|
|
1951
1987
|
]);
|
|
1952
|
-
},
|
|
1988
|
+
}, bn = (e) => {
|
|
1953
1989
|
let { cache: t, runtime: r } = P(e);
|
|
1954
1990
|
return n(() => {
|
|
1955
1991
|
t.refreshAll(r);
|
|
1956
1992
|
}, [t, r]);
|
|
1957
|
-
},
|
|
1958
|
-
for (let t of
|
|
1993
|
+
}, xn = /* @__PURE__ */ new Set(), Sn = (e) => {
|
|
1994
|
+
for (let t of xn) try {
|
|
1959
1995
|
t(e);
|
|
1960
1996
|
} catch {}
|
|
1961
|
-
},
|
|
1962
|
-
|
|
1963
|
-
}),
|
|
1964
|
-
|
|
1997
|
+
}, Cn = (e) => (xn.add(e), () => {
|
|
1998
|
+
xn.delete(e);
|
|
1999
|
+
}), wn = (e, t) => {
|
|
2000
|
+
Sn({
|
|
1965
2001
|
error: e,
|
|
1966
2002
|
source: "manual",
|
|
1967
2003
|
...t ? { context: t } : {}
|
|
1968
2004
|
});
|
|
1969
|
-
},
|
|
2005
|
+
}, Tn = (e, t) => {
|
|
1970
2006
|
let { errorBus: n } = P(e);
|
|
1971
2007
|
a(() => n.on(t), [n, t]);
|
|
1972
|
-
},
|
|
2008
|
+
}, En = "#/$defs/", Dn = (e) => e.replace(/[_-]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/\s+/g, " ").trim().replace(/^./, (e) => e.toUpperCase()), Z = (e, t) => {
|
|
1973
2009
|
let n = e;
|
|
1974
2010
|
for (let e = 0; e < 8; e += 1) {
|
|
1975
2011
|
let e = n.$ref;
|
|
1976
|
-
if (typeof e != "string" || !e.startsWith(
|
|
2012
|
+
if (typeof e != "string" || !e.startsWith(En)) return n;
|
|
1977
2013
|
let r = t[e.slice(8)];
|
|
1978
2014
|
if (!r || typeof r != "object") return n;
|
|
1979
2015
|
n = r;
|
|
1980
2016
|
}
|
|
1981
2017
|
return n;
|
|
1982
|
-
},
|
|
2018
|
+
}, On = (e) => {
|
|
1983
2019
|
if (!e || typeof e != "object") return !1;
|
|
1984
2020
|
let t = e;
|
|
1985
2021
|
if (t.type === "null" || t.const === null) return !0;
|
|
1986
2022
|
let n = t.enum;
|
|
1987
2023
|
return Array.isArray(n) && n.length === 1 && n[0] === null;
|
|
1988
|
-
},
|
|
2024
|
+
}, kn = (e, t) => {
|
|
1989
2025
|
let n = e.type;
|
|
1990
2026
|
if (Array.isArray(n) && n.includes("null")) {
|
|
1991
2027
|
let t = n.filter((e) => e !== "null");
|
|
@@ -2000,7 +2036,7 @@ var Qe = () => {
|
|
|
2000
2036
|
for (let n of ["anyOf", "oneOf"]) {
|
|
2001
2037
|
let r = e[n];
|
|
2002
2038
|
if (!Array.isArray(r)) continue;
|
|
2003
|
-
let i = r.filter((e) => !
|
|
2039
|
+
let i = r.filter((e) => !On(e));
|
|
2004
2040
|
if (i.length !== r.length) return i.length === 1 ? {
|
|
2005
2041
|
node: Z(i[0], t),
|
|
2006
2042
|
nullable: !0
|
|
@@ -2016,14 +2052,14 @@ var Qe = () => {
|
|
|
2016
2052
|
node: e,
|
|
2017
2053
|
nullable: !1
|
|
2018
2054
|
};
|
|
2019
|
-
},
|
|
2055
|
+
}, An = (e) => e.map((e) => ({
|
|
2020
2056
|
value: String(e),
|
|
2021
|
-
label:
|
|
2022
|
-
})),
|
|
2057
|
+
label: Dn(String(e))
|
|
2058
|
+
})), jn = (e) => {
|
|
2023
2059
|
let t = e.enum;
|
|
2024
2060
|
if (Array.isArray(t) && t.length > 0) return {
|
|
2025
2061
|
widget: "select",
|
|
2026
|
-
options:
|
|
2062
|
+
options: An(t)
|
|
2027
2063
|
};
|
|
2028
2064
|
let n = e.type, r = Array.isArray(n) ? n.find((e) => e !== "null") : n, i = e.format;
|
|
2029
2065
|
switch (r) {
|
|
@@ -2034,38 +2070,38 @@ var Qe = () => {
|
|
|
2034
2070
|
case "array": return { widget: "multi-select" };
|
|
2035
2071
|
default: return { widget: "custom" };
|
|
2036
2072
|
}
|
|
2037
|
-
},
|
|
2038
|
-
let { node: i, nullable: a } =
|
|
2073
|
+
}, Mn = (e, t, n) => Object.entries(e).map(([e, r]) => {
|
|
2074
|
+
let { node: i, nullable: a } = kn(Z(r, n), n), o = Z(i, n), { widget: s, options: c } = jn(o);
|
|
2039
2075
|
return {
|
|
2040
2076
|
name: e,
|
|
2041
|
-
label:
|
|
2077
|
+
label: Dn(e),
|
|
2042
2078
|
widget: s,
|
|
2043
2079
|
required: t.has(e),
|
|
2044
2080
|
nullable: a,
|
|
2045
2081
|
...c ? { options: c } : {},
|
|
2046
2082
|
jsonSchema: o
|
|
2047
2083
|
};
|
|
2048
|
-
}),
|
|
2084
|
+
}), Nn = (e) => {
|
|
2049
2085
|
try {
|
|
2050
2086
|
return h.make(e);
|
|
2051
2087
|
} catch {
|
|
2052
2088
|
return;
|
|
2053
2089
|
}
|
|
2054
2090
|
}, Q = (e) => {
|
|
2055
|
-
let t =
|
|
2091
|
+
let t = Nn(e);
|
|
2056
2092
|
if (t === void 0) return [];
|
|
2057
2093
|
let n = t.$defs ?? {}, r = Z(t, n), i = r.properties;
|
|
2058
|
-
return i ?
|
|
2059
|
-
},
|
|
2060
|
-
let t =
|
|
2094
|
+
return i ? Mn(i, new Set(Array.isArray(r.required) ? r.required : []), n) : [];
|
|
2095
|
+
}, Pn = (e) => {
|
|
2096
|
+
let t = Nn(e);
|
|
2061
2097
|
if (t === void 0) return [];
|
|
2062
2098
|
let n = t.$defs ?? {}, r = Z(t, n);
|
|
2063
2099
|
if (r.type !== "array") return [];
|
|
2064
2100
|
let i = r.items;
|
|
2065
2101
|
if (!i || typeof i != "object") return [];
|
|
2066
2102
|
let a = Z(i, n), o = a.properties;
|
|
2067
|
-
return o ?
|
|
2068
|
-
},
|
|
2103
|
+
return o ? Mn(o, new Set(Array.isArray(a.required) ? a.required : []), n) : [];
|
|
2104
|
+
}, Fn = (e, t) => {
|
|
2069
2105
|
let n = _.decodeUnknownEither(e, { errors: "all" })(t);
|
|
2070
2106
|
if (n._tag === "Right") return {
|
|
2071
2107
|
valid: !0,
|
|
@@ -2080,8 +2116,8 @@ var Qe = () => {
|
|
|
2080
2116
|
valid: !1,
|
|
2081
2117
|
errors: r
|
|
2082
2118
|
};
|
|
2083
|
-
},
|
|
2084
|
-
let i = P(e), a =
|
|
2119
|
+
}, In = (e, t, r) => {
|
|
2120
|
+
let i = P(e), a = J(e, t), l = r.schema ?? i.descriptors[t]?.input;
|
|
2085
2121
|
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.`);
|
|
2086
2122
|
let u = o(() => l ? Q(l) : [], [l]), d = s(r.defaults ?? {}), [f, p] = c(d.current), [m, h] = c({}), g = n((e, t) => {
|
|
2087
2123
|
p((n) => ({
|
|
@@ -2097,7 +2133,7 @@ var Qe = () => {
|
|
|
2097
2133
|
p(d.current), h({});
|
|
2098
2134
|
}, []), y = n(async () => {
|
|
2099
2135
|
if (l !== void 0) {
|
|
2100
|
-
let e =
|
|
2136
|
+
let e = Fn(l, f);
|
|
2101
2137
|
if (h(e.errors), !e.valid) return;
|
|
2102
2138
|
}
|
|
2103
2139
|
return a.mutate(f);
|
|
@@ -2110,7 +2146,7 @@ var Qe = () => {
|
|
|
2110
2146
|
fields: u,
|
|
2111
2147
|
values: f,
|
|
2112
2148
|
errors: m,
|
|
2113
|
-
isValid: o(() => l === void 0 ||
|
|
2149
|
+
isValid: o(() => l === void 0 || Fn(l, f).valid, [l, f]),
|
|
2114
2150
|
pending: a.pending,
|
|
2115
2151
|
submitError: a.error,
|
|
2116
2152
|
data: a.data,
|
|
@@ -2119,13 +2155,13 @@ var Qe = () => {
|
|
|
2119
2155
|
reset: v,
|
|
2120
2156
|
submit: y
|
|
2121
2157
|
};
|
|
2122
|
-
},
|
|
2158
|
+
}, Ln = (e, t, n) => e.map((e) => {
|
|
2123
2159
|
let r = String(e[n] ?? ""), i = e[t];
|
|
2124
2160
|
return {
|
|
2125
2161
|
value: r,
|
|
2126
2162
|
label: i == null ? r : String(i)
|
|
2127
2163
|
};
|
|
2128
|
-
}),
|
|
2164
|
+
}), Rn = (e, t, r = {}) => {
|
|
2129
2165
|
let i = r.debounceMs ?? 200, s = r.labelField ?? "name", l = r.valueField ?? "id", u = r.input ?? ((e) => ({ q: e })), [d, f] = c(r.initialTerm ?? ""), [p, m] = c(d);
|
|
2130
2166
|
a(() => {
|
|
2131
2167
|
if (d === p) return;
|
|
@@ -2136,7 +2172,7 @@ var Qe = () => {
|
|
|
2136
2172
|
p,
|
|
2137
2173
|
i
|
|
2138
2174
|
]);
|
|
2139
|
-
let h = r.skipUntilTerm === !0 && p.trim() === "", g =
|
|
2175
|
+
let h = r.skipUntilTerm === !0 && p.trim() === "", g = U(e, t, o(() => u(p), [u, p]), { skip: h }), _ = o(() => Ln(g.data ?? [], s, l), [
|
|
2140
2176
|
g.data,
|
|
2141
2177
|
s,
|
|
2142
2178
|
l
|
|
@@ -2147,13 +2183,13 @@ var Qe = () => {
|
|
|
2147
2183
|
term: d,
|
|
2148
2184
|
search: v
|
|
2149
2185
|
};
|
|
2150
|
-
},
|
|
2151
|
-
let i = P(e), [a, s] = c(r.pageSize), l =
|
|
2186
|
+
}, zn = (e, t) => e === t ? 0 : e == null ? 1 : t == null || e < t ? -1 : 1, Bn = (e, t, r = {}) => {
|
|
2187
|
+
let i = P(e), [a, s] = c(r.pageSize), l = U(e, t, o(() => a === void 0 ? r.input ?? {} : {
|
|
2152
2188
|
...r.input,
|
|
2153
2189
|
limit: a
|
|
2154
2190
|
}, [r.input, a])), u = i.descriptors[t]?.output, d = n(() => {
|
|
2155
2191
|
r.pageSize !== void 0 && s((e) => (e ?? r.pageSize) + r.pageSize);
|
|
2156
|
-
}, [r.pageSize]), f = o(() => r.columns ?? (u === void 0 ? [] :
|
|
2192
|
+
}, [r.pageSize]), f = o(() => r.columns ?? (u === void 0 ? [] : Pn(u)), [r.columns, u]), [p, m] = c(r.initialSort), h = n((e) => {
|
|
2157
2193
|
m((t) => t?.column === e ? {
|
|
2158
2194
|
column: e,
|
|
2159
2195
|
direction: t.direction === "asc" ? "desc" : "asc"
|
|
@@ -2168,7 +2204,7 @@ var Qe = () => {
|
|
|
2168
2204
|
let e = l.data ?? [];
|
|
2169
2205
|
if (p === void 0) return e;
|
|
2170
2206
|
let t = p.direction === "asc" ? 1 : -1;
|
|
2171
|
-
return [...e].sort((e, n) =>
|
|
2207
|
+
return [...e].sort((e, n) => zn(e[p.column], n[p.column]) * t);
|
|
2172
2208
|
}, [l.data, p]),
|
|
2173
2209
|
loading: l.data === void 0,
|
|
2174
2210
|
error: l.error,
|
|
@@ -2177,13 +2213,13 @@ var Qe = () => {
|
|
|
2177
2213
|
loadMore: d,
|
|
2178
2214
|
hasMore: a !== void 0 && (l.data?.length ?? 0) >= a
|
|
2179
2215
|
};
|
|
2180
|
-
},
|
|
2216
|
+
}, Vn = (e, t, n, r) => {
|
|
2181
2217
|
let i = e.replace(/\/$/, ""), a = new URLSearchParams({
|
|
2182
2218
|
table: t,
|
|
2183
2219
|
id: n
|
|
2184
2220
|
});
|
|
2185
2221
|
return r !== void 0 && a.set("column", r), `${i}/_voltro/inspect/provenance?${a.toString()}`;
|
|
2186
|
-
},
|
|
2222
|
+
}, Hn = Vn, Un = (e, t, n, r) => {
|
|
2187
2223
|
let { inspectBaseUrl: i } = P(e), [o, s] = c({
|
|
2188
2224
|
data: void 0,
|
|
2189
2225
|
loading: !0,
|
|
@@ -2196,7 +2232,7 @@ var Qe = () => {
|
|
|
2196
2232
|
loading: !0,
|
|
2197
2233
|
error: void 0
|
|
2198
2234
|
});
|
|
2199
|
-
let a =
|
|
2235
|
+
let a = Vn(i ?? "", t, n, r);
|
|
2200
2236
|
return fetch(a).then(async (e) => {
|
|
2201
2237
|
if (!e.ok) throw Error(`provenance fetch failed: HTTP ${e.status}`);
|
|
2202
2238
|
return await e.json();
|
|
@@ -2222,7 +2258,7 @@ var Qe = () => {
|
|
|
2222
2258
|
n,
|
|
2223
2259
|
r
|
|
2224
2260
|
]), o;
|
|
2225
|
-
},
|
|
2261
|
+
}, Wn = (e) => `${e.replace(/\/$/, "")}/_voltro/inspect/manifest`, Gn = (e) => {
|
|
2226
2262
|
let { inspectBaseUrl: t } = P(e), [n, r] = c({
|
|
2227
2263
|
manifest: void 0,
|
|
2228
2264
|
loading: !0,
|
|
@@ -2234,7 +2270,7 @@ var Qe = () => {
|
|
|
2234
2270
|
manifest: void 0,
|
|
2235
2271
|
loading: !0,
|
|
2236
2272
|
error: void 0
|
|
2237
|
-
}), fetch(
|
|
2273
|
+
}), fetch(Wn(t ?? "")).then(async (e) => {
|
|
2238
2274
|
if (!e.ok) throw Error(`manifest fetch failed: HTTP ${e.status}`);
|
|
2239
2275
|
return await e.json();
|
|
2240
2276
|
}).then((t) => {
|
|
@@ -2253,8 +2289,8 @@ var Qe = () => {
|
|
|
2253
2289
|
e = !0;
|
|
2254
2290
|
};
|
|
2255
2291
|
}, [e, t]), n;
|
|
2256
|
-
},
|
|
2257
|
-
let n = e.procedures.find((e) => e.kind === "query" &&
|
|
2292
|
+
}, Kn = (e, t) => Array.isArray(e) ? e.includes(t) : e === t, qn = (e, t, n) => e.targets?.some((e) => e.table === t && e.op === n) ?? !1, Jn = (e) => e.tables.filter((e) => !e.framework).map((t) => {
|
|
2293
|
+
let n = e.procedures.find((e) => e.kind === "query" && Kn(e.source, t.name)), r = e.procedures.find((e) => e.kind === "mutation" && qn(e, t.name, "insert")), i = e.procedures.find((e) => e.kind === "mutation" && qn(e, t.name, "update")), a = e.procedures.find((e) => e.kind === "mutation" && qn(e, t.name, "delete"));
|
|
2258
2294
|
return {
|
|
2259
2295
|
table: t.name,
|
|
2260
2296
|
columns: t.columns,
|
|
@@ -2267,7 +2303,7 @@ var Qe = () => {
|
|
|
2267
2303
|
writeScope: `${t.name}:write`,
|
|
2268
2304
|
deleteScope: `${t.name}:delete`
|
|
2269
2305
|
};
|
|
2270
|
-
}),
|
|
2306
|
+
}), Yn = (e) => {
|
|
2271
2307
|
let [t, r] = c([]), [i, a] = c([]), s = n((e) => {
|
|
2272
2308
|
r((t) => [...t, e]), a([]);
|
|
2273
2309
|
}, []), l = n(async () => {
|
|
@@ -2295,8 +2331,8 @@ var Qe = () => {
|
|
|
2295
2331
|
l,
|
|
2296
2332
|
u
|
|
2297
2333
|
]);
|
|
2298
|
-
},
|
|
2299
|
-
let r = t?.limit, { data: i } =
|
|
2334
|
+
}, Xn = "__voltro.undo.log", Zn = "__voltro.undo.apply", Qn = "__voltro.undo.redo", $n = (e, t) => {
|
|
2335
|
+
let r = t?.limit, { data: i } = U(e, Xn, r === void 0 ? {} : { limit: r }), a = J(e, Zn), o = J(e, Qn), s = i ?? [], c = s.find((e) => !e.undone && !e.crossesAction), l = s.find((e) => e.undone), u = n(async (e) => {
|
|
2300
2336
|
await a.mutate({ invocationId: e });
|
|
2301
2337
|
}, [a]), d = n(async (e) => {
|
|
2302
2338
|
await o.mutate({ invocationId: e });
|
|
@@ -2315,13 +2351,13 @@ var Qe = () => {
|
|
|
2315
2351
|
undoLast: f,
|
|
2316
2352
|
redoLast: p
|
|
2317
2353
|
};
|
|
2318
|
-
},
|
|
2354
|
+
}, er = (e, t) => ({
|
|
2319
2355
|
name: e,
|
|
2320
2356
|
map: t
|
|
2321
|
-
}), $ = (e, t) => e === void 0 ? null : typeof e == "string" ? { event: e } : e(t),
|
|
2357
|
+
}), $ = (e, t) => e === void 0 ? null : typeof e == "string" ? { event: e } : e(t), tr = /* @__PURE__ */ new Set(["onMount", "onUnmount"]), nr = (e, t, n) => {
|
|
2322
2358
|
let r = { ...t };
|
|
2323
2359
|
for (let [i, a] of Object.entries(e.map)) {
|
|
2324
|
-
if (
|
|
2360
|
+
if (tr.has(i) || a === void 0) continue;
|
|
2325
2361
|
let e = t[i];
|
|
2326
2362
|
r[i] = (...r) => {
|
|
2327
2363
|
let i = $(a, t);
|
|
@@ -2329,7 +2365,7 @@ var Qe = () => {
|
|
|
2329
2365
|
};
|
|
2330
2366
|
}
|
|
2331
2367
|
return r;
|
|
2332
|
-
},
|
|
2368
|
+
}, rr = (e, t, n) => {
|
|
2333
2369
|
let r = s({
|
|
2334
2370
|
spec: e,
|
|
2335
2371
|
props: t,
|
|
@@ -2345,45 +2381,45 @@ var Qe = () => {
|
|
|
2345
2381
|
let e = r.current, t = $(e.spec.map.onUnmount, e.props);
|
|
2346
2382
|
t !== null && e.sink(t);
|
|
2347
2383
|
};
|
|
2348
|
-
}, []), o(() =>
|
|
2384
|
+
}, []), o(() => nr(e, t, n), [
|
|
2349
2385
|
e,
|
|
2350
2386
|
t,
|
|
2351
2387
|
n
|
|
2352
2388
|
]);
|
|
2353
|
-
},
|
|
2389
|
+
}, ir = (e, t) => {
|
|
2354
2390
|
let n = P(e).descriptors[t]?.input;
|
|
2355
2391
|
return o(() => n === void 0 ? [] : Q(n), [n]);
|
|
2356
|
-
},
|
|
2392
|
+
}, ar = (e, t) => {
|
|
2357
2393
|
let n = P(e).descriptors[t]?.output;
|
|
2358
|
-
return o(() => n === void 0 ? [] :
|
|
2359
|
-
},
|
|
2394
|
+
return o(() => n === void 0 ? [] : Pn(n), [n]);
|
|
2395
|
+
}, or = (e, t) => {
|
|
2360
2396
|
if (e === t) return !0;
|
|
2361
2397
|
if (e.length !== t.length) return !1;
|
|
2362
2398
|
for (let n = 0; n < e.length; n += 1) if (!Object.is(e[n], t[n])) return !1;
|
|
2363
2399
|
return !0;
|
|
2364
|
-
},
|
|
2365
|
-
let n = s(null), r =
|
|
2366
|
-
return (n.current === null || !
|
|
2400
|
+
}, sr = (e) => Object.keys(e).sort().map((t) => e[t]), cr = (e, t) => {
|
|
2401
|
+
let n = s(null), r = sr(e);
|
|
2402
|
+
return (n.current === null || !or(n.current.key, r)) && (n.current = {
|
|
2367
2403
|
key: r,
|
|
2368
2404
|
value: t(e)
|
|
2369
2405
|
}), n.current.value;
|
|
2370
|
-
},
|
|
2371
|
-
function
|
|
2372
|
-
return t(
|
|
2406
|
+
}, lr = "admin:full", ur = (e, t) => e.includes("admin:full") ? !0 : (typeof t == "string" ? [t] : t).every((t) => e.includes(t)), dr = (e, t) => t.length === 0 || e.includes("admin:full") ? !0 : t.some((t) => e.includes(t)), fr = e({ scopes: [] });
|
|
2407
|
+
function pr(e) {
|
|
2408
|
+
return t(fr.Provider, { value: { scopes: e.scopes } }, e.children);
|
|
2373
2409
|
}
|
|
2374
|
-
var
|
|
2375
|
-
let i =
|
|
2410
|
+
var mr = () => r(fr), hr = (e) => ur(mr().scopes, e), gr = (e) => dr(mr().scopes, e), _r = (e, t, n, r = {}) => {
|
|
2411
|
+
let i = U(e, t, { ...n }, r);
|
|
2376
2412
|
return o(() => ({
|
|
2377
2413
|
allowed: i.data?.allowed === !0,
|
|
2378
2414
|
pending: i.data === void 0
|
|
2379
2415
|
}), [i.data]);
|
|
2380
|
-
},
|
|
2381
|
-
let i =
|
|
2416
|
+
}, vr = (e, t, n, r = {}) => {
|
|
2417
|
+
let i = U(e, t, { ...n }, r);
|
|
2382
2418
|
return o(() => ({
|
|
2383
2419
|
allowedIds: new Set(i.data?.allowedIds ?? []),
|
|
2384
2420
|
pending: i.data === void 0
|
|
2385
2421
|
}), [i.data]);
|
|
2386
|
-
},
|
|
2422
|
+
}, yr = (e) => {
|
|
2387
2423
|
switch (e) {
|
|
2388
2424
|
case "select":
|
|
2389
2425
|
case "radio":
|
|
@@ -2399,25 +2435,25 @@ var nr = () => r(er), rr = (e) => Qn(nr().scopes, e), ir = (e) => $n(nr().scopes
|
|
|
2399
2435
|
case "switch": return "boolean";
|
|
2400
2436
|
default: return null;
|
|
2401
2437
|
}
|
|
2402
|
-
},
|
|
2403
|
-
let t =
|
|
2438
|
+
}, br = (e) => Q(e).map((e) => {
|
|
2439
|
+
let t = yr(e.widget);
|
|
2404
2440
|
return t === null ? null : {
|
|
2405
2441
|
name: e.name,
|
|
2406
2442
|
label: e.label,
|
|
2407
2443
|
kind: t,
|
|
2408
2444
|
...e.options ? { options: e.options } : {}
|
|
2409
2445
|
};
|
|
2410
|
-
}).filter((e) => e !== null),
|
|
2446
|
+
}).filter((e) => e !== null), xr = (e) => {
|
|
2411
2447
|
let t = {};
|
|
2412
2448
|
for (let [n, r] of Object.entries(e)) r === void 0 || r === "" || Array.isArray(r) && r.length === 0 || (t[n] = r);
|
|
2413
2449
|
return t;
|
|
2414
|
-
},
|
|
2415
|
-
let i = P(e).descriptors[t]?.input, a = o(() => i === void 0 ? [] :
|
|
2416
|
-
l((n) =>
|
|
2450
|
+
}, Sr = (e, t, r = {}) => {
|
|
2451
|
+
let i = P(e).descriptors[t]?.input, a = o(() => i === void 0 ? [] : br(i), [i]), [s, l] = c(r.initial ?? {}), u = n((e, t) => {
|
|
2452
|
+
l((n) => xr({
|
|
2417
2453
|
...n,
|
|
2418
2454
|
[e]: t
|
|
2419
2455
|
}));
|
|
2420
|
-
}, []), d = n(() => l({}), []), f =
|
|
2456
|
+
}, []), d = n(() => l({}), []), f = U(e, t, o(() => xr(s), [s]));
|
|
2421
2457
|
return {
|
|
2422
2458
|
filters: a,
|
|
2423
2459
|
values: s,
|
|
@@ -2428,20 +2464,20 @@ var nr = () => r(er), rr = (e) => Qn(nr().scopes, e), ir = (e) => $n(nr().scopes
|
|
|
2428
2464
|
loading: f.data === void 0,
|
|
2429
2465
|
error: f.error
|
|
2430
2466
|
};
|
|
2431
|
-
},
|
|
2432
|
-
let r =
|
|
2467
|
+
}, Cr = (e, t, n = {}) => {
|
|
2468
|
+
let r = U(e, t, n), i = r.data;
|
|
2433
2469
|
return {
|
|
2434
2470
|
record: Array.isArray(i) ? i[0] : i,
|
|
2435
2471
|
loading: i === void 0,
|
|
2436
2472
|
error: r.error
|
|
2437
2473
|
};
|
|
2438
|
-
},
|
|
2474
|
+
}, wr = (e, t = 300) => {
|
|
2439
2475
|
let [n, r] = c(e);
|
|
2440
2476
|
return a(() => {
|
|
2441
2477
|
let n = setTimeout(() => r(e), t);
|
|
2442
2478
|
return () => clearTimeout(n);
|
|
2443
2479
|
}, [e, t]), n;
|
|
2444
|
-
},
|
|
2480
|
+
}, Tr = (e) => {
|
|
2445
2481
|
let { value: t, debouncedValue: n, data: r, interpret: i, skipEmpty: a = !0 } = e;
|
|
2446
2482
|
if (a && t.trim() === "") return {
|
|
2447
2483
|
status: "idle",
|
|
@@ -2459,19 +2495,19 @@ var nr = () => r(er), rr = (e) => Qn(nr().scopes, e), ir = (e) => $n(nr().scopes
|
|
|
2459
2495
|
valid: o.valid,
|
|
2460
2496
|
message: o.message
|
|
2461
2497
|
};
|
|
2462
|
-
},
|
|
2463
|
-
let { input: i, interpret: a, debounceMs: s = 300, skipEmpty: c = !0 } = r, l =
|
|
2464
|
-
return
|
|
2498
|
+
}, Er = (e, t, n, r) => {
|
|
2499
|
+
let { input: i, interpret: a, debounceMs: s = 300, skipEmpty: c = !0 } = r, l = wr(n, s), u = c && l.trim() === "", d = U(e, t, o(() => i ? i(l) : { value: l }, [i, l]), { skip: u });
|
|
2500
|
+
return Tr({
|
|
2465
2501
|
value: n,
|
|
2466
2502
|
debouncedValue: l,
|
|
2467
2503
|
data: u ? null : d.data,
|
|
2468
2504
|
interpret: a,
|
|
2469
2505
|
skipEmpty: c
|
|
2470
2506
|
});
|
|
2471
|
-
},
|
|
2507
|
+
}, Dr = (e, t) => ({
|
|
2472
2508
|
name: e,
|
|
2473
2509
|
payload: t
|
|
2474
|
-
}),
|
|
2510
|
+
}), Or = (e, t) => {
|
|
2475
2511
|
let n = _.decodeUnknownEither(e.payload, { errors: "all" })(t);
|
|
2476
2512
|
if (n._tag === "Right") return {
|
|
2477
2513
|
valid: !0,
|
|
@@ -2483,15 +2519,15 @@ var nr = () => r(er), rr = (e) => Qn(nr().scopes, e), ir = (e) => $n(nr().scopes
|
|
|
2483
2519
|
valid: !1,
|
|
2484
2520
|
errors: r
|
|
2485
2521
|
};
|
|
2486
|
-
},
|
|
2522
|
+
}, kr = (e) => {
|
|
2487
2523
|
let t = new Map(e.map((e) => [e.name, e]));
|
|
2488
2524
|
return {
|
|
2489
2525
|
names: [...t.keys()].sort(),
|
|
2490
2526
|
get: (e) => t.get(e),
|
|
2491
2527
|
events: e
|
|
2492
2528
|
};
|
|
2493
|
-
},
|
|
2494
|
-
let n =
|
|
2529
|
+
}, Ar = (e, t) => {
|
|
2530
|
+
let n = kr(e);
|
|
2495
2531
|
return {
|
|
2496
2532
|
track: (e, r) => {
|
|
2497
2533
|
let i = n.get(e);
|
|
@@ -2500,7 +2536,7 @@ var nr = () => r(er), rr = (e) => Qn(nr().scopes, e), ir = (e) => $n(nr().scopes
|
|
|
2500
2536
|
return;
|
|
2501
2537
|
}
|
|
2502
2538
|
if (process.env.NODE_ENV !== "production") {
|
|
2503
|
-
let t =
|
|
2539
|
+
let t = Or(i, r);
|
|
2504
2540
|
t.valid || console.error(`[@voltro/client] analytics.track('${e}'): payload failed its schema`, t.errors);
|
|
2505
2541
|
}
|
|
2506
2542
|
t({
|
|
@@ -2511,42 +2547,42 @@ var nr = () => r(er), rr = (e) => Qn(nr().scopes, e), ir = (e) => $n(nr().scopes
|
|
|
2511
2547
|
names: n.names,
|
|
2512
2548
|
catalog: n
|
|
2513
2549
|
};
|
|
2514
|
-
},
|
|
2515
|
-
let r =
|
|
2550
|
+
}, jr = (e, t) => {
|
|
2551
|
+
let r = Y(e, t);
|
|
2516
2552
|
return {
|
|
2517
2553
|
preview: n((e) => r.run(e), [r]),
|
|
2518
2554
|
diff: r.lastResult,
|
|
2519
2555
|
pending: r.pending,
|
|
2520
2556
|
error: r.error
|
|
2521
2557
|
};
|
|
2522
|
-
},
|
|
2558
|
+
}, Mr = (e, t, n, r) => [...e, {
|
|
2523
2559
|
id: t,
|
|
2524
2560
|
tag: n,
|
|
2525
2561
|
input: r,
|
|
2526
2562
|
status: "pending",
|
|
2527
2563
|
attempts: 0
|
|
2528
|
-
}],
|
|
2564
|
+
}], Nr = (e, t, n) => e.map((e) => e.id === t ? {
|
|
2529
2565
|
...e,
|
|
2530
2566
|
...n
|
|
2531
|
-
} : e),
|
|
2567
|
+
} : e), Pr = (e, t) => Nr(e, t, { status: "sent" }), Fr = (e, t, n) => e.map((e) => e.id === t ? {
|
|
2532
2568
|
...e,
|
|
2533
2569
|
status: "failed",
|
|
2534
2570
|
error: n,
|
|
2535
2571
|
attempts: e.attempts + 1
|
|
2536
|
-
} : e),
|
|
2572
|
+
} : e), Ir = (e, t, n) => Nr(e, t, {
|
|
2537
2573
|
status: "conflict",
|
|
2538
2574
|
error: n
|
|
2539
|
-
}),
|
|
2575
|
+
}), Lr = (e) => e.filter((e) => e.status !== "sent"), Rr = (e) => {
|
|
2540
2576
|
let t = [];
|
|
2541
2577
|
for (let n of e) {
|
|
2542
2578
|
if (n.status === "conflict") break;
|
|
2543
2579
|
(n.status === "pending" || n.status === "failed") && t.push(n);
|
|
2544
2580
|
}
|
|
2545
2581
|
return t;
|
|
2546
|
-
},
|
|
2582
|
+
}, zr = (e) => {
|
|
2547
2583
|
let t = e;
|
|
2548
2584
|
return t?.conflict === !0 || t?._tag === "UndoBoundaryError" && t?.boundary === "conflict";
|
|
2549
|
-
},
|
|
2585
|
+
}, Br = (e) => {
|
|
2550
2586
|
let [t, n] = c(e ?? (typeof navigator < "u" ? navigator.onLine : !0));
|
|
2551
2587
|
return a(() => {
|
|
2552
2588
|
if (e !== void 0) {
|
|
@@ -2559,21 +2595,21 @@ var nr = () => r(er), rr = (e) => Qn(nr().scopes, e), ir = (e) => $n(nr().scopes
|
|
|
2559
2595
|
window.removeEventListener("online", t), window.removeEventListener("offline", r);
|
|
2560
2596
|
};
|
|
2561
2597
|
}, [e]), t;
|
|
2562
|
-
},
|
|
2563
|
-
let { send: t, isConflict: r =
|
|
2598
|
+
}, Vr = (e) => {
|
|
2599
|
+
let { send: t, isConflict: r = zr, idFor: i } = e, [o, l] = c([]), u = Br(e.online), d = s(o);
|
|
2564
2600
|
d.current = o;
|
|
2565
2601
|
let f = s(0), p = n((e, t) => {
|
|
2566
2602
|
let n = i?.() ?? `obx_${f.current++}_${e}`;
|
|
2567
|
-
l((r) =>
|
|
2603
|
+
l((r) => Mr(r, n, e, t));
|
|
2568
2604
|
}, [i]), m = n(async () => {
|
|
2569
|
-
for (let e of
|
|
2570
|
-
await t(e), l((t) =>
|
|
2605
|
+
for (let e of Rr(d.current)) try {
|
|
2606
|
+
await t(e), l((t) => Pr(t, e.id));
|
|
2571
2607
|
} catch (t) {
|
|
2572
2608
|
if (r(t)) {
|
|
2573
|
-
l((n) =>
|
|
2609
|
+
l((n) => Ir(n, e.id, t));
|
|
2574
2610
|
break;
|
|
2575
2611
|
}
|
|
2576
|
-
l((n) =>
|
|
2612
|
+
l((n) => Fr(n, e.id, t));
|
|
2577
2613
|
}
|
|
2578
2614
|
}, [t, r]);
|
|
2579
2615
|
return a(() => {
|
|
@@ -2586,7 +2622,7 @@ var nr = () => r(er), rr = (e) => Qn(nr().scopes, e), ir = (e) => $n(nr().scopes
|
|
|
2586
2622
|
pending: o.filter((e) => e.status === "pending" || e.status === "failed").length,
|
|
2587
2623
|
conflicts: o.filter((e) => e.status === "conflict")
|
|
2588
2624
|
};
|
|
2589
|
-
},
|
|
2625
|
+
}, Hr = (e) => {
|
|
2590
2626
|
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);
|
|
2591
2627
|
return {
|
|
2592
2628
|
startIndex: l,
|
|
@@ -2596,8 +2632,8 @@ var nr = () => r(er), rr = (e) => Qn(nr().scopes, e), ir = (e) => $n(nr().scopes
|
|
|
2596
2632
|
topSpacer: l * r,
|
|
2597
2633
|
bottomSpacer: a === void 0 ? 0 : Math.max(0, (a - d) * r)
|
|
2598
2634
|
};
|
|
2599
|
-
},
|
|
2600
|
-
let { rowHeight: i, viewportHeight: a, overscan: s, total: l, input: u } = r, [d, f] = c(0), p = o(() =>
|
|
2635
|
+
}, Ur = (e, t, r) => {
|
|
2636
|
+
let { rowHeight: i, viewportHeight: a, overscan: s, total: l, input: u } = r, [d, f] = c(0), p = o(() => Hr({
|
|
2601
2637
|
scrollTop: d,
|
|
2602
2638
|
viewportHeight: a,
|
|
2603
2639
|
rowHeight: i,
|
|
@@ -2609,7 +2645,7 @@ var nr = () => r(er), rr = (e) => Qn(nr().scopes, e), ir = (e) => $n(nr().scopes
|
|
|
2609
2645
|
i,
|
|
2610
2646
|
s,
|
|
2611
2647
|
l
|
|
2612
|
-
]), m =
|
|
2648
|
+
]), m = U(e, t, o(() => ({
|
|
2613
2649
|
...u,
|
|
2614
2650
|
offset: p.offset,
|
|
2615
2651
|
limit: p.limit
|
|
@@ -2629,8 +2665,8 @@ var nr = () => r(er), rr = (e) => Qn(nr().scopes, e), ir = (e) => $n(nr().scopes
|
|
|
2629
2665
|
loading: m.data === void 0,
|
|
2630
2666
|
error: m.error
|
|
2631
2667
|
};
|
|
2632
|
-
},
|
|
2633
|
-
let { errorBus: t } = P(e), [r, i] = c(
|
|
2668
|
+
}, Wr = () => typeof navigator > "u" || navigator.onLine, Gr = (e) => {
|
|
2669
|
+
let { errorBus: t } = P(e), [r, i] = c(Wr), [o, l] = c(0), [u, d] = c(void 0), f = s(!0);
|
|
2634
2670
|
a(() => (f.current = !0, () => {
|
|
2635
2671
|
f.current = !1;
|
|
2636
2672
|
}), []), a(() => {
|
|
@@ -2656,7 +2692,7 @@ var nr = () => r(er), rr = (e) => Qn(nr().scopes, e), ir = (e) => $n(nr().scopes
|
|
|
2656
2692
|
lastFailureAt: u,
|
|
2657
2693
|
reportSuccess: p
|
|
2658
2694
|
};
|
|
2659
|
-
},
|
|
2695
|
+
}, Kr = "__voltro.connections.list", qr = "__voltro.connections.start", Jr = "__voltro.connections.submitToken", Yr = "__voltro.connections.disconnect", Xr = {
|
|
2660
2696
|
connectionId: "",
|
|
2661
2697
|
kind: "oauth2",
|
|
2662
2698
|
label: "",
|
|
@@ -2667,14 +2703,14 @@ var nr = () => r(er), rr = (e) => Qn(nr().scopes, e), ir = (e) => $n(nr().scopes
|
|
|
2667
2703
|
expiresAt: null,
|
|
2668
2704
|
lastError: null,
|
|
2669
2705
|
connectedAt: null
|
|
2670
|
-
},
|
|
2706
|
+
}, Zr = (e, t) => {
|
|
2671
2707
|
if (t === "redirect") {
|
|
2672
2708
|
globalThis.location.assign(e);
|
|
2673
2709
|
return;
|
|
2674
2710
|
}
|
|
2675
2711
|
globalThis.open(e, "voltro-connect", "width=620,height=760,menubar=no,toolbar=no") === null && globalThis.location.assign(e);
|
|
2676
|
-
},
|
|
2677
|
-
let { data: t } =
|
|
2712
|
+
}, Qr = (e) => {
|
|
2713
|
+
let { data: t } = U(e, Kr, {}), r = Y(e, qr), i = J(e, Jr), a = J(e, Yr), o = t ?? [], s = r.pending || i.pending || a.pending, c = n((e) => ({
|
|
2678
2714
|
...e,
|
|
2679
2715
|
connected: e.status === "connected",
|
|
2680
2716
|
needsAttention: e.status === "expired" || e.status === "revoked" || e.status === "error",
|
|
@@ -2682,7 +2718,7 @@ var nr = () => r(er), rr = (e) => Qn(nr().scopes, e), ir = (e) => $n(nr().scopes
|
|
|
2682
2718
|
connect: async (t) => {
|
|
2683
2719
|
if (e.kind !== "oauth2") throw Error(`connection "${e.connectionId}" is a personal-access-token connection — call submitToken(token), not connect().`);
|
|
2684
2720
|
let n = t?.redirectTo ?? `${globalThis.location.pathname}${globalThis.location.search}`;
|
|
2685
|
-
|
|
2721
|
+
Zr((await r.run({
|
|
2686
2722
|
connectionId: e.connectionId,
|
|
2687
2723
|
redirectTo: n
|
|
2688
2724
|
})).authorizeUrl, t?.mode);
|
|
@@ -2712,10 +2748,10 @@ var nr = () => r(er), rr = (e) => Qn(nr().scopes, e), ir = (e) => $n(nr().scopes
|
|
|
2712
2748
|
get: l,
|
|
2713
2749
|
pending: s
|
|
2714
2750
|
};
|
|
2715
|
-
},
|
|
2716
|
-
let n =
|
|
2751
|
+
}, $r = (e, t) => {
|
|
2752
|
+
let n = Qr(e), r = n.get(t);
|
|
2717
2753
|
return o(() => r === void 0 ? {
|
|
2718
|
-
...
|
|
2754
|
+
...Xr,
|
|
2719
2755
|
connectionId: t,
|
|
2720
2756
|
label: t,
|
|
2721
2757
|
connected: !1,
|
|
@@ -2740,6 +2776,6 @@ var nr = () => r(er), rr = (e) => Qn(nr().scopes, e), ir = (e) => $n(nr().scopes
|
|
|
2740
2776
|
n.loading,
|
|
2741
2777
|
n.pending
|
|
2742
2778
|
]);
|
|
2743
|
-
},
|
|
2779
|
+
}, ei = "framework-client";
|
|
2744
2780
|
//#endregion
|
|
2745
|
-
export {
|
|
2781
|
+
export { lr as ADMIN_SCOPE, ei as CLIENT_NAME, Kr as CONNECTIONS_LIST_TAG, Yr as CONNECTION_DISCONNECT_TAG, qr as CONNECTION_START_TAG, Jr as CONNECTION_SUBMIT_TOKEN_TAG, k as FrameworkRuntimesContext, _e as FrameworkRuntimesProvider, ue as LoadingSubscriptionCache, pr as PermissionProvider, de as RpcErrorBus, le as SubscriptionCache, Zn as UNDO_APPLY_TAG, Xn as UNDO_LOG_TAG, Qn as UNDO_REDO_TAG, he as _resetFrameworkRuntimesWarning, tt as applyPreloadSeeds, Ke as applyStoreSeeds, ur as canCall, dr as canCallAny, vt as clearMutations, Lr as clearSent, ke as clearStoreHistory, Hr as computeWindow, Ar as createAnalytics, Dr as defineEvent, Ve as defineStore, er as defineTracking, Be as definedStores, Jn as deriveEntityAdmins, Mr as enqueueEntry, kr as eventCatalog, br as filtersFromSchema, Et as freshIdempotencyKey, xt as getMutationNotifier, gt as getMutations, F as isUnresolvedApi, Ye as makePreloadSeedBag, Ue as makeStoreSeedBag, Wn as manifestUrl, Ir as markConflict, Fr as markFailed, Pr as markSent, Hn as provenanceUrl, Sn as publishClientError, T as publishClientTrace, nt as readPreloadedSnapshot, Rr as replayable, wn as reportClientError, rt as resetPreloadSeeds, He as resetStoreRegistryForTests, H as resolveByTag, $ as resolveTrackingEvent, fn as resumableConsumeProgram, Ln as rowsToOptions, lt as runSequence, Pn as schemaToColumns, Q as schemaToFields, et as seedPreloadedSubscription, Ge as seedStore, ct as sequence, bt as setMutationNotifier, Ze as setPreloadSeedResolver, We as setStoreSeedResolver, K as settleMutation, I as shallow, or as shallowArrayEqual, sr as sourceValues, A as ssrClientProxy, pe as ssrStubHandle, E as stableKey, G as startMutation, De as storeHistory, Cn as subscribeClientErrors, ee as subscribeClientTraces, _t as subscribeMutations, Oe as subscribeStoreHistory, Ae as travelToStoreState, Y as useAction, vn as useAgent, _n as useAgentChat, dn as useAgentStream, Er as useAsyncValidation, hr as useCan, gr as useCanAny, Gn as useCapabilityManifest, $r as useConnection, Gr as useConnectionStatus, Qr as useConnections, yn as useDataCopilot, Bn as useDataTable, wr as useDebounced, cr as useDerived, st as useEvent, In as useFormBinding, ir as useFormSkeleton, P as useFrameworkApi, ge as useFrameworkRuntimes, J as useMutation, Tn as useOnRpcError, Vr as useOutbox, mr as usePermissions, it as usePreloadedSubscription, jr as usePreview, Un as useProvenance, Rn as useQueryField, Sr as useQueryFilters, Cr as useRecord, bn as useRefreshSubscriptions, _r as useResourceCan, vr as useResourceCans, mn as useResumableAgentStream, ut as useSequence, U as useSubscription, ar as useTableSkeleton, rr as useTracking, Yn as useUndo, $n as useUndoLog, qt as useUpload, Ur as useWindowedSubscription, Jt as useWorkflow, nn as useWorkflowDomainEvents, rn as useWorkflowEventDeliveries, tn as useWorkflowEvents, Zt as useWorkflowRun, en as useWorkflowRunEvents, un as useWorkflowRunState, $t as useWorkflowRunSteps, Qt as useWorkflowRuns, Yt as useWorkflowSignal, Xt as useWorkflowUpdate, Or as validateEventPayload, Fn as validateFields, Tr as validationStatus, Dt as withIdempotencyKey, nr as wrapTrackedCallbacks };
|