@effect-app/vue-components 3.2.0 → 4.0.0-beta.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/dist/types/components/OmegaForm/OmegaAutoGen.vue.d.ts +1 -1
- package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +11 -13
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +6 -4
- package/dist/types/utils/index.d.ts +4 -3
- package/dist/vue-components.es.js +13 -14
- package/dist/vue-components.es10.js +109 -115
- package/dist/vue-components.es11.js +1 -1
- package/dist/vue-components.es12.js +290 -341
- package/dist/vue-components.es17.js +723 -4
- package/dist/vue-components.es18.js +140 -9
- package/dist/vue-components.es19.js +4 -55
- package/dist/vue-components.es2.js +17 -18
- package/dist/vue-components.es20.js +11 -68
- package/dist/vue-components.es21.js +3 -6
- package/dist/vue-components.es22.js +24 -6
- package/dist/vue-components.es23.js +4 -3
- package/dist/vue-components.es24.js +8 -3
- package/dist/vue-components.es25.js +55 -2
- package/dist/vue-components.es26.js +69 -2
- package/dist/vue-components.es27.js +6 -2
- package/dist/vue-components.es28.js +6 -2
- package/dist/vue-components.es29.js +3 -17
- package/dist/vue-components.es3.js +9 -9
- package/dist/vue-components.es30.js +3 -192
- package/dist/vue-components.es31.js +4 -0
- package/dist/vue-components.es32.js +2 -42
- package/dist/vue-components.es33.js +1 -1
- package/dist/vue-components.es34.js +1 -1
- package/dist/vue-components.es35.js +17 -111
- package/dist/vue-components.es36.js +40 -0
- package/dist/vue-components.es37.js +4 -7
- package/dist/vue-components.es38.js +82 -31
- package/dist/vue-components.es39.js +54 -0
- package/dist/vue-components.es40.js +561 -4
- package/dist/vue-components.es41.js +40 -22
- package/dist/vue-components.es42.js +27 -5
- package/dist/vue-components.es43.js +5 -21
- package/dist/vue-components.es44.js +39 -29
- package/dist/vue-components.es45.js +313 -21
- package/dist/vue-components.es46.js +31 -12
- package/dist/vue-components.es47.js +4 -5
- package/dist/vue-components.es48.js +23 -18
- package/dist/vue-components.es49.js +74 -8
- package/dist/vue-components.es50.js +98 -30
- package/dist/vue-components.es51.js +2 -48
- package/dist/vue-components.es52.js +317 -25
- package/dist/vue-components.es53.js +64 -11
- package/dist/vue-components.es54.js +2 -65
- package/dist/vue-components.es55.js +2 -56
- package/dist/vue-components.es56.js +110 -16
- package/dist/vue-components.es58.js +7 -29
- package/dist/vue-components.es59.js +31 -41
- package/dist/vue-components.es61.js +190 -42
- package/dist/vue-components.es63.js +6 -0
- package/dist/vue-components.es64.js +103 -0
- package/dist/vue-components.es65.js +4 -0
- package/dist/vue-components.es66.js +23 -0
- package/dist/vue-components.es67.js +84 -0
- package/dist/vue-components.es68.js +14 -0
- package/dist/vue-components.es69.js +115 -0
- package/dist/vue-components.es7.js +1 -1
- package/dist/vue-components.es70.js +5 -0
- package/dist/vue-components.es71.js +34 -0
- package/dist/vue-components.es72.js +4 -0
- package/dist/vue-components.es73.js +4 -0
- package/dist/vue-components.es74.js +17 -0
- package/dist/vue-components.es75.js +72 -0
- package/dist/vue-components.es76.js +25 -0
- package/dist/vue-components.es77.js +7 -0
- package/dist/vue-components.es78.js +23 -0
- package/dist/vue-components.es79.js +32 -0
- package/dist/vue-components.es80.js +24 -0
- package/dist/vue-components.es81.js +14 -0
- package/dist/vue-components.es82.js +7 -0
- package/dist/vue-components.es83.js +21 -0
- package/dist/vue-components.es84.js +11 -0
- package/dist/vue-components.es85.js +33 -0
- package/dist/vue-components.es86.js +50 -0
- package/dist/vue-components.es87.js +28 -0
- package/dist/vue-components.es88.js +17 -0
- package/dist/vue-components.es89.js +18 -0
- package/dist/vue-components.es90.js +10 -0
- package/dist/vue-components.es91.js +13 -0
- package/dist/vue-components.es92.js +67 -0
- package/dist/vue-components.es93.js +58 -0
- package/dist/vue-components.es94.js +19 -0
- package/dist/{vue-components.es57.js → vue-components.es95.js} +3 -3
- package/dist/vue-components.es96.js +31 -0
- package/dist/vue-components.es97.js +44 -0
- package/dist/vue-components.es99.js +46 -0
- package/package.json +25 -24
- package/src/components/OmegaForm/OmegaAutoGen.vue +11 -10
- package/src/components/OmegaForm/OmegaErrorsInternal.vue +3 -2
- package/src/components/OmegaForm/OmegaFormStuff.ts +249 -274
- package/src/components/OmegaForm/OmegaInternalInput.vue +1 -1
- package/src/components/OmegaForm/useOmegaForm.ts +27 -28
- package/src/utils/index.ts +7 -7
- /package/dist/{vue-components.es62.js → vue-components.es100.js} +0 -0
- /package/dist/{vue-components.es60.js → vue-components.es98.js} +0 -0
|
@@ -1,391 +1,358 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { useIntl as
|
|
4
|
-
import { isObject as
|
|
5
|
-
const
|
|
1
|
+
import { isUnion as k, isUndefined as q, isDeclaration as C, isObjects as c, isNull as V, isArrays as $, isLiteral as B, isString as J, isNumber as G, isBoolean as R } from "./vue-components.es17.js";
|
|
2
|
+
import { Array as H, String as N, Literal as K, Union as _, makeFilter as x, toStandardSchemaV1 as Q, Null as I, make as W, Unknown as j, Boolean as X, Int as Y, Number as Z, Undefined as ee } from "./vue-components.es18.js";
|
|
3
|
+
import { useIntl as te, getTransformationFrom as E } from "./vue-components.es3.js";
|
|
4
|
+
import { isObject as ne } from "./vue-components.es19.js";
|
|
5
|
+
const ie = (e) => k(e) ? e.types.find((n) => q(n) || n === I.ast) : !1, g = (e) => !e || !k(e) ? !1 : e.types.find((n) => q(n)) ? "undefined" : e.types.find((n) => n === I.ast) ? "null" : !1, F = (e) => {
|
|
6
6
|
const n = [];
|
|
7
7
|
for (const t of e)
|
|
8
|
-
if (
|
|
9
|
-
const
|
|
10
|
-
n.push(...
|
|
8
|
+
if (k(t)) {
|
|
9
|
+
const i = F(t.types);
|
|
10
|
+
n.push(...i);
|
|
11
11
|
} else
|
|
12
12
|
n.push(t);
|
|
13
13
|
return n;
|
|
14
|
-
},
|
|
15
|
-
if (t && t
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
return
|
|
14
|
+
}, m = ({ meta: e = {}, parent: n = "", property: t, propertySignatures: i }, r = {}) => {
|
|
15
|
+
if (t && C(t)) {
|
|
16
|
+
const s = t.annotations?.title ?? "";
|
|
17
|
+
if (s !== "Int" && s !== "int")
|
|
18
|
+
return m({
|
|
19
19
|
parent: n,
|
|
20
20
|
meta: e,
|
|
21
|
-
property: t
|
|
21
|
+
property: t
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
if (t
|
|
25
|
-
return
|
|
24
|
+
if (t && c(t))
|
|
25
|
+
return m({
|
|
26
26
|
meta: e,
|
|
27
27
|
propertySignatures: t.propertySignatures
|
|
28
28
|
});
|
|
29
|
-
if (
|
|
30
|
-
for (const
|
|
31
|
-
const
|
|
32
|
-
let
|
|
33
|
-
e._isNullableDiscriminatedUnion &&
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
36
|
-
const
|
|
37
|
-
(u) => u
|
|
38
|
-
).map(
|
|
39
|
-
if (
|
|
40
|
-
(u) =>
|
|
29
|
+
if (i) {
|
|
30
|
+
for (const s of i) {
|
|
31
|
+
const o = n ? `${n}.${s.name.toString()}` : s.name.toString(), l = g(s.type), f = s.type.annotations?.title ?? "", a = f === "Int" || f === "int";
|
|
32
|
+
let p;
|
|
33
|
+
e._isNullableDiscriminatedUnion && s.name.toString() === "_tag" || e.required === !1 ? p = !1 : p = !l;
|
|
34
|
+
const v = s.type;
|
|
35
|
+
if (k(s.type)) {
|
|
36
|
+
const b = F(s.type.types).filter(
|
|
37
|
+
(u) => !q(u) && !V(u)
|
|
38
|
+
).map(E);
|
|
39
|
+
if (b.some(
|
|
40
|
+
(u) => c(u)
|
|
41
41
|
)) {
|
|
42
|
-
if (!
|
|
43
|
-
const u =
|
|
44
|
-
parent:
|
|
45
|
-
property:
|
|
46
|
-
meta: { required:
|
|
42
|
+
if (!l) {
|
|
43
|
+
const u = m({
|
|
44
|
+
parent: o,
|
|
45
|
+
property: s.type,
|
|
46
|
+
meta: { required: p, nullableOrUndefined: l }
|
|
47
47
|
});
|
|
48
|
-
|
|
48
|
+
r[o] = u;
|
|
49
49
|
}
|
|
50
|
-
for (const u of
|
|
51
|
-
if (
|
|
52
|
-
const
|
|
50
|
+
for (const u of b)
|
|
51
|
+
if (c(u)) {
|
|
52
|
+
const y = l && b.length > 1;
|
|
53
53
|
Object.assign(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
parent:
|
|
54
|
+
r,
|
|
55
|
+
m({
|
|
56
|
+
parent: o,
|
|
57
57
|
propertySignatures: u.propertySignatures,
|
|
58
|
-
meta:
|
|
58
|
+
meta: y ? { _isNullableDiscriminatedUnion: !0 } : {}
|
|
59
59
|
})
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
} else {
|
|
63
|
-
const u =
|
|
63
|
+
const u = b.filter($);
|
|
64
64
|
if (u.length > 0) {
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
65
|
+
const y = u[0];
|
|
66
|
+
if (r[o] = {
|
|
67
67
|
type: "multiple",
|
|
68
|
-
members:
|
|
69
|
-
rest:
|
|
70
|
-
required:
|
|
71
|
-
nullableOrUndefined:
|
|
72
|
-
},
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
for (const
|
|
76
|
-
const
|
|
77
|
-
parent:
|
|
78
|
-
property:
|
|
68
|
+
members: y.elements,
|
|
69
|
+
rest: y.rest,
|
|
70
|
+
required: p,
|
|
71
|
+
nullableOrUndefined: l
|
|
72
|
+
}, y.rest && y.rest.length > 0) {
|
|
73
|
+
const S = y.rest[0];
|
|
74
|
+
if (c(S))
|
|
75
|
+
for (const d of S.propertySignatures) {
|
|
76
|
+
const O = `${o}.${d.name.toString()}`, h = m({
|
|
77
|
+
parent: O,
|
|
78
|
+
property: d.type,
|
|
79
79
|
meta: {
|
|
80
|
-
required: !
|
|
81
|
-
nullableOrUndefined:
|
|
80
|
+
required: !g(d.type),
|
|
81
|
+
nullableOrUndefined: g(d.type)
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
|
-
if (
|
|
85
|
-
const
|
|
86
|
-
if (
|
|
87
|
-
for (const
|
|
88
|
-
const
|
|
89
|
-
parent:
|
|
90
|
-
property:
|
|
84
|
+
if (h && typeof h == "object" && "type" in h && (r[O] = h, h.type === "multiple" && $(d.type) && d.type.rest && d.type.rest.length > 0)) {
|
|
85
|
+
const P = d.type.rest[0];
|
|
86
|
+
if (c(P))
|
|
87
|
+
for (const T of P.propertySignatures) {
|
|
88
|
+
const D = `${O}.${T.name.toString()}`, w = m({
|
|
89
|
+
parent: D,
|
|
90
|
+
property: T.type,
|
|
91
91
|
meta: {
|
|
92
|
-
required: !
|
|
93
|
-
nullableOrUndefined:
|
|
92
|
+
required: !g(T.type),
|
|
93
|
+
nullableOrUndefined: g(T.type)
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
|
-
|
|
96
|
+
w && typeof w == "object" && "type" in w && (r[D] = w);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
} else {
|
|
102
|
-
const
|
|
103
|
-
parent:
|
|
104
|
-
property:
|
|
105
|
-
meta: { required:
|
|
102
|
+
const y = m({
|
|
103
|
+
parent: o,
|
|
104
|
+
property: s.type,
|
|
105
|
+
meta: { required: p, nullableOrUndefined: l }
|
|
106
106
|
});
|
|
107
|
-
|
|
107
|
+
r[o] = y;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
} else {
|
|
111
|
-
const
|
|
112
|
-
if (
|
|
111
|
+
const M = E(v);
|
|
112
|
+
if (c(M))
|
|
113
113
|
Object.assign(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
parent:
|
|
117
|
-
propertySignatures:
|
|
118
|
-
meta: { required:
|
|
114
|
+
r,
|
|
115
|
+
m({
|
|
116
|
+
parent: o,
|
|
117
|
+
propertySignatures: M.propertySignatures,
|
|
118
|
+
meta: { required: p, nullableOrUndefined: l }
|
|
119
119
|
})
|
|
120
120
|
);
|
|
121
|
-
else if (
|
|
122
|
-
if (
|
|
123
|
-
const
|
|
124
|
-
if (
|
|
125
|
-
for (const u of
|
|
126
|
-
const
|
|
127
|
-
if (
|
|
128
|
-
const
|
|
129
|
-
if (
|
|
130
|
-
for (const
|
|
131
|
-
const
|
|
132
|
-
parent:
|
|
133
|
-
property:
|
|
121
|
+
else if ($(s.type))
|
|
122
|
+
if (s.type.rest.length > 0 && c(s.type.rest[0])) {
|
|
123
|
+
const L = s.type.rest[0];
|
|
124
|
+
if (c(L))
|
|
125
|
+
for (const u of L.propertySignatures) {
|
|
126
|
+
const y = `${o}.${u.name.toString()}`;
|
|
127
|
+
if ($(u.type) && u.type.rest.length > 0) {
|
|
128
|
+
const S = u.type.rest[0];
|
|
129
|
+
if (c(S))
|
|
130
|
+
for (const d of S.propertySignatures) {
|
|
131
|
+
const O = `${y}.${d.name.toString()}`, h = m({
|
|
132
|
+
parent: O,
|
|
133
|
+
property: d.type,
|
|
134
134
|
meta: {
|
|
135
|
-
required: !
|
|
136
|
-
nullableOrUndefined:
|
|
135
|
+
required: !g(d.type),
|
|
136
|
+
nullableOrUndefined: g(d.type)
|
|
137
137
|
}
|
|
138
138
|
});
|
|
139
|
-
|
|
139
|
+
r[O] = h;
|
|
140
140
|
}
|
|
141
141
|
else
|
|
142
|
-
|
|
142
|
+
r[y] = {
|
|
143
143
|
type: "multiple",
|
|
144
144
|
members: u.type.elements,
|
|
145
145
|
rest: u.type.rest,
|
|
146
|
-
required: !
|
|
147
|
-
nullableOrUndefined:
|
|
146
|
+
required: !g(u.type),
|
|
147
|
+
nullableOrUndefined: g(u.type)
|
|
148
148
|
};
|
|
149
149
|
} else {
|
|
150
|
-
const
|
|
151
|
-
parent:
|
|
150
|
+
const S = m({
|
|
151
|
+
parent: y,
|
|
152
152
|
property: u.type,
|
|
153
153
|
meta: {
|
|
154
|
-
required: !
|
|
155
|
-
nullableOrUndefined:
|
|
154
|
+
required: !g(u.type),
|
|
155
|
+
nullableOrUndefined: g(u.type)
|
|
156
156
|
}
|
|
157
157
|
});
|
|
158
|
-
|
|
158
|
+
r[y] = S;
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
} else
|
|
162
|
-
|
|
162
|
+
r[o] = {
|
|
163
163
|
type: "multiple",
|
|
164
|
-
members:
|
|
165
|
-
rest:
|
|
166
|
-
required:
|
|
167
|
-
nullableOrUndefined:
|
|
164
|
+
members: s.type.elements,
|
|
165
|
+
rest: s.type.rest,
|
|
166
|
+
required: p,
|
|
167
|
+
nullableOrUndefined: l
|
|
168
168
|
};
|
|
169
169
|
else {
|
|
170
|
-
const
|
|
171
|
-
parent:
|
|
172
|
-
property:
|
|
170
|
+
const b = m({
|
|
171
|
+
parent: o,
|
|
172
|
+
property: s.type,
|
|
173
173
|
meta: {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
nullableOrUndefined: a
|
|
174
|
+
required: p,
|
|
175
|
+
nullableOrUndefined: l,
|
|
176
|
+
...a && { refinement: "int" }
|
|
178
177
|
}
|
|
179
178
|
});
|
|
180
|
-
|
|
179
|
+
r[o] = b;
|
|
181
180
|
}
|
|
182
181
|
}
|
|
183
182
|
}
|
|
184
|
-
return
|
|
183
|
+
return r;
|
|
185
184
|
}
|
|
186
185
|
if (t) {
|
|
187
|
-
const
|
|
188
|
-
if (Object.hasOwnProperty.call(e, "required") || (e.required = !
|
|
189
|
-
const f =
|
|
190
|
-
(
|
|
186
|
+
const s = ie(t);
|
|
187
|
+
if (Object.hasOwnProperty.call(e, "required") || (e.required = !s), k(t)) {
|
|
188
|
+
const f = F(t.types), a = f.find(
|
|
189
|
+
(p) => !q(p) && !V(p)
|
|
191
190
|
);
|
|
192
|
-
return
|
|
193
|
-
propertySignatures:
|
|
191
|
+
return c(a) ? m({
|
|
192
|
+
propertySignatures: a.propertySignatures,
|
|
194
193
|
parent: n,
|
|
195
194
|
meta: e
|
|
196
|
-
}) : f.every(
|
|
195
|
+
}) : f.every(B) ? {
|
|
197
196
|
...e,
|
|
198
197
|
type: "select",
|
|
199
|
-
members: f.map((
|
|
198
|
+
members: f.map((p) => p.literal)
|
|
200
199
|
} : {
|
|
201
200
|
...e,
|
|
202
|
-
...
|
|
201
|
+
...m({
|
|
203
202
|
parent: n,
|
|
204
203
|
meta: e,
|
|
205
|
-
property:
|
|
204
|
+
property: a
|
|
206
205
|
})
|
|
207
206
|
};
|
|
208
207
|
}
|
|
209
|
-
if (
|
|
208
|
+
if ($(t))
|
|
210
209
|
return {
|
|
211
210
|
...e,
|
|
212
211
|
type: "multiple",
|
|
213
212
|
members: t.elements,
|
|
214
213
|
rest: t.rest
|
|
215
214
|
};
|
|
216
|
-
e = { ...
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
).pipe(M.getOrElse(() => ({}))), ...e };
|
|
220
|
-
const a = i.AST.getAnnotation(
|
|
221
|
-
t,
|
|
222
|
-
i.AST.TitleAnnotationId
|
|
223
|
-
).pipe(
|
|
224
|
-
M.getOrElse(() => "unknown")
|
|
225
|
-
);
|
|
226
|
-
if (a === "Int" || a === "int")
|
|
227
|
-
e.type = "number", e.refinement = "int";
|
|
228
|
-
else {
|
|
229
|
-
if ("from" in t)
|
|
230
|
-
return y({
|
|
231
|
-
parent: n,
|
|
232
|
-
meta: e,
|
|
233
|
-
property: t.from
|
|
234
|
-
});
|
|
235
|
-
e.type = a;
|
|
236
|
-
}
|
|
237
|
-
return e;
|
|
215
|
+
e = { ...t.annotations?.jsonSchema ?? {}, ...e };
|
|
216
|
+
let l = t.annotations?.title ?? "unknown";
|
|
217
|
+
return l === "unknown" && (J(t) ? l = "string" : G(t) ? l = "number" : R(t) && (l = "boolean")), l === "Int" || l === "int" ? (e.type = "number", e.refinement = "int") : e.type = l, Object.hasOwnProperty.call(e, "required") || (e.required = !s), e;
|
|
238
218
|
}
|
|
239
|
-
return
|
|
240
|
-
},
|
|
219
|
+
return r;
|
|
220
|
+
}, z = (e, n = "") => {
|
|
241
221
|
const t = {};
|
|
242
|
-
for (const
|
|
243
|
-
const
|
|
244
|
-
|
|
222
|
+
for (const i in e) {
|
|
223
|
+
const r = e[i], s = n ? `${n}.${i}` : i;
|
|
224
|
+
r && typeof r == "object" && "type" in r ? t[s] = r : r && typeof r == "object" && Object.assign(t, z(r, s));
|
|
245
225
|
}
|
|
246
226
|
return t;
|
|
247
|
-
},
|
|
248
|
-
const n = e.ast, t = {},
|
|
249
|
-
if (n
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
const S = d.propertySignatures.find(
|
|
258
|
-
(m) => m.name.toString() === "_tag"
|
|
227
|
+
}, re = (e) => {
|
|
228
|
+
const n = e.ast, t = {}, i = {}, r = {};
|
|
229
|
+
if (k(n)) {
|
|
230
|
+
const o = n.types.filter((f) => !q(f) && !V(f)).map(E);
|
|
231
|
+
if (o.every((f) => c(f)) && o.length > 0) {
|
|
232
|
+
const f = [];
|
|
233
|
+
for (const a of o)
|
|
234
|
+
if (c(a)) {
|
|
235
|
+
const p = a.propertySignatures.find(
|
|
236
|
+
(b) => b.name.toString() === "_tag"
|
|
259
237
|
);
|
|
260
|
-
let
|
|
261
|
-
|
|
262
|
-
const
|
|
263
|
-
propertySignatures:
|
|
238
|
+
let v = null;
|
|
239
|
+
p && B(p.type) && (v = p.type.literal, f.push(v));
|
|
240
|
+
const M = m({
|
|
241
|
+
propertySignatures: a.propertySignatures
|
|
264
242
|
});
|
|
265
|
-
|
|
243
|
+
v && (r[v] = z(M)), Object.assign(t, M);
|
|
266
244
|
}
|
|
267
|
-
return
|
|
245
|
+
return f.length > 0 && (t._tag = {
|
|
268
246
|
type: "select",
|
|
269
|
-
members:
|
|
247
|
+
members: f,
|
|
270
248
|
required: !0
|
|
271
|
-
}), { meta: t, defaultValues:
|
|
249
|
+
}), { meta: t, defaultValues: i, unionMeta: r };
|
|
272
250
|
}
|
|
273
251
|
}
|
|
274
|
-
if (
|
|
275
|
-
const
|
|
252
|
+
if (c(n)) {
|
|
253
|
+
const s = m({
|
|
276
254
|
propertySignatures: n.propertySignatures
|
|
277
255
|
});
|
|
278
|
-
if (Object.values(
|
|
279
|
-
return { meta:
|
|
280
|
-
const
|
|
281
|
-
for (const
|
|
282
|
-
const
|
|
283
|
-
a
|
|
256
|
+
if (Object.values(s).every((l) => l && "type" in l))
|
|
257
|
+
return { meta: s, defaultValues: i, unionMeta: r };
|
|
258
|
+
const o = (l, f = "") => {
|
|
259
|
+
for (const a in l) {
|
|
260
|
+
const p = f ? `${f}.${a}` : a;
|
|
261
|
+
l[a] && typeof l[a] == "object" && "type" in l[a] ? t[p] = l[a] : l[a] && typeof l[a] == "object" && o(l[a], p);
|
|
284
262
|
}
|
|
285
263
|
};
|
|
286
|
-
|
|
264
|
+
o(s);
|
|
287
265
|
}
|
|
288
|
-
return { meta: t, defaultValues:
|
|
289
|
-
},
|
|
290
|
-
const { meta: n, unionMeta: t } =
|
|
266
|
+
return { meta: t, defaultValues: i, unionMeta: r };
|
|
267
|
+
}, me = (e) => e, ye = (e) => {
|
|
268
|
+
const { meta: n, unionMeta: t } = re(e);
|
|
291
269
|
return { schema: e, meta: n, unionMeta: t };
|
|
292
|
-
},
|
|
293
|
-
n || (n =
|
|
270
|
+
}, ce = (e, n) => {
|
|
271
|
+
n || (n = te().trans);
|
|
294
272
|
let t;
|
|
295
273
|
switch (e.type) {
|
|
296
|
-
case "string":
|
|
297
|
-
t =
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
break;
|
|
318
|
-
case "number":
|
|
319
|
-
e.refinement === "int" ? t = i.Number.annotations({
|
|
320
|
-
message: () => n("validation.empty")
|
|
321
|
-
}).pipe(
|
|
322
|
-
i.int({ message: (s) => n("validation.integer.expected", { actualValue: String(s.actual) }) })
|
|
323
|
-
) : (t = i.Number.annotations({
|
|
324
|
-
message: () => n("validation.number.expected", { actualValue: "NaN" })
|
|
325
|
-
}), e.required && t.annotations({
|
|
326
|
-
message: () => n("validation.empty")
|
|
327
|
-
})), typeof e.minimum == "number" && (t = t.pipe(i.greaterThanOrEqualTo(e.minimum)).annotations({
|
|
328
|
-
message: () => n(e.minimum === 0 ? "validation.number.positive" : "validation.number.min", {
|
|
329
|
-
minimum: e.minimum,
|
|
330
|
-
isExclusive: !0
|
|
331
|
-
})
|
|
332
|
-
})), typeof e.maximum == "number" && (t = t.pipe(i.lessThanOrEqualTo(e.maximum)).annotations({
|
|
333
|
-
message: () => n("validation.number.max", {
|
|
334
|
-
maximum: e.maximum,
|
|
335
|
-
isExclusive: !0
|
|
336
|
-
})
|
|
337
|
-
})), typeof e.exclusiveMinimum == "number" && (t = t.pipe(i.greaterThan(e.exclusiveMinimum)).annotations({
|
|
338
|
-
message: () => n(e.exclusiveMinimum === 0 ? "validation.number.positive" : "validation.number.min", {
|
|
339
|
-
minimum: e.exclusiveMinimum,
|
|
340
|
-
isExclusive: !1
|
|
341
|
-
})
|
|
342
|
-
})), typeof e.exclusiveMaximum == "number" && (t = t.pipe(i.lessThan(e.exclusiveMaximum)).annotations({
|
|
343
|
-
message: () => n("validation.number.max", {
|
|
344
|
-
maximum: e.exclusiveMaximum,
|
|
345
|
-
isExclusive: !1
|
|
346
|
-
})
|
|
347
|
-
}));
|
|
274
|
+
case "string": {
|
|
275
|
+
if (t = N, e.format === "email" && (t = N.check(
|
|
276
|
+
x(
|
|
277
|
+
(i) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i) || n("validation.email.invalid"),
|
|
278
|
+
{ title: "email format" }
|
|
279
|
+
)
|
|
280
|
+
)), e.required || typeof e.minLength == "number") {
|
|
281
|
+
const i = e.required ? Math.max(1, e.minLength || 0) : e.minLength || 0;
|
|
282
|
+
i > 0 && (t = t.check(
|
|
283
|
+
x(
|
|
284
|
+
(r) => r.length >= i || n("validation.string.minLength", { minLength: i }),
|
|
285
|
+
{ title: `minLength(${i})` }
|
|
286
|
+
)
|
|
287
|
+
));
|
|
288
|
+
}
|
|
289
|
+
typeof e.maxLength == "number" && (t = t.check(
|
|
290
|
+
x(
|
|
291
|
+
(i) => i.length <= e.maxLength || n("validation.string.maxLength", { maxLength: e.maxLength }),
|
|
292
|
+
{ title: `maxLength(${e.maxLength})` }
|
|
293
|
+
)
|
|
294
|
+
));
|
|
348
295
|
break;
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
296
|
+
}
|
|
297
|
+
case "number": {
|
|
298
|
+
e.refinement === "int" ? t = Y : t = Z, typeof e.minimum == "number" && (t = t.check(
|
|
299
|
+
x(
|
|
300
|
+
(i) => i >= e.minimum || n(
|
|
301
|
+
e.minimum === 0 ? "validation.number.positive" : "validation.number.min",
|
|
302
|
+
{ minimum: e.minimum, isExclusive: !1 }
|
|
303
|
+
),
|
|
304
|
+
{ title: `>=${e.minimum}` }
|
|
305
|
+
)
|
|
306
|
+
)), typeof e.maximum == "number" && (t = t.check(
|
|
307
|
+
x(
|
|
308
|
+
(i) => i <= e.maximum || n("validation.number.max", {
|
|
309
|
+
maximum: e.maximum,
|
|
310
|
+
isExclusive: !1
|
|
355
311
|
}),
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
312
|
+
{ title: `<=${e.maximum}` }
|
|
313
|
+
)
|
|
314
|
+
)), typeof e.exclusiveMinimum == "number" && (t = t.check(
|
|
315
|
+
x(
|
|
316
|
+
(i) => i > e.exclusiveMinimum || n(
|
|
317
|
+
e.exclusiveMinimum === 0 ? "validation.number.positive" : "validation.number.min",
|
|
318
|
+
{ minimum: e.exclusiveMinimum, isExclusive: !0 }
|
|
319
|
+
),
|
|
320
|
+
{ title: `>${e.exclusiveMinimum}` }
|
|
321
|
+
)
|
|
322
|
+
)), typeof e.exclusiveMaximum == "number" && (t = t.check(
|
|
323
|
+
x(
|
|
324
|
+
(i) => i < e.exclusiveMaximum || n("validation.number.max", {
|
|
325
|
+
maximum: e.exclusiveMaximum,
|
|
326
|
+
isExclusive: !0
|
|
327
|
+
}),
|
|
328
|
+
{ title: `<${e.exclusiveMaximum}` }
|
|
329
|
+
)
|
|
330
|
+
));
|
|
359
331
|
break;
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
332
|
+
}
|
|
333
|
+
case "select": {
|
|
334
|
+
e.members.length === 0 ? t = j : e.members.length === 1 ? t = K(e.members[0]) : t = _(e.members.map((i) => K(i)));
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
case "multiple": {
|
|
338
|
+
t = H(N);
|
|
367
339
|
break;
|
|
368
|
-
|
|
369
|
-
|
|
340
|
+
}
|
|
341
|
+
case "boolean": {
|
|
342
|
+
t = X;
|
|
370
343
|
break;
|
|
371
|
-
|
|
372
|
-
|
|
344
|
+
}
|
|
345
|
+
case "unknown": {
|
|
346
|
+
t = j;
|
|
373
347
|
break;
|
|
374
|
-
|
|
375
|
-
|
|
348
|
+
}
|
|
349
|
+
default: {
|
|
350
|
+
console.warn(`Unhandled field type: ${e.type}`), t = j;
|
|
376
351
|
break;
|
|
352
|
+
}
|
|
377
353
|
}
|
|
378
|
-
return e.required
|
|
379
|
-
|
|
380
|
-
message: () => n("validation.empty")
|
|
381
|
-
})
|
|
382
|
-
) : t = i.NullishOr(t), i.standardSchemaV1(t);
|
|
383
|
-
}, G = (e, n) => i.NullOr(e).pipe(
|
|
384
|
-
i.transform(i.typeSchema(e), {
|
|
385
|
-
decode: (t) => t ?? n(),
|
|
386
|
-
encode: (t) => t
|
|
387
|
-
})
|
|
388
|
-
), K = [
|
|
354
|
+
return e.required || (t = _([t, I, ee])), Q(t);
|
|
355
|
+
}, se = [
|
|
389
356
|
"button",
|
|
390
357
|
"checkbox",
|
|
391
358
|
"color",
|
|
@@ -401,90 +368,72 @@ const j = (e) => i.AST.isUnion(e) && e.types.find((n) => n._tag === "UndefinedKe
|
|
|
401
368
|
"text",
|
|
402
369
|
"time",
|
|
403
370
|
"url"
|
|
404
|
-
],
|
|
405
|
-
function
|
|
371
|
+
], de = (e) => se.includes(e) ? e : "text";
|
|
372
|
+
function le(e, n) {
|
|
406
373
|
const t = { ...e };
|
|
407
|
-
for (const
|
|
408
|
-
Array.isArray(n[
|
|
374
|
+
for (const i in n)
|
|
375
|
+
Array.isArray(n[i]) ? t[i] = n[i] : n[i] && ne(n[i]) ? t[i] = le(t[i], n[i]) : t[i] = n[i];
|
|
409
376
|
return t;
|
|
410
377
|
}
|
|
411
|
-
function
|
|
378
|
+
function A(e) {
|
|
412
379
|
return e && "fields" in e && typeof e.fields == "object";
|
|
413
380
|
}
|
|
414
|
-
function
|
|
381
|
+
function oe(e) {
|
|
415
382
|
return e && "members" in e && Array.isArray(e.members);
|
|
416
383
|
}
|
|
417
|
-
const
|
|
384
|
+
const U = (e, n = {}) => {
|
|
418
385
|
const t = e.ast;
|
|
419
|
-
if (
|
|
420
|
-
return t.defaultValue();
|
|
421
|
-
if (c(e.ast) === "null")
|
|
386
|
+
if (g(e.ast) === "null")
|
|
422
387
|
return null;
|
|
423
|
-
if (
|
|
424
|
-
if (
|
|
425
|
-
const
|
|
426
|
-
for (const
|
|
427
|
-
const
|
|
428
|
-
|
|
388
|
+
if (g(e.ast) !== "undefined") {
|
|
389
|
+
if (c(t)) {
|
|
390
|
+
const i = { ...n };
|
|
391
|
+
for (const r of t.propertySignatures) {
|
|
392
|
+
const s = r.name.toString(), o = r.type;
|
|
393
|
+
let l;
|
|
394
|
+
e.fields && e.fields[s] ? l = e.fields[s] : l = W(o);
|
|
395
|
+
const f = U(l, n[s] || {});
|
|
396
|
+
f !== void 0 && (i[s] = f);
|
|
397
|
+
}
|
|
398
|
+
return i;
|
|
399
|
+
}
|
|
400
|
+
if (A(e)) {
|
|
401
|
+
const i = {};
|
|
402
|
+
for (const [r, s] of Object.entries(e.fields)) {
|
|
403
|
+
const o = s?.ast;
|
|
404
|
+
if (o?.defaultValue)
|
|
429
405
|
try {
|
|
430
|
-
|
|
406
|
+
i[r] = o.defaultValue();
|
|
431
407
|
continue;
|
|
432
408
|
} catch {
|
|
433
409
|
}
|
|
434
|
-
const
|
|
435
|
-
|
|
410
|
+
const l = U(s, n[r] || {});
|
|
411
|
+
l !== void 0 && (i[r] = l);
|
|
436
412
|
}
|
|
437
|
-
return { ...
|
|
413
|
+
return { ...i, ...n };
|
|
438
414
|
}
|
|
439
|
-
if (e?.from &&
|
|
440
|
-
return
|
|
441
|
-
if (
|
|
442
|
-
const
|
|
443
|
-
const f =
|
|
444
|
-
(!
|
|
445
|
-
}),
|
|
446
|
-
return Object.entries(
|
|
415
|
+
if (e?.from && A(e.from))
|
|
416
|
+
return U(e.from, n);
|
|
417
|
+
if (oe(e)) {
|
|
418
|
+
const i = e.members.reduce((r, s) => (A(s) && Object.entries(s.fields).forEach(([o, l]) => {
|
|
419
|
+
const f = l.ast, a = r[o]?.ast;
|
|
420
|
+
(!r[o] || f?.defaultValue && !a?.defaultValue) && (r[o] = l);
|
|
421
|
+
}), r), {});
|
|
422
|
+
return Object.entries(i).reduce((r, [s, o]) => (r[s] = U(o, n[s] || {}), r), n);
|
|
447
423
|
}
|
|
448
|
-
if (Object.keys(n).length === 0)
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
case "Transformation": {
|
|
453
|
-
const o = i.make(e.ast.from);
|
|
454
|
-
return A(o, n);
|
|
455
|
-
}
|
|
456
|
-
case "TypeLiteral": {
|
|
457
|
-
const o = { ...n };
|
|
458
|
-
for (const s of t.propertySignatures) {
|
|
459
|
-
const r = s.name.toString(), l = s.type;
|
|
460
|
-
if (l._tag === "Transformation" && l.defaultValue) {
|
|
461
|
-
o[r] = l.defaultValue();
|
|
462
|
-
continue;
|
|
463
|
-
}
|
|
464
|
-
if (l.defaultValue) {
|
|
465
|
-
o[r] = l.defaultValue();
|
|
466
|
-
continue;
|
|
467
|
-
}
|
|
468
|
-
const a = i.make(l), f = A(a, n[r] || {});
|
|
469
|
-
f !== void 0 && (o[r] = f);
|
|
470
|
-
}
|
|
471
|
-
return o;
|
|
472
|
-
}
|
|
473
|
-
case "StringKeyword":
|
|
474
|
-
return "";
|
|
475
|
-
case "BooleanKeyword":
|
|
476
|
-
return !1;
|
|
477
|
-
}
|
|
424
|
+
if (Object.keys(n).length === 0 && t.context?.defaultValue, J(t))
|
|
425
|
+
return "";
|
|
426
|
+
if (R(t))
|
|
427
|
+
return !1;
|
|
478
428
|
}
|
|
479
429
|
};
|
|
480
430
|
export {
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
G as nullableInput
|
|
431
|
+
m as createMeta,
|
|
432
|
+
le as deepMerge,
|
|
433
|
+
U as defaultsValueFromSchema,
|
|
434
|
+
me as duplicateSchema,
|
|
435
|
+
ce as generateInputStandardSchemaFromFieldMeta,
|
|
436
|
+
ye as generateMetaFromSchema,
|
|
437
|
+
de as getInputType,
|
|
438
|
+
g as isNullableOrUndefined
|
|
490
439
|
};
|