@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":"base-validator.mjs","names":["defaultRequiredRule"],"sources":["../../../../../../../seal/src/validators/base-validator.ts"],"sourcesContent":["import { clone } from \"@mongez/reinforcements\";\nimport { validate } from \"../factory/validate\";\nimport { VALID_RULE, invalidRule } from \"../helpers/validation-helpers\";\nimport { isEmptyValue } from \"../helpers/is-empty-value\";\nimport { requiredRule as defaultRequiredRule } from \"../rules/core/required\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport { mapToStandardResult } from \"../standard-schema/map-result\";\nimport type { StandardJSONSchemaV1, StandardSchemaV1 } from \"../standard-schema/types\";\nimport type {\n ContextualSchemaRule,\n ContextualizedMutator,\n ContextualizedTransformer,\n Mutator,\n SchemaContext,\n SchemaRule,\n SchemaRuleOptions,\n SimpleTransformerCallback,\n TransformerCallback,\n ValidationAttributesList,\n ValidationResult,\n} from \"../types\";\n\n/**\n * Base validator class - foundation for all validators\n */\nexport class BaseValidator<TInput = unknown, TOutput = TInput> {\n public rules: ContextualSchemaRule[] = [];\n public mutators: ContextualizedMutator[] = [];\n protected defaultValue: any | (() => any);\n protected description?: string;\n protected shouldOmit = false;\n protected isNullable = false;\n protected isMutable = false;\n\n /**\n * Catch state — when `hasCatch` is true and validation fails, `catchValue`\n * (or its callback result) substitutes for the failed value, and the public\n * result reports `isValid: true` with no errors.\n *\n * See `.catch()` for semantics and the v1 scope (leaf-only).\n */\n protected catchValue:\n any | ((errors: ValidationResult[\"errors\"], originalInput: any) => any | Promise<any>);\n protected hasCatch = false;\n\n /**\n * Whether the field is optional.\n * - false (default): field is required unless a requiredRule governs the condition.\n * - true: field can be absent or empty — set by calling .optional().\n *\n * Also used as a TypeScript literal brand via the optional() return type.\n */\n public isOptional = false;\n\n /**\n * The single required-condition rule for this field.\n * - null: field uses strict default (always required when not optional).\n * - set: the rule governs when the field is required (e.g., requiredIf).\n *\n * Stored separately from rules[] and prepended at validate() time.\n */\n public requiredRule: ContextualSchemaRule | null = this.createRule(defaultRequiredRule);\n\n /**\n * Pipeline to transform the mutated/original data before returning it\n */\n protected dataTransformers: ContextualizedTransformer[] = [];\n\n /**\n * Attributes text to be replaced on translations\n * If the value is an object, it will be used as the attributes list for the rule\n * If the value is a string, it will be used as the attributes list for the rule\n */\n protected attributesText: ValidationAttributesList = {};\n\n /**\n * Attributed that will be always using the attribute translator\n */\n protected translatedAttributes: Record<string, string> = {};\n\n /**\n * Mark the validator as mutable\n */\n public get mutable() {\n this.isMutable = true;\n return this;\n }\n\n /**\n * Mark the validator as immutable\n */\n public get immutable() {\n this.isMutable = false;\n return this;\n }\n\n /**\n * Get the instance to apply changes to.\n * By default (immutable), returns a clone so the original is unchanged.\n * When `.mutable` is set, returns `this` to mutate in place.\n */\n protected get instance(): this {\n return this.isMutable ? this : this.clone();\n }\n\n /**\n * Get the default value\n * Supports lazy evaluation via callbacks\n */\n public getDefaultValue(): any {\n return typeof this.defaultValue === \"function\" ? this.defaultValue() : this.defaultValue;\n }\n\n /**\n * Allow null as a valid value.\n *\n * Brands the return type with `{ isNullable: true }` so `Infer<>` widens\n * the inferred output to include `| null`.\n */\n public nullable(): this & { isNullable: true } {\n const instance = this.instance;\n instance.isNullable = true;\n return instance as this & { isNullable: true };\n }\n\n /**\n * Explicitly disallow null values after calling nullable.\n *\n * Brands the return type with `{ isNullable: false }` to cancel any prior\n * `.nullable()` at the type level.\n */\n public notNullable(): this & { isNullable: false } {\n const instance = this.instance;\n instance.isNullable = false;\n return instance as this & { isNullable: false };\n }\n\n /**\n * Add transformer with optional options\n *\n * @param transform - The transformer callback function\n * @param options - Optional options to pass to the transformer\n *\n * @example\n * ```ts\n * // Without options\n * v.date().addTransformer(data => data.toISOString())\n *\n * // With options\n * v.date().addTransformer(\n * (data, { options }) => dayjs(data).format(options.format),\n * { format: 'YYYY-MM-DD' }\n * )\n * ```\n */\n public addTransformer(transform: TransformerCallback, options: any = {}) {\n const instance = this.instance;\n instance.addMutableTransformer(transform, options);\n\n return instance;\n }\n\n /**\n * Add transformer with optional options\n *\n * @param transform - The transformer callback function\n * @param options - Optional options to pass to the transformer\n *\n * @example\n * ```ts\n * // Without options\n * v.date().addTransformer(data => data.toISOString())\n *\n * // With options\n * v.date().addTransformer(\n * (data, { options }) => dayjs(data).format(options.format),\n * { format: 'YYYY-MM-DD' }\n * )\n * ```\n */\n public addMutableTransformer(transform: TransformerCallback, options: any = {}) {\n this.dataTransformers.push({\n transform,\n options,\n });\n }\n\n /**\n * Transform the output value - simple one-time transformation\n *\n * @param callback - Simple callback receiving data and context\n *\n * @example\n * ```ts\n * // Simple transformation\n * v.string().outputAs(data => data.toUpperCase())\n *\n * // With context\n * v.string().outputAs((data, context) => {\n * console.log(`Transforming ${context.path}`);\n * return data.toLowerCase();\n * })\n * ```\n */\n public outputAs(callback: SimpleTransformerCallback) {\n return this.addTransformer((data, { context }) => callback(data, context));\n }\n\n /**\n * Transform output to JSON string\n *\n * Works with any validator type (string, number, date, object, array, etc.)\n *\n * @param indent - Optional indentation for pretty printing (default: 0 for compact)\n *\n * @example\n * ```ts\n * // Compact JSON\n * v.object({ name: v.string() }).toJSON()\n * // Output: '{\"name\":\"John\"}'\n *\n * // Pretty-printed JSON\n * v.array(v.object({...})).toJSON(2)\n * // Output:\n * // [\n * // {\n * // \"name\": \"John\"\n * // }\n * // ]\n *\n * // Works with any type\n * v.string().toJSON() // '\"hello\"'\n * v.number().toJSON() // '42'\n * v.date().toJSON() // '\"2024-10-26T00:00:00.000Z\"'\n * ```\n *\n * @category Transformer\n */\n public toJSON(indent?: number) {\n return this.addTransformer((data, { options }) => JSON.stringify(data, null, options.indent), {\n indent: indent ?? 0,\n });\n }\n\n /**\n * Start data transformation pipeline\n * Context is passed at runtime, not stored\n */\n public async startTransformationPipeline(data: any, context: SchemaContext) {\n for (const transformer of this.dataTransformers) {\n data = await transformer.transform(data, {\n options: transformer.options,\n context,\n });\n }\n\n return data;\n }\n\n /**\n * Set attributes text to be replaced on translations\n * If the value is an object, it will be used as the attributes list for the rule\n * If the value is a string, it will be used as the attributes list for the rule\n *\n * @example\n * v.string().attributes({\n * name: \"Name\",\n * email: \"Email\",\n * });\n * // Example 2: Add custom attributes for matches\n * v.string().matches(\"confirmPassword\").attributes({\n * matches: {\n * confirmPassword: \"Confirm Password\",\n * },\n * });\n */\n public attributes(attributes: Record<string, string | Record<string, string>>) {\n const instance = this.instance;\n for (const [key, value] of Object.entries(attributes)) {\n instance.attributesText[key] = value;\n }\n\n return instance;\n }\n\n /**\n * Define a lazy getter property for each attribute in the given object and use the config attribute translator\n */\n public transAttributes(attributes: Record<string, string>) {\n const instance = this.instance;\n for (const [key, value] of Object.entries(attributes)) {\n instance.translatedAttributes[key] = value;\n }\n\n return instance;\n }\n\n /**\n * Add description to the validator\n */\n public describe(description: string) {\n const instance = this.instance;\n instance.description = description;\n return instance;\n }\n\n /**\n * Check if this validator can handle the given value's type\n * Override this in specific validators to enable type-based routing in union validators\n *\n * Default: returns true (validator will attempt to validate any type)\n *\n * @param value - The value to check\n * @returns True if this validator can handle this type\n *\n * @example\n * ```ts\n * // StringValidator\n * public matchesType(value: any): boolean {\n * return typeof value === 'string';\n * }\n *\n * // Custom FileValidator\n * public matchesType(value: any): boolean {\n * return value instanceof UploadedFile;\n * }\n * ```\n */\n public matchesType(_value: any): boolean {\n return true; // Default: permissive, attempt to validate any type\n }\n\n /**\n * Create a copy of this validator with the same configuration\n * Copies all rules, mutators, transformers, default values, and settings\n *\n * @returns A new validator instance with copied configuration\n *\n * @example\n * ```ts\n * // Create reusable validator templates\n * const baseString = v.string().required().trim().min(3);\n * const emailField = baseString.clone().email();\n * const usernameField = baseString.clone().alphanumeric().max(20);\n *\n * // Works with all validators\n * const positiveInt = v.int().positive().required();\n * const ageField = positiveInt.clone().min(18).max(120);\n * ```\n */\n public clone(): this {\n // Create a new instance using Object.create to preserve the prototype chain\n const Constructor = this.constructor as new (...args: any[]) => this;\n const cloned = Object.create(Constructor.prototype);\n\n // Copy all BaseValidator properties\n cloned.rules = [...this.rules];\n cloned.mutators = [...this.mutators];\n cloned.dataTransformers = [...this.dataTransformers];\n cloned.defaultValue = this.defaultValue;\n cloned.shouldOmit = this.shouldOmit;\n cloned.description = this.description;\n cloned.attributesText = { ...this.attributesText };\n cloned.isNullable = this.isNullable;\n cloned.isOptional = this.isOptional;\n cloned.requiredRule = this.requiredRule; // same reference is fine — rule is treated as immutable\n cloned.catchValue = this.catchValue;\n cloned.hasCatch = this.hasCatch;\n\n return cloned;\n }\n\n /**\n * @deprecated This method is no longer needed and does nothing.\n * Empty values are now automatically skipped for validation rules by default.\n * Only presence validators (required, present, etc.) will check empty values.\n * You can safely remove this call from your code.\n */\n public ignoreEmptyValue(_ignoreEmptyValue = true) {\n // No-op for backward compatibility\n return this;\n }\n\n /**\n * Omit this field from the validated data output\n *\n * Field will still be validated but not included in the final result.\n * Useful for confirmation fields, captcha, terms acceptance, etc.\n *\n * @example\n * ```ts\n * v.object({\n * password: v.string().required(),\n * confirmPassword: v.string().required().sameAs(\"password\").omit(),\n * acceptTerms: v.boolean().required().omit(),\n * });\n * // Output: { password: \"...\" }\n * // confirmPassword and acceptTerms validated but omitted\n * ```\n */\n public omit() {\n const instance = this.instance;\n instance.shouldOmit = true;\n return instance;\n }\n\n /**\n * @alias omit\n */\n public exclude() {\n return this.omit();\n }\n\n /**\n * Check if this field should be omitted from the output\n */\n public isOmitted(): boolean {\n return this.shouldOmit;\n }\n\n /**\n * Add rule to the validator\n */\n public addRule<T extends SchemaRuleOptions = SchemaRuleOptions>(\n rule: SchemaRule<T>,\n errorMessage?: string,\n options: T = {} as T,\n ): this {\n const instance = this.instance;\n instance.addMutableRule(rule, errorMessage, options);\n return instance;\n }\n\n /**\n * Set the required-condition rule for this field.\n *\n * Unlike addRule(), this does NOT push to rules[]. The rule is stored in the\n * dedicated `requiredRule` slot and is prepended to the validation pipeline\n * at runtime. Only one required rule can be active per field — this replaces\n * any previously set required rule.\n *\n * Also marks the field as not optional (isOptional = false).\n *\n * @example\n * ```ts\n * // Used internally by required(), requiredIf(), requiredWith(), etc.\n * BaseValidator.prototype.required = function(msg) {\n * return this.setRequiredRule(requiredRule, msg);\n * };\n * ```\n */\n public setRequiredRule<T extends SchemaRuleOptions = SchemaRuleOptions>(\n rule: SchemaRule<T>,\n errorMessage?: string,\n options: T = {} as T,\n ): this {\n const instance = this.instance;\n instance.isOptional = false;\n instance.requiredRule = instance.createRule(rule, errorMessage, options);\n return instance;\n }\n\n /**\n * Add mutable rule\n */\n public addMutableRule<T extends SchemaRuleOptions = SchemaRuleOptions>(\n rule: SchemaRule<T>,\n errorMessage?: string,\n options: T = {} as T,\n ): ContextualSchemaRule<T> {\n const newRule: ContextualSchemaRule<T> = this.createRule(rule, errorMessage, options);\n\n this.rules.push(newRule);\n\n return newRule;\n }\n\n /**\n * Create new rule\n */\n protected createRule<T extends SchemaRuleOptions = SchemaRuleOptions>(\n rule: SchemaRule<T>,\n errorMessage?: string,\n options: T = {} as T,\n ): ContextualSchemaRule<T> {\n const newRule: ContextualSchemaRule<T> = {\n ...(clone(rule) as ContextualSchemaRule<T>),\n context: {\n errorMessage,\n options,\n attributesList: this.attributesText,\n translatedAttributes: this.translatedAttributes,\n translationParams: {},\n translatableParams: {},\n },\n };\n\n if (errorMessage) {\n newRule.errorMessage = errorMessage;\n }\n\n if (rule.sortOrder === undefined) {\n newRule.sortOrder = this.rules.length + 1;\n }\n\n return newRule;\n }\n\n /**\n * Use a custom or pre-built validation rule\n *\n * @param rule - The validation rule to apply\n * @param options - Rule options including errorMessage and any rule-specific options\n *\n * @example\n * ```ts\n * import { hexColorRule } from \"@warlock.js/seal\";\n *\n * v.string().useRule(hexColorRule, { errorMessage: \"Invalid color\" });\n * ```\n *\n * @example\n * ```ts\n * // With rule options\n * v.string().useRule(myCustomRule, {\n * customOption: true,\n * errorMessage: \"Custom validation failed\"\n * });\n * ```\n */\n public useRule<T extends SchemaRuleOptions = SchemaRuleOptions>(\n rule: SchemaRule<T>,\n options?: T & { errorMessage?: string },\n ) {\n const { errorMessage, ...ruleOptions } = options || ({} as any);\n return this.addRule(rule, errorMessage, ruleOptions);\n }\n\n /**\n * Define custom rule\n */\n public refine(\n callback: (\n value: any,\n context: SchemaContext,\n ) => Promise<string | undefined> | string | undefined,\n ) {\n return this.addRule({\n name: \"custom\",\n async validate(value, context) {\n const result = await callback(value, context);\n if (result) {\n this.context.errorMessage = result;\n return invalidRule(this, context);\n }\n return VALID_RULE;\n },\n });\n }\n\n /**\n * Add mutator to the validator\n */\n public addMutator(mutator: Mutator, options: any = {}) {\n const instance = this.instance;\n instance.addMutableMutator(mutator, options);\n return instance;\n }\n\n /**\n * Add mutable mutator\n */\n public addMutableMutator(mutator: Mutator, options: any = {}) {\n this.mutators.push({\n mutate: mutator,\n context: {\n options,\n ctx: {} as any,\n },\n });\n }\n\n /**\n * Set default value for the field. The default is used when the input is\n * absent (`undefined`); it then flows through the rule pipeline.\n *\n * Brands the return type with `{ hasDefault: true }` so `Infer<>` treats\n * the field as guaranteed-present even when chained with `.optional()`.\n */\n public default(value: any): this & { hasDefault: true } {\n const instance = this.instance;\n instance.defaultValue = value;\n return instance as this & { hasDefault: true };\n }\n\n /**\n * Fallback to a value when validation fails.\n *\n * Complementary to `.default()`: `.default(x)` fires when input is **absent**,\n * `.catch(y)` fires when input is **present but invalid**. Combine them when\n * you want both behaviours: `.optional().default(x).catch(y)`.\n *\n * The fallback can be a value or a callback `(errors, originalInput) => fallback`.\n * The callback variant is the only side-channel for the swallowed errors —\n * use it to log/alert before the fallback substitutes.\n *\n * Brands the return type with `{ hasCatch: true }` so `Infer<>` treats the\n * field as guaranteed-present (the catch ensures a value will always exist).\n *\n * **Scope (v1).** Catch is honoured for **leaf validators** (string, number,\n * boolean, date, …) and for fields inside containers. It is a **no-op on\n * container validators themselves** (`v.object`, `v.array`, `v.record`,\n * `v.tuple`, `v.discriminatedUnion`) — those use their own iteration logic\n * that bypasses the catch hook in `BaseValidator.validate()`.\n *\n * @example\n * ```ts\n * v.int().min(0).catch(3) // bad number → 3\n * v.string().in([\"us\", \"eu\"]).catch(\"us\") // unknown enum → \"us\"\n * v.string().catch((errors, input) => {\n * console.warn(`bad user value: ${JSON.stringify(input)}`, errors);\n * return \"anonymous\";\n * })\n * ```\n */\n public catch(\n fallback:\n any | ((errors: ValidationResult[\"errors\"], originalInput: any) => any | Promise<any>),\n ): this & { hasCatch: true } {\n const instance = this.instance;\n\n instance.catchValue = fallback;\n instance.hasCatch = true;\n\n return instance as this & { hasCatch: true };\n }\n\n /**\n * Mutate the data\n */\n public async mutate(data: any, context: SchemaContext) {\n let mutatedData = data;\n\n for (const mutator of this.mutators) {\n mutator.context.ctx = context;\n mutatedData = await mutator.mutate(mutatedData, mutator.context);\n }\n\n return mutatedData;\n }\n\n /**\n * Set the label for the validator that will be matching the :input attribute\n */\n public label(label: string) {\n const instance = this.instance;\n instance.attributesText.input = label;\n return instance;\n }\n\n /**\n * Validate the data\n */\n public async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\n if (data === null && this.isNullable) {\n return { isValid: true, errors: [], data: null };\n }\n\n const valueForRules = data ?? this.getDefaultValue();\n // Optional fields with no resolved value are absent, not values to\n // transform. Skipping here protects every mutator while still allowing\n // defaults and present values through the normal mutation pipeline.\n const mutatedData =\n this.isOptional && valueForRules === undefined\n ? undefined\n : await this.mutate(valueForRules, context);\n\n const errors: ValidationResult[\"errors\"] = [];\n let isValid = true;\n const isFirstErrorOnly = context.configurations?.firstErrorOnly ?? true;\n\n const isEmpty = isEmptyValue(valueForRules);\n\n // D8 fix (design/core-defects-found.md): for an optional field, only a\n // truly ABSENT value (`valueForRules === undefined` — the key was\n // missing, or was `null`/`undefined` and got coalesced above) may skip\n // the value rules. A PRESENT-but-empty value (e.g. `\"\"` from `?page=`)\n // must still run them, so `v.int().optional()` given `\"\"` fails instead\n // of silently handing back a string that `Infer.Output`'s\n // `number | undefined` forbids. Non-optional fields are unaffected —\n // their `requiredRule` (not nulled out by `.optional()`) already rejects\n // `\"\"` before these rules matter.\n const skipEmptyRules = this.isOptional ? valueForRules === undefined : isEmpty;\n\n // Prepend the required-condition rule if set, so it always runs first.\n // requiredRule has requiresValue = false so it runs even on empty values.\n const rulesToRun = this.requiredRule ? [this.requiredRule, ...this.rules] : this.rules;\n\n for (const rule of rulesToRun) {\n if ((rule.requiresValue ?? true) && skipEmptyRules) continue;\n\n this.setRuleAttributesList(rule);\n\n const result = await rule.validate(mutatedData, context);\n\n if (result.isValid === false) {\n isValid = false;\n errors.push({\n type: rule.name,\n error: result.error,\n input: result.path ?? context.path,\n });\n\n if (isFirstErrorOnly) {\n break;\n }\n }\n }\n\n const result: ValidationResult = {\n isValid,\n errors,\n data:\n mutatedData !== undefined\n ? await this.startTransformationPipeline(mutatedData, context)\n : undefined,\n };\n\n // Catch fallback — only on the leaf path. Container validators override\n // validate() and don't run this hook on their own outcome, so catching\n // a whole object/array/record is a no-op in v1.\n if (result.isValid === false && this.hasCatch) {\n const fallback =\n typeof this.catchValue === \"function\"\n ? await this.catchValue(result.errors, data)\n : this.catchValue;\n\n return { isValid: true, errors: [], data: fallback };\n }\n\n return result;\n }\n\n /**\n * Set rule attributes list\n */\n protected setRuleAttributesList(rule: ContextualSchemaRule) {\n rule.context.attributesList =\n typeof this.attributesText[rule.name] === \"object\"\n ? (this.attributesText[rule.name] as ValidationAttributesList)\n : this.attributesText;\n }\n\n /**\n * Standard Schema V1 compliance.\n *\n * Allows this validator to be used with any Standard Schema-aware library\n * (OpenAI structured outputs, LangGraph, TanStack Form, Conform, Valibot adapters, etc.)\n * without extra adapters.\n *\n * Delegates to the `validate()` factory so all `configureSeal()` options\n * (translations, firstErrorOnly) are picked up automatically at call time.\n *\n * Includes Standard JSON Schema support via `jsonSchema.input()` / `jsonSchema.output()`.\n *\n * ## How Standard Schema libraries consume this\n *\n * You pass the **schema object itself** to the library — they internally read\n * `schema[\"~standard\"]`. Do NOT pass `schema[\"~standard\"]` directly.\n *\n * @example\n * ```ts\n * const schema = v.object({ name: v.string().required() });\n *\n * // TanStack Form — pass schema, library reads [\"~standard\"] internally\n * const form = useForm({ validators: { onChange: schema } });\n *\n * // Conform (Remix) — same pattern\n * const [form] = useForm({ onValidate({ formData }) {\n * return parseWithStandardSchema(formData, { schema });\n * }});\n *\n * // Direct validation (lower level — most apps don't need this)\n * const result = await schema[\"~standard\"].validate({ name: \"Hasan\" });\n * // → { value: { name: \"Hasan\" } } on success\n * // → { issues: [{ message: \"...\", path: [{ key: \"name\" }] }] } on failure\n *\n * // JSON Schema for OpenAI / LangChain tool calling\n * const parameters = schema[\"~standard\"].jsonSchema.input({ target: \"openai-strict\" });\n * // → { type: \"object\", properties: {...}, required: [...], additionalProperties: false }\n * ```\n *\n * @note Cross-field rules (sameAs, requiredIf, requiredWith) rely on sibling values\n * available in the full validation context. When called on a standalone scalar validator,\n * sibling data is absent and those rules will not evaluate correctly.\n * Always call on the parent ObjectValidator for full-payload validation.\n */\n get [\"~standard\"](): StandardJSONSchemaV1.Props<TInput, TOutput> {\n return {\n version: 1,\n vendor: \"seal\",\n types: undefined as unknown as StandardSchemaV1.Types<TInput, TOutput>,\n validate: async (value: unknown) => {\n const result = await validate(this, value);\n return mapToStandardResult(result) as StandardSchemaV1.Result<TOutput>;\n },\n jsonSchema: {\n input: (options) => this.toJsonSchema(options.target),\n output: (options) => this.toJsonSchema(options.target),\n },\n };\n }\n\n /**\n * Generate a JSON Schema representation of this validator.\n *\n * Supports targets: `\"draft-2020-12\"` (default), `\"draft-07\"`, `\"openapi-3.0\"`.\n *\n * Subclasses override this to describe their specific constraints.\n * The base implementation returns `{}` (permissive — accepts anything),\n * which is correct for validators with no representable JSON Schema constraints.\n *\n * @note Rules that cannot be expressed in JSON Schema are silently omitted:\n * - Cross-field rules: sameAs, requiredIf, requiredWith, requiredWithout\n * - Custom callbacks: refine()\n * - Framework-specific runtime rules (core/cascade plugins)\n * These rules still run normally at validation time — only absent from JSON Schema.\n *\n * @example\n * ```ts\n * v.string().min(3).max(50).toJsonSchema(\"draft-2020-12\")\n * // → { type: \"string\", minLength: 3, maxLength: 50 }\n *\n * v.object({ name: v.string().required(), age: v.int().optional() })\n * .toJsonSchema(\"draft-07\")\n * // → { type: \"object\", properties: { name: { type: \"string\" }, age: { type: \"integer\" } }, required: [\"name\"] }\n * ```\n */\n public toJsonSchema(_target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n return {};\n }\n}\n"],"mappings":";;;;;;;;;;;AAyBA,IAAa,gBAAb,MAA+D;;eACtB,CAAC;kBACG,CAAC;oBAGrB;oBACA;mBACD;kBAWD;oBASD;sBAS+B,KAAK,WAAWA,YAAmB;0BAK5B,CAAC;wBAON,CAAC;8BAKG,CAAC;;;;;CAK1D,IAAW,UAAU;EACnB,KAAK,YAAY;EACjB,OAAO;CACT;;;;CAKA,IAAW,YAAY;EACrB,KAAK,YAAY;EACjB,OAAO;CACT;;;;;;CAOA,IAAc,WAAiB;EAC7B,OAAO,KAAK,YAAY,OAAO,KAAK,MAAM;CAC5C;;;;;CAMA,AAAO,kBAAuB;EAC5B,OAAO,OAAO,KAAK,iBAAiB,aAAa,KAAK,aAAa,IAAI,KAAK;CAC9E;;;;;;;CAQA,AAAO,WAAwC;EAC7C,MAAM,WAAW,KAAK;EACtB,SAAS,aAAa;EACtB,OAAO;CACT;;;;;;;CAQA,AAAO,cAA4C;EACjD,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AAO;GAAE,SAAS;GAAM,QAAQ,CAAC;GAAG,MAJlC,OAAO,KAAK,eAAe,aACvB,MAAM,KAAK,WAAW,OAAO,QAAQ,IAAI,IACzC,KAAK;EAEwC;EAGrD,OAAO;CACT;;;;CAKA,AAAU,sBAAsB,MAA4B;EAC1D,KAAK,QAAQ,iBACX,OAAO,KAAK,eAAe,KAAK,UAAU,WACrC,KAAK,eAAe,KAAK,QAC1B,KAAK;CACb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CA,KAAK,eAA4D;EAC/D,OAAO;GACL,SAAS;GACT,QAAQ;GACR,OAAO;GACP,UAAU,OAAO,UAAmB;IAElC,OAAO,oBAAoB,MADN,SAAS,MAAM,KAAK,CACR;GACnC;GACA,YAAY;IACV,QAAQ,YAAY,KAAK,aAAa,QAAQ,MAAM;IACpD,SAAS,YAAY,KAAK,aAAa,QAAQ,MAAM;GACvD;EACF;CACF;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BA,AAAO,aAAa,UAA4B,iBAAmC;EACjF,OAAO,CAAC;CACV;AACF"}
1
+ {"version":3,"file":"base-validator.mjs","names":["defaultRequiredRule"],"sources":["../../../../../../../seal/src/validators/base-validator.ts"],"sourcesContent":["import { clone } from \"@mongez/reinforcements\";\nimport { validate } from \"../factory/validate\";\nimport { VALID_RULE, invalidRule } from \"../helpers/validation-helpers\";\nimport { isEmptyValue } from \"../helpers/is-empty-value\";\nimport { requiredRule as defaultRequiredRule } from \"../rules/core/required\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport { mapToStandardResult } from \"../standard-schema/map-result\";\nimport type { StandardJSONSchemaV1, StandardSchemaV1 } from \"../standard-schema/types\";\nimport type {\n ContextualSchemaRule,\n ContextualizedMutator,\n ContextualizedTransformer,\n Mutator,\n SchemaContext,\n SchemaRule,\n SchemaRuleOptions,\n SimpleTransformerCallback,\n TransformerCallback,\n ValidationAttributesList,\n ValidationResult,\n} from \"../types\";\n\n/**\n * Base validator class - foundation for all validators\n */\nexport class BaseValidator<TInput = unknown, TOutput = TInput> {\n public rules: ContextualSchemaRule[] = [];\n public mutators: ContextualizedMutator[] = [];\n protected defaultValue: any | (() => any);\n protected description?: string;\n protected shouldOmit = false;\n protected isNullable = false;\n protected isMutable = false;\n /** Treat empty or whitespace-only form strings as an absent value. */\n protected blankIsMissing = false;\n\n /**\n * Catch state — when `hasCatch` is true and validation fails, `catchValue`\n * (or its callback result) substitutes for the failed value, and the public\n * result reports `isValid: true` with no errors.\n *\n * See `.catch()` for semantics and the v1 scope (leaf-only).\n */\n protected catchValue:\n any | ((errors: ValidationResult[\"errors\"], originalInput: any) => any | Promise<any>);\n protected hasCatch = false;\n\n /**\n * Whether the field is optional.\n * - false (default): field is required unless a requiredRule governs the condition.\n * - true: field can be absent or empty — set by calling .optional().\n *\n * Also used as a TypeScript literal brand via the optional() return type.\n */\n public isOptional = false;\n\n /**\n * The single required-condition rule for this field.\n * - null: field uses strict default (always required when not optional).\n * - set: the rule governs when the field is required (e.g., requiredIf).\n *\n * Stored separately from rules[] and prepended at validate() time.\n */\n public requiredRule: ContextualSchemaRule | null = this.createRule(defaultRequiredRule);\n\n /**\n * Pipeline to transform the mutated/original data before returning it\n */\n protected dataTransformers: ContextualizedTransformer[] = [];\n\n /**\n * Attributes text to be replaced on translations\n * If the value is an object, it will be used as the attributes list for the rule\n * If the value is a string, it will be used as the attributes list for the rule\n */\n protected attributesText: ValidationAttributesList = {};\n\n /**\n * Attributed that will be always using the attribute translator\n */\n protected translatedAttributes: Record<string, string> = {};\n\n /**\n * Mark the validator as mutable\n */\n public get mutable() {\n this.isMutable = true;\n return this;\n }\n\n /**\n * Mark the validator as immutable\n */\n public get immutable() {\n this.isMutable = false;\n return this;\n }\n\n /**\n * Get the instance to apply changes to.\n * By default (immutable), returns a clone so the original is unchanged.\n * When `.mutable` is set, returns `this` to mutate in place.\n */\n protected get instance(): this {\n return this.isMutable ? this : this.clone();\n }\n\n /**\n * Get the default value\n * Supports lazy evaluation via callbacks\n */\n public getDefaultValue(): any {\n return typeof this.defaultValue === \"function\" ? this.defaultValue() : this.defaultValue;\n }\n\n /**\n * Allow null as a valid value.\n *\n * Brands the return type with `{ isNullable: true }` so `Infer<>` widens\n * the inferred output to include `| null`.\n */\n public nullable(): this & { isNullable: true } {\n const instance = this.instance;\n instance.isNullable = true;\n return instance as this & { isNullable: true };\n }\n\n /**\n * Explicitly disallow null values after calling nullable.\n *\n * Brands the return type with `{ isNullable: false }` to cancel any prior\n * `.nullable()` at the type level.\n */\n public notNullable(): this & { isNullable: false } {\n const instance = this.instance;\n instance.isNullable = false;\n return instance as this & { isNullable: false };\n }\n\n /**\n * Add transformer with optional options\n *\n * @param transform - The transformer callback function\n * @param options - Optional options to pass to the transformer\n *\n * @example\n * ```ts\n * // Without options\n * v.date().addTransformer(data => data.toISOString())\n *\n * // With options\n * v.date().addTransformer(\n * (data, { options }) => dayjs(data).format(options.format),\n * { format: 'YYYY-MM-DD' }\n * )\n * ```\n */\n public addTransformer(transform: TransformerCallback, options: any = {}) {\n const instance = this.instance;\n instance.addMutableTransformer(transform, options);\n\n return instance;\n }\n\n /**\n * Add transformer with optional options\n *\n * @param transform - The transformer callback function\n * @param options - Optional options to pass to the transformer\n *\n * @example\n * ```ts\n * // Without options\n * v.date().addTransformer(data => data.toISOString())\n *\n * // With options\n * v.date().addTransformer(\n * (data, { options }) => dayjs(data).format(options.format),\n * { format: 'YYYY-MM-DD' }\n * )\n * ```\n */\n public addMutableTransformer(transform: TransformerCallback, options: any = {}) {\n this.dataTransformers.push({\n transform,\n options,\n });\n }\n\n /**\n * Transform the output value - simple one-time transformation\n *\n * @param callback - Simple callback receiving data and context\n *\n * @example\n * ```ts\n * // Simple transformation\n * v.string().outputAs(data => data.toUpperCase())\n *\n * // With context\n * v.string().outputAs((data, context) => {\n * console.log(`Transforming ${context.path}`);\n * return data.toLowerCase();\n * })\n * ```\n */\n public outputAs(callback: SimpleTransformerCallback) {\n return this.addTransformer((data, { context }) => callback(data, context));\n }\n\n /**\n * Transform output to JSON string\n *\n * Works with any validator type (string, number, date, object, array, etc.)\n *\n * @param indent - Optional indentation for pretty printing (default: 0 for compact)\n *\n * @example\n * ```ts\n * // Compact JSON\n * v.object({ name: v.string() }).toJSON()\n * // Output: '{\"name\":\"John\"}'\n *\n * // Pretty-printed JSON\n * v.array(v.object({...})).toJSON(2)\n * // Output:\n * // [\n * // {\n * // \"name\": \"John\"\n * // }\n * // ]\n *\n * // Works with any type\n * v.string().toJSON() // '\"hello\"'\n * v.number().toJSON() // '42'\n * v.date().toJSON() // '\"2024-10-26T00:00:00.000Z\"'\n * ```\n *\n * @category Transformer\n */\n public toJSON(indent?: number) {\n return this.addTransformer((data, { options }) => JSON.stringify(data, null, options.indent), {\n indent: indent ?? 0,\n });\n }\n\n /**\n * Start data transformation pipeline\n * Context is passed at runtime, not stored\n */\n public async startTransformationPipeline(data: any, context: SchemaContext) {\n for (const transformer of this.dataTransformers) {\n data = await transformer.transform(data, {\n options: transformer.options,\n context,\n });\n }\n\n return data;\n }\n\n /**\n * Set attributes text to be replaced on translations\n * If the value is an object, it will be used as the attributes list for the rule\n * If the value is a string, it will be used as the attributes list for the rule\n *\n * @example\n * v.string().attributes({\n * name: \"Name\",\n * email: \"Email\",\n * });\n * // Example 2: Add custom attributes for matches\n * v.string().matches(\"confirmPassword\").attributes({\n * matches: {\n * confirmPassword: \"Confirm Password\",\n * },\n * });\n */\n public attributes(attributes: Record<string, string | Record<string, string>>) {\n const instance = this.instance;\n for (const [key, value] of Object.entries(attributes)) {\n instance.attributesText[key] = value;\n }\n\n return instance;\n }\n\n /**\n * Define a lazy getter property for each attribute in the given object and use the config attribute translator\n */\n public transAttributes(attributes: Record<string, string>) {\n const instance = this.instance;\n for (const [key, value] of Object.entries(attributes)) {\n instance.translatedAttributes[key] = value;\n }\n\n return instance;\n }\n\n /**\n * Add description to the validator\n */\n public describe(description: string) {\n const instance = this.instance;\n instance.description = description;\n return instance;\n }\n\n /**\n * Check if this validator can handle the given value's type\n * Override this in specific validators to enable type-based routing in union validators\n *\n * Default: returns true (validator will attempt to validate any type)\n *\n * @param value - The value to check\n * @returns True if this validator can handle this type\n *\n * @example\n * ```ts\n * // StringValidator\n * public matchesType(value: any): boolean {\n * return typeof value === 'string';\n * }\n *\n * // Custom FileValidator\n * public matchesType(value: any): boolean {\n * return value instanceof UploadedFile;\n * }\n * ```\n */\n public matchesType(_value: any): boolean {\n return true; // Default: permissive, attempt to validate any type\n }\n\n /**\n * Create a copy of this validator with the same configuration\n * Copies all rules, mutators, transformers, default values, and settings\n *\n * @returns A new validator instance with copied configuration\n *\n * @example\n * ```ts\n * // Create reusable validator templates\n * const baseString = v.string().required().trim().min(3);\n * const emailField = baseString.clone().email();\n * const usernameField = baseString.clone().alphanumeric().max(20);\n *\n * // Works with all validators\n * const positiveInt = v.int().positive().required();\n * const ageField = positiveInt.clone().min(18).max(120);\n * ```\n */\n public clone(): this {\n // Create a new instance using Object.create to preserve the prototype chain\n const Constructor = this.constructor as new (...args: any[]) => this;\n const cloned = Object.create(Constructor.prototype);\n\n // Copy all BaseValidator properties\n cloned.rules = [...this.rules];\n cloned.mutators = [...this.mutators];\n cloned.dataTransformers = [...this.dataTransformers];\n cloned.defaultValue = this.defaultValue;\n cloned.shouldOmit = this.shouldOmit;\n cloned.description = this.description;\n cloned.attributesText = { ...this.attributesText };\n cloned.translatedAttributes = { ...this.translatedAttributes };\n cloned.isNullable = this.isNullable;\n cloned.isOptional = this.isOptional;\n cloned.blankIsMissing = this.blankIsMissing;\n cloned.requiredRule = this.requiredRule; // same reference is fine — rule is treated as immutable\n cloned.catchValue = this.catchValue;\n cloned.hasCatch = this.hasCatch;\n\n return cloned;\n }\n\n /**\n * @deprecated This method is no longer needed and does nothing.\n * Empty values are now automatically skipped for validation rules by default.\n * Only presence validators (required, present, etc.) will check empty values.\n * You can safely remove this call from your code.\n */\n public ignoreEmptyValue(_ignoreEmptyValue = true) {\n // No-op for backward compatibility\n return this;\n }\n\n /**\n * Omit this field from the validated data output\n *\n * Field will still be validated but not included in the final result.\n * Useful for confirmation fields, captcha, terms acceptance, etc.\n *\n * @example\n * ```ts\n * v.object({\n * password: v.string().required(),\n * confirmPassword: v.string().required().sameAs(\"password\").omit(),\n * acceptTerms: v.boolean().required().omit(),\n * });\n * // Output: { password: \"...\" }\n * // confirmPassword and acceptTerms validated but omitted\n * ```\n */\n public omit() {\n const instance = this.instance;\n instance.shouldOmit = true;\n return instance;\n }\n\n /**\n * @alias omit\n */\n public exclude() {\n return this.omit();\n }\n\n /**\n * Check if this field should be omitted from the output\n */\n public isOmitted(): boolean {\n return this.shouldOmit;\n }\n\n /**\n * Add rule to the validator\n */\n public addRule<T extends SchemaRuleOptions = SchemaRuleOptions>(\n rule: SchemaRule<T>,\n errorMessage?: string,\n options: T = {} as T,\n ): this {\n const instance = this.instance;\n instance.addMutableRule(rule, errorMessage, options);\n return instance;\n }\n\n /**\n * Set the required-condition rule for this field.\n *\n * Unlike addRule(), this does NOT push to rules[]. The rule is stored in the\n * dedicated `requiredRule` slot and is prepended to the validation pipeline\n * at runtime. Only one required rule can be active per field — this replaces\n * any previously set required rule.\n *\n * Also marks the field as not optional (isOptional = false).\n *\n * @example\n * ```ts\n * // Used internally by required(), requiredIf(), requiredWith(), etc.\n * BaseValidator.prototype.required = function(msg) {\n * return this.setRequiredRule(requiredRule, msg);\n * };\n * ```\n */\n public setRequiredRule<T extends SchemaRuleOptions = SchemaRuleOptions>(\n rule: SchemaRule<T>,\n errorMessage?: string,\n options: T = {} as T,\n ): this {\n const instance = this.instance;\n instance.isOptional = false;\n instance.requiredRule = instance.createRule(rule, errorMessage, options);\n return instance;\n }\n\n /**\n * Add mutable rule\n */\n public addMutableRule<T extends SchemaRuleOptions = SchemaRuleOptions>(\n rule: SchemaRule<T>,\n errorMessage?: string,\n options: T = {} as T,\n ): ContextualSchemaRule<T> {\n const newRule: ContextualSchemaRule<T> = this.createRule(rule, errorMessage, options);\n\n this.rules.push(newRule);\n\n return newRule;\n }\n\n /**\n * Create new rule\n */\n protected createRule<T extends SchemaRuleOptions = SchemaRuleOptions>(\n rule: SchemaRule<T>,\n errorMessage?: string,\n options: T = {} as T,\n ): ContextualSchemaRule<T> {\n const newRule: ContextualSchemaRule<T> = {\n ...(clone(rule) as ContextualSchemaRule<T>),\n context: {\n errorMessage,\n options,\n attributesList: this.attributesText,\n translatedAttributes: this.translatedAttributes,\n translationParams: {},\n translatableParams: {},\n },\n };\n\n if (errorMessage) {\n newRule.errorMessage = errorMessage;\n }\n\n if (rule.sortOrder === undefined) {\n newRule.sortOrder = this.rules.length + 1;\n }\n\n return newRule;\n }\n\n /**\n * Use a custom or pre-built validation rule\n *\n * @param rule - The validation rule to apply\n * @param options - Rule options including errorMessage and any rule-specific options\n *\n * @example\n * ```ts\n * import { hexColorRule } from \"@warlock.js/seal\";\n *\n * v.string().useRule(hexColorRule, { errorMessage: \"Invalid color\" });\n * ```\n *\n * @example\n * ```ts\n * // With rule options\n * v.string().useRule(myCustomRule, {\n * customOption: true,\n * errorMessage: \"Custom validation failed\"\n * });\n * ```\n */\n public useRule<T extends SchemaRuleOptions = SchemaRuleOptions>(\n rule: SchemaRule<T>,\n options?: T & { errorMessage?: string },\n ) {\n const { errorMessage, ...ruleOptions } = options || ({} as any);\n return this.addRule(rule, errorMessage, ruleOptions);\n }\n\n /**\n * Define custom rule\n */\n public refine(\n callback: (\n value: any,\n context: SchemaContext,\n ) => Promise<string | undefined> | string | undefined,\n ) {\n return this.addRule({\n name: \"custom\",\n async validate(value, context) {\n const result = await callback(value, context);\n if (result) {\n this.context.errorMessage = result;\n return invalidRule(this, context);\n }\n return VALID_RULE;\n },\n });\n }\n\n /**\n * Add mutator to the validator\n */\n public addMutator(mutator: Mutator, options: any = {}) {\n const instance = this.instance;\n instance.addMutableMutator(mutator, options);\n return instance;\n }\n\n /**\n * Add mutable mutator\n */\n public addMutableMutator(mutator: Mutator, options: any = {}) {\n this.mutators.push({\n mutate: mutator,\n context: {\n options,\n ctx: {} as any,\n },\n });\n }\n\n /**\n * Set default value for the field. The default is used when the input is\n * absent (`undefined`); it then flows through the rule pipeline.\n *\n * Brands the return type with `{ hasDefault: true }` so `Infer<>` treats\n * the field as guaranteed-present even when chained with `.optional()`.\n */\n public default(value: any): this & { hasDefault: true } {\n const instance = this.instance;\n instance.defaultValue = value;\n return instance as this & { hasDefault: true };\n }\n\n /**\n * Fallback to a value when validation fails.\n *\n * Complementary to `.default()`: `.default(x)` fires when input is **absent**,\n * `.catch(y)` fires when input is **present but invalid**. Combine them when\n * you want both behaviours: `.optional().default(x).catch(y)`.\n *\n * The fallback can be a value or a callback `(errors, originalInput) => fallback`.\n * The callback variant is the only side-channel for the swallowed errors —\n * use it to log/alert before the fallback substitutes.\n *\n * Brands the return type with `{ hasCatch: true }` so `Infer<>` treats the\n * field as guaranteed-present (the catch ensures a value will always exist).\n *\n * **Scope (v1).** Catch is honoured for **leaf validators** (string, number,\n * boolean, date, …) and for fields inside containers. It is a **no-op on\n * container validators themselves** (`v.object`, `v.array`, `v.record`,\n * `v.tuple`, `v.discriminatedUnion`) — those use their own iteration logic\n * that bypasses the catch hook in `BaseValidator.validate()`.\n *\n * @example\n * ```ts\n * v.int().min(0).catch(3) // bad number → 3\n * v.string().in([\"us\", \"eu\"]).catch(\"us\") // unknown enum → \"us\"\n * v.string().catch((errors, input) => {\n * console.warn(`bad user value: ${JSON.stringify(input)}`, errors);\n * return \"anonymous\";\n * })\n * ```\n */\n public catch(\n fallback:\n any | ((errors: ValidationResult[\"errors\"], originalInput: any) => any | Promise<any>),\n ): this & { hasCatch: true } {\n const instance = this.instance;\n\n instance.catchValue = fallback;\n instance.hasCatch = true;\n\n return instance as this & { hasCatch: true };\n }\n\n /**\n * Mutate the data\n */\n public async mutate(data: any, context: SchemaContext) {\n let mutatedData = data;\n\n for (const mutator of this.mutators) {\n mutator.context.ctx = context;\n mutatedData = await mutator.mutate(mutatedData, mutator.context);\n }\n\n return mutatedData;\n }\n\n /**\n * Set the label for the validator that will be matching the :input attribute\n */\n public label(label: string) {\n const instance = this.instance;\n instance.attributesText.input = label;\n return instance;\n }\n\n /**\n * Validate the data\n */\n public async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\n if (data === null && this.isNullable) {\n return { isValid: true, errors: [], data: null };\n }\n\n const isBlank = this.blankIsMissing && typeof data === \"string\" && data.trim() === \"\";\n\n if (isBlank && this.isNullable) {\n return { isValid: true, errors: [], data: null };\n }\n\n const valueForRules = (isBlank ? undefined : data) ?? this.getDefaultValue();\n // Optional fields with no resolved value are absent, not values to\n // transform. Skipping here protects every mutator while still allowing\n // defaults and present values through the normal mutation pipeline.\n const mutatedData =\n this.isOptional && valueForRules === undefined\n ? undefined\n : await this.mutate(valueForRules, context);\n\n const errors: ValidationResult[\"errors\"] = [];\n let isValid = true;\n const isFirstErrorOnly = context.configurations?.firstErrorOnly ?? true;\n\n const isEmpty = isEmptyValue(valueForRules);\n\n // D8 fix (design/core-defects-found.md): for an optional field, only a\n // truly ABSENT value (`valueForRules === undefined` — the key was\n // missing, or was `null`/`undefined` and got coalesced above) may skip\n // the value rules. A PRESENT-but-empty value (e.g. `\"\"` from `?page=`)\n // must still run them, so `v.int().optional()` given `\"\"` fails instead\n // of silently handing back a string that `Infer.Output`'s\n // `number | undefined` forbids. Non-optional fields are unaffected —\n // their `requiredRule` (not nulled out by `.optional()`) already rejects\n // `\"\"` before these rules matter.\n const skipEmptyRules = this.isOptional ? valueForRules === undefined : isEmpty;\n\n // Prepend the required-condition rule if set, so it always runs first.\n // requiredRule has requiresValue = false so it runs even on empty values.\n const rulesToRun = this.requiredRule ? [this.requiredRule, ...this.rules] : this.rules;\n\n for (const rule of rulesToRun) {\n if ((rule.requiresValue ?? true) && skipEmptyRules) continue;\n\n this.setRuleAttributesList(rule);\n\n const result = await rule.validate(mutatedData, context);\n\n if (result.isValid === false) {\n isValid = false;\n errors.push({\n type: rule.name,\n error: result.error,\n input: result.path ?? context.path,\n });\n\n if (isFirstErrorOnly) {\n break;\n }\n }\n }\n\n const result: ValidationResult = {\n isValid,\n errors,\n data:\n mutatedData !== undefined\n ? await this.startTransformationPipeline(mutatedData, context)\n : undefined,\n };\n\n // Catch fallback — only on the leaf path. Container validators override\n // validate() and don't run this hook on their own outcome, so catching\n // a whole object/array/record is a no-op in v1.\n if (result.isValid === false && this.hasCatch) {\n const fallback =\n typeof this.catchValue === \"function\"\n ? await this.catchValue(result.errors, data)\n : this.catchValue;\n\n return { isValid: true, errors: [], data: fallback };\n }\n\n return result;\n }\n\n /**\n * Set rule attributes list\n */\n protected setRuleAttributesList(rule: ContextualSchemaRule) {\n rule.context.attributesList =\n typeof this.attributesText[rule.name] === \"object\"\n ? (this.attributesText[rule.name] as ValidationAttributesList)\n : this.attributesText;\n rule.context.translatedAttributes = this.translatedAttributes;\n }\n\n /**\n * Standard Schema V1 compliance.\n *\n * Allows this validator to be used with any Standard Schema-aware library\n * (OpenAI structured outputs, LangGraph, TanStack Form, Conform, Valibot adapters, etc.)\n * without extra adapters.\n *\n * Delegates to the `validate()` factory so all `configureSeal()` options\n * (translations, firstErrorOnly) are picked up automatically at call time.\n *\n * Includes Standard JSON Schema support via `jsonSchema.input()` / `jsonSchema.output()`.\n *\n * ## How Standard Schema libraries consume this\n *\n * You pass the **schema object itself** to the library — they internally read\n * `schema[\"~standard\"]`. Do NOT pass `schema[\"~standard\"]` directly.\n *\n * @example\n * ```ts\n * const schema = v.object({ name: v.string().required() });\n *\n * // TanStack Form — pass schema, library reads [\"~standard\"] internally\n * const form = useForm({ validators: { onChange: schema } });\n *\n * // Conform (Remix) — same pattern\n * const [form] = useForm({ onValidate({ formData }) {\n * return parseWithStandardSchema(formData, { schema });\n * }});\n *\n * // Direct validation (lower level — most apps don't need this)\n * const result = await schema[\"~standard\"].validate({ name: \"Hasan\" });\n * // → { value: { name: \"Hasan\" } } on success\n * // → { issues: [{ message: \"...\", path: [{ key: \"name\" }] }] } on failure\n *\n * // JSON Schema for OpenAI / LangChain tool calling\n * const parameters = schema[\"~standard\"].jsonSchema.input({ target: \"openai-strict\" });\n * // → { type: \"object\", properties: {...}, required: [...], additionalProperties: false }\n * ```\n *\n * @note Cross-field rules (sameAs, requiredIf, requiredWith) rely on sibling values\n * available in the full validation context. When called on a standalone scalar validator,\n * sibling data is absent and those rules will not evaluate correctly.\n * Always call on the parent ObjectValidator for full-payload validation.\n */\n get [\"~standard\"](): StandardJSONSchemaV1.Props<TInput, TOutput> {\n return {\n version: 1,\n vendor: \"seal\",\n types: undefined as unknown as StandardSchemaV1.Types<TInput, TOutput>,\n validate: async (value: unknown) => {\n const result = await validate(this, value);\n return mapToStandardResult(result) as StandardSchemaV1.Result<TOutput>;\n },\n jsonSchema: {\n input: (options) => this.toJsonSchema(options.target),\n output: (options) => this.toJsonSchema(options.target),\n },\n };\n }\n\n /**\n * Generate a JSON Schema representation of this validator.\n *\n * Supports targets: `\"draft-2020-12\"` (default), `\"draft-07\"`, `\"openapi-3.0\"`.\n *\n * Subclasses override this to describe their specific constraints.\n * The base implementation returns `{}` (permissive — accepts anything),\n * which is correct for validators with no representable JSON Schema constraints.\n *\n * @note Rules that cannot be expressed in JSON Schema are silently omitted:\n * - Cross-field rules: sameAs, requiredIf, requiredWith, requiredWithout\n * - Custom callbacks: refine()\n * - Framework-specific runtime rules (core/cascade plugins)\n * These rules still run normally at validation time — only absent from JSON Schema.\n *\n * @example\n * ```ts\n * v.string().min(3).max(50).toJsonSchema(\"draft-2020-12\")\n * // → { type: \"string\", minLength: 3, maxLength: 50 }\n *\n * v.object({ name: v.string().required(), age: v.int().optional() })\n * .toJsonSchema(\"draft-07\")\n * // → { type: \"object\", properties: { name: { type: \"string\" }, age: { type: \"integer\" } }, required: [\"name\"] }\n * ```\n */\n public toJsonSchema(_target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n return {};\n }\n}\n"],"mappings":";;;;;;;;;;;AAyBA,IAAa,gBAAb,MA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H,YAAA,CAAa,MAAA,GAAQ,gBAAA,GAAqC,gBAAA;AAAA"}
1
+ {"version":3,"file":"boolean-validator.d.mts","names":[],"sources":["../../../../../../../seal/src/validators/boolean-validator.ts"],"mappings":";;;;;;AA4BA;;;;;cAAa,gBAAA,SAAyB,kBAAA;cACjB,YAAA;EADmC;;;EAU/C,WAAA,CAAY,KAAA;EAAZ;;;;;;;;;;;;;;;;;;EAAA,QAsBC,kBAAA;EA4CD;EAzBA,QAAA,CAAS,YAAA;EAyBsB;EApB/B,UAAA,CAAW,KAAA,UAAe,KAAA,OAAY,YAAA;EA2B7B;EAtBT,cAAA,CAAe,KAAA,UAAe,KAAA,OAAY,YAAA;EA2B/B;EAtBX,kBAAA,CAAmB,KAAA,UAAe,YAAA;EAsBI;EAjBtC,iBAAA,CAAkB,KAAA,UAAe,YAAA;EAsBlB;EAjBf,eAAA,CAAgB,KAAA,UAAe,YAAA;EAiBW;EAV1C,QAAA,CAAS,YAAA;EAeU;EAVnB,UAAA,CAAW,KAAA,UAAe,KAAA,OAAY,YAAA;EAetC;EAVA,cAAA,CAAe,KAAA,UAAe,KAAA,OAAY,YAAA;EAUT;EALjC,kBAAA,CAAmB,KAAA,UAAe,YAAA;EAUlB;EALhB,iBAAA,CAAkB,KAAA,UAAe,YAAA;EA+BjC;EA1BA,eAAA,CAAgB,KAAA,UAAe,YAAA;EAoC/B;;;;;;;;;AA2BmF;;;;;;;;;;;EArCnF,MAAA;IACoD,SAAA;EAAA;;;;;EASpD,UAAA,CAAW,YAAA;;;;;EAQX,WAAA,CAAY,YAAA;;;;;;;;;;;;;;;;EAmBH,YAAA,CAAa,MAAA,GAAQ,gBAAA,GAAqC,gBAAA;AAAA"}
@@ -18,6 +18,7 @@ import "../rules/scalar/index.mjs";
18
18
  var BooleanValidator = class extends PrimitiveValidator {
19
19
  constructor(errorMessage) {
20
20
  super();
21
+ this.blankIsMissing = true;
21
22
  this.addMutableRule(booleanRule, errorMessage);
22
23
  }
23
24
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"boolean-validator.mjs","names":[],"sources":["../../../../../../../seal/src/validators/boolean-validator.ts"],"sourcesContent":["import { booleanCoerceMutator, formBooleanMutator } from \"../mutators/boolean-mutators\";\nimport {\n acceptedIfPresentRule,\n acceptedIfRequiredRule,\n acceptedIfRule,\n acceptedRule,\n acceptedUnlessRule,\n acceptedWithoutRule,\n declinedIfPresentRule,\n declinedIfRequiredRule,\n declinedIfRule,\n declinedRule,\n declinedUnlessRule,\n declinedWithoutRule,\n} from \"../rules/scalar\";\nimport { booleanRule } from \"../rules\";\nimport { PrimitiveValidator } from \"./primitive-validator\";\nimport { applyNullable } from \"../standard-schema/json-schema\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport type { SchemaRule, SchemaRuleOptions } from \"../types\";\n\n/**\n * Boolean validator class\n *\n * Extends PrimitiveValidator — inherits enum/in/oneOf/allowsOnly/forbids/notIn.\n * Defines accepted/declined directly as real methods (not ScalarValidator field copies)\n * so they survive cloning correctly.\n */\nexport class BooleanValidator extends PrimitiveValidator {\n public constructor(errorMessage?: string) {\n super();\n this.addMutableRule(booleanRule, errorMessage);\n }\n\n /**\n * Check if value is a boolean type\n */\n public matchesType(value: any): boolean {\n return typeof value === \"boolean\";\n }\n\n /**\n * Add a rule from the accepted/declined family, opting the validator into\n * form-boolean parsing.\n *\n * Calling ANY `accepted*`/`declined*` method on `v.boolean()` adds (once,\n * idempotently — checked by mutator identity so chaining several of these\n * methods never stacks duplicates) `formBooleanMutator`, which runs before\n * the type rule and converts the accepted set (`1`, `\"1\"`, `true`,\n * `\"true\"`, `\"yes\"`, `\"y\"`, `\"on\"`, `\"Yes\"`, `\"Y\"`, `\"On\"`) to `true` and\n * the declined set (`0`, `\"0\"`, `false`, `\"false\"`, `\"no\"`, `\"n\"`, `\"off\"`,\n * `\"No\"`, `\"N\"`, `\"Off\"`) to `false`; any other value passes through\n * unchanged and is rejected by the strict type rule as before.\n *\n * The mutator and the rule are added to the SAME resolved instance in one\n * pass — resolving `this.instance` twice (once per `addRule`/`addMutator`\n * call) would clone twice on an immutable validator and silently drop one\n * of the two additions.\n */\n private addFormBooleanRule<T extends SchemaRuleOptions = SchemaRuleOptions>(\n rule: SchemaRule<T>,\n errorMessage?: string,\n options: T = {} as T,\n ): this {\n const instance = this.instance;\n\n if (!instance.mutators.some((mutator) => mutator.mutate === formBooleanMutator)) {\n instance.addMutableMutator(formBooleanMutator);\n }\n\n instance.addMutableRule(rule, errorMessage, options);\n\n return instance;\n }\n\n // ==================== Accepted ====================\n\n /** Value must be accepted (true, \"yes\", 1, \"on\", etc. — form strings are parsed into a real boolean first) */\n public accepted(errorMessage?: string) {\n return this.addFormBooleanRule(acceptedRule, errorMessage);\n }\n\n /** Value must be accepted if another field equals a value */\n public acceptedIf(field: string, value: any, errorMessage?: string) {\n return this.addFormBooleanRule(acceptedIfRule, errorMessage, { field, value });\n }\n\n /** Value must be accepted unless another field equals a value */\n public acceptedUnless(field: string, value: any, errorMessage?: string) {\n return this.addFormBooleanRule(acceptedUnlessRule, errorMessage, { field, value });\n }\n\n /** Value must be accepted if another field is required */\n public acceptedIfRequired(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(acceptedIfRequiredRule, errorMessage, { field });\n }\n\n /** Value must be accepted if another field is present */\n public acceptedIfPresent(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(acceptedIfPresentRule, errorMessage, { field });\n }\n\n /** Value must be accepted if another field is missing */\n public acceptedWithout(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(acceptedWithoutRule, errorMessage, { field });\n }\n\n // ==================== Declined ====================\n\n /** Value must be declined (false, \"no\", 0, \"off\", etc. — form strings are parsed into a real boolean first) */\n public declined(errorMessage?: string) {\n return this.addFormBooleanRule(declinedRule, errorMessage);\n }\n\n /** Value must be declined if another field equals a value */\n public declinedIf(field: string, value: any, errorMessage?: string) {\n return this.addFormBooleanRule(declinedIfRule, errorMessage, { field, value });\n }\n\n /** Value must be declined unless another field equals a value */\n public declinedUnless(field: string, value: any, errorMessage?: string) {\n return this.addFormBooleanRule(declinedUnlessRule, errorMessage, { field, value });\n }\n\n /** Value must be declined if another field is required */\n public declinedIfRequired(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(declinedIfRequiredRule, errorMessage, { field });\n }\n\n /** Value must be declined if another field is present */\n public declinedIfPresent(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(declinedIfPresentRule, errorMessage, { field });\n }\n\n /** Value must be declined if another field is missing */\n public declinedWithout(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(declinedWithoutRule, errorMessage, { field });\n }\n\n // ==================== Coercion ====================\n\n /**\n * Opt in to coercion: an exact query-string-shaped boolean is converted to a\n * real boolean **before** the type rules run; any other value passes through\n * unchanged so bad input still fails the type rule.\n *\n * Converts exactly `\"true\"` / `\"1\"` / `1` → `true` and `\"false\"` / `\"0\"` / `0`\n * → `false`. Case-sensitive, no trimming — `\"TRUE\"`, `\"yes\"`, `\"on\"`, `\"\"`, and\n * `2` all pass through unchanged and fail the type rule. `v.boolean()` does\n * **not** coerce by default; this only takes effect when explicitly chained.\n * For form-style truthy strings like `\"yes\"` / `\"on\"`, use `.accepted()` /\n * `.declined()` instead — those methods opt into their own form-boolean\n * parsing (a wider value set, case-insensitive on a few forms) and then\n * apply the accepted/declined pass-fail rule on top of the parsed boolean.\n *\n * The output type is unchanged (`Infer<>` keys off the validator class), so\n * `v.boolean().coerce()` still infers `boolean`.\n *\n * @example\n * v.boolean().coerce() // \"true\" → true; \"1\" → true; \"0\" → false; \"yes\" → invalid\n */\n public coerce() {\n return this.addMutator(booleanCoerceMutator) as this & { isCoerced: true };\n }\n\n // ==================== Strict boolean checks ====================\n\n /**\n * Value must be strictly true (not \"yes\", \"on\", 1, etc.)\n * @alias accepted - strict version\n */\n public mustBeTrue(errorMessage?: string) {\n return this.equal(true, errorMessage);\n }\n\n /**\n * Value must be strictly false (not \"no\", \"off\", 0, etc.)\n * @alias declined - strict version\n */\n public mustBeFalse(errorMessage?: string) {\n return this.equal(false, errorMessage);\n }\n\n /**\n * @inheritdoc\n *\n * @note accepted/declined rules and all cross-field boolean rules\n * are not representable in JSON Schema and are silently omitted.\n *\n * @example\n * ```ts\n * v.boolean().toJsonSchema(\"draft-2020-12\")\n * // → { type: \"boolean\" }\n *\n * v.boolean().nullable().toJsonSchema(\"openapi-3.0\")\n * // → { type: \"boolean\", nullable: true }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const schema: JsonSchemaResult = { type: \"boolean\" };\n if (this.isNullable) applyNullable(schema, target);\n return schema;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,IAAa,mBAAb,cAAsC,mBAAmB;CACvD,AAAO,YAAY,cAAuB;EACxC,MAAM;EACN,KAAK,eAAe,aAAa,YAAY;CAC/C;;;;CAKA,AAAO,YAAY,OAAqB;EACtC,OAAO,OAAO,UAAU;CAC1B;;;;;;;;;;;;;;;;;;;CAoBA,AAAQ,mBACN,MACA,cACA,UAAa,CAAC,GACR;EACN,MAAM,WAAW,KAAK;EAEtB,IAAI,CAAC,SAAS,SAAS,MAAM,YAAY,QAAQ,WAAW,kBAAkB,GAC5E,SAAS,kBAAkB,kBAAkB;EAG/C,SAAS,eAAe,MAAM,cAAc,OAAO;EAEnD,OAAO;CACT;;CAKA,AAAO,SAAS,cAAuB;EACrC,OAAO,KAAK,mBAAmB,cAAc,YAAY;CAC3D;;CAGA,AAAO,WAAW,OAAe,OAAY,cAAuB;EAClE,OAAO,KAAK,mBAAmB,gBAAgB,cAAc;GAAE;GAAO;EAAM,CAAC;CAC/E;;CAGA,AAAO,eAAe,OAAe,OAAY,cAAuB;EACtE,OAAO,KAAK,mBAAmB,oBAAoB,cAAc;GAAE;GAAO;EAAM,CAAC;CACnF;;CAGA,AAAO,mBAAmB,OAAe,cAAuB;EAC9D,OAAO,KAAK,mBAAmB,wBAAwB,cAAc,EA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ator.mjs","names":[],"sources":["../../../../../../../seal/src/validators/boolean-validator.ts"],"sourcesContent":["import { booleanCoerceMutator, formBooleanMutator } from \"../mutators/boolean-mutators\";\nimport {\n acceptedIfPresentRule,\n acceptedIfRequiredRule,\n acceptedIfRule,\n acceptedRule,\n acceptedUnlessRule,\n acceptedWithoutRule,\n declinedIfPresentRule,\n declinedIfRequiredRule,\n declinedIfRule,\n declinedRule,\n declinedUnlessRule,\n declinedWithoutRule,\n} from \"../rules/scalar\";\nimport { booleanRule } from \"../rules\";\nimport { PrimitiveValidator } from \"./primitive-validator\";\nimport { applyNullable } from \"../standard-schema/json-schema\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport type { SchemaRule, SchemaRuleOptions } from \"../types\";\n\n/**\n * Boolean validator class\n *\n * Extends PrimitiveValidator — inherits enum/in/oneOf/allowsOnly/forbids/notIn.\n * Defines accepted/declined directly as real methods (not ScalarValidator field copies)\n * so they survive cloning correctly.\n */\nexport class BooleanValidator extends PrimitiveValidator {\n public constructor(errorMessage?: string) {\n super();\n this.blankIsMissing = true;\n this.addMutableRule(booleanRule, errorMessage);\n }\n\n /**\n * Check if value is a boolean type\n */\n public matchesType(value: any): boolean {\n return typeof value === \"boolean\";\n }\n\n /**\n * Add a rule from the accepted/declined family, opting the validator into\n * form-boolean parsing.\n *\n * Calling ANY `accepted*`/`declined*` method on `v.boolean()` adds (once,\n * idempotently — checked by mutator identity so chaining several of these\n * methods never stacks duplicates) `formBooleanMutator`, which runs before\n * the type rule and converts the accepted set (`1`, `\"1\"`, `true`,\n * `\"true\"`, `\"yes\"`, `\"y\"`, `\"on\"`, `\"Yes\"`, `\"Y\"`, `\"On\"`) to `true` and\n * the declined set (`0`, `\"0\"`, `false`, `\"false\"`, `\"no\"`, `\"n\"`, `\"off\"`,\n * `\"No\"`, `\"N\"`, `\"Off\"`) to `false`; any other value passes through\n * unchanged and is rejected by the strict type rule as before.\n *\n * The mutator and the rule are added to the SAME resolved instance in one\n * pass — resolving `this.instance` twice (once per `addRule`/`addMutator`\n * call) would clone twice on an immutable validator and silently drop one\n * of the two additions.\n */\n private addFormBooleanRule<T extends SchemaRuleOptions = SchemaRuleOptions>(\n rule: SchemaRule<T>,\n errorMessage?: string,\n options: T = {} as T,\n ): this {\n const instance = this.instance;\n\n if (!instance.mutators.some((mutator) => mutator.mutate === formBooleanMutator)) {\n instance.addMutableMutator(formBooleanMutator);\n }\n\n instance.addMutableRule(rule, errorMessage, options);\n\n return instance;\n }\n\n // ==================== Accepted ====================\n\n /** Value must be accepted (true, \"yes\", 1, \"on\", etc. — form strings are parsed into a real boolean first) */\n public accepted(errorMessage?: string) {\n return this.addFormBooleanRule(acceptedRule, errorMessage);\n }\n\n /** Value must be accepted if another field equals a value */\n public acceptedIf(field: string, value: any, errorMessage?: string) {\n return this.addFormBooleanRule(acceptedIfRule, errorMessage, { field, value });\n }\n\n /** Value must be accepted unless another field equals a value */\n public acceptedUnless(field: string, value: any, errorMessage?: string) {\n return this.addFormBooleanRule(acceptedUnlessRule, errorMessage, { field, value });\n }\n\n /** Value must be accepted if another field is required */\n public acceptedIfRequired(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(acceptedIfRequiredRule, errorMessage, { field });\n }\n\n /** Value must be accepted if another field is present */\n public acceptedIfPresent(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(acceptedIfPresentRule, errorMessage, { field });\n }\n\n /** Value must be accepted if another field is missing */\n public acceptedWithout(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(acceptedWithoutRule, errorMessage, { field });\n }\n\n // ==================== Declined ====================\n\n /** Value must be declined (false, \"no\", 0, \"off\", etc. — form strings are parsed into a real boolean first) */\n public declined(errorMessage?: string) {\n return this.addFormBooleanRule(declinedRule, errorMessage);\n }\n\n /** Value must be declined if another field equals a value */\n public declinedIf(field: string, value: any, errorMessage?: string) {\n return this.addFormBooleanRule(declinedIfRule, errorMessage, { field, value });\n }\n\n /** Value must be declined unless another field equals a value */\n public declinedUnless(field: string, value: any, errorMessage?: string) {\n return this.addFormBooleanRule(declinedUnlessRule, errorMessage, { field, value });\n }\n\n /** Value must be declined if another field is required */\n public declinedIfRequired(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(declinedIfRequiredRule, errorMessage, { field });\n }\n\n /** Value must be declined if another field is present */\n public declinedIfPresent(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(declinedIfPresentRule, errorMessage, { field });\n }\n\n /** Value must be declined if another field is missing */\n public declinedWithout(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(declinedWithoutRule, errorMessage, { field });\n }\n\n // ==================== Coercion ====================\n\n /**\n * Opt in to coercion: an exact query-string-shaped boolean is converted to a\n * real boolean **before** the type rules run; any other value passes through\n * unchanged so bad input still fails the type rule.\n *\n * Converts exactly `\"true\"` / `\"1\"` / `1` → `true` and `\"false\"` / `\"0\"` / `0`\n * → `false`. Case-sensitive, no trimming — `\"TRUE\"`, `\"yes\"`, `\"on\"`, `\"\"`, and\n * `2` all pass through unchanged and fail the type rule. `v.boolean()` does\n * **not** coerce by default; this only takes effect when explicitly chained.\n * For form-style truthy strings like `\"yes\"` / `\"on\"`, use `.accepted()` /\n * `.declined()` instead — those methods opt into their own form-boolean\n * parsing (a wider value set, case-insensitive on a few forms) and then\n * apply the accepted/declined pass-fail rule on top of the parsed boolean.\n *\n * The output type is unchanged (`Infer<>` keys off the validator class), so\n * `v.boolean().coerce()` still infers `boolean`.\n *\n * @example\n * v.boolean().coerce() // \"true\" → true; \"1\" → true; \"0\" → false; \"yes\" → invalid\n */\n public coerce() {\n return this.addMutator(booleanCoerceMutator) as this & { isCoerced: true };\n }\n\n // ==================== Strict boolean checks ====================\n\n /**\n * Value must be strictly true (not \"yes\", \"on\", 1, etc.)\n * @alias accepted - strict version\n */\n public mustBeTrue(errorMessage?: string) {\n return this.equal(true, errorMessage);\n }\n\n /**\n * Value must be strictly false (not \"no\", \"off\", 0, etc.)\n * @alias declined - strict version\n */\n public mustBeFalse(errorMessage?: string) {\n return this.equal(false, errorMessage);\n }\n\n /**\n * @inheritdoc\n *\n * @note accepted/declined rules and all cross-field boolean rules\n * are not representable in JSON Schema and are silently omitted.\n *\n * @example\n * ```ts\n * v.boolean().toJsonSchema(\"draft-2020-12\")\n * // → { type: \"boolean\" }\n *\n * v.boolean().nullable().toJsonSchema(\"openapi-3.0\")\n * // → { type: \"boolean\", nullable: true }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const schema: JsonSchemaResult = { type: \"boolean\" };\n if (this.isNullable) applyNullable(schema, target);\n return schema;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,IAAa,mBAAb,cAAsC,mBAAmB;CACvD,AAAO,YAAY,cAAuB;EACxC,MAAM;EACN,KAAK,iBAAiB;EACtB,KAAK,eAAe,aAAa,YAAY;CAC/C;;;;CAKA,AAAO,YAAY,OAAqB;EACtC,OAAO,OAAO,UAAU;CAC1B;;;;;;;;;;;;;;;;;;;CAoBA,AAAQ,mBACN,MACA,cACA,UAAa,CAAC,GACR;EACN,MAAM,WAAW,KAAK;EAEtB,IAAI,CAAC,SAAS,SAAS,MAAM,YAAY,QAAQ,WAAW,kBAAkB,GAC5E,SAAS,kBAAkB,kBAAkB;EAG/C,SAAS,eAAe,MAAM,cAAc,OAAO;EAEnD,OAAO;CACT;;CAKA,AAAO,SAAS,cAAuB;EACrC,OAAO,KAAK,mBAAmB,cAAc,YAAY;CAC3D;;CAGA,AAAO,WAAW,OAAe,OAAY,cAAuB;EAClE,OAAO,KAAK,mBAAmB,gBAAgB,cAAc;GAAE;GAAO;EAAM,CAAC;CAC/E;;CAGA,AAAO,eAAe,OAAe,OAAY,cAAuB;EACtE,OAAO,KAAK,mBAAmB,oBAAoB,cAAc;GAAE;GAAO;EAAM,CAAC;CACnF;;CAGA,AAAO,mBAAmB,OAAe,cAAuB;EAC9D,OAAO,KAAK,mBAAmB,wBAAwB,cAAc,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version":3,"file":"computed-validator.d.mts","names":[],"sources":["../../../../../../../seal/src/validators/computed-validator.ts"],"mappings":";;;;;;;;;AAQA;KAAY,gBAAA,mBACV,IAAA,OACA,OAAA,EAAS,aAAA,KACN,OAAA,GAAU,OAAA,CAAQ,OAAA;;;;;;;;;;;;;;;;AAAO;AAkC9B;;;;;;;;;;;;;;;;cAAa,iBAAA,wBAAyC,aAAA;EAAA,UAQxC,QAAA,EAAU,gBAAA,CAAiB,OAAA;EAAA,UAC3B,eAAA,GAAkB,aAAA;EADlB;;;;;;cAAA,QAAA,EAAU,gBAAA,CAAiB,OAAA,GAC3B,eAAA,GAAkB,aAAA;EADS;;;EAS1B,QAAA,CAAS,IAAA,OAAW,OAAA,EAAS,aAAA,GAAgB,OAAA,CAAQ,gBAAA;EAArD;;;;EAkDG,KAAA;EAlDkD;;;EA+D3D,WAAA,CAAY,KAAA;EAaH;;;;;AAA2E;;;;EAA3E,YAAA,CAAa,OAAA,GAAS,gBAAA,GAAqC,gBAAA;AAAA"}
1
+ {"version":3,"file":"computed-validator.d.mts","names":[],"sources":["../../../../../../../seal/src/validators/computed-validator.ts"],"mappings":";;;;;;;;;;KAQY,gBAAA,mBACV,IAAA,OACA,OAAA,EAAS,aAAA,KACN,OAAA,GAAU,OAAA,CAAQ,OAAA;;;;;;;;;;;;;;;;;AAAO;AAkC9B;;;;;;;;;;;;;;;cAAa,iBAAA,wBAAyC,aAAA;EAAA,UAQxC,QAAA,EAAU,gBAAA,CAAiB,OAAA;EAAA,UAC3B,eAAA,GAAkB,aAAA;EATsB;;;;;;cAQxC,QAAA,EAAU,gBAAA,CAAiB,OAAA,GAC3B,eAAA,GAAkB,aAAA;EADR;;;EAST,QAAA,CAAS,IAAA,OAAW,OAAA,EAAS,aAAA,GAAgB,OAAA,CAAQ,gBAAA;EARtD;;;;EA0DI,KAAA;EAlD0C;;;EA+DnD,WAAA,CAAY,KAAA;EAAA;;;;;;AAawE;;;EAA3E,YAAA,CAAa,OAAA,GAAS,gBAAA,GAAqC,gBAAA;AAAA"}
@@ -2,7 +2,6 @@ import { JsonSchemaResult, JsonSchemaTarget } from "../standard-schema/json-sche
2
2
  import { WeekDay } from "../types/date-types.mjs";
3
3
  import { BaseValidator } from "./base-validator.mjs";
4
4
  import { Month } from "../rules/date/date-period-rules.mjs";
5
-
6
5
  //#region ../seal/src/validators/date-validator.d.ts
7
6
  /**
8
7
  * Date validator class
@@ -1 +1 @@
1
- {"version":3,"file":"date-validator.d.mts","names":[],"sources":["../../../../../../../seal/src/validators/date-validator.ts"],"mappings":";;;;;;;;AAwEA;cAAa,aAAA,SAAsB,aAAA;cACd,YAAA;EA+IK;;;EAtIjB,WAAA,CAAY,KAAA;EA8LO;;;;EAnLnB,WAAA;EA+ZO;EA1ZP,WAAA;EAihBuB;EAzgBvB,QAAA,CAAS,MAAA;EAopB0D;EA5oBnE,UAAA;EA1CuC;EAkDvC,UAAA;EAlD0B;;;;EAgE1B,YAAA;EA3CA;EAgDA,UAAA;EAnCA;EAwCA,OAAA,CAAQ,IAAA;EAhCR;EAqCA,SAAA,CAAU,MAAA;EAfV;EAoBA,QAAA,CAAS,KAAA;EAVT;EAeA,QAAA,CAAS,KAAA;EAVT;EAeA,KAAA;EAVA;EAiBA,cAAA;EAZA;EAiBA,YAAA;EAZA;EAiBA,aAAA;EALA;EAUA,WAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;EA4BA,GAAA,CAAI,WAAA,EAAa,IAAA,oBAAwB,YAAA;EA6DzC;;;;;;;;;EA7CA,GAAA,CAAI,WAAA,EAAa,IAAA,oBAAwB,YAAA;EAsEzC;;;;;;;;;EAtDA,MAAA,CAAO,WAAA,EAAa,IAAA,oBAAwB,YAAA;EAuFf;;;;;;;;;EAvE7B,KAAA,CAAM,WAAA,EAAa,IAAA,oBAAwB,YAAA;EA4G3C;EApGA,OAAA,CAAQ,SAAA,EAAW,IAAA,EAAM,OAAA,EAAS,IAAA,EAAM,YAAA;EAoGjB;EA/FvB,KAAA,C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aAAA,CAAc,KAAA,UAAe,YAAA;;EAQ7B,OAAA,CAAQ,OAAA,iBAAwB,YAAA;;EAOhC,QAAA,CAAS,MAAA,WAAiB,MAAA,WAAiB,YAAA;;EAK3C,QAAA,CAAS,YAAA;;;;EAOT,UAAA;;;;;;;;;;;;;;;;;;;EAoBS,YAAA,CAAa,MAAA,GAAQ,gBAAA,GAAqC,gBAAA;AAAA"}
@@ -20,6 +20,7 @@ import dayjs from "dayjs";
20
20
  var DateValidator = class extends BaseValidator {
21
21
  constructor(errorMessage) {
22
22
  super();
23
+ this.blankIsMissing = true;
23
24
  this.addMutableMutator(dateMutator);
24
25
  this.addMutableRule(dateRule, errorMessage);
25
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"date-validator.mjs","names":[],"sources":["../../../../../../../seal/src/validators/date-validator.ts"],"sourcesContent":["import dayjs from \"dayjs\";\r\nimport {\r\n addDaysMutator,\r\n addHoursMutator,\r\n addMonthsMutator,\r\n addYearsMutator,\r\n dateMutator,\r\n toEndOfDayMutator,\r\n toEndOfMonthMutator,\r\n toEndOfYearMutator,\r\n toStartOfDayMutator,\r\n toStartOfMonthMutator,\r\n toStartOfYearMutator,\r\n toUTCMutator,\r\n} from \"../mutators\";\r\nimport {\r\n afterFieldRule,\r\n afterTodayRule,\r\n ageRule,\r\n beforeFieldRule,\r\n beforeHourRule,\r\n beforeMinuteRule,\r\n beforeTodayRule,\r\n betweenAgeRule,\r\n betweenDatesRule,\r\n betweenDaysRule,\r\n betweenHoursRule,\r\n betweenMinutesRule,\r\n betweenMonthsRule,\r\n betweenTimesRule,\r\n betweenYearsRule,\r\n birthdayRule,\r\n businessDayRule,\r\n dateRule,\r\n fromHourRule,\r\n fromMinuteRule,\r\n fromTodayRule,\r\n futureRule,\r\n leapYearRule,\r\n maxAgeRule,\r\n maxDateRule,\r\n maxDayRule,\r\n maxMonthRule,\r\n maxYearRule,\r\n minAgeRule,\r\n minDateRule,\r\n minDayRule,\r\n minMonthRule,\r\n minYearRule,\r\n type Month,\r\n monthRule,\r\n pastRule,\r\n quarterRule,\r\n sameAsFieldDateRule,\r\n todayRule,\r\n weekDayRule,\r\n weekdaysRule,\r\n weekendRule,\r\n withinDaysRule,\r\n withinFutureDaysRule,\r\n withinPastDaysRule,\r\n yearRule,\r\n} from \"../rules\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\nimport { applyNullable, getRuleOptions } from \"../standard-schema/json-schema\";\r\nimport type { WeekDay } from \"../types/date-types\";\r\nimport { isDateValue } from \"./../helpers/date-helpers\";\r\nimport { BaseValidator } from \"./base-validator\";\r\n\r\n/**\r\n * Date validator class\r\n */\r\nexport class DateValidator extends BaseValidator {\r\n public constructor(errorMessage?: string) {\r\n super();\r\n this.addMutableMutator(dateMutator); // Normalize to Date object first\r\n this.addMutableRule(dateRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is a Date type\r\n */\r\n public matchesType(value: any): boolean {\r\n return isDateValue(value);\r\n }\r\n\r\n // ==================== Output Transformers ====================\r\n // These transform the Date after validation into different formats\r\n\r\n /**\r\n * Convert date to ISO string format\r\n * @category transformer\r\n */\r\n public toISOString() {\r\n return this.addTransformer((data) => (data instanceof Date ? data.toISOString() : data));\r\n }\r\n\r\n /** Convert date to Unix timestamp (milliseconds) */\r\n public toTimestamp() {\r\n return this.addTransformer((data) => (data instanceof Date ? data.getTime() : data));\r\n }\r\n\r\n // ==================== String Format Transformers ====================\r\n // These convert Date to formatted strings after validation\r\n\r\n /** Convert date to specific format using dayjs */\r\n public toFormat(format: string) {\r\n return this.addTransformer(\r\n (data, { options }) => (data instanceof Date ? dayjs(data).format(options.format) : data),\r\n { format },\r\n );\r\n }\r\n\r\n /** Convert to date only (remove time, returns YYYY-MM-DD) */\r\n public toDateOnly() {\r\n return this.addTransformer(\r\n (data) => (data instanceof Date ? dayjs(data).format(\"YYYY-MM-DD\") : data),\r\n { __jsonSchemaFormat: \"date\" },\r\n );\r\n }\r\n\r\n /** Convert to time only (returns HH:MM:SS) */\r\n public toTimeOnly() {\r\n return this.addTransformer(\r\n (data) => (data instanceof Date ? dayjs(data).format(\"HH:mm:ss\") : data),\r\n { __jsonSchemaFormat: \"time\" },\r\n );\r\n }\r\n\r\n // ==================== Date Mutators ====================\r\n // These modify the Date object before validation\r\n\r\n /**\r\n * Convert date to start of day (00:00:00)\r\n * @category mutator\r\n */\r\n public toStartOfDay() {\r\n return this.addMutator(toStartOfDayMutator);\r\n }\r\n\r\n /** Convert date to end of day (23:59:59.999) */\r\n public toEndOfDay() {\r\n return this.addMutator(toEndOfDayMutator);\r\n }\r\n\r\n /** Add or subtract days from date */\r\n public addDays(days: number) {\r\n return this.addMutator(addDaysMutator, { days });\r\n }\r\n\r\n /** Add or subtract months from date */\r\n public addMonths(months: number) {\r\n return this.addMutator(addMonthsMutator, { months });\r\n }\r\n\r\n /** Add or subtract years from date */\r\n public addYears(years: number) {\r\n return this.addMutator(addYearsMutator, { years });\r\n }\r\n\r\n /** Add or subtract hours from date */\r\n public addHours(hours: number) {\r\n return this.addMutator(addHoursMutator, { hours });\r\n }\r\n\r\n /** Convert date to UTC */\r\n public toUTC() {\r\n return this.addMutator(toUTCMutator);\r\n }\r\n\r\n // ==================== Date Range Mutators ====================\r\n\r\n /** Set to start of month */\r\n public toStartOfMonth() {\r\n return this.addMutator(toStartOfMonthMutator);\r\n }\r\n\r\n /** Set to end of month */\r\n public toEndOfMonth() {\r\n return this.addMutator(toEndOfMonthMutator);\r\n }\r\n\r\n /** Set to start of year */\r\n public toStartOfYear() {\r\n return this.addMutator(toStartOfYearMutator);\r\n }\r\n\r\n /** Set to end of year */\r\n public toEndOfYear() {\r\n return this.addMutator(toEndOfYearMutator);\r\n }\r\n\r\n // ==================== Date Comparison ====================\r\n\r\n /**\r\n * Date must be greater than or equal to the given date or field (inclusive)\r\n *\r\n * Smart detection:\r\n * - Date instance, timestamp, or date string (with - or /) → value comparison\r\n * - Plain string → field comparison\r\n *\r\n * @param dateOrField - Date, timestamp, date string, or field name\r\n *\r\n * @example\r\n * ```ts\r\n * // Value comparison\r\n * v.date().min('2024-01-01')\r\n * v.date().min(new Date())\r\n * v.date().min(1698278400000)\r\n *\r\n * // Field comparison\r\n * v.date().min('startsAt')\r\n * ```\r\n *\r\n * @category Validation Rule\r\n */\r\n public min(dateOrField: Date | string | number, errorMessage?: string): this {\r\n return this.addRule(minDateRule, errorMessage, {\r\n dateOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be less than or equal to the given date or field (inclusive)\r\n *\r\n * Smart detection:\r\n * - Date instance, timestamp, or date string (with - or /) → value comparison\r\n * - Plain string → field comparison\r\n *\r\n * @category Validation Rule\r\n */\r\n public max(dateOrField: Date | string | number, errorMessage?: string): this {\r\n return this.addRule(maxDateRule, errorMessage, {\r\n dateOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be strictly less than the given date or field (exclusive)\r\n *\r\n * Smart detection:\r\n * - Date instance, timestamp, or date string (with - or /) → value comparison\r\n * - Plain string → field comparison\r\n *\r\n * @category Validation Rule\r\n */\r\n public before(dateOrField: Date | string | number, errorMessage?: string): this {\r\n return this.addRule(beforeFieldRule, errorMessage, {\r\n dateOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be strictly greater than the given date or field (exclusive)\r\n *\r\n * Smart detection:\r\n * - Date instance, timestamp, or date string (with - or /) → value comparison\r\n * - Plain string → field comparison\r\n *\r\n * @category Validation Rule\r\n */\r\n public after(dateOrField: Date | string | number, errorMessage?: string): this {\r\n return this.addRule(afterFieldRule, errorMessage, {\r\n dateOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /** Date must be between start and end dates */\r\n public between(startDate: Date, endDate: Date, errorMessage?: string) {\r\n return this.addRule(betweenDatesRule, errorMessage, { startDate, endDate });\r\n }\r\n\r\n /** Date must be exactly today */\r\n public today(errorMessage?: string) {\r\n return this.addRule(todayRule, errorMessage);\r\n }\r\n\r\n /** Date must be today or in the future */\r\n public fromToday(errorMessage?: string) {\r\n return this.addRule(fromTodayRule, errorMessage);\r\n }\r\n\r\n /** Date must be before today */\r\n public beforeToday(errorMessage?: string) {\r\n return this.addRule(beforeTodayRule, errorMessage);\r\n }\r\n\r\n /** Date must be after today (not including today) */\r\n public afterToday(errorMessage?: string) {\r\n return this.addRule(afterTodayRule, errorMessage);\r\n }\r\n\r\n /** Date must be in the past */\r\n public past(errorMessage?: string) {\r\n return this.addRule(pastRule, errorMessage);\r\n }\r\n\r\n /** Date must be in the future */\r\n public future(errorMessage?: string) {\r\n return this.addRule(futureRule, errorMessage);\r\n }\r\n\r\n // ==================== Sibling Field Comparison ====================\r\n // Explicit sibling scope methods\r\n\r\n /**\r\n * Date must be >= sibling field value (inclusive)\r\n * @category Validation Rule\r\n */\r\n public minSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(minDateRule, errorMessage, {\r\n dateOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be <= sibling field value (inclusive)\r\n * @category Validation Rule\r\n */\r\n public maxSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(maxDateRule, errorMessage, {\r\n dateOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be < sibling field value (exclusive)\r\n * @category Validation Rule\r\n */\r\n public beforeSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(beforeFieldRule, errorMessage, {\r\n dateOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be > sibling field value (exclusive)\r\n * @category Validation Rule\r\n */\r\n public afterSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(afterFieldRule, errorMessage, {\r\n dateOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /** Date must be the same as another field's date */\r\n public sameAsField(field: string, errorMessage?: string) {\r\n return this.addRule(sameAsFieldDateRule, errorMessage, {\r\n field,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /** Date must be the same as another sibling field's date */\r\n public sameAsFieldSibling(field: string, errorMessage?: string) {\r\n return this.addRule(sameAsFieldDateRule, errorMessage, {\r\n field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n // ==================== Time Validation ====================\r\n\r\n /** Time must be from specific hour onwards (0-23) */\r\n public fromHour(hour: number, errorMessage?: string) {\r\n return this.addRule(fromHourRule, errorMessage, { hour });\r\n }\r\n\r\n /** Time must be before specific hour (0-23) */\r\n public beforeHour(hour: number, errorMessage?: string) {\r\n return this.addRule(beforeHourRule, errorMessage, { hour });\r\n }\r\n\r\n /** Time must be between start and end hours (0-23) */\r\n public betweenHours(startHour: number, endHour: number, errorMessage?: string) {\r\n return this.addRule(betweenHoursRule, errorMessage, { startHour, endHour });\r\n }\r\n\r\n /** Time must be from specific minute onwards (0-59) */\r\n public fromMinute(minute: number, errorMessage?: string) {\r\n return this.addRule(fromMinuteRule, errorMessage, { minute });\r\n }\r\n\r\n /** Time must be before specific minute (0-59) */\r\n public beforeMinute(minute: number, errorMessage?: string) {\r\n return this.addRule(beforeMinuteRule, errorMessage, { minute });\r\n }\r\n\r\n /** Time must be between start and end minutes (0-59) */\r\n public betweenMinutes(startMinute: number, endMinute: number, errorMessage?: string) {\r\n return this.addRule(betweenMinutesRule, errorMessage, {\r\n startMinute,\r\n endMinute,\r\n });\r\n }\r\n\r\n /** Time must be between start and end times (HH:MM format) */\r\n public betweenTimes(startTime: string, endTime: string, errorMessage?: string) {\r\n return this.addRule(betweenTimesRule, errorMessage, { startTime, endTime });\r\n }\r\n\r\n // ==================== Age Validation ====================\r\n\r\n /** Age must be exactly the given years */\r\n public age(years: number, errorMessage?: string) {\r\n return this.addRule(ageRule, errorMessage, { years });\r\n }\r\n\r\n /** Minimum age requirement */\r\n public minAge(years: number, errorMessage?: string) {\r\n return this.addRule(minAgeRule, errorMessage, { years });\r\n }\r\n\r\n /** Maximum age requirement */\r\n public maxAge(years: number, errorMessage?: string) {\r\n return this.addRule(maxAgeRule, errorMessage, { years });\r\n }\r\n\r\n /** Age must be between min and max years */\r\n public betweenAge(minAge: number, maxAge: number, errorMessage?: string) {\r\n return this.addRule(betweenAgeRule, errorMessage, { minAge, maxAge });\r\n }\r\n\r\n // ==================== Day Validation ====================\r\n\r\n /** Date must be specific weekday */\r\n public weekDay(day: WeekDay, errorMessage?: string) {\r\n return this.addRule(weekDayRule, errorMessage, { day });\r\n }\r\n\r\n /** Date must be one of specified weekdays */\r\n public weekdays(days: WeekDay[], errorMessage?: string) {\r\n return this.addRule(weekdaysRule, errorMessage, { days });\r\n }\r\n\r\n /** Date must be a weekend (Saturday or Sunday) */\r\n public weekend(errorMessage?: string) {\r\n return this.addRule(weekendRule, errorMessage);\r\n }\r\n\r\n /** Date must be a business day (Monday-Friday) */\r\n public businessDay(errorMessage?: string) {\r\n return this.addRule(businessDayRule, errorMessage);\r\n }\r\n\r\n /** Date must match specific format */\r\n public format(format: string, errorMessage?: string) {\r\n return this.addRule(dateRule, errorMessage, { format });\r\n }\r\n\r\n // ==================== Relative Date Validation ====================\r\n\r\n /** Date must be within X days from now (past or future) */\r\n public withinDays(days: number, errorMessage?: string) {\r\n return this.addRule(withinDaysRule, errorMessage, { days });\r\n }\r\n\r\n /** Date must be within X days in the past */\r\n public withinPastDays(days: number, errorMessage?: string) {\r\n return this.addRule(withinPastDaysRule, errorMessage, { days });\r\n }\r\n\r\n /** Date must be within X days in the future */\r\n public withinFutureDays(days: number, errorMessage?: string) {\r\n return this.addRule(withinFutureDaysRule, errorMessage, { days });\r\n }\r\n\r\n // ==================== Period Validation ====================\r\n\r\n /** Date must be in specific month (1-12) */\r\n public month(month: Month, errorMessage?: string) {\r\n return this.addRule(monthRule, errorMessage, { month });\r\n }\r\n\r\n /** Date must be in specific year */\r\n public year(year: number, errorMessage?: string) {\r\n return this.addRule(yearRule, errorMessage, { year });\r\n }\r\n\r\n /**\r\n * Date must be between start and end years\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public betweenYears(startYear: number | string, endYear: number | string, errorMessage?: string) {\r\n return this.addRule(betweenYearsRule, errorMessage, {\r\n startYear,\r\n endYear,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be between start and end months (1-12)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public betweenMonths(\r\n startMonth: Month | string,\r\n endMonth: Month | string,\r\n errorMessage?: string,\r\n ) {\r\n return this.addRule(betweenMonthsRule, errorMessage, {\r\n startMonth,\r\n endMonth,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be between start and end days (1-31)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public betweenDays(startDay: number | string, endDay: number | string, errorMessage?: string) {\r\n return this.addRule(betweenDaysRule, errorMessage, {\r\n startDay,\r\n endDay,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be between sibling field years\r\n * @category Validation Rule\r\n */\r\n public betweenYearsSibling(startYearField: string, endYearField: string, errorMessage?: string) {\r\n return this.addRule(betweenYearsRule, errorMessage, {\r\n startYear: startYearField,\r\n endYear: endYearField,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be between sibling field months\r\n * @category Validation Rule\r\n */\r\n public betweenMonthsSibling(\r\n startMonthField: string,\r\n endMonthField: string,\r\n errorMessage?: string,\r\n ) {\r\n return this.addRule(betweenMonthsRule, errorMessage, {\r\n startMonth: startMonthField,\r\n endMonth: endMonthField,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be between sibling field days\r\n * @category Validation Rule\r\n */\r\n public betweenDaysSibling(startDayField: string, endDayField: string, errorMessage?: string) {\r\n return this.addRule(betweenDaysRule, errorMessage, {\r\n startDay: startDayField,\r\n endDay: endDayField,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Year must be >= given year or field\r\n * Smart detection: number or field name\r\n *\r\n * @example\r\n * ```ts\r\n * // Value comparison\r\n * v.date().minYear(2024)\r\n *\r\n * // Field comparison\r\n * v.date().minYear('startYear')\r\n * ```\r\n *\r\n * @category Validation Rule\r\n */\r\n public minYear(yearOrField: number | string, errorMessage?: string): this {\r\n return this.addRule(minYearRule, errorMessage, {\r\n yearOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Year must be <= given year or field\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public maxYear(yearOrField: number | string, errorMessage?: string): this {\r\n return this.addRule(maxYearRule, errorMessage, {\r\n yearOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Month must be >= given month or field (1-12)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public minMonth(monthOrField: number | string, errorMessage?: string): this {\r\n return this.addRule(minMonthRule, errorMessage, {\r\n monthOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Month must be <= given month or field (1-12)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public maxMonth(monthOrField: Month | string, errorMessage?: string): this {\r\n return this.addRule(maxMonthRule, errorMessage, {\r\n monthOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Day must be >= given day or field (1-31)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public minDay(dayOrField: number | string, errorMessage?: string): this {\r\n return this.addRule(minDayRule, errorMessage, {\r\n dayOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Day must be <= given day or field (1-31)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public maxDay(dayOrField: number | string, errorMessage?: string): this {\r\n return this.addRule(maxDayRule, errorMessage, {\r\n dayOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Year must be >= sibling field year\r\n * @category Validation Rule\r\n */\r\n public minYearSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(minYearRule, errorMessage, {\r\n yearOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Year must be <= sibling field year\r\n * @category Validation Rule\r\n */\r\n public maxYearSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(maxYearRule, errorMessage, {\r\n yearOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Month must be >= sibling field month\r\n * @category Validation Rule\r\n */\r\n public minMonthSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(minMonthRule, errorMessage, {\r\n monthOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Month must be <= sibling field month\r\n * @category Validation Rule\r\n */\r\n public maxMonthSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(maxMonthRule, errorMessage, {\r\n monthOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Day must be >= sibling field day\r\n * @category Validation Rule\r\n */\r\n public minDaySibling(field: string, errorMessage?: string): this {\r\n return this.addRule(minDayRule, errorMessage, {\r\n dayOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Day must be <= sibling field day\r\n * @category Validation Rule\r\n */\r\n public maxDaySibling(field: string, errorMessage?: string): this {\r\n return this.addRule(maxDayRule, errorMessage, {\r\n dayOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /** Date must be in specific quarter (1-4) */\r\n public quarter(quarter: 1 | 2 | 3 | 4, errorMessage?: string) {\r\n return this.addRule(quarterRule, errorMessage, { quarter });\r\n }\r\n\r\n // ==================== Special Validation ====================\r\n\r\n /** Valid birthday (not in future, reasonable age) */\r\n public birthday(minAge?: number, maxAge?: number, errorMessage?: string) {\r\n return this.addRule(birthdayRule, errorMessage, { minAge, maxAge });\r\n }\r\n\r\n /** Date must be in a leap year */\r\n public leapYear(errorMessage?: string) {\r\n return this.addRule(leapYearRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Set default value as current time of exeuction\r\n */\r\n public defaultNow() {\r\n return this.default(() => new Date());\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Maps DateValidator to JSON Schema format keywords.\r\n * Default is `date-time`. If `.toDateOnly()` or `.toTimeOnly()` are used,\r\n * falls back to `date` or `time` formats respectively.\r\n *\r\n * @example\r\n * ```ts\r\n * v.date().toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"string\", format: \"date-time\" }\r\n *\r\n * v.date().toDateOnly().toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"string\", format: \"date\" }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const schema: JsonSchemaResult = { type: \"string\", format: \"date-time\" };\r\n\r\n // Check if an explicit format rule was applied via v.date().format()\r\n const dateOpts = getRuleOptions(this.rules, \"date\");\r\n if (dateOpts?.format === \"YYYY-MM-DD\") {\r\n schema.format = \"date\";\r\n } else if (dateOpts?.format === \"HH:mm:ss\") {\r\n schema.format = \"time\";\r\n }\r\n\r\n // Transformer-based detection (marker-driven; minifier-safe).\r\n // toDateOnly/toTimeOnly tag their options bag with __jsonSchemaFormat.\r\n // toFormat() exposes the user-supplied format string in options.format.\r\n if (schema.format === \"date-time\") {\r\n for (const t of this.dataTransformers) {\r\n const hint = t.options?.__jsonSchemaFormat;\r\n if (hint === \"date\" || hint === \"time\") {\r\n schema.format = hint;\r\n break;\r\n }\r\n\r\n const userFormat = t.options?.format;\r\n\r\n if (userFormat === \"YYYY-MM-DD\") {\r\n schema.format = \"date\";\r\n break;\r\n }\r\n\r\n if (userFormat === \"HH:mm:ss\") {\r\n schema.format = \"time\";\r\n break;\r\n }\r\n }\r\n }\r\n\r\n if (this.isNullable) applyNullable(schema, target);\r\n\r\n return schema;\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAwEA,IAAa,gBAAb,cAAmC,cAAc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;GACZ,OAAO;EACT,CAAC;CACH;;CAGA,AAAO,QAAQ,SAAwB,cAAuB;EAC5D,OAAO,KAAK,QAAQ,aAAa,cAAc,EAAE,QAAQ,CAAC;CAC5D;;CAKA,AAAO,SAAS,QAAiB,QAAiB,cAAuB;EACvE,OAAO,KAAK,QAAQ,cAAc,cAAc;GAAE;GAAQ;EAAO,CAAC;CACpE;;CAGA,AAAO,SAAS,cAAuB;EACrC,OAAO,KAAK,QAAQ,cAAc,YAAY;CAChD;;;;CAKA,AAAO,aAAa;EAClB,OAAO,KAAK,8BAAc,IAAI,KAAK,CAAC;CACtC;;;;;;;;;;;;;;;;;CAkBA,AAAgB,aAAa,SAA2B,iBAAmC;EACzF,MAAM,SAA2B;GAAE,MAAM;GAAU,QAAQ;EAAY;EAGvE,MAAM,WAAW,eAAe,KAAK,OAAO,MAAM;EAClD,IAAI,UAAU,WAAW,cACvB,OAAO,SAAS;OACX,IAAI,UAAU,WAAW,YAC9B,OAAO,SAAS;EAMlB,IAAI,OAAO,WAAW,aACpB,KAAK,MAAM,KAAK,KAAK,kBAAkB;GACrC,MAAM,OAAO,EAAE,SAAS;GACxB,IAAI,SAAS,UAAU,SAAS,QAAQ;IACtC,OAAO,SAAS;IAChB;GACF;GAEA,MAAM,aAAa,EAAE,SAAS;GAE9B,IAAI,eAAe,cAAc;IAC/B,OAAO,SAAS;IAChB;GACF;GAEA,IAAI,eAAe,YAAY;IAC7B,OAAO,SAAS;IAChB;GACF;EACF;EAGF,IAAI,KAAK,YAAY,cAAc,QAAQ,MAAM;EAEjD,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"date-validator.mjs","names":[],"sources":["../../../../../../../seal/src/validators/date-validator.ts"],"sourcesContent":["import dayjs from \"dayjs\";\nimport {\n addDaysMutator,\n addHoursMutator,\n addMonthsMutator,\n addYearsMutator,\n dateMutator,\n toEndOfDayMutator,\n toEndOfMonthMutator,\n toEndOfYearMutator,\n toStartOfDayMutator,\n toStartOfMonthMutator,\n toStartOfYearMutator,\n toUTCMutator,\n} from \"../mutators\";\nimport {\n afterFieldRule,\n afterTodayRule,\n ageRule,\n beforeFieldRule,\n beforeHourRule,\n beforeMinuteRule,\n beforeTodayRule,\n betweenAgeRule,\n betweenDatesRule,\n betweenDaysRule,\n betweenHoursRule,\n betweenMinutesRule,\n betweenMonthsRule,\n betweenTimesRule,\n betweenYearsRule,\n birthdayRule,\n businessDayRule,\n dateRule,\n fromHourRule,\n fromMinuteRule,\n fromTodayRule,\n futureRule,\n leapYearRule,\n maxAgeRule,\n maxDateRule,\n maxDayRule,\n maxMonthRule,\n maxYearRule,\n minAgeRule,\n minDateRule,\n minDayRule,\n minMonthRule,\n minYearRule,\n type Month,\n monthRule,\n pastRule,\n quarterRule,\n sameAsFieldDateRule,\n todayRule,\n weekDayRule,\n weekdaysRule,\n weekendRule,\n withinDaysRule,\n withinFutureDaysRule,\n withinPastDaysRule,\n yearRule,\n} from \"../rules\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport { applyNullable, getRuleOptions } from \"../standard-schema/json-schema\";\nimport type { WeekDay } from \"../types/date-types\";\nimport { isDateValue } from \"./../helpers/date-helpers\";\nimport { BaseValidator } from \"./base-validator\";\n\n/**\n * Date validator class\n */\nexport class DateValidator extends BaseValidator {\n public constructor(errorMessage?: string) {\n super();\n this.blankIsMissing = true;\n this.addMutableMutator(dateMutator); // Normalize to Date object first\n this.addMutableRule(dateRule, errorMessage);\n }\n\n /**\n * Check if value is a Date type\n */\n public matchesType(value: any): boolean {\n return isDateValue(value);\n }\n\n // ==================== Output Transformers ====================\n // These transform the Date after validation into different formats\n\n /**\n * Convert date to ISO string format\n * @category transformer\n */\n public toISOString() {\n return this.addTransformer((data) => (data instanceof Date ? data.toISOString() : data));\n }\n\n /** Convert date to Unix timestamp (milliseconds) */\n public toTimestamp() {\n return this.addTransformer((data) => (data instanceof Date ? data.getTime() : data));\n }\n\n // ==================== String Format Transformers ====================\n // These convert Date to formatted strings after validation\n\n /** Convert date to specific format using dayjs */\n public toFormat(format: string) {\n return this.addTransformer(\n (data, { options }) => (data instanceof Date ? dayjs(data).format(options.format) : data),\n { format },\n );\n }\n\n /** Convert to date only (remove time, returns YYYY-MM-DD) */\n public toDateOnly() {\n return this.addTransformer(\n (data) => (data instanceof Date ? dayjs(data).format(\"YYYY-MM-DD\") : data),\n { __jsonSchemaFormat: \"date\" },\n );\n }\n\n /** Convert to time only (returns HH:MM:SS) */\n public toTimeOnly() {\n return this.addTransformer(\n (data) => (data instanceof Date ? dayjs(data).format(\"HH:mm:ss\") : data),\n { __jsonSchemaFormat: \"time\" },\n );\n }\n\n // ==================== Date Mutators ====================\n // These modify the Date object before validation\n\n /**\n * Convert date to start of day (00:00:00)\n * @category mutator\n */\n public toStartOfDay() {\n return this.addMutator(toStartOfDayMutator);\n }\n\n /** Convert date to end of day (23:59:59.999) */\n public toEndOfDay() {\n return this.addMutator(toEndOfDayMutator);\n }\n\n /** Add or subtract days from date */\n public addDays(days: number) {\n return this.addMutator(addDaysMutator, { days });\n }\n\n /** Add or subtract months from date */\n public addMonths(months: number) {\n return this.addMutator(addMonthsMutator, { months });\n }\n\n /** Add or subtract years from date */\n public addYears(years: number) {\n return this.addMutator(addYearsMutator, { years });\n }\n\n /** Add or subtract hours from date */\n public addHours(hours: number) {\n return this.addMutator(addHoursMutator, { hours });\n }\n\n /** Convert date to UTC */\n public toUTC() {\n return this.addMutator(toUTCMutator);\n }\n\n // ==================== Date Range Mutators ====================\n\n /** Set to start of month */\n public toStartOfMonth() {\n return this.addMutator(toStartOfMonthMutator);\n }\n\n /** Set to end of month */\n public toEndOfMonth() {\n return this.addMutator(toEndOfMonthMutator);\n }\n\n /** Set to start of year */\n public toStartOfYear() {\n return this.addMutator(toStartOfYearMutator);\n }\n\n /** Set to end of year */\n public toEndOfYear() {\n return this.addMutator(toEndOfYearMutator);\n }\n\n // ==================== Date Comparison ====================\n\n /**\n * Date must be greater than or equal to the given date or field (inclusive)\n *\n * Smart detection:\n * - Date instance, timestamp, or date string (with - or /) → value comparison\n * - Plain string → field comparison\n *\n * @param dateOrField - Date, timestamp, date string, or field name\n *\n * @example\n * ```ts\n * // Value comparison\n * v.date().min('2024-01-01')\n * v.date().min(new Date())\n * v.date().min(1698278400000)\n *\n * // Field comparison\n * v.date().min('startsAt')\n * ```\n *\n * @category Validation Rule\n */\n public min(dateOrField: Date | string | number, errorMessage?: string): this {\n return this.addRule(minDateRule, errorMessage, {\n dateOrField,\n scope: \"global\",\n });\n }\n\n /**\n * Date must be less than or equal to the given date or field (inclusive)\n *\n * Smart detection:\n * - Date instance, timestamp, or date string (with - or /) → value comparison\n * - Plain string → field comparison\n *\n * @category Validation Rule\n */\n public max(dateOrField: Date | string | number, errorMessage?: string): this {\n return this.addRule(maxDateRule, errorMessage, {\n dateOrField,\n scope: \"global\",\n });\n }\n\n /**\n * Date must be strictly less than the given date or field (exclusive)\n *\n * Smart detection:\n * - Date instance, timestamp, or date string (with - or /) → value comparison\n * - Plain string → field comparison\n *\n * @category Validation Rule\n */\n public before(dateOrField: Date | string | number, errorMessage?: string): this {\n return this.addRule(beforeFieldRule, errorMessage, {\n dateOrField,\n scope: \"global\",\n });\n }\n\n /**\n * Date must be strictly greater than the given date or field (exclusive)\n *\n * Smart detection:\n * - Date instance, timestamp, or date string (with - or /) → value comparison\n * - Plain string → field comparison\n *\n * @category Validation Rule\n */\n public after(dateOrField: Date | string | number, errorMessage?: string): this {\n return this.addRule(afterFieldRule, errorMessage, {\n dateOrField,\n scope: \"global\",\n });\n }\n\n /** Date must be between start and end dates */\n public between(startDate: Date, endDate: Date, errorMessage?: string) {\n return this.addRule(betweenDatesRule, errorMessage, { startDate, endDate });\n }\n\n /** Date must be exactly today */\n public today(errorMessage?: string) {\n return this.addRule(todayRule, errorMessage);\n }\n\n /** Date must be today or in the future */\n public fromToday(errorMessage?: string) {\n return this.addRule(fromTodayRule, errorMessage);\n }\n\n /** Date must be before today */\n public beforeToday(errorMessage?: string) {\n return this.addRule(beforeTodayRule, errorMessage);\n }\n\n /** Date must be after today (not including today) */\n public afterToday(errorMessage?: string) {\n return this.addRule(afterTodayRule, errorMessage);\n }\n\n /** Date must be in the past */\n public past(errorMessage?: string) {\n return this.addRule(pastRule, errorMessage);\n }\n\n /** Date must be in the future */\n public future(errorMessage?: string) {\n return this.addRule(futureRule, errorMessage);\n }\n\n // ==================== Sibling Field Comparison ====================\n // Explicit sibling scope methods\n\n /**\n * Date must be >= sibling field value (inclusive)\n * @category Validation Rule\n */\n public minSibling(field: string, errorMessage?: string): this {\n return this.addRule(minDateRule, errorMessage, {\n dateOrField: field,\n scope: \"sibling\",\n });\n }\n\n /**\n * Date must be <= sibling field value (inclusive)\n * @category Validation Rule\n */\n public maxSibling(field: string, errorMessage?: string): this {\n return this.addRule(maxDateRule, errorMessage, {\n dateOrField: field,\n scope: \"sibling\",\n });\n }\n\n /**\n * Date must be < sibling field value (exclusive)\n * @category Validation Rule\n */\n public beforeSibling(field: string, errorMessage?: string): this {\n return this.addRule(beforeFieldRule, errorMessage, {\n dateOrField: field,\n scope: \"sibling\",\n });\n }\n\n /**\n * Date must be > sibling field value (exclusive)\n * @category Validation Rule\n */\n public afterSibling(field: string, errorMessage?: string): this {\n return this.addRule(afterFieldRule, errorMessage, {\n dateOrField: field,\n scope: \"sibling\",\n });\n }\n\n /** Date must be the same as another field's date */\n public sameAsField(field: string, errorMessage?: string) {\n return this.addRule(sameAsFieldDateRule, errorMessage, {\n field,\n scope: \"global\",\n });\n }\n\n /** Date must be the same as another sibling field's date */\n public sameAsFieldSibling(field: string, errorMessage?: string) {\n return this.addRule(sameAsFieldDateRule, errorMessage, {\n field,\n scope: \"sibling\",\n });\n }\n\n // ==================== Time Validation ====================\n\n /** Time must be from specific hour onwards (0-23) */\n public fromHour(hour: number, errorMessage?: string) {\n return this.addRule(fromHourRule, errorMessage, { hour });\n }\n\n /** Time must be before specific hour (0-23) */\n public beforeHour(hour: number, errorMessage?: string) {\n return this.addRule(beforeHourRule, errorMessage, { hour });\n }\n\n /** Time must be between start and end hours (0-23) */\n public betweenHours(startHour: number, endHour: number, errorMessage?: string) {\n return this.addRule(betweenHoursRule, errorMessage, { startHour, endHour });\n }\n\n /** Time must be from specific minute onwards (0-59) */\n public fromMinute(minute: number, errorMessage?: string) {\n return this.addRule(fromMinuteRule, errorMessage, { minute });\n }\n\n /** Time must be before specific minute (0-59) */\n public beforeMinute(minute: number, errorMessage?: string) {\n return this.addRule(beforeMinuteRule, errorMessage, { minute });\n }\n\n /** Time must be between start and end minutes (0-59) */\n public betweenMinutes(startMinute: number, endMinute: number, errorMessage?: string) {\n return this.addRule(betweenMinutesRule, errorMessage, {\n startMinute,\n endMinute,\n });\n }\n\n /** Time must be between start and end times (HH:MM format) */\n public betweenTimes(startTime: string, endTime: string, errorMessage?: string) {\n return this.addRule(betweenTimesRule, errorMessage, { startTime, endTime });\n }\n\n // ==================== Age Validation ====================\n\n /** Age must be exactly the given years */\n public age(years: number, errorMessage?: string) {\n return this.addRule(ageRule, errorMessage, { years });\n }\n\n /** Minimum age requirement */\n public minAge(years: number, errorMessage?: string) {\n return this.addRule(minAgeRule, errorMessage, { years });\n }\n\n /** Maximum age requirement */\n public maxAge(years: number, errorMessage?: string) {\n return this.addRule(maxAgeRule, errorMessage, { years });\n }\n\n /** Age must be between min and max years */\n public betweenAge(minAge: number, maxAge: number, errorMessage?: string) {\n return this.addRule(betweenAgeRule, errorMessage, { minAge, maxAge });\n }\n\n // ==================== Day Validation ====================\n\n /** Date must be specific weekday */\n public weekDay(day: WeekDay, errorMessage?: string) {\n return this.addRule(weekDayRule, errorMessage, { day });\n }\n\n /** Date must be one of specified weekdays */\n public weekdays(days: WeekDay[], errorMessage?: string) {\n return this.addRule(weekdaysRule, errorMessage, { days });\n }\n\n /** Date must be a weekend (Saturday or Sunday) */\n public weekend(errorMessage?: string) {\n return this.addRule(weekendRule, errorMessage);\n }\n\n /** Date must be a business day (Monday-Friday) */\n public businessDay(errorMessage?: string) {\n return this.addRule(businessDayRule, errorMessage);\n }\n\n /** Date must match specific format */\n public format(format: string, errorMessage?: string) {\n return this.addRule(dateRule, errorMessage, { format });\n }\n\n // ==================== Relative Date Validation ====================\n\n /** Date must be within X days from now (past or future) */\n public withinDays(days: number, errorMessage?: string) {\n return this.addRule(withinDaysRule, errorMessage, { days });\n }\n\n /** Date must be within X days in the past */\n public withinPastDays(days: number, errorMessage?: string) {\n return this.addRule(withinPastDaysRule, errorMessage, { days });\n }\n\n /** Date must be within X days in the future */\n public withinFutureDays(days: number, errorMessage?: string) {\n return this.addRule(withinFutureDaysRule, errorMessage, { days });\n }\n\n // ==================== Period Validation ====================\n\n /** Date must be in specific month (1-12) */\n public month(month: Month, errorMessage?: string) {\n return this.addRule(monthRule, errorMessage, { month });\n }\n\n /** Date must be in specific year */\n public year(year: number, errorMessage?: string) {\n return this.addRule(yearRule, errorMessage, { year });\n }\n\n /**\n * Date must be between start and end years\n * Smart detection: number or field name\n *\n * @category Validation Rule\n */\n public betweenYears(startYear: number | string, endYear: number | string, errorMessage?: string) {\n return this.addRule(betweenYearsRule, errorMessage, {\n startYear,\n endYear,\n scope: \"global\",\n });\n }\n\n /**\n * Date must be between start and end months (1-12)\n * Smart detection: number or field name\n *\n * @category Validation Rule\n */\n public betweenMonths(\n startMonth: Month | string,\n endMonth: Month | string,\n errorMessage?: string,\n ) {\n return this.addRule(betweenMonthsRule, errorMessage, {\n startMonth,\n endMonth,\n scope: \"global\",\n });\n }\n\n /**\n * Date must be between start and end days (1-31)\n * Smart detection: number or field name\n *\n * @category Validation Rule\n */\n public betweenDays(startDay: number | string, endDay: number | string, errorMessage?: string) {\n return this.addRule(betweenDaysRule, errorMessage, {\n startDay,\n endDay,\n scope: \"global\",\n });\n }\n\n /**\n * Date must be between sibling field years\n * @category Validation Rule\n */\n public betweenYearsSibling(startYearField: string, endYearField: string, errorMessage?: string) {\n return this.addRule(betweenYearsRule, errorMessage, {\n startYear: startYearField,\n endYear: endYearField,\n scope: \"sibling\",\n });\n }\n\n /**\n * Date must be between sibling field months\n * @category Validation Rule\n */\n public betweenMonthsSibling(\n startMonthField: string,\n endMonthField: string,\n errorMessage?: string,\n ) {\n return this.addRule(betweenMonthsRule, errorMessage, {\n startMonth: startMonthField,\n endMonth: endMonthField,\n scope: \"sibling\",\n });\n }\n\n /**\n * Date must be between sibling field days\n * @category Validation Rule\n */\n public betweenDaysSibling(startDayField: string, endDayField: string, errorMessage?: string) {\n return this.addRule(betweenDaysRule, errorMessage, {\n startDay: startDayField,\n endDay: endDayField,\n scope: \"sibling\",\n });\n }\n\n /**\n * Year must be >= given year or field\n * Smart detection: number or field name\n *\n * @example\n * ```ts\n * // Value comparison\n * v.date().minYear(2024)\n *\n * // Field comparison\n * v.date().minYear('startYear')\n * ```\n *\n * @category Validation Rule\n */\n public minYear(yearOrField: number | string, errorMessage?: string): this {\n return this.addRule(minYearRule, errorMessage, {\n yearOrField,\n scope: \"global\",\n });\n }\n\n /**\n * Year must be <= given year or field\n * Smart detection: number or field name\n *\n * @category Validation Rule\n */\n public maxYear(yearOrField: number | string, errorMessage?: string): this {\n return this.addRule(maxYearRule, errorMessage, {\n yearOrField,\n scope: \"global\",\n });\n }\n\n /**\n * Month must be >= given month or field (1-12)\n * Smart detection: number or field name\n *\n * @category Validation Rule\n */\n public minMonth(monthOrField: number | string, errorMessage?: string): this {\n return this.addRule(minMonthRule, errorMessage, {\n monthOrField,\n scope: \"global\",\n });\n }\n\n /**\n * Month must be <= given month or field (1-12)\n * Smart detection: number or field name\n *\n * @category Validation Rule\n */\n public maxMonth(monthOrField: Month | string, errorMessage?: string): this {\n return this.addRule(maxMonthRule, errorMessage, {\n monthOrField,\n scope: \"global\",\n });\n }\n\n /**\n * Day must be >= given day or field (1-31)\n * Smart detection: number or field name\n *\n * @category Validation Rule\n */\n public minDay(dayOrField: number | string, errorMessage?: string): this {\n return this.addRule(minDayRule, errorMessage, {\n dayOrField,\n scope: \"global\",\n });\n }\n\n /**\n * Day must be <= given day or field (1-31)\n * Smart detection: number or field name\n *\n * @category Validation Rule\n */\n public maxDay(dayOrField: number | string, errorMessage?: string): this {\n return this.addRule(maxDayRule, errorMessage, {\n dayOrField,\n scope: \"global\",\n });\n }\n\n /**\n * Year must be >= sibling field year\n * @category Validation Rule\n */\n public minYearSibling(field: string, errorMessage?: string): this {\n return this.addRule(minYearRule, errorMessage, {\n yearOrField: field,\n scope: \"sibling\",\n });\n }\n\n /**\n * Year must be <= sibling field year\n * @category Validation Rule\n */\n public maxYearSibling(field: string, errorMessage?: string): this {\n return this.addRule(maxYearRule, errorMessage, {\n yearOrField: field,\n scope: \"sibling\",\n });\n }\n\n /**\n * Month must be >= sibling field month\n * @category Validation Rule\n */\n public minMonthSibling(field: string, errorMessage?: string): this {\n return this.addRule(minMonthRule, errorMessage, {\n monthOrField: field,\n scope: \"sibling\",\n });\n }\n\n /**\n * Month must be <= sibling field month\n * @category Validation Rule\n */\n public maxMonthSibling(field: string, errorMessage?: string): this {\n return this.addRule(maxMonthRule, errorMessage, {\n monthOrField: field,\n scope: \"sibling\",\n });\n }\n\n /**\n * Day must be >= sibling field day\n * @category Validation Rule\n */\n public minDaySibling(field: string, errorMessage?: string): this {\n return this.addRule(minDayRule, errorMessage, {\n dayOrField: field,\n scope: \"sibling\",\n });\n }\n\n /**\n * Day must be <= sibling field day\n * @category Validation Rule\n */\n public maxDaySibling(field: string, errorMessage?: string): this {\n return this.addRule(maxDayRule, errorMessage, {\n dayOrField: field,\n scope: \"sibling\",\n });\n }\n\n /** Date must be in specific quarter (1-4) */\n public quarter(quarter: 1 | 2 | 3 | 4, errorMessage?: string) {\n return this.addRule(quarterRule, errorMessage, { quarter });\n }\n\n // ==================== Special Validation ====================\n\n /** Valid birthday (not in future, reasonable age) */\n public birthday(minAge?: number, maxAge?: number, errorMessage?: string) {\n return this.addRule(birthdayRule, errorMessage, { minAge, maxAge });\n }\n\n /** Date must be in a leap year */\n public leapYear(errorMessage?: string) {\n return this.addRule(leapYearRule, errorMessage);\n }\n\n /**\n * Set default value as current time of exeuction\n */\n public defaultNow() {\n return this.default(() => new Date());\n }\n\n /**\n * @inheritdoc\n *\n * Maps DateValidator to JSON Schema format keywords.\n * Default is `date-time`. If `.toDateOnly()` or `.toTimeOnly()` are used,\n * falls back to `date` or `time` formats respectively.\n *\n * @example\n * ```ts\n * v.date().toJsonSchema(\"draft-2020-12\")\n * // → { type: \"string\", format: \"date-time\" }\n *\n * v.date().toDateOnly().toJsonSchema(\"draft-2020-12\")\n * // → { type: \"string\", format: \"date\" }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const schema: JsonSchemaResult = { type: \"string\", format: \"date-time\" };\n\n // Check if an explicit format rule was applied via v.date().format()\n const dateOpts = getRuleOptions(this.rules, \"date\");\n if (dateOpts?.format === \"YYYY-MM-DD\") {\n schema.format = \"date\";\n } else if (dateOpts?.format === \"HH:mm:ss\") {\n schema.format = \"time\";\n }\n\n // Transformer-based detection (marker-driven; minifier-safe).\n // toDateOnly/toTimeOnly tag their options bag with __jsonSchemaFormat.\n // toFormat() exposes the user-supplied format string in options.format.\n if (schema.format === \"date-time\") {\n for (const t of this.dataTransformers) {\n const hint = t.options?.__jsonSchemaFormat;\n if (hint === \"date\" || hint === \"time\") {\n schema.format = hint;\n break;\n }\n\n const userFormat = t.options?.format;\n\n if (userFormat === \"YYYY-MM-DD\") {\n schema.format = \"date\";\n break;\n }\n\n if (userFormat === \"HH:mm:ss\") {\n schema.format = \"time\";\n break;\n }\n }\n }\n\n if (this.isNullable) applyNullable(schema, target);\n\n return schema;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAwEA,IAAa,gBAAb,cAAmC,cAAc;CAC/C,AAAO,YAAY,cAAuB;EACxC,MAAM;EACN,KAAK,iBAAiB;EACtB,KAAK,kBAAkB,WAAW;EAClC,KAAK,eAAe,UAAU,YAAY;CAC5C;;;;CAKA,AAAO,YAAY,OAAqB;E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KA,AAAO,SAAS,QAAiB,QAAiB,cAAuB;EACvE,OAAO,KAAK,QAAQ,cAAc,cAAc;GAAE;GAAQ;EAAO,CAAC;CACpE;;CAGA,AAAO,SAAS,cAAuB;EACrC,OAAO,KAAK,QAAQ,cAAc,YAAY;CAChD;;;;CAKA,AAAO,aAAa;EAClB,OAAO,KAAK,8BAAc,IAAI,KAAK,CAAC;CACtC;;;;;;;;;;;;;;;;;CAkBA,AAAgB,aAAa,SAA2B,iBAAmC;EACzF,MAAM,SAA2B;GAAE,MAAM;GAAU,QAAQ;EAAY;EAGvE,MAAM,WAAW,eAAe,KAAK,OAAO,MAAM;EAClD,IAAI,UAAU,WAAW,cACvB,OAAO,SAAS;OACX,IAAI,UAAU,WAAW,YAC9B,OAAO,SAAS;EAMlB,IAAI,OAAO,WAAW,aACpB,KAAK,MAAM,KAAK,KAAK,kBAAkB;GACrC,MAAM,OAAO,EAAE,SAAS;GACxB,IAAI,SAAS,UAAU,SAAS,QAAQ;IACtC,OAAO,SAAS;IAChB;GACF;GAEA,MAAM,aAAa,EAAE,SAAS;GAE9B,IAAI,eAAe,cAAc;IAC/B,OAAO,SAAS;IAChB;GACF;GAEA,IAAI,eAAe,YAAY;IAC7B,OAAO,SAAS;IAChB;GACF;EACF;EAGF,IAAI,KAAK,YAAY,cAAc,QAAQ,MAAM;EAEjD,OAAO;CACT;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"discriminated-union-validator.d.mts","names":[],"sources":["../../../../../../../seal/src/validators/discriminated-union-validator.ts"],"mappings":";;;;;;;;;;AAuCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,2BAAA,6CAEM,aAAA,CAAc,eAAA,SAAwB,aAAA,CAAc,eAAA,gBAC7D,aAAA;EAKC,aAAA,EAAe,CAAA;EACf,UAAA,EAAY,QAAA;;UAJb,QAAA;cAGC,aAAA,EAAe,CAAA,EACf,UAAA,EAAY,QAAA;EAAA;;;;;EAAA,eAYN,cAAA;EAkCC,WAAA,CAAY,KAAA;EAIN,QAAA,CAAS,IAAA,OAAW,OAAA,EAAS,aAAA,GAAgB,OAAA,CAAQ,gBAAA;EAwC3D,KAAA;EAxCmD;;;;;;;;AA4DuB;EAA1E,YAAA,CAAa,MAAA,GAAQ,gBAAA,GAAqC,gBAAA;AAAA"}
1
+ {"version":3,"file":"discriminated-union-validator.d.mts","names":[],"sources":["../../../../../../../seal/src/validators/discriminated-union-validator.ts"],"mappings":";;;;;;;;;;;AAuCA;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,2BAAA,6CAEM,aAAA,CAAc,eAAA,SAAwB,aAAA,CAAc,eAAA,gBAC7D,aAAA;EAKC,aAAA,EAAe,CAAA;EACf,UAAA,EAAY,QAAA;EAJb;EAAA,QAAA,QAAA;cAGC,aAAA,EAAe,CAAA,EACf,UAAA,EAAY,QAAA;EADZ;;;;;EAAA,eAaM,cAAA;EAkCC,WAAA,CAAY,KAAA;EAIN,QAAA,CAAS,IAAA,OAAW,OAAA,EAAS,aAAA,GAAgB,OAAA,CAAQ,gBAAA;EAwC3D,KAAA;EAxC0B;;;;;;;;;EA4D1B,YAAA,CAAa,MAAA,GAAQ,gBAAA,GAAqC,gBAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"float-validator.mjs","names":[],"sources":["../../../../../../../seal/src/validators/float-validator.ts"],"sourcesContent":["import { floatRule } from \"../rules\";\r\nimport { NumberValidator } from \"./number-validator\";\r\n\r\n/**\r\n * Float validator class\r\n */\r\nexport class FloatValidator extends NumberValidator {\r\n public constructor(errorMessage?: string) {\r\n super();\r\n this.addMutableRule(floatRule, errorMessage);\r\n }\r\n}\r\n"],"mappings":";;;;;;;;AAMA,IAAa,iBAAb,cAAoC,gBAAgB;CAClD,AAAO,YAAY,cAAuB;EACxC,MAAM;EACN,KAAK,eAAe,WAAW,YAAY;CAC7C;AACF"}
1
+ {"version":3,"file":"float-validator.mjs","names":[],"sources":["../../../../../../../seal/src/validators/float-validator.ts"],"sourcesContent":["import { floatRule } from \"../rules\";\nimport { NumberValidator } from \"./number-validator\";\n\n/**\n * Float validator class\n */\nexport class FloatValidator extends NumberValidator {\n public constructor(errorMessage?: string) {\n super();\n this.addMutableRule(floatRule, errorMessage);\n }\n}\n"],"mappings":";;;;;;;;AAMA,IAAa,iBAAb,cAAoC,gBAAgB;CAClD,AAAO,YAAY,cAAuB;EACxC,MAAM;EACN,KAAK,eAAe,WAAW,YAAY;CAC7C;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"int-validator.mjs","names":[],"sources":["../../../../../../../seal/src/validators/int-validator.ts"],"sourcesContent":["import { intRule } from \"../rules\";\r\nimport { NumberValidator } from \"./number-validator\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Integer validator class\r\n */\r\nexport class IntValidator extends NumberValidator {\r\n public constructor(errorMessage?: string) {\r\n super();\r\n this.addMutableRule(intRule, errorMessage);\r\n }\r\n\r\n /**\r\n * @inheritdoc — returns `{ type: \"integer\" }` instead of `{ type: \"number\" }`\r\n *\r\n * @example\r\n * ```ts\r\n * v.int().min(1).max(100).toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"integer\", minimum: 1, maximum: 100 }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n return this.buildNumberJsonSchema(\"integer\", target);\r\n }\r\n}\r\n"],"mappings":";;;;;;;;AAOA,IAAa,eAAb,cAAkC,gBAAgB;CAChD,AAAO,YAAY,cAAuB;EACxC,MAAM;EACN,KAAK,eAAe,SAAS,YAAY;CAC3C;;;;;;;;;;CAWA,AAAgB,aAAa,SAA2B,iBAAmC;EACzF,OAAO,KAAK,sBAAsB,WAAW,MAAM;CACrD;AACF"}
1
+ {"version":3,"file":"int-validator.mjs","names":[],"sources":["../../../../../../../seal/src/validators/int-validator.ts"],"sourcesContent":["import { intRule } from \"../rules\";\nimport { NumberValidator } from \"./number-validator\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\n\n/**\n * Integer validator class\n */\nexport class IntValidator extends NumberValidator {\n public constructor(errorMessage?: string) {\n super();\n this.addMutableRule(intRule, errorMessage);\n }\n\n /**\n * @inheritdoc — returns `{ type: \"integer\" }` instead of `{ type: \"number\" }`\n *\n * @example\n * ```ts\n * v.int().min(1).max(100).toJsonSchema(\"draft-2020-12\")\n * // → { type: \"integer\", minimum: 1, maximum: 100 }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n return this.buildNumberJsonSchema(\"integer\", target);\n }\n}\n"],"mappings":";;;;;;;;AAOA,IAAa,eAAb,cAAkC,gBAAgB;CAChD,AAAO,YAAY,cAAuB;EACxC,MAAM;EACN,KAAK,eAAe,SAAS,YAAY;CAC3C;;;;;;;;;;CAWA,AAAgB,aAAa,SAA2B,iBAAmC;EACzF,OAAO,KAAK,sBAAsB,WAAW,MAAM;CACrD;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"lazy-validator.d.mts","names":[],"sources":["../../../../../../../seal/src/validators/lazy-validator.ts"],"mappings":";;;;;;;;;AA4CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,aAAA,WAAwB,aAAA,GAAgB,aAAA,UAAuB,aAAA;EAAA,QAG/C,KAAA;EAAA,QAFnB,iBAAA;cAEmB,KAAA,QAAa,CAAA;;;;;UAYhC,OAAA;EAQc,QAAA,CAAS,IAAA,OAAW,OAAA,EAAS,aAAA,GAAgB,OAAA,CAAQ,gBAAA;EAI3D,WAAA,CAAY,KAAA;EAIZ,KAAA;;;;;;;;EAkBA,YAAA,CAAa,MAAA,GAAQ,gBAAA,GAAqC,gBAAA;AAAA"}
1
+ {"version":3,"file":"lazy-validator.d.mts","names":[],"sources":["../../../../../../../seal/src/validators/lazy-validator.ts"],"mappings":";;;;;;;;;;AA4CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,aAAA,WAAwB,aAAA,GAAgB,aAAA,UAAuB,aAAA;EAAA,QAG/C,KAAA;EAAA,QAFnB,iBAAA;cAEmB,KAAA,QAAa,CAAA;;;;;UAYhC,OAAA;EAQc,QAAA,CAAS,IAAA,OAAW,OAAA,EAAS,aAAA,GAAgB,OAAA,CAAQ,gBAAA;EAI3D,WAAA,CAAY,KAAA;EAIZ,KAAA;;;;;;;;EAkBA,YAAA,CAAa,MAAA,GAAQ,gBAAA,GAAqC,gBAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"literal-validator.d.mts","names":[],"sources":["../../../../../../../seal/src/validators/literal-validator.ts"],"mappings":";;;;;;AAqBA;;;;;;;;;;;;cAAa,gBAAA,oGAEH,aAAA;EACD,MAAA,EAAQ,CAAA;cAEI,MAAA,EAAQ,CAAA,EAAG,YAAA;EAAH;;;EAuBpB,WAAA,CAAY,KAAA;EAAA;;;;;;;EAWH,KAAA;;;;;;;;;;;;;;;EAoBA,YAAA,CAAa,MAAA,GAAQ,gBAAA,GAAqC,gBAAA;AAAA"}
1
+ {"version":3,"file":"literal-validator.d.mts","names":[],"sources":["../../../../../../../seal/src/validators/literal-validator.ts"],"mappings":";;;;;;AAmBA;;;;;;;;;;;;cAAa,gBAAA,oGAEH,aAAA;EACD,MAAA,EAAQ,CAAA;cAEI,MAAA,EAAQ,CAAA,EAAG,YAAA;EAAH;;;EAqBpB,WAAA,CAAY,KAAA;EAAA;;;;;;;EAWH,KAAA;;;;;;;;;;;;;;;EAoBA,YAAA,CAAa,MAAA,GAAQ,gBAAA,GAAqC,gBAAA;AAAA"}
@@ -1,6 +1,4 @@
1
1
  import { applyNullable } from "../standard-schema/json-schema.mjs";
2
- import { isEmptyValue } from "../helpers/is-empty-value.mjs";
3
- import { presentRule } from "../rules/core/required.mjs";
4
2
  import { BaseValidator } from "./base-validator.mjs";
5
3
  import { literalRule } from "../rules/common/literal.mjs";
6
4
 
@@ -22,9 +20,9 @@ import { literalRule } from "../rules/common/literal.mjs";
22
20
  var LiteralValidator = class extends BaseValidator {
23
21
  constructor(values, errorMessage) {
24
22
  super();
23
+ this.blankIsMissing = true;
25
24
  this.values = values;
26
25
  this.addMutableRule(literalRule, errorMessage, { values });
27
- if (values.some((value) => isEmptyValue(value))) this.requiredRule = this.createRule(presentRule);
28
26
  }
29
27
  /**
30
28
  * Check if value is one of the configured literals
@@ -1 +1 @@
1
- {"version":3,"file":"literal-validator.mjs","names":[],"sources":["../../../../../../../seal/src/validators/literal-validator.ts"],"sourcesContent":["import { isEmptyValue } from \"../helpers/is-empty-value\";\nimport { literalRule } from \"../rules/common/literal\";\nimport { presentRule } from \"../rules/core/required\";\nimport { applyNullable } from \"../standard-schema/json-schema\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport { BaseValidator } from \"./base-validator\";\n\n/**\n * Literal validator class\n *\n * Accepts a fixed tuple of primitive literal values (string, number, boolean).\n * The TypeScript type narrows to the union of those literals — `v.literal(\"a\", \"b\")`\n * infers as `\"a\" | \"b\"`, not `string`. Use for discriminator fields, enum-like\n * unions of constants, and any case where `oneOf([...])` would lose literal types.\n *\n * @example\n * v.literal(\"items\") // type: \"items\"\n * v.literal(\"draft\", \"published\") // type: \"draft\" | \"published\"\n * v.literal(1, 2, 3) // type: 1 | 2 | 3\n * v.literal(true) // type: true\n */\nexport class LiteralValidator<\n T extends readonly (string | number | boolean)[] = readonly (string | number | boolean)[],\n> extends BaseValidator {\n public values: T;\n\n public constructor(values: T, errorMessage?: string) {\n super();\n this.values = values;\n this.addMutableRule(literalRule, errorMessage, { values });\n\n // `\"\"` is a value, not an absence. Every validator is required by default,\n // and `required` rejects anything `isEmptyValue` calls empty — including the\n // empty string — so `v.literal(\"\")` could never pass. When the author has\n // explicitly listed an empty value as acceptable, swap `required` for\n // `present`: the key must still exist, but judging the value is the literal\n // set's job, and it is already the stricter statement of intent.\n //\n // Dropping the rule entirely instead would make a missing key valid, which\n // is the opposite mistake — `alt=\"\"` and no `alt` at all are different\n // things to a screen reader, and to anything else reading the schema.\n if (values.some(value => isEmptyValue(value))) {\n this.requiredRule = this.createRule(presentRule);\n }\n }\n\n /**\n * Check if value is one of the configured literals\n */\n public matchesType(value: any): boolean {\n return (this.values as readonly any[]).includes(value);\n }\n\n /**\n * Clone the validator, preserving the literal `values` set.\n *\n * The base `clone()` only copies `BaseValidator` fields, so without this\n * override a cloned literal loses its public `values` array — which breaks\n * any consumer that reads it (e.g. `discriminatedUnion` branch routing).\n */\n public override clone(): this {\n const cloned = super.clone();\n cloned.values = this.values;\n return cloned;\n }\n\n /**\n * @inheritdoc\n *\n * Single literal → `{ const: <value> }`. Multiple → `{ enum: [...] }`.\n *\n * @example\n * ```ts\n * v.literal(\"items\").toJsonSchema()\n * // → { const: \"items\" }\n *\n * v.literal(\"draft\", \"published\").toJsonSchema()\n * // → { enum: [\"draft\", \"published\"] }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const schema: JsonSchemaResult =\n this.values.length === 1 ? { const: this.values[0] } : { enum: [...this.values] };\n if (this.isNullable) applyNullable(schema, target);\n return schema;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,IAAa,mBAAb,cAEU,cAAc;CAGtB,AAAO,YAAY,QAAW,cAAuB;EACnD,MAAM;EACN,KAAK,SAAS;EACd,KAAK,eAAe,aAAa,cAAc,EAAE,OAAO,CAAC;EAYzD,IAAI,OAAO,MAAK,UAAS,aAAa,KAAK,CAAC,GAC1C,KAAK,eAAe,KAAK,WAAW,WAAW;CAEnD;;;;CAKA,AAAO,YAAY,OAAqB;EACtC,OAAQ,KAAK,OAA0B,SAAS,KAAK;CACvD;;;;;;;;CASA,AAAgB,QAAc;EAC5B,MAAM,SAAS,MAAM,MAAM;EAC3B,OAAO,SAAS,KAAK;EACrB,OAAO;CACT;;;;;;;;;;;;;;;CAgBA,AAAgB,aAAa,SAA2B,iBAAmC;EACzF,MAAM,SACJ,KAAK,OAAO,WAAW,IAAI,EAAE,OAAO,KAAK,OAAO,GAAG,IAAI,EAAE,MAAM,CAAC,GAAG,KAAK,MAAM,EAAE;EAClF,IAAI,KAAK,YAAY,cAAc,QAAQ,MAAM;EACjD,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"literal-validator.mjs","names":[],"sources":["../../../../../../../seal/src/validators/literal-validator.ts"],"sourcesContent":["import { literalRule } from \"../rules/common/literal\";\nimport { applyNullable } from \"../standard-schema/json-schema\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport { BaseValidator } from \"./base-validator\";\n\n/**\n * Literal validator class\n *\n * Accepts a fixed tuple of primitive literal values (string, number, boolean).\n * The TypeScript type narrows to the union of those literals — `v.literal(\"a\", \"b\")`\n * infers as `\"a\" | \"b\"`, not `string`. Use for discriminator fields, enum-like\n * unions of constants, and any case where `oneOf([...])` would lose literal types.\n *\n * @example\n * v.literal(\"items\") // type: \"items\"\n * v.literal(\"draft\", \"published\") // type: \"draft\" | \"published\"\n * v.literal(1, 2, 3) // type: 1 | 2 | 3\n * v.literal(true) // type: true\n */\nexport class LiteralValidator<\n T extends readonly (string | number | boolean)[] = readonly (string | number | boolean)[],\n> extends BaseValidator {\n public values: T;\n\n public constructor(values: T, errorMessage?: string) {\n super();\n this.blankIsMissing = true;\n this.values = values;\n this.addMutableRule(literalRule, errorMessage, { values });\n\n // `\"\"` is a value, not an absence. Every validator is required by default,\n // and `required` rejects anything `isEmptyValue` calls empty — including the\n // empty string — so `v.literal(\"\")` could never pass. When the author has\n // explicitly listed an empty value as acceptable, swap `required` for\n // `present`: the key must still exist, but judging the value is the literal\n // set's job, and it is already the stricter statement of intent.\n //\n // Dropping the rule entirely instead would make a missing key valid, which\n // is the opposite mistake — `alt=\"\"` and no `alt` at all are different\n // things to a screen reader, and to anything else reading the schema.\n }\n\n /**\n * Check if value is one of the configured literals\n */\n public matchesType(value: any): boolean {\n return (this.values as readonly any[]).includes(value);\n }\n\n /**\n * Clone the validator, preserving the literal `values` set.\n *\n * The base `clone()` only copies `BaseValidator` fields, so without this\n * override a cloned literal loses its public `values` array — which breaks\n * any consumer that reads it (e.g. `discriminatedUnion` branch routing).\n */\n public override clone(): this {\n const cloned = super.clone();\n cloned.values = this.values;\n return cloned;\n }\n\n /**\n * @inheritdoc\n *\n * Single literal → `{ const: <value> }`. Multiple → `{ enum: [...] }`.\n *\n * @example\n * ```ts\n * v.literal(\"items\").toJsonSchema()\n * // → { const: \"items\" }\n *\n * v.literal(\"draft\", \"published\").toJsonSchema()\n * // → { enum: [\"draft\", \"published\"] }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const schema: JsonSchemaResult =\n this.values.length === 1 ? { const: this.values[0] } : { enum: [...this.values] };\n if (this.isNullable) applyNullable(schema, target);\n return schema;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,IAAa,mBAAb,cAEU,cAAc;CAGtB,AAAO,YAAY,QAAW,cAAuB;EACnD,MAAM;EACN,KAAK,iBAAiB;EACtB,KAAK,SAAS;EACd,KAAK,eAAe,aAAa,cAAc,EAAE,OAAO,CAAC;CAY3D;;;;CAKA,AAAO,YAAY,OAAqB;EACtC,OAAQ,KAAK,OAA0B,SAAS,KAAK;CACvD;;;;;;;;CASA,AAAgB,QAAc;EAC5B,MAAM,SAAS,MAAM,MAAM;EAC3B,OAAO,SAAS,KAAK;EACrB,OAAO;CACT;;;;;;;;;;;;;;;CAgBA,AAAgB,aAAa,SAA2B,iBAAmC;EACzF,MAAM,SACJ,KAAK,OAAO,WAAW,IAAI,EAAE,OAAO,KAAK,OAAO,GAAG,IAAI,EAAE,MAAM,CAAC,GAAG,KAAK,MAAM,EAAE;EAClF,IAAI,KAAK,YAAY,cAAc,QAAQ,MAAM;EACjD,OAAO;CACT;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"managed-validator.d.mts","names":[],"sources":["../../../../../../../seal/src/validators/managed-validator.ts"],"mappings":";;;;;;;AAQA;;KAAY,eAAA,mBAAkC,OAAA,EAAS,aAAA,KAAkB,OAAA,GAAU,OAAA,CAAQ,OAAA;;;;;;;;;;;;;;AAAO;AAsBlG;;;;;;cAAa,gBAAA,wBAAwC,iBAAA,CAAkB,OAAA;EAAlB;;;;;;cAOvC,QAAA,EAAU,eAAA,CAAgB,OAAA,GAAU,eAAA,GAAkB,aAAA;AAAA"}
1
+ {"version":3,"file":"managed-validator.d.mts","names":[],"sources":["../../../../../../../seal/src/validators/managed-validator.ts"],"mappings":";;;;;;;;AAQA;KAAY,eAAA,mBAAkC,OAAA,EAAS,aAAA,KAAkB,OAAA,GAAU,OAAA,CAAQ,OAAA;;;;;;;;;;;;;;;AAAO;AAsBlG;;;;;cAAa,gBAAA,wBAAwC,iBAAA,CAAkB,OAAA;EAOH;;;;;;cAAtD,QAAA,EAAU,eAAA,CAAgB,OAAA,GAAU,eAAA,GAAkB,aAAA;AAAA"}
@@ -1,5 +1,4 @@
1
1
  import { WhenRuleOptions } from "../../types/conditional-types.mjs";
2
-
3
2
  //#region ../seal/src/validators/methods/equality-conditional-methods.d.ts
4
3
  /**
5
4
  * Marker re-exported by the validators barrel so the dts bundler keeps this
@@ -1 +1 @@
1
- {"version":3,"file":"equality-conditional-methods.d.mts","names":[],"sources":["../../../../../../../../seal/src/validators/methods/equality-conditional-methods.ts"],"mappings":";;;;;AAUA;;cAAa,iCAAA;AAAA;EAAA,UAGD,aAAA;IAH0C;;;IAOlD,KAAA,CAAM,KAAA,OAAY,YAAA;IA0DW;;;IArD7B,MAAA,CAAO,KAAA,UAAe,YAAA;IA+EyB;;;IA1E/C,aAAA,CAAc,KAAA,UAAe,YAAA;IAVX;;;IAelB,aAAA,CAAc,KAAA,UAAe,YAAA;IAL7B;;;IAUA,oBAAA,CAAqB,KAAA,UAAe,YAAA;IALtB;;;;;;;;;;;;;;;;;AAqEqE;;;;;;;;;;;;;;;;;;;IA1BnF,IAAA,CAAK,KAAA,UAAe,OAAA,EAAS,IAAA,CAAK,eAAA;;;;;;;;;;;;;;;;;;;;;;;;;IA0BlC,WAAA,CAAY,YAAA,UAAsB,OAAA,EAAS,IAAA,CAAK,eAAA;EAAA;AAAA"}
1
+ {"version":3,"file":"equality-conditional-methods.d.mts","names":[],"sources":["../../../../../../../../seal/src/validators/methods/equality-conditional-methods.ts"],"mappings":";;;;;AAUA;cAAa,iCAAA;AAAA;EAAA,UAGD,aAAA;IAHkC;AAAQ;;IAOlD,KAAA,CAAM,KAAA,OAAY,YAAA;IA0DgB;;;IArDlC,MAAA,CAAO,KAAA,UAAe,YAAA;IA+EyB;;;IA1E/C,aAAA,CAAc,KAAA,UAAe,YAAA;IAVvB;;;IAeN,aAAA,CAAc,KAAA,UAAe,YAAA;IAVP;;;IAetB,oBAAA,CAAqB,KAAA,UAAe,YAAA;IALpC;;;;;;;;;;;;;;;;;;AAqEmF;;;;;;;;;;;;;;;;;;IA1BnF,IAAA,CAAK,KAAA,UAAe,OAAA,EAAS,IAAA,CAAK,eAAA;;;;;;;;;;;;;;;;;;;;;;;;;IA0BlC,WAAA,CAAY,YAAA,UAAsB,OAAA,EAAS,IAAA,CAAK,eAAA;EAAA;AAAA"}