@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.
Files changed (139) hide show
  1. package/dist/{chunk-MCDESS3T.js → chunk-2JGRV3JO.js} +1 -1
  2. package/dist/{chunk-4LYZAO3P.js → chunk-3QLUXIY2.js} +1 -1
  3. package/dist/chunk-3ZF5JO3F.js +61 -0
  4. package/dist/{chunk-OP4KV3BY.cjs → chunk-4AQB4RSU.cjs} +3 -3
  5. package/dist/{chunk-UFNVCUPQ.cjs → chunk-53EEWALQ.cjs} +3 -3
  6. package/dist/{chunk-R5G4V7C6.cjs → chunk-5ZMTAI4G.cjs} +3 -3
  7. package/dist/{chunk-RKHX3DGH.js → chunk-6DFP7XY2.js} +1 -1
  8. package/dist/{chunk-P2NONIMS.js → chunk-6IAPM7BP.js} +1 -1
  9. package/dist/{chunk-AWV2IT66.js → chunk-7SKH66CM.js} +1 -1
  10. package/dist/chunk-7X3XPK6A.js +92 -0
  11. package/dist/{chunk-FVO4743A.cjs → chunk-A2GAEU4O.cjs} +3 -3
  12. package/dist/{chunk-P364KRO5.js → chunk-AI4U42JV.js} +1 -1
  13. package/dist/{chunk-5ZEKWPSE.cjs → chunk-AYCXAJRA.cjs} +3 -3
  14. package/dist/{chunk-5LS4DSRQ.cjs → chunk-BZSPJJYT.cjs} +3 -3
  15. package/dist/chunk-BZWQPSHO.cjs +92 -0
  16. package/dist/{chunk-KARFFIMP.js → chunk-D55YFP5R.js} +1 -1
  17. package/dist/{chunk-I2RJMDXN.js → chunk-E52GRXYY.js} +1 -1
  18. package/dist/{chunk-VDOAPLA6.cjs → chunk-EDTNS2XL.cjs} +3 -3
  19. package/dist/{chunk-YALLOVNO.cjs → chunk-FEL432I2.cjs} +3 -3
  20. package/dist/chunk-FMPHW7ID.cjs +61 -0
  21. package/dist/{chunk-OMFQ7Z63.cjs → chunk-FP4O2ICM.cjs} +3 -3
  22. package/dist/{chunk-AANSHH2O.cjs → chunk-G747FHUZ.cjs} +3 -3
  23. package/dist/{chunk-JZ2SHRGZ.js → chunk-G7FLGJYD.js} +1 -1
  24. package/dist/{chunk-LKPXHW5N.cjs → chunk-H25N5GP6.cjs} +3 -3
  25. package/dist/{chunk-FC6VDOC7.js → chunk-H6STFX4I.js} +11 -2
  26. package/dist/{chunk-MAQRXYE6.js → chunk-HQ4RAMSD.js} +1 -1
  27. package/dist/{chunk-6X22I6NQ.cjs → chunk-HZ2WESSL.cjs} +3 -3
  28. package/dist/{chunk-W2EWMV3A.cjs → chunk-IWR3H7IH.cjs} +3 -3
  29. package/dist/{chunk-5GAZQDVS.cjs → chunk-JZEF5Q3W.cjs} +13 -4
  30. package/dist/{chunk-77KZUPPN.cjs → chunk-KIUO2HIR.cjs} +3 -3
  31. package/dist/{chunk-OEK7QSQP.js → chunk-LBH5U2DZ.js} +1 -1
  32. package/dist/{chunk-PGSDXR2I.js → chunk-LC4RNKBM.js} +1 -1
  33. package/dist/{chunk-YAU6JCYL.cjs → chunk-LNWEJED7.cjs} +3 -3
  34. package/dist/{chunk-WWRFBLCR.cjs → chunk-LXFRQLH4.cjs} +3 -3
  35. package/dist/{chunk-B3U5G3AA.js → chunk-NWQSOSNF.js} +1 -1
  36. package/dist/{chunk-LIQSVJLS.js → chunk-OGU7AIZF.js} +1 -1
  37. package/dist/{chunk-NKCYXBGX.js → chunk-OKO6WO6M.js} +1 -1
  38. package/dist/{chunk-6OGDPSWT.js → chunk-OSUPJCBA.js} +1 -1
  39. package/dist/{chunk-ZBOQCXD4.js → chunk-POIDES2L.js} +190 -0
  40. package/dist/{chunk-MG25BEV4.cjs → chunk-Q24GYUTO.cjs} +3 -3
  41. package/dist/{chunk-YWV2BBXN.cjs → chunk-Q7TUNJD4.cjs} +190 -0
  42. package/dist/{chunk-DRXPGQM6.cjs → chunk-QQWX3ICK.cjs} +3 -3
  43. package/dist/{chunk-EAU42EVH.js → chunk-RFWCYULE.js} +1 -1
  44. package/dist/{chunk-VCRKYMJM.js → chunk-RHKBT3M2.js} +1 -1
  45. package/dist/{chunk-36NWHESN.js → chunk-RVGCMQ4J.js} +1 -1
  46. package/dist/{chunk-IJEEM3DI.js → chunk-T7PG4JDW.js} +1 -1
  47. package/dist/{chunk-JBNCMS42.cjs → chunk-TDEXEIHH.cjs} +3 -3
  48. package/dist/{chunk-VP5CCP5F.cjs → chunk-TPXRQT2H.cjs} +3 -3
  49. package/dist/{chunk-DPXRMSB2.js → chunk-TRQMRHFM.js} +1 -1
  50. package/dist/{chunk-ZFQQXWNB.js → chunk-U2PB6XEO.js} +1 -1
  51. package/dist/{chunk-G6DV7LX7.cjs → chunk-UCPKW43K.cjs} +3 -3
  52. package/dist/{chunk-PL2GERLG.cjs → chunk-V2KKGSKQ.cjs} +3 -3
  53. package/dist/{chunk-AI72FMOF.cjs → chunk-VKBNKPFO.cjs} +3 -3
  54. package/dist/{chunk-5OGW2ERW.js → chunk-XAN4CAVH.js} +1 -1
  55. package/dist/{chunk-CFFCBWYL.cjs → chunk-ZCX22PY4.cjs} +3 -3
  56. package/dist/{chunk-TSHL7ZO2.js → chunk-ZXPRRNZR.js} +1 -1
  57. package/dist/common/boolean.cjs +3 -3
  58. package/dist/common/boolean.js +2 -2
  59. package/dist/common/color.cjs +3 -3
  60. package/dist/common/color.js +2 -2
  61. package/dist/common/coordinate.cjs +3 -3
  62. package/dist/common/coordinate.js +2 -2
  63. package/dist/common/credit-card.cjs +3 -3
  64. package/dist/common/credit-card.js +2 -2
  65. package/dist/common/date.cjs +3 -3
  66. package/dist/common/date.js +2 -2
  67. package/dist/common/datetime.cjs +3 -3
  68. package/dist/common/datetime.js +2 -2
  69. package/dist/common/email.cjs +3 -3
  70. package/dist/common/email.js +2 -2
  71. package/dist/common/file.cjs +3 -3
  72. package/dist/common/file.js +2 -2
  73. package/dist/common/id.cjs +3 -3
  74. package/dist/common/id.d.cts +34 -8
  75. package/dist/common/id.d.ts +34 -8
  76. package/dist/common/id.js +2 -2
  77. package/dist/common/ip.cjs +3 -3
  78. package/dist/common/ip.js +2 -2
  79. package/dist/common/many-of.cjs +7 -0
  80. package/dist/common/many-of.d.cts +111 -0
  81. package/dist/common/many-of.d.ts +111 -0
  82. package/dist/common/many-of.js +7 -0
  83. package/dist/common/number.cjs +3 -3
  84. package/dist/common/number.js +2 -2
  85. package/dist/common/one-of.cjs +7 -0
  86. package/dist/common/one-of.d.cts +104 -0
  87. package/dist/common/one-of.d.ts +104 -0
  88. package/dist/common/one-of.js +7 -0
  89. package/dist/common/password.cjs +3 -3
  90. package/dist/common/password.js +2 -2
  91. package/dist/common/text.cjs +3 -3
  92. package/dist/common/text.js +2 -2
  93. package/dist/common/time.cjs +3 -3
  94. package/dist/common/time.js +2 -2
  95. package/dist/common/url.cjs +3 -3
  96. package/dist/common/url.js +2 -2
  97. package/dist/index.cjs +35 -27
  98. package/dist/index.d.cts +2 -0
  99. package/dist/index.d.ts +2 -0
  100. package/dist/index.js +46 -38
  101. package/dist/taiwan/bank-account.cjs +3 -3
  102. package/dist/taiwan/bank-account.js +2 -2
  103. package/dist/taiwan/business-id.cjs +3 -3
  104. package/dist/taiwan/business-id.js +2 -2
  105. package/dist/taiwan/fax.cjs +3 -3
  106. package/dist/taiwan/fax.js +2 -2
  107. package/dist/taiwan/invoice.cjs +3 -3
  108. package/dist/taiwan/invoice.js +2 -2
  109. package/dist/taiwan/license-plate.cjs +3 -3
  110. package/dist/taiwan/license-plate.js +2 -2
  111. package/dist/taiwan/mobile.cjs +3 -3
  112. package/dist/taiwan/mobile.js +2 -2
  113. package/dist/taiwan/national-id.cjs +3 -3
  114. package/dist/taiwan/national-id.js +2 -2
  115. package/dist/taiwan/passport.cjs +3 -3
  116. package/dist/taiwan/passport.js +2 -2
  117. package/dist/taiwan/postal-code.cjs +3 -3
  118. package/dist/taiwan/postal-code.js +2 -2
  119. package/dist/taiwan/tel.cjs +3 -3
  120. package/dist/taiwan/tel.js +2 -2
  121. package/package.json +15 -5
  122. package/src/i18n/locales/en-GB.json +19 -0
  123. package/src/i18n/locales/en-US.json +20 -1
  124. package/src/i18n/locales/id-ID.json +19 -0
  125. package/src/i18n/locales/ja-JP.json +19 -0
  126. package/src/i18n/locales/ko-KR.json +19 -0
  127. package/src/i18n/locales/ms-MY.json +19 -0
  128. package/src/i18n/locales/th-TH.json +19 -0
  129. package/src/i18n/locales/vi-VN.json +19 -0
  130. package/src/i18n/locales/zh-CN.json +19 -0
  131. package/src/i18n/locales/zh-TW.json +19 -0
  132. package/src/index.ts +2 -0
  133. package/src/validators/common/id.ts +45 -3
  134. package/src/validators/common/many-of.ts +219 -0
  135. package/src/validators/common/one-of.ts +172 -0
  136. package/tests/common/id.test.ts +68 -3
  137. package/tests/common/many-of.test.ts +198 -0
  138. package/tests/common/one-of.test.ts +136 -0
  139. 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 _chunkYWV2BBXNcjs = require('./chunk-YWV2BBXN.cjs');
