@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
|
@@ -1,649 +0,0 @@
|
|
|
1
|
-
import { JSONSchema as e, Schema as t } from "effect";
|
|
2
|
-
import * as n from "effect/SchemaAST";
|
|
3
|
-
//#region src/schemaFields.ts
|
|
4
|
-
var r = (e) => ({ jsonSchema: { "x-voltro": e } }), i = "#/$defs/", a = (e) => e.replace(/[_-]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/\s+/g, " ").trim().replace(/^./, (e) => e.toUpperCase()), o = /^[a-z][A-Za-z0-9]*(\(.*\))?$/, s = (e) => {
|
|
5
|
-
let t = e.title;
|
|
6
|
-
if (typeof t != "string") return;
|
|
7
|
-
let n = t.trim();
|
|
8
|
-
return n === "" || o.test(n) ? void 0 : n;
|
|
9
|
-
}, c = (e, t) => {
|
|
10
|
-
let n = e;
|
|
11
|
-
for (let e = 0; e < 8; e += 1) {
|
|
12
|
-
let e = n.$ref;
|
|
13
|
-
if (typeof e != "string" || !e.startsWith(i)) return n;
|
|
14
|
-
let r = t[e.slice(8)];
|
|
15
|
-
if (!r || typeof r != "object") return n;
|
|
16
|
-
n = r;
|
|
17
|
-
}
|
|
18
|
-
return n;
|
|
19
|
-
}, l = (e) => {
|
|
20
|
-
if (!e || typeof e != "object") return !1;
|
|
21
|
-
let t = e;
|
|
22
|
-
if (t.type === "null" || t.const === null) return !0;
|
|
23
|
-
let n = t.enum;
|
|
24
|
-
return Array.isArray(n) && n.length === 1 && n[0] === null;
|
|
25
|
-
}, u = (e, t) => {
|
|
26
|
-
let n = e.type;
|
|
27
|
-
if (Array.isArray(n) && n.includes("null")) {
|
|
28
|
-
let t = n.filter((e) => e !== "null");
|
|
29
|
-
return {
|
|
30
|
-
node: {
|
|
31
|
-
...e,
|
|
32
|
-
type: t.length === 1 ? t[0] : t
|
|
33
|
-
},
|
|
34
|
-
nullable: !0
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
for (let n of ["anyOf", "oneOf"]) {
|
|
38
|
-
let r = e[n];
|
|
39
|
-
if (!Array.isArray(r)) continue;
|
|
40
|
-
let i = r.filter((e) => !l(e));
|
|
41
|
-
if (i.length !== r.length) return i.length === 1 ? {
|
|
42
|
-
node: c(i[0], t),
|
|
43
|
-
nullable: !0
|
|
44
|
-
} : {
|
|
45
|
-
node: {
|
|
46
|
-
...e,
|
|
47
|
-
[n]: i
|
|
48
|
-
},
|
|
49
|
-
nullable: !0
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
node: e,
|
|
54
|
-
nullable: !1
|
|
55
|
-
};
|
|
56
|
-
}, d = (e) => e.map((e) => ({
|
|
57
|
-
value: String(e),
|
|
58
|
-
label: a(String(e))
|
|
59
|
-
})), f = (e) => {
|
|
60
|
-
let t = e.enum;
|
|
61
|
-
if (Array.isArray(t) && t.length > 0) return {
|
|
62
|
-
widget: "select",
|
|
63
|
-
options: d(t)
|
|
64
|
-
};
|
|
65
|
-
let n = e.type, r = Array.isArray(n) ? n.find((e) => e !== "null") : n, i = e.format;
|
|
66
|
-
switch (r) {
|
|
67
|
-
case "string": return i === "date" ? { widget: "date" } : i === "date-time" ? { widget: "datetime" } : { widget: "text" };
|
|
68
|
-
case "integer":
|
|
69
|
-
case "number": return { widget: "number" };
|
|
70
|
-
case "boolean": return { widget: "checkbox" };
|
|
71
|
-
case "array": return { widget: "multi-select" };
|
|
72
|
-
default: return { widget: "custom" };
|
|
73
|
-
}
|
|
74
|
-
}, ee = (e) => {
|
|
75
|
-
let t = e.$ref;
|
|
76
|
-
if (typeof t != "string" || !t.startsWith(i)) return;
|
|
77
|
-
let n = t.slice(8);
|
|
78
|
-
if (/DateTime/i.test(n) || /Timestamp/i.test(n)) return "datetime";
|
|
79
|
-
if (/Date/.test(n)) return "date";
|
|
80
|
-
}, p = (e) => typeof e["x-voltro"] == "object" && e["x-voltro"] !== null ? e["x-voltro"] : {}, te = 4, m = (e, t, n, r = "", i, o = 0) => Object.entries(e).flatMap(([e, l]) => {
|
|
81
|
-
let { node: d, nullable: h } = u(c(l, n), n), g = c(d, n), _ = p(g), v = r === "" ? e : `${r}.${e}`, y = g.properties;
|
|
82
|
-
if (g.type === "object" && y !== void 0 && o < te && _.widget === void 0) return m(y, new Set(Array.isArray(g.required) ? g.required : []), n, v, {
|
|
83
|
-
path: _.section ?? v,
|
|
84
|
-
label: _.label ?? s(g) ?? a(e)
|
|
85
|
-
}, o + 1);
|
|
86
|
-
let b = ee(l), { widget: x, options: S } = f(g);
|
|
87
|
-
b !== void 0 && (x = b);
|
|
88
|
-
let C;
|
|
89
|
-
if (g.type === "array") {
|
|
90
|
-
let e = g.items;
|
|
91
|
-
if (typeof e == "object" && e && !Array.isArray(e)) {
|
|
92
|
-
let t = c(e, n), r = t.properties;
|
|
93
|
-
t.type === "object" && r !== void 0 && (x = "array", C = m(r, new Set(Array.isArray(t.required) ? t.required : []), n));
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
_.widget !== void 0 && (x = _.widget), _.reference !== void 0 && _.widget === void 0 && (x = "reference");
|
|
97
|
-
let w = typeof g.description == "string" ? g.description : void 0, T = _.section ?? i?.path;
|
|
98
|
-
return [{
|
|
99
|
-
name: v,
|
|
100
|
-
label: _.label ?? s(g) ?? a(e),
|
|
101
|
-
widget: x,
|
|
102
|
-
required: t.has(e),
|
|
103
|
-
nullable: h,
|
|
104
|
-
...S ? { options: S } : {},
|
|
105
|
-
jsonSchema: g,
|
|
106
|
-
...T === void 0 ? {} : {
|
|
107
|
-
section: T,
|
|
108
|
-
sectionLabel: i?.label ?? a(T)
|
|
109
|
-
},
|
|
110
|
-
...w === void 0 ? {} : { description: w },
|
|
111
|
-
..._.order === void 0 ? {} : { order: _.order },
|
|
112
|
-
...C === void 0 ? {} : { item: C },
|
|
113
|
-
..._.reference === void 0 ? {} : { reference: _.reference }
|
|
114
|
-
}];
|
|
115
|
-
}), h = (e) => e.map((e, t) => [e, t]).sort((e, t) => (e[0].order ?? e[1]) - (t[0].order ?? t[1]) || e[1] - t[1]).map(([e]) => e), g = (t) => {
|
|
116
|
-
try {
|
|
117
|
-
return e.make(t);
|
|
118
|
-
} catch {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
}, _ = (e) => {
|
|
122
|
-
let t = g(e);
|
|
123
|
-
if (t === void 0) return [];
|
|
124
|
-
let n = t.$defs ?? {}, r = c(t, n), i = r.properties;
|
|
125
|
-
return i ? h(m(i, new Set(Array.isArray(r.required) ? r.required : []), n)) : [];
|
|
126
|
-
}, v = (e) => {
|
|
127
|
-
let t = g(e);
|
|
128
|
-
if (t === void 0) return [];
|
|
129
|
-
let n = t.$defs ?? {}, r = c(t, n);
|
|
130
|
-
if (r.type !== "array") return [];
|
|
131
|
-
let i = r.items;
|
|
132
|
-
if (!i || typeof i != "object") return [];
|
|
133
|
-
let a = c(i, n), o = a.properties;
|
|
134
|
-
return o ? m(o, new Set(Array.isArray(a.required) ? a.required : []), n) : [];
|
|
135
|
-
}, y = (e) => {
|
|
136
|
-
let t = [];
|
|
137
|
-
for (let n of e) {
|
|
138
|
-
let e = t[t.length - 1];
|
|
139
|
-
if (e !== void 0 && e.name === n.section) {
|
|
140
|
-
e.fields.push(n);
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
t.push({
|
|
144
|
-
name: n.section,
|
|
145
|
-
label: n.sectionLabel,
|
|
146
|
-
fields: [n]
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
return t;
|
|
150
|
-
}, b = {
|
|
151
|
-
en: {
|
|
152
|
-
"validation.required": "Required",
|
|
153
|
-
"validation.invalid": "Invalid value",
|
|
154
|
-
"validation.minLength": "Must be at least {min} characters",
|
|
155
|
-
"validation.maxLength": "Must be at most {max} characters",
|
|
156
|
-
"validation.pattern": "Invalid format",
|
|
157
|
-
"validation.minValue": "Must be at least {min}",
|
|
158
|
-
"validation.maxValue": "Must be at most {max}",
|
|
159
|
-
"validation.minItems": "Add at least {min}",
|
|
160
|
-
"validation.maxItems": "No more than {max}",
|
|
161
|
-
"validation.integer": "Must be a whole number",
|
|
162
|
-
"validation.checking": "Still checking…",
|
|
163
|
-
"validation.invalidEmail": "Enter a valid email address",
|
|
164
|
-
"validation.invalidUrl": "Enter a valid URL",
|
|
165
|
-
"validation.invalidUuid": "Enter a valid identifier",
|
|
166
|
-
"validation.betweenLength": "Must be between {min} and {max} characters",
|
|
167
|
-
"validation.exactLength": "Must be exactly {amount} characters",
|
|
168
|
-
"validation.minDate": "Must not be earlier than {min}",
|
|
169
|
-
"validation.maxDate": "Must not be later than {max}",
|
|
170
|
-
"validation.invalidFileType": "This file type is not allowed",
|
|
171
|
-
"validation.fileTooLarge": "File is too large"
|
|
172
|
-
},
|
|
173
|
-
de: {
|
|
174
|
-
"validation.required": "Pflichtfeld",
|
|
175
|
-
"validation.invalid": "Ungültiger Wert",
|
|
176
|
-
"validation.minLength": "Mindestens {min} Zeichen",
|
|
177
|
-
"validation.maxLength": "Höchstens {max} Zeichen",
|
|
178
|
-
"validation.pattern": "Ungültiges Format",
|
|
179
|
-
"validation.minValue": "Mindestens {min}",
|
|
180
|
-
"validation.maxValue": "Höchstens {max}",
|
|
181
|
-
"validation.minItems": "Mindestens {min}",
|
|
182
|
-
"validation.maxItems": "Höchstens {max}",
|
|
183
|
-
"validation.integer": "Ganze Zahl erforderlich",
|
|
184
|
-
"validation.checking": "Prüfung läuft…",
|
|
185
|
-
"validation.invalidEmail": "Bitte eine gültige E-Mail-Adresse eingeben",
|
|
186
|
-
"validation.invalidUrl": "Bitte eine gültige URL eingeben",
|
|
187
|
-
"validation.invalidUuid": "Bitte eine gültige Kennung eingeben",
|
|
188
|
-
"validation.betweenLength": "Muss zwischen {min} und {max} Zeichen haben",
|
|
189
|
-
"validation.exactLength": "Muss genau {amount} Zeichen haben",
|
|
190
|
-
"validation.minDate": "Darf nicht früher sein als {min}",
|
|
191
|
-
"validation.maxDate": "Darf nicht später sein als {max}",
|
|
192
|
-
"validation.invalidFileType": "Dieser Dateityp ist nicht erlaubt",
|
|
193
|
-
"validation.fileTooLarge": "Die Datei ist zu groß"
|
|
194
|
-
}
|
|
195
|
-
}, x = (e, t) => {
|
|
196
|
-
let n = !1, r = e.replace(/\{(\w+)\}/g, (e, r) => {
|
|
197
|
-
let i = t?.[r];
|
|
198
|
-
return i === void 0 ? (n = !0, e) : String(i);
|
|
199
|
-
});
|
|
200
|
-
return n ? void 0 : r;
|
|
201
|
-
}, S = () => {
|
|
202
|
-
let e = globalThis.document?.documentElement?.lang ?? "";
|
|
203
|
-
return e === "" ? "en" : e;
|
|
204
|
-
}, C = (e, t) => {
|
|
205
|
-
let n = t?.messages?.(e.id, e.params, e.fallback);
|
|
206
|
-
if (n !== void 0) return n;
|
|
207
|
-
let r = b[(t?.locale ?? S()).toLowerCase().split("-")[0] ?? "en"]?.[e.id] ?? b.en?.[e.id];
|
|
208
|
-
return (r === void 0 ? void 0 : x(r, e.params)) ?? e.fallback;
|
|
209
|
-
}, w = (e) => {
|
|
210
|
-
let t = /^([a-z][\w-]*(?:\.[\w-]+)+)\|(\{.*\})$/.exec(e);
|
|
211
|
-
if (t !== null && t[1] !== void 0 && t[2] !== void 0) try {
|
|
212
|
-
return {
|
|
213
|
-
id: t[1],
|
|
214
|
-
params: JSON.parse(t[2]),
|
|
215
|
-
fallback: e
|
|
216
|
-
};
|
|
217
|
-
} catch {}
|
|
218
|
-
return /^[a-z][\w-]*(?:\.[\w-]+)+$/.test(e) ? {
|
|
219
|
-
id: e,
|
|
220
|
-
fallback: e
|
|
221
|
-
} : {
|
|
222
|
-
id: "validation.custom",
|
|
223
|
-
fallback: e
|
|
224
|
-
};
|
|
225
|
-
}, T = {
|
|
226
|
-
email: "validation.invalidEmail",
|
|
227
|
-
"idn-email": "validation.invalidEmail",
|
|
228
|
-
uri: "validation.invalidUrl",
|
|
229
|
-
url: "validation.invalidUrl",
|
|
230
|
-
uuid: "validation.invalidUuid"
|
|
231
|
-
}, ne = (e, t) => {
|
|
232
|
-
let r = e.ast;
|
|
233
|
-
for (let e of t.split(".")) {
|
|
234
|
-
if (r === void 0) return {};
|
|
235
|
-
if (/^\d+$/.test(e)) {
|
|
236
|
-
r = r.rest?.[0]?.type;
|
|
237
|
-
continue;
|
|
238
|
-
}
|
|
239
|
-
let t;
|
|
240
|
-
try {
|
|
241
|
-
t = n.getPropertySignatures(r);
|
|
242
|
-
} catch {
|
|
243
|
-
return {};
|
|
244
|
-
}
|
|
245
|
-
r = t.find((t) => String(t.name) === e)?.type;
|
|
246
|
-
}
|
|
247
|
-
let i = {}, a = r;
|
|
248
|
-
for (let e = 0; e < 12 && a !== void 0; e += 1) {
|
|
249
|
-
let e = a.annotations?.[n.JSONSchemaAnnotationId] ?? {};
|
|
250
|
-
i.min === void 0 && typeof e.minLength == "number" && (i.min = e.minLength), i.max === void 0 && typeof e.maxLength == "number" && (i.max = e.maxLength), a = a.from;
|
|
251
|
-
}
|
|
252
|
-
return i;
|
|
253
|
-
}, E = (e) => {
|
|
254
|
-
let r = e[n.SchemaIdAnnotationId], i = e[n.JSONSchemaAnnotationId] ?? {};
|
|
255
|
-
switch (r) {
|
|
256
|
-
case t.MinLengthSchemaId: return {
|
|
257
|
-
id: "validation.minLength",
|
|
258
|
-
params: { min: i.minLength }
|
|
259
|
-
};
|
|
260
|
-
case t.MaxLengthSchemaId: return {
|
|
261
|
-
id: "validation.maxLength",
|
|
262
|
-
params: { max: i.maxLength }
|
|
263
|
-
};
|
|
264
|
-
case t.LengthSchemaId: return {
|
|
265
|
-
id: "validation.exactLength",
|
|
266
|
-
params: { amount: i.minLength }
|
|
267
|
-
};
|
|
268
|
-
case t.PatternSchemaId: {
|
|
269
|
-
let e = typeof i.format == "string" ? T[i.format] : void 0;
|
|
270
|
-
return e === void 0 ? {
|
|
271
|
-
id: "validation.pattern",
|
|
272
|
-
params: { pattern: i.pattern }
|
|
273
|
-
} : { id: e };
|
|
274
|
-
}
|
|
275
|
-
case t.GreaterThanOrEqualToSchemaId: return {
|
|
276
|
-
id: "validation.minValue",
|
|
277
|
-
params: { min: i.minimum }
|
|
278
|
-
};
|
|
279
|
-
case t.LessThanOrEqualToSchemaId: return {
|
|
280
|
-
id: "validation.maxValue",
|
|
281
|
-
params: { max: i.maximum }
|
|
282
|
-
};
|
|
283
|
-
case t.GreaterThanSchemaId: return {
|
|
284
|
-
id: "validation.minValue",
|
|
285
|
-
params: {
|
|
286
|
-
min: i.exclusiveMinimum,
|
|
287
|
-
exclusive: !0
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
case t.LessThanSchemaId: return {
|
|
291
|
-
id: "validation.maxValue",
|
|
292
|
-
params: {
|
|
293
|
-
max: i.exclusiveMaximum,
|
|
294
|
-
exclusive: !0
|
|
295
|
-
}
|
|
296
|
-
};
|
|
297
|
-
case t.IntSchemaId: return { id: "validation.integer" };
|
|
298
|
-
case t.MinItemsSchemaId: return {
|
|
299
|
-
id: "validation.minItems",
|
|
300
|
-
params: {
|
|
301
|
-
count: i.minItems,
|
|
302
|
-
min: i.minItems
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
case t.MaxItemsSchemaId: return {
|
|
306
|
-
id: "validation.maxItems",
|
|
307
|
-
params: {
|
|
308
|
-
count: i.maxItems,
|
|
309
|
-
max: i.maxItems
|
|
310
|
-
}
|
|
311
|
-
};
|
|
312
|
-
case t.BetweenSchemaId: return {
|
|
313
|
-
id: "validation.minValue",
|
|
314
|
-
params: {
|
|
315
|
-
min: i.minimum,
|
|
316
|
-
max: i.maximum
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
default: {
|
|
320
|
-
let e = String(r ?? "");
|
|
321
|
-
return /GreaterThanOrEqualToDate|GreaterThanDate/.test(e) ? { id: "validation.minDate" } : /LessThanOrEqualToDate|LessThanDate/.test(e) ? { id: "validation.maxDate" } : { id: "validation.invalid" };
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}, D = (e, t) => {
|
|
325
|
-
let r = e[n.MessageAnnotationId];
|
|
326
|
-
if (typeof r == "function") try {
|
|
327
|
-
let e = r(t);
|
|
328
|
-
if (typeof e == "string") return e;
|
|
329
|
-
if (typeof e == "object" && e && typeof e.message == "string") return e.message;
|
|
330
|
-
} catch {}
|
|
331
|
-
}, O = (e) => Array.isArray(e) ? e.map((e) => String(e)) : [String(e)], k = (e) => {
|
|
332
|
-
let t = [], n = (e, n, r, i) => {
|
|
333
|
-
t.push({
|
|
334
|
-
path: e.join("."),
|
|
335
|
-
id: n,
|
|
336
|
-
...r === void 0 ? {} : { params: r },
|
|
337
|
-
fallback: i
|
|
338
|
-
});
|
|
339
|
-
}, r = (e, t) => {
|
|
340
|
-
let r = w(t);
|
|
341
|
-
n(e, r.id, r.params, r.fallback);
|
|
342
|
-
}, i = (e, t) => {
|
|
343
|
-
switch (e._tag) {
|
|
344
|
-
case "Composite": {
|
|
345
|
-
let n = e.issues;
|
|
346
|
-
if (n === void 0) return;
|
|
347
|
-
for (let e of Array.isArray(n) ? n : [n]) i(e, t);
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
case "Pointer":
|
|
351
|
-
e.issue !== void 0 && i(e.issue, [...t, ...O(e.path)]);
|
|
352
|
-
return;
|
|
353
|
-
case "Refinement": {
|
|
354
|
-
if (e.kind === "From") {
|
|
355
|
-
e.issue !== void 0 && i(e.issue, t);
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
let a = e.ast?.annotations ?? {}, o = D(a, e);
|
|
359
|
-
if (o !== void 0) return r(t, o);
|
|
360
|
-
let s = E(a);
|
|
361
|
-
if (s.id !== "validation.invalid") {
|
|
362
|
-
n(t, s.id, s.params, A(e));
|
|
363
|
-
return;
|
|
364
|
-
}
|
|
365
|
-
if (e.issue !== void 0 && (e.issue._tag === "Pointer" || e.issue._tag === "Composite" || e.issue._tag === "Type")) {
|
|
366
|
-
i(e.issue, t);
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
n(t, "validation.invalid", void 0, A(e));
|
|
370
|
-
return;
|
|
371
|
-
}
|
|
372
|
-
case "Transformation":
|
|
373
|
-
e.issue !== void 0 && i(e.issue, t);
|
|
374
|
-
return;
|
|
375
|
-
case "Missing":
|
|
376
|
-
n(t, "validation.required", void 0, "Required");
|
|
377
|
-
return;
|
|
378
|
-
case "Type": {
|
|
379
|
-
if (typeof e.message == "string" && e.message.length > 0) return r(t, e.message);
|
|
380
|
-
let i = e.ast?.annotations, a = i === void 0 ? void 0 : D(i, e);
|
|
381
|
-
if (a !== void 0) return r(t, a);
|
|
382
|
-
n(t, "validation.invalid", void 0, A(e));
|
|
383
|
-
return;
|
|
384
|
-
}
|
|
385
|
-
default:
|
|
386
|
-
n(t, "validation.invalid", void 0, A(e));
|
|
387
|
-
return;
|
|
388
|
-
}
|
|
389
|
-
};
|
|
390
|
-
return i(e.issue, []), t;
|
|
391
|
-
}, A = (e) => typeof e.message == "string" && e.message.length > 0 ? e.message : "Invalid value", j = (e, t) => {
|
|
392
|
-
if (typeof t != "object" || !t || Array.isArray(t)) return {
|
|
393
|
-
input: t,
|
|
394
|
-
dropped: []
|
|
395
|
-
};
|
|
396
|
-
let r;
|
|
397
|
-
try {
|
|
398
|
-
r = n.getPropertySignatures(e.ast).map((e) => String(e.name));
|
|
399
|
-
} catch {
|
|
400
|
-
return {
|
|
401
|
-
input: t,
|
|
402
|
-
dropped: []
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
if (r.length === 0) return {
|
|
406
|
-
input: t,
|
|
407
|
-
dropped: []
|
|
408
|
-
};
|
|
409
|
-
let i = new Set(r), a = Object.entries(t), o = a.filter(([e]) => !i.has(e)).map(([e]) => e);
|
|
410
|
-
return o.length === 0 ? {
|
|
411
|
-
input: t,
|
|
412
|
-
dropped: []
|
|
413
|
-
} : {
|
|
414
|
-
input: Object.fromEntries(a.filter(([e]) => i.has(e))),
|
|
415
|
-
dropped: o
|
|
416
|
-
};
|
|
417
|
-
}, M = (e, n, r) => {
|
|
418
|
-
let i = t.decodeUnknownEither(e, { errors: "all" })(n);
|
|
419
|
-
if (i._tag === "Right") return {
|
|
420
|
-
valid: !0,
|
|
421
|
-
errors: {},
|
|
422
|
-
issues: []
|
|
423
|
-
};
|
|
424
|
-
let a = k(i.left).map((t) => {
|
|
425
|
-
if (t.id !== "validation.minLength" && t.id !== "validation.maxLength") return t;
|
|
426
|
-
let n = ne(e, t.path);
|
|
427
|
-
return n.min === void 0 || n.max === void 0 ? t : n.min === n.max ? {
|
|
428
|
-
...t,
|
|
429
|
-
id: "validation.exactLength",
|
|
430
|
-
params: { amount: n.min }
|
|
431
|
-
} : {
|
|
432
|
-
...t,
|
|
433
|
-
id: "validation.betweenLength",
|
|
434
|
-
params: {
|
|
435
|
-
min: n.min,
|
|
436
|
-
max: n.max
|
|
437
|
-
}
|
|
438
|
-
};
|
|
439
|
-
}), o = {};
|
|
440
|
-
for (let e of a) e.path !== "" && !(e.path in o) && (o[e.path] = C(e, r));
|
|
441
|
-
return {
|
|
442
|
-
valid: !1,
|
|
443
|
-
errors: o,
|
|
444
|
-
issues: a
|
|
445
|
-
};
|
|
446
|
-
}, N = [
|
|
447
|
-
"bold",
|
|
448
|
-
"italic",
|
|
449
|
-
"code",
|
|
450
|
-
"strike"
|
|
451
|
-
], P = 5e3, re = (e) => {
|
|
452
|
-
let t = "";
|
|
453
|
-
for (let n of e) {
|
|
454
|
-
let e = n.codePointAt(0) ?? 0;
|
|
455
|
-
e > 32 && e !== 127 && (t += n);
|
|
456
|
-
}
|
|
457
|
-
return t.toLowerCase();
|
|
458
|
-
}, F = (e) => {
|
|
459
|
-
let t = re(e);
|
|
460
|
-
return t.length === 0 ? !1 : t.startsWith("#") || t.startsWith("/") ? !t.startsWith("//") : t.startsWith("https://") || t.startsWith("http://") || t.startsWith("mailto:");
|
|
461
|
-
}, I = t.String.pipe(t.filter((e) => F(e) || "href must be http(s), mailto:, a #fragment or a /path")), L = t.Struct({
|
|
462
|
-
type: t.Literal("text"),
|
|
463
|
-
text: t.String,
|
|
464
|
-
marks: t.optional(t.Array(t.Literal(...N)))
|
|
465
|
-
}), R = t.Struct({
|
|
466
|
-
type: t.Literal("link"),
|
|
467
|
-
href: I,
|
|
468
|
-
content: t.Array(L)
|
|
469
|
-
}), z = t.Union(L, R), B = t.Struct({
|
|
470
|
-
type: t.Literal("listItem"),
|
|
471
|
-
content: t.Array(z)
|
|
472
|
-
}), V = t.Union(t.Struct({
|
|
473
|
-
type: t.Literal("paragraph"),
|
|
474
|
-
content: t.Array(z)
|
|
475
|
-
}), t.Struct({
|
|
476
|
-
type: t.Literal("heading"),
|
|
477
|
-
level: t.Literal(1, 2, 3),
|
|
478
|
-
content: t.Array(z)
|
|
479
|
-
}), t.Struct({
|
|
480
|
-
type: t.Literal("blockquote"),
|
|
481
|
-
content: t.Array(z)
|
|
482
|
-
}), t.Struct({
|
|
483
|
-
type: t.Literal("bulletList"),
|
|
484
|
-
content: t.Array(B)
|
|
485
|
-
}), t.Struct({
|
|
486
|
-
type: t.Literal("orderedList"),
|
|
487
|
-
content: t.Array(B)
|
|
488
|
-
}), t.Struct({
|
|
489
|
-
type: t.Literal("codeBlock"),
|
|
490
|
-
text: t.String
|
|
491
|
-
})), H = (e) => {
|
|
492
|
-
let t = 1, n = (e) => {
|
|
493
|
-
for (let r of e) {
|
|
494
|
-
t += 1;
|
|
495
|
-
let e = r.content;
|
|
496
|
-
Array.isArray(e) && n(e);
|
|
497
|
-
}
|
|
498
|
-
};
|
|
499
|
-
return n(e.content), t;
|
|
500
|
-
}, U = t.Struct({
|
|
501
|
-
type: t.Literal("doc"),
|
|
502
|
-
content: t.Array(V)
|
|
503
|
-
}).pipe(t.filter((e) => H(e) <= 5e3 || "rich text document exceeds 5000 nodes"), t.annotations(r({ widget: "rich-text" }))), W = {
|
|
504
|
-
type: "doc",
|
|
505
|
-
content: []
|
|
506
|
-
}, G = (e) => typeof e == "object" && !!e && e.type === "doc" && Array.isArray(e.content), K = /(\*\*([^*]+)\*\*)|(~~([^~]+)~~)|(\*([^*]+)\*)|(`([^`]+)`)|(\[([^\]]*)\]\(([^)\s]+)\))/, q = (e, t) => t && t.length > 0 ? {
|
|
507
|
-
type: "text",
|
|
508
|
-
text: e,
|
|
509
|
-
marks: t
|
|
510
|
-
} : {
|
|
511
|
-
type: "text",
|
|
512
|
-
text: e
|
|
513
|
-
}, J = (e) => {
|
|
514
|
-
let t = [], n = e;
|
|
515
|
-
for (;;) {
|
|
516
|
-
let e = K.exec(n);
|
|
517
|
-
if (e === null || e.index === void 0) break;
|
|
518
|
-
e.index > 0 && t.push(q(n.slice(0, e.index))), e[2] === void 0 ? e[4] === void 0 ? e[6] === void 0 ? e[8] === void 0 ? e[11] !== void 0 && (F(e[11]) ? t.push({
|
|
519
|
-
type: "link",
|
|
520
|
-
href: e[11],
|
|
521
|
-
content: [{
|
|
522
|
-
type: "text",
|
|
523
|
-
text: e[10] ?? ""
|
|
524
|
-
}]
|
|
525
|
-
}) : t.push(q(e[0]))) : t.push(q(e[8], ["code"])) : t.push(q(e[6], ["italic"])) : t.push(q(e[4], ["strike"])) : t.push(q(e[2], ["bold"])), n = n.slice(e.index + e[0].length);
|
|
526
|
-
}
|
|
527
|
-
return n.length > 0 && t.push(q(n)), t;
|
|
528
|
-
}, Y = (e, t) => e.map((e) => ({
|
|
529
|
-
type: "listItem",
|
|
530
|
-
content: J(e.replace(t, ""))
|
|
531
|
-
})), ie = (e) => {
|
|
532
|
-
if (e.length === 0) return null;
|
|
533
|
-
let t = e[0];
|
|
534
|
-
if (t.startsWith("```")) return {
|
|
535
|
-
type: "codeBlock",
|
|
536
|
-
text: e.slice(1).filter((e) => !e.startsWith("```")).join("\n")
|
|
537
|
-
};
|
|
538
|
-
let n = /^(#{1,3})\s+(.*)$/.exec(t);
|
|
539
|
-
return n === null ? e.every((e) => /^[-*]\s+/.test(e)) ? {
|
|
540
|
-
type: "bulletList",
|
|
541
|
-
content: Y(e, /^[-*]\s+/)
|
|
542
|
-
} : e.every((e) => /^\d+\.\s+/.test(e)) ? {
|
|
543
|
-
type: "orderedList",
|
|
544
|
-
content: Y(e, /^\d+\.\s+/)
|
|
545
|
-
} : e.every((e) => e.startsWith(">")) ? {
|
|
546
|
-
type: "blockquote",
|
|
547
|
-
content: J(e.map((e) => e.replace(/^>\s?/, "")).join(" "))
|
|
548
|
-
} : {
|
|
549
|
-
type: "paragraph",
|
|
550
|
-
content: J(e.join(" "))
|
|
551
|
-
} : {
|
|
552
|
-
type: "heading",
|
|
553
|
-
level: n[1].length,
|
|
554
|
-
content: J(n[2])
|
|
555
|
-
};
|
|
556
|
-
}, X = (e) => {
|
|
557
|
-
let t = [], n = [], r = () => {
|
|
558
|
-
let e = ie(n);
|
|
559
|
-
e !== null && t.push(e), n = [];
|
|
560
|
-
};
|
|
561
|
-
for (let t of e.replace(/\r\n/g, "\n").split("\n")) t.trim() === "" ? r() : n.push(t);
|
|
562
|
-
return r(), {
|
|
563
|
-
type: "doc",
|
|
564
|
-
content: t
|
|
565
|
-
};
|
|
566
|
-
}, Z = (e) => e.map((e) => {
|
|
567
|
-
if (e.type === "link") return `[${e.content.map((e) => e.text).join("")}](${e.href})`;
|
|
568
|
-
let t = e.marks ?? [];
|
|
569
|
-
return t.includes("bold") ? `**${e.text}**` : t.includes("strike") ? `~~${e.text}~~` : t.includes("italic") ? `*${e.text}*` : t.includes("code") ? `\`${e.text}\`` : e.text;
|
|
570
|
-
}).join(""), ae = (e) => G(e) ? e.content.map((e) => {
|
|
571
|
-
switch (e.type) {
|
|
572
|
-
case "heading": return `${"#".repeat(e.level)} ${Z(e.content)}`;
|
|
573
|
-
case "bulletList": return e.content.map((e) => `- ${Z(e.content)}`).join("\n");
|
|
574
|
-
case "orderedList": return e.content.map((e, t) => `${t + 1}. ${Z(e.content)}`).join("\n");
|
|
575
|
-
case "blockquote": return `> ${Z(e.content)}`;
|
|
576
|
-
case "codeBlock": return [
|
|
577
|
-
"```",
|
|
578
|
-
e.text,
|
|
579
|
-
"```"
|
|
580
|
-
].join("\n");
|
|
581
|
-
default: return Z(e.content);
|
|
582
|
-
}
|
|
583
|
-
}).join("\n\n") : "", oe = (e) => {
|
|
584
|
-
if (!G(e)) return "";
|
|
585
|
-
let t = (e) => e.map((e) => e.type === "link" ? e.content.map((e) => e.text).join("") : e.text).join("");
|
|
586
|
-
return e.content.map((e) => {
|
|
587
|
-
switch (e.type) {
|
|
588
|
-
case "bulletList":
|
|
589
|
-
case "orderedList": return e.content.map((e) => t(e.content)).join("\n");
|
|
590
|
-
case "codeBlock": return e.text;
|
|
591
|
-
default: return t(e.content);
|
|
592
|
-
}
|
|
593
|
-
}).join("\n\n");
|
|
594
|
-
}, se = "__voltro_form_flash__", Q = "/form/", ce = (e) => `${Q}${encodeURIComponent(e)}`, le = "__voltro_form", ue = "__voltro_redirect", $ = (e) => {
|
|
595
|
-
let t = Number(e);
|
|
596
|
-
return Number.isNaN(t) ? e : t;
|
|
597
|
-
}, de = (e) => {
|
|
598
|
-
let t = e.jsonSchema.items;
|
|
599
|
-
if (!t || typeof t != "object") return;
|
|
600
|
-
let n = t.type;
|
|
601
|
-
return typeof n == "string" ? n : void 0;
|
|
602
|
-
}, fe = (e, t) => {
|
|
603
|
-
switch (e.widget) {
|
|
604
|
-
case "rich-text": return t === "" ? {
|
|
605
|
-
type: "doc",
|
|
606
|
-
content: []
|
|
607
|
-
} : X(t);
|
|
608
|
-
case "number": return t === "" ? void 0 : $(t);
|
|
609
|
-
case "date":
|
|
610
|
-
case "datetime": return t === "" ? void 0 : t;
|
|
611
|
-
default: return t;
|
|
612
|
-
}
|
|
613
|
-
}, pe = (e, t) => {
|
|
614
|
-
let n = /* @__PURE__ */ new Map();
|
|
615
|
-
for (let [e, r] of t) {
|
|
616
|
-
let t = n.get(e);
|
|
617
|
-
t === void 0 ? n.set(e, [r]) : t.push(r);
|
|
618
|
-
}
|
|
619
|
-
let r = {}, i = (e, t) => {
|
|
620
|
-
let n = e.split("."), i = r;
|
|
621
|
-
for (let e of n.slice(0, -1)) {
|
|
622
|
-
let t = i[e];
|
|
623
|
-
if (typeof t != "object" || !t) {
|
|
624
|
-
let t = {};
|
|
625
|
-
i[e] = t, i = t;
|
|
626
|
-
} else i = t;
|
|
627
|
-
}
|
|
628
|
-
i[n[n.length - 1]] = t;
|
|
629
|
-
};
|
|
630
|
-
for (let t of _(e)) {
|
|
631
|
-
if (t.widget === "array") continue;
|
|
632
|
-
let e = n.get(t.name);
|
|
633
|
-
if (t.widget === "checkbox" || t.widget === "switch") {
|
|
634
|
-
i(t.name, e !== void 0);
|
|
635
|
-
continue;
|
|
636
|
-
}
|
|
637
|
-
if (t.widget === "multi-select") {
|
|
638
|
-
let n = de(t), r = e ?? [];
|
|
639
|
-
i(t.name, n === "number" || n === "integer" ? r.filter((e) => e !== "").map($) : r.filter((e) => e !== ""));
|
|
640
|
-
continue;
|
|
641
|
-
}
|
|
642
|
-
if (e === void 0) continue;
|
|
643
|
-
let r = fe(t, e[0]);
|
|
644
|
-
r !== void 0 && i(t.name, r);
|
|
645
|
-
}
|
|
646
|
-
return r;
|
|
647
|
-
};
|
|
648
|
-
//#endregion
|
|
649
|
-
export { v as C, y as S, S as _, ce as a, M as b, P as c, G as d, F as f, k as g, ae as h, ue as i, U as l, oe as m, le as n, pe as o, X as p, Q as r, N as s, se as t, W as u, C as v, _ as w, r as x, j as y };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { i as e, m as t, n, t as r, u as i } from "./runRpc-DvHpFZAZ.js";
|
|
2
|
-
import { createContext as a, useContext as o, useEffect as s } from "react";
|
|
3
|
-
import { Effect as c, Exit as l, Option as u, Stream as d } from "effect";
|
|
4
|
-
import { firstEventValue as f } from "@voltro/protocol";
|
|
5
|
-
//#region src/runtimeContext.ts
|
|
6
|
-
var p = a(null), m = () => {
|
|
7
|
-
throw Error("Voltro: rpc / cache calls are not invokable on a not-yet-resolved api — either during SSR, or in the client boot window before the api client resolves");
|
|
8
|
-
}, h = new Proxy(() => m(), {
|
|
9
|
-
get: (e, t) => h,
|
|
10
|
-
has: () => !0,
|
|
11
|
-
apply: () => m()
|
|
12
|
-
}), g = Symbol.for("@voltro/client/ssrDescriptors"), _ = globalThis, v = _[g] ?? (_[g] = { byApi: /* @__PURE__ */ new Map() }), y = (e, t) => {
|
|
13
|
-
v.byApi.set(e, t);
|
|
14
|
-
}, b = (e) => v.byApi.get(e), x = () => {
|
|
15
|
-
v.byApi.clear();
|
|
16
|
-
}, S = {
|
|
17
|
-
runtime: { runPromiseExit: () => Promise.resolve(l.die(/* @__PURE__ */ Error("Voltro: mutations are not invokable during SSR"))) },
|
|
18
|
-
cache: new t(),
|
|
19
|
-
client: h,
|
|
20
|
-
descriptors: {},
|
|
21
|
-
inspectBaseUrl: "",
|
|
22
|
-
errorBus: new i(),
|
|
23
|
-
recovery: new e("ssr")
|
|
24
|
-
}, C = {
|
|
25
|
-
get: (e) => {
|
|
26
|
-
let t = b(e);
|
|
27
|
-
return t === void 0 ? S : {
|
|
28
|
-
...S,
|
|
29
|
-
descriptors: t
|
|
30
|
-
};
|
|
31
|
-
},
|
|
32
|
-
names: []
|
|
33
|
-
}, w = !1, T = !1, E = null, D = () => {
|
|
34
|
-
w = !1, T = !1, E !== null && (clearTimeout(E), E = null);
|
|
35
|
-
}, O = () => {
|
|
36
|
-
let e = o(p);
|
|
37
|
-
return e ? (T || (T = !0, E !== null && (clearTimeout(E), E = null)), e) : (globalThis.window !== void 0 && !w && !T && E === null && process.env.NODE_ENV !== "production" && (E = setTimeout(() => {
|
|
38
|
-
E = null, !(w || T) && (w = !0, console.warn("useFrameworkRuntimes: no <FrameworkRuntimesProvider> in the tree — returning a loading baseline (subscriptions read `undefined`, mutations are no-ops). If this is not an intentional lazy/conditional mount, mount your app via @voltro/web mount() or wrap the subtree in <VoltroRuntimeProvider>."));
|
|
39
|
-
}, 0)), C);
|
|
40
|
-
}, k = (e) => {
|
|
41
|
-
let t = O(), n = t.demand;
|
|
42
|
-
return s(() => {
|
|
43
|
-
n?.(e);
|
|
44
|
-
}, [n, e]), t.get(e);
|
|
45
|
-
}, A = (e) => typeof e.runtime?.runFork != "function", j = 15e3, M = async (e, t, n) => {
|
|
46
|
-
if (!A(e.current)) return e.current;
|
|
47
|
-
let r = Date.now() + j;
|
|
48
|
-
for (; Date.now() < r;) if (await new Promise((e) => setTimeout(e, 16)), !A(e.current)) return e.current;
|
|
49
|
-
throw Error(`Voltro: the api "${t}" did not resolve within ${j}ms, so ${n} was never sent. This is not the boot window — that is waited out. Check that "${t}" is a configured api name and that its client could connect.`);
|
|
50
|
-
}, N = async (e, t, i, a, o) => {
|
|
51
|
-
let { runtime: s, client: l } = await M(e, t, i), p = n(l, i)(a ?? {}), m = c.isEffect(p) ? p : d.runHead(p).pipe(c.map(u.getOrUndefined)), h = await r(s, m, { signal: o });
|
|
52
|
-
return f(i, h, "[loader.query]");
|
|
53
|
-
};
|
|
54
|
-
//#endregion
|
|
55
|
-
export { x as a, h as c, k as d, O as f, D as i, b as l, M as n, A as o, p as r, y as s, N as t, S as u };
|