@effect-app/vue-components 4.0.0-beta.298 → 4.0.0-beta.299

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.
Files changed (70) hide show
  1. package/dist/types/components/FixedNuxtErrorBoundary.vue.d.ts +39 -0
  2. package/dist/types/components/index.d.ts +1 -0
  3. package/dist/vue-components.es.js +19 -18
  4. package/dist/vue-components11.es.js +55 -19
  5. package/dist/vue-components12.es.js +4 -48
  6. package/dist/vue-components13.es.js +19 -127
  7. package/dist/vue-components14.es.js +46 -62
  8. package/dist/vue-components15.es.js +115 -101
  9. package/dist/vue-components16.es.js +63 -20
  10. package/dist/vue-components17.es.js +113 -4
  11. package/dist/vue-components18.es.js +20 -78
  12. package/dist/vue-components19.es.js +4 -92
  13. package/dist/vue-components20.es.js +75 -68
  14. package/dist/vue-components21.es.js +91 -10
  15. package/dist/vue-components22.es.js +72 -56
  16. package/dist/vue-components23.es.js +11 -4
  17. package/dist/vue-components24.es.js +49 -36
  18. package/dist/vue-components25.es.js +1 -1
  19. package/dist/vue-components26.es.js +39 -79
  20. package/dist/vue-components27.es.js +5 -0
  21. package/dist/vue-components28.es.js +83 -7
  22. package/dist/vue-components30.es.js +7 -23
  23. package/dist/vue-components31.es.js +8 -299
  24. package/dist/vue-components32.es.js +24 -0
  25. package/dist/vue-components33.es.js +299 -7
  26. package/dist/vue-components35.es.js +5 -2
  27. package/dist/vue-components36.es.js +61 -52
  28. package/dist/vue-components37.es.js +1 -1
  29. package/dist/vue-components38.es.js +58 -18
  30. package/dist/vue-components39.es.js +1 -1
  31. package/dist/vue-components40.es.js +18 -53
  32. package/dist/vue-components41.es.js +1 -1
  33. package/dist/vue-components42.es.js +58 -11
  34. package/dist/vue-components43.es.js +4 -21
  35. package/dist/vue-components44.es.js +12 -0
  36. package/dist/vue-components45.es.js +21 -8
  37. package/dist/vue-components47.es.js +8 -37
  38. package/dist/vue-components48.es.js +3 -26
  39. package/dist/vue-components49.es.js +34 -24
  40. package/dist/vue-components50.es.js +26 -6
  41. package/dist/vue-components51.es.js +25 -15
  42. package/dist/vue-components52.es.js +6 -35
  43. package/dist/vue-components53.es.js +16 -16
  44. package/dist/vue-components54.es.js +32 -17
  45. package/dist/vue-components55.es.js +16 -28
  46. package/dist/vue-components56.es.js +20 -6
  47. package/dist/vue-components57.es.js +28 -7
  48. package/dist/vue-components58.es.js +6 -37
  49. package/dist/vue-components59.es.js +8 -24
  50. package/dist/vue-components60.es.js +37 -127
  51. package/dist/vue-components61.es.js +22 -21
  52. package/dist/vue-components62.es.js +127 -20
  53. package/dist/vue-components63.es.js +21 -6
  54. package/dist/vue-components64.es.js +15 -13
  55. package/dist/vue-components65.es.js +8 -4
  56. package/dist/vue-components66.es.js +13 -23
  57. package/dist/vue-components67.es.js +3 -3
  58. package/dist/vue-components68.es.js +27 -41
  59. package/dist/vue-components69.es.js +4 -100
  60. package/dist/vue-components70.es.js +39 -32
  61. package/dist/vue-components71.es.js +100 -18
  62. package/dist/vue-components72.es.js +35 -47
  63. package/dist/vue-components73.es.js +19 -0
  64. package/dist/vue-components74.es.js +50 -0
  65. package/package.json +9 -3
  66. package/src/components/FixedNuxtErrorBoundary.vue +112 -0
  67. package/src/components/index.ts +1 -0
  68. package/dist/vue-components29.es.js +0 -9
  69. package/dist/vue-components34.es.js +0 -73
  70. package/dist/vue-components46.es.js +0 -4