4
+ var _chunkQ7TUNJD4cjs = require('./chunk-Q7TUNJD4.cjs');
5
5
 
6
6
  // src/validators/common/credit-card.ts
7
7
  var _zod = require('zod');
@@ -37,14 +37,14 @@ function creditCard(required, options) {
37
37
  const actualDefaultValue = _nullishCoalesce(defaultValue, () => ( (isRequired ? "" : null)));
38
38
  const getMessage = (key, params) => {
39
39
  if (i18n) {
40
- const currentLocale = _chunkYWV2BBXNcjs.getLocale.call(void 0, );
40
+ const currentLocale = _chunkQ7TUNJD4cjs.getLocale.call(void 0, );
41
41
  const customMessages = i18n[currentLocale];
42
42
  if (customMessages && customMessages[key]) {
43
43
  const template = customMessages[key];
44
44
  return template.replace(/\$\{(\w+)}/g, (_, k) => _nullishCoalesce(_optionalChain([params, 'optionalAccess', _2 => _2[k]]), () => ( "")));
45
45
  }
46
46
  }
47
- return _chunkYWV2BBXNcjs.t.call(void 0, `common.creditCard.${key}`, params);
47
+ return _chunkQ7TUNJD4cjs.t.call(void 0, `common.creditCard.${key}`, params);
48
48
  };
49
49
  const preprocessFn = (val) => {
50
50
  if (val === "" || val === null || val === void 0) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getLocale,
3
3
  t
4
- } from "./chunk-ZBOQCXD4.js";
4
+ } from "./chunk-POIDES2L.js";
5
5
 
