@warlock.js/seal 5.24.0 → 5.26.0

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 (255) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE +21 -21
  3. package/cjs/index.cjs +10 -5
  4. package/cjs/index.cjs.map +1 -1
  5. package/cjs/{object-DPPttDAF.cjs → object-BuKApaax.cjs} +3 -3
  6. package/cjs/object-BuKApaax.cjs.map +1 -0
  7. package/cjs/object.cjs +2 -2
  8. package/cjs/{required-methods-DJTm7yNP.cjs → required-methods-BOVNRtci.cjs} +12 -2
  9. package/cjs/required-methods-BOVNRtci.cjs.map +1 -0
  10. package/cjs/{string-C_pAtZPC.cjs → string-DpDpgefH.cjs} +2 -2
  11. package/cjs/string-DpDpgefH.cjs.map +1 -0
  12. package/cjs/string.cjs +2 -2
  13. package/esm/config.d.mts +0 -1
  14. package/esm/config.d.mts.map +1 -1
  15. package/esm/config.mjs.map +1 -1
  16. package/esm/factory/validate.mjs.map +1 -1
  17. package/esm/factory/validators.d.mts.map +1 -1
  18. package/esm/factory/validators.mjs +1 -1
  19. package/esm/factory/validators.mjs.map +1 -1
  20. package/esm/helpers/date-helpers.mjs.map +1 -1
  21. package/esm/helpers/get-field-value.d.mts +0 -1
  22. package/esm/helpers/get-field-value.d.mts.map +1 -1
  23. package/esm/helpers/get-field-value.mjs.map +1 -1
  24. package/esm/helpers/index.d.mts +5 -0
  25. package/esm/helpers/path-helpers.mjs.map +1 -1
  26. package/esm/helpers/validation-helpers.d.mts +0 -1
  27. package/esm/helpers/validation-helpers.d.mts.map +1 -1
  28. package/esm/mutators/array-mutators.d.mts +0 -1
  29. package/esm/mutators/array-mutators.d.mts.map +1 -1
  30. package/esm/mutators/array-mutators.mjs.map +1 -1
  31. package/esm/mutators/boolean-mutators.d.mts +0 -1
  32. package/esm/mutators/boolean-mutators.d.mts.map +1 -1
  33. package/esm/mutators/date-mutators.d.mts +0 -1
  34. package/esm/mutators/date-mutators.d.mts.map +1 -1
  35. package/esm/mutators/date-mutators.mjs.map +1 -1
  36. package/esm/mutators/index.d.mts +7 -0
  37. package/esm/mutators/number-mutators.d.mts +0 -1
  38. package/esm/mutators/number-mutators.d.mts.map +1 -1
  39. package/esm/mutators/number-mutators.mjs.map +1 -1
  40. package/esm/mutators/object-mutators.d.mts +0 -1
  41. package/esm/mutators/object-mutators.d.mts.map +1 -1
  42. package/esm/mutators/object-mutators.mjs.map +1 -1
  43. package/esm/mutators/scalar-mutators.d.mts +0 -1
  44. package/esm/mutators/scalar-mutators.d.mts.map +1 -1
  45. package/esm/mutators/scalar-mutators.mjs.map +1 -1
  46. package/esm/mutators/string-mutators.d.mts +0 -1
  47. package/esm/mutators/string-mutators.d.mts.map +1 -1
  48. package/esm/mutators/string-mutators.mjs.map +1 -1
  49. package/esm/plugins/plugin-system.mjs.map +1 -1
  50. package/esm/rules/array/array-rules.d.mts +0 -1
  51. package/esm/rules/array/array-rules.d.mts.map +1 -1
  52. package/esm/rules/array/array-rules.mjs.map +1 -1
  53. package/esm/rules/array/index.d.mts +1 -0
  54. package/esm/rules/color/color-rules.d.mts +0 -1
  55. package/esm/rules/color/color-rules.d.mts.map +1 -1
  56. package/esm/rules/color/color-rules.mjs.map +1 -1
  57. package/esm/rules/color/index.d.mts +1 -0
  58. package/esm/rules/common/enum.d.mts +0 -1
  59. package/esm/rules/common/enum.d.mts.map +1 -1
  60. package/esm/rules/common/enum.mjs.map +1 -1
  61. package/esm/rules/common/equals-field-rules.d.mts +0 -1
  62. package/esm/rules/common/equals-field-rules.d.mts.map +1 -1
  63. package/esm/rules/common/equals-field-rules.mjs.map +1 -1
  64. package/esm/rules/common/index.d.mts +6 -0
  65. package/esm/rules/common/instanceof.d.mts +0 -1
  66. package/esm/rules/common/instanceof.d.mts.map +1 -1
  67. package/esm/rules/common/literal.d.mts +0 -1
  68. package/esm/rules/common/literal.d.mts.map +1 -1
  69. package/esm/rules/common/type-rules.d.mts +0 -1
  70. package/esm/rules/common/type-rules.d.mts.map +1 -1
  71. package/esm/rules/common/type-rules.mjs.map +1 -1
  72. package/esm/rules/common/unknown-key.d.mts +0 -1
  73. package/esm/rules/common/unknown-key.d.mts.map +1 -1
  74. package/esm/rules/conditional/forbidden-if-rules.d.mts +0 -1
  75. package/esm/rules/conditional/forbidden-if-rules.d.mts.map +1 -1
  76. package/esm/rules/conditional/forbidden-if-rules.mjs.map +1 -1
  77. package/esm/rules/conditional/index.d.mts +10 -0
  78. package/esm/rules/conditional/present-if-rules.d.mts +0 -1
  79. package/esm/rules/conditional/present-if-rules.d.mts.map +1 -1
  80. package/esm/rules/conditional/present-if-rules.mjs.map +1 -1
  81. package/esm/rules/conditional/present-unless-rules.d.mts +0 -1
  82. package/esm/rules/conditional/present-unless-rules.d.mts.map +1 -1
  83. package/esm/rules/conditional/present-unless-rules.mjs.map +1 -1
  84. package/esm/rules/conditional/present-with-rules.d.mts +0 -1
  85. package/esm/rules/conditional/present-with-rules.d.mts.map +1 -1
  86. package/esm/rules/conditional/present-with-rules.mjs.map +1 -1
  87. package/esm/rules/conditional/present-without-rules.d.mts +0 -1
  88. package/esm/rules/conditional/present-without-rules.d.mts.map +1 -1
  89. package/esm/rules/conditional/present-without-rules.mjs.map +1 -1
  90. package/esm/rules/conditional/required-if-rules.d.mts +0 -1
  91. package/esm/rules/conditional/required-if-rules.d.mts.map +1 -1
  92. package/esm/rules/conditional/required-if-rules.mjs.map +1 -1
  93. package/esm/rules/conditional/required-unless-rules.d.mts +0 -1
  94. package/esm/rules/conditional/required-unless-rules.d.mts.map +1 -1
  95. package/esm/rules/conditional/required-unless-rules.mjs.map +1 -1
  96. package/esm/rules/conditional/required-when-rule.d.mts +0 -1
  97. package/esm/rules/conditional/required-when-rule.d.mts.map +1 -1
  98. package/esm/rules/conditional/required-with-rules.d.mts +0 -1
  99. package/esm/rules/conditional/required-with-rules.d.mts.map +1 -1
  100. package/esm/rules/conditional/required-with-rules.mjs.map +1 -1
  101. package/esm/rules/conditional/required-without-rules.d.mts +0 -1
  102. package/esm/rules/conditional/required-without-rules.d.mts.map +1 -1
  103. package/esm/rules/conditional/required-without-rules.mjs.map +1 -1
  104. package/esm/rules/core/equal.d.mts +0 -1
  105. package/esm/rules/core/equal.d.mts.map +1 -1
  106. package/esm/rules/core/equal.mjs.map +1 -1
  107. package/esm/rules/core/forbidden.d.mts +0 -1
  108. package/esm/rules/core/forbidden.d.mts.map +1 -1
  109. package/esm/rules/core/forbidden.mjs.map +1 -1
  110. package/esm/rules/core/index.d.mts +5 -0
  111. package/esm/rules/core/required.d.mts +0 -1
  112. package/esm/rules/core/required.d.mts.map +1 -1
  113. package/esm/rules/core/required.mjs.map +1 -1
  114. package/esm/rules/core/union.d.mts.map +1 -1
  115. package/esm/rules/core/union.mjs.map +1 -1
  116. package/esm/rules/core/when.d.mts +0 -1
  117. package/esm/rules/core/when.d.mts.map +1 -1
  118. package/esm/rules/core/when.mjs.map +1 -1
  119. package/esm/rules/date/date-comparison-rules.d.mts +0 -1
  120. package/esm/rules/date/date-comparison-rules.d.mts.map +1 -1
  121. package/esm/rules/date/date-comparison-rules.mjs.map +1 -1
  122. package/esm/rules/date/date-day-rules.d.mts +0 -1
  123. package/esm/rules/date/date-day-rules.d.mts.map +1 -1
  124. package/esm/rules/date/date-day-rules.mjs.map +1 -1
  125. package/esm/rules/date/date-field-comparison-rules.d.mts +0 -1
  126. package/esm/rules/date/date-field-comparison-rules.d.mts.map +1 -1
  127. package/esm/rules/date/date-field-comparison-rules.mjs.map +1 -1
  128. package/esm/rules/date/date-period-rules.d.mts +0 -1
  129. package/esm/rules/date/date-period-rules.d.mts.map +1 -1
  130. package/esm/rules/date/date-period-rules.mjs.map +1 -1
  131. package/esm/rules/date/date-relative-rules.d.mts +0 -1
  132. package/esm/rules/date/date-relative-rules.d.mts.map +1 -1
  133. package/esm/rules/date/date-relative-rules.mjs.map +1 -1
  134. package/esm/rules/date/date-special-rules.d.mts +0 -1
  135. package/esm/rules/date/date-special-rules.d.mts.map +1 -1
  136. package/esm/rules/date/date-special-rules.mjs.map +1 -1
  137. package/esm/rules/date/date.d.mts +0 -1
  138. package/esm/rules/date/date.d.mts.map +1 -1
  139. package/esm/rules/date/date.mjs.map +1 -1
  140. package/esm/rules/date/index.d.mts +7 -0
  141. package/esm/rules/file/dimensions.d.mts +0 -1
  142. package/esm/rules/file/dimensions.d.mts.map +1 -1
  143. package/esm/rules/file/dimensions.mjs.map +1 -1
  144. package/esm/rules/file/file-size.d.mts +0 -1
  145. package/esm/rules/file/file-size.d.mts.map +1 -1
  146. package/esm/rules/file/file-size.mjs.map +1 -1
  147. package/esm/rules/file/index.d.mts +2 -0
  148. package/esm/rules/index.d.mts +45 -0
  149. package/esm/rules/length/index.d.mts +1 -0
  150. package/esm/rules/length/length-rules.d.mts +0 -1
  151. package/esm/rules/length/length-rules.d.mts.map +1 -1
  152. package/esm/rules/length/length-rules.mjs.map +1 -1
  153. package/esm/rules/number/index.d.mts +1 -0
  154. package/esm/rules/number/number-rules.d.mts +0 -1
  155. package/esm/rules/number/number-rules.d.mts.map +1 -1
  156. package/esm/rules/number/number-rules.mjs.map +1 -1
  157. package/esm/rules/scalar/accepted-rule.mjs.map +1 -1
  158. package/esm/rules/scalar/declined-rule.mjs.map +1 -1
  159. package/esm/rules/string/alpha.d.mts +0 -1
  160. package/esm/rules/string/alpha.d.mts.map +1 -1
  161. package/esm/rules/string/alpha.mjs.map +1 -1
  162. package/esm/rules/string/credit-card.d.mts +0 -1
  163. package/esm/rules/string/credit-card.d.mts.map +1 -1
  164. package/esm/rules/string/credit-card.mjs.map +1 -1
  165. package/esm/rules/string/email.d.mts +0 -1
  166. package/esm/rules/string/email.d.mts.map +1 -1
  167. package/esm/rules/string/email.mjs.map +1 -1
  168. package/esm/rules/string/id-formats.d.mts +0 -1
  169. package/esm/rules/string/id-formats.d.mts.map +1 -1
  170. package/esm/rules/string/index.d.mts +11 -0
  171. package/esm/rules/string/ip.d.mts +0 -1
  172. package/esm/rules/string/ip.d.mts.map +1 -1
  173. package/esm/rules/string/matches.d.mts +0 -1
  174. package/esm/rules/string/matches.d.mts.map +1 -1
  175. package/esm/rules/string/matches.mjs.map +1 -1
  176. package/esm/rules/string/pattern.d.mts +0 -1
  177. package/esm/rules/string/pattern.d.mts.map +1 -1
  178. package/esm/rules/string/pattern.mjs.map +1 -1
  179. package/esm/rules/string/string-comparison.d.mts +0 -1
  180. package/esm/rules/string/string-comparison.d.mts.map +1 -1
  181. package/esm/rules/string/string-comparison.mjs.map +1 -1
  182. package/esm/rules/string/strong-password-rule.d.mts +0 -1
  183. package/esm/rules/string/strong-password-rule.d.mts.map +1 -1
  184. package/esm/rules/string/strong-password-rule.mjs.map +1 -1
  185. package/esm/rules/string/url.d.mts +0 -1
  186. package/esm/rules/string/url.d.mts.map +1 -1
  187. package/esm/rules/string/url.mjs.map +1 -1
  188. package/esm/rules/string/without-whitespace.d.mts +0 -1
  189. package/esm/rules/string/without-whitespace.d.mts.map +1 -1
  190. package/esm/rules/string/without-whitespace.mjs.map +1 -1
  191. package/esm/standard-schema/index.d.mts +3 -0
  192. package/esm/standard-schema/map-result.d.mts +0 -1
  193. package/esm/standard-schema/map-result.d.mts.map +1 -1
  194. package/esm/types/date-types.mjs.map +1 -1
  195. package/esm/types/index.d.mts +10 -0
  196. package/esm/validators/any-validator.mjs.map +1 -1
  197. package/esm/validators/array-validator.d.mts.map +1 -1
  198. package/esm/validators/array-validator.mjs +1 -0
  199. package/esm/validators/array-validator.mjs.map +1 -1
  200. package/esm/validators/base-validator.d.mts +2 -1
  201. package/esm/validators/base-validator.d.mts.map +1 -1
  202. package/esm/validators/base-validator.mjs +11 -1
  203. package/esm/validators/base-validator.mjs.map +1 -1
  204. package/esm/validators/boolean-validator.d.mts.map +1 -1
  205. package/esm/validators/boolean-validator.mjs +1 -0
  206. package/esm/validators/boolean-validator.mjs.map +1 -1
  207. package/esm/validators/computed-validator.d.mts.map +1 -1
  208. package/esm/validators/date-validator.d.mts +0 -1
  209. package/esm/validators/date-validator.d.mts.map +1 -1
  210. package/esm/validators/date-validator.mjs +1 -0
  211. package/esm/validators/date-validator.mjs.map +1 -1
  212. package/esm/validators/discriminated-union-validator.d.mts.map +1 -1
  213. package/esm/validators/float-validator.mjs.map +1 -1
  214. package/esm/validators/int-validator.mjs.map +1 -1
  215. package/esm/validators/lazy-validator.d.mts.map +1 -1
  216. package/esm/validators/literal-validator.d.mts.map +1 -1
  217. package/esm/validators/literal-validator.mjs +1 -3
  218. package/esm/validators/literal-validator.mjs.map +1 -1
  219. package/esm/validators/managed-validator.d.mts.map +1 -1
  220. package/esm/validators/methods/equality-conditional-methods.d.mts +0 -1
  221. package/esm/validators/methods/equality-conditional-methods.d.mts.map +1 -1
  222. package/esm/validators/methods/equality-conditional-methods.mjs.map +1 -1
  223. package/esm/validators/methods/forbidden-methods.mjs.map +1 -1
  224. package/esm/validators/methods/present-methods.mjs.map +1 -1
  225. package/esm/validators/methods/required-methods.d.mts +0 -1
  226. package/esm/validators/methods/required-methods.d.mts.map +1 -1
  227. package/esm/validators/methods/required-methods.mjs.map +1 -1
  228. package/esm/validators/number-validator.d.mts.map +1 -1
  229. package/esm/validators/number-validator.mjs +1 -0
  230. package/esm/validators/number-validator.mjs.map +1 -1
  231. package/esm/validators/numeric-validator.mjs.map +1 -1
  232. package/esm/validators/object-validator.d.mts.map +1 -1
  233. package/esm/validators/object-validator.mjs +1 -1
  234. package/esm/validators/object-validator.mjs.map +1 -1
  235. package/esm/validators/record-validator.d.mts.map +1 -1
  236. package/esm/validators/record-validator.mjs.map +1 -1
  237. package/esm/validators/scalar-validator.d.mts.map +1 -1
  238. package/esm/validators/scalar-validator.mjs +1 -0
  239. package/esm/validators/scalar-validator.mjs.map +1 -1
  240. package/esm/validators/string-validator.mjs.map +1 -1
  241. package/esm/validators/tuple-validator.d.mts.map +1 -1
  242. package/esm/validators/tuple-validator.mjs.map +1 -1
  243. package/esm/validators/union-validator.mjs.map +1 -1
  244. package/llms-full.txt +1166 -1168
  245. package/llms.txt +1 -1
  246. package/package.json +1 -1
  247. package/skills/bridge-standard-schema/SKILL.md +138 -138
  248. package/skills/define-structural-shape/SKILL.md +138 -138
  249. package/skills/extend-seal-with-plugins/SKILL.md +178 -178
  250. package/skills/generate-json-schema/SKILL.md +143 -143
  251. package/skills/handle-seal-errors/SKILL.md +148 -148
  252. package/skills/pick-seal-primitive/SKILL.md +149 -149
  253. package/cjs/object-DPPttDAF.cjs.map +0 -1
  254. package/cjs/required-methods-DJTm7yNP.cjs.map +0 -1
  255. package/cjs/string-C_pAtZPC.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"accepted-rule.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/scalar/accepted-rule.ts"],"sourcesContent":["import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * The full set of values treated as \"accepted\" by `acceptedRule` and its\r\n * conditional variants. Shared with `formBooleanMutator` (see\r\n * `../../mutators/boolean-mutators`) so `v.boolean().accepted()` recognizes\r\n * exactly this list — single source of truth, no duplicated literals.\r\n */\r\nexport const ACCEPTED_VALUES: readonly unknown[] = [\r\n \"1\",\r\n \"true\",\r\n \"yes\",\r\n \"y\",\r\n \"on\",\r\n 1,\r\n true,\r\n \"Yes\",\r\n \"Y\",\r\n \"On\",\r\n];\r\n\r\nconst isAcceptedValue = (value: any) => {\r\n return ACCEPTED_VALUES.includes(value);\r\n};\r\n\r\n/**\r\n * Validate value as accepted if it equals:\r\n * 1 | \"1\" | true | \"true\" | \"yes\" | \"y\" | \"on\"\r\n */\r\nexport const acceptedRule: SchemaRule = {\r\n name: \"accepted\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n description:\r\n \"The value must be accepted if it equals: 1 | '1' | true | 'true' | 'yes' | 'y' | 'on' | 1 | true | 'Yes' | 'Y' | 'On'\",\r\n async validate(value: any, context) {\r\n if (isAcceptedValue(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Accepted value if another field's value equals to a specific value\r\n */\r\nexport const acceptedIfRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"acceptedIf\",\r\n description: \"The field must be accepted if :field's value equals to :value\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n if (fieldValue !== expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is not equal to the given value\r\n */\r\nexport const acceptedUnlessRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"acceptedUnless\",\r\n description: \"The field must be accepted if :field's value is not equal to :value\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n if (fieldValue === expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is required\r\n */\r\nexport const acceptedIfRequiredRule: SchemaRule<{ field: string }> = {\r\n name: \"acceptedIfRequired\",\r\n description: \"The field must be accepted if :field is required\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is present\r\n */\r\nexport const acceptedIfPresentRule: SchemaRule<{ field: string }> = {\r\n name: \"acceptedIfPresent\",\r\n description: \"The field must be accepted if :field is present\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue === undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is missing\r\n */\r\nexport const acceptedWithoutRule: SchemaRule<{ field: string }> = {\r\n name: \"acceptedWithout\",\r\n description: \"The field must be accepted if :field is missing\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue !== undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n"],"mappings":";;;;;;;;;;;;AAUA,MAAa,kBAAsC;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,mBAAmB,UAAe;CACtC,OAAO,gBAAgB,SAAS,KAAK;AACvC;;;;;AAMA,MAAa,eAA2B;CACtC,MAAM;CACN,qBAAqB;CACrB,aACE;CACF,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,gBAAgB,KAAK,GACvB,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,iBAA4D;CACvE,MAAM;CACN,aAAa;C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AAc,MAAM,OAAO;EAC9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,eAAe,QACjB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,sBAAqD;CAChE,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,eAAe,QACjB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"accepted-rule.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/scalar/accepted-rule.ts"],"sourcesContent":["import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * The full set of values treated as \"accepted\" by `acceptedRule` and its\n * conditional variants. Shared with `formBooleanMutator` (see\n * `../../mutators/boolean-mutators`) so `v.boolean().accepted()` recognizes\n * exactly this list — single source of truth, no duplicated literals.\n */\nexport const ACCEPTED_VALUES: readonly unknown[] = [\n \"1\",\n \"true\",\n \"yes\",\n \"y\",\n \"on\",\n 1,\n true,\n \"Yes\",\n \"Y\",\n \"On\",\n];\n\nconst isAcceptedValue = (value: any) => {\n return ACCEPTED_VALUES.includes(value);\n};\n\n/**\n * Validate value as accepted if it equals:\n * 1 | \"1\" | true | \"true\" | \"yes\" | \"y\" | \"on\"\n */\nexport const acceptedRule: SchemaRule = {\n name: \"accepted\",\n defaultErrorMessage: \"The :input must be accepted\",\n description:\n \"The value must be accepted if it equals: 1 | '1' | true | 'true' | 'yes' | 'y' | 'on' | 1 | true | 'Yes' | 'Y' | 'On'\",\n async validate(value: any, context) {\n if (isAcceptedValue(value)) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Accepted value if another field's value equals to a specific value\n */\nexport const acceptedIfRule: SchemaRule<{ field: string; value: any }> = {\n name: \"acceptedIf\",\n description: \"The field must be accepted if :field's value equals to :value\",\n defaultErrorMessage: \"The :input must be accepted\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n const { value: expectedValue } = this.context.options;\n\n this.context.translatableParams.field = this.context.options.field;\n this.context.translatableParams.value = this.context.options.value;\n if (fieldValue !== expectedValue) {\n return invalidRule(this, context);\n }\n\n if (!isAcceptedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Accepted if another field is not equal to the given value\n */\nexport const acceptedUnlessRule: SchemaRule<{ field: string; value: any }> = {\n name: \"acceptedUnless\",\n description: \"The field must be accepted if :field's value is not equal to :value\",\n defaultErrorMessage: \"The :input must be accepted\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n const { value: expectedValue } = this.context.options;\n\n this.context.translatableParams.field = this.context.options.field;\n this.context.translatableParams.value = this.context.options.value;\n\n if (fieldValue === expectedValue) {\n return invalidRule(this, context);\n }\n\n if (!isAcceptedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Accepted if another field is required\n */\nexport const acceptedIfRequiredRule: SchemaRule<{ field: string }> = {\n name: \"acceptedIfRequired\",\n description: \"The field must be accepted if :field is required\",\n defaultErrorMessage: \"The :input must be accepted\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n this.context.translatableParams.field = this.context.options.field;\n\n if (isEmptyValue(fieldValue)) {\n return invalidRule(this, context);\n }\n\n if (!isAcceptedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Accepted if another field is present\n */\nexport const acceptedIfPresentRule: SchemaRule<{ field: string }> = {\n name: \"acceptedIfPresent\",\n description: \"The field must be accepted if :field is present\",\n defaultErrorMessage: \"The :input must be accepted\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n this.context.translatableParams.field = this.context.options.field;\n\n if (fieldValue === undefined) {\n return invalidRule(this, context);\n }\n\n if (!isAcceptedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Accepted if another field is missing\n */\nexport const acceptedWithoutRule: SchemaRule<{ field: string }> = {\n name: \"acceptedWithout\",\n description: \"The field must be accepted if :field is missing\",\n defaultErrorMessage: \"The :input must be accepted\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n this.context.translatableParams.field = this.context.options.field;\n\n if (fieldValue !== undefined) {\n return invalidRule(this, context);\n }\n\n if (!isAcceptedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;;;;;AAUA,MAAa,kBAAsC;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,mBAAmB,UAAe;CACtC,OAAO,gBAAgB,SAAS,KAAK;AACvC;;;;;AAMA,MAAa,eAA2B;CACtC,MAAM;CACN,qBAAqB;CACrB,aACE;CACF,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,gBAAgB,KAAK,GACvB,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,iBAA4D;CACvE,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,MAAM,EAAE,OAAO,kBAAkB,KAAK,QAAQ;EAE9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAC7D,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAC7D,IAAI,eAAe,eACjB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BAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,eAAe,QACjB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"declined-rule.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/scalar/declined-rule.ts"],"sourcesContent":["import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * The full set of values treated as \"declined\" by `declinedRule` and its\r\n * conditional variants. Shared with `formBooleanMutator` (see\r\n * `../../mutators/boolean-mutators`) so `v.boolean().declined()` recognizes\r\n * exactly this list — single source of truth, no duplicated literals.\r\n */\r\nexport const DECLINED_VALUES: readonly unknown[] = [\r\n \"0\",\r\n \"false\",\r\n \"no\",\r\n \"n\",\r\n \"off\",\r\n 0,\r\n false,\r\n \"No\",\r\n \"N\",\r\n \"Off\",\r\n];\r\n\r\nconst isDeclinedValue = (value: any) => {\r\n return DECLINED_VALUES.includes(value);\r\n};\r\n\r\n/**\r\n * Validate value as declined if it equals:\r\n * 0 | \"0\" | false | \"false\" | \"no\" | \"n\" | \"off\" | 0 | false | \"No\" | \"N\" | \"Off\"\r\n */\r\nexport const declinedRule: SchemaRule = {\r\n name: \"declined\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n description:\r\n \"The value must be declined if it equals: 0 | '0' | false | 'false' | 'no' | 'n' | 'off' | 0 | false | 'No' | 'N' | 'Off'\",\r\n async validate(value: any, context) {\r\n if (isDeclinedValue(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Declined value if another field's value equals to a specific value\r\n */\r\nexport const declinedIfRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"declinedIf\",\r\n description: \"The field must be declined if :field's value equals to :value\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n if (fieldValue !== expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is not equal to the given value\r\n */\r\nexport const declinedUnlessRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"declinedUnless\",\r\n description: \"The field must be declined if :field's value is not equal to :value\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n if (fieldValue === expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is required\r\n */\r\nexport const declinedIfRequiredRule: SchemaRule<{ field: string }> = {\r\n name: \"declinedIfRequired\",\r\n description: \"The field must be declined if :field is required\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is present\r\n */\r\nexport const declinedIfPresentRule: SchemaRule<{ field: string }> = {\r\n name: \"declinedIfPresent\",\r\n description: \"The field must be declined if :field is present\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue === undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is missing\r\n */\r\nexport const declinedWithoutRule: SchemaRule<{ field: string }> = {\r\n name: \"declinedWithout\",\r\n description: \"The field must be declined if :field is missing\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue !== undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n"],"mappings":";;;;;;;;;;;;AAUA,MAAa,kBAAsC;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,mBAAmB,UAAe;CACtC,OAAO,gBAAgB,SAAS,KAAK;AACvC;;;;;AAMA,MAAa,eAA2B;CACtC,MAAM;CACN,qBAAqB;CACrB,aACE;CACF,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,gBAAgB,KAAK,GACvB,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,iBAA4D;CACvE,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,MAAM,EAAE,OAAO,kBAAkB,KAAK,QAAQ;EAE9C,KAAK,QAA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gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,sBAAqD;CAChE,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,eAAe,QACjB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"declined-rule.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/scalar/declined-rule.ts"],"sourcesContent":["import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * The full set of values treated as \"declined\" by `declinedRule` and its\n * conditional variants. Shared with `formBooleanMutator` (see\n * `../../mutators/boolean-mutators`) so `v.boolean().declined()` recognizes\n * exactly this list — single source of truth, no duplicated literals.\n */\nexport const DECLINED_VALUES: readonly unknown[] = [\n \"0\",\n \"false\",\n \"no\",\n \"n\",\n \"off\",\n 0,\n false,\n \"No\",\n \"N\",\n \"Off\",\n];\n\nconst isDeclinedValue = (value: any) => {\n return DECLINED_VALUES.includes(value);\n};\n\n/**\n * Validate value as declined if it equals:\n * 0 | \"0\" | false | \"false\" | \"no\" | \"n\" | \"off\" | 0 | false | \"No\" | \"N\" | \"Off\"\n */\nexport const declinedRule: SchemaRule = {\n name: \"declined\",\n defaultErrorMessage: \"The :input must be declined\",\n description:\n \"The value must be declined if it equals: 0 | '0' | false | 'false' | 'no' | 'n' | 'off' | 0 | false | 'No' | 'N' | 'Off'\",\n async validate(value: any, context) {\n if (isDeclinedValue(value)) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Declined value if another field's value equals to a specific value\n */\nexport const declinedIfRule: SchemaRule<{ field: string; value: any }> = {\n name: \"declinedIf\",\n description: \"The field must be declined if :field's value equals to :value\",\n defaultErrorMessage: \"The :input must be declined\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n const { value: expectedValue } = this.context.options;\n\n this.context.translatableParams.field = this.context.options.field;\n this.context.translatableParams.value = this.context.options.value;\n\n if (fieldValue !== expectedValue) {\n return invalidRule(this, context);\n }\n\n if (!isDeclinedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Declined if another field is not equal to the given value\n */\nexport const declinedUnlessRule: SchemaRule<{ field: string; value: any }> = {\n name: \"declinedUnless\",\n description: \"The field must be declined if :field's value is not equal to :value\",\n defaultErrorMessage: \"The :input must be declined\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n const { value: expectedValue } = this.context.options;\n\n this.context.translatableParams.field = this.context.options.field;\n this.context.translatableParams.value = this.context.options.value;\n if (fieldValue === expectedValue) {\n return invalidRule(this, context);\n }\n\n if (!isDeclinedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Declined if another field is required\n */\nexport const declinedIfRequiredRule: SchemaRule<{ field: string }> = {\n name: \"declinedIfRequired\",\n description: \"The field must be declined if :field is required\",\n defaultErrorMessage: \"The :input must be declined\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n this.context.translatableParams.field = this.context.options.field;\n\n if (isEmptyValue(fieldValue)) {\n return invalidRule(this, context);\n }\n\n if (!isDeclinedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Declined if another field is present\n */\nexport const declinedIfPresentRule: SchemaRule<{ field: string }> = {\n name: \"declinedIfPresent\",\n description: \"The field must be declined if :field is present\",\n defaultErrorMessage: \"The :input must be declined\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n this.context.translatableParams.field = this.context.options.field;\n\n if (fieldValue === undefined) {\n return invalidRule(this, context);\n }\n\n if (!isDeclinedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Declined if another field is missing\n */\nexport const declinedWithoutRule: SchemaRule<{ field: string }> = {\n name: \"declinedWithout\",\n description: \"The field must be declined if :field is missing\",\n defaultErrorMessage: \"The :input must be declined\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n this.context.translatableParams.field = this.context.options.field;\n\n if (fieldValue !== undefined) {\n return invalidRule(this, context);\n }\n\n if (!isDeclinedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;;;;;AAUA,MAAa,kBAAsC;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,mBAAmB,UAAe;CACtC,OAAO,gBAAgB,SAAS,KAAK;AACvC;;;;;AAMA,MAAa,eAA2B;CACtC,MAAM;CACN,qBAAqB;CACrB,aACE;CACF,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,gBAAgB,KAAK,GACvB,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,iBAA4D;CACvE,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,MAAM,EAAE,OAAO,kBAAkB,KAAK,QAAQ;EAE9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAC7D,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,eAAe,eACjB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,qBAAgE;CAC3E,MAAM;CACN,aAAa;CACb,qB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MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
