@voltro/client 0.84.0 → 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 +549 -0
- package/THIRD-PARTY-NOTICES.md +1 -57
- package/dist/{authRefresh-C4Ow8HH7.js → authRefresh-DmfSoCca.js} +81 -67
- 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 +232 -272
- package/dist/index.js +1533 -1098
- package/dist/query.js +1 -1
- package/dist/{queryOnce-CvdopzOj.js → queryOnce-D5Y4V1SB.js} +1 -1
- package/dist/{runRpc-DvHpFZAZ.js → runRpc-Zfz3w709.js} +319 -181
- package/dist/runtime.d.ts +47 -14
- package/dist/runtime.js +10 -13
- package/package.json +3 -5
- 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
|
|
@@ -1,36 +1,36 @@
|
|
|
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-
|
|
2
|
-
import { Context as c, Effect as l,
|
|
3
|
-
import * as
|
|
4
|
-
import { RpcClient as
|
|
5
|
-
import { compareSurfaces as
|
|
6
|
-
import * as
|
|
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
7
|
//#region src/clientScheduler.ts
|
|
8
|
-
var
|
|
8
|
+
var C = {
|
|
9
9
|
channel: "timer",
|
|
10
10
|
yield: (e) => {
|
|
11
11
|
setTimeout(e, 0);
|
|
12
12
|
}
|
|
13
|
-
},
|
|
14
|
-
let t =
|
|
13
|
+
}, w = (e) => {
|
|
14
|
+
let t = f.make();
|
|
15
15
|
return e.port1.onmessage = () => {
|
|
16
|
-
|
|
16
|
+
let e = f.take(t);
|
|
17
|
+
e !== f.Empty && e();
|
|
17
18
|
}, e.port1.unref?.(), {
|
|
18
19
|
channel: "message-channel",
|
|
19
20
|
yield: (n) => {
|
|
20
|
-
|
|
21
|
+
f.append(t, n), e.port2.postMessage(null);
|
|
21
22
|
}
|
|
22
23
|
};
|
|
23
|
-
},
|
|
24
|
-
let
|
|
25
|
-
n
|
|
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
|
+
};
|
|
26
32
|
});
|
|
27
|
-
return {
|
|
28
|
-
yieldChannel: e.channel,
|
|
29
|
-
shouldYield: p.defaultShouldYield,
|
|
30
|
-
scheduleTask: (e, t, r) => {
|
|
31
|
-
n(r).scheduleTask(e, t);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
33
|
+
return Object.assign(t, { yieldChannel: e.channel });
|
|
34
34
|
}, D = (e, t, n) => {
|
|
35
35
|
try {
|
|
36
36
|
let r = globalThis.location, i = typeof r == "object" && r ? r.href : void 0, a = new URL(e, i);
|
|
@@ -69,7 +69,7 @@ var S = {
|
|
|
69
69
|
} catch {
|
|
70
70
|
return;
|
|
71
71
|
} finally {
|
|
72
|
-
clearTimeout(s);
|
|
72
|
+
clearTimeout(s), o.abort();
|
|
73
73
|
}
|
|
74
74
|
}, k = class {
|
|
75
75
|
#e;
|
|
@@ -120,18 +120,32 @@ var S = {
|
|
|
120
120
|
});
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
|
-
}, P = (e, t
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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) => {
|
|
132
146
|
let i;
|
|
133
147
|
try {
|
|
134
|
-
i =
|
|
148
|
+
i = b(x(n), r);
|
|
135
149
|
} catch {
|
|
136
150
|
return;
|
|
137
151
|
}
|
|
@@ -145,65 +159,65 @@ var S = {
|
|
|
145
159
|
let s = [...a, ...o].slice(0, F), c = a.length + o.length - s.length;
|
|
146
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.`);
|
|
147
161
|
}, L = async (n) => {
|
|
148
|
-
let { name: i, wsUrl:
|
|
149
|
-
e(i, "runtime.build-started", { generation:
|
|
150
|
-
let
|
|
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) => {
|
|
151
165
|
e(i, "socket.retry-scheduled", {
|
|
152
|
-
generation:
|
|
166
|
+
generation: w,
|
|
153
167
|
attempt: t,
|
|
154
168
|
delayMs: n,
|
|
155
169
|
owner: "socket"
|
|
156
170
|
});
|
|
157
171
|
});
|
|
158
|
-
O(
|
|
159
|
-
|
|
172
|
+
O(f, i, fetch, 1500, D.options.capabilitiesUrl).then((t) => {
|
|
173
|
+
D.setMutationReplaySupported(t?.mutationReplay === !0, w), e(i, "runtime.capabilities", {
|
|
160
174
|
mutationReplay: t?.mutationReplay === !0,
|
|
161
175
|
discovered: t !== void 0
|
|
162
176
|
});
|
|
163
177
|
let r = n.surfaceAudience === "service" ? t?.serviceSurface : t?.surface;
|
|
164
|
-
r !== void 0 && I(i,
|
|
178
|
+
r !== void 0 && I(i, b, r);
|
|
165
179
|
});
|
|
166
|
-
let
|
|
167
|
-
errorBus:
|
|
180
|
+
let M = n.descriptors ?? {}, F = await N(i, w, n.mirror, M), L = new r({
|
|
181
|
+
errorBus: T,
|
|
168
182
|
apiName: i,
|
|
169
|
-
...
|
|
170
|
-
}),
|
|
171
|
-
class
|
|
172
|
-
let
|
|
173
|
-
|
|
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();
|
|
174
188
|
let t = 0;
|
|
175
|
-
|
|
176
|
-
generation:
|
|
189
|
+
z !== void 0 && (t = L.resumeTransportFailures(z)), e(i, "protocol.ready", {
|
|
190
|
+
generation: w,
|
|
177
191
|
resumed: t
|
|
178
|
-
}),
|
|
179
|
-
},
|
|
180
|
-
|
|
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);
|
|
181
195
|
try {
|
|
182
|
-
let t = await
|
|
196
|
+
let t = await X.runPromise(B);
|
|
183
197
|
e(i, "runtime.resolved", {
|
|
184
|
-
generation:
|
|
185
|
-
scheduler:
|
|
198
|
+
generation: w,
|
|
199
|
+
scheduler: Y.yieldChannel
|
|
186
200
|
});
|
|
187
|
-
let n = (
|
|
188
|
-
let t =
|
|
189
|
-
return t !== void 0 &&
|
|
201
|
+
let n = (F?.warmTags ?? []).filter((e) => {
|
|
202
|
+
let t = M[e]?.input;
|
|
203
|
+
return t !== void 0 && p.isSuccess(h.decodeUnknownResult(t)({}));
|
|
190
204
|
}).map((e) => [e, {}]);
|
|
191
|
-
for (let [e, r] of [...
|
|
192
|
-
let n =
|
|
193
|
-
|
|
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 });
|
|
194
208
|
}
|
|
195
209
|
return {
|
|
196
|
-
runtime:
|
|
210
|
+
runtime: X,
|
|
197
211
|
client: t,
|
|
198
|
-
cache:
|
|
199
|
-
errorBus:
|
|
200
|
-
recovery:
|
|
212
|
+
cache: L,
|
|
213
|
+
errorBus: T,
|
|
214
|
+
recovery: D
|
|
201
215
|
};
|
|
202
216
|
} catch (t) {
|
|
203
217
|
throw e(i, "runtime.failed", {
|
|
204
|
-
generation:
|
|
218
|
+
generation: w,
|
|
205
219
|
errorName: t instanceof Error ? t.name : typeof t
|
|
206
|
-
}),
|
|
220
|
+
}), X.dispose(), t;
|
|
207
221
|
}
|
|
208
222
|
}, R = (e, t, n) => ({
|
|
209
223
|
resolved: null,
|
|
@@ -325,7 +339,7 @@ var S = {
|
|
|
325
339
|
}, H = 0, U = () => {
|
|
326
340
|
let e = typeof crypto < "u" ? crypto : void 0;
|
|
327
341
|
return e && typeof e.randomUUID == "function" ? e.randomUUID() : `idem_${Date.now().toString(36)}_${H += 1}`;
|
|
328
|
-
}, W = (e, t) => e.pipe(l.
|
|
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 = {}) => {
|
|
329
343
|
let r = n.cooldownMs ?? 15e3, i = n.maxConsecutive ?? 3, a = n.now ?? (() => Date.now()), o = -Infinity, s = 0, c = e.on((e) => {
|
|
330
344
|
if (!G(e.error) || s >= i) return;
|
|
331
345
|
let n = a();
|
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 };
|