6
6
  // src/validators/common/color.ts
7
7
  import { z } from "zod";
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkYAU6JCYLcjs = require('../chunk-YAU6JCYL.cjs');
4
- require('../chunk-YWV2BBXN.cjs');
3
+ var _chunkLNWEJED7cjs = require('../chunk-LNWEJED7.cjs');
4
+ require('../chunk-Q7TUNJD4.cjs');
5
5
 
6
6
 
7
- exports.boolean = _chunkYAU6JCYLcjs.boolean;
7
+ exports.boolean = _chunkLNWEJED7cjs.boolean;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  boolean
3
- } from "../chunk-PGSDXR2I.js";
4
- import "../chunk-ZBOQCXD4.js";
3
+ } from "../chunk-LC4RNKBM.js";
4
+ import "../chunk-POIDES2L.js";
5
5
  export {
6
6
  boolean
7
7
  };
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkFVO4743Acjs = require('../chunk-FVO4743A.cjs');
5
- require('../chunk-YWV2BBXN.cjs');
4
+ var _chunkA2GAEU4Ocjs = require('../chunk-A2GAEU4O.cjs');
5
+ require('../chunk-Q7TUNJD4.cjs');
6
6
 
7
7
 
8
8
 
9
- exports.color = _chunkFVO4743Acjs.color; exports.validateColor = _chunkFVO4743Acjs.validateColor;
9
+ exports.color = _chunkA2GAEU4Ocjs.color; exports.validateColor = _chunkA2GAEU4Ocjs.validateColor;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  color,
3
3
  validateColor