@@ -1,5 +1,4 @@
1
1
  import { SchemaRule } from "../../types/rule-types.mjs";
2
-
3
2
  //#region ../seal/src/rules/string/alpha.d.ts
4
3
  /**
5
4
  * Alpha rule - allows only alphabetic characters
@@ -1 +1 @@
1
- {"version":3,"file":"alpha.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/string/alpha.ts"],"mappings":";;;;;AAMA;cAAa,SAAA,EAAW,UASvB;;;AAAA;cAKY,gBAAA,EAAkB,UAS9B;;;;cAKY,aAAA,EAAe,UAS3B"}
1
+ {"version":3,"file":"alpha.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/string/alpha.ts"],"mappings":";;;;;cAMa,SAAA,EAAW,UASvB;;;;cAKY,gBAAA,EAAkB,UAS9B;AATD;;;AAAA,cAca,aAAA,EAAe,UAS3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"alpha.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/alpha.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Alpha rule - allows only alphabetic characters\r\n */\r\nexport const alphaRule: SchemaRule = {\r\n name: \"alpha\",\r\n defaultErrorMessage: \"The :input must contain only alphabetic characters\",\r\n async validate(value: any, context) {\r\n if (/^[a-zA-Z]+$/.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * AlphaNumeric rule - allows only alphanumeric characters\r\n */\r\nexport const alphaNumericRule: SchemaRule = {\r\n name: \"alphaNumeric\",\r\n defaultErrorMessage: \"The :input must contain only alphanumeric characters\",\r\n async validate(value: any, context) {\r\n if (/^[a-zA-Z0-9]+$/.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Numeric string rule - allows only numeric characters\r\n */\r\nexport const isNumericRule: SchemaRule = {\r\n name: \"numeric\",\r\n defaultErrorMessage: \"The :input must contain only numeric characters\",\r\n async validate(value: any, context) {\r\n if (/^[0-9]+$/.test(String(value))) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAMA,MAAa,YAAwB;CACnC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,cAAc,KAAK,KAAK,GAC1B,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,mBAA+B;CAC1C,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,iBAAiB,KAAK,KAAK,GAC7B,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,gBAA4B;CACvC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,WAAW,KAAK,OAAO,KAAK,CAAC,GAC/B,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
1
+ {"version":3,"file":"alpha.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/alpha.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Alpha rule - allows only alphabetic characters\n */\nexport const alphaRule: SchemaRule = {\n name: \"alpha\",\n defaultErrorMessage: \"The :input must contain only alphabetic characters\",\n async validate(value: any, context) {\n if (/^[a-zA-Z]+$/.test(value)) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * AlphaNumeric rule - allows only alphanumeric characters\n */\nexport const alphaNumericRule: SchemaRule = {\n name: \"alphaNumeric\",\n defaultErrorMessage: \"The :input must contain only alphanumeric characters\",\n async validate(value: any, context) {\n if (/^[a-zA-Z0-9]+$/.test(value)) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * Numeric string rule - allows only numeric characters\n */\nexport const isNumericRule: SchemaRule = {\n name: \"numeric\",\n defaultErrorMessage: \"The :input must contain only numeric characters\",\n async validate(value: any, context) {\n if (/^[0-9]+$/.test(String(value))) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;AAMA,MAAa,YAAwB;CACnC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,cAAc,KAAK,KAAK,GAC1B,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,mBAA+B;CAC1C,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,iBAAiB,KAAK,KAAK,GAC7B,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,gBAA4B;CACvC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,WAAW,KAAK,OAAO,KAAK,CAAC,GAC/B,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
@@ -1,5 +1,4 @@
1
1
  import { SchemaRule } from "../../types/rule-types.mjs";
2
-
3
2
  //#region ../seal/src/rules/string/credit-card.d.ts
4
3
  /**
5
4
  * Credit card rule - validates credit card number
@@ -1 +1 @@
1
- {"version":3,"file":"credit-card.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/string/credit-card.ts"],"mappings":";;;;;AAMA;cAAa,gBAAA,EAAkB,UAkC9B"}
1
+ {"version":3,"file":"credit-card.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/string/credit-card.ts"],"mappings":";;;;;cAMa,gBAAA,EAAkB,UAkC9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"credit-card.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/credit-card.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Credit card rule - validates credit card number\r\n */\r\nexport const isCreditCardRule: SchemaRule = {\r\n name: \"creditCard\",\r\n defaultErrorMessage: \"The :input must be a valid credit card number\",\r\n async validate(value: any, context) {\r\n // Luhn algorithm for credit card validation\r\n const cardNumber = String(value).replace(/\\s/g, \"\");\r\n\r\n if (!/^\\d+$/.test(cardNumber)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n let sum = 0;\r\n let isEven = false;\r\n\r\n for (let i = cardNumber.length - 1; i >= 0; i--) {\r\n let digit = parseInt(cardNumber.charAt(i), 10);\n\r\n if (isEven) {\r\n digit *= 2;\r\n if (digit > 9) {\r\n digit -= 9;\r\n }\r\n }\r\n\r\n sum += digit;\r\n isEven = !isEven;\r\n }\r\n\r\n if (sum % 10 === 0) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAMA,MAAa,mBAA+B;CAC1C,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAElC,MAAM,aAAa,OAAO,KAAK,CAAC,CAAC,QAAQ,OAAO,EAAE;EAElD,IAAI,CAAC,QAAQ,KAAK,UAAU,GAC1B,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,MAAM;EACV,IAAI,SAAS;EAEb,KAAK,IAAI,IAAI,WAAW,SAAS,GAAG,KAAK,GAAG,KAAK;GAC/C,IAAI,QAAQ,SAAS,WAAW,OAAO,CAAC,GAAG,EAAE;GAE7C,IAAI,QAAQ;IACV,SAAS;IACT,IAAI,QAAQ,GACV,SAAS;GAEb;GAEA,OAAO;GACP,SAAS,CAAC;EACZ;EAEA,IAAI,MAAM,OAAO,GACf,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
1
+ {"version":3,"file":"credit-card.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/credit-card.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Credit card rule - validates credit card number\n */\nexport const isCreditCardRule: SchemaRule = {\n name: \"creditCard\",\n defaultErrorMessage: \"The :input must be a valid credit card number\",\n async validate(value: any, context) {\n // Luhn algorithm for credit card validation\n const cardNumber = String(value).replace(/\\s/g, \"\");\n\n if (!/^\\d+$/.test(cardNumber)) {\n return invalidRule(this, context);\n }\n\n let sum = 0;\n let isEven = false;\n\n for (let i = cardNumber.length - 1; i >= 0; i--) {\n let digit = parseInt(cardNumber.charAt(i), 10);\n\n if (isEven) {\n digit *= 2;\n if (digit > 9) {\n digit -= 9;\n }\n }\n\n sum += digit;\n isEven = !isEven;\n }\n\n if (sum % 10 === 0) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;AAMA,MAAa,mBAA+B;CAC1C,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAElC,MAAM,aAAa,OAAO,KAAK,CAAC,CAAC,QAAQ,OAAO,EAAE;EAElD,IAAI,CAAC,QAAQ,KAAK,UAAU,GAC1B,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,MAAM;EACV,IAAI,SAAS;EAEb,KAAK,IAAI,IAAI,WAAW,SAAS,GAAG,KAAK,GAAG,KAAK;GAC/C,IAAI,QAAQ,SAAS,WAAW,OAAO,CAAC,GAAG,EAAE;GAE7C,IAAI,QAAQ;IACV,SAAS;IACT,IAAI,QAAQ,GACV,SAAS;GAEb;GAEA,OAAO;GACP,SAAS,CAAC;EACZ;EAEA,IAAI,MAAM,OAAO,GACf,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
@@ -1,5 +1,4 @@
1
1
  import { SchemaRule } from "../../types/rule-types.mjs";
2
-
3
2
  //#region ../seal/src/rules/string/email.d.ts
4
3
  /**
5
4
  * Email rule - validates email format
@@ -1 +1 @@
1
- {"version":3,"file":"email.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/string/email.ts"],"mappings":";;;;;AAOA;cAAa,SAAA,EAAW,UASvB"}
1
+ {"version":3,"file":"email.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/string/email.ts"],"mappings":";;;;;cAOa,SAAA,EAAW,UASvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"email.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/email.ts"],"sourcesContent":["import { isEmail } from \"@mongez/supportive-is\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Email rule - validates email format\r\n */\r\nexport const emailRule: SchemaRule = {\r\n name: \"email\",\r\n defaultErrorMessage: \"The :input must be a valid email address\",\r\n async validate(value: any, context) {\r\n if (isEmail(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;;AAOA,MAAa,YAAwB;CACnC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,QAAQ,KAAK,GACf,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
1
+ {"version":3,"file":"email.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/email.ts"],"sourcesContent":["import { isEmail } from \"@mongez/supportive-is\";\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Email rule - validates email format\n */\nexport const emailRule: SchemaRule = {\n name: \"email\",\n defaultErrorMessage: \"The :input must be a valid email address\",\n async validate(value: any, context) {\n if (isEmail(value)) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;;AAOA,MAAa,YAAwB;CACnC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,QAAQ,KAAK,GACf,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
@@ -1,5 +1,4 @@
1
1
  import { SchemaRule } from "../../types/rule-types.mjs";
2
-
3
2
  //#region ../seal/src/rules/string/id-formats.d.ts
4
3
  type UUIDVersion = 1 | 3 | 4 | 5 | 6 | 7;
5
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"id-formats.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/string/id-formats.ts"],"mappings":";;;KAuBY,WAAA;;AAAZ;;;;AAAuB;AAUvB;;cAAa,QAAA,EAAU,UAAU;EAAG,OAAA,GAAU,WAAA;AAAA;;;;AAAW;AA8BzD;;;;AAA2C;AAqB3C;;cArBa,QAAA,EAAU,UAAU;EAAG,OAAO;AAAA;AAyC3C;;;;AAA4C;;;;AAA5C,cApBa,QAAA,EAAU,UAQtB;;;;;;;;;;;cAYY,UAAA,EAAY,UAAU;EAAG,MAAM;AAAA"}
1
+ {"version":3,"file":"id-formats.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/string/id-formats.ts"],"mappings":";;KAuBY,WAAA;;;AAAZ;;;;AAAuB;AAUvB;cAAa,QAAA,EAAU,UAAU;EAAG,OAAA,GAAU,WAAA;AAAA;;;;;AAAW;AA8BzD;;;;AAA2C;AAqB3C;cArBa,QAAA,EAAU,UAAU;EAAG,OAAO;AAAA;AA6B1C;AAYD;;;;AAA4C;;;AAZ3C,cARY,QAAA,EAAU,UAQtB;;;;;;;;;;;cAYY,UAAA,EAAY,UAAU;EAAG,MAAM;AAAA"}
@@ -0,0 +1,11 @@
1
+ import { alphaNumericRule, alphaRule, isNumericRule } from "./alpha.mjs";
2
+ import { isCreditCardRule } from "./credit-card.mjs";
3
+ import { emailRule } from "./email.mjs";
4
+ import { UUIDVersion, cuidRule, nanoidRule, ulidRule, uuidRule } from "./id-formats.mjs";
5
+ import { ip4Rule, ip6Rule, ipRule, isIP, isIPv4, isIPv6 } from "./ip.mjs";
6
+ import { matchesRule } from "./matches.mjs";
7
+ import { patternRule } from "./pattern.mjs";
8
+ import { containsRule, endsWithRule, notContainsRule, startsWithRule } from "./string-comparison.mjs";
9
+ import { strongPasswordRule } from "./strong-password-rule.mjs";
10
+ import { urlRule } from "./url.mjs";
11
+ import { withoutWhitespaceRule } from "./without-whitespace.mjs";
@@ -1,5 +1,4 @@
1
1
  import { SchemaRule } from "../../types/rule-types.mjs";
2
-
3
2
  //#region ../seal/src/rules/string/ip.d.ts
4
3
  declare function isIPv4(value: string): boolean;
5
4
  declare function isIPv6(value: string): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"ip.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/string/ip.ts"],"mappings":";;;iBA0BgB,MAAA,CAAO,KAAa;AAAA,iBAIpB,MAAA,CAAO,KAAa;AAJpC;;;;AAAA,iBAYgB,IAAA,CAAK,KAAa;AARlC;;;AAAA,cAiBa,MAAA,EAAQ,UASpB;AA1BmC;AAQpC;;AARoC,cA+BvB,OAAA,EAAS,UASrB;;AAhCiC;AASlC;cA4Ba,OAAA,EAAS,UASrB"}
1
+ {"version":3,"file":"ip.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/string/ip.ts"],"mappings":";;iBA0BgB,MAAA,CAAO,KAAa;AAAA,iBAIpB,MAAA,CAAO,KAAa;;AAJpC;;;iBAYgB,IAAA,CAAK,KAAa;AAZE;AAIpC;;AAJoC,cAqBvB,MAAA,EAAQ,UASpB;;AA1BmC;AAQpC;cAuBa,OAAA,EAAS,UASrB;;;AAhCiC;cAqCrB,OAAA,EAAS,UASrB"}
@@ -1,5 +1,4 @@
1
1
  import { SchemaRule } from "../../types/rule-types.mjs";
