@voltro/client 0.83.1 → 0.85.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 +1191 -0
- package/THIRD-PARTY-NOTICES.md +1 -57
- package/dist/authRefresh-DmfSoCca.js +360 -0
- package/dist/form.d.ts +8 -11
- package/dist/form.js +1 -1
- package/dist/formData-BfpBt7BQ.js +769 -0
- package/dist/index.d.ts +406 -282
- package/dist/index.js +1823 -1355
- package/dist/query.d.ts +25 -0
- package/dist/query.js +2 -0
- package/dist/queryOnce-D5Y4V1SB.js +55 -0
- package/dist/runRpc-Zfz3w709.js +1172 -0
- package/dist/runtime.d.ts +135 -16
- package/dist/runtime.js +48 -50
- package/package.json +8 -5
- package/dist/authRefresh-Cu2A-H5R.js +0 -1272
- package/dist/formData-dGz5aoUR.js +0 -649
package/THIRD-PARTY-NOTICES.md
CHANGED
|
@@ -5,66 +5,10 @@ property of its respective copyright holders and is used under the terms of
|
|
|
5
5
|
its license. This file is provided for attribution; it grants no rights in
|
|
6
6
|
@voltro/client itself, which is proprietary (see LICENSE).
|
|
7
7
|
|
|
8
|
-
Generated from the resolved runtime dependency closure (
|
|
8
|
+
Generated from the resolved runtime dependency closure (11 packages).
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
## @effect/experimental@0.61.1
|
|
13
|
-
|
|
14
|
-
License: MIT
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
MIT License
|
|
18
|
-
|
|
19
|
-
Copyright (c) 2023-present The Contributors
|
|
20
|
-
|
|
21
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
22
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
23
|
-
in the Software without restriction, including without limitation the rights
|
|
24
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
25
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
26
|
-
furnished to do so, subject to the following conditions:
|
|
27
|
-
|
|
28
|
-
The above copyright notice and this permission notice shall be included in all
|
|
29
|
-
copies or substantial portions of the Software.
|
|
30
|
-
|
|
31
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
32
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
33
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
34
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
35
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
36
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
37
|
-
SOFTWARE.
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## @effect/sql@0.52.1
|
|
41
|
-
|
|
42
|
-
License: MIT
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
MIT License
|
|
46
|
-
|
|
47
|
-
Copyright (c) 2023-present The Contributors
|
|
48
|
-
|
|
49
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
50
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
51
|
-
in the Software without restriction, including without limitation the rights
|
|
52
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
53
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
54
|
-
furnished to do so, subject to the following conditions:
|
|
55
|
-
|
|
56
|
-
The above copyright notice and this permission notice shall be included in all
|
|
57
|
-
copies or substantial portions of the Software.
|
|
58
|
-
|
|
59
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
60
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
61
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
62
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
63
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
64
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
65
|
-
SOFTWARE.
|
|
66
|
-
```
|
|
67
|
-
|
|
68
12
|
## @tanstack/devtools-event-client@0.4.4
|
|
69
13
|
|
|
70
14
|
License: MIT
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
import { S as e, a as t, c as n, h as r, i, n as a, s as o, u as s } from "./runRpc-Zfz3w709.js";
|
|
2
|
+
import { Context as c, Effect as l, Layer as u, ManagedRuntime as d, MutableList as f, Result as p, Scheduler as m, Schema as h, Stream as g } from "effect";
|
|
3
|
+
import * as _ from "effect/http/Headers";
|
|
4
|
+
import { RpcClient as v, RpcSerialization as y } from "effect/rpc";
|
|
5
|
+
import { compareSurfaces as b, groupShapeDigests as x } from "@voltro/protocol";
|
|
6
|
+
import * as S from "effect/socket/Socket";
|
|
7
|
+
//#region src/clientScheduler.ts
|
|
8
|
+
var C = {
|
|
9
|
+
channel: "timer",
|
|
10
|
+
yield: (e) => {
|
|
11
|
+
setTimeout(e, 0);
|
|
12
|
+
}
|
|
13
|
+
}, w = (e) => {
|
|
14
|
+
let t = f.make();
|
|
15
|
+
return e.port1.onmessage = () => {
|
|
16
|
+
let e = f.take(t);
|
|
17
|
+
e !== f.Empty && e();
|
|
18
|
+
}, e.port1.unref?.(), {
|
|
19
|
+
channel: "message-channel",
|
|
20
|
+
yield: (n) => {
|
|
21
|
+
f.append(t, n), e.port2.postMessage(null);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}, T = () => globalThis.window !== void 0 && typeof MessageChannel == "function" ? w(new MessageChannel()) : C, E = (e = T()) => {
|
|
25
|
+
let t = new m.MixedScheduler("async", (t) => {
|
|
26
|
+
let n = !0;
|
|
27
|
+
return e.yield(() => {
|
|
28
|
+
n && t();
|
|
29
|
+
}), () => {
|
|
30
|
+
n = !1;
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
return Object.assign(t, { yieldChannel: e.channel });
|
|
34
|
+
}, D = (e, t, n) => {
|
|
35
|
+
try {
|
|
36
|
+
let r = globalThis.location, i = typeof r == "object" && r ? r.href : void 0, a = new URL(e, i);
|
|
37
|
+
if (a.protocol === "wss:" ? a.protocol = "https:" : a.protocol === "ws:" && (a.protocol = "http:"), n !== void 0) return new URL(n, a).toString();
|
|
38
|
+
let o = `/ws/${t}`;
|
|
39
|
+
if (a.pathname === o) a.pathname = `/_voltro/api/${encodeURIComponent(t)}/_voltro/runtime-capabilities`;
|
|
40
|
+
else {
|
|
41
|
+
let e = a.pathname.lastIndexOf("/");
|
|
42
|
+
a.pathname = `${e <= 0 ? "" : a.pathname.slice(0, e)}/_voltro/runtime-capabilities`;
|
|
43
|
+
}
|
|
44
|
+
return a.search = "", a.hash = "", a.toString();
|
|
45
|
+
} catch {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
}, O = async (e, t, n = fetch, r = 1500, i) => {
|
|
49
|
+
let a = D(e, t, i);
|
|
50
|
+
if (a === void 0) return;
|
|
51
|
+
let o = new AbortController(), s = setTimeout(() => o.abort(), r);
|
|
52
|
+
try {
|
|
53
|
+
let e = await n(a, {
|
|
54
|
+
method: "GET",
|
|
55
|
+
headers: { accept: "application/json" },
|
|
56
|
+
cache: "no-store",
|
|
57
|
+
signal: o.signal
|
|
58
|
+
});
|
|
59
|
+
if (!e.ok) return;
|
|
60
|
+
let t = await e.json();
|
|
61
|
+
if (t.protocol !== 1 || typeof t.mutationReplay != "boolean") return;
|
|
62
|
+
let r = (e) => typeof e == "object" && e && !Array.isArray(e) && Object.values(e).every((e) => typeof e == "string") ? e : void 0, i = r(t.surface), s = r(t.serviceSurface);
|
|
63
|
+
return {
|
|
64
|
+
protocol: 1,
|
|
65
|
+
mutationReplay: t.mutationReplay,
|
|
66
|
+
...i === void 0 ? {} : { surface: i },
|
|
67
|
+
...s === void 0 ? {} : { serviceSurface: s }
|
|
68
|
+
};
|
|
69
|
+
} catch {
|
|
70
|
+
return;
|
|
71
|
+
} finally {
|
|
72
|
+
clearTimeout(s), o.abort();
|
|
73
|
+
}
|
|
74
|
+
}, k = class {
|
|
75
|
+
#e;
|
|
76
|
+
#t;
|
|
77
|
+
#n;
|
|
78
|
+
#r = /* @__PURE__ */ new Set();
|
|
79
|
+
getSnapshot = () => this.#n;
|
|
80
|
+
subscribe = (e) => (this.#r.add(e), () => {
|
|
81
|
+
this.#r.delete(e);
|
|
82
|
+
});
|
|
83
|
+
begin() {
|
|
84
|
+
let e = {};
|
|
85
|
+
return this.#e = e, this.#i(), {
|
|
86
|
+
open: () => {
|
|
87
|
+
if (this.#e === e) return this.#n === void 0 && (this.#t = new AbortController(), this.#n = Object.freeze({ signal: this.#t.signal }), this.#a()), this.#e === e ? this.#n : void 0;
|
|
88
|
+
},
|
|
89
|
+
close: () => {
|
|
90
|
+
this.#e === e && (this.#e = void 0, this.#i());
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
#i() {
|
|
95
|
+
let e = this.#t, t = this.#n !== void 0;
|
|
96
|
+
this.#t = void 0, this.#n = void 0, e?.abort(), t && this.#a();
|
|
97
|
+
}
|
|
98
|
+
#a() {
|
|
99
|
+
for (let e of this.#r) try {
|
|
100
|
+
e();
|
|
101
|
+
} catch {}
|
|
102
|
+
}
|
|
103
|
+
}, A = /* @__PURE__ */ new WeakMap(), j = (e, t) => {
|
|
104
|
+
A.set(e, t);
|
|
105
|
+
}, M = (e) => A.get(e), N = async (t, n, r, i) => {
|
|
106
|
+
if (r !== void 0) try {
|
|
107
|
+
let a = await r({
|
|
108
|
+
apiName: t,
|
|
109
|
+
descriptors: i
|
|
110
|
+
});
|
|
111
|
+
return e(t, "runtime.mirror", {
|
|
112
|
+
generation: n,
|
|
113
|
+
mirrored: a !== void 0
|
|
114
|
+
}), a;
|
|
115
|
+
} catch (r) {
|
|
116
|
+
e(t, "runtime.mirror", {
|
|
117
|
+
generation: n,
|
|
118
|
+
mirrored: !1,
|
|
119
|
+
errorName: r instanceof Error ? r.name : typeof r
|
|
120
|
+
});
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
}, P = (e, t = new k()) => {
|
|
124
|
+
let n;
|
|
125
|
+
return {
|
|
126
|
+
wrap: (e) => S.Socket.of({
|
|
127
|
+
...e,
|
|
128
|
+
reader: l.gen(function* () {
|
|
129
|
+
let r = t.begin();
|
|
130
|
+
yield* l.addFinalizer(() => l.sync(() => {
|
|
131
|
+
n === r && (n = void 0), r.close();
|
|
132
|
+
}));
|
|
133
|
+
let i = yield* e.reader;
|
|
134
|
+
return n = r, i;
|
|
135
|
+
})
|
|
136
|
+
}),
|
|
137
|
+
hooks: {
|
|
138
|
+
onConnect: l.sync(() => {
|
|
139
|
+
let t = n;
|
|
140
|
+
n = void 0, t?.open() !== void 0 && e();
|
|
141
|
+
}),
|
|
142
|
+
onDisconnect: l.void
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}, F = 3, I = (t, n, r) => {
|
|
146
|
+
let i;
|
|
147
|
+
try {
|
|
148
|
+
i = b(x(n), r);
|
|
149
|
+
} catch {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
let { differing: a, missingHere: o } = i;
|
|
153
|
+
if (a.length === 0 && o.length === 0) return;
|
|
154
|
+
e(t, "runtime.surface-mismatch", {
|
|
155
|
+
differing: a.length,
|
|
156
|
+
missingHere: o.length,
|
|
157
|
+
first: a[0] ?? o[0] ?? null
|
|
158
|
+
});
|
|
159
|
+
let s = [...a, ...o].slice(0, F), c = a.length + o.length - s.length;
|
|
160
|
+
console.warn(`[voltro] the api client this page loaded does not match what the '${t}' server binds: ${s.join(", ")}${c > 0 ? ` and ${c} more` : ""}. Responses for those procedures may decode against the wrong schema — a field the server sends and this client does not know is dropped silently. Reload; if it persists, stop the dev server, delete \`.framework/.vite\`, and start it again.`);
|
|
161
|
+
}, L = async (n) => {
|
|
162
|
+
let { name: i, wsUrl: f, group: b, headers: x, webSocketConstructor: C } = n, w = n.generation ?? 0;
|
|
163
|
+
e(i, "runtime.build-started", { generation: w });
|
|
164
|
+
let T = n.errorBus ?? new s(), D = n.recovery ?? t(T, i), A = o(D.options.retry, (t, n) => {
|
|
165
|
+
e(i, "socket.retry-scheduled", {
|
|
166
|
+
generation: w,
|
|
167
|
+
attempt: t,
|
|
168
|
+
delayMs: n,
|
|
169
|
+
owner: "socket"
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
O(f, i, fetch, 1500, D.options.capabilitiesUrl).then((t) => {
|
|
173
|
+
D.setMutationReplaySupported(t?.mutationReplay === !0, w), e(i, "runtime.capabilities", {
|
|
174
|
+
mutationReplay: t?.mutationReplay === !0,
|
|
175
|
+
discovered: t !== void 0
|
|
176
|
+
});
|
|
177
|
+
let r = n.surfaceAudience === "service" ? t?.serviceSurface : t?.surface;
|
|
178
|
+
r !== void 0 && I(i, b, r);
|
|
179
|
+
});
|
|
180
|
+
let M = n.descriptors ?? {}, F = await N(i, w, n.mirror, M), L = new r({
|
|
181
|
+
errorBus: T,
|
|
182
|
+
apiName: i,
|
|
183
|
+
...F === void 0 ? {} : { mirror: F }
|
|
184
|
+
}), R = new k(), z;
|
|
185
|
+
class B extends c.Service()(`@voltro/client/AppClient/${i}`) {}
|
|
186
|
+
let V = u.succeed(S.WebSocketConstructor, C), H = S.layerWebSocket(f).pipe(u.provide(V)), U = P(() => {
|
|
187
|
+
A.reset();
|
|
188
|
+
let t = 0;
|
|
189
|
+
z !== void 0 && (t = L.resumeTransportFailures(z)), e(i, "protocol.ready", {
|
|
190
|
+
generation: w,
|
|
191
|
+
resumed: t
|
|
192
|
+
}), D.protocolReady();
|
|
193
|
+
}, R), W = u.effect(S.Socket, l.map(S.Socket, U.wrap)).pipe(u.provide(H)), G = u.effect(v.Protocol, v.makeProtocolSocket({ retryPolicy: A.schedule })).pipe(u.provide(y.layerJson), u.provide(W), u.provide(u.succeed(v.ConnectionHooks, U.hooks))), K = typeof x == "function" ? await x() : x, q = u.effect(B, v.make(b)).pipe(u.provide(G)), J = K ? u.succeed(v.CurrentHeaders, _.fromInput(K)) : u.empty, Y = E(), X = d.make(u.merge(q, J).pipe(u.provideMerge(u.succeed(m.Scheduler, Y))));
|
|
194
|
+
z = X, j(z, R);
|
|
195
|
+
try {
|
|
196
|
+
let t = await X.runPromise(B);
|
|
197
|
+
e(i, "runtime.resolved", {
|
|
198
|
+
generation: w,
|
|
199
|
+
scheduler: Y.yieldChannel
|
|
200
|
+
});
|
|
201
|
+
let n = (F?.warmTags ?? []).filter((e) => {
|
|
202
|
+
let t = M[e]?.input;
|
|
203
|
+
return t !== void 0 && p.isSuccess(h.decodeUnknownResult(t)({}));
|
|
204
|
+
}).map((e) => [e, {}]);
|
|
205
|
+
for (let [e, r] of [...F?.warm ?? [], ...n]) {
|
|
206
|
+
let n = M[e]?.source;
|
|
207
|
+
L.subscribe([e, r], () => g.suspend(() => a(t, e)(r)), X, () => {}, n === void 0 ? {} : { source: n });
|
|
208
|
+
}
|
|
209
|
+
return {
|
|
210
|
+
runtime: X,
|
|
211
|
+
client: t,
|
|
212
|
+
cache: L,
|
|
213
|
+
errorBus: T,
|
|
214
|
+
recovery: D
|
|
215
|
+
};
|
|
216
|
+
} catch (t) {
|
|
217
|
+
throw e(i, "runtime.failed", {
|
|
218
|
+
generation: w,
|
|
219
|
+
errorName: t instanceof Error ? t.name : typeof t
|
|
220
|
+
}), X.dispose(), t;
|
|
221
|
+
}
|
|
222
|
+
}, R = (e, t, n) => ({
|
|
223
|
+
resolved: null,
|
|
224
|
+
retryToken: 0,
|
|
225
|
+
failureCount: 0,
|
|
226
|
+
generation: 0,
|
|
227
|
+
reconnectStatusDispose: null,
|
|
228
|
+
everOpened: !1,
|
|
229
|
+
wedgeStop: null,
|
|
230
|
+
subjectMayHaveChanged: !1,
|
|
231
|
+
errorBus: e,
|
|
232
|
+
recovery: t,
|
|
233
|
+
stopRecoveryError: e.on((e) => t.observeError(e)),
|
|
234
|
+
stopRecoverySuccess: e.onSuccess((e) => t.observeSuccess(e)),
|
|
235
|
+
ownsRecovery: n
|
|
236
|
+
}), z = (e) => {
|
|
237
|
+
e.wedgeStop !== null && (e.wedgeStop(), e.wedgeStop = null);
|
|
238
|
+
}, B = (e) => {
|
|
239
|
+
e.cache.destroy(e.runtime), e.runtime.dispose();
|
|
240
|
+
}, V = (t) => {
|
|
241
|
+
let r = t.apis, a = t.buildClient, o = t.onChange, c = t.stableWindowMs ?? 5e3, l = t.scheduler?.setTimeout ?? ((e, t) => setTimeout(e, t)), u = t.scheduler?.clearTimeout ?? ((e) => {
|
|
242
|
+
clearTimeout(e);
|
|
243
|
+
}), d = t.scheduler?.queueMicrotask ?? queueMicrotask, f = t.onReconnecting, p = t.wedgeBackstop, m = /* @__PURE__ */ new Map();
|
|
244
|
+
for (let e of r) {
|
|
245
|
+
let n = t.errorBusFor?.(e.name) ?? new s(), r = t.recoveryFor?.(e.name, e.recovery), a = r ?? new i(e.name, e.recovery);
|
|
246
|
+
m.set(e.name, R(n, a, r === void 0));
|
|
247
|
+
}
|
|
248
|
+
let h = !1, g = /* @__PURE__ */ new Set(), _ = (e, t) => {
|
|
249
|
+
let n = l(() => {
|
|
250
|
+
g.delete(n), e();
|
|
251
|
+
}, t);
|
|
252
|
+
return g.add(n), n;
|
|
253
|
+
}, v = () => {
|
|
254
|
+
if (h) return;
|
|
255
|
+
let e = /* @__PURE__ */ new Map();
|
|
256
|
+
for (let [t, n] of m) n.resolved && e.set(t, n.resolved);
|
|
257
|
+
o(e, r.every((t) => e.has(t.name)));
|
|
258
|
+
}, y = (e, t) => {
|
|
259
|
+
t.failureCount += 1, !t.reconnectStatusDispose && f && (t.reconnectStatusDispose = f(e.name)), p && t.everOpened && t.failureCount >= p.afterFailures && t.wedgeStop === null && (t.wedgeStop = p.arm(e.name));
|
|
260
|
+
}, b = (r) => {
|
|
261
|
+
if (h) return;
|
|
262
|
+
let i = m.get(r.name);
|
|
263
|
+
if (!i) return;
|
|
264
|
+
y(r, i);
|
|
265
|
+
let a = t.retryDelayMs?.(i.failureCount) ?? n(i.recovery.options.retry, i.failureCount);
|
|
266
|
+
e(r.name, "socket.retry-scheduled", {
|
|
267
|
+
generation: i.generation,
|
|
268
|
+
attempt: i.failureCount,
|
|
269
|
+
delayMs: a,
|
|
270
|
+
owner: "runtime-build"
|
|
271
|
+
});
|
|
272
|
+
let o = ++i.retryToken;
|
|
273
|
+
_(() => {
|
|
274
|
+
h || i.retryToken === o && (i.generation += 1, x(r));
|
|
275
|
+
}, a);
|
|
276
|
+
}, x = async (t) => {
|
|
277
|
+
if (h) return;
|
|
278
|
+
let n = m.get(t.name);
|
|
279
|
+
if (!n) return;
|
|
280
|
+
let r = n.generation, i = () => {
|
|
281
|
+
if (h || n.generation !== r) return;
|
|
282
|
+
n.everOpened = !0, z(n), n.reconnectStatusDispose &&= (n.reconnectStatusDispose(), null), n.retryToken++;
|
|
283
|
+
let e = n.failureCount;
|
|
284
|
+
_(() => {
|
|
285
|
+
h || n.failureCount === e && (n.failureCount = 0);
|
|
286
|
+
}, c);
|
|
287
|
+
}, o = (e) => {
|
|
288
|
+
h || n.generation !== r || (n.recovery.transportIssue(), y(t, n));
|
|
289
|
+
};
|
|
290
|
+
try {
|
|
291
|
+
let s = await a(t, r, i, o, n.errorBus, n.recovery);
|
|
292
|
+
if (h || n.generation !== r) {
|
|
293
|
+
B(s);
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
let c = n.resolved, l = n.subjectMayHaveChanged, u = c && !l ? s.cache.seedStaleFrom(c.cache) : 0;
|
|
297
|
+
n.subjectMayHaveChanged = !1, n.resolved = s, e(t.name, "runtime.swapped", {
|
|
298
|
+
generation: r,
|
|
299
|
+
replaced: c !== null,
|
|
300
|
+
seeded: u,
|
|
301
|
+
subjectMayHaveChanged: l
|
|
302
|
+
}), v(), c && B(c);
|
|
303
|
+
} catch {
|
|
304
|
+
if (h || n.generation !== r) return;
|
|
305
|
+
b(t);
|
|
306
|
+
}
|
|
307
|
+
}, S = (e) => {
|
|
308
|
+
if (!h) for (let t of r) {
|
|
309
|
+
let n = m.get(t.name);
|
|
310
|
+
n && (e && (n.subjectMayHaveChanged = !0), n.retryToken += 1, n.generation += 1, e && n.recovery.resetForSubjectChange(n.generation), n.failureCount = 0, z(n), x(t));
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
return r.length === 0 ? (o(/* @__PURE__ */ new Map(), !0), {
|
|
314
|
+
dispose: () => {
|
|
315
|
+
h = !0;
|
|
316
|
+
},
|
|
317
|
+
reconnect: () => {},
|
|
318
|
+
refreshAuth: () => {}
|
|
319
|
+
}) : (d(() => {
|
|
320
|
+
if (!h) for (let e of r) x(e);
|
|
321
|
+
}), {
|
|
322
|
+
dispose: () => {
|
|
323
|
+
if (!h) {
|
|
324
|
+
h = !0;
|
|
325
|
+
for (let e of g) u(e);
|
|
326
|
+
g.clear();
|
|
327
|
+
for (let [, e] of m) e.resolved && B(e.resolved), e.reconnectStatusDispose && e.reconnectStatusDispose(), z(e), e.stopRecoveryError(), e.stopRecoverySuccess(), e.ownsRecovery && e.recovery.dispose();
|
|
328
|
+
for (let t of r) e(t.name, "runtime.disposed");
|
|
329
|
+
m.clear();
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
reconnect: () => {
|
|
333
|
+
S(!0);
|
|
334
|
+
},
|
|
335
|
+
refreshAuth: () => {
|
|
336
|
+
S(!1);
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
}, H = 0, U = () => {
|
|
340
|
+
let e = typeof crypto < "u" ? crypto : void 0;
|
|
341
|
+
return e && typeof e.randomUUID == "function" ? e.randomUUID() : `idem_${Date.now().toString(36)}_${H += 1}`;
|
|
342
|
+
}, W = (e, t) => e.pipe(l.updateService(v.CurrentHeaders, (e) => _.set(e, "idempotency-key", t))), G = (e) => e?._tag === "Unauthenticated", K = (e, t, n = {}) => {
|
|
343
|
+
let r = n.cooldownMs ?? 15e3, i = n.maxConsecutive ?? 3, a = n.now ?? (() => Date.now()), o = -Infinity, s = 0, c = e.on((e) => {
|
|
344
|
+
if (!G(e.error) || s >= i) return;
|
|
345
|
+
let n = a();
|
|
346
|
+
n - o < r || (o = n, s += 1, t());
|
|
347
|
+
}), l = e.onSuccess(() => {
|
|
348
|
+
s = 0;
|
|
349
|
+
});
|
|
350
|
+
return {
|
|
351
|
+
dispose: () => {
|
|
352
|
+
c(), l();
|
|
353
|
+
},
|
|
354
|
+
noteSuccess: () => {
|
|
355
|
+
s = 0;
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
};
|
|
359
|
+
//#endregion
|
|
360
|
+
export { V as a, M as c, W as i, K as n, L as o, U as r, P as s, G as t };
|
package/dist/form.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { ParseResult } from 'effect';
|
|
2
1
|
import { Schema } from 'effect';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
|
-
* Walk a
|
|
4
|
+
* Walk a schema failure's issue tree into structured, PATH-PRESERVING issues.
|
|
6
5
|
* Every leaf keeps its full path (`address.city`, `entries.0.startsAt`) —
|
|
7
6
|
* nothing collapses to the top-level segment.
|
|
8
7
|
*/
|
|
9
|
-
export declare const decodeFieldIssues: (error:
|
|
8
|
+
export declare const decodeFieldIssues: (error: Schema.SchemaError) => ReadonlyArray<FieldIssue>;
|
|
10
9
|
|
|
11
10
|
/** The document's locale per the framework contract (`<html lang>`); `'en'`
|
|
12
11
|
* outside a browser. Primary subtag only (`de-AT` → `de`). */
|
|
@@ -115,7 +114,7 @@ export declare const formActionPath: (mutationTag: string) => string;
|
|
|
115
114
|
* the server rejects undeclared fields, and a hidden bookkeeping field must
|
|
116
115
|
* not turn every no-JS submit into a validation error.
|
|
117
116
|
*/
|
|
118
|
-
export declare const formDataToInput: (schema: Schema.
|
|
117
|
+
export declare const formDataToInput: (schema: Schema.Top, entries: Iterable<FormEntry>) => Record<string, unknown>;
|
|
119
118
|
|
|
120
119
|
/** One posted entry. File entries must be filtered out by the caller —
|
|
121
120
|
* uploads are a declared limit of the no-JS path. */
|
|
@@ -137,9 +136,7 @@ export declare const formField: (meta: {
|
|
|
137
136
|
* list, for a multi-reference feeding a target's `relations:`). */
|
|
138
137
|
readonly reference?: string;
|
|
139
138
|
}) => {
|
|
140
|
-
readonly
|
|
141
|
-
readonly "x-voltro": typeof meta;
|
|
142
|
-
};
|
|
139
|
+
readonly voltroField: typeof meta;
|
|
143
140
|
};
|
|
144
141
|
|
|
145
142
|
/**
|
|
@@ -198,7 +195,7 @@ export declare const resolveValidationMessage: (issue: Pick<FieldIssue, "id" | "
|
|
|
198
195
|
* Non-struct schemas (a scalar input) are returned untouched — there is no
|
|
199
196
|
* declared key set to restrict against.
|
|
200
197
|
*/
|
|
201
|
-
export declare const restrictToSchema: (schema: Schema.
|
|
198
|
+
export declare const restrictToSchema: (schema: Schema.Top, input: unknown) => {
|
|
202
199
|
readonly input: unknown;
|
|
203
200
|
readonly dropped: ReadonlyArray<string>;
|
|
204
201
|
};
|
|
@@ -209,14 +206,14 @@ export declare const restrictToSchema: (schema: Schema.Schema.Any, input: unknow
|
|
|
209
206
|
* its properties (same descriptor shape as `schemaToFields`, reused for
|
|
210
207
|
* `<DataTable>` cells). Returns `[]` if the output isn't an array of objects.
|
|
211
208
|
*/
|
|
212
|
-
export declare const schemaToColumns: (schema: Schema.
|
|
209
|
+
export declare const schemaToColumns: (schema: Schema.Top) => ReadonlyArray<FieldDescriptor>;
|
|
213
210
|
|
|
214
211
|
/**
|
|
215
212
|
* Derive the ordered field list for a `Schema.Struct` input. Returns `[]` for a
|
|
216
213
|
* schema with no object properties (a scalar, `Schema.Void`, or anything
|
|
217
214
|
* `JSONSchema.make` cannot represent).
|
|
218
215
|
*/
|
|
219
|
-
export declare const schemaToFields: (schema: Schema.
|
|
216
|
+
export declare const schemaToFields: (schema: Schema.Top) => ReadonlyArray<FieldDescriptor>;
|
|
220
217
|
|
|
221
218
|
/**
|
|
222
219
|
* Validate `values` against an input `schema`. Uses the same
|
|
@@ -225,7 +222,7 @@ export declare const schemaToFields: (schema: Schema.Schema.Any) => ReadonlyArra
|
|
|
225
222
|
* pass. Client-side validation is non-authoritative UX — the server
|
|
226
223
|
* re-validates the same schema on the mutation.
|
|
227
224
|
*/
|
|
228
|
-
export declare const validateFields: (schema: Schema.
|
|
225
|
+
export declare const validateFields: (schema: Schema.Top, values: unknown, options?: ValidateOptions) => ValidationResult;
|
|
229
226
|
|
|
230
227
|
export declare interface ValidateOptions {
|
|
231
228
|
/** BCP-47-ish tag; only the primary subtag is read. Default: the document's
|
package/dist/form.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as e, S as t, _ as n, a as r, b as i, g as a, i as o, n as s, o as c, r as l, t as u, v as d, w as f, x as p, y as m } from "./formData-
|
|
1
|
+
import { C as e, S as t, _ as n, a as r, b as i, g as a, i as o, n as s, o as c, r as l, t as u, v as d, w as f, x as p, y as m } from "./formData-BfpBt7BQ.js";
|
|
2
2
|
export { u as FORM_FLASH_SCRIPT_ID, s as FORM_KEY_FIELD, l as FORM_PATH_PREFIX, o as FORM_REDIRECT_FIELD, a as decodeFieldIssues, n as documentLocale, r as formActionPath, c as formDataToInput, p as formField, t as formSections, d as resolveValidationMessage, m as restrictToSchema, e as schemaToColumns, f as schemaToFields, i as validateFields };
|