4
- } from "../chunk-TSHL7ZO2.js";
5
- import "../chunk-ZBOQCXD4.js";
4
+ } from "../chunk-ZXPRRNZR.js";
5
+ import "../chunk-POIDES2L.js";
6
6
  export {
7
7
  color,
8
8
  validateColor
@@ -2,10 +2,10 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkYALLOVNOcjs = require('../chunk-YALLOVNO.cjs');
6
- require('../chunk-YWV2BBXN.cjs');
5
+ var _chunkFEL432I2cjs = require('../chunk-FEL432I2.cjs');
6
+ require('../chunk-Q7TUNJD4.cjs');
7
7
 
8
8
 
9
9
 
10
10
 
11
- exports.coordinate = _chunkYALLOVNOcjs.coordinate; exports.validateLatitude = _chunkYALLOVNOcjs.validateLatitude; exports.validateLongitude = _chunkYALLOVNOcjs.validateLongitude;
11
+ exports.coordinate = _chunkFEL432I2cjs.coordinate; exports.validateLatitude = _chunkFEL432I2cjs.validateLatitude; exports.validateLongitude = _chunkFEL432I2cjs.validateLongitude;
@@ -2,8 +2,8 @@ import {
2
2
  coordinate,
3
3
  validateLatitude,
4
4
  validateLongitude
5
- } from "../chunk-MAQRXYE6.js";
6
- import "../chunk-ZBOQCXD4.js";
5
+ } from "../chunk-HQ4RAMSD.js";
6
+ import "../chunk-POIDES2L.js";
7
7
  export {
8
8
  coordinate,
9
9
  validateLatitude,
@@ -2,10 +2,10 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkCFFCBWYLcjs = require('../chunk-CFFCBWYL.cjs');
6
- require('../chunk-YWV2BBXN.cjs');
5
+ var _chunkZCX22PY4cjs = require('../chunk-ZCX22PY4.cjs');
6
+ require('../chunk-Q7TUNJD4.cjs');
7
7
 
8
8
 
9
9
 
10
10
 
11
- exports.creditCard = _chunkCFFCBWYLcjs.creditCard; exports.detectCardType = _chunkCFFCBWYLcjs.detectCardType; exports.validateCreditCard = _chunkCFFCBWYLcjs.validateCreditCard;
11
+ exports.creditCard = _chunkZCX22PY4cjs.creditCard; exports.detectCardType = _chunkZCX22PY4cjs.detectCardType; exports.validateCreditCard = _chunkZCX22PY4cjs.validateCreditCard;
@@ -2,8 +2,8 @@ import {
2
2
  creditCard,
3
3
  detectCardType,
4
4
  validateCreditCard
5
- } from "../chunk-NKCYXBGX.js";
6
- import "../chunk-ZBOQCXD4.js";
5
+ } from "../chunk-OKO6WO6M.js";
6
+ import "../chunk-POIDES2L.js";
7
7
  export {
8
8
  creditCard,
9
9
  detectCardType,
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkOP4KV3BYcjs = require('../chunk-OP4KV3BY.cjs');
4
- require('../chunk-YWV2BBXN.cjs');
3
+ var _chunk4AQB4RSUcjs = require('../chunk-4AQB4RSU.cjs');
4
+ require('../chunk-Q7TUNJD4.cjs');
5
5
 
6
6
 
7
- exports.date = _chunkOP4KV3BYcjs.date;
7
+ exports.date = _chunk4AQB4RSUcjs.date;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  date
3
- } from "../chunk-36NWHESN.js";
4
- import "../chunk-ZBOQCXD4.js";
3
+ } from "../chunk-RVGCMQ4J.js";
4
+ import "../chunk-POIDES2L.js";
5
5
  export {
6
6
  date
7
7
  };
@@ -4,12 +4,12 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkUFNVCUPQcjs = require('../chunk-UFNVCUPQ.cjs');
8
- require('../chunk-YWV2BBXN.cjs');
7
+ var _chunk53EEWALQcjs = require('../chunk-53EEWALQ.cjs');
8
+ require('../chunk-Q7TUNJD4.cjs');
9
9
 
10
10
 
11
11
 
12
12
 
13
13
 
14
14
 
15
- exports.DATETIME_PATTERNS = _chunkUFNVCUPQcjs.DATETIME_PATTERNS; exports.datetime = _chunkUFNVCUPQcjs.datetime; exports.normalizeDateTimeValue = _chunkUFNVCUPQcjs.normalizeDateTimeValue; exports.parseDateTimeValue = _chunkUFNVCUPQcjs.parseDateTimeValue; exports.validateDateTimeFormat = _chunkUFNVCUPQcjs.validateDateTimeFormat;
15
+ exports.DATETIME_PATTERNS = _chunk53EEWALQcjs.DATETIME_PATTERNS; exports.datetime = _chunk53EEWALQcjs.datetime; exports.normalizeDateTimeValue = _chunk53EEWALQcjs.normalizeDateTimeValue; exports.parseDateTimeValue = _chunk53EEWALQcjs.parseDateTimeValue; exports.validateDateTimeFormat = _chunk53EEWALQcjs.validateDateTimeFormat;
@@ -4,8 +4,8 @@ import {
4
4
  normalizeDateTimeValue,
5
5
  parseDateTimeValue,
6
6
  validateDateTimeFormat
7
- } from "../chunk-VCRKYMJM.js";
8
- import "../chunk-ZBOQCXD4.js";
7
+ } from "../chunk-RHKBT3M2.js";
8
+ import "../chunk-POIDES2L.js";
9
9
  export {
10
10
  DATETIME_PATTERNS,
11
11
  datetime,
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkLKPXHW5Ncjs = require('../chunk-LKPXHW5N.cjs');
4
- require('../chunk-YWV2BBXN.cjs');
3
+ var _chunkH25N5GP6cjs = require('../chunk-H25N5GP6.cjs');
4
+ require('../chunk-Q7TUNJD4.cjs');
5
5
 
6
6
 
7
- exports.email = _chunkLKPXHW5Ncjs.email;
7
+ exports.email = _chunkH25N5GP6cjs.email;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  email
3
- } from "../chunk-5OGW2ERW.js";
4
- import "../chunk-ZBOQCXD4.js";
3
+ } from "../chunk-XAN4CAVH.js";
4
+ import "../chunk-POIDES2L.js";
5
5
  export {
6
6
  email
7
7
  };
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk77KZUPPNcjs = require('../chunk-77KZUPPN.cjs');
4
- require('../chunk-YWV2BBXN.cjs');
3
+ var _chunkKIUO2HIRcjs = require('../chunk-KIUO2HIR.cjs');
4
+ require('../chunk-Q7TUNJD4.cjs');
5
5
 