2
-
3
2
  //#region ../seal/src/rules/string/matches.d.ts
4
3
  /**
5
4
  * Matches rule - value must match another field value
@@ -1 +1 @@
1
- {"version":3,"file":"matches.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/string/matches.ts"],"mappings":";;;;;AAOA;cAAa,WAAA,EAAa,UAAU;EAAG,KAAK;AAAA"}
1
+ {"version":3,"file":"matches.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/string/matches.ts"],"mappings":";;;;;cAOa,WAAA,EAAa,UAAU;EAAG,KAAK;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"matches.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/matches.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Matches rule - value must match another field value\r\n */\r\nexport const matchesRule: SchemaRule<{ field: string }> = {\r\n name: \"matches\",\r\n defaultErrorMessage: \"The :input must match :field\",\r\n async validate(value: any, context) {\r\n const otherFieldValue = get(context.allValues, this.context.options.field);\r\n\r\n if (value === otherFieldValue) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;;AAOA,MAAa,cAA6C;CACxD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAGlC,IAAI,UAFoB,IAAI,QAAQ,WAAW,KAAK,QAAQ,QAAQ,KAExC,GAC1B,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
1
+ {"version":3,"file":"matches.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/matches.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Matches rule - value must match another field value\n */\nexport const matchesRule: SchemaRule<{ field: string }> = {\n name: \"matches\",\n defaultErrorMessage: \"The :input must match :field\",\n async validate(value: any, context) {\n const otherFieldValue = get(context.allValues, this.context.options.field);\n\n if (value === otherFieldValue) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.field = this.context.options.field;\n\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;;AAOA,MAAa,cAA6C;CACxD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAGlC,IAAI,UAFoB,IAAI,QAAQ,WAAW,KAAK,QAAQ,QAAQ,KAExC,GAC1B,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
@@ -1,5 +1,4 @@
1
1
  import { SchemaRule } from "../../types/rule-types.mjs";
2
-
3
2
  //#region ../seal/src/rules/string/pattern.d.ts
4
3
  /**
5
4
  * Pattern rule - validates against regex pattern
@@ -1 +1 @@
1
- {"version":3,"file":"pattern.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/string/pattern.ts"],"mappings":";;;;;AAMA;cAAa,WAAA,EAAa,UAAU;EAAG,OAAA,EAAS,MAAA;AAAA"}
1
+ {"version":3,"file":"pattern.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/string/pattern.ts"],"mappings":";;;;;cAMa,WAAA,EAAa,UAAU;EAAG,OAAA,EAAS,MAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"pattern.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/pattern.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Pattern rule - validates against regex pattern\r\n */\r\nexport const patternRule: SchemaRule<{ pattern: RegExp }> = {\r\n name: \"pattern\",\r\n defaultErrorMessage: \"The :input does not match the required pattern\",\r\n async validate(value: any, context) {\r\n if (this.context.options.pattern.test(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.pattern = this.context.options.pattern.toString();\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAMA,MAAa,cAA+C;CAC1D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,KAAK,QAAQ,QAAQ,QAAQ,KAAK,KAAK,GACzC,OAAO;EAGT,KAAK,QAAQ,kBAAkB,UAAU,KAAK,QAAQ,QAAQ,QAAQ,SAAS;EAC/E,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
1
+ {"version":3,"file":"pattern.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/pattern.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Pattern rule - validates against regex pattern\n */\nexport const patternRule: SchemaRule<{ pattern: RegExp }> = {\n name: \"pattern\",\n defaultErrorMessage: \"The :input does not match the required pattern\",\n async validate(value: any, context) {\n if (this.context.options.pattern.test(value)) {\n return VALID_RULE;\n }\n\n this.context.translationParams.pattern = this.context.options.pattern.toString();\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;AAMA,MAAa,cAA+C;CAC1D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,KAAK,QAAQ,QAAQ,QAAQ,KAAK,KAAK,GACzC,OAAO;EAGT,KAAK,QAAQ,kBAAkB,UAAU,KAAK,QAAQ,QAAQ,QAAQ,SAAS;EAC/E,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
@@ -1,5 +1,4 @@
1
1
  import { SchemaRule } from "../../types/rule-types.mjs";
2
-
3
2
  //#region ../seal/src/rules/string/string-comparison.d.ts
4
3
  /**
5
4
  * Starts with rule
@@ -1 +1 @@
1
- {"version":3,"file":"string-comparison.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/string/string-comparison.ts"],"mappings":";;;;;AAMA;cAAa,cAAA,EAAgB,UAAU;EAAG,KAAK;AAAA;AAAA;AAiB/C;;AAjB+C,cAiBlC,YAAA,EAAc,UAAU;EAAG,KAAK;AAAA;AAiB7C;;;AAAA,cAAa,YAAA,EAAc,UAAU;EAAG,KAAK;AAAA;;;;cAiBhC,eAAA,EAAiB,UAAU;EAAG,KAAK;AAAA"}
1
+ {"version":3,"file":"string-comparison.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/string/string-comparison.ts"],"mappings":";;;;;cAMa,cAAA,EAAgB,UAAU;EAAG,KAAK;AAAA;;AAAA;AAiB/C;cAAa,YAAA,EAAc,UAAU;EAAG,KAAK;AAAA;AAAA;AAiB7C;;AAjB6C,cAiBhC,YAAA,EAAc,UAAU;EAAG,KAAK;AAAA;AAiB7C;;;AAAA,cAAa,eAAA,EAAiB,UAAU;EAAG,KAAK;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"string-comparison.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/string-comparison.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Starts with rule\r\n */\r\nexport const startsWithRule: SchemaRule<{ value: string }> = {\r\n name: \"startsWith\",\r\n defaultErrorMessage: \"The :input must start with :value\",\r\n async validate(value: any, context) {\r\n if (String(value).startsWith(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Ends with rule\r\n */\r\nexport const endsWithRule: SchemaRule<{ value: string }> = {\r\n name: \"endsWith\",\r\n defaultErrorMessage: \"The :input must end with :value\",\r\n async validate(value: any, context) {\r\n if (String(value).endsWith(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Contains rule\r\n */\r\nexport const containsRule: SchemaRule<{ value: string }> = {\r\n name: \"contains\",\r\n defaultErrorMessage: \"The :input must contain :value\",\r\n async validate(value: any, context) {\r\n if (String(value).includes(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Not contains rule\r\n */\r\nexport const notContainsRule: SchemaRule<{ value: string }> = {\r\n name: \"notContains\",\r\n defaultErrorMessage: \"The :input must not contain :value\",\r\n async validate(value: any, context) {\r\n if (!String(value).includes(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAMA,MAAa,iBAAgD;CAC3D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,OAAO,KAAK,CAAC,CAAC,WAAW,KAAK,QAAQ,QAAQ,KAAK,GACrD,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,eAA8C;CACzD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,OAAO,KAAK,CAAC,CAAC,SAAS,KAAK,QAAQ,QAAQ,KAAK,GACnD,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,eAA8C;CACzD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,OAAO,KAAK,CAAC,CAAC,SAAS,KAAK,QAAQ,QAAQ,KAAK,GACnD,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,kBAAiD;CAC5D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,CAAC,OAAO,KAAK,CAAC,CAAC,SAAS,KAAK,QAAQ,QAAQ,KAAK,GACpD,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
1
+ {"version":3,"file":"string-comparison.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/string-comparison.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Starts with rule\n */\nexport const startsWithRule: SchemaRule<{ value: string }> = {\n name: \"startsWith\",\n defaultErrorMessage: \"The :input must start with :value\",\n async validate(value: any, context) {\n if (String(value).startsWith(this.context.options.value)) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.value = this.context.options.value;\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Ends with rule\n */\nexport const endsWithRule: SchemaRule<{ value: string }> = {\n name: \"endsWith\",\n defaultErrorMessage: \"The :input must end with :value\",\n async validate(value: any, context) {\n if (String(value).endsWith(this.context.options.value)) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.value = this.context.options.value;\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Contains rule\n */\nexport const containsRule: SchemaRule<{ value: string }> = {\n name: \"contains\",\n defaultErrorMessage: \"The :input must contain :value\",\n async validate(value: any, context) {\n if (String(value).includes(this.context.options.value)) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.value = this.context.options.value;\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Not contains rule\n */\nexport const notContainsRule: SchemaRule<{ value: string }> = {\n name: \"notContains\",\n defaultErrorMessage: \"The :input must not contain :value\",\n async validate(value: any, context) {\n if (!String(value).includes(this.context.options.value)) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.value = this.context.options.value;\n\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;AAMA,MAAa,iBAAgD;CAC3D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,OAAO,KAAK,CAAC,CAAC,WAAW,KAAK,QAAQ,QAAQ,KAAK,GACrD,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,eAA8C;CACzD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,OAAO,KAAK,CAAC,CAAC,SAAS,KAAK,QAAQ,QAAQ,KAAK,GACnD,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,eAA8C;CACzD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,OAAO,KAAK,CAAC,CAAC,SAAS,KAAK,QAAQ,QAAQ,KAAK,GACnD,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,kBAAiD;CAC5D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,CAAC,OAAO,KAAK,CAAC,CAAC,SAAS,KAAK,QAAQ,QAAQ,KAAK,GACpD,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
@@ -1,5 +1,4 @@
1
1
  import { SchemaRule } from "../../types/rule-types.mjs";
2
-
3
2
  //#region ../seal/src/rules/string/strong-password-rule.d.ts
4
3
  /**
5
4
  * Strong Password rule - validates password strength
@@ -1 +1 @@
1
- {"version":3,"file":"strong-password-rule.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/string/strong-password-rule.ts"],"mappings":";;;;;AAYA;;;;AAAuD;;;cAA1C,kBAAA,EAAoB,UAAU;EAAG,SAAS;AAAA"}
1
+ {"version":3,"file":"strong-password-rule.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/string/strong-password-rule.ts"],"mappings":";;;;;AAYA;;;;AAAuD;;cAA1C,kBAAA,EAAoB,UAAU;EAAG,SAAS;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"strong-password-rule.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/strong-password-rule.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Strong Password rule - validates password strength\r\n * Requirements:\r\n * - At least 8 characters\r\n * - At least 1 uppercase letter\r\n * - At least 1 lowercase letter\r\n * - At least 1 number\r\n * - At least 1 special character\r\n */\r\nexport const strongPasswordRule: SchemaRule<{ minLength?: number }> = {\r\n name: \"strongPassword\",\r\n defaultErrorMessage:\r\n \"The :input must be at least 8 characters and contain at least one uppercase letter, one lowercase letter, one number, and one special character\",\r\n async validate(value: any, context) {\r\n const password = String(value);\r\n const minLength = this.context.options.minLength ?? 8;\r\n\r\n // Check minimum length\r\n if (password.length < minLength) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Check for at least one uppercase letter\r\n if (!/[A-Z]/.test(password)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Check for at least one lowercase letter\r\n if (!/[a-z]/.test(password)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Check for at least one number\r\n if (!/[0-9]/.test(password)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Check for at least one special character\r\n if (!/[!@#$%^&*()_+\\-=[\\]{};':\"\\\\|,.<>/?]/.test(password)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAa,qBAAyD;CACpE,MAAM;CACN,qBACE;CACF,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,WAAW,OAAO,KAAK;EAC7B,MAAM,YAAY,KAAK,QAAQ,QAAQ,aAAa;EAGpD,IAAI,SAAS,SAAS,WACpB,OAAO,YAAY,MAAM,OAAO;EAIlC,IAAI,CAAC,QAAQ,KAAK,QAAQ,GACxB,OAAO,YAAY,MAAM,OAAO;EAIlC,IAAI,CAAC,QAAQ,KAAK,QAAQ,GACxB,OAAO,YAAY,MAAM,OAAO;EAIlC,IAAI,CAAC,QAAQ,KAAK,QAAQ,GACxB,OAAO,YAAY,MAAM,OAAO;EAIlC,IAAI,CAAC,sCAAsC,KAAK,QAAQ,GACtD,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"strong-password-rule.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/strong-password-rule.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Strong Password rule - validates password strength\n * Requirements:\n * - At least 8 characters\n * - At least 1 uppercase letter\n * - At least 1 lowercase letter\n * - At least 1 number\n * - At least 1 special character\n */\nexport const strongPasswordRule: SchemaRule<{ minLength?: number }> = {\n name: \"strongPassword\",\n defaultErrorMessage:\n \"The :input must be at least 8 characters and contain at least one uppercase letter, one lowercase letter, one number, and one special character\",\n async validate(value: any, context) {\n const password = String(value);\n const minLength = this.context.options.minLength ?? 8;\n\n // Check minimum length\n if (password.length < minLength) {\n return invalidRule(this, context);\n }\n\n // Check for at least one uppercase letter\n if (!/[A-Z]/.test(password)) {\n return invalidRule(this, context);\n }\n\n // Check for at least one lowercase letter\n if (!/[a-z]/.test(password)) {\n return invalidRule(this, context);\n }\n\n // Check for at least one number\n if (!/[0-9]/.test(password)) {\n return invalidRule(this, context);\n }\n\n // Check for at least one special character\n if (!/[!@#$%^&*()_+\\-=[\\]{};':\"\\\\|,.<>/?]/.test(password)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAa,qBAAyD;CACpE,MAAM;CACN,qBACE;CACF,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,WAAW,OAAO,KAAK;EAC7B,MAAM,YAAY,KAAK,QAAQ,QAAQ,aAAa;EAGpD,IAAI,SAAS,SAAS,WACpB,OAAO,YAAY,MAAM,OAAO;EAIlC,IAAI,CAAC,QAAQ,KAAK,QAAQ,GACxB,OAAO,YAAY,MAAM,OAAO;EAIlC,IAAI,CAAC,QAAQ,KAAK,QAAQ,GACxB,OAAO,YAAY,MAAM,OAAO;EAIlC,IAAI,CAAC,QAAQ,KAAK,QAAQ,GACxB,OAAO,YAAY,MAAM,OAAO;EAIlC,IAAI,CAAC,sCAAsC,KAAK,QAAQ,GACtD,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
@@ -1,5 +1,4 @@
1
1
  import { SchemaRule } from "../../types/rule-types.mjs";
2
-
3
2
  //#region ../seal/src/rules/string/url.d.ts
4
3
  /**
5
4
  * URL rule - validates URL format
@@ -1 +1 @@
1
- {"version":3,"file":"url.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/string/url.ts"],"mappings":";;;;;AAMA;cAAa,OAAA,EAAS,UAWrB"}
1
+ {"version":3,"file":"url.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/string/url.ts"],"mappings":";;;;;cAMa,OAAA,EAAS,UAWrB"}
@@ -1 +1 @@
1
- {"version":3,"file":"url.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/url.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * URL rule - validates URL format\r\n */\r\nexport const urlRule: SchemaRule = {\r\n name: \"url\",\r\n defaultErrorMessage: \"The :input must be a valid URL\",\r\n async validate(value: any, context) {\r\n try {\r\n new URL(value);\r\n return VALID_RULE;\r\n } catch {\r\n return invalidRule(this, context);\r\n }\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAMA,MAAa,UAAsB;CACjC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI;GACF,IAAI,IAAI,KAAK;GACb,OAAO;EACT,QAAQ;GACN,OAAO,YAAY,MAAM,OAAO;EAClC;CACF;AACF"}
1
+ {"version":3,"file":"url.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/url.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * URL rule - validates URL format\n */\nexport const urlRule: SchemaRule = {\n name: \"url\",\n defaultErrorMessage: \"The :input must be a valid URL\",\n async validate(value: any, context) {\n try {\n new URL(value);\n return VALID_RULE;\n } catch {\n return invalidRule(this, context);\n }\n },\n};\n"],"mappings":";;;;;;;AAMA,MAAa,UAAsB;CACjC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI;GACF,IAAI,IAAI,KAAK;GACb,OAAO;EACT,QAAQ;GACN,OAAO,YAAY,MAAM,OAAO;EAClC;CACF;AACF"}
@@ -1,5 +1,4 @@
1
1
  import { SchemaRule } from "../../types/rule-types.mjs";
2
-
3
2
  //#region ../seal/src/rules/string/without-whitespace.d.ts
4
3
  /**
5
4
  * Without whitespace rule - value must not contain whitespace
@@ -1 +1 @@
1
- {"version":3,"file":"without-whitespace.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/string/without-whitespace.ts"],"mappings":";;;;;AAMA;cAAa,qBAAA,EAAuB,UASnC"}
1
+ {"version":3,"file":"without-whitespace.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/string/without-whitespace.ts"],"mappings":";;;;;cAMa,qBAAA,EAAuB,UASnC"}
@@ -1 +1 @@
1
- {"version":3,"file":"without-whitespace.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/without-whitespace.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Without whitespace rule - value must not contain whitespace\r\n */\r\nexport const withoutWhitespaceRule: SchemaRule = {\r\n name: \"withoutWhitespace\",\r\n defaultErrorMessage: \"The :input must not contain whitespace\",\r\n async validate(value: any, context) {\r\n if (!/\\s/.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAMA,MAAa,wBAAoC;CAC/C,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,CAAC,KAAK,KAAK,KAAK,GAClB,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
1
+ {"version":3,"file":"without-whitespace.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/without-whitespace.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Without whitespace rule - value must not contain whitespace\n */\nexport const withoutWhitespaceRule: SchemaRule = {\n name: \"withoutWhitespace\",\n defaultErrorMessage: \"The :input must not contain whitespace\",\n async validate(value: any, context) {\n if (!/\\s/.test(value)) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;AAMA,MAAa,wBAAoC;CAC/C,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,CAAC,KAAK,KAAK,KAAK,GAClB,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
@@ -0,0 +1,3 @@
1
+ import { StandardJSONSchemaV1, StandardSchemaV1 } from "./types.mjs";
2
+ import { JsonSchemaResult, JsonSchemaTarget, applyNullable, getRuleOptions, wrapNullableStrict } from "./json-schema.mjs";
3
+ import { mapToStandardResult } from "./map-result.mjs";
@@ -1,6 +1,5 @@
1
1
  import { StandardSchemaV1 } from "./types.mjs";
2
2
  import { ValidationResult } from "../types/result-types.mjs";
3
-
4
3
  //#region ../seal/src/standard-schema/map-result.d.ts
5
4
  /**
6
5
  * Maps a Seal ValidationResult to a Standard Schema result shape.
@@ -1 +1 @@
1
- {"version":3,"file":"map-result.d.mts","names":[],"sources":["../../../../../../../seal/src/standard-schema/map-result.ts"],"mappings":";;;;;;AAiBA;;;;;;;;;AAE0B;;;iBAFV,mBAAA,CACd,MAAA,EAAQ,gBAAA,GACP,gBAAA,CAAiB,MAAM"}
1
+ {"version":3,"file":"map-result.d.mts","names":[],"sources":["../../../../../../../seal/src/standard-schema/map-result.ts"],"mappings":";;;;;;AAiBA;;;;;;;;;AAE0B;;iBAFV,mBAAA,CACd,MAAA,EAAQ,gBAAA,GACP,gBAAA,CAAiB,MAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"date-types.mjs","names":[],"sources":["../../../../../../../seal/src/types/date-types.ts"],"sourcesContent":["/**\r\n * Week day names for validation\r\n */\r\nexport type WeekDay =\r\n | \"sunday\"\r\n | \"monday\"\r\n | \"tuesday\"\r\n | \"wednesday\"\r\n | \"thursday\"\r\n | \"friday\"\r\n | \"saturday\";\r\n\r\n/**\r\n * Week day numbers mapping\r\n */\r\nexport const WEEK_DAYS: Record<WeekDay, number> = {\r\n sunday: 0,\r\n monday: 1,\r\n tuesday: 2,\r\n wednesday: 3,\r\n thursday: 4,\r\n friday: 5,\r\n saturday: 6,\r\n};\r\n"],"mappings":";;;;AAeA,MAAa,YAAqC;CAChD,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,WAAW;CACX,UAAU;CACV,QAAQ;CACR,UAAU;AACZ"}
1
+ {"version":3,"file":"date-types.mjs","names":[],"sources":["../../../../../../../seal/src/types/date-types.ts"],"sourcesContent":["/**\n * Week day names for validation\n */\nexport type WeekDay =\n | \"sunday\"\n | \"monday\"\n | \"tuesday\"\n | \"wednesday\"\n | \"thursday\"\n | \"friday\"\n | \"saturday\";\n\n/**\n * Week day numbers mapping\n */\nexport const WEEK_DAYS: Record<WeekDay, number> = {\n sunday: 0,\n monday: 1,\n tuesday: 2,\n wednesday: 3,\n thursday: 4,\n friday: 5,\n saturday: 6,\n};\n"],"mappings":";;;;AAeA,MAAa,YAAqC;CAChD,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,WAAW;CACX,UAAU;CACV,QAAQ;CACR,UAAU;AACZ"}
@@ -0,0 +1,10 @@
1
+ import { Schema } from "./schema-types.mjs";
2
+ import { ContextualSchemaRule, RuleResult, SchemaRule, SchemaRuleOptions, ValidationAttributesList } from "./rule-types.mjs";
3
+ import { AttributeTranslation, RuleTranslation, SchemaContext } from "./context-types.mjs";
4
+ import { ValidationResult } from "./result-types.mjs";
5
+ import { ContextualizedMutator, Mutator, MutatorContext } from "./mutator-types.mjs";
6
+ import { WhenRuleOptions } from "./conditional-types.mjs";
7
+ import { ContextualizedTransformer, SimpleTransformerCallback, TransformerCallback } from "./data-transformer-types.mjs";
8
+ import { Infer, InferInput, InferInputObjectShape, InferObjectShape, InferOutput, InferOutputObjectShape, IsInputOptionalKey, IsOptionalKey, IsOutputOptionalKey } from "./inference-types.mjs";
9
+ import { WEEK_DAYS, WeekDay } from "./date-types.mjs";
10
+ import { FileSizeOption } from "./file.types.mjs";
@@ -1 +1 @@
1
- {"version":3,"file":"any-validator.mjs","names":[],"sources":["../../../../../../../seal/src/validators/any-validator.ts"],"sourcesContent":["import type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\nimport { applyNullable } from \"../standard-schema/json-schema\";\r\nimport { BaseValidator } from \"./base-validator\";\r\n\r\n/**\r\n * Any validator - accepts any value\r\n */\r\nexport class AnyValidator extends BaseValidator {\r\n /**\r\n * Any validator means any value, so we disable the default required requirement.\r\n */\r\n public override requiredRule = null;\r\n\r\n /**\r\n * Set is optional to be true\r\n */\r\n public override isOptional = true;\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Any validator accepts anything. In JSON Schema, an empty object `{}`\r\n * is the permissive schema that accepts any valid JSON value.\r\n *\r\n * @example\r\n * ```ts\r\n * v.any().toJsonSchema(\"draft-2020-12\")\r\n * // → {}\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const schema: JsonSchemaResult = {};\r\n if (this.isNullable) applyNullable(schema, target);\r\n return schema;\r\n }\r\n}\r\n"],"mappings":";;;;;;;AAOA,IAAa,eAAb,cAAkC,cAAc;;;sBAIf;oBAKF;;;;;;;;;;;;;;CAc7B,AAAgB,aAAa,SAA2B,iBAAmC;EACzF,MAAM,SAA2B,CAAC;EAClC,IAAI,KAAK,YAAY,cAAc,QAAQ,MAAM;EACjD,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"any-validator.mjs","names":[],"sources":["../../../../../../../seal/src/validators/any-validator.ts"],"sourcesContent":["import type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport { applyNullable } from \"../standard-schema/json-schema\";\nimport { BaseValidator } from \"./base-validator\";\n\n/**\n * Any validator - accepts any value\n */\nexport class AnyValidator extends BaseValidator {\n /**\n * Any validator means any value, so we disable the default required requirement.\n */\n public override requiredRule = null;\n\n /**\n * Set is optional to be true\n */\n public override isOptional = true;\n\n /**\n * @inheritdoc\n *\n * Any validator accepts anything. In JSON Schema, an empty object `{}`\n * is the permissive schema that accepts any valid JSON value.\n *\n * @example\n * ```ts\n * v.any().toJsonSchema(\"draft-2020-12\")\n * // → {}\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const schema: JsonSchemaResult = {};\n if (this.isNullable) applyNullable(schema, target);\n return schema;\n }\n}\n"],"mappings":";;;;;;;AAOA,IAAa,eAAb,cAAkC,cAAc;;;sBAIf;oBAKF;;;;;;;;;;;;;;CAc7B,AAAgB,aAAa,SAA2B,iBAAmC;EACzF,MAAM,SAA2B,CAAC;EAClC,IAAI,KAAK,YAAY,cAAc,QAAQ,MAAM;EACjD,OAAO;CACT;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"array-validator.d.mts","names":[],"sources":["../../../../../../../seal/src/validators/array-validator.ts"],"mappings":";;;;;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AA,CAAK,SAAA,mBAAmC,GAAA;EA1C3B;EA+Cb,GAAA,CAAI,GAAA,UAAa,YAAA;EA9CtB;EAmDK,SAAA,CAAU,MAAA,UAAgB,YAAA;EAzCd;EA8CZ,GAAA,CAAI,GAAA,UAAa,YAAA;EA9BjB;EAmCA,SAAA,CAAU,MAAA,UAAgB,YAAA;EAzB1B;EA8BA,MAAA,CAAO,MAAA,UAAgB,YAAA;EAzBlB;;;;;;;;;;;;;;EA2CL,OAAA,CAAQ,GAAA,UAAa,GAAA,UAAa,YAAA;EAlB3B;;;EA4BP,aAAA,CAAc,GAAA,UAAa,GAAA,UAAa,YAAA;EAVnB;EAerB,MAAA,CAAO,YAAA;EALP;EAUA,MAAA,CAAO,SAAA,mBAAmC,YAAA;EAVf;EAe3B,MAAA,CAAO,IAAA,OAAW,OAAA,EAAS,aAAA;EAV3B;;;;;;EAqBM,QAAA,CAAS,IAAA,OAAW,OAAA,EAAS,aAAA,GAAgB,OAAA,CAAQ,gBAAA;EAXhC;;;;;;;;;;;EAwElB,YAAA,CAAa,MAAA,GAAQ,gBAAA,GAAqC,gBAAA;AAAA"}
@@ -17,6 +17,7 @@ var ArrayValidator = class extends BaseValidator {
17
17
  constructor(validator, errorMessage) {
18
18
  super();
19
19
  this.validator = validator;
20
+ this.blankIsMissing = true;
20
21
  this.addMutableRule(arrayRule, errorMessage);
21
22
  }
22
23
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"array-validator.mjs","names":[],"sources":["../../../../../../../seal/src/validators/array-validator.ts"],"sourcesContent":["import { setKeyPath } from \"../helpers\";\r\nimport { flipArrayMutator, sortArrayMutator, uniqueArrayMutator } from \"../mutators\";\r\nimport {\r\n arrayRule,\r\n betweenLengthRule,\r\n lengthRule,\r\n maxLengthRule,\r\n minLengthRule,\r\n sortedArrayRule,\r\n uniqueArrayRule,\r\n} from \"../rules\";\r\nimport type { SchemaContext, ValidationResult } from \"../types\";\r\nimport { BaseValidator } from \"./base-validator\";\r\nimport { applyNullable, getRuleOptions } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Array validator class\r\n */\r\nexport class ArrayValidator extends BaseValidator {\r\n public constructor(\r\n public validator: BaseValidator,\r\n errorMessage?: string,\r\n ) {\r\n super();\r\n this.addMutableRule(arrayRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is an array type\r\n */\r\n public matchesType(value: any): boolean {\r\n return Array.isArray(value);\r\n }\r\n\r\n /**\r\n * Clone the validator\r\n */\r\n public override clone(): this {\r\n const cloned = super.clone();\r\n\r\n cloned.validator = this.validator.clone();\r\n\r\n return cloned;\r\n }\r\n\r\n /** Reverse array order */\r\n public flip() {\r\n return this.addMutator(flipArrayMutator);\r\n }\r\n\r\n /** Reverse array order (alias) */\r\n public reverse() {\r\n return this.addMutator(flipArrayMutator);\r\n }\r\n\r\n /** Make it has only unique values */\r\n public onlyUnique() {\r\n return this.addMutator(uniqueArrayMutator);\r\n }\r\n\r\n /** Sort array */\r\n public sort(direction: \"asc\" | \"desc\" = \"asc\", key?: string) {\r\n return this.addMutator(sortArrayMutator, { direction, key });\r\n }\r\n\r\n /** Array length must be greater than the given length */\n public min(min: number, errorMessage?: string) {\n return this.addRule(minLengthRule, errorMessage, { minLength: min });\n }\n\n /** @alias min */\n public minLength(length: number, errorMessage?: string) {\n return this.min(length, errorMessage);\n }\n\n /** Array length must be less than the given length */\n public max(max: number, errorMessage?: string) {\n return this.addRule(maxLengthRule, errorMessage, { maxLength: max });\n }\n\n /** @alias max */\n public maxLength(length: number, errorMessage?: string) {\n return this.max(length, errorMessage);\n }\n\r\n /** Array length must be of the given length */\r\n public length(length: number, errorMessage?: string) {\r\n return this.addRule(lengthRule, errorMessage, { length });\r\n }\r\n\r\n /**\r\n * Array length must be between min and max (inclusive)\r\n *\r\n * @param min - Minimum length (inclusive)\r\n * @param max - Maximum length (inclusive)\r\n *\r\n * @example\r\n * ```ts\r\n * v.array(v.string()).between(1, 10) // Array must have 1 to 10 items\r\n * v.array(v.number()).lengthBetween(5, 20) // Same using alias\r\n * ```\r\n *\r\n * @category Validation Rule\r\n */\r\n public between(min: number, max: number, errorMessage?: string) {\r\n return this.addRule(betweenLengthRule, errorMessage, {\r\n minLength: min,\r\n maxLength: max,\r\n });\r\n }\r\n\r\n /**\r\n * Alias for between() - array length between min and max\r\n */\r\n public lengthBetween(min: number, max: number, errorMessage?: string) {\r\n return this.between(min, max, errorMessage);\r\n }\r\n\r\n /** Array must have unique values */\r\n public unique(errorMessage?: string) {\r\n return this.addRule(uniqueArrayRule, errorMessage);\r\n }\r\n\r\n /** Array must be sorted */\r\n public sorted(direction: \"asc\" | \"desc\" = \"asc\", errorMessage?: string) {\r\n return this.addRule(sortedArrayRule, errorMessage, { direction });\r\n }\r\n\r\n /** Mutate the data */\r\n public mutate(data: any, context: SchemaContext) {\r\n if (!Array.isArray(data)) return data;\r\n return super.mutate([...data], context);\r\n }\r\n\r\n /** Validate array\r\n *\r\n * Absent input (and absent without `.default()`) propagates as `data: undefined`\r\n * so the parent ObjectValidator can omit the key. Without this, optional array\r\n * fields would silently materialise as `[]` in the validated output.\r\n */\r\n public async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\r\n // Apply default when absent, then mutate. Mirrors BaseValidator's\r\n // `valueForRules = data ?? this.getDefaultValue()` so `.default([...])`\r\n // works on arrays too.\r\n const valueForRules = data ?? this.getDefaultValue();\r\n const mutatedData = await this.mutate(valueForRules, context);\r\n\r\n const result = await super.validate(data, context);\r\n\r\n if (result.isValid === false) return result;\r\n\r\n // Nothing to iterate for absent (no default) or null (nullable) inputs —\r\n // propagate so the parent ObjectValidator can omit the key.\r\n if (mutatedData === undefined || mutatedData === null) return result;\r\n\r\n // Defensive: type rule (arrayRule) should have failed for non-arrays.\r\n if (!Array.isArray(mutatedData)) return result;\r\n\r\n const errors: ValidationResult[\"errors\"] = [];\r\n\r\n // Validate all items in parallel (consistent with ObjectValidator)\r\n const validationPromises = mutatedData.map(async (value: any, index: number) => {\r\n const childContext: SchemaContext = {\r\n ...context,\r\n parent: mutatedData,\r\n value,\r\n key: index.toString(),\r\n path: setKeyPath(context.path, index.toString()),\r\n };\r\n\r\n const childResult = await this.validator.validate(value, childContext);\r\n\r\n // Update mutated data with validated result\r\n mutatedData[index] = childResult.data;\r\n\r\n // Collect errors from this element\r\n if (childResult.isValid === false) {\r\n errors.push(...childResult.errors);\r\n }\r\n });\r\n\r\n await Promise.all(validationPromises);\r\n\r\n return {\r\n isValid: errors.length === 0,\r\n errors,\r\n data: await this.startTransformationPipeline(mutatedData, context),\r\n };\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Recursively generates JSON Schema for the array items.\r\n *\r\n * @example\r\n * ```ts\r\n * v.array(v.string().min(1)).minLength(1).toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"array\", items: { type: \"string\", minLength: 1 }, minItems: 1 }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const schema: JsonSchemaResult = {\r\n type: \"array\",\r\n items: this.validator.toJsonSchema(target),\r\n };\r\n\r\n const minOpts = getRuleOptions(this.rules, \"minLength\");\r\n if (minOpts?.minLength !== undefined) schema.minItems = minOpts.minLength;\r\n\r\n const maxOpts = getRuleOptions(this.rules, \"maxLength\");\r\n if (maxOpts?.maxLength !== undefined) schema.maxItems = maxOpts.maxLength;\r\n\r\n const betweenOpts = getRuleOptions(this.rules, \"betweenLength\");\r\n if (betweenOpts) {\r\n if (betweenOpts.minLength !== undefined) schema.minItems = betweenOpts.minLength;\r\n if (betweenOpts.maxLength !== undefined) schema.maxItems = betweenOpts.maxLength;\r\n }\r\n\r\n const lengthOpts = getRuleOptions(this.rules, \"length\");\r\n if (lengthOpts?.length !== undefined) {\r\n schema.minItems = lengthOpts.length;\r\n schema.maxItems = lengthOpts.length;\r\n }\r\n\r\n if (this.isNullable) applyNullable(schema, target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Aa,SAA2B,iBAAmC;EACzF,MAAM,SAA2B;GAC/B,MAAM;GACN,OAAO,KAAK,UAAU,aAAa,MAAM;EAC3C;EAEA,MAAM,UAAU,eAAe,KAAK,OAAO,WAAW;EACtD,IAAI,SAAS,cAAc,QAAW,OAAO,WAAW,QAAQ;EAEhE,MAAM,UAAU,eAAe,KAAK,OAAO,WAAW;EACtD,IAAI,SAAS,cAAc,QAAW,OAAO,WAAW,QAAQ;EAEhE,MAAM,cAAc,eAAe,KAAK,OAAO,eAAe;EAC9D,IAAI,aAAa;GACf,IAAI,YAAY,cAAc,QAAW,OAAO,WAAW,YAAY;GACvE,IAAI,YAAY,cAAc,QAAW,OAAO,WAAW,YAAY;EACzE;EAEA,MAAM,aAAa,eAAe,KAAK,OAAO,QAAQ;EACtD,IAAI,YAAY,WAAW,QAAW;GACpC,OAAO,WAAW,WAAW;GAC7B,OAAO,WAAW,WAAW;EAC/B;EAEA,IAAI,KAAK,YAAY,cAAc,QAAQ,MAAM;EAEjD,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"array-validator.mjs","names":[],"sources":["../../../../../../../seal/src/validators/array-validator.ts"],"sourcesContent":["import { setKeyPath } from \"../helpers\";\nimport { flipArrayMutator, sortArrayMutator, uniqueArrayMutator } from \"../mutators\";\nimport {\n arrayRule,\n betweenLengthRule,\n lengthRule,\n maxLengthRule,\n minLengthRule,\n sortedArrayRule,\n uniqueArrayRule,\n} from \"../rules\";\nimport type { SchemaContext, ValidationResult } from \"../types\";\nimport { BaseValidator } from \"./base-validator\";\nimport { applyNullable, getRuleOptions } from \"../standard-schema/json-schema\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\n\n/**\n * Array validator class\n */\nexport class ArrayValidator extends BaseValidator {\n public constructor(\n public validator: BaseValidator,\n errorMessage?: string,\n ) {\n super();\n this.blankIsMissing = true;\n this.addMutableRule(arrayRule, errorMessage);\n }\n\n /**\n * Check if value is an array type\n */\n public matchesType(value: any): boolean {\n return Array.isArray(value);\n }\n\n /**\n * Clone the validator\n */\n public override clone(): this {\n const cloned = super.clone();\n\n cloned.validator = this.validator.clone();\n\n return cloned;\n }\n\n /** Reverse array order */\n public flip() {\n return this.addMutator(flipArrayMutator);\n }\n\n /** Reverse array order (alias) */\n public reverse() {\n return this.addMutator(flipArrayMutator);\n }\n\n /** Make it has only unique values */\n public onlyUnique() {\n return this.addMutator(uniqueArrayMutator);\n }\n\n /** Sort array */\n public sort(direction: \"asc\" | \"desc\" = \"asc\", key?: string) {\n return this.addMutator(sortArrayMutator, { direction, key });\n }\n\n /** Array length must be greater than the given length */\n public min(min: number, errorMessage?: string) {\n return this.addRule(minLengthRule, errorMessage, { minLength: min });\n }\n\n /** @alias min */\n public minLength(length: number, errorMessage?: string) {\n return this.min(length, errorMessage);\n }\n\n /** Array length must be less than the given length */\n public max(max: number, errorMessage?: string) {\n return this.addRule(maxLengthRule, errorMessage, { maxLength: max });\n }\n\n /** @alias max */\n public maxLength(length: number, errorMessage?: string) {\n return this.max(length, errorMessage);\n }\n\n /** Array length must be of the given length */\n public length(length: number, errorMessage?: string) {\n return this.addRule(lengthRule, errorMessage, { length });\n }\n\n /**\n * Array length must be between min and max (inclusive)\n *\n * @param min - Minimum length (inclusive)\n * @param max - Maximum length (inclusive)\n *\n * @example\n * ```ts\n * v.array(v.string()).between(1, 10) // Array must have 1 to 10 items\n * v.array(v.number()).lengthBetween(5, 20) // Same using alias\n * ```\n *\n * @category Validation Rule\n */\n public between(min: number, max: number, errorMessage?: string) {\n return this.addRule(betweenLengthRule, errorMessage, {\n minLength: min,\n maxLength: max,\n });\n }\n\n /**\n * Alias for between() - array length between min and max\n */\n public lengthBetween(min: number, max: number, errorMessage?: string) {\n return this.between(min, max, errorMessage);\n }\n\n /** Array must have unique values */\n public unique(errorMessage?: string) {\n return this.addRule(uniqueArrayRule, errorMessage);\n }\n\n /** Array must be sorted */\n public sorted(direction: \"asc\" | \"desc\" = \"asc\", errorMessage?: string) {\n return this.addRule(sortedArrayRule, errorMessage, { direction });\n }\n\n /** Mutate the data */\n public mutate(data: any, context: SchemaContext) {\n if (!Array.isArray(data)) return data;\n return super.mutate([...data], context);\n }\n\n /** Validate array\n *\n * Absent input (and absent without `.default()`) propagates as `data: undefined`\n * so the parent ObjectValidator can omit the key. Without this, optional array\n * fields would silently materialise as `[]` in the validated output.\n */\n public async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\n // Apply default when absent, then mutate. Mirrors BaseValidator's\n // `valueForRules = data ?? this.getDefaultValue()` so `.default([...])`\n // works on arrays too.\n const valueForRules = data ?? this.getDefaultValue();\n const mutatedData = await this.mutate(valueForRules, context);\n\n const result = await super.validate(data, context);\n\n if (result.isValid === false) return result;\n\n // Nothing to iterate for absent (no default) or null (nullable) inputs —\n // propagate so the parent ObjectValidator can omit the key.\n if (mutatedData === undefined || mutatedData === null) return result;\n\n // Defensive: type rule (arrayRule) should have failed for non-arrays.\n if (!Array.isArray(mutatedData)) return result;\n\n const errors: ValidationResult[\"errors\"] = [];\n\n // Validate all items in parallel (consistent with ObjectValidator)\n const validationPromises = mutatedData.map(async (value: any, index: number) => {\n const childContext: SchemaContext = {\n ...context,\n parent: mutatedData,\n value,\n key: index.toString(),\n path: setKeyPath(context.path, index.toString()),\n };\n\n const childResult = await this.validator.validate(value, childContext);\n\n // Update mutated data with validated result\n mutatedData[index] = childResult.data;\n\n // Collect errors from this element\n if (childResult.isValid === false) {\n errors.push(...childResult.errors);\n }\n });\n\n await Promise.all(validationPromises);\n\n return {\n isValid: errors.length === 0,\n errors,\n data: await this.startTransformationPipeline(mutatedData, context),\n };\n }\n\n /**\n * @inheritdoc\n *\n * Recursively generates JSON Schema for the array items.\n *\n * @example\n * ```ts\n * v.array(v.string().min(1)).minLength(1).toJsonSchema(\"draft-2020-12\")\n * // → { type: \"array\", items: { type: \"string\", minLength: 1 }, minItems: 1 }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const schema: JsonSchemaResult = {\n type: \"array\",\n items: this.validator.toJsonSchema(target),\n };\n\n const minOpts = getRuleOptions(this.rules, \"minLength\");\n if (minOpts?.minLength !== undefined) schema.minItems = minOpts.minLength;\n\n const maxOpts = getRuleOptions(this.rules, \"maxLength\");\n if (maxOpts?.maxLength !== undefined) schema.maxItems = maxOpts.maxLength;\n\n const betweenOpts = getRuleOptions(this.rules, \"betweenLength\");\n if (betweenOpts) {\n if (betweenOpts.minLength !== undefined) schema.minItems = betweenOpts.minLength;\n if (betweenOpts.maxLength !== undefined) schema.maxItems = betweenOpts.maxLength;\n }\n\n const lengthOpts = getRuleOptions(this.rules, \"length\");\n if (lengthOpts?.length !== undefined) {\n schema.minItems = lengthOpts.length;\n schema.maxItems = lengthOpts.length;\n }\n\n if (this.isNullable) applyNullable(schema, target);\n\n return schema;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAmBA,IAAa,iBAAb,cAAoC,cAAc;CAChD,AAAO,YACL,AAAO,WACP,cACA;EACA,MAAM;EAHC;EAIP,KAAK,iBAAiB;EACtB,KAAK,eAAe,WAAW,YAAY;CAC7C;;;;CAKA,AAAO,YAAY,OAAqB;EACtC,OAAO,MAAM,QAAQ,KAAK;CAC5B;;;;CAKA,AAAgB,QAAc;EAC5B,MAAM,SAAS,MAAM,MAAM;EAE3B,OAAO,YAAY,KAAK,UAAU,MAAM;EAExC,OAAO;CACT;;CAGA,AAAO,OAAO;EACZ,OAAO,KAAK,WAAW,gBAAgB;CACzC;;CAGA,AAAO,UAAU;EACf,OAAO,KAAK,WAAW,gBAAgB;CACzC;;CAGA,AAAO,aAAa;EAClB,OAAO,KAAK,WAAW,kBAAkB;CAC3C;;CAGA,AAAO,KAAK,YAA4B,OAAO,KAAc;EAC3D,OAAO,KAAK,WAAW,kBAAkB;GAAE;GAAW;EAAI,CAAC;CAC7D;;CAGA,AAAO,IAAI,KAAa,cAAuB;EAC7C,OAAO,KAAK,QAAQ,eAAe,cAAc,EAAE,WA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-types.mjs";
6
6
  import { ContextualizedMutator, Mutator } from "../types/mutator-types.mjs";
7
7
  import { ContextualizedTransformer, SimpleTransformerCallback, TransformerCallback } from "../types/data-transformer-types.mjs";
8
-
9
8
  //#region ../seal/src/validators/base-validator.d.ts
10
9
  /**
11
10
  * Base validator class - foundation for all validators
@@ -18,6 +17,8 @@ declare class BaseValidator<TInput = unknown, TOutput = TInput> {
18
17
  protected shouldOmit: boolean;
19
18
  protected isNullable: boolean;
20
19
  protected isMutable: boolean;
20
+ /** Treat empty or whitespace-only form strings as an absent value. */
21
+ protected blankIsMissing: boolean;
21
22
  /**
22
23
  * Catch state — when `hasCatch` is true and validation fails, `catchValue`
23
24
  * (or its callback result) substitutes for the failed value, and the public
@@ -1 +1 @@
1
- {"version":3,"file":"base-validator.d.mts","names":[],"sources":["../../../../../../../seal/src/validators/base-validator.ts"],"mappings":";;;;;;;;;;;;cAyBa,aAAA,6BAA0C,MAAA;EAC9C,KAAA,EAAO,oBAAA;EACP,QAAA,EAAU,qBAAA;EAAA,UACP,YAAA;EAAA,UACA,WAAA;EAAA,UACA,UAAA;EAAA,UACA,UAAA;EAAA,UACA,SAAA;EALO;;;;;;;EAAA,UAcP,UAAA,UACA,MAAA,EAAQ,gBAAA,YAA4B,aAAA,gBAA6B,OAAA;EAAA,UACjE,QAAA;EAiKgB;;;;;;;EAxJnB,UAAA;EAoXY;;;;;;;EA3WZ,YAAA,EAAc,oBAAA;EAoZW;;;EAAA,UA/YtB,gBAAA,EAAkB,yBAAA;EAkZjB;;;;;EAAA,UA3YD,cAAA,EAAgB,wBAAA;EAwZlB;;;EAAA,UAnZE,oBAAA,EAAsB,MAAA;EAocP;;;EAAA,IA/bd,OAAA;EAicC;;;EAAA,IAzbD,SAAA;EAieuB;;;;;EAAA,cAvdpB,QAAA;EAkjBoD;;;;EA1iB3D,eAAA;EAgrBc;;;;;;EAtqBd,QAAA;IAAqB,UAAA;EAAA;EA7Fd;;;;;;EAyGP,WAAA;IAAwB,UAA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AAS,IAAA,OAAW,OAAA,EAAS,aAAA,GAAgB,OAAA,CAAQ,gBAAA;;;;YAyFxD,qBAAA,CAAsB,IAAA,EAAM,oBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAoDjB,oBAAA,CAAqB,KAAA,CAAM,MAAA,EAAQ,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;EAyCjD,YAAA,CAAa,OAAA,GAAS,gBAAA,GAAqC,gBAAA;AAAA"}
@@ -16,6 +16,7 @@ var BaseValidator = class {
16
16
  this.shouldOmit = false;
17
17
  this.isNullable = false;
18
18
  this.isMutable = false;
19
+ this.blankIsMissing = false;
19
20
  this.hasCatch = false;
20
21
  this.isOptional = false;
21
22
  this.requiredRule = this.createRule(requiredRule);
@@ -276,8 +277,10 @@ var BaseValidator = class {
276
277
  cloned.shouldOmit = this.shouldOmit;
277
278
  cloned.description = this.description;
278
279
  cloned.attributesText = { ...this.attributesText };
280
+ cloned.translatedAttributes = { ...this.translatedAttributes };
279
281
  cloned.isNullable = this.isNullable;
280
282
  cloned.isOptional = this.isOptional;
283
+ cloned.blankIsMissing = this.blankIsMissing;
281
284
  cloned.requiredRule = this.requiredRule;
282
285
  cloned.catchValue = this.catchValue;
283
286
  cloned.hasCatch = this.hasCatch;
@@ -523,7 +526,13 @@ var BaseValidator = class {
523
526
  errors: [],
524
527
  data: null
525
528
  };
526
- const valueForRules = data ?? this.getDefaultValue();
529
+ const isBlank = this.blankIsMissing && typeof data === "string" && data.trim() === "";
530
+ if (isBlank && this.isNullable) return {
531
+ isValid: true,
532
+ errors: [],
533
+ data: null
534
+ };
535
+ const valueForRules = (isBlank ? void 0 : data) ?? this.getDefaultValue();
527
536
  const mutatedData = this.isOptional && valueForRules === void 0 ? void 0 : await this.mutate(valueForRules, context);
528
537
  const errors = [];
529
538
  let isValid = true;
@@ -562,6 +571,7 @@ var BaseValidator = class {
562
571
  */
563
572
  setRuleAttributesList(rule) {
564
573
  rule.context.attributesList = typeof this.attributesText[rule.name] === "object" ? this.attributesText[rule.name] : this.attributesText;
574
+ rule.context.translatedAttributes = this.translatedAttributes;
565
575
  }
566
576
  /**
567
577
  * Standard Schema V1 compliance.