@@ -0,0 +1,39 @@
1
+ type __VLS_Props = {
2
+ captureException: (err: Error, hint?: {
3
+ extra?: Record<string, unknown>;
4
+ }) => void;
5
+ toastError: (message: string) => void;
6
+ debug: boolean;
7
+ /** register the boundary only when true (backend passes import.meta.client; frontend omits → true) */
8
+ enabled?: boolean;
9
+ /** defer handling until app ready (backend: onNuxtReady while hydrating; frontend: omit → run now) */
10
+ scheduleAfterReady?: (fn: () => void) => void;
11
+ /** extra side-effect after emit, before error.value is set (backend: nuxtApp vue:error hook) */
12
+ onHandled?: (err: Error, instance: unknown, info: string) => void;
13
+ };
14
+ type __VLS_Slots = {
15
+ error(props: {
16
+ error: Error;
17
+ clearError: () => void;
18
+ }): any;
19
+ default(): any;
20
+ };
21
+ declare function clearError(): void;
22
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
23
+ error: import("vue").ShallowRef<Error | null, Error | null>;
24
+ clearError: typeof clearError;
25
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
26
+ error: (error: Error) => any;
27
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
28
+ onError?: ((error: Error) => any) | undefined;
29
+ }>, {
30
+ enabled: boolean;
31
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
32
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
33
+ declare const _default: typeof __VLS_export;
34
+ export default _default;
35
+ type __VLS_WithSlots<T, S> = T & {
36
+ new (): {
37
+ $slots: S;
38
+ };
39
+ };
@@ -1,3 +1,4 @@
1
1
  export { default as CommandButton } from "./CommandButton.vue";
2
2
  export { default as Dialog } from "./Dialog.vue";
3
+ export { default as FixedNuxtErrorBoundary } from "./FixedNuxtErrorBoundary.vue";
3
4
  export * from "./OmegaForm";
@@ -2,29 +2,30 @@ import e from "./vue-components4.es.js";
2
2
  import { getTransformationFrom as t, provideIntl as n, useIntl as r, useIntlKey as i } from "./vue-components6.es.js";
3
3
  import { useOnClose as a, usePreventClose as o } from "./vue-components8.es.js";
4
4
  import s from "./vue-components10.es.js";
5
- import { getInputType as c } from "./vue-components11.es.js";
6
- import { createMeta as l, generateMetaFromSchema as u, isNullableOrUndefined as d, metadataFromAst as f } from "./vue-components14.es.js";
7
- import { defaultsValueFromSchema as p } from "./vue-components15.es.js";
8
- import { toFormSchema as m } from "./vue-components16.es.js";
9
- import { deepMerge as h } from "./vue-components18.es.js";
10
- import { makeStandardSchemaV1Hooks as g, toLocalizedStandardSchemaV1 as _ } from "./vue-components19.es.js";
11
- import { useErrorLabel as v } from "./vue-components20.es.js";
12
- import y from "./vue-components35.es.js";
5
+ import c from "./vue-components12.es.js";
6
+ import { getInputType as l } from "./vue-components13.es.js";
7
+ import { createMeta as u, generateMetaFromSchema as d, isNullableOrUndefined as f, metadataFromAst as p } from "./vue-components16.es.js";
8
+ import { defaultsValueFromSchema as m } from "./vue-components17.es.js";
9
+ import { toFormSchema as h } from "./vue-components18.es.js";
10
+ import { deepMerge as g } from "./vue-components20.es.js";
11
+ import { makeStandardSchemaV1Hooks as _, toLocalizedStandardSchemaV1 as v } from "./vue-components21.es.js";
12
+ import { useErrorLabel as y } from "./vue-components22.es.js";
13
13
  import b from "./vue-components37.es.js";
14
14
  import x from "./vue-components39.es.js";
15
15
  import S from "./vue-components41.es.js";
16
- import { FormErrors as C } from "./vue-components68.es.js";
17
- import { OmegaFormKey as w, useOmegaForm as T } from "./vue-components69.es.js";
18
- import { createUseFormWithCustomInput as E } from "./vue-components70.es.js";
19
- import { duplicateSchema as D } from "./vue-components71.es.js";
20
- import { components_exports as O } from "./vue-components72.es.js";
16
+ import C from "./vue-components43.es.js";
17
+ import { FormErrors as w } from "./vue-components70.es.js";
18
+ import { OmegaFormKey as T, useOmegaForm as E } from "./vue-components71.es.js";
19
+ import { createUseFormWithCustomInput as D } from "./vue-components72.es.js";
20
+ import { duplicateSchema as O } from "./vue-components73.es.js";
21
+ import { components_exports as k } from "./vue-components74.es.js";
21
22
  //#region src/index.ts
22
- function k(e) {
23
- for (let t in O) if (Object.prototype.hasOwnProperty.call(O, t)) {
24
- let n = O[t];
23
+ function A(e) {
24
+ for (let t in k) if (Object.prototype.hasOwnProperty.call(k, t)) {
25
+ let n = k[t];
25
26
  n && typeof n == "object" && e.component(t, n);
26
27
  }
27
28
  }
28
- var A = { install: k };
29
+ var j = { install: A };
29
30
  //#endregion
30
- export { e as CommandButton, s as Dialog, C as FormErrors, w as OmegaFormKey, b as OmegaInput, S as OmegaTaggedUnion, x as OmegaTaggedUnionInternal, y as OmegaVuetifyInput, l as createMeta, E as createUseFormWithCustomInput, h as deepMerge, A as default, p as defaultsValueFromSchema, D as duplicateSchema, u as generateMetaFromSchema, c as getInputType, t as getTransformationFrom, d as isNullableOrUndefined, g as makeStandardSchemaV1Hooks, f as metadataFromAst, n as provideIntl, m as toFormSchema, _ as toLocalizedStandardSchemaV1, v as useErrorLabel, r as useIntl, i as useIntlKey, T as useOmegaForm, a as useOnClose, o as usePreventClose };
31
+ export { e as CommandButton, s as Dialog, c as FixedNuxtErrorBoundary, w as FormErrors, T as OmegaFormKey, x as OmegaInput, C as OmegaTaggedUnion, S as OmegaTaggedUnionInternal, b as OmegaVuetifyInput, u as createMeta, D as createUseFormWithCustomInput, g as deepMerge, j as default, m as defaultsValueFromSchema, O as duplicateSchema, d as generateMetaFromSchema, l as getInputType, t as getTransformationFrom, f as isNullableOrUndefined, _ as makeStandardSchemaV1Hooks, p as metadataFromAst, n as provideIntl, h as toFormSchema, v as toLocalizedStandardSchemaV1, y as useErrorLabel, r as useIntl, i as useIntlKey, E as useOmegaForm, a as useOnClose, o as usePreventClose };
@@ -1,20 +1,56 @@
1
- //#region src/components/OmegaForm/inputs.ts
2
- var e = [
3
- "button",
4
- "checkbox",
5
- "color",
6
- "date",
7
- "email",
8
- "number",
9
- "password",
10
- "radio",
11
- "range",
12
- "search",
13
- "submit",
14
- "tel",
15
- "text",
16
- "time",
17
- "url"
18
- ], t = (t) => e.includes(t) ? t : "text";
1
+ import { defineComponent as e, mergeProps as t, normalizeProps as n, onErrorCaptured as r, renderSlot as i, shallowRef as a } from "vue";
2
+ import { CauseException as o } from "effect-app/client";
3
+ import * as s from "effect/Cause";
4
+ import { useRouter as c } from "vue-router";
5
+ //#region src/components/FixedNuxtErrorBoundary.vue?vue&type=script&setup=true&lang.ts
6
+ var l = /*@__PURE__*/ e({
7
+ name: "NuxtErrorBoundary",
8
+ inheritAttrs: !1,
9
+ __name: "FixedNuxtErrorBoundary",
10
+ props: {
11
+ captureException: {},
12
+ toastError: {},
13
+ debug: { type: Boolean },
14
+ enabled: {
15
+ type: Boolean,
16
+ default: !0
17
+ },
18
+ scheduleAfterReady: {},
19
+ onHandled: {}
20
+ },
21
+ emits: ["error"],
22
+ setup(e, { expose: l, emit: u }) {
23
+ let d = e, f = u, p = a(null);
24
+ function m() {
25
+ p.value = null;
26
+ }
27
+ let h = [
28
+ "https://vuejs.org/error-reference/#runtime-0",
29
+ 0,
30
+ "0",
31
+ "setup function"
32
+ ];
33
+ function g(...e) {
34
+ let [t, n, r] = e, i = t instanceof o ? t : null;
35
+ if (console.warn("NuxtErrorBoundary caught error in " + r + ": " + (i ? "CauseException" : "classic error"), i ? s.pretty(i.originalCause) : t, n), !h.includes(r)) {
36
+ d.captureException(t, { extra: {
37
+ info: r,
38
+ instance: n
39
+ } }), d.debug && d.toastError("An unexpected error has occurred: " + t.toString());
40
+ return;
41
+ }
42
+ i && s.hasInterruptsOnly(i.originalCause) || (f("error", t), d.onHandled?.(t, n, r), p.value = t);
43
+ }
44
+ return d.enabled && r((e, t, n) => (d.scheduleAfterReady ? d.scheduleAfterReady(() => g(e, t, n)) : g(e, t, n), !1)), c().afterEach(() => {
45
+ m();
46
+ }), l({
47
+ error: p,
48
+ clearError: m
49
+ }), (e, r) => p.value ? i(e.$slots, "error", n(t({ key: 0 }, {
50
+ error: p.value,
51
+ clearError: m
52
+ }))) : i(e.$slots, "default", { key: 1 });
53
+ }
54
+ });
19
55
  //#endregion
20
- export { t as getInputType };
56
+ export { l as default };
@@ -1,49 +1,5 @@
1
- import * as e from "effect-app/Schema";
2
- //#region src/components/OmegaForm/meta/checks.ts
3
- var t = (e) => (e.checks ?? []).flatMap((e) => {
4
- if (e._tag === "FilterGroup") return e.checks.flatMap((e) => {
5
- let t = e.annotations?.meta;
6
- return t && typeof t == "object" ? [t] : [];
7
- });
8
- let t = e.annotations?.meta;
9
- return t && typeof t == "object" ? [t] : [];
10
- }), n = (n) => {
11
- let r = { description: e.AST.resolveDescription(n) }, i = t(n);
12
- if (e.AST.isString(n)) {
13
- r.type = "string";
14
- for (let e of i) switch (e._tag) {
15
- case "isMinLength":
16
- r.minLength = e.minLength;
17
- break;
18
- case "isMaxLength":
19
- r.maxLength = e.maxLength;
20
- break;
21
- }
22
- n.annotations?.format === "email" && (r.format = "email");
23
- } else if (e.AST.isNumber(n)) {
24
- r.type = "number";
25
- for (let e of i) switch (e._tag) {
26
- case "isInt":
27
- r.refinement = "int";
28
- break;
29
- case "isGreaterThanOrEqualTo":
30
- r.minimum = e.minimum;
31
- break;
32
- case "isLessThanOrEqualTo":
33
- r.maximum = e.maximum;
34
- break;
35
- case "isBetween":
36
- r.minimum = e.minimum, r.maximum = e.maximum;
37
- break;
38
- case "isGreaterThan":
39
- r.exclusiveMinimum = e.exclusiveMinimum;
40
- break;
41
- case "isLessThan":
42
- r.exclusiveMaximum = e.exclusiveMaximum;
43
- break;
44
- }
45
- } else e.AST.isBoolean(n) ? r.type = "boolean" : e.AST.isDeclaration(n) && n.annotations?.typeConstructor?._tag === "Date" ? r.type = "date" : r.type = "unknown";
46
- return r;
47
- };
1
+ import e from "./vue-components11.es.js";
2
+ //#region src/components/FixedNuxtErrorBoundary.vue
3
+ var t = e;
48
4
  //#endregion
49
- export { n as getFieldMetadataFromAst };
5
+ export { t as default };
@@ -1,128 +1,20 @@
1
- import { getFieldMetadataFromAst as e } from "./vue-components12.es.js";
2
- import { isNullableOrUndefined as t, unwrapDeclaration as n } from "./vue-components14.es.js";
3
- import * as r from "effect-app/Schema";
4
- //#region src/components/OmegaForm/meta/walker.ts
5
- var i = (e) => r.AST.isUndefined(e) || r.AST.isNull(e), a = (e) => r.AST.isUnion(e) && e.types.length === 1 && r.AST.isLiteral(e.types[0]) ? e.types[0] : e, o = (e) => e.flatMap((e) => r.AST.isUnion(e) ? o(e.types) : [e]), s = (t, n) => {
6
- let { nullableOrUndefined: i, required: a } = n;
7
- return r.AST.isArrays(t) ? {
8
- required: a,
9
- nullableOrUndefined: i,
10
- type: "multiple",
11
- members: t.elements,
12
- rest: t.rest
13
- } : r.AST.isLiteral(t) ? {
14
- required: a,
15
- nullableOrUndefined: i,
16
- type: "select",
17
- members: [t.literal]
18
- } : {
19
- ...e(t),
20
- required: a,
21
- nullableOrUndefined: i
22
- };
23
- }, c = (e, n, r, i) => {
24
- for (let a of e) {
25
- let e = n ? `${n}.${a.name.toString()}` : a.name.toString(), o = t(a.type), s = a.type.context?.isOptional === !0, c;
26
- c = r.isNullableDiscriminatedUnion && a.name.toString() === "_tag" ? !1 : r.required ? s ? !1 : !o : !1, u(a.type, e, {
27
- required: c,
28
- nullableOrUndefined: o,
29
- isOptionalKey: s
30
- }, i);
31
- }
32
- }, l = (e, t, l, d) => {
33
- let { acc: f } = d, p = o(e.types).map(n), m = p.filter((e) => !i(e));
34
- if (m.length === 1 && r.AST.isLiteral(m[0]) && typeof m[0].literal == "boolean") {
35
- f[t] = s(m[0], l);
36
- return;
37
- }
38
- if (m.some(r.AST.isObjects)) {
39
- let e = !!l.nullableOrUndefined && m.length > 1;
40
- if (!l.nullableOrUndefined && t) {
41
- let e = m.find((e) => !r.AST.isObjects(e));
42
- e && (f[t] = s(e, l));
43
- }
44
- let n = [], i = e ? {
45
- required: !0,
46
- nullableOrUndefined: !1,
47
- isNullableDiscriminatedUnion: !0
48
- } : {
49
- required: !0,
50
- nullableOrUndefined: !1
51
- };
52
- for (let e of m) {
53
- if (!r.AST.isObjects(e)) continue;
54
- let o = e.propertySignatures.find((e) => e.name.toString() === "_tag"), s = o ? a(o.type) : null, l = null;
55
- s && r.AST.isLiteral(s) && (l = s.literal, n.includes(l) || n.push(l));
56
- let u = {
57
- acc: {},
58
- unionMeta: d.unionMeta
59
- };
60
- if (c(e.propertySignatures, t, i, u), l) {
61
- let e = d.unionMeta[l];
62
- e ? Object.assign(e, u.acc) : d.unionMeta[l] = u.acc;
63
- }
64
- for (let [e, t] of Object.entries(u.acc)) {
65
- let n = f[e];
66
- n && n.type === "select" && t?.type === "select" ? n.members = [...n.members, ...t.members.filter((e) => !n.members.includes(e))] : f[e] = t;
67
- }
68
- }
69
- if (n.length > 0) {
70
- let r = t ? `${t}._tag` : "_tag", i = f[r];
71
- if (i && i.type === "select") for (let e of n) i.members.includes(e) || i.members.push(e);
72
- else f[r] = {
73
- type: "select",
74
- members: n,
75
- required: !e
76
- };
77
- }
78
- return;
79
- }
80
- let h = m.find(r.AST.isArrays);
81
- if (h) {
82
- u(h, t, l, d);
83
- return;
84
- }
85
- let g = p.map(a);
86
- if (g.every((e) => i(e) || r.AST.isLiteral(e))) {
87
- let { isOptionalKey: e, nullableOrUndefined: n, required: i } = l, a = {
88
- required: i,
89
- nullableOrUndefined: n,
90
- type: "select",
91
- members: g.filter(r.AST.isLiteral).map((e) => e.literal)
92
- };
93
- e && (a.isOptionalKey = !0), f[t] = a;
94
- return;
95
- }
96
- let _ = m[0];
97
- _ && u(_, t, l, d);
98
- }, u = (t, i, a, o) => {
99
- t = n(t);
100
- let { acc: u } = o;
101
- if (r.AST.isObjects(t)) {
102
- c(t.propertySignatures, i, a, o);
103
- return;
104
- }
105
- if (r.AST.isUnion(t)) {
106
- l(t, i, a, o);
107
- return;
108
- }
109
- if (r.AST.isArrays(t)) {
110
- let e = t.rest.length > 0 ? n(t.rest[0]) : null;
111
- if (e && r.AST.isObjects(e)) {
112
- c(e.propertySignatures, i, {
113
- required: !0,
114
- nullableOrUndefined: !1
115
- }, o);
116
- return;
117
- }
118
- u[i] = s(t, a);
119
- return;
120
- }
121
- let { isOptionalKey: d, nullableOrUndefined: f, required: p } = a, m = {
122
- required: p && (!r.AST.isString(t) || !!e(t).minLength),
123
- nullableOrUndefined: f
124
- }, h = s(t, m);
125
- d && (h.isOptionalKey = !0), u[i] = h;
126
- };
1
+ //#region src/components/OmegaForm/inputs.ts
2
+ var e = [
3
+ "button",
4
+ "checkbox",
5
+ "color",
6
+ "date",
7
+ "email",
8
+ "number",
9
+ "password",
10
+ "radio",
11
+ "range",
12
+ "search",
13
+ "submit",
14
+ "tel",
15
+ "text",
16
+ "time",
17
+ "url"
18
+ ], t = (t) => e.includes(t) ? t : "text";
127
19
  //#endregion
128
- export { l as classifyAndWalkUnion, s as leafMetaForAst, c as walkStruct };
20
+ export { t as getInputType };
@@ -1,65 +1,49 @@
1
- import { getTransformationFrom as e } from "./vue-components6.es.js";
2
- import { classifyAndWalkUnion as t, leafMetaForAst as n, walkStruct as r } from "./vue-components13.es.js";
3
- import * as i from "effect-app/Schema";
4
- //#region src/components/OmegaForm/meta/createMeta.ts
5
- var a = (t) => {
6
- let n = e(t);
7
- for (; i.AST.isDeclaration(n) && n.typeParameters.length > 0;) n = e(n.typeParameters[0]);
8
- return n;
9
- }, o = (e) => !e || !i.AST.isUnion(e) ? !1 : e.types.find((e) => i.AST.isUndefined(e)) ? "undefined" : e.types.find((e) => i.AST.isNull(e)) ? "null" : !1, s = ({ meta: e = {}, parent: s = "", property: c, propertySignatures: l }, u = {}) => {
10
- let d = {
11
- acc: u,
12
- unionMeta: {}
13
- };
14
- if (l) return r(l, s, {
15
- required: e.required !== !1,
16
- nullableOrUndefined: e.nullableOrUndefined ?? !1
17
- }, d), u;
18
- if (c) {
19
- let l = o(c), f = a(c), p = {
20
- required: Object.hasOwnProperty.call(e, "required") ? e.required : !l,
21
- nullableOrUndefined: e.nullableOrUndefined ?? l
22
- };
23
- if (i.AST.isObjects(f)) return r(f.propertySignatures, s, p, d), u;
24
- if (i.AST.isUnion(f)) {
25
- let e = {
26
- acc: {},
27
- unionMeta: {}
28
- };
29
- t(f, s, p, e);
30
- let n = e.acc[s];
31
- if (n) return n;
32
- }
33
- return n(f, p);
34
- }
35
- return u;
36
- }, c = (e) => {
37
- let n = a(e.ast), o = {}, s = {}, c = {}, l = {
38
- acc: o,
39
- unionMeta: c
40
- };
41
- return i.AST.isUnion(n) ? (t(n, "", {
42
- required: !0,
43
- nullableOrUndefined: !1
44
- }, l), {
45
- meta: o,
46
- defaultValues: s,
47
- unionMeta: c
48
- }) : (i.AST.isObjects(n) && r(n.propertySignatures, "", {
49
- required: !0,
50
- nullableOrUndefined: !1
51
- }, l), {
52
- meta: o,
53
- defaultValues: s,
54
- unionMeta: c
1
+ import * as e from "effect-app/Schema";
2
+ //#region src/components/OmegaForm/meta/checks.ts
3
+ var t = (e) => (e.checks ?? []).flatMap((e) => {
4
+ if (e._tag === "FilterGroup") return e.checks.flatMap((e) => {
5
+ let t = e.annotations?.meta;
6
+ return t && typeof t == "object" ? [t] : [];
55
7
  });
56
- }, l = (e) => {
57
- let { meta: t, unionMeta: n } = c(e);
58
- return {
59
- schema: e,
60
- meta: t,
61
- unionMeta: n
62
- };
8
+ let t = e.annotations?.meta;
9
+ return t && typeof t == "object" ? [t] : [];
10
+ }), n = (n) => {
11
+ let r = { description: e.AST.resolveDescription(n) }, i = t(n);
12
+ if (e.AST.isString(n)) {
13
+ r.type = "string";
14
+ for (let e of i) switch (e._tag) {
15
+ case "isMinLength":
16
+ r.minLength = e.minLength;
17
+ break;
18
+ case "isMaxLength":
19
+ r.maxLength = e.maxLength;
20
+ break;
21
+ }
22
+ n.annotations?.format === "email" && (r.format = "email");
23
+ } else if (e.AST.isNumber(n)) {
24
+ r.type = "number";
25
+ for (let e of i) switch (e._tag) {
26
+ case "isInt":
27
+ r.refinement = "int";
28
+ break;
29
+ case "isGreaterThanOrEqualTo":
30
+ r.minimum = e.minimum;
31
+ break;
32
+ case "isLessThanOrEqualTo":
33
+ r.maximum = e.maximum;
34
+ break;
35
+ case "isBetween":
36
+ r.minimum = e.minimum, r.maximum = e.maximum;
37
+ break;
38
+ case "isGreaterThan":
39
+ r.exclusiveMinimum = e.exclusiveMinimum;
40
+ break;
41
+ case "isLessThan":
42
+ r.exclusiveMaximum = e.exclusiveMaximum;
43
+ break;
44
+ }
45
+ } else e.AST.isBoolean(n) ? r.type = "boolean" : e.AST.isDeclaration(n) && n.annotations?.typeConstructor?._tag === "Date" ? r.type = "date" : r.type = "unknown";
46
+ return r;
63
47
  };
64
48
  //#endregion
65
- export { s as createMeta, l as generateMetaFromSchema, o as isNullableOrUndefined, c as metadataFromAst, a as unwrapDeclaration };
49
+ export { n as getFieldMetadataFromAst };