@reformer/core 11.0.0-beta.8 → 11.0.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -73
- package/dist/behaviors-value-HA_Q03hc.js +108 -0
- package/dist/behaviors.js +370 -242
- package/dist/{create-model-BBRHhHwK.js → create-model-BvcbNPgL.js} +6 -6
- package/dist/date-utils-90-qZbse.js +43 -0
- package/dist/{en-CjAqn7h0.js → en-HP8XEych.js} +6 -3
- package/dist/form/aggregate-signals.d.ts +21 -63
- package/dist/form/behaviors/collections.d.ts +28 -7
- package/dist/form/behaviors/context.d.ts +19 -2
- package/dist/form/behaviors/index.d.ts +3 -3
- package/dist/form/behaviors/internals.d.ts +9 -2
- package/dist/form/behaviors/node.d.ts +25 -2
- package/dist/form/behaviors/operators.d.ts +17 -9
- package/dist/form/behaviors/schema-operators.d.ts +6 -4
- package/dist/form/behaviors/types.d.ts +12 -4
- package/dist/form/create-form.d.ts +47 -35
- package/dist/form/flow/flow.d.ts +87 -0
- package/dist/form/form-bundle.d.ts +45 -28
- package/dist/form/form-config-base.d.ts +46 -0
- package/dist/form/form-level.d.ts +121 -0
- package/dist/form/form-proxy-builder.d.ts +6 -22
- package/dist/form/index.d.ts +16 -21
- package/dist/form/nodes/form-array-node.d.ts +100 -0
- package/dist/form/nodes/form-control-node.d.ts +73 -0
- package/dist/form/nodes/form-group-node.d.ts +66 -0
- package/dist/form/nodes/node-kind.d.ts +29 -0
- package/dist/form/nodes/state/availability.d.ts +6 -0
- package/dist/form/nodes/state/component.d.ts +6 -0
- package/dist/form/nodes/state/index.d.ts +12 -0
- package/dist/form/nodes/state/interaction.d.ts +13 -0
- package/dist/form/nodes/state/issues.d.ts +9 -0
- package/dist/form/nodes/state/pending.d.ts +6 -0
- package/dist/form/schema/compile.d.ts +59 -0
- package/dist/form/schema/compiled.d.ts +143 -0
- package/dist/form/schema/row-key.d.ts +11 -0
- package/dist/form/schema-controller.d.ts +30 -14
- package/dist/form/signal-node-registry.d.ts +6 -7
- package/dist/form/submission.d.ts +93 -0
- package/dist/form/type-guards.d.ts +14 -73
- package/dist/form/types/contracts.d.ts +19 -92
- package/dist/form/types/field-config.d.ts +27 -0
- package/dist/form/types/index.d.ts +5 -57
- package/dist/form/types/nodes.d.ts +159 -0
- package/dist/form/types/schema-node.d.ts +139 -63
- package/dist/form/types/validation-schema.d.ts +23 -27
- package/dist/form/validation/context.d.ts +42 -7
- package/dist/form/validation/index.d.ts +9 -8
- package/dist/form/validation/operators.d.ts +22 -30
- package/dist/form/validation/run.d.ts +93 -18
- package/dist/form/validation/strategy.d.ts +41 -13
- package/dist/form/validation/types.d.ts +74 -20
- package/dist/form/validators/date-utils.d.ts +13 -1
- package/dist/form/validators/email.d.ts +8 -7
- package/dist/form/validators/file-type.d.ts +8 -7
- package/dist/form/validators/file-utils.d.ts +2 -1
- package/dist/form/validators/future-date.d.ts +8 -7
- package/dist/form/validators/index.d.ts +1 -1
- package/dist/form/validators/integer.d.ts +8 -7
- package/dist/form/validators/is-date.d.ts +11 -9
- package/dist/form/validators/is-number.d.ts +11 -9
- package/dist/form/validators/max-age.d.ts +13 -9
- package/dist/form/validators/max-date.d.ts +8 -7
- package/dist/form/validators/max-file-size.d.ts +8 -7
- package/dist/form/validators/max-files.d.ts +8 -7
- package/dist/form/validators/max-length.d.ts +14 -7
- package/dist/form/validators/max-total-file-size.d.ts +8 -7
- package/dist/form/validators/max.d.ts +10 -8
- package/dist/form/validators/min-age.d.ts +12 -9
- package/dist/form/validators/min-date.d.ts +8 -7
- package/dist/form/validators/min-file-size.d.ts +8 -7
- package/dist/form/validators/min-files.d.ts +11 -9
- package/dist/form/validators/min-length.d.ts +14 -7
- package/dist/form/validators/min.d.ts +10 -8
- package/dist/form/validators/multiple-of.d.ts +10 -8
- package/dist/form/validators/non-negative.d.ts +8 -7
- package/dist/form/validators/non-zero.d.ts +8 -7
- package/dist/form/validators/past-date.d.ts +8 -7
- package/dist/form/validators/pattern.d.ts +9 -8
- package/dist/form/validators/phone.d.ts +8 -7
- package/dist/form/validators/required.d.ts +11 -9
- package/dist/form/validators/url.d.ts +20 -13
- package/dist/form/validators/validation-issue.d.ts +8 -0
- package/dist/i18n/descriptor.d.ts +1 -1
- package/dist/i18n/en.json.d.ts +5 -1
- package/dist/i18n/locale-store.d.ts +7 -0
- package/dist/i18n/message-format.d.ts +24 -4
- package/dist/i18n/ru.json.d.ts +5 -1
- package/dist/i18n/translator.d.ts +11 -0
- package/dist/i18n/validation-message.d.ts +42 -7
- package/dist/i18n.d.ts +7 -12
- package/dist/i18n.js +66 -283
- package/dist/index.d.ts +16 -7
- package/dist/index.js +924 -2855
- package/dist/loader-BWkigpVe.js +52 -0
- package/dist/locale/en.js +1 -1
- package/dist/locale/en.json +4 -1
- package/dist/locale/ru.js +4 -1
- package/dist/locale/ru.json +4 -1
- package/dist/locale-CG54AU2Q.js +219 -0
- package/dist/locale.js +1 -1
- package/dist/model/behaviors-value.d.ts +24 -6
- package/dist/model/create-model.d.ts +2 -2
- package/dist/model/derived-registry.d.ts +1 -1
- package/dist/model/index.d.ts +11 -5
- package/dist/model/model-nodes.d.ts +79 -12
- package/dist/model/model-signals-proxy.d.ts +5 -6
- package/dist/model/model-value-proxy.d.ts +20 -15
- package/dist/model/safe-effect.d.ts +33 -1
- package/dist/model/types.d.ts +63 -13
- package/dist/model.js +20 -18
- package/dist/node-kind-C-r6ZMdo.js +15 -0
- package/dist/platforms/react/field-binding/field-adapter.d.ts +1 -1
- package/dist/platforms/react/field-binding/field-handle.d.ts +5 -2
- package/dist/platforms/react/form-bundle-context.d.ts +2 -2
- package/dist/platforms/react/hooks/types.d.ts +57 -38
- package/dist/platforms/react/hooks/use-form-bundle.d.ts +19 -4
- package/dist/platforms/react/hooks/use-form-flow.d.ts +40 -0
- package/dist/platforms/react/hooks/use-form-validation.d.ts +12 -6
- package/dist/platforms/react/hooks/useArrayLength.d.ts +6 -6
- package/dist/platforms/react/hooks/useFormControl.d.ts +7 -9
- package/dist/platforms/react/hooks/useFormControlValue.d.ts +18 -19
- package/dist/platforms/react/hooks/useSignalSubscription.d.ts +9 -1
- package/dist/platforms/react/i18n/context.d.ts +6 -1
- package/dist/platforms/react/i18n/hooks.d.ts +16 -10
- package/dist/platforms/react/i18n/provider.d.ts +9 -2
- package/dist/platforms/react/index.d.ts +6 -4
- package/dist/react.d.ts +22 -0
- package/dist/react.js +505 -0
- package/dist/runtime-token.d.ts +1 -2
- package/dist/safe-effect-BbtX3KuN.js +643 -0
- package/dist/schema-controller-CpiO2JoK.js +143 -0
- package/dist/signals.d.ts +15 -9
- package/dist/signals.js +11 -6
- package/dist/strategy-CoFSemuP.js +375 -0
- package/dist/type-guards-D-N_5Ddh.js +19 -0
- package/dist/validation-issue-B9mjI8jz.js +7 -0
- package/dist/validation-message-Ced9MGxs.js +194 -0
- package/dist/validation.js +9 -9
- package/dist/validators/email.js +5 -5
- package/dist/validators/future-date.js +8 -8
- package/dist/validators/integer.js +3 -3
- package/dist/validators/is-date.js +4 -4
- package/dist/validators/is-number.js +4 -4
- package/dist/validators/max-age.js +8 -9
- package/dist/validators/max-date.js +8 -8
- package/dist/validators/max-length.js +7 -7
- package/dist/validators/max.js +4 -4
- package/dist/validators/min-age.js +10 -8
- package/dist/validators/min-date.js +3 -3
- package/dist/validators/min-length.js +5 -5
- package/dist/validators/min.js +4 -4
- package/dist/validators/multiple-of.js +11 -7
- package/dist/validators/non-negative.js +3 -3
- package/dist/validators/non-zero.js +3 -3
- package/dist/validators/past-date.js +8 -8
- package/dist/validators/pattern.js +5 -5
- package/dist/validators/phone.js +11 -9
- package/dist/validators/required.js +2 -2
- package/dist/validators/url.js +48 -12
- package/dist/validators.js +17 -17
- package/docs/llms/01-api-reference.md +60 -34
- package/docs/llms/02-quick-start.md +111 -80
- package/docs/llms/03-api-signatures.md +368 -153
- package/docs/llms/04-common-patterns.md +58 -56
- package/docs/llms/05-common-mistakes.md +69 -44
- package/docs/llms/06-troubleshooting.md +14 -9
- package/docs/llms/07-complete-import.md +74 -43
- package/docs/llms/08-form-types.md +11 -4
- package/docs/llms/09-formschema.md +129 -81
- package/docs/llms/10-arrays.md +106 -75
- package/docs/llms/11-async-watchfield.md +2 -2
- package/docs/llms/13-multi-step.md +134 -63
- package/docs/llms/14-extended-mistakes.md +20 -17
- package/docs/llms/15-project-structure.md +221 -74
- package/docs/llms/16-ui-components.md +55 -42
- package/docs/llms/17-nonexistent-api.md +199 -32
- package/docs/llms/18-conditional-fields.md +66 -32
- package/docs/llms/19-reading-values.md +15 -3
- package/docs/llms/20-compute-vs-watch.md +16 -10
- package/docs/llms/21-array-operations.md +51 -27
- package/docs/llms/22-cycle-detection.md +1 -1
- package/docs/llms/23-copy-from.md +2 -2
- package/docs/llms/24-sync-fields.md +6 -5
- package/docs/llms/25-reset-when.md +14 -7
- package/docs/llms/26-transform-value.md +4 -4
- package/docs/llms/27-revalidate-when.md +16 -15
- package/docs/llms/28-submit-and-reset.md +276 -128
- package/docs/llms/29-async-preload.md +39 -29
- package/docs/llms/30-type-safety-recipes.md +105 -51
- package/docs/llms/31-async-validator-debounce.md +96 -53
- package/docs/llms/33-validation-strategy.md +177 -65
- package/docs/llms/34-i18n.md +69 -43
- package/docs/llms/35-unified-contract.md +100 -39
- package/docs/llms/36-issue-messages.md +284 -0
- package/docs/llms/37-compiled-schema.md +332 -0
- package/docs/llms/38-form-flow.md +397 -0
- package/llms-index.json +1 -1
- package/llms.txt +6084 -3420
- package/package.json +23 -4
- package/dist/behaviors-value-C7dSEhCc.js +0 -134
- package/dist/date-utils-dTT_x_Be.js +0 -31
- package/dist/form/create-core-form.d.ts +0 -72
- package/dist/form/factories/index.d.ts +0 -6
- package/dist/form/factories/node-factory.d.ts +0 -189
- package/dist/form/form-submitter.d.ts +0 -121
- package/dist/form/nodes/array-node.d.ts +0 -276
- package/dist/form/nodes/field-node.d.ts +0 -297
- package/dist/form/nodes/form-node.d.ts +0 -326
- package/dist/form/nodes/group-node.d.ts +0 -284
- package/dist/form/nodes/model-array-node.d.ts +0 -126
- package/dist/form/nodes/subscription-manager.d.ts +0 -180
- package/dist/form/status-machine.d.ts +0 -115
- package/dist/form/types/deep-schema.d.ts +0 -107
- package/dist/form/types/form-proxy.d.ts +0 -141
- package/dist/form/unique-id.d.ts +0 -45
- package/dist/form/validation/config.d.ts +0 -73
- package/dist/form/validation/error-handler.d.ts +0 -166
- package/dist/form/validators/validation-error.d.ts +0 -8
- package/dist/index-BrNkQj1y.js +0 -105
- package/dist/loader-Dv_Hl7JC.js +0 -216
- package/dist/model-value-proxy-caTmAiUd.js +0 -419
- package/dist/node-BeV_lV5i.js +0 -100
- package/dist/strategy-DgzELWno.js +0 -204
- package/dist/validation-error-B-U3RsV0.js +0 -11
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { m as $ } from "./en-HP8XEych.js";
|
|
2
|
+
import { h as p, i as g, f as E, p as D, t as L } from "./locale-CG54AU2Q.js";
|
|
3
|
+
function R(t, n, e = {}) {
|
|
4
|
+
const r = /* @__PURE__ */ new Set(), o = t.peek?.(n);
|
|
5
|
+
let a = {
|
|
6
|
+
lang: n,
|
|
7
|
+
locale: o ?? e.previous ?? null,
|
|
8
|
+
pending: o === void 0,
|
|
9
|
+
error: void 0
|
|
10
|
+
}, u = null, s = o === void 0 ? null : n;
|
|
11
|
+
const f = (i) => {
|
|
12
|
+
a = i;
|
|
13
|
+
for (const l of [...r]) l();
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
getState: () => a,
|
|
17
|
+
subscribe(i) {
|
|
18
|
+
return r.add(i), () => {
|
|
19
|
+
r.delete(i);
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
setLang(i) {
|
|
23
|
+
if (u === i) return;
|
|
24
|
+
if (s === i) {
|
|
25
|
+
u = null, (a.lang !== i || a.pending || a.error !== void 0) && f({ ...a, lang: i, pending: !1, error: void 0 });
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const l = t.peek?.(i);
|
|
29
|
+
if (l !== void 0) {
|
|
30
|
+
u = null, s = i, f({ lang: i, locale: l, pending: !1, error: void 0 });
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
c(i);
|
|
34
|
+
},
|
|
35
|
+
retry() {
|
|
36
|
+
a.error === void 0 || u !== null || c(a.lang);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
function c(i) {
|
|
40
|
+
u = i, f({ ...a, lang: i, pending: !0, error: void 0 }), t(i).then(
|
|
41
|
+
(l) => {
|
|
42
|
+
u === i && (u = null, s = i, f({ lang: i, locale: l, pending: !1, error: void 0 }));
|
|
43
|
+
},
|
|
44
|
+
(l) => {
|
|
45
|
+
u === i && (u = null, f({ ...a, pending: !1, error: l }), e.onError?.(l, i));
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const v = "en", N = { onMissingArgument: (t) => `{${t}}` }, w = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new WeakMap();
|
|
51
|
+
function T() {
|
|
52
|
+
return process.env.NODE_ENV !== "production";
|
|
53
|
+
}
|
|
54
|
+
function z(t, n) {
|
|
55
|
+
try {
|
|
56
|
+
if (typeof t != "string") throw new TypeError("сообщение не является строкой");
|
|
57
|
+
return D(t);
|
|
58
|
+
} catch (e) {
|
|
59
|
+
return T() && console.error(
|
|
60
|
+
`[@reformer/core/i18n] ${n}: ${e instanceof Error ? e.message : String(e)}`
|
|
61
|
+
), null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function A(t, n, e) {
|
|
65
|
+
if (!p(t, n)) return;
|
|
66
|
+
let r = w.get(t);
|
|
67
|
+
r === void 0 && w.set(t, r = /* @__PURE__ */ new Map());
|
|
68
|
+
let o = r.get(n);
|
|
69
|
+
return o === void 0 && (o = z(t[n], `локаль «${e}», ключ «${n}»`), r.set(n, o)), o;
|
|
70
|
+
}
|
|
71
|
+
function m(t, n, e, r) {
|
|
72
|
+
const o = A(t, e, n);
|
|
73
|
+
if (o != null)
|
|
74
|
+
return E(o, r ?? {}, n, N);
|
|
75
|
+
}
|
|
76
|
+
function _(t, n, e, r) {
|
|
77
|
+
if (typeof t[e] == "string")
|
|
78
|
+
return m(t, n, e, r);
|
|
79
|
+
}
|
|
80
|
+
function U(t, n, e, r) {
|
|
81
|
+
return m(t.messages, t.code, e, r) ?? m(n, v, e, r) ?? e;
|
|
82
|
+
}
|
|
83
|
+
function P(t, n) {
|
|
84
|
+
let e = S.get(t);
|
|
85
|
+
return e === void 0 && (e = z(t, `defaultMessage «${t}»`), S.set(t, e)), e === null ? void 0 : E(e, n ?? {}, v, N);
|
|
86
|
+
}
|
|
87
|
+
const M = ["b", "kb", "mb", "gb", "tb"], y = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Map();
|
|
88
|
+
function F(t, n, e, r) {
|
|
89
|
+
const o = e === void 0 ? n : `${n}|${JSON.stringify(e)}`;
|
|
90
|
+
let a = t.get(o);
|
|
91
|
+
return a === void 0 && t.set(o, a = r()), a;
|
|
92
|
+
}
|
|
93
|
+
const b = /* @__PURE__ */ new WeakMap();
|
|
94
|
+
function Z(t) {
|
|
95
|
+
const n = b.get(t);
|
|
96
|
+
if (n !== void 0) return n;
|
|
97
|
+
const { code: e, messages: r } = t, o = (s, f) => F(
|
|
98
|
+
y,
|
|
99
|
+
e,
|
|
100
|
+
f,
|
|
101
|
+
() => new Intl.NumberFormat(g(e), f)
|
|
102
|
+
).format(s), a = (s, f, c) => {
|
|
103
|
+
const i = m(r, e, s, f);
|
|
104
|
+
if (i !== void 0) return i;
|
|
105
|
+
if (c !== void 0) {
|
|
106
|
+
const d = P(c, f);
|
|
107
|
+
if (d !== void 0) return d;
|
|
108
|
+
}
|
|
109
|
+
const l = m($, v, s, f);
|
|
110
|
+
if (l !== void 0) return l;
|
|
111
|
+
if (T()) {
|
|
112
|
+
let d = h.get(r);
|
|
113
|
+
d === void 0 && h.set(r, d = /* @__PURE__ */ new Set()), d.has(s) || (d.add(s), console.warn(
|
|
114
|
+
`[@reformer/core/i18n] ключа «${s}» нет в локали «${e}», и defaultMessage не задан — показан сам ключ`
|
|
115
|
+
));
|
|
116
|
+
}
|
|
117
|
+
return s;
|
|
118
|
+
}, u = {
|
|
119
|
+
locale: t,
|
|
120
|
+
code: e,
|
|
121
|
+
has: (s) => p(r, s),
|
|
122
|
+
t: a,
|
|
123
|
+
number: o,
|
|
124
|
+
date: (s, f) => F(
|
|
125
|
+
j,
|
|
126
|
+
e,
|
|
127
|
+
f,
|
|
128
|
+
() => new Intl.DateTimeFormat(g(e), f)
|
|
129
|
+
).format(s),
|
|
130
|
+
fileSize: (s) => {
|
|
131
|
+
if (!Number.isFinite(s) || s < 0) return "";
|
|
132
|
+
let f = s, c = 0;
|
|
133
|
+
for (; f >= 1024 && c < M.length - 1; )
|
|
134
|
+
f /= 1024, c += 1;
|
|
135
|
+
const i = o(f, { maximumFractionDigits: c === 0 ? 0 : 1, useGrouping: !1 });
|
|
136
|
+
return a(`format.fileSize.${M[c]}`, { value: i });
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
return b.set(t, u), u;
|
|
140
|
+
}
|
|
141
|
+
function G(t) {
|
|
142
|
+
return t;
|
|
143
|
+
}
|
|
144
|
+
const C = /* @__PURE__ */ new Set([
|
|
145
|
+
"maxFileSize",
|
|
146
|
+
"minFileSize",
|
|
147
|
+
"actualSize",
|
|
148
|
+
"maxTotalFileSize",
|
|
149
|
+
"actualTotal"
|
|
150
|
+
]), I = /* @__PURE__ */ new Map();
|
|
151
|
+
function W(t, n) {
|
|
152
|
+
const e = n.map(L);
|
|
153
|
+
let r = I.get(t);
|
|
154
|
+
if (r === void 0) {
|
|
155
|
+
try {
|
|
156
|
+
r = new Intl.ListFormat(g(t), { style: "narrow", type: "conjunction" });
|
|
157
|
+
} catch {
|
|
158
|
+
r = null;
|
|
159
|
+
}
|
|
160
|
+
I.set(t, r);
|
|
161
|
+
}
|
|
162
|
+
return r === null ? e.join(", ") : r.format(e);
|
|
163
|
+
}
|
|
164
|
+
function O(t, n) {
|
|
165
|
+
if (t === void 0) return;
|
|
166
|
+
const e = {};
|
|
167
|
+
for (const r of Object.keys(t)) {
|
|
168
|
+
const o = t[r];
|
|
169
|
+
o instanceof Date ? e[r] = n.date(o, { dateStyle: "medium" }) : Array.isArray(o) ? e[r] = W(n.code, o) : typeof o == "number" && C.has(r) ? e[r] = n.fileSize(o) : e[r] = o;
|
|
170
|
+
}
|
|
171
|
+
return e;
|
|
172
|
+
}
|
|
173
|
+
function J(t, n, e) {
|
|
174
|
+
if (e !== void 0 && p(e, t.code)) {
|
|
175
|
+
const o = e[t.code];
|
|
176
|
+
if (typeof o == "function") return o(t.params ?? {}, n);
|
|
177
|
+
const a = _(
|
|
178
|
+
e,
|
|
179
|
+
n.code,
|
|
180
|
+
t.code,
|
|
181
|
+
O(t.params, n)
|
|
182
|
+
);
|
|
183
|
+
if (a !== void 0) return a;
|
|
184
|
+
}
|
|
185
|
+
const r = `validation.${t.code}`;
|
|
186
|
+
return n.has(r) || p($, r) ? n.t(r, O(t.params, n)) : t.code;
|
|
187
|
+
}
|
|
188
|
+
export {
|
|
189
|
+
Z as a,
|
|
190
|
+
R as c,
|
|
191
|
+
G as d,
|
|
192
|
+
J as r,
|
|
193
|
+
U as t
|
|
194
|
+
};
|
package/dist/validation.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as i, d as l, f as s, h as d, e as t, r as n, v as o, a as p, g as r, b as v } from "./strategy-CoFSemuP.js";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
i as apply,
|
|
4
|
+
l as applyEach,
|
|
5
|
+
s as applyValidationResult,
|
|
5
6
|
d as createFormValidation,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
c as each,
|
|
7
|
+
t as defineValidation,
|
|
8
|
+
n as runValidation,
|
|
9
9
|
o as validate,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
p as validateAsync,
|
|
11
|
+
r as validateModel,
|
|
12
|
+
v as validateWhen
|
|
13
13
|
};
|
package/dist/validators/email.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { v as n } from "../validation-
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
return (r) => r ?
|
|
1
|
+
import { v as n } from "../validation-issue-B9mjI8jz.js";
|
|
2
|
+
const e = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
3
|
+
function s(t) {
|
|
4
|
+
return (r) => r ? e.test(r) ? null : n("email", t) : null;
|
|
5
5
|
}
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
s as email
|
|
8
8
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { p as
|
|
2
|
-
import { v as
|
|
1
|
+
import { p as o, n as s, g as u } from "../date-utils-90-qZbse.js";
|
|
2
|
+
import { v as i } from "../validation-issue-B9mjI8jz.js";
|
|
3
3
|
function f(n) {
|
|
4
|
-
return (
|
|
5
|
-
if (
|
|
4
|
+
return (t) => {
|
|
5
|
+
if (t == null || t === "")
|
|
6
6
|
return null;
|
|
7
|
-
const
|
|
8
|
-
if (
|
|
7
|
+
const r = o(t);
|
|
8
|
+
if (r === null)
|
|
9
9
|
return null;
|
|
10
|
-
const
|
|
11
|
-
return
|
|
10
|
+
const a = s(r), e = u();
|
|
11
|
+
return a < e ? i("date_past", n) : null;
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { v as t } from "../validation-
|
|
2
|
-
function
|
|
1
|
+
import { v as t } from "../validation-issue-B9mjI8jz.js";
|
|
2
|
+
function i(n) {
|
|
3
3
|
return (r) => r == null || typeof r != "number" || isNaN(r) || Number.isInteger(r) ? null : t("integer", n);
|
|
4
4
|
}
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
i as integer
|
|
7
7
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { p as t } from "../date-utils-
|
|
2
|
-
import { v as i } from "../validation-
|
|
3
|
-
function
|
|
1
|
+
import { p as t } from "../date-utils-90-qZbse.js";
|
|
2
|
+
import { v as i } from "../validation-issue-B9mjI8jz.js";
|
|
3
|
+
function a(n) {
|
|
4
4
|
return (r) => r == null || r === "" ? null : t(r) === null ? i("date_invalid", n) : null;
|
|
5
5
|
}
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
a as isDate
|
|
8
8
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { v as
|
|
2
|
-
function
|
|
3
|
-
return (r) => r == null ? null : typeof r != "number" ||
|
|
1
|
+
import { v as n } from "../validation-issue-B9mjI8jz.js";
|
|
2
|
+
function u(i) {
|
|
3
|
+
return (r) => r == null || r === "" ? null : typeof r != "number" || !Number.isFinite(r) ? n("isNumber", i) : null;
|
|
4
4
|
}
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
u as isNumber
|
|
7
7
|
};
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { p as
|
|
2
|
-
import { v as
|
|
3
|
-
function
|
|
1
|
+
import { p as i, i as a, c as l } from "../date-utils-90-qZbse.js";
|
|
2
|
+
import { v as s } from "../validation-issue-B9mjI8jz.js";
|
|
3
|
+
function f(n, u) {
|
|
4
4
|
return (r) => {
|
|
5
5
|
if (r == null || r === "")
|
|
6
6
|
return null;
|
|
7
|
-
const t =
|
|
8
|
-
if (t === null)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return e > n ? l("date_max_age", a, { maxAge: n, currentAge: e }) : null;
|
|
7
|
+
const t = i(r);
|
|
8
|
+
if (t === null || a(t)) return null;
|
|
9
|
+
const e = l(t);
|
|
10
|
+
return e > n ? s("date_max_age", u, { maxAge: n, currentAge: e }) : null;
|
|
12
11
|
};
|
|
13
12
|
}
|
|
14
13
|
export {
|
|
15
|
-
|
|
14
|
+
f as maxAge
|
|
16
15
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { p as l, n as
|
|
2
|
-
import { v as
|
|
3
|
-
function d(
|
|
4
|
-
return (
|
|
5
|
-
if (
|
|
1
|
+
import { p as l, n as a } from "../date-utils-90-qZbse.js";
|
|
2
|
+
import { v as s } from "../validation-issue-B9mjI8jz.js";
|
|
3
|
+
function d(r, o) {
|
|
4
|
+
return (n) => {
|
|
5
|
+
if (n == null || n === "")
|
|
6
6
|
return null;
|
|
7
|
-
const t = l(
|
|
7
|
+
const t = l(n);
|
|
8
8
|
if (t === null)
|
|
9
9
|
return null;
|
|
10
|
-
const e =
|
|
11
|
-
return e > i ?
|
|
10
|
+
const e = a(t), i = a(r);
|
|
11
|
+
return e > i ? s("date_max", o, { maxDate: r }) : null;
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
export {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { v as
|
|
2
|
-
function
|
|
3
|
-
return (
|
|
4
|
-
if (
|
|
1
|
+
import { v as u } from "../validation-issue-B9mjI8jz.js";
|
|
2
|
+
function a(r, e) {
|
|
3
|
+
return (t) => {
|
|
4
|
+
if (t == null || t === "")
|
|
5
5
|
return null;
|
|
6
|
-
const
|
|
7
|
-
return typeof
|
|
6
|
+
const n = t.length;
|
|
7
|
+
return typeof n != "number" ? null : n > r ? Array.isArray(t) ? u("maxItems", e, { maxLength: r, actualLength: n }) : u("maxLength", e, { maxLength: r, actualLength: n }) : null;
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
10
|
export {
|
|
11
|
-
|
|
11
|
+
a as maxLength
|
|
12
12
|
};
|
package/dist/validators/max.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { v as i } from "../validation-
|
|
2
|
-
function
|
|
3
|
-
return (r) => r
|
|
1
|
+
import { v as i } from "../validation-issue-B9mjI8jz.js";
|
|
2
|
+
function m(n, t) {
|
|
3
|
+
return (r) => typeof r != "number" || Number.isNaN(r) ? null : r > n ? i("max", t, { max: n, actual: r }) : null;
|
|
4
4
|
}
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
m as max
|
|
7
7
|
};
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { p as
|
|
2
|
-
import { v as
|
|
3
|
-
function
|
|
1
|
+
import { p as a, i as s, c as f } from "../date-utils-90-qZbse.js";
|
|
2
|
+
import { v as u } from "../validation-issue-B9mjI8jz.js";
|
|
3
|
+
function c(t, e) {
|
|
4
4
|
return (r) => {
|
|
5
5
|
if (r == null || r === "")
|
|
6
6
|
return null;
|
|
7
|
-
const
|
|
8
|
-
if (
|
|
7
|
+
const n = a(r);
|
|
8
|
+
if (n === null)
|
|
9
9
|
return null;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
if (s(n))
|
|
11
|
+
return u("date_future", e, { minAge: t });
|
|
12
|
+
const i = f(n);
|
|
13
|
+
return i < t ? u("date_min_age", e, { minAge: t, currentAge: i }) : null;
|
|
12
14
|
};
|
|
13
15
|
}
|
|
14
16
|
export {
|
|
15
|
-
|
|
17
|
+
c as minAge
|
|
16
18
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as l, n as i } from "../date-utils-
|
|
2
|
-
import { v as
|
|
1
|
+
import { p as l, n as i } from "../date-utils-90-qZbse.js";
|
|
2
|
+
import { v as s } from "../validation-issue-B9mjI8jz.js";
|
|
3
3
|
function d(r, o) {
|
|
4
4
|
return (n) => {
|
|
5
5
|
if (n == null || n === "")
|
|
@@ -8,7 +8,7 @@ function d(r, o) {
|
|
|
8
8
|
if (t === null)
|
|
9
9
|
return null;
|
|
10
10
|
const e = i(t), a = i(r);
|
|
11
|
-
return e < a ?
|
|
11
|
+
return e < a ? s("date_min", o, { minDate: r }) : null;
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
export {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { v as i } from "../validation-
|
|
2
|
-
function
|
|
1
|
+
import { v as i } from "../validation-issue-B9mjI8jz.js";
|
|
2
|
+
function l(r, e) {
|
|
3
3
|
return (n) => {
|
|
4
4
|
if (n == null || n === "")
|
|
5
5
|
return null;
|
|
6
|
-
const
|
|
7
|
-
return typeof
|
|
6
|
+
const t = n.length;
|
|
7
|
+
return typeof t != "number" ? null : t < r ? Array.isArray(n) ? i("minItems", e, { minLength: r, actualLength: t }) : i("minLength", e, { minLength: r, actualLength: t }) : null;
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
10
|
export {
|
|
11
|
-
|
|
11
|
+
l as minLength
|
|
12
12
|
};
|
package/dist/validators/min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { v as
|
|
2
|
-
function
|
|
3
|
-
return (r) => r
|
|
1
|
+
import { v as i } from "../validation-issue-B9mjI8jz.js";
|
|
2
|
+
function m(n, t) {
|
|
3
|
+
return (r) => typeof r != "number" || Number.isNaN(r) ? null : r < n ? i("min", t, { min: n, actual: r }) : null;
|
|
4
4
|
}
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
m as min
|
|
7
7
|
};
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { v as
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { v as u } from "../validation-issue-B9mjI8jz.js";
|
|
2
|
+
function f(t, e) {
|
|
3
|
+
if (!Number.isFinite(t) || t === 0)
|
|
4
|
+
throw new RangeError(
|
|
5
|
+
`[@reformer/core] multipleOf(${String(t)}): делитель должен быть конечным числом, не равным нулю.`
|
|
6
|
+
);
|
|
7
|
+
return (r) => {
|
|
8
|
+
if (r == null || typeof r != "number" || isNaN(r)) return null;
|
|
9
|
+
const n = r / t;
|
|
10
|
+
return Math.abs(n - Math.round(n)) <= 8 * Number.EPSILON * Math.max(1, Math.abs(n)) ? null : u("multipleOf", e, { multipleOf: t });
|
|
7
11
|
};
|
|
8
12
|
}
|
|
9
13
|
export {
|
|
10
|
-
|
|
14
|
+
f as multipleOf
|
|
11
15
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { v as t } from "../validation-
|
|
2
|
-
function
|
|
1
|
+
import { v as t } from "../validation-issue-B9mjI8jz.js";
|
|
2
|
+
function e(r) {
|
|
3
3
|
return (n) => n == null || typeof n != "number" || isNaN(n) ? null : n < 0 ? t("nonNegative", r) : null;
|
|
4
4
|
}
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
e as nonNegative
|
|
7
7
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { v as o } from "../validation-
|
|
2
|
-
function i(
|
|
3
|
-
return (
|
|
1
|
+
import { v as o } from "../validation-issue-B9mjI8jz.js";
|
|
2
|
+
function i(r) {
|
|
3
|
+
return (n) => n == null || typeof n != "number" || isNaN(n) ? null : n === 0 ? o("nonZero", r) : null;
|
|
4
4
|
}
|
|
5
5
|
export {
|
|
6
6
|
i as nonZero
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { p as
|
|
2
|
-
import { v as
|
|
1
|
+
import { p as o, n as s, g as u } from "../date-utils-90-qZbse.js";
|
|
2
|
+
import { v as i } from "../validation-issue-B9mjI8jz.js";
|
|
3
3
|
function f(n) {
|
|
4
|
-
return (
|
|
5
|
-
if (
|
|
4
|
+
return (t) => {
|
|
5
|
+
if (t == null || t === "")
|
|
6
6
|
return null;
|
|
7
|
-
const
|
|
8
|
-
if (
|
|
7
|
+
const r = o(t);
|
|
8
|
+
if (r === null)
|
|
9
9
|
return null;
|
|
10
|
-
const
|
|
11
|
-
return
|
|
10
|
+
const a = s(r), e = u();
|
|
11
|
+
return a > e ? i("date_future", n) : null;
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
export {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { v as
|
|
2
|
-
function
|
|
3
|
-
const
|
|
4
|
-
return (
|
|
1
|
+
import { v as s } from "../validation-issue-B9mjI8jz.js";
|
|
2
|
+
function o(t, e) {
|
|
3
|
+
const n = new RegExp(t.source, t.flags);
|
|
4
|
+
return (r) => r ? (n.lastIndex = 0, n.test(r) ? null : s("pattern", e, { pattern: t.source })) : null;
|
|
5
5
|
}
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
o as pattern
|
|
8
8
|
};
|
package/dist/validators/phone.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { v as
|
|
2
|
-
const
|
|
1
|
+
import { v as e } from "../validation-issue-B9mjI8jz.js";
|
|
2
|
+
const o = {
|
|
3
3
|
international: /^\+?[1-9]\d{1,14}$/,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
// Код города — в парных скобках либо без них: непарная скобка — не номер.
|
|
5
|
+
ru: /^(\+7|7|8)?[\s-]?(?:\([489][0-9]{2}\)|[489][0-9]{2})[\s-]?[0-9]{3}[\s-]?[0-9]{2}[\s-]?[0-9]{2}$/,
|
|
6
|
+
us: /^(\+?1)?[\s-]?(?:\([2-9]\d{2}\)|[2-9]\d{2})[\s-]?\d{3}[\s-]?\d{4}$/,
|
|
7
|
+
// От 3 до 15 цифр (предел E.164), между ними — любые скобки, пробелы, точки и дефисы.
|
|
8
|
+
any: /^\+?(?:[\s().-]*\d){3,15}[\s().-]*$/
|
|
7
9
|
};
|
|
8
|
-
function
|
|
9
|
-
const
|
|
10
|
-
return (
|
|
10
|
+
function a(n) {
|
|
11
|
+
const r = n?.format ?? "any", t = o[r];
|
|
12
|
+
return (s) => s ? t.test(s) ? null : e("phone", n, { format: r }) : null;
|
|
11
13
|
}
|
|
12
14
|
export {
|
|
13
|
-
|
|
15
|
+
a as phone
|
|
14
16
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { v as i } from "../validation-
|
|
1
|
+
import { v as i } from "../validation-issue-B9mjI8jz.js";
|
|
2
2
|
function e(t) {
|
|
3
|
-
return (r) => r == null || r === "" || Array.isArray(r) && r.length === 0 || typeof r == "boolean" && r !== !0 ? i("required", t) : null;
|
|
3
|
+
return (r) => r == null || r === "" || Array.isArray(r) && r.length === 0 || typeof r == "number" && Number.isNaN(r) || typeof r == "boolean" && r !== !0 ? i("required", t) : null;
|
|
4
4
|
}
|
|
5
5
|
export {
|
|
6
6
|
e as required
|
package/dist/validators/url.js
CHANGED
|
@@ -1,17 +1,53 @@
|
|
|
1
|
-
import { v as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { v as i } from "../validation-issue-B9mjI8jz.js";
|
|
2
|
+
const f = ["http", "https"], h = /^([a-z][a-z\d+.-]*):\/\//i, a = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)", p = new RegExp(`^${a}(?:\\.${a}){3}$`), L = /^\[[\da-f:.]+\]$/i, w = /^[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?$/u, P = new RegExp("^(?:\\p{L}{2,}|xn--[a-z\\d-]+)$", "iu"), E = /^\d{1,5}$/, x = /\s/;
|
|
3
|
+
function O(t) {
|
|
4
|
+
if (t.toLowerCase() === "localhost" || p.test(t) || L.test(t)) return !0;
|
|
5
|
+
const r = t.split(".");
|
|
6
|
+
return r.length >= 2 && r.every((l) => w.test(l)) && P.test(r[r.length - 1]);
|
|
7
|
+
}
|
|
8
|
+
function d(t, r) {
|
|
9
|
+
const l = t.slice(r), c = l.search(/[/?#]/), e = c === -1 ? l : l.slice(0, c);
|
|
10
|
+
if (e.includes("@")) return !1;
|
|
11
|
+
let s = e, n;
|
|
12
|
+
if (e.startsWith("[")) {
|
|
13
|
+
const o = e.indexOf("]");
|
|
14
|
+
if (o === -1) return !1;
|
|
15
|
+
s = e.slice(0, o + 1);
|
|
16
|
+
const u = e.slice(o + 1);
|
|
17
|
+
if (u !== "") {
|
|
18
|
+
if (!u.startsWith(":")) return !1;
|
|
19
|
+
n = u.slice(1);
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
const o = e.lastIndexOf(":");
|
|
23
|
+
o !== -1 && (s = e.slice(0, o), n = e.slice(o + 1));
|
|
24
|
+
}
|
|
25
|
+
if (!O(s) || n !== void 0 && !E.test(n)) return !1;
|
|
26
|
+
try {
|
|
27
|
+
return new URL(t), !0;
|
|
28
|
+
} catch {
|
|
29
|
+
return !1;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function C(t) {
|
|
33
|
+
const r = t?.allowedProtocols !== void 0 && t.allowedProtocols.length > 0, l = (r ? t.allowedProtocols : f).map(
|
|
34
|
+
(e) => e.toLowerCase()
|
|
35
|
+
), c = () => i("url_protocol", t, {
|
|
36
|
+
allowedProtocols: r ? t.allowedProtocols : [...f]
|
|
37
|
+
});
|
|
38
|
+
return (e) => {
|
|
39
|
+
if (!e)
|
|
6
40
|
return null;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
41
|
+
if (x.test(e)) return i("url", t);
|
|
42
|
+
const s = h.exec(e);
|
|
43
|
+
if (s === null) {
|
|
44
|
+
if (t?.requireProtocol || e.startsWith("/")) return i("url", t);
|
|
45
|
+
const n = `http://${e}`;
|
|
46
|
+
return d(n, 7) ? r ? c() : null : i("url", t);
|
|
47
|
+
}
|
|
48
|
+
return d(e, s[0].length) ? l.includes(s[1].toLowerCase()) ? null : c() : i("url", t);
|
|
13
49
|
};
|
|
14
50
|
}
|
|
15
51
|
export {
|
|
16
|
-
|
|
52
|
+
C as url
|
|
17
53
|
};
|