6
6
 
7
- exports.file = _chunk77KZUPPNcjs.file;
7
+ exports.file = _chunkKIUO2HIRcjs.file;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  file
3
- } from "../chunk-LIQSVJLS.js";
4
- import "../chunk-ZBOQCXD4.js";
3
+ } from "../chunk-OGU7AIZF.js";
4
+ import "../chunk-POIDES2L.js";
5
5
  export {
6
6
  file
7
7
  };
@@ -3,11 +3,11 @@
3
3
 
4
4
 
5
5
 
6
- var _chunk5GAZQDVScjs = require('../chunk-5GAZQDVS.cjs');
7
- require('../chunk-YWV2BBXN.cjs');
6
+ var _chunkJZEF5Q3Wcjs = require('../chunk-JZEF5Q3W.cjs');
7
+ require('../chunk-Q7TUNJD4.cjs');
8
8
 
9
9
 
10
10
 
11
11
 
12
12
 
13
- exports.ID_PATTERNS = _chunk5GAZQDVScjs.ID_PATTERNS; exports.detectIdType = _chunk5GAZQDVScjs.detectIdType; exports.id = _chunk5GAZQDVScjs.id; exports.validateIdType = _chunk5GAZQDVScjs.validateIdType;
13
+ exports.ID_PATTERNS = _chunkJZEF5Q3Wcjs.ID_PATTERNS; exports.detectIdType = _chunkJZEF5Q3Wcjs.detectIdType; exports.id = _chunkJZEF5Q3Wcjs.id; exports.validateIdType = _chunkJZEF5Q3Wcjs.validateIdType;
@@ -21,6 +21,14 @@ import { L as Locale } from '../config-CABSSvAp.cjs';
21
21
  * @property {string} [maxLength] - Message when ID is too long
22
22
  * @property {string} [numeric] - Message when numeric ID format is invalid
23
23
  * @property {string} [uuid] - Message when UUID format is invalid
24
+ * @property {string} [uuidv1] - Message when UUID v1 format is invalid
25
+ * @property {string} [uuidv2] - Message when UUID v2 format is invalid
26
+ * @property {string} [uuidv3] - Message when UUID v3 format is invalid
27
+ * @property {string} [uuidv4] - Message when UUID v4 format is invalid
28
+ * @property {string} [uuidv5] - Message when UUID v5 format is invalid
29
+ * @property {string} [uuidv6] - Message when UUID v6 format is invalid
30
+ * @property {string} [uuidv7] - Message when UUID v7 format is invalid
31
+ * @property {string} [uuidv8] - Message when UUID v8 format is invalid
24
32
  * @property {string} [objectId] - Message when MongoDB ObjectId format is invalid
25
33
  * @property {string} [nanoid] - Message when Nano ID format is invalid
26
34
  * @property {string} [snowflake] - Message when Snowflake ID format is invalid
