mlform 0.1.20 → 0.1.22
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/README.md +2 -2
- package/dist/{builtins-CUN_bP93.js → builtins-B2U_ViF6.js} +7 -7
- package/dist/mlform/builtins.mjs +1 -1
- package/dist/mlform/kit.mjs +8 -8
- package/dist/mlform/primitives.mjs +1 -1
- package/dist/mlform/runtime.mjs +1 -1
- package/dist/mlform/schema.mjs +2 -2
- package/dist/{primitives-CgFaSmAm.js → primitives-ljp3c5R8.js} +4 -8
- package/dist/{runtime-zS0p2589.js → runtime-C9ZioNpI.js} +294 -304
- package/dist/{schema-CYsf2AFP.js → schema-CiCjXECD.js} +110 -63
- package/dist/types/src/primitives/controller-types.d.ts +8 -16
- package/dist/types/src/runtime/submission/request.d.ts +0 -4
- package/dist/types/src/runtime/types/behavior.d.ts +0 -4
- package/dist/types/src/runtime/types/transport.d.ts +0 -12
- package/dist/types/src/schema/mapped-to.d.ts +5 -0
- package/dist/types/src/schema/normalize.d.ts +5 -0
- package/dist/types/src/schema/report-context.d.ts +2 -2
- package/dist/types/src/schema/types/report.d.ts +4 -8
- package/dist/types/src/schema/types/submit.d.ts +4 -8
- package/dist/types/src/transport/types.d.ts +3 -7
- package/package.json +1 -1
|
@@ -72,35 +72,72 @@ var t = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/
|
|
|
72
72
|
listReports() {
|
|
73
73
|
return Array.from(this.reportDefinitions.values());
|
|
74
74
|
}
|
|
75
|
-
}, u = () => new l(), d = (e) => e, f = (e) => e, p =
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}, m = (e, t) => {
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
-
|
|
75
|
+
}, u = () => new l(), d = (e) => e, f = (e) => e, p = class extends Error {
|
|
76
|
+
path;
|
|
77
|
+
code;
|
|
78
|
+
constructor(e, t, n = "invalid-config") {
|
|
79
|
+
super(e), this.path = t, this.code = n, this.name = "SchemaNormalizationError";
|
|
80
|
+
}
|
|
81
|
+
}, m = (e, t, n, r, i) => {
|
|
82
|
+
if (typeof n != "object" || !n) throw new p(`Series field "${e}" requires "${t}" configuration.`, [
|
|
83
|
+
"fields",
|
|
84
|
+
i,
|
|
85
|
+
t
|
|
86
|
+
]);
|
|
87
|
+
let a = "kind" in n && typeof n.kind == "string" ? n.kind : "";
|
|
88
|
+
if (a.length === 0) throw new p(`Series field "${e}" requires "${t}.kind".`, [
|
|
89
|
+
"fields",
|
|
90
|
+
i,
|
|
91
|
+
t,
|
|
92
|
+
"kind"
|
|
93
|
+
]);
|
|
94
|
+
if (a === "series") throw new p(`Series field "${e}" cannot nest series in "${t}".`, [
|
|
95
|
+
"fields",
|
|
96
|
+
i,
|
|
97
|
+
t,
|
|
98
|
+
"kind"
|
|
99
|
+
]);
|
|
100
|
+
if (!r.getField(a)) throw new p(`Series field "${e}" uses unknown sub-field kind "${a}" in "${t}".`, [
|
|
101
|
+
"fields",
|
|
102
|
+
i,
|
|
103
|
+
t,
|
|
104
|
+
"kind"
|
|
105
|
+
], "unknown-kind");
|
|
106
|
+
}, h = (e, t, n) => {
|
|
107
|
+
if (e.kind === "series" && (m(e.label, "field1", e.field1, t, n), m(e.label, "field2", e.field2, t, n), typeof e.minPoints == "number" && typeof e.maxPoints == "number" && e.minPoints > e.maxPoints)) throw new p(`Series field "${e.label}" requires minPoints to be less than or equal to maxPoints.`, [
|
|
108
|
+
"fields",
|
|
109
|
+
n,
|
|
110
|
+
"minPoints"
|
|
111
|
+
]);
|
|
112
|
+
}, g = (e, n, r, i, a) => {
|
|
113
|
+
let o = t((e ?? n) || i);
|
|
85
114
|
if (e) {
|
|
86
|
-
if (r.has(
|
|
87
|
-
return r.add(
|
|
115
|
+
if (r.has(o)) throw new p(`Duplicate explicit id "${o}" in schema.`, a);
|
|
116
|
+
return r.add(o), o;
|
|
88
117
|
}
|
|
89
|
-
let
|
|
90
|
-
for (; r.has(
|
|
91
|
-
return r.add(
|
|
92
|
-
},
|
|
118
|
+
let s = o, c = 2;
|
|
119
|
+
for (; r.has(s);) s = `${o}-${c}`, c += 1;
|
|
120
|
+
return r.add(s), s;
|
|
121
|
+
}, _ = (e, t, n, r) => {
|
|
93
122
|
let i = n.getField(e.kind);
|
|
94
123
|
if (!i) throw new c(`Unknown field kind "${e.kind}".`);
|
|
95
124
|
let a = i.schema.parse(e);
|
|
96
|
-
return
|
|
125
|
+
return h(a, n, t), {
|
|
97
126
|
...a,
|
|
98
|
-
id:
|
|
127
|
+
id: g(a.id, a.label, r, `field-${t + 1}`, [
|
|
128
|
+
"fields",
|
|
129
|
+
t,
|
|
130
|
+
"id"
|
|
131
|
+
])
|
|
99
132
|
};
|
|
100
|
-
},
|
|
133
|
+
}, v = (e, t, n, r) => {
|
|
101
134
|
let i = n.getReport(e.kind);
|
|
102
135
|
if (!i) throw new c(`Unknown report kind "${e.kind}".`);
|
|
103
|
-
let a = i.schema.parse(e), o =
|
|
136
|
+
let a = i.schema.parse(e), o = g(e.id ?? a.id, e.label ?? a.label ?? a.kind, r, `report-${t + 1}`, [
|
|
137
|
+
"reports",
|
|
138
|
+
t,
|
|
139
|
+
"id"
|
|
140
|
+
]);
|
|
104
141
|
return {
|
|
105
142
|
...a,
|
|
106
143
|
...e.label === void 0 ? {} : { label: e.label },
|
|
@@ -109,13 +146,13 @@ var t = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/
|
|
|
109
146
|
...e.ui === void 0 ? {} : { ui: e.ui },
|
|
110
147
|
id: o
|
|
111
148
|
};
|
|
112
|
-
},
|
|
113
|
-
let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = (e.reports ?? []).map((e, n) =>
|
|
149
|
+
}, y = (e, t) => {
|
|
150
|
+
let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = (e.reports ?? []).map((e, n) => v(e, n, t, r));
|
|
114
151
|
return {
|
|
115
|
-
fields: e.fields.map((e, r) =>
|
|
152
|
+
fields: e.fields.map((e, r) => _(e, r, t, n)),
|
|
116
153
|
reports: i
|
|
117
154
|
};
|
|
118
|
-
},
|
|
155
|
+
}, b = (e) => e === 1 || e === "1" || e === !0, x = (e, t, i = {}) => {
|
|
119
156
|
if (e.kind !== "onehot-category" || !Array.isArray(e.options)) return;
|
|
120
157
|
let a = /* @__PURE__ */ new Set(), o;
|
|
121
158
|
for (let s of e.options) {
|
|
@@ -123,20 +160,20 @@ var t = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/
|
|
|
123
160
|
if (c === void 0) throw Error(`onehot-category "${e.id ?? e.kind}": option "${s.value}" has no mappedTo.`);
|
|
124
161
|
let l = r(c);
|
|
125
162
|
if (a.has(l)) throw Error(`onehot-category "${e.id ?? e.kind}": duplicate mappedTo "${l}".`);
|
|
126
|
-
if (a.add(l),
|
|
163
|
+
if (a.add(l), b(t[l])) {
|
|
127
164
|
if (o !== void 0) throw Error(`onehot-category "${e.id ?? e.kind}": multiple selected mapped values.`);
|
|
128
165
|
o = s.value;
|
|
129
166
|
}
|
|
130
167
|
}
|
|
131
168
|
return o;
|
|
132
|
-
},
|
|
169
|
+
}, S = (e) => {
|
|
133
170
|
if (typeof e == "string") return e;
|
|
134
171
|
if (typeof e != "number") return e.id ?? e.config?.id;
|
|
135
|
-
},
|
|
172
|
+
}, C = (e, t) => {
|
|
136
173
|
if (typeof e == "string" || typeof e == "number") return String(e);
|
|
137
174
|
let i = n(e.mappedTo ?? e.config?.mappedTo, t);
|
|
138
175
|
return i === void 0 ? void 0 : r(i);
|
|
139
|
-
},
|
|
176
|
+
}, w = (e, t) => Object.fromEntries(e.map((e) => {
|
|
140
177
|
let i = o(e, t), a = i?.context, s = i?.mappedTo ?? n(e.mappedTo, t.backend);
|
|
141
178
|
return [e.id, {
|
|
142
179
|
reportId: e.id,
|
|
@@ -146,25 +183,25 @@ var t = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/
|
|
|
146
183
|
target: s,
|
|
147
184
|
targetKey: s === void 0 ? void 0 : r(s),
|
|
148
185
|
backend: i?.backend ?? t.backend,
|
|
149
|
-
displayValues: a?.displayValues ?? t.displayValues
|
|
150
|
-
modelValues: a?.modelValues ?? t.modelValues
|
|
186
|
+
displayValues: a?.displayValues ?? t.displayValues,
|
|
187
|
+
modelValues: a?.modelValues ?? t.modelValues,
|
|
151
188
|
reports: t.reports,
|
|
152
189
|
meta: a?.meta ?? t.meta,
|
|
153
190
|
raw: a && "raw" in a ? a.raw : t.raw
|
|
154
191
|
}];
|
|
155
|
-
})),
|
|
156
|
-
let n = e.reportContexts
|
|
192
|
+
})), T = (e, t) => {
|
|
193
|
+
let n = e.reportContexts, r = S(t);
|
|
157
194
|
if (r && n[r]) return n[r];
|
|
158
|
-
let i =
|
|
195
|
+
let i = C(t, e.backend);
|
|
159
196
|
if (i === void 0) return;
|
|
160
197
|
let a = Object.values(n).filter((t) => t.targetKey === i && (e.backend === void 0 || t.backend === e.backend));
|
|
161
198
|
return a.length === 1 ? a[0] : void 0;
|
|
162
|
-
},
|
|
163
|
-
if (!
|
|
199
|
+
}, E = (e) => typeof e == "object" && !!e && !Array.isArray(e), D = (e, t) => {
|
|
200
|
+
if (!E(e)) return [];
|
|
164
201
|
let n = [], r = (r) => {
|
|
165
202
|
let i = e[r];
|
|
166
203
|
Array.isArray(i) && i.forEach((e, i) => {
|
|
167
|
-
!
|
|
204
|
+
if (!(!E(e) || typeof e.kind != "string") && ((r === "fields" ? t.getField(e.kind) : t.getReport(e.kind)) || n.push({
|
|
168
205
|
section: r,
|
|
169
206
|
index: i,
|
|
170
207
|
kind: e.kind,
|
|
@@ -173,11 +210,24 @@ var t = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/
|
|
|
173
210
|
i,
|
|
174
211
|
"kind"
|
|
175
212
|
]
|
|
176
|
-
})
|
|
213
|
+
}), r === "fields" && e.kind === "series")) for (let a of ["field1", "field2"]) {
|
|
214
|
+
let o = e[a];
|
|
215
|
+
!E(o) || typeof o.kind != "string" || t.getField(o.kind) || n.push({
|
|
216
|
+
section: r,
|
|
217
|
+
index: i,
|
|
218
|
+
kind: o.kind,
|
|
219
|
+
path: [
|
|
220
|
+
r,
|
|
221
|
+
i,
|
|
222
|
+
a,
|
|
223
|
+
"kind"
|
|
224
|
+
]
|
|
225
|
+
});
|
|
226
|
+
}
|
|
177
227
|
});
|
|
178
228
|
};
|
|
179
229
|
return r("fields"), r("reports"), n;
|
|
180
|
-
},
|
|
230
|
+
}, O = (e, t, n, r) => {
|
|
181
231
|
if (!Array.isArray(t)) {
|
|
182
232
|
r.push({
|
|
183
233
|
path: [e],
|
|
@@ -187,7 +237,7 @@ var t = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/
|
|
|
187
237
|
return;
|
|
188
238
|
}
|
|
189
239
|
t.forEach((t, i) => {
|
|
190
|
-
if (!
|
|
240
|
+
if (!E(t)) {
|
|
191
241
|
r.push({
|
|
192
242
|
path: [e, i],
|
|
193
243
|
message: `${e === "fields" ? "Field" : "Report"} must be an object.`,
|
|
@@ -220,8 +270,8 @@ var t = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/
|
|
|
220
270
|
code: "invalid-config"
|
|
221
271
|
});
|
|
222
272
|
});
|
|
223
|
-
},
|
|
224
|
-
if (!
|
|
273
|
+
}, k = (e, t) => {
|
|
274
|
+
if (!E(e)) return {
|
|
225
275
|
success: !1,
|
|
226
276
|
issues: [{
|
|
227
277
|
path: [],
|
|
@@ -235,8 +285,8 @@ var t = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/
|
|
|
235
285
|
message: `Unsupported schema property "${t}".`,
|
|
236
286
|
code: "invalid-schema"
|
|
237
287
|
});
|
|
238
|
-
|
|
239
|
-
for (let r of
|
|
288
|
+
O("fields", e.fields, t, n), O("reports", e.reports ?? [], t, n);
|
|
289
|
+
for (let r of D(e, t)) n.push({
|
|
240
290
|
path: r.path,
|
|
241
291
|
message: `Unknown ${r.section === "fields" ? "field" : "report"} kind "${r.kind}".`,
|
|
242
292
|
code: "unknown-kind"
|
|
@@ -248,26 +298,27 @@ var t = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/
|
|
|
248
298
|
try {
|
|
249
299
|
return {
|
|
250
300
|
success: !0,
|
|
251
|
-
data:
|
|
301
|
+
data: y(e, t),
|
|
252
302
|
issues: []
|
|
253
303
|
};
|
|
254
304
|
} catch (e) {
|
|
305
|
+
let t = e instanceof p ? e : void 0;
|
|
255
306
|
return {
|
|
256
307
|
success: !1,
|
|
257
308
|
issues: [{
|
|
258
|
-
path: [],
|
|
309
|
+
path: t?.path ?? [],
|
|
259
310
|
message: e instanceof Error ? e.message : "Schema normalization failed.",
|
|
260
|
-
code: "invalid-schema"
|
|
311
|
+
code: t?.code ?? "invalid-schema"
|
|
261
312
|
}]
|
|
262
313
|
};
|
|
263
314
|
}
|
|
264
|
-
},
|
|
315
|
+
}, A = (t) => t.map((t) => e(t.schema, {
|
|
265
316
|
io: "input",
|
|
266
317
|
unrepresentable: "any"
|
|
267
|
-
})),
|
|
268
|
-
let t =
|
|
318
|
+
})), j = (e) => {
|
|
319
|
+
let t = A(e);
|
|
269
320
|
return t.length > 0 ? { oneOf: t } : !1;
|
|
270
|
-
},
|
|
321
|
+
}, M = (e) => ({
|
|
271
322
|
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
272
323
|
type: "object",
|
|
273
324
|
additionalProperties: !1,
|
|
@@ -275,29 +326,25 @@ var t = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/
|
|
|
275
326
|
properties: {
|
|
276
327
|
fields: {
|
|
277
328
|
type: "array",
|
|
278
|
-
items:
|
|
329
|
+
items: j(e.listFields())
|
|
279
330
|
},
|
|
280
331
|
reports: {
|
|
281
332
|
type: "array",
|
|
282
|
-
items:
|
|
333
|
+
items: j(e.listReports())
|
|
283
334
|
}
|
|
284
335
|
}
|
|
285
|
-
}),
|
|
336
|
+
}), N = (e, t = {}) => ({
|
|
286
337
|
reportId: t.reportId ?? "",
|
|
287
338
|
backend: e.backend,
|
|
288
|
-
inputs: e.inputs
|
|
289
|
-
displayValues: e.displayValues
|
|
290
|
-
modelValues: e.modelValues
|
|
291
|
-
values: e.values,
|
|
292
|
-
fieldValues: e.fieldValues,
|
|
293
|
-
serializedValues: e.serializedValues,
|
|
294
|
-
serializedFieldValues: e.serializedFieldValues,
|
|
339
|
+
inputs: e.inputs,
|
|
340
|
+
displayValues: e.displayValues,
|
|
341
|
+
modelValues: e.modelValues,
|
|
295
342
|
reports: e.reports,
|
|
296
|
-
reportContext: t.reportId === void 0 ? void 0 :
|
|
297
|
-
reportContexts: e.reportContexts
|
|
343
|
+
reportContext: t.reportId === void 0 ? void 0 : T(e, t.reportId),
|
|
344
|
+
reportContexts: e.reportContexts,
|
|
298
345
|
meta: e.meta,
|
|
299
346
|
raw: e.raw,
|
|
300
347
|
signal: t.signal
|
|
301
348
|
});
|
|
302
349
|
//#endregion
|
|
303
|
-
export {
|
|
350
|
+
export { a as _, w as a, t as b, p as c, u as d, d as f, o as g, s as h, k as i, y as l, r as m, D as n, T as o, f as p, M as r, x as s, N as t, c as u, i as v, n as y };
|
|
@@ -18,15 +18,11 @@ export interface PrimitiveReportStateSnapshot {
|
|
|
18
18
|
}
|
|
19
19
|
export interface PrimitiveSubmitResult {
|
|
20
20
|
backend?: string;
|
|
21
|
-
inputs
|
|
22
|
-
displayValues
|
|
23
|
-
modelValues
|
|
24
|
-
values: Record<string, unknown>;
|
|
25
|
-
fieldValues: Record<string, unknown>;
|
|
26
|
-
serializedValues: Record<string, unknown>;
|
|
27
|
-
serializedFieldValues: Record<string, unknown>;
|
|
21
|
+
inputs: PrimitiveSubmissionInputRecord[];
|
|
22
|
+
displayValues: Record<string, unknown>;
|
|
23
|
+
modelValues: Record<string, unknown>;
|
|
28
24
|
reports: readonly unknown[];
|
|
29
|
-
reportContexts
|
|
25
|
+
reportContexts: Record<string, PrimitiveReportContext>;
|
|
30
26
|
reportStates: Record<string, unknown>;
|
|
31
27
|
meta: Record<string, unknown>;
|
|
32
28
|
raw: unknown;
|
|
@@ -114,16 +110,12 @@ export interface PrimitiveSubmitExecutionResult {
|
|
|
114
110
|
export interface PrimitiveReportRequest {
|
|
115
111
|
reportId: string;
|
|
116
112
|
backend?: string;
|
|
117
|
-
inputs
|
|
118
|
-
displayValues
|
|
119
|
-
modelValues
|
|
120
|
-
values: Record<string, unknown>;
|
|
121
|
-
fieldValues: Record<string, unknown>;
|
|
122
|
-
serializedValues: Record<string, unknown>;
|
|
123
|
-
serializedFieldValues: Record<string, unknown>;
|
|
113
|
+
inputs: PrimitiveSubmissionInputRecord[];
|
|
114
|
+
displayValues: Record<string, unknown>;
|
|
115
|
+
modelValues: Record<string, unknown>;
|
|
124
116
|
reports: readonly unknown[];
|
|
125
117
|
reportContext?: PrimitiveReportContext;
|
|
126
|
-
reportContexts
|
|
118
|
+
reportContexts: Record<string, PrimitiveReportContext>;
|
|
127
119
|
meta: Record<string, unknown>;
|
|
128
120
|
raw: unknown;
|
|
129
121
|
signal?: AbortSignal;
|
|
@@ -14,10 +14,6 @@ export type SubmissionValueRecords = {
|
|
|
14
14
|
inputs: SubmissionInputRecord[];
|
|
15
15
|
displayValues: Record<string, unknown>;
|
|
16
16
|
modelValues: Record<string, unknown>;
|
|
17
|
-
values: Record<string, unknown>;
|
|
18
|
-
fieldValues: Record<string, unknown>;
|
|
19
|
-
serializedValues: Record<string, unknown>;
|
|
20
|
-
serializedFieldValues: Record<string, unknown>;
|
|
21
17
|
};
|
|
22
18
|
export declare const cloneSubmissionValueRecords: (records: SubmissionValueRecords) => SubmissionValueRecords;
|
|
23
19
|
export declare const shouldIncludeFieldInSubmission: (field: SubmissionField, resolveInactiveFieldPolicy: (field: SubmissionField) => "include" | "omit" | "reset-on-hide") => boolean;
|
|
@@ -10,10 +10,6 @@ export interface RuntimeBehaviorSubmissionRecords {
|
|
|
10
10
|
inputs: SubmissionInputRecord[];
|
|
11
11
|
displayValues: Record<string, unknown>;
|
|
12
12
|
modelValues: Record<string, unknown>;
|
|
13
|
-
values: Record<string, unknown>;
|
|
14
|
-
fieldValues: Record<string, unknown>;
|
|
15
|
-
serializedValues: Record<string, unknown>;
|
|
16
|
-
serializedFieldValues: Record<string, unknown>;
|
|
17
13
|
}
|
|
18
14
|
export interface RuntimeBehaviorContext {
|
|
19
15
|
readonly registry: Registry;
|
|
@@ -17,10 +17,6 @@ export interface BeforeSubmitContext {
|
|
|
17
17
|
inputs: SubmissionInputRecord[];
|
|
18
18
|
displayValues: Record<string, unknown>;
|
|
19
19
|
modelValues: Record<string, unknown>;
|
|
20
|
-
values: Record<string, unknown>;
|
|
21
|
-
fieldValues: Record<string, unknown>;
|
|
22
|
-
serializedValues: Record<string, unknown>;
|
|
23
|
-
serializedFieldValues: Record<string, unknown>;
|
|
24
20
|
submitCount: number;
|
|
25
21
|
signal: AbortSignal;
|
|
26
22
|
}
|
|
@@ -29,10 +25,6 @@ export interface AfterSubmitContext {
|
|
|
29
25
|
inputs: SubmissionInputRecord[];
|
|
30
26
|
displayValues: Record<string, unknown>;
|
|
31
27
|
modelValues: Record<string, unknown>;
|
|
32
|
-
values: Record<string, unknown>;
|
|
33
|
-
fieldValues: Record<string, unknown>;
|
|
34
|
-
serializedValues: Record<string, unknown>;
|
|
35
|
-
serializedFieldValues: Record<string, unknown>;
|
|
36
28
|
submitCount: number;
|
|
37
29
|
result: SubmitResult;
|
|
38
30
|
}
|
|
@@ -41,10 +33,6 @@ export interface SubmitErrorContext {
|
|
|
41
33
|
inputs: SubmissionInputRecord[];
|
|
42
34
|
displayValues: Record<string, unknown>;
|
|
43
35
|
modelValues: Record<string, unknown>;
|
|
44
|
-
values: Record<string, unknown>;
|
|
45
|
-
fieldValues: Record<string, unknown>;
|
|
46
|
-
serializedValues: Record<string, unknown>;
|
|
47
|
-
serializedFieldValues: Record<string, unknown>;
|
|
48
36
|
submitCount: number;
|
|
49
37
|
error: unknown;
|
|
50
38
|
}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { ReportResult } from './types/submit';
|
|
2
2
|
export type MappedToTarget = string | number;
|
|
3
3
|
export type MappedTo = MappedToTarget | Record<string, MappedToTarget | null | undefined>;
|
|
4
|
+
export type MappedToRoute = {
|
|
5
|
+
backend: string;
|
|
6
|
+
mappedTo: MappedToTarget;
|
|
7
|
+
};
|
|
4
8
|
export declare const resolveMappedTo: (mappedTo: MappedTo | undefined, backend: string | undefined) => MappedToTarget | undefined;
|
|
5
9
|
export declare const mappedToKey: (target: MappedToTarget) => string;
|
|
6
10
|
export declare const resolveMappedTargets: (mappedTo: MappedTo | undefined, backend: string | undefined) => MappedToTarget[];
|
|
11
|
+
export declare const resolveMappedRoutes: (mappedTo: MappedTo | undefined, backend: string | undefined) => MappedToRoute[];
|
|
7
12
|
export declare const resolveMappedReportResult: (report: {
|
|
8
13
|
mappedTo?: MappedTo;
|
|
9
14
|
}, result: {
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { FormSchema, NormalizedFormSchema, Registry } from './index';
|
|
2
|
+
export declare class SchemaNormalizationError extends Error {
|
|
3
|
+
readonly path: readonly (string | number)[];
|
|
4
|
+
readonly code: "invalid-config" | "unknown-kind";
|
|
5
|
+
constructor(message: string, path: readonly (string | number)[], code?: "invalid-config" | "unknown-kind");
|
|
6
|
+
}
|
|
2
7
|
export declare const normalizeSchema: (schema: FormSchema, registry: Registry) => NormalizedFormSchema;
|
|
@@ -2,7 +2,7 @@ import { MappedTo } from './mapped-to';
|
|
|
2
2
|
import { NormalizedReportConfig } from './types/report';
|
|
3
3
|
import { ReportContext, SubmitResult } from './types/submit';
|
|
4
4
|
type ReportContextSource = Pick<SubmitResult, "backend"> & {
|
|
5
|
-
reportContexts
|
|
5
|
+
reportContexts: Record<string, ReportContext>;
|
|
6
6
|
};
|
|
7
7
|
type ReportContextLookup = string | number | {
|
|
8
8
|
id?: string;
|
|
@@ -12,6 +12,6 @@ type ReportContextLookup = string | number | {
|
|
|
12
12
|
mappedTo?: MappedTo;
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
|
-
export declare const createReportContexts: (reports: readonly NormalizedReportConfig[], result: Pick<SubmitResult, "backend" | "displayValues" | "modelValues" | "
|
|
15
|
+
export declare const createReportContexts: (reports: readonly NormalizedReportConfig[], result: Pick<SubmitResult, "backend" | "displayValues" | "modelValues" | "reports" | "meta" | "raw">) => Record<string, ReportContext>;
|
|
16
16
|
export declare const getReportContext: (source: ReportContextSource, lookup: ReportContextLookup) => ReportContext | undefined;
|
|
17
17
|
export {};
|
|
@@ -35,16 +35,12 @@ export interface ReportResolveContext<TConfig extends ReportConfig = ReportConfi
|
|
|
35
35
|
export interface ReportFetchRequest {
|
|
36
36
|
reportId: string;
|
|
37
37
|
backend?: string;
|
|
38
|
-
inputs
|
|
39
|
-
displayValues
|
|
40
|
-
modelValues
|
|
41
|
-
values: Record<string, unknown>;
|
|
42
|
-
fieldValues: Record<string, unknown>;
|
|
43
|
-
serializedValues: Record<string, unknown>;
|
|
44
|
-
serializedFieldValues: Record<string, unknown>;
|
|
38
|
+
inputs: SubmissionInputRecord[];
|
|
39
|
+
displayValues: Record<string, unknown>;
|
|
40
|
+
modelValues: Record<string, unknown>;
|
|
45
41
|
reports: readonly unknown[];
|
|
46
42
|
reportContext?: ReportContext;
|
|
47
|
-
reportContexts
|
|
43
|
+
reportContexts: Record<string, ReportContext>;
|
|
48
44
|
meta: Record<string, unknown>;
|
|
49
45
|
raw: unknown;
|
|
50
46
|
signal?: AbortSignal;
|
|
@@ -46,15 +46,11 @@ export type ReportResult = (BaseReportResult & {
|
|
|
46
46
|
});
|
|
47
47
|
export interface SubmitResult<TReportState = unknown> {
|
|
48
48
|
backend?: string;
|
|
49
|
-
inputs
|
|
50
|
-
displayValues
|
|
51
|
-
modelValues
|
|
52
|
-
values: Record<string, unknown>;
|
|
53
|
-
fieldValues: Record<string, unknown>;
|
|
54
|
-
serializedValues: Record<string, unknown>;
|
|
55
|
-
serializedFieldValues: Record<string, unknown>;
|
|
49
|
+
inputs: SubmissionInputRecord[];
|
|
50
|
+
displayValues: Record<string, unknown>;
|
|
51
|
+
modelValues: Record<string, unknown>;
|
|
56
52
|
reports: readonly ReportResult[];
|
|
57
|
-
reportContexts
|
|
53
|
+
reportContexts: Record<string, ReportContext>;
|
|
58
54
|
reportStates: Record<string, TReportState>;
|
|
59
55
|
meta: Record<string, unknown>;
|
|
60
56
|
raw: unknown;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { ReportResult, SubmissionInputRecord } from '../../schema';
|
|
2
2
|
export interface SubmitRequest<TField extends Record<string, unknown> = Record<string, unknown>, TReport extends Record<string, unknown> = Record<string, unknown>> {
|
|
3
3
|
backend?: string;
|
|
4
|
-
inputs
|
|
5
|
-
displayValues
|
|
6
|
-
modelValues
|
|
7
|
-
values: Record<string, unknown>;
|
|
8
|
-
fieldValues: Record<string, unknown>;
|
|
9
|
-
serializedValues: Record<string, unknown>;
|
|
10
|
-
serializedFieldValues: Record<string, unknown>;
|
|
4
|
+
inputs: SubmissionInputRecord[];
|
|
5
|
+
displayValues: Record<string, unknown>;
|
|
6
|
+
modelValues: Record<string, unknown>;
|
|
11
7
|
fields: readonly TField[];
|
|
12
8
|
reports: readonly TReport[];
|
|
13
9
|
signal?: AbortSignal;
|