mlform 0.1.22 → 0.1.23

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 CHANGED
@@ -9,7 +9,7 @@ Schema-driven forms for machine learning applications.
9
9
 
10
10
  MLForm gives you a predictable UI layer between users and model backends. You describe inputs and reports with a schema, MLForm renders accessible Web Components, validates values, submits structured payloads, and displays model results in the same host container.
11
11
 
12
- Version `0.1.22` is the current release in this repository.
12
+ Version `0.1.23` is the current release in this repository.
13
13
 
14
14
  ## Why MLForm
15
15
 
@@ -306,7 +306,7 @@ The main package targets Node.js `>=24.9.0`.
306
306
 
307
307
  ## Release Notes
308
308
 
309
- For `0.1.22`, use the repository release entry and the published docs as the source of truth:
309
+ For `0.1.23`, use the repository release entry and the published docs as the source of truth:
310
310
 
311
311
  - GitHub releases: https://github.com/UlloaSP/mlform/releases
312
312
  - npm package: https://www.npmjs.com/package/mlform
@@ -1,4 +1,4 @@
1
- import { b as e, d as t, h as n } from "./schema-CiCjXECD.js";
1
+ import { b as e, d as t, h as n } from "./schema-BI-Ia-h9.js";
2
2
  import { s as r } from "./primitives-ljp3c5R8.js";
3
3
  import * as i from "zod";
4
4
  //#region src/builtins/constants.ts
@@ -1,2 +1,2 @@
1
- import { S as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as d, n as f, o as p, p as m, r as h, s as g, t as _, u as v, v as y, x as b, y as x } from "../builtins-B2U_ViF6.js";
1
+ import { S as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as d, n as f, o as p, p as m, r as h, s as g, t as _, u as v, v as y, x as b, y as x } from "../builtins-rkxD-h7K.js";
2
2
  export { t as booleanFieldDefinition, y as builtinFieldKinds, x as builtinReportFallbacks, r as builtinReportKinds, b as builtinReportLabels, e as builtinValidationMessages, s as categoryFieldDefinition, n as classifierReportDefinition, _ as createBuiltinMlRegistry, h as createMappedCategoryBehavior, f as createMlRegistryPack, m as dateFieldDefinition, o as longTextFieldDefinition, c as mappedCategoryFieldDefinition, a as multiChoiceFieldDefinition, v as numberFieldDefinition, d as oneHotCategoryFieldDefinition, u as ratingFieldDefinition, l as regressorReportDefinition, g as seriesFieldDefinition, p as singleChoiceFieldDefinition, i as textFieldDefinition };
@@ -1,6 +1,6 @@
1
- import { _ as e, t } from "../runtime-C9ZioNpI.js";
2
- import { b as n, d as r } from "../schema-CiCjXECD.js";
3
- import { n as i } from "../builtins-B2U_ViF6.js";
1
+ import { _ as e, t } from "../runtime-BQsOz8iz.js";
2
+ import { b as n, d as r } from "../schema-BI-Ia-h9.js";
3
+ import { n as i } from "../builtins-rkxD-h7K.js";
4
4
  import { _ as a, a as o, h as s, l as c, m as l, p as u, r as d, t as f } from "../primitives-ljp3c5R8.js";
5
5
  import { d as p, h as m, r as h } from "../design-Dr7o4rR9.js";
6
6
  import { LitElement as g, css as _, html as v, nothing as y } from "lit";
@@ -1,3 +1,3 @@
1
- import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g, v as _ } from "../runtime-C9ZioNpI.js";
1
+ import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g, v as _ } from "../runtime-BQsOz8iz.js";
2
2
  import { a as v, i as y } from "../transport-KUB3zfW9.js";
3
3
  export { r as EngineError, i as RegistryError, f as ReportPayloadError, l as SubmissionAbortedError, o as SubmitError, y as TransportError, a as ValidationError, h as createForm, h as createFormRuntime, m as createMultiBackendSubmissionSnapshot, n as createSubmissionSnapshot, u as defaultEquality, e as executeFormPipeline, d as executeMultiBackendPipeline, _ as executeReportFetches, c as identity, g as isPromiseLike, p as shallowArrayEquality, s as shallowEquality, t as shallowObjectEquality, v as transportErrorCodes };
