@voltro/client 0.84.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 +1215 -0
- package/THIRD-PARTY-NOTICES.md +5 -89
- 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.d.ts +8 -11
- 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 +285 -279
- package/dist/index.js +83 -3686
- 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 +79 -15
- package/dist/runtime.js +16 -129
- 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 +8 -5
- package/dist/authRefresh-C4Ow8HH7.js +0 -346
- package/dist/formData-dGz5aoUR.js +0 -649
- package/dist/queryOnce-CvdopzOj.js +0 -55
- package/dist/runRpc-DvHpFZAZ.js +0 -1034
package/dist/form.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { formField as e, formSections as t, schemaToColumns as n, schemaToFields as r } from "./schemaFields.js";
|
|
2
|
+
import { decodeFieldIssues as i, documentLocale as a, resolveValidationMessage as o, restrictToSchema as s, validateFields as c } from "./formBinding.js";
|
|
3
|
+
import { FORM_FLASH_SCRIPT_ID as l } from "./formFlashId.js";
|
|
4
|
+
import { FORM_KEY_FIELD as u, FORM_PATH_PREFIX as d, FORM_REDIRECT_FIELD as f, formActionPath as p, formDataToInput as m } from "./formData.js";
|
|
5
|
+
export { l as FORM_FLASH_SCRIPT_ID, u as FORM_KEY_FIELD, d as FORM_PATH_PREFIX, f as FORM_REDIRECT_FIELD, i as decodeFieldIssues, a as documentLocale, p as formActionPath, m as formDataToInput, e as formField, t as formSections, o as resolveValidationMessage, s as restrictToSchema, n as schemaToColumns, r as schemaToFields, c as validateFields };
|
|
@@ -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 };
|