@reformer/core 1.0.0-beta.1 → 1.0.0-beta.2
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/behaviors/compute-from.js +3 -3
- package/dist/behaviors/enable-when.js +5 -5
- package/dist/behaviors/reset-when.js +1 -1
- package/dist/behaviors/revalidate-when.js +1 -1
- package/dist/behaviors/sync-fields.js +5 -5
- package/dist/behaviors/watch-field.js +3 -3
- package/dist/behaviors.js +2 -2
- package/dist/core/types/field-path.d.ts +2 -2
- package/dist/core/types/index.d.ts +1 -1
- package/dist/core/types/validation-schema.d.ts +21 -50
- package/dist/core/validation/core/index.d.ts +0 -1
- package/dist/core/validation/core/validate-async.d.ts +9 -15
- package/dist/core/validation/core/validate.d.ts +15 -15
- package/dist/core/validation/index.d.ts +5 -3
- package/dist/core/validation/validation-applicator.d.ts +2 -56
- package/dist/core/validation/validation-registry.d.ts +18 -16
- package/dist/core/validation/validators/array-validators.d.ts +6 -31
- package/dist/core/validation/validators/email.d.ts +5 -29
- package/dist/core/validation/validators/future-date.d.ts +6 -28
- package/dist/core/validation/validators/index.d.ts +12 -4
- package/dist/core/validation/validators/integer.d.ts +13 -0
- package/dist/core/validation/validators/is-date.d.ts +5 -28
- package/dist/core/validation/validators/is-number.d.ts +14 -0
- package/dist/core/validation/validators/max-age.d.ts +6 -29
- package/dist/core/validation/validators/max-date.d.ts +6 -29
- package/dist/core/validation/validators/max-length.d.ts +5 -30
- package/dist/core/validation/validators/max.d.ts +7 -29
- package/dist/core/validation/validators/min-age.d.ts +6 -29
- package/dist/core/validation/validators/min-date.d.ts +6 -29
- package/dist/core/validation/validators/min-length.d.ts +5 -30
- package/dist/core/validation/validators/min.d.ts +7 -29
- package/dist/core/validation/validators/multiple-of.d.ts +13 -0
- package/dist/core/validation/validators/non-negative.d.ts +13 -0
- package/dist/core/validation/validators/non-zero.d.ts +13 -0
- package/dist/core/validation/validators/past-date.d.ts +5 -28
- package/dist/core/validation/validators/pattern.d.ts +5 -32
- package/dist/core/validation/validators/phone.d.ts +9 -19
- package/dist/core/validation/validators/required.d.ts +10 -31
- package/dist/core/validation/validators/url.d.ts +13 -15
- package/dist/{index-D25LsbRm.js → index-DLh_Ryb2.js} +1 -1
- package/dist/index.js +465 -397
- package/dist/{registry-helpers-Bv_BJ1s-.js → registry-helpers-CLPXad2B.js} +152 -292
- package/dist/validators/email.js +7 -9
- package/dist/validators/future-date.js +11 -12
- package/dist/validators/integer.d.ts +2 -0
- package/dist/validators/integer.js +10 -0
- package/dist/validators/is-date.js +6 -7
- package/dist/validators/is-number.d.ts +2 -0
- package/dist/validators/is-number.js +10 -0
- package/dist/validators/max-age.js +11 -12
- package/dist/validators/max-date.js +11 -12
- package/dist/validators/max-length.js +12 -8
- package/dist/validators/max.js +5 -6
- package/dist/validators/min-age.js +10 -11
- package/dist/validators/min-date.js +12 -13
- package/dist/validators/min-length.js +12 -8
- package/dist/validators/min.js +6 -7
- package/dist/validators/multiple-of.d.ts +2 -0
- package/dist/validators/multiple-of.js +10 -0
- package/dist/validators/non-negative.d.ts +2 -0
- package/dist/validators/non-negative.js +10 -0
- package/dist/validators/non-zero.d.ts +2 -0
- package/dist/validators/non-zero.js +10 -0
- package/dist/validators/past-date.js +11 -12
- package/dist/validators/pattern.js +6 -7
- package/dist/validators/phone.js +14 -32
- package/dist/validators/required.js +9 -10
- package/dist/validators/url.js +19 -16
- package/dist/validators-xJyP-jLZ.js +169 -0
- package/dist/validators.js +54 -50
- package/llms.txt +505 -790
- package/package.json +20 -4
- package/dist/core/validation/core/validate-tree.d.ts +0 -35
- package/dist/core/validation/validation-context.d.ts +0 -86
- package/dist/core/validation/validators/number.d.ts +0 -31
- package/dist/validate-C3XiA_zf.js +0 -10
- package/dist/validators/number.d.ts +0 -2
- package/dist/validators/number.js +0 -35
- package/dist/validators-BGsNOgT1.js +0 -207
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
a && m(a, (r) => {
|
|
1
|
+
import { p as s, c as l } from "../date-utils-xUWFslTj.js";
|
|
2
|
+
function c(e, a) {
|
|
3
|
+
return (r) => {
|
|
5
4
|
if (r == null || r === "")
|
|
6
5
|
return null;
|
|
7
|
-
const
|
|
8
|
-
if (
|
|
6
|
+
const n = s(r);
|
|
7
|
+
if (n === null)
|
|
9
8
|
return null;
|
|
10
|
-
const
|
|
11
|
-
return
|
|
9
|
+
const t = l(n);
|
|
10
|
+
return t > e ? {
|
|
12
11
|
code: "date_max_age",
|
|
13
|
-
message:
|
|
14
|
-
params: { maxAge: e, currentAge:
|
|
12
|
+
message: a?.message ?? "invalid",
|
|
13
|
+
params: { maxAge: e, currentAge: t, ...a?.params }
|
|
15
14
|
} : null;
|
|
16
|
-
}
|
|
15
|
+
};
|
|
17
16
|
}
|
|
18
17
|
export {
|
|
19
|
-
|
|
18
|
+
c as maxAge
|
|
20
19
|
};
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
a && i(a, (r) => {
|
|
1
|
+
import { p as m, n as t } from "../date-utils-xUWFslTj.js";
|
|
2
|
+
function o(n, a) {
|
|
3
|
+
return (r) => {
|
|
5
4
|
if (r == null || r === "")
|
|
6
5
|
return null;
|
|
7
|
-
const
|
|
8
|
-
if (
|
|
6
|
+
const e = m(r);
|
|
7
|
+
if (e === null)
|
|
9
8
|
return null;
|
|
10
|
-
const s =
|
|
11
|
-
return s >
|
|
9
|
+
const s = t(e), l = t(n);
|
|
10
|
+
return s > l ? {
|
|
12
11
|
code: "date_max",
|
|
13
|
-
message:
|
|
14
|
-
params: { maxDate:
|
|
12
|
+
message: a?.message ?? "invalid",
|
|
13
|
+
params: { maxDate: n, ...a?.params }
|
|
15
14
|
} : null;
|
|
16
|
-
}
|
|
15
|
+
};
|
|
17
16
|
}
|
|
18
17
|
export {
|
|
19
|
-
|
|
18
|
+
o as maxDate
|
|
20
19
|
};
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
function l(r, t) {
|
|
2
|
+
return (n) => {
|
|
3
|
+
if (n == null || n === "")
|
|
4
|
+
return null;
|
|
5
|
+
const e = n.length;
|
|
6
|
+
return typeof e != "number" ? null : e > r ? {
|
|
7
|
+
code: "maxLength",
|
|
8
|
+
message: t?.message ?? "invalid",
|
|
9
|
+
params: { maxLength: r, actualLength: e, ...t?.params }
|
|
10
|
+
} : null;
|
|
11
|
+
};
|
|
8
12
|
}
|
|
9
13
|
export {
|
|
10
|
-
|
|
14
|
+
l as maxLength
|
|
11
15
|
};
|
package/dist/validators/max.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
m && a(m, (r) => r == null ? null : r > n ? {
|
|
1
|
+
function e(n, a) {
|
|
2
|
+
return (r) => r == null ? null : r > n ? {
|
|
4
3
|
code: "max",
|
|
5
|
-
message:
|
|
6
|
-
params: { max: n, actual: r, ...
|
|
7
|
-
} : null
|
|
4
|
+
message: a?.message ?? "invalid",
|
|
5
|
+
params: { max: n, actual: r, ...a?.params }
|
|
6
|
+
} : null;
|
|
8
7
|
}
|
|
9
8
|
export {
|
|
10
9
|
e as max
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
n && m(n, (r) => {
|
|
1
|
+
import { p as s, c as i } from "../date-utils-xUWFslTj.js";
|
|
2
|
+
function u(e, n) {
|
|
3
|
+
return (r) => {
|
|
5
4
|
if (r == null || r === "")
|
|
6
5
|
return null;
|
|
7
|
-
const a =
|
|
6
|
+
const a = s(r);
|
|
8
7
|
if (a === null)
|
|
9
8
|
return null;
|
|
10
|
-
const
|
|
11
|
-
return
|
|
9
|
+
const t = i(a);
|
|
10
|
+
return t < e ? {
|
|
12
11
|
code: "date_min_age",
|
|
13
|
-
message:
|
|
14
|
-
params: { minAge: e, currentAge:
|
|
12
|
+
message: n?.message ?? "invalid",
|
|
13
|
+
params: { minAge: e, currentAge: t, ...n?.params }
|
|
15
14
|
} : null;
|
|
16
|
-
}
|
|
15
|
+
};
|
|
17
16
|
}
|
|
18
17
|
export {
|
|
19
|
-
|
|
18
|
+
u as minAge
|
|
20
19
|
};
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (r == null || r === "")
|
|
1
|
+
import { p as l, n as t } from "../date-utils-xUWFslTj.js";
|
|
2
|
+
function o(r, e) {
|
|
3
|
+
return (n) => {
|
|
4
|
+
if (n == null || n === "")
|
|
6
5
|
return null;
|
|
7
|
-
const
|
|
8
|
-
if (
|
|
6
|
+
const a = l(n);
|
|
7
|
+
if (a === null)
|
|
9
8
|
return null;
|
|
10
|
-
const
|
|
11
|
-
return
|
|
9
|
+
const i = t(a), s = t(r);
|
|
10
|
+
return i < s ? {
|
|
12
11
|
code: "date_min",
|
|
13
|
-
message:
|
|
14
|
-
params: { minDate:
|
|
12
|
+
message: e?.message ?? "invalid",
|
|
13
|
+
params: { minDate: r, ...e?.params }
|
|
15
14
|
} : null;
|
|
16
|
-
}
|
|
15
|
+
};
|
|
17
16
|
}
|
|
18
17
|
export {
|
|
19
|
-
|
|
18
|
+
o as minDate
|
|
20
19
|
};
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
function l(r, t) {
|
|
2
|
+
return (n) => {
|
|
3
|
+
if (n == null || n === "")
|
|
4
|
+
return null;
|
|
5
|
+
const e = n.length;
|
|
6
|
+
return typeof e != "number" ? null : e < r ? {
|
|
7
|
+
code: "minLength",
|
|
8
|
+
message: t?.message ?? "invalid",
|
|
9
|
+
params: { minLength: r, actualLength: e, ...t?.params }
|
|
10
|
+
} : null;
|
|
11
|
+
};
|
|
8
12
|
}
|
|
9
13
|
export {
|
|
10
|
-
|
|
14
|
+
l as minLength
|
|
11
15
|
};
|
package/dist/validators/min.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
m && i(m, (r) => r == null ? null : r < n ? {
|
|
1
|
+
function e(r, i) {
|
|
2
|
+
return (n) => n == null ? null : n < r ? {
|
|
4
3
|
code: "min",
|
|
5
|
-
message:
|
|
6
|
-
params: { min:
|
|
7
|
-
} : null
|
|
4
|
+
message: i?.message ?? "invalid",
|
|
5
|
+
params: { min: r, actual: n, ...i?.params }
|
|
6
|
+
} : null;
|
|
8
7
|
}
|
|
9
8
|
export {
|
|
10
|
-
|
|
9
|
+
e as min
|
|
11
10
|
};
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
a && o(a, (r) => {
|
|
1
|
+
import { p as s, n as l, g as o } from "../date-utils-xUWFslTj.js";
|
|
2
|
+
function i(a) {
|
|
3
|
+
return (r) => {
|
|
5
4
|
if (r == null || r === "")
|
|
6
5
|
return null;
|
|
7
|
-
const
|
|
8
|
-
if (
|
|
6
|
+
const e = s(r);
|
|
7
|
+
if (e === null)
|
|
9
8
|
return null;
|
|
10
|
-
const n = l(
|
|
11
|
-
return n >
|
|
9
|
+
const n = l(e), t = o();
|
|
10
|
+
return n > t ? {
|
|
12
11
|
code: "date_future",
|
|
13
|
-
message:
|
|
14
|
-
params:
|
|
12
|
+
message: a?.message ?? "invalid",
|
|
13
|
+
params: a?.params
|
|
15
14
|
} : null;
|
|
16
|
-
}
|
|
15
|
+
};
|
|
17
16
|
}
|
|
18
17
|
export {
|
|
19
|
-
|
|
18
|
+
i as pastDate
|
|
20
19
|
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
r && n(r, (a) => a ? t.test(a) ? null : {
|
|
1
|
+
function n(r, t) {
|
|
2
|
+
return (e) => e ? r.test(e) ? null : {
|
|
4
3
|
code: "pattern",
|
|
5
|
-
message:
|
|
6
|
-
params: { pattern:
|
|
7
|
-
} : null
|
|
4
|
+
message: t?.message ?? "invalid",
|
|
5
|
+
params: { pattern: r.source, ...t?.params }
|
|
6
|
+
} : null;
|
|
8
7
|
}
|
|
9
8
|
export {
|
|
10
|
-
|
|
9
|
+
n as pattern
|
|
11
10
|
};
|
package/dist/validators/phone.js
CHANGED
|
@@ -1,35 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
o(n, (e) => {
|
|
15
|
-
if (!e)
|
|
16
|
-
return null;
|
|
17
|
-
if (!t[r].test(e)) {
|
|
18
|
-
const a = {
|
|
19
|
-
international: "Введите телефон в международном формате (например, +1234567890)",
|
|
20
|
-
ru: "Введите российский номер телефона (например, +7 900 123-45-67)",
|
|
21
|
-
us: "Введите американский номер телефона (например, (123) 456-7890)",
|
|
22
|
-
any: "Неверный формат телефона"
|
|
23
|
-
};
|
|
24
|
-
return {
|
|
25
|
-
code: "phone",
|
|
26
|
-
message: s?.message || a[r],
|
|
27
|
-
params: { format: r, ...s?.params }
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
return null;
|
|
31
|
-
});
|
|
1
|
+
const t = {
|
|
2
|
+
international: /^\+?[1-9]\d{1,14}$/,
|
|
3
|
+
ru: /^(\+7|7|8)?[\s-]?\(?[489][0-9]{2}\)?[\s-]?[0-9]{3}[\s-]?[0-9]{2}[\s-]?[0-9]{2}$/,
|
|
4
|
+
us: /^(\+?1)?[\s-]?\(?[2-9]\d{2}\)?[\s-]?\d{3}[\s-]?\d{4}$/,
|
|
5
|
+
any: /^\+?\(?[0-9]{1,4}\)?[-\s.]?\(?[0-9]{1,4}\)?[-\s.]?[0-9]{1,9}$/
|
|
6
|
+
};
|
|
7
|
+
function a(s) {
|
|
8
|
+
const n = s?.format ?? "any", e = t[n];
|
|
9
|
+
return (r) => r ? e.test(r) ? null : {
|
|
10
|
+
code: "phone",
|
|
11
|
+
message: s?.message ?? "invalid",
|
|
12
|
+
params: { format: n, ...s?.params }
|
|
13
|
+
} : null;
|
|
32
14
|
}
|
|
33
15
|
export {
|
|
34
|
-
|
|
16
|
+
a as phone
|
|
35
17
|
};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
a && m(a, (r) => r == null || r === "" ? {
|
|
1
|
+
function a(r) {
|
|
2
|
+
return (e) => e == null || e === "" ? {
|
|
4
3
|
code: "required",
|
|
5
|
-
message:
|
|
6
|
-
params:
|
|
7
|
-
} : typeof
|
|
4
|
+
message: r?.message ?? "invalid",
|
|
5
|
+
params: r?.params
|
|
6
|
+
} : typeof e == "boolean" && e !== !0 ? {
|
|
8
7
|
code: "required",
|
|
9
|
-
message:
|
|
10
|
-
params:
|
|
11
|
-
} : null
|
|
8
|
+
message: r?.message ?? "invalid",
|
|
9
|
+
params: r?.params
|
|
10
|
+
} : null;
|
|
12
11
|
}
|
|
13
12
|
export {
|
|
14
|
-
|
|
13
|
+
a as required
|
|
15
14
|
};
|
package/dist/validators/url.js
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
const a = /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/i, t = /^https?:\/\/([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/i;
|
|
2
|
+
function d(e) {
|
|
3
|
+
return (r) => {
|
|
4
|
+
if (!r)
|
|
5
|
+
return null;
|
|
6
|
+
const l = r;
|
|
7
|
+
return (e?.requireProtocol ? t : a).test(l) ? e?.allowedProtocols && e.allowedProtocols.length > 0 && !e.allowedProtocols.some(
|
|
8
|
+
(o) => l.toLowerCase().startsWith(`${o}://`)
|
|
9
|
+
) ? {
|
|
10
|
+
code: "url_protocol",
|
|
11
|
+
message: e?.message ?? "invalid",
|
|
12
|
+
params: { allowedProtocols: e.allowedProtocols, ...e?.params }
|
|
13
|
+
} : null : {
|
|
14
|
+
code: "url",
|
|
15
|
+
message: e?.message ?? "invalid",
|
|
16
|
+
params: e?.params
|
|
17
|
+
};
|
|
18
|
+
};
|
|
16
19
|
}
|
|
17
20
|
export {
|
|
18
|
-
|
|
21
|
+
d as url
|
|
19
22
|
};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { b as a, V as l } from "./registry-helpers-CLPXad2B.js";
|
|
2
|
+
import { e as s, t as y, c, a as x } from "./field-path-DuKdGcIE.js";
|
|
3
|
+
import { required as N } from "./validators/required.js";
|
|
4
|
+
import { min as V } from "./validators/min.js";
|
|
5
|
+
import { max as b } from "./validators/max.js";
|
|
6
|
+
import { minLength as _ } from "./validators/min-length.js";
|
|
7
|
+
import { maxLength as C } from "./validators/max-length.js";
|
|
8
|
+
import { email as P } from "./validators/email.js";
|
|
9
|
+
import { pattern as R } from "./validators/pattern.js";
|
|
10
|
+
import { url as w } from "./validators/url.js";
|
|
11
|
+
import { phone as D } from "./validators/phone.js";
|
|
12
|
+
import { isNumber as j } from "./validators/is-number.js";
|
|
13
|
+
import { integer as k } from "./validators/integer.js";
|
|
14
|
+
import { multipleOf as F } from "./validators/multiple-of.js";
|
|
15
|
+
import { nonNegative as L } from "./validators/non-negative.js";
|
|
16
|
+
import { nonZero as B } from "./validators/non-zero.js";
|
|
17
|
+
import { isDate as T } from "./validators/is-date.js";
|
|
18
|
+
import { minDate as E } from "./validators/min-date.js";
|
|
19
|
+
import { maxDate as G } from "./validators/max-date.js";
|
|
20
|
+
import { pastDate as I } from "./validators/past-date.js";
|
|
21
|
+
import { futureDate as M } from "./validators/future-date.js";
|
|
22
|
+
import { minAge as S } from "./validators/min-age.js";
|
|
23
|
+
import { maxAge as q } from "./validators/max-age.js";
|
|
24
|
+
function z(t, r, n) {
|
|
25
|
+
if (!t) return;
|
|
26
|
+
const i = s(t);
|
|
27
|
+
a().registerSync(
|
|
28
|
+
i,
|
|
29
|
+
r,
|
|
30
|
+
n
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
function K(t, r, n) {
|
|
34
|
+
const i = s(t);
|
|
35
|
+
a().registerAsync(
|
|
36
|
+
i,
|
|
37
|
+
r,
|
|
38
|
+
n
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
function U(t, r) {
|
|
42
|
+
if (!Array.isArray(t) && !Array.isArray(r) && t && !("__key" in t) && !("__path" in t)) {
|
|
43
|
+
r(t);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const n = (Array.isArray(t) ? t : [t]).filter(
|
|
47
|
+
Boolean
|
|
48
|
+
), i = Array.isArray(r) ? r : [r];
|
|
49
|
+
for (const e of n) {
|
|
50
|
+
const o = y(e);
|
|
51
|
+
for (const p of i)
|
|
52
|
+
p(o);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function W(t, r, n) {
|
|
56
|
+
const i = s(t);
|
|
57
|
+
a().enterCondition(i, r);
|
|
58
|
+
try {
|
|
59
|
+
const e = c();
|
|
60
|
+
n(e);
|
|
61
|
+
} finally {
|
|
62
|
+
a().exitCondition();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function Z(t) {
|
|
66
|
+
return (r) => {
|
|
67
|
+
if (r == null)
|
|
68
|
+
return null;
|
|
69
|
+
const n = r.length;
|
|
70
|
+
return typeof n != "number" || n >= 1 ? null : {
|
|
71
|
+
code: "minLength",
|
|
72
|
+
message: t?.message ?? "invalid",
|
|
73
|
+
params: { minLength: 1, ...t?.params }
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function H(t, r) {
|
|
78
|
+
if (!t) return;
|
|
79
|
+
const n = s(t);
|
|
80
|
+
a().registerArrayItemValidation(n, r);
|
|
81
|
+
}
|
|
82
|
+
function m(t) {
|
|
83
|
+
return t == null ? !1 : typeof t == "object" && "value" in t && "setValue" in t && "getValue" in t && "validate" in t;
|
|
84
|
+
}
|
|
85
|
+
function u(t) {
|
|
86
|
+
return t == null ? !1 : m(t) && "validators" in t && "asyncValidators" in t && // FieldNode имеет markAsTouched метод
|
|
87
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
88
|
+
typeof t.markAsTouched == "function" && // У FieldNode нет fields или items
|
|
89
|
+
!("fields" in t) && !("items" in t);
|
|
90
|
+
}
|
|
91
|
+
function d(t) {
|
|
92
|
+
return t == null ? !1 : m(t) && "applyValidationSchema" in t && "applyBehaviorSchema" in t && "getFieldByPath" in t && // GroupNode НЕ имеет items/push/removeAt (это ArrayNode)
|
|
93
|
+
!("items" in t) && !("push" in t) && !("removeAt" in t);
|
|
94
|
+
}
|
|
95
|
+
function g(t) {
|
|
96
|
+
return t == null ? !1 : m(t) && "items" in t && "length" in t && "push" in t && "removeAt" in t && "at" in t && // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
97
|
+
typeof t.push == "function" && // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
98
|
+
typeof t.removeAt == "function";
|
|
99
|
+
}
|
|
100
|
+
function ht(t) {
|
|
101
|
+
return u(t) ? "FieldNode" : d(t) ? "GroupNode" : g(t) ? "ArrayNode" : m(t) ? "FormNode" : "Unknown";
|
|
102
|
+
}
|
|
103
|
+
function f(t) {
|
|
104
|
+
return u(t) ? [t] : d(t) ? Array.from(t.getAllFields()).flatMap(f) : g(t) ? t.map((r) => f(r)).flat() : [];
|
|
105
|
+
}
|
|
106
|
+
async function J(t, r) {
|
|
107
|
+
const n = new l();
|
|
108
|
+
n.beginRegistration();
|
|
109
|
+
let i = [], e = !1;
|
|
110
|
+
try {
|
|
111
|
+
const o = c();
|
|
112
|
+
r(o), i = n.getCurrentContext()?.getValidators() || [], n.cancelRegistration(), e = !0, t.clearErrors();
|
|
113
|
+
const h = f(t);
|
|
114
|
+
return await Promise.allSettled(h.map((A) => A.validate())), i.length > 0 && await t.applyContextualValidators(i), t.valid.value;
|
|
115
|
+
} catch (o) {
|
|
116
|
+
throw e || n.cancelRegistration(), o;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const At = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
120
|
+
__proto__: null,
|
|
121
|
+
ValidationRegistry: l,
|
|
122
|
+
apply: U,
|
|
123
|
+
applyWhen: W,
|
|
124
|
+
createFieldPath: c,
|
|
125
|
+
email: P,
|
|
126
|
+
extractKey: x,
|
|
127
|
+
extractPath: s,
|
|
128
|
+
futureDate: M,
|
|
129
|
+
integer: k,
|
|
130
|
+
isDate: T,
|
|
131
|
+
isNumber: j,
|
|
132
|
+
max: b,
|
|
133
|
+
maxAge: q,
|
|
134
|
+
maxDate: G,
|
|
135
|
+
maxLength: C,
|
|
136
|
+
min: V,
|
|
137
|
+
minAge: S,
|
|
138
|
+
minDate: E,
|
|
139
|
+
minLength: _,
|
|
140
|
+
multipleOf: F,
|
|
141
|
+
nonNegative: L,
|
|
142
|
+
nonZero: B,
|
|
143
|
+
notEmpty: Z,
|
|
144
|
+
pastDate: I,
|
|
145
|
+
pattern: R,
|
|
146
|
+
phone: D,
|
|
147
|
+
required: N,
|
|
148
|
+
toFieldPath: y,
|
|
149
|
+
url: w,
|
|
150
|
+
validate: z,
|
|
151
|
+
validateAsync: K,
|
|
152
|
+
validateForm: J,
|
|
153
|
+
validateItems: H
|
|
154
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
155
|
+
export {
|
|
156
|
+
g as a,
|
|
157
|
+
At as b,
|
|
158
|
+
m as c,
|
|
159
|
+
d,
|
|
160
|
+
z as e,
|
|
161
|
+
K as f,
|
|
162
|
+
ht as g,
|
|
163
|
+
U as h,
|
|
164
|
+
u as i,
|
|
165
|
+
W as j,
|
|
166
|
+
H as k,
|
|
167
|
+
Z as n,
|
|
168
|
+
J as v
|
|
169
|
+
};
|