@@ -1,2 +1,2 @@
1
- import { _ as e, a as t, b as n, c as r, d as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _, v, y } from "../schema-CiCjXECD.js";
1
+ import { _ as e, a as t, b as n, c as r, d as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _, v, y } from "../schema-BI-Ia-h9.js";
2
2
  export { _ as RegistryError, r as SchemaNormalizationError, i as createRegistry, t as createReportContexts, g as createReportFetchRequest, a as defineFieldDefinition, p as defineReportDefinition, d as findUnknownKinds, f as getReportContext, u as mappedToKey, l as normalizeSchema, n as normalizeSchemaId, s as resolveMappedReportPayload, o as resolveMappedReportResult, e as resolveMappedRoutes, v as resolveMappedTargets, y as resolveMappedTo, h as resolveOneHotDisplayValue, m as toSchemaJsonSchema, c as validateSchema };
@@ -1,4 +1,4 @@
1
- import { a as e, b as t, g as n, h as r, l as i, m as a, t as o, v as s, y as c } from "./schema-CiCjXECD.js";
1
+ import { a as e, b as t, g as n, h as r, l as i, m as a, t as o, v as s, y as c } from "./schema-BI-Ia-h9.js";
2
2
  import { a as l, n as u, r as d } from "./transport-KUB3zfW9.js";
3
3
  //#region src/runtime/submission/report-fetches.ts
