@effect-app/vue-components 4.0.0-beta.33 → 4.0.0-beta.36
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/OmegaFormStuff.d.ts +8 -3
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +1 -1
- package/dist/vue-components.es.js +8 -7
- package/dist/vue-components.es10.js +120 -120
- package/dist/vue-components.es12.js +160 -138
- package/dist/vue-components.es2.js +15 -14
- package/dist/vue-components.es45.js +1 -1
- package/dist/vue-components.es52.js +2 -2
- package/dist/vue-components.es53.js +3 -3
- package/dist/vue-components.es55.js +29 -65
- package/dist/vue-components.es56.js +54 -45
- package/dist/vue-components.es57.js +54 -15
- package/dist/vue-components.es58.js +15 -31
- package/dist/vue-components.es59.js +30 -26
- package/package.json +5 -5
- package/src/components/OmegaForm/OmegaFormStuff.ts +75 -4
- package/src/components/OmegaForm/useOmegaForm.ts +5 -4
|
@@ -1,67 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return i.concat(e || Array.prototype.slice.call(n));
|
|
25
|
-
}, h = "diag", P = (
|
|
26
|
-
/** @class */
|
|
27
|
-
(function() {
|
|
28
|
-
function i() {
|
|
29
|
-
function n(a) {
|
|
30
|
-
return function() {
|
|
31
|
-
for (var e = [], o = 0; o < arguments.length; o++)
|
|
32
|
-
e[o] = arguments[o];
|
|
33
|
-
var l = v("diag");
|
|
34
|
-
if (l)
|
|
35
|
-
return l[a].apply(l, _([], b(e), !1));
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
var r = this, t = function(a, e) {
|
|
39
|
-
var o, l, g;
|
|
40
|
-
if (e === void 0 && (e = { logLevel: d.INFO }), a === r) {
|
|
41
|
-
var u = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
42
|
-
return r.error((o = u.stack) !== null && o !== void 0 ? o : u.message), !1;
|
|
43
|
-
}
|
|
44
|
-
typeof e == "number" && (e = {
|
|
45
|
-
logLevel: e
|
|
46
|
-
});
|
|
47
|
-
var f = v("diag"), s = y((l = e.logLevel) !== null && l !== void 0 ? l : d.INFO, a);
|
|
48
|
-
if (f && !e.suppressOverrideMessage) {
|
|
49
|
-
var c = (g = new Error().stack) !== null && g !== void 0 ? g : "<failed to generate stacktrace>";
|
|
50
|
-
f.warn("Current logger will be overwritten from " + c), s.warn("Current logger will overwrite one already registered from " + c);
|
|
51
|
-
}
|
|
52
|
-
return w("diag", s, r, !0);
|
|
53
|
-
};
|
|
54
|
-
r.setLogger = t, r.disable = function() {
|
|
55
|
-
p(h, r);
|
|
56
|
-
}, r.createComponentLogger = function(a) {
|
|
57
|
-
return new m(a);
|
|
58
|
-
}, r.verbose = n("verbose"), r.debug = n("debug"), r.info = n("info"), r.warn = n("warn"), r.error = n("error");
|
|
59
|
-
}
|
|
60
|
-
return i.instance = function() {
|
|
61
|
-
return this._instance || (this._instance = new i()), this._instance;
|
|
62
|
-
}, i;
|
|
63
|
-
})()
|
|
64
|
-
);
|
|
1
|
+
import { createContextKey as o } from "./vue-components.es42.js";
|
|
2
|
+
import { NonRecordingSpan as a } from "./vue-components.es51.js";
|
|
3
|
+
import { ContextAPI as u } from "./vue-components.es52.js";
|
|
4
|
+
var n = o("OpenTelemetry Context Key SPAN");
|
|
5
|
+
function r(e) {
|
|
6
|
+
return e.getValue(n) || void 0;
|
|
7
|
+
}
|
|
8
|
+
function S() {
|
|
9
|
+
return r(u.getInstance().active());
|
|
10
|
+
}
|
|
11
|
+
function i(e, t) {
|
|
12
|
+
return e.setValue(n, t);
|
|
13
|
+
}
|
|
14
|
+
function l(e) {
|
|
15
|
+
return e.deleteValue(n);
|
|
16
|
+
}
|
|
17
|
+
function d(e, t) {
|
|
18
|
+
return i(e, new a(t));
|
|
19
|
+
}
|
|
20
|
+
function m(e) {
|
|
21
|
+
var t;
|
|
22
|
+
return (t = r(e)) === null || t === void 0 ? void 0 : t.spanContext();
|
|
23
|
+
}
|
|
65
24
|
export {
|
|
66
|
-
|
|
25
|
+
l as deleteSpan,
|
|
26
|
+
S as getActiveSpan,
|
|
27
|
+
r as getSpan,
|
|
28
|
+
m as getSpanContext,
|
|
29
|
+
i as setSpan,
|
|
30
|
+
d as setSpanContext
|
|
67
31
|
};
|
|
@@ -1,58 +1,67 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { DiagComponentLogger as m } from "./vue-components.es57.js";
|
|
2
|
+
import { createLogLevelDiagLogger as y } from "./vue-components.es58.js";
|
|
3
|
+
import { DiagLogLevel as d } from "./vue-components.es43.js";
|
|
4
|
+
import { unregisterGlobal as p, getGlobal as v, registerGlobal as w } from "./vue-components.es59.js";
|
|
5
|
+
var b = function(i, n) {
|
|
6
|
+
var r = typeof Symbol == "function" && i[Symbol.iterator];
|
|
7
|
+
if (!r) return i;
|
|
8
|
+
var t = r.call(i), a, e = [], o;
|
|
6
9
|
try {
|
|
7
|
-
for (; (
|
|
8
|
-
} catch (
|
|
9
|
-
|
|
10
|
+
for (; (n === void 0 || n-- > 0) && !(a = t.next()).done; ) e.push(a.value);
|
|
11
|
+
} catch (l) {
|
|
12
|
+
o = { error: l };
|
|
10
13
|
} finally {
|
|
11
14
|
try {
|
|
12
|
-
|
|
15
|
+
a && !a.done && (r = t.return) && r.call(t);
|
|
13
16
|
} finally {
|
|
14
|
-
if (
|
|
17
|
+
if (o) throw o.error;
|
|
15
18
|
}
|
|
16
19
|
}
|
|
17
|
-
return
|
|
18
|
-
},
|
|
19
|
-
if (r || arguments.length === 2) for (var t = 0,
|
|
20
|
-
(
|
|
21
|
-
return
|
|
22
|
-
},
|
|
20
|
+
return e;
|
|
21
|
+
}, _ = function(i, n, r) {
|
|
22
|
+
if (r || arguments.length === 2) for (var t = 0, a = n.length, e; t < a; t++)
|
|
23
|
+
(e || !(t in n)) && (e || (e = Array.prototype.slice.call(n, 0, t)), e[t] = n[t]);
|
|
24
|
+
return i.concat(e || Array.prototype.slice.call(n));
|
|
25
|
+
}, h = "diag", P = (
|
|
23
26
|
/** @class */
|
|
24
27
|
(function() {
|
|
25
|
-
function
|
|
26
|
-
|
|
28
|
+
function i() {
|
|
29
|
+
function n(a) {
|
|
30
|
+
return function() {
|
|
31
|
+
for (var e = [], o = 0; o < arguments.length; o++)
|
|
32
|
+
e[o] = arguments[o];
|
|
33
|
+
var l = v("diag");
|
|
34
|
+
if (l)
|
|
35
|
+
return l[a].apply(l, _([], b(e), !1));
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
var r = this, t = function(a, e) {
|
|
39
|
+
var o, l, g;
|
|
40
|
+
if (e === void 0 && (e = { logLevel: d.INFO }), a === r) {
|
|
41
|
+
var u = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
42
|
+
return r.error((o = u.stack) !== null && o !== void 0 ? o : u.message), !1;
|
|
43
|
+
}
|
|
44
|
+
typeof e == "number" && (e = {
|
|
45
|
+
logLevel: e
|
|
46
|
+
});
|
|
47
|
+
var f = v("diag"), s = y((l = e.logLevel) !== null && l !== void 0 ? l : d.INFO, a);
|
|
48
|
+
if (f && !e.suppressOverrideMessage) {
|
|
49
|
+
var c = (g = new Error().stack) !== null && g !== void 0 ? g : "<failed to generate stacktrace>";
|
|
50
|
+
f.warn("Current logger will be overwritten from " + c), s.warn("Current logger will overwrite one already registered from " + c);
|
|
51
|
+
}
|
|
52
|
+
return w("diag", s, r, !0);
|
|
53
|
+
};
|
|
54
|
+
r.setLogger = t, r.disable = function() {
|
|
55
|
+
p(h, r);
|
|
56
|
+
}, r.createComponentLogger = function(a) {
|
|
57
|
+
return new m(a);
|
|
58
|
+
}, r.verbose = n("verbose"), r.debug = n("debug"), r.info = n("info"), r.warn = n("warn"), r.error = n("error");
|
|
27
59
|
}
|
|
28
|
-
return
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return u("debug", this._namespace, e);
|
|
32
|
-
}, n.prototype.error = function() {
|
|
33
|
-
for (var e = [], r = 0; r < arguments.length; r++)
|
|
34
|
-
e[r] = arguments[r];
|
|
35
|
-
return u("error", this._namespace, e);
|
|
36
|
-
}, n.prototype.info = function() {
|
|
37
|
-
for (var e = [], r = 0; r < arguments.length; r++)
|
|
38
|
-
e[r] = arguments[r];
|
|
39
|
-
return u("info", this._namespace, e);
|
|
40
|
-
}, n.prototype.warn = function() {
|
|
41
|
-
for (var e = [], r = 0; r < arguments.length; r++)
|
|
42
|
-
e[r] = arguments[r];
|
|
43
|
-
return u("warn", this._namespace, e);
|
|
44
|
-
}, n.prototype.verbose = function() {
|
|
45
|
-
for (var e = [], r = 0; r < arguments.length; r++)
|
|
46
|
-
e[r] = arguments[r];
|
|
47
|
-
return u("verbose", this._namespace, e);
|
|
48
|
-
}, n;
|
|
60
|
+
return i.instance = function() {
|
|
61
|
+
return this._instance || (this._instance = new i()), this._instance;
|
|
62
|
+
}, i;
|
|
49
63
|
})()
|
|
50
64
|
);
|
|
51
|
-
function u(n, e, r) {
|
|
52
|
-
var t = f("diag");
|
|
53
|
-
if (t)
|
|
54
|
-
return r.unshift(e), t[n].apply(t, l([], p(r), !1));
|
|
55
|
-
}
|
|
56
65
|
export {
|
|
57
|
-
|
|
66
|
+
P as DiagAPI
|
|
58
67
|
};
|
|
@@ -1,19 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { getGlobal as f } from "./vue-components.es59.js";
|
|
2
|
+
var p = function(n, e) {
|
|
3
|
+
var r = typeof Symbol == "function" && n[Symbol.iterator];
|
|
4
|
+
if (!r) return n;
|
|
5
|
+
var t = r.call(n), o, a = [], g;
|
|
6
|
+
try {
|
|
7
|
+
for (; (e === void 0 || e-- > 0) && !(o = t.next()).done; ) a.push(o.value);
|
|
8
|
+
} catch (s) {
|
|
9
|
+
g = { error: s };
|
|
10
|
+
} finally {
|
|
11
|
+
try {
|
|
12
|
+
o && !o.done && (r = t.return) && r.call(t);
|
|
13
|
+
} finally {
|
|
14
|
+
if (g) throw g.error;
|
|
15
|
+
}
|
|
8
16
|
}
|
|
9
|
-
return
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
return a;
|
|
18
|
+
}, l = function(n, e, r) {
|
|
19
|
+
if (r || arguments.length === 2) for (var t = 0, o = e.length, a; t < o; t++)
|
|
20
|
+
(a || !(t in e)) && (a || (a = Array.prototype.slice.call(e, 0, t)), a[t] = e[t]);
|
|
21
|
+
return n.concat(a || Array.prototype.slice.call(e));
|
|
22
|
+
}, i = (
|
|
23
|
+
/** @class */
|
|
24
|
+
(function() {
|
|
25
|
+
function n(e) {
|
|
26
|
+
this._namespace = e.namespace || "DiagComponentLogger";
|
|
27
|
+
}
|
|
28
|
+
return n.prototype.debug = function() {
|
|
29
|
+
for (var e = [], r = 0; r < arguments.length; r++)
|
|
30
|
+
e[r] = arguments[r];
|
|
31
|
+
return u("debug", this._namespace, e);
|
|
32
|
+
}, n.prototype.error = function() {
|
|
33
|
+
for (var e = [], r = 0; r < arguments.length; r++)
|
|
34
|
+
e[r] = arguments[r];
|
|
35
|
+
return u("error", this._namespace, e);
|
|
36
|
+
}, n.prototype.info = function() {
|
|
37
|
+
for (var e = [], r = 0; r < arguments.length; r++)
|
|
38
|
+
e[r] = arguments[r];
|
|
39
|
+
return u("info", this._namespace, e);
|
|
40
|
+
}, n.prototype.warn = function() {
|
|
41
|
+
for (var e = [], r = 0; r < arguments.length; r++)
|
|
42
|
+
e[r] = arguments[r];
|
|
43
|
+
return u("warn", this._namespace, e);
|
|
44
|
+
}, n.prototype.verbose = function() {
|
|
45
|
+
for (var e = [], r = 0; r < arguments.length; r++)
|
|
46
|
+
e[r] = arguments[r];
|
|
47
|
+
return u("verbose", this._namespace, e);
|
|
48
|
+
}, n;
|
|
49
|
+
})()
|
|
50
|
+
);
|
|
51
|
+
function u(n, e, r) {
|
|
52
|
+
var t = f("diag");
|
|
53
|
+
if (t)
|
|
54
|
+
return r.unshift(e), t[n].apply(t, l([], p(r), !1));
|
|
16
55
|
}
|
|
17
56
|
export {
|
|
18
|
-
|
|
57
|
+
i as DiagComponentLogger
|
|
19
58
|
};
|
|
@@ -1,35 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var s = l[n] = (v = l[n]) !== null && v !== void 0 ? v : {
|
|
9
|
-
version: t
|
|
10
|
-
};
|
|
11
|
-
if (!i && s[r]) {
|
|
12
|
-
var a = new Error("@opentelemetry/api: Attempted duplicate registration of API: " + r);
|
|
13
|
-
return e.error(a.stack || a.message), !1;
|
|
14
|
-
}
|
|
15
|
-
if (s.version !== t) {
|
|
16
|
-
var a = new Error("@opentelemetry/api: Registration of version v" + s.version + " for " + r + " does not match previously registered API v" + t);
|
|
17
|
-
return e.error(a.stack || a.message), !1;
|
|
1
|
+
import { DiagLogLevel as r } from "./vue-components.es43.js";
|
|
2
|
+
function c(n, o) {
|
|
3
|
+
n < r.NONE ? n = r.NONE : n > r.ALL && (n = r.ALL), o = o || {};
|
|
4
|
+
function i(t, f) {
|
|
5
|
+
var e = o[t];
|
|
6
|
+
return typeof e == "function" && n >= f ? e.bind(o) : function() {
|
|
7
|
+
};
|
|
18
8
|
}
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
function _(r, o) {
|
|
27
|
-
o.debug("@opentelemetry/api: Unregistering a global for " + r + " v" + t + ".");
|
|
28
|
-
var e = l[n];
|
|
29
|
-
e && delete e[r];
|
|
9
|
+
return {
|
|
10
|
+
error: i("error", r.ERROR),
|
|
11
|
+
warn: i("warn", r.WARN),
|
|
12
|
+
info: i("info", r.INFO),
|
|
13
|
+
debug: i("debug", r.DEBUG),
|
|
14
|
+
verbose: i("verbose", r.VERBOSE)
|
|
15
|
+
};
|
|
30
16
|
}
|
|
31
17
|
export {
|
|
32
|
-
|
|
33
|
-
d as registerGlobal,
|
|
34
|
-
_ as unregisterGlobal
|
|
18
|
+
c as createLogLevelDiagLogger
|
|
35
19
|
};
|
|
@@ -1,31 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
var
|
|
5
|
-
function r
|
|
6
|
-
|
|
1
|
+
import { VERSION as t } from "./vue-components.es61.js";
|
|
2
|
+
import { isCompatible as f } from "./vue-components.es62.js";
|
|
3
|
+
import { _globalThis as m } from "./vue-components.es63.js";
|
|
4
|
+
var u = t.split(".")[0], n = /* @__PURE__ */ Symbol.for("opentelemetry.js.api." + u), l = m;
|
|
5
|
+
function d(r, o, e, i) {
|
|
6
|
+
var v;
|
|
7
|
+
i === void 0 && (i = !1);
|
|
8
|
+
var s = l[n] = (v = l[n]) !== null && v !== void 0 ? v : {
|
|
9
|
+
version: t
|
|
10
|
+
};
|
|
11
|
+
if (!i && s[r]) {
|
|
12
|
+
var a = new Error("@opentelemetry/api: Attempted duplicate registration of API: " + r);
|
|
13
|
+
return e.error(a.stack || a.message), !1;
|
|
14
|
+
}
|
|
15
|
+
if (s.version !== t) {
|
|
16
|
+
var a = new Error("@opentelemetry/api: Registration of version v" + s.version + " for " + r + " does not match previously registered API v" + t);
|
|
17
|
+
return e.error(a.stack || a.message), !1;
|
|
18
|
+
}
|
|
19
|
+
return s[r] = o, e.debug("@opentelemetry/api: Registered a global for " + r + " v" + t + "."), !0;
|
|
7
20
|
}
|
|
8
|
-
function
|
|
9
|
-
|
|
21
|
+
function E(r) {
|
|
22
|
+
var o, e, i = (o = l[n]) === null || o === void 0 ? void 0 : o.version;
|
|
23
|
+
if (!(!i || !f(i)))
|
|
24
|
+
return (e = l[n]) === null || e === void 0 ? void 0 : e[r];
|
|
10
25
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return e.deleteValue(n);
|
|
16
|
-
}
|
|
17
|
-
function d(e, t) {
|
|
18
|
-
return i(e, new a(t));
|
|
19
|
-
}
|
|
20
|
-
function m(e) {
|
|
21
|
-
var t;
|
|
22
|
-
return (t = r(e)) === null || t === void 0 ? void 0 : t.spanContext();
|
|
26
|
+
function _(r, o) {
|
|
27
|
+
o.debug("@opentelemetry/api: Unregistering a global for " + r + " v" + t + ".");
|
|
28
|
+
var e = l[n];
|
|
29
|
+
e && delete e[r];
|
|
23
30
|
}
|
|
24
31
|
export {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
m as getSpanContext,
|
|
29
|
-
i as setSpan,
|
|
30
|
-
d as setSpanContext
|
|
32
|
+
E as getGlobal,
|
|
33
|
+
d as registerGlobal,
|
|
34
|
+
_ as unregisterGlobal
|
|
31
35
|
};
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect-app/vue-components",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.36",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@mdi/js": "^7.4.47",
|
|
6
|
-
"effect": "^4.0.0-beta.
|
|
6
|
+
"effect": "^4.0.0-beta.40",
|
|
7
7
|
"intl-messageformat": "^11.1.2",
|
|
8
8
|
"mdi-js": "^1.0.1",
|
|
9
9
|
"primeflex": "^4.0.0",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"rimraf": "^6.1.3",
|
|
25
25
|
"sass": "^1.97.3",
|
|
26
26
|
"storybook": "^10.2.15",
|
|
27
|
-
"typescript": "~
|
|
27
|
+
"typescript": "~6.0.2",
|
|
28
28
|
"vite": "^7.3.1",
|
|
29
29
|
"vite-plugin-css-injected-by-js": "^4.0.1",
|
|
30
30
|
"vitepress": "^1.6.4",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"highlight.js": "^11.11.1",
|
|
58
58
|
"mitt": "^3.0.1",
|
|
59
59
|
"vue3-highlightjs": "^1.0.5",
|
|
60
|
-
"@effect-app/vue": "4.0.0-beta.
|
|
61
|
-
"effect-app": "4.0.0-beta.
|
|
60
|
+
"@effect-app/vue": "4.0.0-beta.36",
|
|
61
|
+
"effect-app": "4.0.0-beta.36"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"check": "vue-tsc",
|
|
@@ -3,6 +3,7 @@ import { Effect, Option, type Record, S } from "effect-app"
|
|
|
3
3
|
import { type DeepKeys, type DeepValue, type FieldAsyncValidateOrFn, type FieldValidateOrFn, type FormApi, type FormAsyncValidateOrFn, type FormOptions, type FormState, type FormValidateOrFn, type StandardSchemaV1, type VueFormApi } from "@tanstack/vue-form"
|
|
4
4
|
import { isObject } from "@vueuse/core"
|
|
5
5
|
import type { Fiber as EffectFiber } from "effect/Fiber"
|
|
6
|
+
import type { Redacted } from "effect/Redacted"
|
|
6
7
|
import { getTransformationFrom, useIntl } from "../../utils"
|
|
7
8
|
import { type OmegaFieldInternalApi } from "./InputProps"
|
|
8
9
|
import { type OF, type OmegaFormReturn } from "./useOmegaForm"
|
|
@@ -23,7 +24,7 @@ const isDevelopmentEnvironment = () => {
|
|
|
23
24
|
|
|
24
25
|
export type FieldPath<T> = unknown extends T ? string
|
|
25
26
|
// technically we cannot have primitive at the root
|
|
26
|
-
: T extends string | boolean | number | null | undefined | symbol | bigint ? ""
|
|
27
|
+
: T extends string | boolean | number | null | undefined | symbol | bigint | Redacted<any> ? ""
|
|
27
28
|
// technically we cannot have array at the root
|
|
28
29
|
: T extends ReadonlyArray<infer U> ? FieldPath_<U, `[${number}]`>
|
|
29
30
|
: {
|
|
@@ -31,7 +32,7 @@ export type FieldPath<T> = unknown extends T ? string
|
|
|
31
32
|
}[keyof T]
|
|
32
33
|
|
|
33
34
|
export type FieldPath_<T, Path extends string> = unknown extends T ? string
|
|
34
|
-
: T extends string | boolean | number | null | undefined | symbol | bigint ? Path
|
|
35
|
+
: T extends string | boolean | number | null | undefined | symbol | bigint | Redacted<any> ? Path
|
|
35
36
|
: T extends ReadonlyArray<infer U> ? FieldPath_<U, `${Path}[${number}]`> | Path
|
|
36
37
|
: {
|
|
37
38
|
[K in keyof T]: FieldPath_<T[K], `${Path}.${K & string}`>
|
|
@@ -236,7 +237,13 @@ export type PrefixFromDepth<
|
|
|
236
237
|
_TDepth extends any[]
|
|
237
238
|
> = K
|
|
238
239
|
|
|
239
|
-
|
|
240
|
+
// Recursively replace Redacted<A> with its inner type so DeepKeys treats it as a leaf
|
|
241
|
+
type StripRedacted<T> = T extends Redacted<any> ? string
|
|
242
|
+
: T extends ReadonlyArray<infer U> ? ReadonlyArray<StripRedacted<U>>
|
|
243
|
+
: T extends Record<string, any> ? { [K in keyof T]: StripRedacted<T[K]> }
|
|
244
|
+
: T
|
|
245
|
+
|
|
246
|
+
export type NestedKeyOf<T> = DeepKeys<StripRedacted<T>>
|
|
240
247
|
|
|
241
248
|
export type FieldValidators<T> = {
|
|
242
249
|
onChangeAsync?: FieldAsyncValidateOrFn<T, any, any>
|
|
@@ -730,7 +737,7 @@ export const createMeta = <T = any>(
|
|
|
730
737
|
// an empty string is valid for a S.String field, so we should not mark it as required
|
|
731
738
|
// TODO: handle this better via the createMeta minLength parsing
|
|
732
739
|
required: isRequired
|
|
733
|
-
&& (!S.AST.isString(typeToProcess) || !!getFieldMetadataFromAst(
|
|
740
|
+
&& (!S.AST.isString(typeToProcess) || !!getFieldMetadataFromAst(typeToProcess).minLength),
|
|
734
741
|
nullableOrUndefined
|
|
735
742
|
}
|
|
736
743
|
})
|
|
@@ -937,6 +944,70 @@ const metadataFromAst = <From, To>(
|
|
|
937
944
|
return { meta: newMeta, defaultValues, unionMeta }
|
|
938
945
|
}
|
|
939
946
|
|
|
947
|
+
/*
|
|
948
|
+
* Checks if an AST node is a S.Redacted Declaration without encoding.
|
|
949
|
+
* These need to be swapped to S.RedactedFromValue for form usage
|
|
950
|
+
* because S.Redacted expects Redacted objects, not plain strings.
|
|
951
|
+
*/
|
|
952
|
+
const isRedactedWithoutEncoding = (ast: S.AST.AST): boolean =>
|
|
953
|
+
S.AST.isDeclaration(ast)
|
|
954
|
+
&& (ast.annotations as any)?.typeConstructor?._tag === "effect/Redacted"
|
|
955
|
+
&& !ast.encoding
|
|
956
|
+
|
|
957
|
+
/*
|
|
958
|
+
* Creates a form-compatible schema by replacing S.Redacted(X) with
|
|
959
|
+
* S.RedactedFromValue(X). S.Redacted is a Declaration that expects
|
|
960
|
+
* Redacted<A> on both encoded and type sides, so form inputs (which
|
|
961
|
+
* produce plain strings) fail validation. S.RedactedFromValue accepts
|
|
962
|
+
* plain values on the encoded side and wraps them in Redacted on decode.
|
|
963
|
+
*/
|
|
964
|
+
export const toFormSchema = <From, To>(
|
|
965
|
+
schema: S.Codec<To, From, never>
|
|
966
|
+
): S.Codec<To, From, never> => {
|
|
967
|
+
const ast = schema.ast
|
|
968
|
+
const objAst = S.AST.isObjects(ast)
|
|
969
|
+
? ast
|
|
970
|
+
: S.AST.isDeclaration(ast)
|
|
971
|
+
? S.AST.toEncoded(ast)
|
|
972
|
+
: null
|
|
973
|
+
|
|
974
|
+
if (!objAst || !("propertySignatures" in objAst)) return schema
|
|
975
|
+
|
|
976
|
+
let hasRedacted = false
|
|
977
|
+
const props: Record<string, S.Struct.Fields[string]> = {}
|
|
978
|
+
|
|
979
|
+
for (const p of objAst.propertySignatures) {
|
|
980
|
+
if (isRedactedWithoutEncoding(p.type)) {
|
|
981
|
+
hasRedacted = true
|
|
982
|
+
const innerSchema = S.make((p.type as S.AST.Declaration).typeParameters[0]!)
|
|
983
|
+
props[p.name as string] = S.RedactedFromValue(innerSchema)
|
|
984
|
+
} else if (S.AST.isUnion(p.type)) {
|
|
985
|
+
const types = p.type.types
|
|
986
|
+
const redactedType = types.find(isRedactedWithoutEncoding)
|
|
987
|
+
if (redactedType) {
|
|
988
|
+
hasRedacted = true
|
|
989
|
+
const innerSchema = S.make((redactedType as S.AST.Declaration).typeParameters[0]!)
|
|
990
|
+
const hasNull = types.some(S.AST.isNull)
|
|
991
|
+
const hasUndefined = types.some(S.AST.isUndefined)
|
|
992
|
+
const base = S.RedactedFromValue(innerSchema)
|
|
993
|
+
props[p.name as string] = hasNull && hasUndefined
|
|
994
|
+
? S.NullishOr(base)
|
|
995
|
+
: hasNull
|
|
996
|
+
? S.NullOr(base)
|
|
997
|
+
: hasUndefined
|
|
998
|
+
? S.UndefinedOr(base)
|
|
999
|
+
: base
|
|
1000
|
+
} else {
|
|
1001
|
+
props[p.name as string] = S.make(p.type)
|
|
1002
|
+
}
|
|
1003
|
+
} else {
|
|
1004
|
+
props[p.name as string] = S.make(p.type)
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
return hasRedacted ? S.Struct(props) as unknown as S.Codec<To, From, never> : schema
|
|
1009
|
+
}
|
|
1010
|
+
|
|
940
1011
|
export const duplicateSchema = <From, To>(
|
|
941
1012
|
schema: S.Codec<To, From, never>
|
|
942
1013
|
) => {
|
|
@@ -11,7 +11,7 @@ import { MergedInputProps } from "./InputProps"
|
|
|
11
11
|
import OmegaArray from "./OmegaArray.vue"
|
|
12
12
|
import OmegaAutoGen from "./OmegaAutoGen.vue"
|
|
13
13
|
import OmegaErrorsInternal from "./OmegaErrorsInternal.vue"
|
|
14
|
-
import { BaseProps, deepMerge, defaultsValueFromSchema, DefaultTypeProps, FieldPath, type FormProps, generateMetaFromSchema, type MetaRecord, type NestedKeyOf, OmegaArrayProps, OmegaAutoGenMeta, OmegaError, type OmegaFormApi, OmegaFormState } from "./OmegaFormStuff"
|
|
14
|
+
import { BaseProps, deepMerge, defaultsValueFromSchema, DefaultTypeProps, FieldPath, type FormProps, generateMetaFromSchema, type MetaRecord, type NestedKeyOf, OmegaArrayProps, OmegaAutoGenMeta, OmegaError, type OmegaFormApi, OmegaFormState, toFormSchema } from "./OmegaFormStuff"
|
|
15
15
|
import OmegaInput from "./OmegaInput.vue"
|
|
16
16
|
import OmegaTaggedUnion from "./OmegaTaggedUnion.vue"
|
|
17
17
|
import OmegaForm from "./OmegaWrapper.vue"
|
|
@@ -395,7 +395,7 @@ export interface OmegaFormReturn<
|
|
|
395
395
|
> extends OF<From, To> {
|
|
396
396
|
// Pre-computed type aliases - computed ONCE for performance
|
|
397
397
|
_paths: FieldPath<From>
|
|
398
|
-
_keys:
|
|
398
|
+
_keys: NestedKeyOf<From>
|
|
399
399
|
_schema: S.Codec<To, From, never>
|
|
400
400
|
|
|
401
401
|
// this crazy thing here is copied from the OmegaFormInput.vue.d.ts, with `From` removed as Generic, instead closed over from the From generic above..
|
|
@@ -680,8 +680,9 @@ export const useOmegaForm = <
|
|
|
680
680
|
omegaConfig?: OmegaConfig<To>
|
|
681
681
|
): OmegaFormReturn<From, To, TypeProps> => {
|
|
682
682
|
if (!schema) throw new Error("Schema is required")
|
|
683
|
-
const
|
|
684
|
-
const
|
|
683
|
+
const formCompatibleSchema = toFormSchema(schema)
|
|
684
|
+
const standardSchema = S.toStandardSchemaV1(formCompatibleSchema)
|
|
685
|
+
const decode = S.decodeUnknownEffect(formCompatibleSchema)
|
|
685
686
|
|
|
686
687
|
const { meta, unionMeta } = generateMetaFromSchema(schema)
|
|
687
688
|
|