@voltro/client 0.85.0 → 0.86.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 +666 -0
- package/THIRD-PARTY-NOTICES.md +5 -33
- package/dist/analyticsCatalog.js +47 -0
- package/dist/apiConnectivity.js +33 -0
- package/dist/apiRuntime.js +135 -0
- package/dist/apiSupervisor.js +125 -0
- package/dist/authRefresh.js +20 -0
- package/dist/awaitResolvedApi.js +23 -0
- package/dist/bootstrap.d.ts +1144 -0
- package/dist/bootstrap.js +8 -0
- package/dist/cellMerger.js +6 -0
- package/dist/clientDiagnostics.js +94 -0
- package/dist/clientErrorBus.js +16 -0
- package/dist/clientScheduler.js +31 -0
- package/dist/connectionPrerequisite.js +70 -0
- package/dist/connectionScope.js +35 -0
- package/dist/connectionSetupController.js +206 -0
- package/dist/createHooks.js +15 -0
- package/dist/deepLink.js +69 -0
- package/dist/filters.js +58 -0
- package/dist/form.js +5 -2
- package/dist/formBinding.js +325 -0
- package/dist/formData.js +65 -0
- package/dist/formFlashId.js +4 -0
- package/dist/frameworkRuntimesContext.js +8 -0
- package/dist/globalContext.js +10 -0
- package/dist/index.d.ts +53 -7
- package/dist/index.js +83 -4121
- package/dist/liveRowSort.js +66 -0
- package/dist/mutationConnectionSetup.js +16 -0
- package/dist/mutationIdentity.js +10 -0
- package/dist/mutationSerialExecution.js +53 -0
- package/dist/mutationsBus.js +40 -0
- package/dist/onlineSource.js +13 -0
- package/dist/outbox.js +213 -0
- package/dist/outboxHttp.js +104 -0
- package/dist/outboxState.js +43 -0
- package/dist/permissions.js +20 -0
- package/dist/platform.js +121 -0
- package/dist/preloadSeed.js +47 -0
- package/dist/provider.js +22 -0
- package/dist/query.js +12 -2
- package/dist/recoveryCoordinator.js +195 -0
- package/dist/recoveryRetry.js +24 -0
- package/dist/richText.js +176 -0
- package/dist/rpcErrorBus.js +39 -0
- package/dist/rpcErrorKind.js +13 -0
- package/dist/runRpc.js +12 -0
- package/dist/runtime.d.ts +32 -1
- package/dist/runtime.js +16 -126
- package/dist/runtimeCapabilities.js +44 -0
- package/dist/runtimeContext.js +49 -0
- package/dist/schemaFields.js +219 -0
- package/dist/scopeMembership.js +12 -0
- package/dist/seedResolvers.js +7 -0
- package/dist/sequence.js +65 -0
- package/dist/serverRequest.js +24 -0
- package/dist/serviceClient.js +128 -0
- package/dist/squashRpcCause.js +8 -0
- package/dist/stableKey.js +21 -0
- package/dist/store.js +288 -0
- package/dist/storeStorage.js +28 -0
- package/dist/subscriptionCache.js +724 -0
- package/dist/tagWalk.js +23 -0
- package/dist/traceBus.js +10 -0
- package/dist/tracking.js +40 -0
- package/dist/uploadProgress.js +21 -0
- package/dist/useAction.js +101 -0
- package/dist/useAgent.js +53 -0
- package/dist/useAgentChat.js +43 -0
- package/dist/useAgentStream.js +64 -0
- package/dist/useApiOnline.js +14 -0
- package/dist/useCapabilityManifest.js +101 -0
- package/dist/useConnectionSetup.js +28 -0
- package/dist/useConnectionStatus.js +38 -0
- package/dist/useConnections.js +107 -0
- package/dist/useDataCopilot.js +24 -0
- package/dist/useDataTable.js +34 -0
- package/dist/useDerived.js +22 -0
- package/dist/useEvent.js +88 -0
- package/dist/useFormBinding.js +476 -0
- package/dist/useLocalQuery.js +59 -0
- package/dist/useMutation.js +214 -0
- package/dist/useOnRpcError.js +13 -0
- package/dist/usePreloadedSubscription.js +18 -0
- package/dist/usePreview.js +14 -0
- package/dist/useProvenance.js +51 -0
- package/dist/useQueryField.js +34 -0
- package/dist/useRecord.js +12 -0
- package/dist/useRefreshSubscriptions.js +22 -0
- package/dist/useResourceCan.js +18 -0
- package/dist/useResumableAgentStream.js +75 -0
- package/dist/useSequence.js +25 -0
- package/dist/useSkeleton.js +13 -0
- package/dist/useSubscription.js +89 -0
- package/dist/useSubscriptionHealth.js +32 -0
- package/dist/useTranscription.js +51 -0
- package/dist/useUndo.js +33 -0
- package/dist/useUndoLog.js +44 -0
- package/dist/useUpload.js +296 -0
- package/dist/useWindowedSubscription.js +65 -0
- package/dist/useWorkflow.js +284 -0
- package/dist/useWorkflowRunState.js +93 -0
- package/dist/validation.js +39 -0
- package/dist/validationMessages.js +5 -0
- package/package.json +7 -2
- package/dist/authRefresh-DmfSoCca.js +0 -360
- package/dist/formData-BfpBt7BQ.js +0 -769
- package/dist/queryOnce-D5Y4V1SB.js +0 -55
- package/dist/runRpc-Zfz3w709.js +0 -1172
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import { Schema as e, SchemaIssue as t } from "effect";
|
|
2
|
+
import * as n from "effect/SchemaAST";
|
|
3
|
+
//#region src/formBinding.ts
|
|
4
|
+
var r = {
|
|
5
|
+
en: {
|
|
6
|
+
"validation.required": "Required",
|
|
7
|
+
"validation.invalid": "Invalid value",
|
|
8
|
+
"validation.minLength": "Must be at least {min} characters",
|
|
9
|
+
"validation.maxLength": "Must be at most {max} characters",
|
|
10
|
+
"validation.pattern": "Invalid format",
|
|
11
|
+
"validation.minValue": "Must be at least {min}",
|
|
12
|
+
"validation.maxValue": "Must be at most {max}",
|
|
13
|
+
"validation.minItems": "Add at least {min}",
|
|
14
|
+
"validation.maxItems": "No more than {max}",
|
|
15
|
+
"validation.integer": "Must be a whole number",
|
|
16
|
+
"validation.checking": "Still checking…",
|
|
17
|
+
"validation.invalidEmail": "Enter a valid email address",
|
|
18
|
+
"validation.invalidUrl": "Enter a valid URL",
|
|
19
|
+
"validation.invalidUuid": "Enter a valid identifier",
|
|
20
|
+
"validation.betweenLength": "Must be between {min} and {max} characters",
|
|
21
|
+
"validation.exactLength": "Must be exactly {amount} characters",
|
|
22
|
+
"validation.minDate": "Must not be earlier than {min}",
|
|
23
|
+
"validation.maxDate": "Must not be later than {max}",
|
|
24
|
+
"validation.invalidFileType": "This file type is not allowed",
|
|
25
|
+
"validation.fileTooLarge": "File is too large"
|
|
26
|
+
},
|
|
27
|
+
de: {
|
|
28
|
+
"validation.required": "Pflichtfeld",
|
|
29
|
+
"validation.invalid": "Ungültiger Wert",
|
|
30
|
+
"validation.minLength": "Mindestens {min} Zeichen",
|
|
31
|
+
"validation.maxLength": "Höchstens {max} Zeichen",
|
|
32
|
+
"validation.pattern": "Ungültiges Format",
|
|
33
|
+
"validation.minValue": "Mindestens {min}",
|
|
34
|
+
"validation.maxValue": "Höchstens {max}",
|
|
35
|
+
"validation.minItems": "Mindestens {min}",
|
|
36
|
+
"validation.maxItems": "Höchstens {max}",
|
|
37
|
+
"validation.integer": "Ganze Zahl erforderlich",
|
|
38
|
+
"validation.checking": "Prüfung läuft…",
|
|
39
|
+
"validation.invalidEmail": "Bitte eine gültige E-Mail-Adresse eingeben",
|
|
40
|
+
"validation.invalidUrl": "Bitte eine gültige URL eingeben",
|
|
41
|
+
"validation.invalidUuid": "Bitte eine gültige Kennung eingeben",
|
|
42
|
+
"validation.betweenLength": "Muss zwischen {min} und {max} Zeichen haben",
|
|
43
|
+
"validation.exactLength": "Muss genau {amount} Zeichen haben",
|
|
44
|
+
"validation.minDate": "Darf nicht früher sein als {min}",
|
|
45
|
+
"validation.maxDate": "Darf nicht später sein als {max}",
|
|
46
|
+
"validation.invalidFileType": "Dieser Dateityp ist nicht erlaubt",
|
|
47
|
+
"validation.fileTooLarge": "Die Datei ist zu groß"
|
|
48
|
+
}
|
|
49
|
+
}, i = (e, t) => {
|
|
50
|
+
let n = !1, r = e.replace(/\{(\w+)\}/g, (e, r) => {
|
|
51
|
+
let i = t?.[r];
|
|
52
|
+
return i === void 0 ? (n = !0, e) : String(i);
|
|
53
|
+
});
|
|
54
|
+
return n ? void 0 : r;
|
|
55
|
+
}, a = () => {
|
|
56
|
+
let e = globalThis.document?.documentElement?.lang ?? "";
|
|
57
|
+
return e === "" ? "en" : e;
|
|
58
|
+
}, o = (e, t) => {
|
|
59
|
+
let n = t?.messages?.(e.id, e.params, e.fallback);
|
|
60
|
+
if (n !== void 0) return n;
|
|
61
|
+
let o = r[(t?.locale ?? a()).toLowerCase().split("-")[0] ?? "en"]?.[e.id] ?? r.en?.[e.id];
|
|
62
|
+
return (o === void 0 ? void 0 : i(o, e.params)) ?? e.fallback;
|
|
63
|
+
}, s = (e) => {
|
|
64
|
+
let t = /^([a-z][\w-]*(?:\.[\w-]+)+)\|(\{.*\})$/.exec(e);
|
|
65
|
+
if (t !== null && t[1] !== void 0 && t[2] !== void 0) try {
|
|
66
|
+
return {
|
|
67
|
+
id: t[1],
|
|
68
|
+
params: JSON.parse(t[2]),
|
|
69
|
+
fallback: e
|
|
70
|
+
};
|
|
71
|
+
} catch {}
|
|
72
|
+
return /^[a-z][\w-]*(?:\.[\w-]+)+$/.test(e) ? {
|
|
73
|
+
id: e,
|
|
74
|
+
fallback: e
|
|
75
|
+
} : {
|
|
76
|
+
id: "validation.custom",
|
|
77
|
+
fallback: e
|
|
78
|
+
};
|
|
79
|
+
}, c = {
|
|
80
|
+
email: "validation.invalidEmail",
|
|
81
|
+
"idn-email": "validation.invalidEmail",
|
|
82
|
+
uri: "validation.invalidUrl",
|
|
83
|
+
url: "validation.invalidUrl",
|
|
84
|
+
uuid: "validation.invalidUuid"
|
|
85
|
+
}, l = (e, t, r) => {
|
|
86
|
+
let i = e.ast;
|
|
87
|
+
for (let e of t.split(".")) {
|
|
88
|
+
if (i === void 0) return {};
|
|
89
|
+
if (/^\d+$/.test(e)) {
|
|
90
|
+
i = n.isArrays(i) ? i.rest[0] ?? i.elements[0] : void 0;
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
let t = r?.get(i);
|
|
94
|
+
if (t !== void 0) {
|
|
95
|
+
i = t.get(e);
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
let a;
|
|
99
|
+
if (!n.isObjects(i)) return {};
|
|
100
|
+
if (a = i.propertySignatures, r !== void 0 && a.length >= 32) {
|
|
101
|
+
let t = /* @__PURE__ */ new Map();
|
|
102
|
+
for (let e of a) {
|
|
103
|
+
let n = String(e.name);
|
|
104
|
+
t.has(n) || t.set(n, e.type);
|
|
105
|
+
}
|
|
106
|
+
r.set(i, t), i = t.get(e);
|
|
107
|
+
} else i = a.find((t) => String(t.name) === e)?.type;
|
|
108
|
+
}
|
|
109
|
+
let a = {};
|
|
110
|
+
for (let e of i?.checks ?? []) {
|
|
111
|
+
let t = u(e.annotations);
|
|
112
|
+
if (t === void 0) continue;
|
|
113
|
+
let n = t.payload ?? {};
|
|
114
|
+
a.min === void 0 && t.id === "effect/schema/isMinLength" && typeof n.minLength == "number" && (a.min = n.minLength), a.max === void 0 && t.id === "effect/schema/isMaxLength" && typeof n.maxLength == "number" && (a.max = n.maxLength);
|
|
115
|
+
}
|
|
116
|
+
return a;
|
|
117
|
+
}, u = (e) => {
|
|
118
|
+
let t = e?.representation;
|
|
119
|
+
return t !== void 0 && typeof t.id == "string" ? {
|
|
120
|
+
id: t.id,
|
|
121
|
+
payload: t.payload
|
|
122
|
+
} : void 0;
|
|
123
|
+
}, d = (e, t) => {
|
|
124
|
+
let n = u(e), r = n?.payload ?? {};
|
|
125
|
+
switch (n?.id) {
|
|
126
|
+
case "effect/schema/isMinLength": return t ? {
|
|
127
|
+
id: "validation.minItems",
|
|
128
|
+
params: {
|
|
129
|
+
count: r.minLength,
|
|
130
|
+
min: r.minLength
|
|
131
|
+
}
|
|
132
|
+
} : {
|
|
133
|
+
id: "validation.minLength",
|
|
134
|
+
params: { min: r.minLength }
|
|
135
|
+
};
|
|
136
|
+
case "effect/schema/isMaxLength": return t ? {
|
|
137
|
+
id: "validation.maxItems",
|
|
138
|
+
params: {
|
|
139
|
+
count: r.maxLength,
|
|
140
|
+
max: r.maxLength
|
|
141
|
+
}
|
|
142
|
+
} : {
|
|
143
|
+
id: "validation.maxLength",
|
|
144
|
+
params: { max: r.maxLength }
|
|
145
|
+
};
|
|
146
|
+
case "effect/schema/isBetweenLength": {
|
|
147
|
+
let e = r.minimum, t = r.maximum;
|
|
148
|
+
return e === t ? {
|
|
149
|
+
id: "validation.exactLength",
|
|
150
|
+
params: { amount: e }
|
|
151
|
+
} : {
|
|
152
|
+
id: "validation.betweenLength",
|
|
153
|
+
params: {
|
|
154
|
+
min: e,
|
|
155
|
+
max: t
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
case "effect/schema/isPattern": {
|
|
160
|
+
let t = typeof e?.format == "string" ? c[e.format] : void 0;
|
|
161
|
+
return t === void 0 ? {
|
|
162
|
+
id: "validation.pattern",
|
|
163
|
+
params: { pattern: r.source }
|
|
164
|
+
} : { id: t };
|
|
165
|
+
}
|
|
166
|
+
case "effect/schema/isGreaterThanOrEqualTo": return {
|
|
167
|
+
id: "validation.minValue",
|
|
168
|
+
params: { min: r.minimum }
|
|
169
|
+
};
|
|
170
|
+
case "effect/schema/isLessThanOrEqualTo": return {
|
|
171
|
+
id: "validation.maxValue",
|
|
172
|
+
params: { max: r.maximum }
|
|
173
|
+
};
|
|
174
|
+
case "effect/schema/isGreaterThan": return {
|
|
175
|
+
id: "validation.minValue",
|
|
176
|
+
params: {
|
|
177
|
+
min: r.exclusiveMinimum,
|
|
178
|
+
exclusive: !0
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
case "effect/schema/isLessThan": return {
|
|
182
|
+
id: "validation.maxValue",
|
|
183
|
+
params: {
|
|
184
|
+
max: r.exclusiveMaximum,
|
|
185
|
+
exclusive: !0
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
case "effect/schema/isInt": return { id: "validation.integer" };
|
|
189
|
+
case "effect/schema/isBetween": return {
|
|
190
|
+
id: "validation.minValue",
|
|
191
|
+
params: {
|
|
192
|
+
min: r.minimum,
|
|
193
|
+
max: r.maximum
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
default: {
|
|
197
|
+
let e = n?.id ?? "";
|
|
198
|
+
return /isGreaterThanOrEqualToDate|isGreaterThanDate/.test(e) ? { id: "validation.minDate" } : /isLessThanOrEqualToDate|isLessThanDate/.test(e) ? { id: "validation.maxDate" } : { id: "validation.invalid" };
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}, f = (e) => {
|
|
202
|
+
let t = e?.message;
|
|
203
|
+
return typeof t == "string" && t.length > 0 ? t : void 0;
|
|
204
|
+
}, p = (e) => e.map((e) => String(e)), m = t.makeFormatterDefault(), h = (e) => {
|
|
205
|
+
let t = [], n = (e, n, r, i) => {
|
|
206
|
+
t.push({
|
|
207
|
+
path: e.join("."),
|
|
208
|
+
id: n,
|
|
209
|
+
...r === void 0 ? {} : { params: r },
|
|
210
|
+
fallback: i
|
|
211
|
+
});
|
|
212
|
+
}, r = (e, t) => {
|
|
213
|
+
let r = s(t);
|
|
214
|
+
n(e, r.id, r.params, r.fallback);
|
|
215
|
+
}, i = (e, t, a = !1) => {
|
|
216
|
+
switch (e._tag) {
|
|
217
|
+
case "Composite":
|
|
218
|
+
for (let n of e.issues) i(n, t, e.ast._tag === "Arrays");
|
|
219
|
+
return;
|
|
220
|
+
case "AnyOf":
|
|
221
|
+
for (let n of e.issues) i(n, t, a);
|
|
222
|
+
return;
|
|
223
|
+
case "Pointer":
|
|
224
|
+
i(e.issue, [...t, ...p(e.path)]);
|
|
225
|
+
return;
|
|
226
|
+
case "Encoding":
|
|
227
|
+
i(e.issue, t, a);
|
|
228
|
+
return;
|
|
229
|
+
case "Filter": {
|
|
230
|
+
let o = e.filter.annotations, s = f(o);
|
|
231
|
+
if (s !== void 0) return r(t, s);
|
|
232
|
+
let c = d(o, a);
|
|
233
|
+
if (c.id !== "validation.invalid") {
|
|
234
|
+
n(t, c.id, c.params, g(e));
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
if (e.issue._tag === "Pointer" || e.issue._tag === "Composite" || e.issue._tag === "InvalidValue") {
|
|
238
|
+
i(e.issue, t);
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
n(t, "validation.invalid", void 0, g(e));
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
case "MissingKey":
|
|
245
|
+
n(t, "validation.required", void 0, "Required");
|
|
246
|
+
return;
|
|
247
|
+
case "InvalidValue": {
|
|
248
|
+
let i = f(e.annotations);
|
|
249
|
+
if (i !== void 0) return r(t, i);
|
|
250
|
+
n(t, "validation.invalid", void 0, g(e));
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
default:
|
|
254
|
+
n(t, "validation.invalid", void 0, g(e));
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
return i(e.issue, []), t;
|
|
259
|
+
}, g = (e) => {
|
|
260
|
+
let t = m(e).split("\n")[0] ?? "";
|
|
261
|
+
return t.length > 0 ? t : "Invalid value";
|
|
262
|
+
}, _ = (e, t) => {
|
|
263
|
+
if (typeof t != "object" || !t || Array.isArray(t)) return {
|
|
264
|
+
input: t,
|
|
265
|
+
dropped: []
|
|
266
|
+
};
|
|
267
|
+
let r;
|
|
268
|
+
try {
|
|
269
|
+
let t = e.ast;
|
|
270
|
+
if (!n.isObjects(t)) throw Error("not an object schema");
|
|
271
|
+
r = t.propertySignatures.map((e) => String(e.name));
|
|
272
|
+
} catch {
|
|
273
|
+
return {
|
|
274
|
+
input: t,
|
|
275
|
+
dropped: []
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
if (r.length === 0) return {
|
|
279
|
+
input: t,
|
|
280
|
+
dropped: []
|
|
281
|
+
};
|
|
282
|
+
let i = new Set(r), a = Object.entries(t), o = [], s = 0;
|
|
283
|
+
for (let e = 0; e < a.length; e += 1) {
|
|
284
|
+
let t = a[e];
|
|
285
|
+
i.has(t[0]) ? a[s++] = t : o.push(t[0]);
|
|
286
|
+
}
|
|
287
|
+
return o.length === 0 ? {
|
|
288
|
+
input: t,
|
|
289
|
+
dropped: []
|
|
290
|
+
} : (a.length = s, {
|
|
291
|
+
input: Object.fromEntries(a),
|
|
292
|
+
dropped: o
|
|
293
|
+
});
|
|
294
|
+
}, v = (t, n, r) => {
|
|
295
|
+
let i = e.decodeUnknownResult(t, { errors: "all" })(n);
|
|
296
|
+
if (i._tag === "Success") return {
|
|
297
|
+
valid: !0,
|
|
298
|
+
errors: {},
|
|
299
|
+
issues: []
|
|
300
|
+
};
|
|
301
|
+
let a = h(i.failure), s = a.length >= 32 ? /* @__PURE__ */ new WeakMap() : void 0, c = a.map((e) => {
|
|
302
|
+
if (e.id !== "validation.minLength" && e.id !== "validation.maxLength") return e;
|
|
303
|
+
let n = l(t, e.path, s);
|
|
304
|
+
return n.min === void 0 || n.max === void 0 ? e : n.min === n.max ? {
|
|
305
|
+
...e,
|
|
306
|
+
id: "validation.exactLength",
|
|
307
|
+
params: { amount: n.min }
|
|
308
|
+
} : {
|
|
309
|
+
...e,
|
|
310
|
+
id: "validation.betweenLength",
|
|
311
|
+
params: {
|
|
312
|
+
min: n.min,
|
|
313
|
+
max: n.max
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
}), u = {};
|
|
317
|
+
for (let e of c) e.path !== "" && !(e.path in u) && (u[e.path] = o(e, r));
|
|
318
|
+
return {
|
|
319
|
+
valid: !1,
|
|
320
|
+
errors: u,
|
|
321
|
+
issues: c
|
|
322
|
+
};
|
|
323
|
+
};
|
|
324
|
+
//#endregion
|
|
325
|
+
export { h as decodeFieldIssues, a as documentLocale, o as resolveValidationMessage, _ as restrictToSchema, v as validateFields };
|
package/dist/formData.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { schemaToFields as e } from "./schemaFields.js";
|
|
2
|
+
import { parseRichText as t } from "./richText.js";
|
|
3
|
+
import { FORM_FLASH_SCRIPT_ID as n } from "./formFlashId.js";
|
|
4
|
+
//#region src/formData.ts
|
|
5
|
+
var r = "/form/", i = (e) => `${r}${encodeURIComponent(e)}`, a = "__voltro_form", o = "__voltro_redirect", s = (e) => {
|
|
6
|
+
let t = Number(e);
|
|
7
|
+
return Number.isNaN(t) ? e : t;
|
|
8
|
+
}, c = (e) => {
|
|
9
|
+
let t = e.jsonSchema.items;
|
|
10
|
+
if (!t || typeof t != "object") return;
|
|
11
|
+
let n = t.type;
|
|
12
|
+
return typeof n == "string" ? n : void 0;
|
|
13
|
+
}, l = (e, n) => {
|
|
14
|
+
switch (e.widget) {
|
|
15
|
+
case "rich-text": return n === "" ? {
|
|
16
|
+
type: "doc",
|
|
17
|
+
content: []
|
|
18
|
+
} : t(n);
|
|
19
|
+
case "number": return n === "" ? void 0 : s(n);
|
|
20
|
+
case "date":
|
|
21
|
+
case "datetime": return n === "" ? void 0 : n;
|
|
22
|
+
default: return n;
|
|
23
|
+
}
|
|
24
|
+
}, u = (t, n) => {
|
|
25
|
+
let r = /* @__PURE__ */ new Map();
|
|
26
|
+
for (let [e, t] of n) {
|
|
27
|
+
let n = r.get(e);
|
|
28
|
+
n === void 0 ? r.set(e, [t]) : n.push(t);
|
|
29
|
+
}
|
|
30
|
+
let i = {}, a = (e, t) => {
|
|
31
|
+
if (!e.includes(".")) {
|
|
32
|
+
i[e] = t;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
let n = e.split("."), r = i;
|
|
36
|
+
for (let e = 0; e < n.length - 1; e += 1) {
|
|
37
|
+
let t = n[e], i = r[t];
|
|
38
|
+
if (typeof i != "object" || !i) {
|
|
39
|
+
let e = {};
|
|
40
|
+
r[t] = e, r = e;
|
|
41
|
+
} else r = i;
|
|
42
|
+
}
|
|
43
|
+
r[n[n.length - 1]] = t;
|
|
44
|
+
};
|
|
45
|
+
for (let n of e(t)) {
|
|
46
|
+
if (n.widget === "array") continue;
|
|
47
|
+
let e = r.get(n.name);
|
|
48
|
+
if (n.widget === "checkbox" || n.widget === "switch") {
|
|
49
|
+
a(n.name, e !== void 0);
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (n.widget === "multi-select") {
|
|
53
|
+
let t = c(n), r = e ?? [], i = t === "number" || t === "integer", o = r.filter((e) => e !== "");
|
|
54
|
+
if (i) for (let e = 0; e < o.length; e += 1) o[e] = s(o[e]);
|
|
55
|
+
a(n.name, o);
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (e === void 0) continue;
|
|
59
|
+
let t = l(n, e[0]);
|
|
60
|
+
t !== void 0 && a(n.name, t);
|
|
61
|
+
}
|
|
62
|
+
return i;
|
|
63
|
+
};
|
|
64
|
+
//#endregion
|
|
65
|
+
export { n as FORM_FLASH_SCRIPT_ID, a as FORM_KEY_FIELD, r as FORM_PATH_PREFIX, o as FORM_REDIRECT_FIELD, i as formActionPath, u as formDataToInput };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { globalContext as e } from "./globalContext.js";
|
|
2
|
+
//#region src/frameworkRuntimesContext.ts
|
|
3
|
+
var t = (e, t) => {
|
|
4
|
+
let n = Array.from(t).join(", ") || "(none mounted)";
|
|
5
|
+
return /* @__PURE__ */ Error(`@voltro/client: no api named ${JSON.stringify(e)}. Known apis: ${n}`);
|
|
6
|
+
}, n = e("frameworkRuntimes", null), r = (e) => typeof e.runtime?.runFork != "function";
|
|
7
|
+
//#endregion
|
|
8
|
+
export { n as FrameworkRuntimesContext, r as isUnresolvedApi, t as unknownApiError };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext as e } from "react";
|
|
2
|
+
//#region src/globalContext.ts
|
|
3
|
+
var t = (t, n) => {
|
|
4
|
+
let r = globalThis, i = Symbol.for(`@voltro/web/context:${t}`), a = r[i];
|
|
5
|
+
if (a) return a;
|
|
6
|
+
let o = e(n);
|
|
7
|
+
return r[i] = o, o;
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { t as globalContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { ClientDescriptor } from '@voltro/protocol';
|
|
|
4
4
|
import { ClipboardEvent as ClipboardEvent_2 } from 'react';
|
|
5
5
|
import { Context } from 'react';
|
|
6
6
|
import { createRowPatchApplier } from '@voltro/protocol';
|
|
7
|
+
import { DEV_ACTIVITY_EVENT } from '@voltro/protocol';
|
|
8
|
+
import { DevActivityMessage } from '@voltro/protocol';
|
|
7
9
|
import { DragEvent as DragEvent_2 } from 'react';
|
|
8
10
|
import { Effect } from 'effect';
|
|
9
11
|
import { errorMessage } from '@voltro/protocol';
|
|
@@ -1145,6 +1147,10 @@ export declare const defineTracking: <P = Record<string, unknown>>(name: string,
|
|
|
1145
1147
|
*/
|
|
1146
1148
|
export declare const deriveEntityAdmins: (manifest: CapabilityManifest) => ReadonlyArray<EntityAdminSpec>;
|
|
1147
1149
|
|
|
1150
|
+
export { DEV_ACTIVITY_EVENT }
|
|
1151
|
+
|
|
1152
|
+
export { DevActivityMessage }
|
|
1153
|
+
|
|
1148
1154
|
export declare const disableClientDiagnosticsPersistence: () => void;
|
|
1149
1155
|
|
|
1150
1156
|
/**
|
|
@@ -1707,11 +1713,27 @@ export declare interface FrameworkRuntimes {
|
|
|
1707
1713
|
* keeps working; absent means "already connected", which is the safe reading.
|
|
1708
1714
|
*/
|
|
1709
1715
|
readonly demand?: (apiName: string) => void;
|
|
1716
|
+
/**
|
|
1717
|
+
* One read through an api's client — the browser half of a loader's
|
|
1718
|
+
* `ctx.query`. Supplied by the host that builds the rpc runtime
|
|
1719
|
+
* (`VoltroRuntimeProvider`), not by this context: the read reaches the rpc
|
|
1720
|
+
* client and with it the Effect runtime, and an app that mounts no api must
|
|
1721
|
+
* not load either just because its router can ask. Absent → `ctx.query` is
|
|
1722
|
+
* `undefined` in the browser, as it is for an app without apis.
|
|
1723
|
+
*/
|
|
1724
|
+
readonly queryOnce?: QueryOnce;
|
|
1725
|
+
/**
|
|
1726
|
+
* Resolves once the rpc runtime behind these apis is loaded. A host that
|
|
1727
|
+
* loads it on demand (the web boot keeps it out of an app's first load and
|
|
1728
|
+
* fetches it with the first route that reads data) supplies it; absent means
|
|
1729
|
+
* the runtime is already there.
|
|
1730
|
+
*/
|
|
1731
|
+
readonly ready?: () => Promise<void>;
|
|
1710
1732
|
}
|
|
1711
1733
|
|
|
1712
1734
|
export declare const FrameworkRuntimesContext: Context<FrameworkRuntimes | null>;
|
|
1713
1735
|
|
|
1714
|
-
export declare const FrameworkRuntimesProvider: ({ apis, children, demand, }: FrameworkRuntimesProviderProps) => ReactNode;
|
|
1736
|
+
export declare const FrameworkRuntimesProvider: ({ apis, children, demand, queryOnce, }: FrameworkRuntimesProviderProps) => ReactNode;
|
|
1715
1737
|
|
|
1716
1738
|
export declare interface FrameworkRuntimesProviderProps {
|
|
1717
1739
|
readonly apis: ReadonlyMap<string, ApiHandle>;
|
|
@@ -1721,6 +1743,9 @@ export declare interface FrameworkRuntimesProviderProps {
|
|
|
1721
1743
|
* `web.api.connect: 'lazy'`; a foreign host may omit it, which reads as
|
|
1722
1744
|
* "already connected". */
|
|
1723
1745
|
readonly demand?: (apiName: string) => void;
|
|
1746
|
+
/** Passed straight through to the context for loader reads in the browser —
|
|
1747
|
+
* see `FrameworkRuntimes.queryOnce`. The web boot supplies `queryOnce`. */
|
|
1748
|
+
readonly queryOnce?: QueryOnce;
|
|
1724
1749
|
}
|
|
1725
1750
|
|
|
1726
1751
|
/** One browser-safe key per logical mutation, stable across its resends. */
|
|
@@ -2551,6 +2576,14 @@ export declare interface QueryFiltersState<Row> {
|
|
|
2551
2576
|
readonly error: unknown | undefined;
|
|
2552
2577
|
}
|
|
2553
2578
|
|
|
2579
|
+
/** `queryOnce`'s shape, declared here so this module stays free of it. */
|
|
2580
|
+
export declare type QueryOnce = (handleRef: {
|
|
2581
|
+
readonly current: {
|
|
2582
|
+
readonly runtime: unknown;
|
|
2583
|
+
readonly client: unknown;
|
|
2584
|
+
};
|
|
2585
|
+
}, apiName: string, tag: string, input: Record<string, unknown> | undefined, signal?: AbortSignal) => Promise<unknown>;
|
|
2586
|
+
|
|
2554
2587
|
/**
|
|
2555
2588
|
* Resolve `tag(input)` once on the api behind `handleRef`: a query to the data
|
|
2556
2589
|
* of its first snapshot, a mutation or action to its result.
|
|
@@ -2624,6 +2657,13 @@ export declare class RecoveryCoordinator {
|
|
|
2624
2657
|
get options(): ResolvedRecoveryOptions;
|
|
2625
2658
|
/** Ends on login/logout, tenant change or API disposal, not ordinary reconnect. */
|
|
2626
2659
|
get subjectSignal(): AbortSignal;
|
|
2660
|
+
/** Hydration values belong to the initial subject only. Once identity may
|
|
2661
|
+
* have changed, a later generation/remount must obtain its own snapshot.
|
|
2662
|
+
* Ordinary transport recovery does not cross this boundary. */
|
|
2663
|
+
getPreloadSeedPermission: () => boolean;
|
|
2664
|
+
/** A whole-cache resnapshot can follow same-socket re-authentication. Its
|
|
2665
|
+
* replacement reads must not reuse the original server-rendered values. */
|
|
2666
|
+
invalidatePreloadSeeds(): void;
|
|
2627
2667
|
getSnapshot: () => RecoverySnapshot;
|
|
2628
2668
|
/** The SSR / hydration snapshot — see INITIAL_RECOVERY_SNAPSHOT. Stable by
|
|
2629
2669
|
* reference, so both renders agree and React swaps to the live one after. */
|
|
@@ -2655,7 +2695,7 @@ export declare class RecoveryCoordinator {
|
|
|
2655
2695
|
* Disabled is final for the current generation and refuses immediately.
|
|
2656
2696
|
*/
|
|
2657
2697
|
reserveMutationReplay(startedAt: number): MutationReplayReservation | undefined;
|
|
2658
|
-
waitForProtocolReady(startedAt: number): Promise<boolean>;
|
|
2698
|
+
waitForProtocolReady(startedAt: number, signal?: AbortSignal): Promise<boolean>;
|
|
2659
2699
|
dispose(): void;
|
|
2660
2700
|
}
|
|
2661
2701
|
|
|
@@ -4202,11 +4242,10 @@ export declare interface SubscriptionMeta {
|
|
|
4202
4242
|
readonly revision: number;
|
|
4203
4243
|
/** Wall-clock ms when the most recent delta was emitted; undefined for snapshots / optimistic. */
|
|
4204
4244
|
readonly emittedAt: number | undefined;
|
|
4205
|
-
/**
|
|
4206
|
-
*
|
|
4207
|
-
*
|
|
4208
|
-
*
|
|
4209
|
-
* `useOnRpcError` for connection-level UX.
|
|
4245
|
+
/** Subscription refusal or terminal non-transport stream failure.
|
|
4246
|
+
* After a snapshot, data remains available alongside the error. Check it
|
|
4247
|
+
* before presenting retained data as current/live. Transport interruptions
|
|
4248
|
+
* preserve delivered data and report through recovery health/error buses.
|
|
4210
4249
|
*
|
|
4211
4250
|
* A cold-start failure is its own STATE: `loading` is `false`, `failed` is
|
|
4212
4251
|
* `true`, and this field is non-optional there (see
|
|
@@ -4638,6 +4677,9 @@ export declare interface UndoLogEntry {
|
|
|
4638
4677
|
readonly createdAt: string;
|
|
4639
4678
|
}
|
|
4640
4679
|
|
|
4680
|
+
/** The error for an api name nothing mounted — one wording for every host. */
|
|
4681
|
+
export declare const unknownApiError: (name: string, known: Iterable<string>) => Error;
|
|
4682
|
+
|
|
4641
4683
|
/** How the running code gets replaced: a service worker, a desktop updater,
|
|
4642
4684
|
* an OTA bundle. `apply` is the restart/reload; callers gate it on an empty
|
|
4643
4685
|
* outbox. */
|
|
@@ -4703,6 +4745,10 @@ export declare interface UploadOptions {
|
|
|
4703
4745
|
readonly tags?: ReadonlyArray<string>;
|
|
4704
4746
|
readonly alt?: string;
|
|
4705
4747
|
readonly caption?: string;
|
|
4748
|
+
/** Stable identity for one through-app transfer. Reuse unchanged bytes and metadata
|
|
4749
|
+
* after an uncertain acknowledgement. Requires native operation storage.
|
|
4750
|
+
* uploadMany accepts an explicit identity only when it contains one file. */
|
|
4751
|
+
readonly operationId?: string;
|
|
4706
4752
|
/** rpc tag of the ticket-minting action. Default `'storage.mintUploadTicket'`
|
|
4707
4753
|
* — override for a namespaced storage plugin instance. */
|
|
4708
4754
|
readonly mintTag?: string;
|