4
4
  var f = "Unknown report fetch error.", p = async ({ reports: e, request: t }) => {
@@ -1,60 +1,60 @@
1
- import { toJSONSchema as e } from "zod";
1
+ import { array as e, never as t, strictObject as n, toJSONSchema as r, xor as i } from "zod";
2
2
  //#region src/schema/ids.ts
3
- var t = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "item", n = (e, t) => {
3
+ var a = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "item", o = (e, t) => {
4
4
  if (typeof e == "string" || typeof e == "number") return e;
5
5
  if (e) return (t ? e[t] : void 0) ?? e.default ?? void 0;
6
- }, r = (e) => String(e), i = (e, t) => {
7
- let i = n(e, t);
8
- if (t !== void 0 || typeof e != "object" || !e) return i === void 0 ? [] : [i];
9
- let a = /* @__PURE__ */ new Set();
6
+ }, s = (e) => String(e), c = (e, t) => {
7
+ let n = o(e, t);
8
+ if (t !== void 0 || typeof e != "object" || !e) return n === void 0 ? [] : [n];
9
+ let r = /* @__PURE__ */ new Set();
10
10
  return Object.values(e).filter((e) => {
11
11
  if (typeof e != "string" && typeof e != "number") return !1;
12
- let t = r(e);
13
- return a.has(t) ? !1 : (a.add(t), !0);
12
+ let t = s(e);
13
+ return r.has(t) ? !1 : (r.add(t), !0);
14
14
  });
15
- }, a = (e, t) => {
15
+ }, l = (e, t) => {
16
16
  if (typeof e == "string" || typeof e == "number") return [{
17
17
  backend: t ?? "default",
18
18
  mappedTo: e
19
19
  }];
20
20
  if (!e) return [];
21
21
  if (t) {
22
- let r = n(e, t);
23
- return r === void 0 ? [] : [{
22
+ let n = o(e, t);
23
+ return n === void 0 ? [] : [{
24
24
  backend: t,
25
- mappedTo: r
25
+ mappedTo: n
26
26
  }];
27
27
  }
28
28
  return Object.entries(e).flatMap(([e, t]) => typeof t == "string" || typeof t == "number" ? [{
29
29
  backend: e,
30
30
  mappedTo: t
31
31
  }] : []);
32
- }, o = (e, t) => {
33
- let n = a(e.mappedTo, t.backend), i = t.reports.filter((e) => n.some((t) => t.backend === e.backend && r(t.mappedTo) === r(e.mappedTo)));
34
- if (i.length > 1) {
35
- let e = i[0];
32
+ }, u = (e, t) => {
33
+ let n = l(e.mappedTo, t.backend), r = t.reports.filter((e) => n.some((t) => t.backend === e.backend && s(t.mappedTo) === s(e.mappedTo)));
34
+ if (r.length > 1) {
35
+ let e = r[0];
36
36
  throw Error(`Duplicate report result for backend "${e?.backend}" and mappedTo "${String(e?.mappedTo)}".`);
37
37
  }
38
- return i[0];
39
- }, s = (e, t) => {
40
- let n = o(e, t);
38
+ return r[0];
39
+ }, d = (e, t) => {
40
+ let n = u(e, t);
41
41
  return n?.status === "ready" ? n.payload : void 0;
42
- }, c = class extends Error {
42
+ }, f = class extends Error {
43
43
  constructor(e) {
44
44
  super(e), this.name = "RegistryError";
45
45
  }
46
- }, l = class {
46
+ }, p = class {
47
47
  fieldDefinitions = /* @__PURE__ */ new Map();
48
48
  reportDefinitions = /* @__PURE__ */ new Map();
49
49
  registerField(e) {
50
- if (this.fieldDefinitions.has(e.kind)) throw new c(`Field kind "${e.kind}" is already registered.`);
50
+ if (this.fieldDefinitions.has(e.kind)) throw new f(`Field kind "${e.kind}" is already registered.`);
51
51
  return this.fieldDefinitions.set(e.kind, e), this;
52
52
  }
53
53
  unregisterField(e) {
54
54
  return this.fieldDefinitions.delete(e), this;
55
55
  }
56
56
  registerReport(e) {
57
- if (this.reportDefinitions.has(e.kind)) throw new c(`Report kind "${e.kind}" is already registered.`);
57
+ if (this.reportDefinitions.has(e.kind)) throw new f(`Report kind "${e.kind}" is already registered.`);
58
58
  return this.reportDefinitions.set(e.kind, e), this;
59
59
  }
60
60
  unregisterReport(e) {
@@ -72,68 +72,68 @@ 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 = class extends Error {
75
+ }, m = () => new p(), h = (e) => e, g = (e) => e, _ = class extends Error {
76
76
  path;
77
77
  code;
78
78
  constructor(e, t, n = "invalid-config") {
79
79
  super(e), this.path = t, this.code = n, this.name = "SchemaNormalizationError";
80
80
  }
81
- }, m = (e, t, n, r, i) => {
82
- if (typeof n != "object" || !n) throw new p(`Series field "${e}" requires "${t}" configuration.`, [
81
+ }, v = (e, t, n, r, i) => {
82
+ if (typeof n != "object" || !n) throw new _(`Series field "${e}" requires "${t}" configuration.`, [
83
83
  "fields",
84
84
  i,
85
85
  t
86
86
  ]);
87
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".`, [
88
+ if (a.length === 0) throw new _(`Series field "${e}" requires "${t}.kind".`, [
89
89
  "fields",
90
90
  i,
91
91
  t,
92
92
  "kind"
93
93
  ]);
94
- if (a === "series") throw new p(`Series field "${e}" cannot nest series in "${t}".`, [
94
+ if (a === "series") throw new _(`Series field "${e}" cannot nest series in "${t}".`, [
95
95
  "fields",
96
96
  i,
97
97
  t,
98
98
  "kind"
99
99
  ]);
100
- if (!r.getField(a)) throw new p(`Series field "${e}" uses unknown sub-field kind "${a}" in "${t}".`, [
100
+ if (!r.getField(a)) throw new _(`Series field "${e}" uses unknown sub-field kind "${a}" in "${t}".`, [
101
101
  "fields",
102
102
  i,
103
103
  t,
104
104
  "kind"
105
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.`, [
106
+ }, y = (e, t, n) => {
107
+ if (e.kind === "series" && (v(e.label, "field1", e.field1, t, n), v(e.label, "field2", e.field2, t, n), typeof e.minPoints == "number" && typeof e.maxPoints == "number" && e.minPoints > e.maxPoints)) throw new _(`Series field "${e.label}" requires minPoints to be less than or equal to maxPoints.`, [
108
108
  "fields",
109
109
  n,
110
110
  "minPoints"
111
111
  ]);
112
- }, g = (e, n, r, i, a) => {
113
- let o = t((e ?? n) || i);
112
+ }, b = (e, t, n, r, i) => {
113
+ let o = a((e ?? t) || r);
114
114
  if (e) {
115
- if (r.has(o)) throw new p(`Duplicate explicit id "${o}" in schema.`, a);
116
- return r.add(o), o;
115
+ if (n.has(o)) throw new _(`Duplicate explicit id "${o}" in schema.`, i);
116
+ return n.add(o), o;
117
117
  }
118
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) => {
119
+ for (; n.has(s);) s = `${o}-${c}`, c += 1;
120
+ return n.add(s), s;
121
+ }, x = (e, t, n, r) => {
122
122
  let i = n.getField(e.kind);
123
- if (!i) throw new c(`Unknown field kind "${e.kind}".`);
123
+ if (!i) throw new f(`Unknown field kind "${e.kind}".`);
124
124
  let a = i.schema.parse(e);
125
- return h(a, n, t), {
125
+ return y(a, n, t), {
126
126
  ...a,
127
- id: g(a.id, a.label, r, `field-${t + 1}`, [
127
+ id: b(a.id, a.label, r, `field-${t + 1}`, [
128
128
  "fields",
129
129
  t,
130
130
  "id"
131
131
  ])
132
132
  };
133
- }, v = (e, t, n, r) => {
133
+ }, S = (e, t, n, r) => {
134
134
  let i = n.getReport(e.kind);
135
- if (!i) throw new c(`Unknown report kind "${e.kind}".`);
136
- let a = i.schema.parse(e), o = g(e.id ?? a.id, e.label ?? a.label ?? a.kind, r, `report-${t + 1}`, [
135
+ if (!i) throw new f(`Unknown report kind "${e.kind}".`);
136
+ let a = i.schema.parse(e), o = b(e.id ?? a.id, e.label ?? a.label ?? a.kind, r, `report-${t + 1}`, [
137
137
  "reports",
138
138
  t,
139
139
  "id"
@@ -146,62 +146,62 @@ var t = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/
146
146
  ...e.ui === void 0 ? {} : { ui: e.ui },
147
147
  id: o
148
148
  };
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));
149
+ }, C = (e, t) => {
150
+ let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = (e.reports ?? []).map((e, n) => S(e, n, t, r));
151
151
  return {
152
- fields: e.fields.map((e, r) => _(e, r, t, n)),
152
+ fields: e.fields.map((e, r) => x(e, r, t, n)),
153
153
  reports: i
154
154
  };
155
- }, b = (e) => e === 1 || e === "1" || e === !0, x = (e, t, i = {}) => {
155
+ }, w = (e) => e === 1 || e === "1" || e === !0, T = (e, t, n = {}) => {
156
156
  if (e.kind !== "onehot-category" || !Array.isArray(e.options)) return;
157
- let a = /* @__PURE__ */ new Set(), o;
158
- for (let s of e.options) {
159
- let c = n(s.mappedTo, i.backend);
160
- if (c === void 0) throw Error(`onehot-category "${e.id ?? e.kind}": option "${s.value}" has no mappedTo.`);
161
- let l = r(c);
162
- if (a.has(l)) throw Error(`onehot-category "${e.id ?? e.kind}": duplicate mappedTo "${l}".`);
163
- if (a.add(l), b(t[l])) {
164
- if (o !== void 0) throw Error(`onehot-category "${e.id ?? e.kind}": multiple selected mapped values.`);
165
- o = s.value;
157
+ let r = /* @__PURE__ */ new Set(), i;
158
+ for (let a of e.options) {
159
+ let c = o(a.mappedTo, n.backend);
160
+ if (c === void 0) throw Error(`onehot-category "${e.id ?? e.kind}": option "${a.value}" has no mappedTo.`);
161
+ let l = s(c);
162
+ if (r.has(l)) throw Error(`onehot-category "${e.id ?? e.kind}": duplicate mappedTo "${l}".`);
163
+ if (r.add(l), w(t[l])) {
164
+ if (i !== void 0) throw Error(`onehot-category "${e.id ?? e.kind}": multiple selected mapped values.`);
165
+ i = a.value;
166
166
  }
167
167
  }
168
- return o;
169
- }, S = (e) => {
168
+ return i;
169
+ }, E = (e) => {
170
170
  if (typeof e == "string") return e;
171
171
  if (typeof e != "number") return e.id ?? e.config?.id;
172
- }, C = (e, t) => {
172
+ }, D = (e, t) => {
173
173
  if (typeof e == "string" || typeof e == "number") return String(e);
174
- let i = n(e.mappedTo ?? e.config?.mappedTo, t);
175
- return i === void 0 ? void 0 : r(i);
176
- }, w = (e, t) => Object.fromEntries(e.map((e) => {
177
- let i = o(e, t), a = i?.context, s = i?.mappedTo ?? n(e.mappedTo, t.backend);
174
+ let n = o(e.mappedTo ?? e.config?.mappedTo, t);
175
+ return n === void 0 ? void 0 : s(n);
176
+ }, O = (e, t) => Object.fromEntries(e.map((e) => {
177
+ let n = u(e, t), r = n?.context, i = n?.mappedTo ?? o(e.mappedTo, t.backend);
178
178
  return [e.id, {
179
179
  reportId: e.id,
180
180
  kind: e.kind,
181
181
  label: e.label,
182
182
  mappedTo: e.mappedTo,
183
- target: s,
184
- targetKey: s === void 0 ? void 0 : r(s),
185
- backend: i?.backend ?? t.backend,
186
- displayValues: a?.displayValues ?? t.displayValues,
187
- modelValues: a?.modelValues ?? t.modelValues,
183
+ target: i,
184
+ targetKey: i === void 0 ? void 0 : s(i),
185
+ backend: n?.backend ?? t.backend,
186
+ displayValues: r?.displayValues ?? t.displayValues,
187
+ modelValues: r?.modelValues ?? t.modelValues,
188
188
  reports: t.reports,
189
- meta: a?.meta ?? t.meta,
190
- raw: a && "raw" in a ? a.raw : t.raw
189
+ meta: r?.meta ?? t.meta,
190
+ raw: r && "raw" in r ? r.raw : t.raw
191
191
  }];
192
- })), T = (e, t) => {
193
- let n = e.reportContexts, r = S(t);
192
+ })), k = (e, t) => {
193
+ let n = e.reportContexts, r = E(t);
194
194
  if (r && n[r]) return n[r];
195
- let i = C(t, e.backend);
195
+ let i = D(t, e.backend);
196
196
  if (i === void 0) return;
197
197
  let a = Object.values(n).filter((t) => t.targetKey === i && (e.backend === void 0 || t.backend === e.backend));
198
198
  return a.length === 1 ? a[0] : void 0;
199
- }, E = (e) => typeof e == "object" && !!e && !Array.isArray(e), D = (e, t) => {
200
- if (!E(e)) return [];
199
+ }, A = (e) => typeof e == "object" && !!e && !Array.isArray(e), j = (e, t) => {
200
+ if (!A(e)) return [];
201
201
  let n = [], r = (r) => {
202
202
  let i = e[r];
203
203
  Array.isArray(i) && i.forEach((e, i) => {
204
- if (!(!E(e) || typeof e.kind != "string") && ((r === "fields" ? t.getField(e.kind) : t.getReport(e.kind)) || n.push({
204
+ if (!(!A(e) || typeof e.kind != "string") && ((r === "fields" ? t.getField(e.kind) : t.getReport(e.kind)) || n.push({
205
205
  section: r,
206
206
  index: i,
207
207
  kind: e.kind,
@@ -212,7 +212,7 @@ var t = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/
212
212
  ]
213
213
  }), r === "fields" && e.kind === "series")) for (let a of ["field1", "field2"]) {
214
214
  let o = e[a];
215
- !E(o) || typeof o.kind != "string" || t.getField(o.kind) || n.push({
215
+ !A(o) || typeof o.kind != "string" || t.getField(o.kind) || n.push({
216
216
  section: r,
217
217
  index: i,
218
218
  kind: o.kind,
@@ -227,7 +227,7 @@ var t = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/
227
227
  });
228
228
  };
229
229
  return r("fields"), r("reports"), n;
230
- }, O = (e, t, n, r) => {
230
+ }, M = (e, t, n, r) => {
231
231
  if (!Array.isArray(t)) {
232
232
  r.push({
233
233
  path: [e],
@@ -237,7 +237,7 @@ var t = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/
237
237
  return;
238
238
  }
239
239
  t.forEach((t, i) => {
240
- if (!E(t)) {
240
+ if (!A(t)) {
241
241
  r.push({
242
242
  path: [e, i],
243
243
  message: `${e === "fields" ? "Field" : "Report"} must be an object.`,
@@ -270,8 +270,8 @@ var t = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/
270
270
  code: "invalid-config"
271
271
  });
272
272
  });
273
- }, k = (e, t) => {
274
- if (!E(e)) return {
273
+ }, N = (e, t) => {
274
+ if (!A(e)) return {
275
275
  success: !1,
276
276
  issues: [{
277
277
  path: [],
@@ -285,8 +285,8 @@ var t = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/
285
285
  message: `Unsupported schema property "${t}".`,
286
286
  code: "invalid-schema"
287
287
  });
288
- O("fields", e.fields, t, n), O("reports", e.reports ?? [], t, n);
289
- for (let r of D(e, t)) n.push({
288
+ M("fields", e.fields, t, n), M("reports", e.reports ?? [], t, n);
289
+ for (let r of j(e, t)) n.push({
290
290
  path: r.path,
291
291
  message: `Unknown ${r.section === "fields" ? "field" : "report"} kind "${r.kind}".`,
292
292
  code: "unknown-kind"
@@ -298,11 +298,11 @@ var t = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/
298
298
  try {
299
299
  return {
300
300
  success: !0,
301
- data: y(e, t),
301
+ data: C(e, t),
302
302
  issues: []
303
303
  };
304
304
  } catch (e) {
305
- let t = e instanceof p ? e : void 0;
305
+ let t = e instanceof _ ? e : void 0;
306
306
  return {
307
307
  success: !1,
308
308
  issues: [{
@@ -312,39 +312,28 @@ var t = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/
312
312
  }]
313
313
  };
314
314
  }
315
- }, A = (t) => t.map((t) => e(t.schema, {
315
+ }, P = (e) => {
316
+ let n = e.map((e) => e.schema);
317
+ return n.length > 0 ? i(n) : t();
318
+ }, F = (t) => r(n({
319
+ fields: e(P(t.listFields())),
320
+ reports: e(P(t.listReports())).optional()
321
+ }), {
322
+ target: "draft-2020-12",
316
323
  io: "input",
317
324
  unrepresentable: "any"
318
- })), j = (e) => {
319
- let t = A(e);
320
- return t.length > 0 ? { oneOf: t } : !1;
321
- }, M = (e) => ({
322
- $schema: "https://json-schema.org/draft/2020-12/schema",
323
- type: "object",
324
- additionalProperties: !1,
325
- required: ["fields"],
326
- properties: {
327
- fields: {
328
- type: "array",
329
- items: j(e.listFields())
330
- },
331
- reports: {
332
- type: "array",
333
- items: j(e.listReports())
334
- }
335
- }
336
- }), N = (e, t = {}) => ({
325
+ }), I = (e, t = {}) => ({
337
326
  reportId: t.reportId ?? "",
338
327
  backend: e.backend,
339
328
  inputs: e.inputs,
340
329
  displayValues: e.displayValues,
341
330
  modelValues: e.modelValues,
342
331
  reports: e.reports,
343
- reportContext: t.reportId === void 0 ? void 0 : T(e, t.reportId),
332
+ reportContext: t.reportId === void 0 ? void 0 : k(e, t.reportId),
344
333
  reportContexts: e.reportContexts,
345
334
  meta: e.meta,
346
335
  raw: e.raw,
347
336
  signal: t.signal
348
337
  });
349
338
  //#endregion
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 };
339
+ export { l as _, O as a, a as b, _ as c, m as d, h as f, u as g, d as h, N as i, C as l, s as m, j as n, k as o, g as p, F as r, T as s, I as t, f as u, c as v, o as y };
@@ -22,4 +22,5 @@ export type SchemaValidationResult = {
22
22
  export type SchemaJsonSchema = Record<string, unknown>;
23
23
  export declare const findUnknownKinds: (schema: unknown, registry: Registry) => UnknownSchemaKind[];
24
24
  export declare const validateSchema: (schema: unknown, registry: Registry) => SchemaValidationResult;
25
+ /** Registered schemas that set metadata ids must use globally unique ids. */
25
26
  export declare const toSchemaJsonSchema: (registry: Registry) => SchemaJsonSchema;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mlform",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "private": false,
5
5
  "description": "Composable form generation utilities for machine learning backend integration",
6
6
  "keywords": [