@@ -40,6 +48,14 @@ type IdMessages = {
40
48
  maxLength?: string;
41
49
  numeric?: string;
42
50
  uuid?: string;
51
+ uuidv1?: string;
52
+ uuidv2?: string;
53
+ uuidv3?: string;
54
+ uuidv4?: string;
55
+ uuidv5?: string;
56
+ uuidv6?: string;
57
+ uuidv7?: string;
58
+ uuidv8?: string;
43
59
  objectId?: string;
44
60
  nanoid?: string;
45
61
  snowflake?: string;
@@ -59,7 +75,15 @@ type IdMessages = {
59
75
  *
60
76
  * Available types:
61
77
  * - numeric: Pure numeric IDs (1, 123, 999999)
62
- * - uuid: UUID v4 format (xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx)
78
+ * - uuid: UUID any version (v1–v8)
79
+ * - uuidv1: UUID v1 (timestamp-based)
80
+ * - uuidv2: UUID v2 (DCE security)
81
+ * - uuidv3: UUID v3 (MD5 name-based)
82
+ * - uuidv4: UUID v4 (random)
83
+ * - uuidv5: UUID v5 (SHA-1 name-based)
84
+ * - uuidv6: UUID v6 (reordered timestamp, RFC 9562)
85
+ * - uuidv7: UUID v7 (Unix timestamp, sortable, RFC 9562)
86
+ * - uuidv8: UUID v8 (custom, RFC 9562)
63
87
  * - objectId: MongoDB ObjectId (24-character hexadecimal)
64
88
  * - nanoid: Nano ID format (21-character URL-safe)
65
89
  * - snowflake: Twitter Snowflake (19-digit number)
@@ -68,7 +92,7 @@ type IdMessages = {
68
92
  * - shortid: ShortId format (7-14 character URL-safe)
69
93
  * - auto: Auto-detect format from the value
70
94
  */
71
- type IdType = "numeric" | "uuid" | "objectId" | "nanoid" | "snowflake" | "cuid" | "ulid" | "shortid" | "auto";
95
+ type IdType = "numeric" | "uuid" | "uuidv1" | "uuidv2" | "uuidv3" | "uuidv4" | "uuidv5" | "uuidv6" | "uuidv7" | "uuidv8" | "objectId" | "nanoid" | "snowflake" | "cuid" | "ulid" | "shortid" | "auto";
72
96
  /**
73
97
  * Configuration options for ID validation
74
98
  *
@@ -117,15 +141,17 @@ type IdOptions<Type extends IdType | undefined = undefined> = {
117
141
  * - other types: ZodString or ZodNullable<ZodString>
118
142
  */
119
143
  type IdSchema<IsRequired extends boolean, Type extends IdType | undefined = undefined> = Type extends "numeric" ? IsRequired extends true ? ZodNumber : ZodNullable<ZodNumber> : IsRequired extends true ? ZodString : ZodNullable<ZodString>;
120
- /**
121
- * Regular expression patterns for different ID formats
122
- *
123
- * @constant {Record<string, RegExp>} ID_PATTERNS
124
- * @description Maps each ID type to its corresponding regex pattern
125
- */
126
144
  declare const ID_PATTERNS: {
127
145
  readonly numeric: RegExp;
128
146
  readonly uuid: RegExp;
147
+ readonly uuidv1: RegExp;
148
+ readonly uuidv2: RegExp;
149
+ readonly uuidv3: RegExp;
150
+ readonly uuidv4: RegExp;
151
+ readonly uuidv5: RegExp;
152
+ readonly uuidv6: RegExp;
153
+ readonly uuidv7: RegExp;
154
+ readonly uuidv8: RegExp;
129
155
  readonly objectId: RegExp;
130
156
  readonly nanoid: RegExp;
131
157
  readonly snowflake: RegExp;
@@ -21,6 +21,14 @@ import { L as Locale } from '../config-CABSSvAp.js';
21
21
  * @property {string} [maxLength] - Message when ID is too long
22
22
  * @property {string} [numeric] - Message when numeric ID format is invalid
23
23
  * @property {string} [uuid] - Message when UUID format is invalid
24
+ * @property {string} [uuidv1] - Message when UUID v1 format is invalid
25
+ * @property {string} [uuidv2] - Message when UUID v2 format is invalid
26
+ * @property {string} [uuidv3] - Message when UUID v3 format is invalid
27
+ * @property {string} [uuidv4] - Message when UUID v4 format is invalid
28
+ * @property {string} [uuidv5] - Message when UUID v5 format is invalid
29
+ * @property {string} [uuidv6] - Message when UUID v6 format is invalid
30
+ * @property {string} [uuidv7] - Message when UUID v7 format is invalid
31
+ * @property {string} [uuidv8] - Message when UUID v8 format is invalid
24
32
  * @property {string} [objectId] - Message when MongoDB ObjectId format is invalid
25
33
  * @property {string} [nanoid] - Message when Nano ID format is invalid
26
34
  * @property {string} [snowflake] - Message when Snowflake ID format is invalid
@@ -40,6 +48,14 @@ type IdMessages = {
40
48
  maxLength?: string;
41
49
  numeric?: string;
42
50
  uuid?: string;
51
+ uuidv1?: string;
52
+ uuidv2?: string;
53
+ uuidv3?: string;
54
+ uuidv4?: string;
55
+ uuidv5?: string;
56
+ uuidv6?: string;
57
+ uuidv7?: string;
58
+ uuidv8?: string;
43
59
  objectId?: string;
44
60
  nanoid?: string;
45
61
  snowflake?: string;
@@ -59,7 +75,15 @@ type IdMessages = {
59
75
  *
60
76
  * Available types:
61
77
  * - numeric: Pure numeric IDs (1, 123, 999999)
62
- * - uuid: UUID v4 format (xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx)
78
+ * - uuid: UUID any version (v1–v8)
79
+ * - uuidv1: UUID v1 (timestamp-based)
80
+ * - uuidv2: UUID v2 (DCE security)
81
+ * - uuidv3: UUID v3 (MD5 name-based)
82
+ * - uuidv4: UUID v4 (random)
83
+ * - uuidv5: UUID v5 (SHA-1 name-based)
84
+ * - uuidv6: UUID v6 (reordered timestamp, RFC 9562)
85
+ * - uuidv7: UUID v7 (Unix timestamp, sortable, RFC 9562)
86
+ * - uuidv8: UUID v8 (custom, RFC 9562)
63
87
  * - objectId: MongoDB ObjectId (24-character hexadecimal)
64
88
  * - nanoid: Nano ID format (21-character URL-safe)
65
89
  * - snowflake: Twitter Snowflake (19-digit number)
@@ -68,7 +92,7 @@ type IdMessages = {
68
92
  * - shortid: ShortId format (7-14 character URL-safe)
69
93
  * - auto: Auto-detect format from the value
70
94
  */
71
- type IdType = "numeric" | "uuid" | "objectId" | "nanoid" | "snowflake" | "cuid" | "ulid" | "shortid" | "auto";
95
+ type IdType = "numeric" | "uuid" | "uuidv1" | "uuidv2" | "uuidv3" | "uuidv4" | "uuidv5" | "uuidv6" | "uuidv7" | "uuidv8" | "objectId" | "nanoid" | "snowflake" | "cuid" | "ulid" | "shortid" | "auto";
72
96
  /**
73
97
  * Configuration options for ID validation
74
98
  *
@@ -117,15 +141,17 @@ type IdOptions<Type extends IdType | undefined = undefined> = {
117
141
  * - other types: ZodString or ZodNullable<ZodString>
118
142
  */
119
143
  type IdSchema<IsRequired extends boolean, Type extends IdType | undefined = undefined> = Type extends "numeric" ? IsRequired extends true ? ZodNumber : ZodNullable<ZodNumber> : IsRequired extends true ? ZodString : ZodNullable<ZodString>;
120
- /**
121
- * Regular expression patterns for different ID formats
122
- *
123
- * @constant {Record<string, RegExp>} ID_PATTERNS
124
- * @description Maps each ID type to its corresponding regex pattern
125
- */
126
144
  declare const ID_PATTERNS: {
127
145
  readonly numeric: RegExp;
128
146
  readonly uuid: RegExp;
147
+ readonly uuidv1: RegExp;
148
+ readonly uuidv2: RegExp;
149
+ readonly uuidv3: RegExp;
150
+ readonly uuidv4: RegExp;
151
+ readonly uuidv5: RegExp;
152
+ readonly uuidv6: RegExp;
153
+ readonly uuidv7: RegExp;
154
+ readonly uuidv8: RegExp;
129
155
  readonly objectId: RegExp;
130
156
  readonly nanoid: RegExp;
131
157
  readonly snowflake: RegExp;
package/dist/common/id.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  detectIdType,
4
4
  id,
5
5
  validateIdType
6
- } from "../chunk-FC6VDOC7.js";
7
- import "../chunk-ZBOQCXD4.js";
6
+ } from "../chunk-H6STFX4I.js";
7
+ import "../chunk-POIDES2L.js";
8
8
  export {
9
9
  ID_PATTERNS,
10
10
  detectIdType,
@@ -2,10 +2,10 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkWWRFBLCRcjs = require('../chunk-WWRFBLCR.cjs');
6
- require('../chunk-YWV2BBXN.cjs');
5
+ var _chunkLXFRQLH4cjs = require('../chunk-LXFRQLH4.cjs');
6
+ require('../chunk-Q7TUNJD4.cjs');
7
7
 
8
8
 
9
9
 
10
10
 
11
- exports.ip = _chunkWWRFBLCRcjs.ip; exports.validateIPv4 = _chunkWWRFBLCRcjs.validateIPv4; exports.validateIPv6 = _chunkWWRFBLCRcjs.validateIPv6;
11
+ exports.ip = _chunkLXFRQLH4cjs.ip; exports.validateIPv4 = _chunkLXFRQLH4cjs.validateIPv4; exports.validateIPv6 = _chunkLXFRQLH4cjs.validateIPv6;
package/dist/common/ip.js CHANGED
@@ -2,8 +2,8 @@ import {
2
2
  ip,
3
3
  validateIPv4,
4
4
  validateIPv6
5
- } from "../chunk-AWV2IT66.js";
6
- import "../chunk-ZBOQCXD4.js";
5
+ } from "../chunk-7SKH66CM.js";
6
+ import "../chunk-POIDES2L.js";
7
7
  export {
8
8
  ip,
9
9
  validateIPv4,
@@ -0,0 +1,7 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkBZWQPSHOcjs = require('../chunk-BZWQPSHO.cjs');
4
+ require('../chunk-Q7TUNJD4.cjs');
5
+
6
+
7
+ exports.manyOf = _chunkBZWQPSHOcjs.manyOf;
@@ -0,0 +1,111 @@
1
+ import { ZodType } from 'zod';
2
+ import { L as Locale } from '../config-CABSSvAp.cjs';
3
+
4
+ /**
5
+ * @fileoverview ManyOf validator for Zod Kit
6
+ *
7
+ * Provides multi-select validation that restricts input to an array of values
8
+ * from a predefined set, with min/max selection, duplicate control, and transformation.
9
+ *
10
+ * @author Ong Hoe Yuan
11
+ * @version 0.2.2
12
+ */
13
+
14
+ /**
15
+ * Type definition for manyOf validation error messages
16
+ *
17
+ * @interface ManyOfMessages
18
+ * @property {string} [required] - Message when field is required but empty
19
+ * @property {string} [invalid] - Message when a value is not in the allowed list
20
+ * @property {string} [minSelect] - Message when fewer than minimum items are selected
21
+ * @property {string} [maxSelect] - Message when more than maximum items are selected
22
+ * @property {string} [duplicate] - Message when duplicate values are found
23
+ */
24
+ type ManyOfMessages = {
25
+ required?: string;
26
+ invalid?: string;
27
+ minSelect?: string;
28
+ maxSelect?: string;
29
+ duplicate?: string;
30
+ };
31
+ /**
32
+ * Configuration options for manyOf validation
33
+ *
34
+ * @template IsRequired - Whether the field is required (affects return type)
35
+ * @template T - The type of allowed values
36
+ *
37
+ * @interface ManyOfOptions
38
+ * @property {T[]} values - Array of allowed values
39
+ * @property {T[] | null} [defaultValue] - Default value when input is empty
40
+ * @property {number} [min] - Minimum number of selections
41
+ * @property {number} [max] - Maximum number of selections
42
+ * @property {boolean} [allowDuplicates=false] - Whether to allow duplicate selections
43
+ * @property {boolean} [caseSensitive=true] - Whether string matching is case-sensitive
44
+ * @property {Function} [transform] - Custom transformation function applied to each value
45
+ * @property {Record<Locale, ManyOfMessages>} [i18n] - Custom error messages for different locales
46
+ */
47
+ type ManyOfOptions<IsRequired extends boolean = true, T extends string | number = string | number> = {
48
+ values: T[];
49
+ defaultValue?: IsRequired extends true ? T[] : T[] | null;
50
+ min?: number;
51
+ max?: number;
52
+ allowDuplicates?: boolean;
53
+ caseSensitive?: boolean;
54
+ transform?: (value: T[]) => T[];
55
+ i18n?: Partial<Record<Locale, Partial<ManyOfMessages>>>;
56
+ };
57
+ /**
58
+ * Type alias for manyOf validation schema based on required flag
59
+ *
60
+ * @template IsRequired - Whether the field is required
61
+ * @template T - The type of allowed values
62
+ */
63
+ type ManyOfSchema<IsRequired extends boolean, T> = IsRequired extends true ? ZodType<T[]> : ZodType<T[] | null>;
64
+ /**
65
+ * Creates a Zod schema for multi-select validation that restricts values to a predefined set
66
+ *
67
+ * @template IsRequired - Whether the field is required (affects return type)
68
+ * @template T - The type of allowed values (string | number)
69
+ * @param {IsRequired} [required=false] - Whether the field is required
70
+ * @param {ManyOfOptions<IsRequired, T>} options - Configuration options (values is required)
71
+ * @returns {ManyOfSchema<IsRequired, T>} Zod schema for manyOf validation
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * // Basic multi-select (optional by default)
76
+ * const tagsSchema = manyOf(false, { values: ["js", "ts", "rust", "go"] })
77
+ * tagsSchema.parse(["js", "ts"]) // ✓ ["js", "ts"]
78
+ * tagsSchema.parse(null) // ✓ null
79
+ *
80
+ * // Required with min/max
81
+ * const skillsSchema = manyOf(true, {
82
+ * values: ["react", "vue", "angular", "svelte"],
83
+ * min: 1,
84
+ * max: 3,
85
+ * })
86
+ * skillsSchema.parse(["react"]) // ✓
87
+ * skillsSchema.parse([]) // ✗ minSelect
88
+ * skillsSchema.parse(["react", "vue", "angular", "svelte"]) // ✗ maxSelect
89
+ *
90
+ * // Case-insensitive matching
91
+ * const colorsSchema = manyOf(true, {
92
+ * values: ["red", "green", "blue"],
93
+ * caseSensitive: false,
94
+ * })
95
+ * colorsSchema.parse(["RED", "Green"]) // ✓ ["red", "green"]
96
+ *
97
+ * // No duplicates (default)
98
+ * const rolesSchema = manyOf(true, { values: ["admin", "editor", "viewer"] })
99
+ * rolesSchema.parse(["admin", "admin"]) // ✗ duplicate
100
+ *
101
+ * // Allow duplicates
102
+ * const itemsSchema = manyOf(true, {
103
+ * values: [1, 2, 3],
104
+ * allowDuplicates: true,
105
+ * })
106
+ * itemsSchema.parse([1, 1, 2]) // ✓ [1, 1, 2]
107
+ * ```
108
+ */
109
+ declare function manyOf<IsRequired extends boolean = false, T extends string | number = string | number>(required?: IsRequired, options?: Omit<ManyOfOptions<IsRequired, T>, "required">): ManyOfSchema<IsRequired, T>;
110
+
111
+ export { type ManyOfMessages, type ManyOfOptions, type ManyOfSchema, manyOf };