@hy_ong/zod-kit 0.2.1 → 0.2.3
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/{chunk-MCDESS3T.js → chunk-2JGRV3JO.js} +1 -1
- package/dist/{chunk-4LYZAO3P.js → chunk-3QLUXIY2.js} +1 -1
- package/dist/chunk-3ZF5JO3F.js +61 -0
- package/dist/{chunk-OP4KV3BY.cjs → chunk-4AQB4RSU.cjs} +3 -3
- package/dist/{chunk-UFNVCUPQ.cjs → chunk-53EEWALQ.cjs} +3 -3
- package/dist/{chunk-R5G4V7C6.cjs → chunk-5ZMTAI4G.cjs} +3 -3
- package/dist/{chunk-RKHX3DGH.js → chunk-6DFP7XY2.js} +1 -1
- package/dist/{chunk-P2NONIMS.js → chunk-6IAPM7BP.js} +1 -1
- package/dist/{chunk-AWV2IT66.js → chunk-7SKH66CM.js} +1 -1
- package/dist/chunk-7X3XPK6A.js +92 -0
- package/dist/{chunk-FVO4743A.cjs → chunk-A2GAEU4O.cjs} +3 -3
- package/dist/{chunk-P364KRO5.js → chunk-AI4U42JV.js} +1 -1
- package/dist/{chunk-5ZEKWPSE.cjs → chunk-AYCXAJRA.cjs} +3 -3
- package/dist/{chunk-5LS4DSRQ.cjs → chunk-BZSPJJYT.cjs} +3 -3
- package/dist/chunk-BZWQPSHO.cjs +92 -0
- package/dist/{chunk-KARFFIMP.js → chunk-D55YFP5R.js} +1 -1
- package/dist/{chunk-I2RJMDXN.js → chunk-E52GRXYY.js} +1 -1
- package/dist/{chunk-VDOAPLA6.cjs → chunk-EDTNS2XL.cjs} +3 -3
- package/dist/{chunk-YALLOVNO.cjs → chunk-FEL432I2.cjs} +3 -3
- package/dist/chunk-FMPHW7ID.cjs +61 -0
- package/dist/{chunk-OMFQ7Z63.cjs → chunk-FP4O2ICM.cjs} +3 -3
- package/dist/{chunk-AANSHH2O.cjs → chunk-G747FHUZ.cjs} +3 -3
- package/dist/{chunk-JZ2SHRGZ.js → chunk-G7FLGJYD.js} +1 -1
- package/dist/{chunk-LKPXHW5N.cjs → chunk-H25N5GP6.cjs} +3 -3
- package/dist/{chunk-FC6VDOC7.js → chunk-H6STFX4I.js} +11 -2
- package/dist/{chunk-MAQRXYE6.js → chunk-HQ4RAMSD.js} +1 -1
- package/dist/{chunk-6X22I6NQ.cjs → chunk-HZ2WESSL.cjs} +3 -3
- package/dist/{chunk-W2EWMV3A.cjs → chunk-IWR3H7IH.cjs} +3 -3
- package/dist/{chunk-5GAZQDVS.cjs → chunk-JZEF5Q3W.cjs} +13 -4
- package/dist/{chunk-77KZUPPN.cjs → chunk-KIUO2HIR.cjs} +3 -3
- package/dist/{chunk-OEK7QSQP.js → chunk-LBH5U2DZ.js} +1 -1
- package/dist/{chunk-PGSDXR2I.js → chunk-LC4RNKBM.js} +1 -1
- package/dist/{chunk-YAU6JCYL.cjs → chunk-LNWEJED7.cjs} +3 -3
- package/dist/{chunk-WWRFBLCR.cjs → chunk-LXFRQLH4.cjs} +3 -3
- package/dist/{chunk-B3U5G3AA.js → chunk-NWQSOSNF.js} +1 -1
- package/dist/{chunk-LIQSVJLS.js → chunk-OGU7AIZF.js} +1 -1
- package/dist/{chunk-NKCYXBGX.js → chunk-OKO6WO6M.js} +1 -1
- package/dist/{chunk-6OGDPSWT.js → chunk-OSUPJCBA.js} +1 -1
- package/dist/{chunk-ZBOQCXD4.js → chunk-POIDES2L.js} +190 -0
- package/dist/{chunk-MG25BEV4.cjs → chunk-Q24GYUTO.cjs} +3 -3
- package/dist/{chunk-YWV2BBXN.cjs → chunk-Q7TUNJD4.cjs} +190 -0
- package/dist/{chunk-DRXPGQM6.cjs → chunk-QQWX3ICK.cjs} +3 -3
- package/dist/{chunk-EAU42EVH.js → chunk-RFWCYULE.js} +1 -1
- package/dist/{chunk-VCRKYMJM.js → chunk-RHKBT3M2.js} +1 -1
- package/dist/{chunk-36NWHESN.js → chunk-RVGCMQ4J.js} +1 -1
- package/dist/{chunk-IJEEM3DI.js → chunk-T7PG4JDW.js} +1 -1
- package/dist/{chunk-JBNCMS42.cjs → chunk-TDEXEIHH.cjs} +3 -3
- package/dist/{chunk-VP5CCP5F.cjs → chunk-TPXRQT2H.cjs} +3 -3
- package/dist/{chunk-DPXRMSB2.js → chunk-TRQMRHFM.js} +1 -1
- package/dist/{chunk-ZFQQXWNB.js → chunk-U2PB6XEO.js} +1 -1
- package/dist/{chunk-G6DV7LX7.cjs → chunk-UCPKW43K.cjs} +3 -3
- package/dist/{chunk-PL2GERLG.cjs → chunk-V2KKGSKQ.cjs} +3 -3
- package/dist/{chunk-AI72FMOF.cjs → chunk-VKBNKPFO.cjs} +3 -3
- package/dist/{chunk-5OGW2ERW.js → chunk-XAN4CAVH.js} +1 -1
- package/dist/{chunk-CFFCBWYL.cjs → chunk-ZCX22PY4.cjs} +3 -3
- package/dist/{chunk-TSHL7ZO2.js → chunk-ZXPRRNZR.js} +1 -1
- package/dist/common/boolean.cjs +3 -3
- package/dist/common/boolean.js +2 -2
- package/dist/common/color.cjs +3 -3
- package/dist/common/color.js +2 -2
- package/dist/common/coordinate.cjs +3 -3
- package/dist/common/coordinate.js +2 -2
- package/dist/common/credit-card.cjs +3 -3
- package/dist/common/credit-card.js +2 -2
- package/dist/common/date.cjs +3 -3
- package/dist/common/date.js +2 -2
- package/dist/common/datetime.cjs +3 -3
- package/dist/common/datetime.js +2 -2
- package/dist/common/email.cjs +3 -3
- package/dist/common/email.js +2 -2
- package/dist/common/file.cjs +3 -3
- package/dist/common/file.js +2 -2
- package/dist/common/id.cjs +3 -3
- package/dist/common/id.d.cts +34 -8
- package/dist/common/id.d.ts +34 -8
- package/dist/common/id.js +2 -2
- package/dist/common/ip.cjs +3 -3
- package/dist/common/ip.js +2 -2
- package/dist/common/many-of.cjs +7 -0
- package/dist/common/many-of.d.cts +111 -0
- package/dist/common/many-of.d.ts +111 -0
- package/dist/common/many-of.js +7 -0
- package/dist/common/number.cjs +3 -3
- package/dist/common/number.js +2 -2
- package/dist/common/one-of.cjs +7 -0
- package/dist/common/one-of.d.cts +104 -0
- package/dist/common/one-of.d.ts +104 -0
- package/dist/common/one-of.js +7 -0
- package/dist/common/password.cjs +3 -3
- package/dist/common/password.js +2 -2
- package/dist/common/text.cjs +3 -3
- package/dist/common/text.js +2 -2
- package/dist/common/time.cjs +3 -3
- package/dist/common/time.js +2 -2
- package/dist/common/url.cjs +3 -3
- package/dist/common/url.js +2 -2
- package/dist/index.cjs +35 -27
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +46 -38
- package/dist/taiwan/bank-account.cjs +3 -3
- package/dist/taiwan/bank-account.js +2 -2
- package/dist/taiwan/business-id.cjs +3 -3
- package/dist/taiwan/business-id.js +2 -2
- package/dist/taiwan/fax.cjs +3 -3
- package/dist/taiwan/fax.js +2 -2
- package/dist/taiwan/invoice.cjs +3 -3
- package/dist/taiwan/invoice.js +2 -2
- package/dist/taiwan/license-plate.cjs +3 -3
- package/dist/taiwan/license-plate.js +2 -2
- package/dist/taiwan/mobile.cjs +3 -3
- package/dist/taiwan/mobile.js +2 -2
- package/dist/taiwan/national-id.cjs +3 -3
- package/dist/taiwan/national-id.js +2 -2
- package/dist/taiwan/passport.cjs +3 -3
- package/dist/taiwan/passport.js +2 -2
- package/dist/taiwan/postal-code.cjs +3 -3
- package/dist/taiwan/postal-code.js +2 -2
- package/dist/taiwan/tel.cjs +3 -3
- package/dist/taiwan/tel.js +2 -2
- package/package.json +15 -5
- package/src/i18n/locales/en-GB.json +19 -0
- package/src/i18n/locales/en-US.json +20 -1
- package/src/i18n/locales/id-ID.json +19 -0
- package/src/i18n/locales/ja-JP.json +19 -0
- package/src/i18n/locales/ko-KR.json +19 -0
- package/src/i18n/locales/ms-MY.json +19 -0
- package/src/i18n/locales/th-TH.json +19 -0
- package/src/i18n/locales/vi-VN.json +19 -0
- package/src/i18n/locales/zh-CN.json +19 -0
- package/src/i18n/locales/zh-TW.json +19 -0
- package/src/index.ts +2 -0
- package/src/validators/common/id.ts +45 -3
- package/src/validators/common/many-of.ts +219 -0
- package/src/validators/common/one-of.ts +172 -0
- package/tests/common/id.test.ts +68 -3
- package/tests/common/many-of.test.ts +198 -0
- package/tests/common/one-of.test.ts +136 -0
- package/tsup.config.ts +2 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkQ7TUNJD4cjs = require('./chunk-Q7TUNJD4.cjs');
|
|
5
5
|
|
|
6
6
|
// src/validators/common/number.ts
|
|
7
7
|
var _zod = require('zod');
|
|
@@ -10,14 +10,14 @@ function number(required, options) {
|
|
|
10
10
|
const isRequired = _nullishCoalesce(required, () => ( false));
|
|
11
11
|
const getMessage = (key, params) => {
|
|
12
12
|
if (i18n) {
|
|
13
|
-
const currentLocale =
|
|
13
|
+
const currentLocale = _chunkQ7TUNJD4cjs.getLocale.call(void 0, );
|
|
14
14
|
const customMessages = i18n[currentLocale];
|
|
15
15
|
if (customMessages && customMessages[key]) {
|
|
16
16
|
const template = customMessages[key];
|
|
17
17
|
return template.replace(/\$\{(\w+)}/g, (_, k) => _nullishCoalesce(_optionalChain([params, 'optionalAccess', _2 => _2[k]]), () => ( "")));
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
return
|
|
20
|
+
return _chunkQ7TUNJD4cjs.t.call(void 0, `common.number.${key}`, params);
|
|
21
21
|
};
|
|
22
22
|
const actualDefaultValue = _nullishCoalesce(defaultValue, () => ( null));
|
|
23
23
|
const schema = _zod.z.preprocess(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkQ7TUNJD4cjs = require('./chunk-Q7TUNJD4.cjs');
|
|
5
5
|
|
|
6
6
|
// src/validators/common/email.ts
|
|
7
7
|
var _zod = require('zod');
|
|
@@ -24,14 +24,14 @@ function email(required, options) {
|
|
|
24
24
|
const isRequired = _nullishCoalesce(required, () => ( false));
|
|
25
25
|
const getMessage = (key, params) => {
|
|
26
26
|
if (i18n) {
|
|
27
|
-
const currentLocale =
|
|
27
|
+
const currentLocale = _chunkQ7TUNJD4cjs.getLocale.call(void 0, );
|
|
28
28
|
const customMessages = i18n[currentLocale];
|
|
29
29
|
if (customMessages && customMessages[key]) {
|
|
30
30
|
const template = customMessages[key];
|
|
31
31
|
return template.replace(/\$\{(\w+)}/g, (_, k) => _nullishCoalesce(_optionalChain([params, 'optionalAccess', _2 => _2[k]]), () => ( "")));
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
return
|
|
34
|
+
return _chunkQ7TUNJD4cjs.t.call(void 0, `common.email.${key}`, params);
|
|
35
35
|
};
|
|
36
36
|
const disposableDomains = ["10minutemail.com", "tempmail.org", "guerrillamail.com", "mailinator.com", "yopmail.com", "temp-mail.org", "throwaway.email", "getnada.com", "maildrop.cc"];
|
|
37
37
|
const freeEmailDomains = ["gmail.com", "yahoo.com", "hotmail.com", "outlook.com", "icloud.com", "aol.com", "protonmail.com", "zoho.com"];
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getLocale,
|
|
3
3
|
t
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-POIDES2L.js";
|
|
5
5
|
|
|
6
6
|
// src/validators/common/id.ts
|
|
7
7
|
import { z } from "zod";
|
|
8
|
+
var UUID_BASE = (version) => new RegExp(`^[0-9a-f]{8}-[0-9a-f]{4}-${version}[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$`, "i");
|
|
8
9
|
var ID_PATTERNS = {
|
|
9
10
|
numeric: /^\d+$/,
|
|
10
|
-
uuid: /^[0-9a-f]{8}-[0-9a-f]{4}-[1-
|
|
11
|
+
uuid: /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,
|
|
12
|
+
uuidv1: UUID_BASE("1"),
|
|
13
|
+
uuidv2: UUID_BASE("2"),
|
|
14
|
+
uuidv3: UUID_BASE("3"),
|
|
15
|
+
uuidv4: UUID_BASE("4"),
|
|
16
|
+
uuidv5: UUID_BASE("5"),
|
|
17
|
+
uuidv6: UUID_BASE("6"),
|
|
18
|
+
uuidv7: UUID_BASE("7"),
|
|
19
|
+
uuidv8: UUID_BASE("8"),
|
|
11
20
|
objectId: /^[0-9a-f]{24}$/i,
|
|
12
21
|
nanoid: /^[A-Za-z0-9_-]{21}$/,
|
|
13
22
|
snowflake: /^\d{19}$/,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkQ7TUNJD4cjs = require('./chunk-Q7TUNJD4.cjs');
|
|
5
5
|
|
|
6
6
|
// src/validators/common/text.ts
|
|
7
7
|
var _zod = require('zod');
|
|
@@ -11,14 +11,14 @@ function text(required, options) {
|
|
|
11
11
|
const actualDefaultValue = _nullishCoalesce(defaultValue, () => ( (isRequired ? "" : null)));
|
|
12
12
|
const getMessage = (key, params) => {
|
|
13
13
|
if (i18n) {
|
|
14
|
-
const currentLocale =
|
|
14
|
+
const currentLocale = _chunkQ7TUNJD4cjs.getLocale.call(void 0, );
|
|
15
15
|
const customMessages = i18n[currentLocale];
|
|
16
16
|
if (customMessages && customMessages[key]) {
|
|
17
17
|
const template = customMessages[key];
|
|
18
18
|
return template.replace(/\$\{(\w+)}/g, (_, k) => _nullishCoalesce(_optionalChain([params, 'optionalAccess', _2 => _2[k]]), () => ( "")));
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
return
|
|
21
|
+
return _chunkQ7TUNJD4cjs.t.call(void 0, `common.text.${key}`, params);
|
|
22
22
|
};
|
|
23
23
|
const applyTrim = (str) => {
|
|
24
24
|
switch (trimMode) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkQ7TUNJD4cjs = require('./chunk-Q7TUNJD4.cjs');
|
|
5
5
|
|
|
6
6
|
// src/validators/taiwan/business-id.ts
|
|
7
7
|
var _zod = require('zod');
|
|
@@ -42,14 +42,14 @@ function twBusinessId(required, options) {
|
|
|
42
42
|
const actualDefaultValue = _nullishCoalesce(defaultValue, () => ( (isRequired ? "" : null)));
|
|
43
43
|
const getMessage = (key, params) => {
|
|
44
44
|
if (i18n) {
|
|
45
|
-
const currentLocale =
|
|
45
|
+
const currentLocale = _chunkQ7TUNJD4cjs.getLocale.call(void 0, );
|
|
46
46
|
const customMessages = i18n[currentLocale];
|
|
47
47
|
if (customMessages && customMessages[key]) {
|
|
48
48
|
const template = customMessages[key];
|
|
49
49
|
return template.replace(/\$\{(\w+)}/g, (_, k) => _nullishCoalesce(_optionalChain([params, 'optionalAccess', _2 => _2[k]]), () => ( "")));
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
return
|
|
52
|
+
return _chunkQ7TUNJD4cjs.t.call(void 0, `taiwan.businessId.${key}`, params);
|
|
53
53
|
};
|
|
54
54
|
const preprocessFn = (val) => {
|
|
55
55
|
if (val === "" || val === null || val === void 0) {
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkQ7TUNJD4cjs = require('./chunk-Q7TUNJD4.cjs');
|
|
5
5
|
|
|
6
6
|
// src/validators/common/id.ts
|
|
7
7
|
var _zod = require('zod');
|
|
8
|
+
var UUID_BASE = (version) => new RegExp(`^[0-9a-f]{8}-[0-9a-f]{4}-${version}[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$`, "i");
|
|
8
9
|
var ID_PATTERNS = {
|
|
9
10
|
numeric: /^\d+$/,
|
|
10
|
-
uuid: /^[0-9a-f]{8}-[0-9a-f]{4}-[1-
|
|
11
|
+
uuid: /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,
|
|
12
|
+
uuidv1: UUID_BASE("1"),
|
|
13
|
+
uuidv2: UUID_BASE("2"),
|
|
14
|
+
uuidv3: UUID_BASE("3"),
|
|
15
|
+
uuidv4: UUID_BASE("4"),
|
|
16
|
+
uuidv5: UUID_BASE("5"),
|
|
17
|
+
uuidv6: UUID_BASE("6"),
|
|
18
|
+
uuidv7: UUID_BASE("7"),
|
|
19
|
+
uuidv8: UUID_BASE("8"),
|
|
11
20
|
objectId: /^[0-9a-f]{24}$/i,
|
|
12
21
|
nanoid: /^[A-Za-z0-9_-]{21}$/,
|
|
13
22
|
snowflake: /^\d{19}$/,
|
|
@@ -48,14 +57,14 @@ function id(required, options) {
|
|
|
48
57
|
const actualDefaultValue = defaultValue !== void 0 ? defaultValue : isRequired ? isNumericType ? NaN : "" : null;
|
|
49
58
|
const getMessage = (key, params) => {
|
|
50
59
|
if (i18n) {
|
|
51
|
-
const currentLocale =
|
|
60
|
+
const currentLocale = _chunkQ7TUNJD4cjs.getLocale.call(void 0, );
|
|
52
61
|
const customMessages = i18n[currentLocale];
|
|
53
62
|
if (customMessages && customMessages[key]) {
|
|
54
63
|
const template = customMessages[key];
|
|
55
64
|
return template.replace(/\$\{(\w+)}/g, (_match, k) => _nullishCoalesce(_optionalChain([params, 'optionalAccess', _ => _[k]]), () => ( "")));
|
|
56
65
|
}
|
|
57
66
|
}
|
|
58
|
-
return
|
|
67
|
+
return _chunkQ7TUNJD4cjs.t.call(void 0, `common.id.${key}`, params);
|
|
59
68
|
};
|
|
60
69
|
const preprocessNumericFn = (val) => {
|
|
61
70
|
if (val === "" || val === null || val === void 0) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkQ7TUNJD4cjs = require('./chunk-Q7TUNJD4.cjs');
|
|
5
5
|
|
|
6
6
|
// src/validators/common/file.ts
|
|
7
7
|
var _zod = require('zod');
|
|
@@ -28,14 +28,14 @@ function file(required, options) {
|
|
|
28
28
|
const isRequired = _nullishCoalesce(required, () => ( false));
|
|
29
29
|
const getMessage = (key, params) => {
|
|
30
30
|
if (i18n) {
|
|
31
|
-
const currentLocale =
|
|
31
|
+
const currentLocale = _chunkQ7TUNJD4cjs.getLocale.call(void 0, );
|
|
32
32
|
const customMessages = i18n[currentLocale];
|
|
33
33
|
if (customMessages && customMessages[key]) {
|
|
34
34
|
const template = customMessages[key];
|
|
35
35
|
return template.replace(/\$\{(\w+)}/g, (_, k) => _nullishCoalesce(_optionalChain([params, 'optionalAccess', _2 => _2[k]]), () => ( "")));
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
return
|
|
38
|
+
return _chunkQ7TUNJD4cjs.t.call(void 0, `common.file.${key}`, params);
|
|
39
39
|
};
|
|
40
40
|
const imageTypes = ["image/jpeg", "image/jpg", "image/png", "image/gif", "image/webp", "image/svg+xml", "image/bmp", "image/tiff"];
|
|
41
41
|
const documentTypes = [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkQ7TUNJD4cjs = require('./chunk-Q7TUNJD4.cjs');
|
|
5
5
|
|
|
6
6
|
// src/validators/common/boolean.ts
|
|
7
7
|
var _zod = require('zod');
|
|
@@ -18,14 +18,14 @@ function boolean(required, options) {
|
|
|
18
18
|
const isRequired = _nullishCoalesce(required, () => ( false));
|
|
19
19
|
const getMessage = (key, params) => {
|
|
20
20
|
if (i18n) {
|
|
21
|
-
const currentLocale =
|
|
21
|
+
const currentLocale = _chunkQ7TUNJD4cjs.getLocale.call(void 0, );
|
|
22
22
|
const customMessages = i18n[currentLocale];
|
|
23
23
|
if (customMessages && customMessages[key]) {
|
|
24
24
|
const template = customMessages[key];
|
|
25
25
|
return template.replace(/\$\{(\w+)}/g, (_, k) => _nullishCoalesce(_optionalChain([params, 'optionalAccess', _2 => _2[k]]), () => ( "")));
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
return
|
|
28
|
+
return _chunkQ7TUNJD4cjs.t.call(void 0, `common.boolean.${key}`, params);
|
|
29
29
|
};
|
|
30
30
|
let result = _zod.z.preprocess(
|
|
31
31
|
(val) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkQ7TUNJD4cjs = require('./chunk-Q7TUNJD4.cjs');
|
|
5
5
|
|
|
6
6
|
// src/validators/common/ip.ts
|
|
7
7
|
var _zod = require('zod');
|
|
@@ -58,14 +58,14 @@ function ip(required, options) {
|
|
|
58
58
|
const actualDefaultValue = _nullishCoalesce(defaultValue, () => ( (isRequired ? "" : null)));
|
|
59
59
|
const getMessage = (key, params) => {
|
|
60
60
|
if (i18n) {
|
|
61
|
-
const currentLocale =
|
|
61
|
+
const currentLocale = _chunkQ7TUNJD4cjs.getLocale.call(void 0, );
|
|
62
62
|
const customMessages = i18n[currentLocale];
|
|
63
63
|
if (customMessages && customMessages[key]) {
|
|
64
64
|
const template = customMessages[key];
|
|
65
65
|
return template.replace(/\$\{(\w+)}/g, (_, k) => _nullishCoalesce(_optionalChain([params, 'optionalAccess', _2 => _2[k]]), () => ( "")));
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
return
|
|
68
|
+
return _chunkQ7TUNJD4cjs.t.call(void 0, `common.ip.${key}`, params);
|
|
69
69
|
};
|
|
70
70
|
const preprocessFn = (val) => {
|
|
71
71
|
if (val === "" || val === null || val === void 0) {
|