@warlock.js/seal 4.1.7 → 4.1.10

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 (199) hide show
  1. package/cjs/index.cjs +92 -92
  2. package/cjs/index.cjs.map +1 -1
  3. package/esm/config.d.mts +1 -1
  4. package/esm/config.mjs +1 -1
  5. package/esm/factory/validate.d.mts +1 -1
  6. package/esm/factory/validate.mjs +1 -1
  7. package/esm/factory/validators.d.mts +1 -1
  8. package/esm/factory/validators.mjs +1 -1
  9. package/esm/helpers/date-helpers.d.mts +1 -1
  10. package/esm/helpers/date-helpers.mjs +1 -1
  11. package/esm/helpers/file.utils.d.mts +1 -1
  12. package/esm/helpers/file.utils.mjs +1 -1
  13. package/esm/helpers/get-field-value.d.mts +1 -1
  14. package/esm/helpers/get-field-value.mjs +1 -1
  15. package/esm/helpers/is-empty-value.mjs +1 -1
  16. package/esm/helpers/path-helpers.d.mts +1 -1
  17. package/esm/helpers/path-helpers.mjs +1 -1
  18. package/esm/helpers/validation-helpers.d.mts +1 -1
  19. package/esm/helpers/validation-helpers.mjs +1 -1
  20. package/esm/index.d.mts +5 -1
  21. package/esm/mutators/array-mutators.d.mts +1 -1
  22. package/esm/mutators/array-mutators.mjs +1 -1
  23. package/esm/mutators/date-mutators.d.mts +1 -1
  24. package/esm/mutators/date-mutators.mjs +1 -1
  25. package/esm/mutators/number-mutators.d.mts +1 -1
  26. package/esm/mutators/number-mutators.mjs +1 -1
  27. package/esm/mutators/object-mutators.d.mts +1 -1
  28. package/esm/mutators/object-mutators.mjs +1 -1
  29. package/esm/mutators/scalar-mutators.d.mts +1 -1
  30. package/esm/mutators/scalar-mutators.mjs +1 -1
  31. package/esm/mutators/string-mutators.d.mts +1 -1
  32. package/esm/mutators/string-mutators.mjs +1 -1
  33. package/esm/plugins/plugin-system.d.mts +1 -1
  34. package/esm/plugins/plugin-system.mjs +1 -1
  35. package/esm/rules/array/array-rules.d.mts +1 -1
  36. package/esm/rules/array/array-rules.mjs +1 -1
  37. package/esm/rules/color/color-rules.d.mts +1 -1
  38. package/esm/rules/color/color-rules.mjs +1 -1
  39. package/esm/rules/common/enum.d.mts +1 -1
  40. package/esm/rules/common/enum.mjs +1 -1
  41. package/esm/rules/common/equals-field-rules.d.mts +1 -1
  42. package/esm/rules/common/equals-field-rules.mjs +1 -1
  43. package/esm/rules/common/instanceof.d.mts +1 -1
  44. package/esm/rules/common/instanceof.mjs +1 -1
  45. package/esm/rules/common/literal.d.mts +1 -1
  46. package/esm/rules/common/literal.mjs +1 -1
  47. package/esm/rules/common/type-rules.d.mts +1 -1
  48. package/esm/rules/common/type-rules.mjs +1 -1
  49. package/esm/rules/common/unknown-key.d.mts +1 -1
  50. package/esm/rules/common/unknown-key.mjs +1 -1
  51. package/esm/rules/conditional/forbidden-if-rules.d.mts +1 -1
  52. package/esm/rules/conditional/forbidden-if-rules.mjs +1 -1
  53. package/esm/rules/conditional/present-if-rules.d.mts +1 -1
  54. package/esm/rules/conditional/present-if-rules.mjs +1 -1
  55. package/esm/rules/conditional/present-unless-rules.d.mts +1 -1
  56. package/esm/rules/conditional/present-unless-rules.mjs +1 -1
  57. package/esm/rules/conditional/present-with-rules.d.mts +1 -1
  58. package/esm/rules/conditional/present-with-rules.mjs +1 -1
  59. package/esm/rules/conditional/present-without-rules.d.mts +1 -1
  60. package/esm/rules/conditional/present-without-rules.mjs +1 -1
  61. package/esm/rules/conditional/required-if-rules.d.mts +1 -1
  62. package/esm/rules/conditional/required-if-rules.mjs +1 -1
  63. package/esm/rules/conditional/required-unless-rules.d.mts +1 -1
  64. package/esm/rules/conditional/required-unless-rules.mjs +1 -1
  65. package/esm/rules/conditional/required-when-rule.d.mts +1 -1
  66. package/esm/rules/conditional/required-when-rule.mjs +1 -1
  67. package/esm/rules/conditional/required-with-rules.d.mts +1 -1
  68. package/esm/rules/conditional/required-with-rules.mjs +1 -1
  69. package/esm/rules/conditional/required-without-rules.d.mts +1 -1
  70. package/esm/rules/conditional/required-without-rules.mjs +1 -1
  71. package/esm/rules/core/equal.d.mts +1 -1
  72. package/esm/rules/core/equal.mjs +1 -1
  73. package/esm/rules/core/forbidden.d.mts +1 -1
  74. package/esm/rules/core/forbidden.mjs +1 -1
  75. package/esm/rules/core/required.d.mts +1 -1
  76. package/esm/rules/core/required.mjs +1 -1
  77. package/esm/rules/core/union.d.mts +1 -1
  78. package/esm/rules/core/union.mjs +1 -1
  79. package/esm/rules/core/when.d.mts +1 -1
  80. package/esm/rules/core/when.mjs +1 -1
  81. package/esm/rules/date/date-comparison-rules.d.mts +1 -1
  82. package/esm/rules/date/date-comparison-rules.mjs +1 -1
  83. package/esm/rules/date/date-day-rules.d.mts +1 -1
  84. package/esm/rules/date/date-day-rules.mjs +1 -1
  85. package/esm/rules/date/date-field-comparison-rules.d.mts +1 -1
  86. package/esm/rules/date/date-field-comparison-rules.mjs +1 -1
  87. package/esm/rules/date/date-period-rules.d.mts +1 -1
  88. package/esm/rules/date/date-period-rules.mjs +1 -1
  89. package/esm/rules/date/date-relative-rules.d.mts +1 -1
  90. package/esm/rules/date/date-relative-rules.mjs +1 -1
  91. package/esm/rules/date/date-special-rules.d.mts +1 -1
  92. package/esm/rules/date/date-special-rules.mjs +1 -1
  93. package/esm/rules/date/date.d.mts +1 -1
  94. package/esm/rules/date/date.mjs +1 -1
  95. package/esm/rules/file/dimensions.d.mts +1 -1
  96. package/esm/rules/file/dimensions.mjs +1 -1
  97. package/esm/rules/file/file-size.d.mts +1 -1
  98. package/esm/rules/file/file-size.mjs +1 -1
  99. package/esm/rules/length/length-rules.d.mts +1 -1
  100. package/esm/rules/length/length-rules.mjs +1 -1
  101. package/esm/rules/number/number-rules.d.mts +1 -1
  102. package/esm/rules/number/number-rules.mjs +1 -1
  103. package/esm/rules/scalar/accepted-rule.mjs +1 -1
  104. package/esm/rules/scalar/declined-rule.mjs +1 -1
  105. package/esm/rules/string/alpha.d.mts +1 -1
  106. package/esm/rules/string/alpha.mjs +1 -1
  107. package/esm/rules/string/credit-card.d.mts +1 -1
  108. package/esm/rules/string/credit-card.mjs +1 -1
  109. package/esm/rules/string/email.d.mts +1 -1
  110. package/esm/rules/string/email.mjs +1 -1
  111. package/esm/rules/string/id-formats.d.mts +1 -1
  112. package/esm/rules/string/id-formats.mjs +1 -1
  113. package/esm/rules/string/ip.d.mts +1 -1
  114. package/esm/rules/string/ip.mjs +1 -1
  115. package/esm/rules/string/matches.d.mts +1 -1
  116. package/esm/rules/string/matches.mjs +1 -1
  117. package/esm/rules/string/pattern.d.mts +1 -1
  118. package/esm/rules/string/pattern.mjs +1 -1
  119. package/esm/rules/string/string-comparison.d.mts +1 -1
  120. package/esm/rules/string/string-comparison.mjs +1 -1
  121. package/esm/rules/string/strong-password-rule.d.mts +1 -1
  122. package/esm/rules/string/strong-password-rule.mjs +1 -1
  123. package/esm/rules/string/url.d.mts +1 -1
  124. package/esm/rules/string/url.mjs +1 -1
  125. package/esm/rules/string/without-whitespace.d.mts +1 -1
  126. package/esm/rules/string/without-whitespace.mjs +1 -1
  127. package/esm/standard-schema/json-schema.d.mts +1 -1
  128. package/esm/standard-schema/json-schema.mjs +1 -1
  129. package/esm/standard-schema/map-result.d.mts +1 -1
  130. package/esm/standard-schema/map-result.mjs +1 -1
  131. package/esm/standard-schema/types.d.mts +1 -1
  132. package/esm/types/conditional-types.d.mts +1 -1
  133. package/esm/types/context-types.d.mts +1 -1
  134. package/esm/types/data-transformer-types.d.mts +1 -1
  135. package/esm/types/date-types.d.mts +1 -1
  136. package/esm/types/date-types.mjs +1 -1
  137. package/esm/types/file.types.d.mts +1 -1
  138. package/esm/types/inference-types.d.mts +1 -1
  139. package/esm/types/mutator-types.d.mts +1 -1
  140. package/esm/types/result-types.d.mts +1 -1
  141. package/esm/types/rule-types.d.mts +1 -1
  142. package/esm/types/schema-types.d.mts +1 -1
  143. package/esm/validators/any-validator.d.mts +1 -1
  144. package/esm/validators/any-validator.mjs +1 -1
  145. package/esm/validators/array-validator.d.mts +1 -1
  146. package/esm/validators/array-validator.mjs +1 -1
  147. package/esm/validators/base-validator.d.mts +1 -1
  148. package/esm/validators/base-validator.mjs +1 -1
  149. package/esm/validators/boolean-validator.d.mts +1 -1
  150. package/esm/validators/boolean-validator.mjs +1 -1
  151. package/esm/validators/computed-validator.d.mts +1 -1
  152. package/esm/validators/computed-validator.mjs +1 -1
  153. package/esm/validators/date-validator.d.mts +1 -1
  154. package/esm/validators/date-validator.mjs +1 -1
  155. package/esm/validators/discriminated-union-validator.d.mts +1 -1
  156. package/esm/validators/discriminated-union-validator.mjs +1 -1
  157. package/esm/validators/float-validator.d.mts +1 -1
  158. package/esm/validators/float-validator.mjs +1 -1
  159. package/esm/validators/instanceof-validator.d.mts +1 -1
  160. package/esm/validators/instanceof-validator.mjs +1 -1
  161. package/esm/validators/int-validator.d.mts +1 -1
  162. package/esm/validators/int-validator.mjs +1 -1
  163. package/esm/validators/lazy-validator.d.mts +1 -1
  164. package/esm/validators/lazy-validator.mjs +1 -1
  165. package/esm/validators/literal-validator.d.mts +1 -1
  166. package/esm/validators/literal-validator.mjs +1 -1
  167. package/esm/validators/managed-validator.d.mts +1 -1
  168. package/esm/validators/managed-validator.mjs +1 -1
  169. package/esm/validators/methods/equality-conditional-methods.d.mts +2 -2
  170. package/esm/validators/methods/equality-conditional-methods.mjs +1 -1
  171. package/esm/validators/methods/equality-conditional-methods.mjs.map +1 -1
  172. package/esm/validators/methods/forbidden-methods.d.mts +2 -2
  173. package/esm/validators/methods/forbidden-methods.mjs +1 -1
  174. package/esm/validators/methods/forbidden-methods.mjs.map +1 -1
  175. package/esm/validators/methods/present-methods.d.mts +2 -2
  176. package/esm/validators/methods/present-methods.mjs +1 -1
  177. package/esm/validators/methods/present-methods.mjs.map +1 -1
  178. package/esm/validators/methods/required-methods.d.mts +2 -2
  179. package/esm/validators/methods/required-methods.mjs +1 -1
  180. package/esm/validators/methods/required-methods.mjs.map +1 -1
  181. package/esm/validators/number-validator.d.mts +1 -1
  182. package/esm/validators/number-validator.mjs +1 -1
  183. package/esm/validators/numeric-validator.d.mts +1 -1
  184. package/esm/validators/numeric-validator.mjs +1 -1
  185. package/esm/validators/object-validator.d.mts +1 -1
  186. package/esm/validators/object-validator.mjs +1 -1
  187. package/esm/validators/primitive-validator.d.mts +1 -1
  188. package/esm/validators/primitive-validator.mjs +1 -1
  189. package/esm/validators/record-validator.d.mts +1 -1
  190. package/esm/validators/record-validator.mjs +1 -1
  191. package/esm/validators/scalar-validator.d.mts +1 -1
  192. package/esm/validators/scalar-validator.mjs +1 -1
  193. package/esm/validators/string-validator.d.mts +1 -1
  194. package/esm/validators/string-validator.mjs +1 -1
  195. package/esm/validators/tuple-validator.d.mts +1 -1
  196. package/esm/validators/tuple-validator.mjs +1 -1
  197. package/esm/validators/union-validator.d.mts +1 -1
  198. package/esm/validators/union-validator.mjs +1 -1
  199. package/package.json +1 -1
package/cjs/index.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["defaultRequiredRule","validateFunction"],"sources":["../../../../../@warlock.js/seal/src/standard-schema/json-schema.ts","../../../../../@warlock.js/seal/src/config.ts","../../../../../@warlock.js/seal/src/factory/validate.ts","../../../../../@warlock.js/seal/src/helpers/date-helpers.ts","../../../../../@warlock.js/seal/src/helpers/file.utils.ts","../../../../../@warlock.js/seal/src/helpers/get-field-value.ts","../../../../../@warlock.js/seal/src/helpers/path-helpers.ts","../../../../../@warlock.js/seal/src/helpers/validation-helpers.ts","../../../../../@warlock.js/seal/src/helpers/is-empty-value.ts","../../../../../@warlock.js/seal/src/rules/core/required.ts","../../../../../@warlock.js/seal/src/standard-schema/map-result.ts","../../../../../@warlock.js/seal/src/validators/base-validator.ts","../../../../../@warlock.js/seal/src/validators/any-validator.ts","../../../../../@warlock.js/seal/src/mutators/array-mutators.ts","../../../../../@warlock.js/seal/src/mutators/date-mutators.ts","../../../../../@warlock.js/seal/src/mutators/number-mutators.ts","../../../../../@warlock.js/seal/src/mutators/object-mutators.ts","../../../../../@warlock.js/seal/src/mutators/scalar-mutators.ts","../../../../../@warlock.js/seal/src/mutators/string-mutators.ts","../../../../../@warlock.js/seal/src/rules/core/equal.ts","../../../../../@warlock.js/seal/src/rules/core/forbidden.ts","../../../../../@warlock.js/seal/src/rules/core/union.ts","../../../../../@warlock.js/seal/src/rules/core/when.ts","../../../../../@warlock.js/seal/src/rules/string/alpha.ts","../../../../../@warlock.js/seal/src/rules/string/credit-card.ts","../../../../../@warlock.js/seal/src/rules/string/email.ts","../../../../../@warlock.js/seal/src/rules/string/id-formats.ts","../../../../../@warlock.js/seal/src/rules/string/ip.ts","../../../../../@warlock.js/seal/src/rules/string/matches.ts","../../../../../@warlock.js/seal/src/rules/string/pattern.ts","../../../../../@warlock.js/seal/src/rules/string/string-comparison.ts","../../../../../@warlock.js/seal/src/rules/string/strong-password-rule.ts","../../../../../@warlock.js/seal/src/rules/string/url.ts","../../../../../@warlock.js/seal/src/rules/string/without-whitespace.ts","../../../../../@warlock.js/seal/src/rules/number/number-rules.ts","../../../../../@warlock.js/seal/src/rules/length/length-rules.ts","../../../../../@warlock.js/seal/src/rules/array/array-rules.ts","../../../../../@warlock.js/seal/src/types/date-types.ts","../../../../../@warlock.js/seal/src/rules/date/date.ts","../../../../../@warlock.js/seal/src/rules/date/date-comparison-rules.ts","../../../../../@warlock.js/seal/src/rules/date/date-day-rules.ts","../../../../../@warlock.js/seal/src/rules/date/date-field-comparison-rules.ts","../../../../../@warlock.js/seal/src/rules/date/date-period-rules.ts","../../../../../@warlock.js/seal/src/rules/date/date-relative-rules.ts","../../../../../@warlock.js/seal/src/rules/date/date-special-rules.ts","../../../../../@warlock.js/seal/src/rules/file/dimensions.ts","../../../../../@warlock.js/seal/src/rules/file/file-size.ts","../../../../../@warlock.js/seal/src/rules/color/color-rules.ts","../../../../../@warlock.js/seal/src/rules/conditional/required-if-rules.ts","../../../../../@warlock.js/seal/src/rules/conditional/required-unless-rules.ts","../../../../../@warlock.js/seal/src/rules/conditional/required-when-rule.ts","../../../../../@warlock.js/seal/src/rules/conditional/required-with-rules.ts","../../../../../@warlock.js/seal/src/rules/conditional/required-without-rules.ts","../../../../../@warlock.js/seal/src/rules/conditional/present-if-rules.ts","../../../../../@warlock.js/seal/src/rules/conditional/present-unless-rules.ts","../../../../../@warlock.js/seal/src/rules/conditional/present-with-rules.ts","../../../../../@warlock.js/seal/src/rules/conditional/present-without-rules.ts","../../../../../@warlock.js/seal/src/rules/conditional/forbidden-if-rules.ts","../../../../../@warlock.js/seal/src/rules/common/enum.ts","../../../../../@warlock.js/seal/src/rules/common/equals-field-rules.ts","../../../../../@warlock.js/seal/src/rules/common/instanceof.ts","../../../../../@warlock.js/seal/src/rules/common/literal.ts","../../../../../@warlock.js/seal/src/rules/common/type-rules.ts","../../../../../@warlock.js/seal/src/rules/common/unknown-key.ts","../../../../../@warlock.js/seal/src/validators/array-validator.ts","../../../../../@warlock.js/seal/src/validators/methods/equality-conditional-methods.ts","../../../../../@warlock.js/seal/src/validators/methods/forbidden-methods.ts","../../../../../@warlock.js/seal/src/validators/methods/present-methods.ts","../../../../../@warlock.js/seal/src/validators/methods/required-methods.ts","../../../../../@warlock.js/seal/src/validators/primitive-validator.ts","../../../../../@warlock.js/seal/src/rules/scalar/accepted-rule.ts","../../../../../@warlock.js/seal/src/rules/scalar/declined-rule.ts","../../../../../@warlock.js/seal/src/validators/boolean-validator.ts","../../../../../@warlock.js/seal/src/validators/computed-validator.ts","../../../../../@warlock.js/seal/src/validators/date-validator.ts","../../../../../@warlock.js/seal/src/validators/literal-validator.ts","../../../../../@warlock.js/seal/src/validators/discriminated-union-validator.ts","../../../../../@warlock.js/seal/src/validators/number-validator.ts","../../../../../@warlock.js/seal/src/validators/float-validator.ts","../../../../../@warlock.js/seal/src/validators/instanceof-validator.ts","../../../../../@warlock.js/seal/src/validators/int-validator.ts","../../../../../@warlock.js/seal/src/validators/lazy-validator.ts","../../../../../@warlock.js/seal/src/validators/managed-validator.ts","../../../../../@warlock.js/seal/src/validators/numeric-validator.ts","../../../../../@warlock.js/seal/src/validators/object-validator.ts","../../../../../@warlock.js/seal/src/validators/record-validator.ts","../../../../../@warlock.js/seal/src/validators/scalar-validator.ts","../../../../../@warlock.js/seal/src/validators/string-validator.ts","../../../../../@warlock.js/seal/src/validators/tuple-validator.ts","../../../../../@warlock.js/seal/src/validators/union-validator.ts","../../../../../@warlock.js/seal/src/factory/validators.ts","../../../../../@warlock.js/seal/src/plugins/plugin-system.ts"],"sourcesContent":["import type { StandardJSONSchemaV1 } from \"./types\";\n\n/**\n * Supported JSON Schema generation targets.\n */\nexport type JsonSchemaTarget = StandardJSONSchemaV1.Target;\n\n/**\n * The result shape for a generated JSON Schema.\n */\nexport type JsonSchemaResult = Record<string, unknown>;\n\n/**\n * Apply nullable to a JSON Schema object based on the target dialect.\n *\n * - draft-2020-12 : `type` becomes an array: `[\"string\", \"null\"]`\n * - openai-strict : same as draft-2020-12 (type array form)\n * - draft-07 : wraps in `oneOf: [{ ...schema }, { type: \"null\" }]`\n * - openapi-3.0 : adds `nullable: true` alongside the existing type\n *\n * Mutates the schema in-place.\n *\n * @example\n * ```ts\n * const schema = { type: \"string\" };\n * applyNullable(schema, \"draft-2020-12\");\n * // → { type: [\"string\", \"null\"] }\n * ```\n */\nexport function applyNullable(schema: JsonSchemaResult, target: JsonSchemaTarget): void {\n if (target === \"openapi-3.0\") {\n schema.nullable = true;\n return;\n }\n\n if (target === \"draft-2020-12\" || target === \"openai-strict\") {\n const baseType = schema.type as string | string[] | undefined;\n schema.type = Array.isArray(baseType)\n ? [...baseType, \"null\"]\n : [baseType as string, \"null\"];\n return;\n }\n\n // draft-07: oneOf wrapping\n const copy = { ...schema };\n for (const key of Object.keys(schema)) {\n delete schema[key];\n }\n schema.oneOf = [copy, { type: \"null\" }];\n}\n\n/**\n * Wrap a field schema as nullable for OpenAI strict mode.\n *\n * OpenAI strict requires optional fields to be expressed as a nullable type\n * rather than being omitted from the `required` array. This helper wraps a\n * given schema into its nullable equivalent using the type-array form.\n *\n * Unlike `applyNullable()` (which mutates in-place), this returns a new\n * schema object to avoid side effects when wrapping child schemas.\n *\n * @example\n * ```ts\n * wrapNullableStrict({ type: \"string\", minLength: 3 })\n * // → { type: [\"string\", \"null\"], minLength: 3 }\n *\n * wrapNullableStrict({ type: \"object\", properties: {...} })\n * // → { type: [\"object\", \"null\"], properties: {...} }\n *\n * wrapNullableStrict({ oneOf: [...] })\n * // → { oneOf: [..., { type: \"null\" }] }\n * ```\n */\nexport function wrapNullableStrict(schema: JsonSchemaResult): JsonSchemaResult {\n // If the schema uses oneOf/anyOf (e.g. union), append null to the list\n if (schema.oneOf) {\n return { ...schema, oneOf: [...(schema.oneOf as unknown[]), { type: \"null\" }] };\n }\n\n if (schema.anyOf) {\n return { ...schema, anyOf: [...(schema.anyOf as unknown[]), { type: \"null\" }] };\n }\n\n // If there's no type at all (permissive `{}`), stay permissive\n if (schema.type === undefined) {\n return schema;\n }\n\n // Standard case: wrap type into array with null\n const baseType = schema.type as string | string[];\n return {\n ...schema,\n type: Array.isArray(baseType) ? [...baseType, \"null\"] : [baseType, \"null\"],\n };\n}\n\n/**\n * Find the first rule matching the given name in a rules array,\n * and return its options bag.\n */\nexport function getRuleOptions(\n rules: Array<{ name: string; context: { options: Record<string, unknown> } }>,\n ruleName: string,\n): Record<string, unknown> | undefined {\n const rule = rules.find(r => r.name === ruleName);\n return rule?.context?.options as Record<string, unknown> | undefined;\n}\n","/**\r\n * Seal Configuration\r\n *\r\n * Global configuration for the Seal validation library\r\n */\r\n\r\nimport type { AttributeTranslation, RuleTranslation } from \"./types\";\r\n\r\nexport type TranslateRuleCallback = (\r\n ruleTranslation: RuleTranslation,\r\n) => string;\r\n\r\nexport type TranslateAttributeCallback = (\r\n attributeTranslation: AttributeTranslation,\r\n) => string;\r\n\r\nexport type SealConfig = {\r\n /**\r\n * Translation function for error messages\r\n * Default: returns the key with attributes replaced\r\n */\r\n translateRule?: TranslateRuleCallback;\r\n /**\r\n * Translation function for attribute messages\r\n */\r\n translateAttribute?: TranslateAttributeCallback;\r\n\r\n /**\r\n * Default to first error only in validation\r\n * Default: true\r\n */\r\n firstErrorOnly?: boolean;\r\n};\r\n\r\n/**\r\n * Global Seal configuration\r\n */\r\nconst config: SealConfig = {\r\n firstErrorOnly: true,\r\n};\r\n\r\n/**\r\n * Configure Seal globally\r\n *\r\n * @example\r\n * ```ts\r\n * import { configureSeal } from \"@warlock.js/seal\";\r\n * import { trans } from \"@mongez/localization\";\r\n *\r\n * configureSeal({\r\n * translateRule: (ruleTranslation) => trans(`validation.${ruleTranslation.rule.name}`, ruleTranslation.attributes),\r\n * translateAttribute: (attributeTranslation) => trans(`validation.attributes.${attributeTranslation.rule.name}.${attributeTranslation.attribute}`, attributeTranslation.context.allValues),\r\n * });\r\n * ```\r\n */\r\nexport function configureSeal(options: Partial<SealConfig>): void {\r\n Object.assign(config, options);\r\n}\r\n\r\n/**\r\n * Get current Seal configuration\r\n */\r\nexport function getSealConfig(): SealConfig {\r\n return config;\r\n}\r\n\r\n/**\r\n * Reset configuration to defaults\r\n */\r\nexport function resetSealConfig(): void {\r\n delete config.translateRule;\r\n delete config.translateAttribute;\r\n\r\n config.firstErrorOnly = true;\r\n}\r\n","import { getSealConfig } from \"../config\";\r\nimport type { SchemaContext, ValidationResult } from \"../types\";\r\nimport type { BaseValidator } from \"../validators\";\r\nimport { type ValidateOptions } from \"./validators\";\r\n\r\n/**\r\n * Validate data against a schema\r\n */\r\nexport const validate = async <T extends BaseValidator>(\r\n schema: T,\r\n data: any, // Temporarily use any - will fix type inference\r\n { context: extendedContext, ...configurations }: ValidateOptions = getSealConfig() || {},\r\n): Promise<ValidationResult> => {\r\n const context: SchemaContext = {\r\n allValues: data,\r\n parent: null,\r\n value: data,\r\n key: \"\",\r\n path: \"\",\r\n context: extendedContext,\r\n rootContext: extendedContext,\r\n translateRule(ruleTranslation) {\r\n return configurations.translateRule?.(ruleTranslation) ?? \"\";\r\n },\r\n translateAttribute(attributeTranslation) {\r\n return configurations.translateAttribute?.(attributeTranslation) ?? \"\";\r\n },\r\n configurations,\r\n };\r\n\r\n return await schema.validate(data, context);\r\n};\r\n","/**\r\n * Detect if value is a date value or field name\r\n *\r\n * Date values:\r\n * - Date instance\r\n * - Number (timestamp)\r\n * - String with date separators (- or /)\r\n *\r\n * Field names:\r\n * - Strings without - or /\r\n *\r\n * @param value - Value to check\r\n * @returns true if it's a date value, false if it's a field name\r\n */\r\nexport function isDateValue(value: any): boolean {\r\n if (value instanceof Date) return true;\r\n\r\n const date = new Date(value);\r\n\r\n return !isNaN(date.getTime());\r\n}\r\n","import type { FileSizeOption } from \"../types/file.types\";\n\nexport function resolveFileSize(size: number | FileSizeOption): number {\n if (typeof size === \"number\") {\n return size;\n }\n\n switch (size.unit) {\n case \"B\":\n return size.size;\n case \"KB\":\n return size.size * 1024;\n case \"MB\":\n return size.size * 1024 * 1024;\n case \"GB\":\n return size.size * 1024 * 1024 * 1024;\n }\n}\n\n/**\n * Convert the given size to a human size\n * i.e 2MB, 0.5MB, 120KB, 1.5GB..etc\n */\nexport function humanizeSize(sizeInBits: number): string {\n const units = [\"B\", \"KB\", \"MB\", \"GB\"];\n let size = sizeInBits;\n let unitIndex = 0;\n\n while (size >= 1024 && unitIndex < units.length - 1) {\n size /= 1024;\n unitIndex++;\n }\n\n return `${Number.isInteger(size) ? size : size.toFixed(2)}${units[unitIndex]}`;\n}\n","import { get } from \"@mongez/reinforcements\";\r\nimport type { ContextualSchemaRule, SchemaContext } from \"../types\";\r\n\r\n/**\r\n * Get field value based on scope from rule options\r\n *\r\n * This utility extracts a field value from either the global context or sibling context\r\n * based on the `scope` option in the rule's context.\r\n *\r\n * @param rule - The contextual schema rule containing options with:\r\n * - `field` (or custom fieldKey): The field name to extract\r\n * - `scope` (optional): Either \"global\" (default) or \"sibling\"\r\n * @param context - The schema validation context containing allValues and parent\r\n * @param fieldKey - The key in rule.context.options that contains the field name (defaults to \"field\")\r\n *\r\n * @returns The value of the specified field from the appropriate source\r\n *\r\n * @example\r\n * // In a validation rule with scope support:\r\n * async validate(value: any, context) {\r\n * const otherFieldValue = getFieldValue(this, context);\r\n * // Extracts from context.allValues if scope is \"global\"\r\n * // Extracts from context.parent if scope is \"sibling\"\r\n * }\r\n *\r\n * @example\r\n * // Using a custom field key:\r\n * async validate(value: any, context) {\r\n * const compareValue = getFieldValue(this, context, \"compareField\");\r\n * // Looks for rule.context.options.compareField instead of .field\r\n * }\r\n *\r\n * @remarks\r\n * - **Global scope** (`scope: \"global\"`): Searches the entire input data (context.allValues)\r\n * - **Sibling scope** (`scope: \"sibling\"`): Searches only within the parent object (context.parent)\r\n * - Uses `@mongez/reinforcements.get()` to support nested paths (e.g., \"user.email\")\r\n */\r\nexport function getFieldValue(\r\n rule: ContextualSchemaRule,\r\n context: SchemaContext,\r\n fieldKey = \"field\",\r\n) {\r\n const field = rule.context.options[fieldKey];\r\n const scope = rule.context.options.scope || \"global\";\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n return get(source, field);\r\n}\r\n","/**\r\n * Set the key path for nested validation\r\n */\r\nexport const setKeyPath = (path: string, key: string): string => {\r\n if (!path) return key;\r\n return `${path}.${key}`;\r\n};\r\n","import { getSealConfig } from \"../config\";\nimport type { ContextualSchemaRule, RuleResult, RuleTranslation, SchemaContext } from \"../types\";\n\nexport const VALID_RULE: RuleResult = {\n isValid: true,\n};\n/**\n * Resolve a single attribute value through the full translation priority chain:\n * 1. attributesList[key] — developer direct text override (highest priority)\n * 2. translatedAttributes[key] — developer explicit translation key\n * 3. translator(rawValue) — auto-translate the raw value (fallback)\n *\n * Use this in rule bodies when you need per-item translation\n * (e.g. translating each enum value before joining them).\n *\n * @example\n * // Translate each enum value individually then join\n * const enumList = enumValues\n * .map(v => resolveTranslation(String(v), String(v), this, context))\n * .join(\", \");\n * this.context.translationParams.enumList = enumList;\n */\nexport const resolveTranslation = ({\n key,\n rawValue,\n rule,\n context,\n}: {\n key: string;\n rawValue: any;\n rule: ContextualSchemaRule;\n context: SchemaContext;\n}): string => {\n const translator = getSealConfig().translateAttribute;\n\n // 1. Direct text override wins\n const direct = rule.context.attributesList?.[key];\n if (direct && typeof direct === \"string\") return direct;\n\n if (!translator) return String(rawValue ?? key);\n\n // 2. Explicit translation key\n const transKey = rule.context.translatedAttributes?.[key];\n if (transKey) return translator({ attribute: transKey, context, rule });\n\n // 3. Auto-translate the raw value (fallback)\n return translator({ attribute: String(rawValue ?? key), context, rule });\n};\n\n// Internal alias — invalidRule uses the same function without re-importing config\nconst resolveAttribute = resolveTranslation;\n\nexport const invalidRule = (rule: ContextualSchemaRule, context: SchemaContext): RuleResult => {\n // `input` is always translatable — rules may add more (e.g., field references in sameAs)\n // Rule-defined translatableParams override the default input if the key matches\n const translatableWithInput: Record<string, string> = {\n // Fall back to \"schema\" when validating at the root level (no key)\n input: context.key || \"schema\",\n ...rule.context.translatableParams,\n };\n\n // Resolve all translatable params through the full priority chain\n const resolvedParams = Object.fromEntries(\n Object.entries(translatableWithInput).map(([key, rawValue]) => [\n key,\n resolveAttribute({ key, rawValue, rule, context }),\n ]),\n );\n\n const attributes: RuleTranslation[\"attributes\"] = {\n path: context.path,\n key: context.key,\n value: context.value,\n // Raw placeholders (:enumList, :min, :max, etc.) — no translation\n ...rule.context.translationParams,\n // Translated placeholders (:input, :field, etc.) — override raws if key collides\n ...resolvedParams,\n // Satisfy TypeScript's required field (always present via resolvedParams)\n input: resolvedParams.input,\n };\n\n const rawError =\n rule.context.errorMessage ||\n rule.errorMessage ||\n context.translateRule?.({ rule, context, attributes }) ||\n rule.defaultErrorMessage!;\n\n // Fallback interpolation: replace :placeholder patterns from attributes\n // This kicks in when translateRule is absent or returns \"\" (not configured)\n const error = rawError.replace(/:([a-zA-Z_]+)/g, (match, key) =>\n key in attributes ? String(attributes[key as keyof typeof attributes]) : match,\n );\n\n return {\n isValid: false,\n error,\n input: attributes.input, // use resolved input, not raw context.key (may be \"\")\n path: context.path,\n };\n};\n","import { isEmpty, isObject } from \"@mongez/supportive-is\";\n\nexport function isEmptyValue(value: any) {\n return isEmpty(value) && !isObject(value);\n}\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Required rule - value must be present and not empty\r\n */\r\nexport const requiredRule: SchemaRule = {\r\n name: \"required\",\r\n defaultErrorMessage: \"The :input is required\",\r\n requiresValue: false,\r\n sortOrder: -2,\r\n async validate(value: any, context) {\r\n if (isEmptyValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present rule - key must exist in the data, but value can be anything\r\n * (empty string, null are all valid as long as the key exists)\r\n */\r\nexport const presentRule: SchemaRule = {\r\n name: \"present\",\r\n defaultErrorMessage: \"The :input field is required\",\r\n requiresValue: false,\r\n sortOrder: -2,\r\n async validate(value: any, context) {\r\n if (value === undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import type { ValidationResult } from \"../types\";\nimport type { StandardSchemaV1 } from \"./types\";\n\n/**\n * Maps a Seal ValidationResult to a Standard Schema result shape.\n *\n * Seal error paths are dot-notation strings (e.g. \"address.city\").\n * Standard Schema expects an array of path segments: [{ key: \"address\" }, { key: \"city\" }].\n *\n * @example\n * ```ts\n * const result = await validator.validate(value, context);\n * return mapToStandardResult(result);\n * // Success → { value: <data> }\n * // Failure → { issues: [{ message: \"...\", path: [{ key: \"...\" }] }] }\n * ```\n */\nexport function mapToStandardResult(\n result: ValidationResult,\n): StandardSchemaV1.Result<unknown> {\n if (result.isValid) {\n return { value: result.data };\n }\n\n return {\n issues: result.errors.map(e => ({\n message: e.error,\n path: e.input\n ? e.input.split(\".\").map(key => ({ key }))\n : undefined,\n })),\n };\n}\n","import { clone } from \"@mongez/reinforcements\";\nimport { validate } from \"../factory/validate\";\nimport { VALID_RULE, invalidRule } from \"../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\n | ((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 in attributes) {\n instance.attributesText[key] = attributes[key];\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 in attributes) {\n instance.translatedAttributes[key] = attributes[key];\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\n | ((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 const mutatedData = 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 // 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) && isEmpty) 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","import type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\nimport { applyNullable } from \"../standard-schema/json-schema\";\r\nimport { BaseValidator } from \"./base-validator\";\r\n\r\n/**\r\n * Any validator - accepts any value\r\n */\r\nexport class AnyValidator extends BaseValidator {\r\n /**\r\n * Any validator means any value, so we disable the default required requirement.\r\n */\r\n public override requiredRule = null;\r\n\r\n /**\r\n * Set is optional to be true\r\n */\r\n public override isOptional = true;\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Any validator accepts anything. In JSON Schema, an empty object `{}`\r\n * is the permissive schema that accepts any valid JSON value.\r\n *\r\n * @example\r\n * ```ts\r\n * v.any().toJsonSchema(\"draft-2020-12\")\r\n * // → {}\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const schema: JsonSchemaResult = {};\r\n if (this.isNullable) applyNullable(schema, target);\r\n return schema;\r\n }\r\n}\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { isEmptyValue } from \"../helpers/is-empty-value\";\r\nimport type { Mutator } from \"../types\";\r\n\r\n/** Reverse array order */\r\nexport const flipArrayMutator: Mutator = async (value) => {\r\n return value.reverse();\r\n};\r\n\r\n/** Reverse array order (alias) */\r\nexport const reverseArrayMutator: Mutator = async (value) => {\r\n return value.reverse();\r\n};\r\n\r\n/** Sort array */\r\nexport const sortArrayMutator: Mutator = async (value, context) => {\r\n if (!Array.isArray(value)) return value;\r\n\r\n const sortDirection = context?.options.direction ?? \"asc\";\r\n const sortByKey = context?.options.key ?? null;\r\n\r\n return value.sort((a: any, b: any) => {\r\n if (sortByKey) {\r\n const aValue = get(a, sortByKey);\r\n const bValue = get(b, sortByKey);\r\n\r\n if (sortDirection === \"asc\") {\r\n return aValue - bValue;\r\n }\r\n return bValue - aValue;\r\n }\r\n\r\n if (sortDirection === \"asc\") {\r\n return a - b;\r\n }\r\n return b - a;\r\n });\r\n};\r\n\r\n/** Make array have only unique values */\r\nexport const uniqueArrayMutator: Mutator = async (value) => {\r\n return [...new Set(value)];\r\n};\r\n\r\n/** Remove empty elements from array */\r\nexport const removeEmptyArrayElementsMutator: Mutator = async (value) => {\r\n return value.filter((item: any) => !isEmptyValue(item));\r\n};\r\n","import dayjs from \"dayjs\";\r\nimport type { Mutator } from \"../types\";\r\n\r\n/**\r\n * Convert value to Date object\r\n * Returns Invalid Date if value cannot be converted\r\n */\r\nexport const dateMutator: Mutator = async (value) => {\r\n // Handle null/undefined\r\n if (!value) {\r\n return;\r\n }\r\n\r\n // Already a Date object\r\n if (value instanceof Date) {\r\n return value;\r\n }\r\n\r\n // Try to convert to Date\r\n const date = new Date(value);\r\n\r\n // Return the date (valid or Invalid Date)\r\n // dateRule will validate and fail if invalid\r\n return date;\r\n};\r\n\r\n/** Convert date to ISO string format */\r\nexport const toISOStringMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n return date.toISOString();\r\n};\r\n\r\n/** Convert date to Unix timestamp (milliseconds) */\r\nexport const toTimestampMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n return date.getTime();\r\n};\r\n\r\n/** Convert date to start of day (00:00:00) */\r\nexport const toStartOfDayMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n date.setHours(0, 0, 0, 0);\r\n return date;\r\n};\r\n\r\n/** Convert date to end of day (23:59:59.999) */\r\nexport const toEndOfDayMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n date.setHours(23, 59, 59, 999);\r\n return date;\r\n};\r\n\r\n/** Add or subtract days from date */\r\nexport const addDaysMutator: Mutator = async (value, context) => {\r\n const date = new Date(value);\r\n const days = context?.options.days ?? 0;\r\n date.setDate(date.getDate() + days);\r\n return date;\r\n};\r\n\r\n/** Add or subtract months from date */\r\nexport const addMonthsMutator: Mutator = async (value, context) => {\r\n const date = new Date(value);\r\n const months = context?.options.months ?? 0;\r\n date.setMonth(date.getMonth() + months);\r\n return date;\r\n};\r\n\r\n/** Add or subtract years from date */\r\nexport const addYearsMutator: Mutator = async (value, context) => {\r\n const date = new Date(value);\r\n const years = context?.options.years ?? 0;\r\n date.setFullYear(date.getFullYear() + years);\r\n return date;\r\n};\r\n\r\n/** Add or subtract hours from date */\r\nexport const addHoursMutator: Mutator = async (value, context) => {\r\n const date = new Date(value);\r\n const hours = context?.options.hours ?? 0;\r\n date.setHours(date.getHours() + hours);\r\n return date;\r\n};\r\n\r\n/** Convert date to UTC */\r\nexport const toUTCMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n return new Date(date.toUTCString());\r\n};\r\n\r\n/** Convert date to specific format using dayjs */\r\nexport const toFormatMutator: Mutator = async (value, context) => {\r\n const format = context?.options.format ?? \"YYYY-MM-DD\";\r\n return dayjs(value).format(format);\r\n};\r\n\r\n/** Convert to date only (remove time) */\r\nexport const toDateOnlyMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n return date.toISOString().split(\"T\")[0];\r\n};\r\n\r\n/** Convert to time only (HH:MM:SS) */\r\nexport const toTimeOnlyMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n return date.toTimeString().split(\" \")[0];\r\n};\r\n\r\n/** Set to start of month */\r\nexport const toStartOfMonthMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n date.setDate(1);\r\n date.setHours(0, 0, 0, 0);\r\n return date;\r\n};\r\n\r\n/** Set to end of month */\r\nexport const toEndOfMonthMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n date.setMonth(date.getMonth() + 1);\r\n date.setDate(0);\r\n date.setHours(23, 59, 59, 999);\r\n return date;\r\n};\r\n\r\n/** Set to start of year */\r\nexport const toStartOfYearMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n date.setMonth(0);\r\n date.setDate(1);\r\n date.setHours(0, 0, 0, 0);\r\n return date;\r\n};\r\n\r\n/** Set to end of year */\r\nexport const toEndOfYearMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n date.setMonth(11);\r\n date.setDate(31);\r\n date.setHours(23, 59, 59, 999);\r\n return date;\r\n};\r\n","import { round } from \"@mongez/reinforcements\";\r\nimport { isNumeric } from \"@mongez/supportive-is\";\r\nimport type { Mutator } from \"../types\";\r\n\r\n/** Convert value to number */\r\nexport const numberMutator: Mutator = async (value) => {\r\n if (!value) return value;\r\n return Number(value);\r\n};\r\n\r\n/** Round number to specified decimals */\r\nexport const roundNumberMutator: Mutator = async (value, context) => {\r\n return round(value, context?.options?.decimals ?? 2);\r\n};\r\n\r\n/** Convert to boolean */\r\nexport const booleanMutator: Mutator = async (value) => {\r\n if (value === \"true\") return true;\r\n if (value === \"false\") return false;\r\n return Boolean(value);\r\n};\r\n\r\nexport const numericMutator: Mutator = async (value) => {\r\n if (!isNumeric(value)) return value;\r\n return Number(value);\r\n};\r\n\r\n/** Absolute value mutator */\r\nexport const absMutator: Mutator = async (value) => {\r\n return Math.abs(Number(value));\r\n};\r\n\r\n/** Ceil mutator */\r\nexport const ceilMutator: Mutator = async (value) => {\r\n return Math.ceil(Number(value));\r\n};\r\n\r\n/** Floor mutator */\r\nexport const floorMutator: Mutator = async (value) => {\r\n return Math.floor(Number(value));\r\n};\r\n\r\n/**\r\n * Round mutator\r\n * Supports decimal precision via options.decimals\r\n */\r\nexport const roundMutator: Mutator = async (value, context) => {\r\n const decimals = context?.options?.decimals ?? 0;\r\n // If decimals is 0, use standard Math.round for integers\r\n if (decimals === 0) {\r\n return Math.round(Number(value));\r\n }\r\n // Otherwise use reinforcements round helper for precision\r\n return round(Number(value), decimals);\r\n};\r\n\r\n/** To fixed mutator */\r\nexport const toFixedMutator: Mutator = async (value, context) => {\r\n const decimals = context?.options?.decimals ?? 2;\r\n return Number(value).toFixed(decimals);\r\n};\r\n","import { trim } from \"@mongez/reinforcements\";\r\nimport { isPlainObject } from \"@mongez/supportive-is\";\r\nimport type { Mutator } from \"../types\";\r\n\r\n/** Strip unknown keys from object */\r\nexport const stripUnknownMutator: Mutator = async (value, context) => {\r\n const allowedKeys = [\r\n ...(context?.ctx.schema ? Object.keys(context.ctx.schema) : []),\r\n ...(context?.options.allowedKeys ?? []),\r\n ];\r\n\r\n const result: Record<string, any> = {};\r\n\r\n for (const key in value) {\r\n if (allowedKeys.includes(key)) {\r\n result[key] = value[key];\r\n }\r\n }\r\n\r\n return result;\r\n};\r\n\r\n/** Trim all string values in object */\r\nexport const objectTrimMutator: Mutator = async (value, context) => {\r\n if (!isPlainObject(value)) return value;\r\n\r\n const result: Record<string, any> = {};\r\n const recursive = context?.options.recursive ?? false;\r\n\r\n for (const key in value) {\r\n const item = value[key];\r\n\r\n if (recursive) {\r\n if (Array.isArray(item)) {\r\n result[key] = await Promise.all(\r\n item.map(async (i: any) =>\r\n typeof i === \"string\" ? trim(i) : await objectTrimMutator(i, context),\r\n ),\r\n );\r\n } else if (isPlainObject(item)) {\r\n result[key] = await objectTrimMutator(item, context);\r\n } else {\r\n result[key] = typeof item === \"string\" ? trim(item) : item;\r\n }\r\n } else {\r\n result[key] = typeof item === \"string\" ? trim(item) : item;\r\n }\r\n }\r\n\r\n return result;\r\n};\r\n\r\n/** Parse JSON string */\r\nexport const jsonMutator: Mutator = async (value) => {\r\n try {\r\n return JSON.parse(value);\r\n } catch {\r\n return value;\r\n }\r\n};\r\n","import type { Mutator } from \"../types\";\r\n\r\nexport const stringMutator: Mutator = async (value) => {\r\n if ([undefined, null].includes(value)) {\r\n return value;\r\n }\r\n\r\n return String(value);\r\n};\r\n","import {\r\n capitalize,\r\n ltrim,\r\n readMoreChars,\r\n rtrim,\r\n toCamelCase,\r\n toKebabCase,\r\n toSnakeCase,\r\n toStudlyCase,\r\n trim,\r\n} from \"@mongez/reinforcements\";\r\nimport type { Mutator } from \"../types\";\r\n\r\n/** Convert string to lowercase */\r\nexport const lowercaseMutator: Mutator = async (value) => {\r\n return value?.toString().toLowerCase();\r\n};\r\n\r\n/** Convert string to uppercase */\r\nexport const uppercaseMutator: Mutator = async (value) => {\r\n return value?.toString().toUpperCase();\r\n};\r\n\r\n/** Capitalize only the first letter of the string */\r\nexport const capitalizeMutator: Mutator = async (value) => {\r\n const str = value?.toString();\r\n return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();\r\n};\r\n\r\n/** Capitalize the first letter of each word (Title Case) */\r\nexport const titleCaseMutator: Mutator = async (value) => {\r\n return capitalize(value?.toString());\r\n};\r\n\r\n/** Convert value to string */\r\nexport const stringifyMutator: Mutator = async (value) => {\r\n if (!value && value !== 0) return \"\";\r\n // only convert numbers, boolean and strings\r\n\r\n // Handle strings (pass through)\r\n if (typeof value === \"string\") return value;\r\n\r\n // Handle scalar types (number, boolean)\r\n if (typeof value === \"number\" || typeof value === \"boolean\") {\r\n return String(value);\r\n }\r\n};\r\n\r\n/** Trim whitespace */\r\nexport const trimMutator: Mutator = async (value, context) => {\r\n return trim(value?.toString(), context?.options?.needle ?? \" \");\r\n};\r\n\r\n/** Remove HTML tags (safe HTML) */\r\nexport const safeHtmlMutator: Mutator = async (value) => {\r\n return value?.toString().replace(/<[^>]*>?/gm, \"\");\r\n};\r\n\r\n/** HTML escape */\r\nexport const htmlEscapeMutator: Mutator = async (value) => {\r\n return value\r\n ?.toString()\r\n .replace(/&/g, \"&amp;\")\r\n .replace(/</g, \"&lt;\")\r\n .replace(/>/g, \"&gt;\")\r\n .replace(/\"/g, \"&quot;\")\r\n .replace(/'/g, \"&#039;\");\r\n};\r\n\r\n/** Remove special characters */\r\nexport const removeSpecialCharactersMutator: Mutator = async (value) => {\r\n return value?.toString().replace(/[^a-zA-Z0-9]/g, \"\");\r\n};\r\n\r\n/** URL decode */\r\nexport const urlDecodeMutator: Mutator = async (value) => {\r\n return decodeURIComponent(value);\r\n};\r\n\r\n/** URL encode */\r\nexport const urlEncodeMutator: Mutator = async (value) => {\r\n return encodeURIComponent(value);\r\n};\r\n\r\n/** Convert to camelCase */\r\nexport const camelCaseMutator: Mutator = async (value) => {\r\n return toCamelCase(value?.toString());\r\n};\r\n\r\n/** Convert to PascalCase */\r\nexport const pascalCaseMutator: Mutator = async (value) => {\r\n return toStudlyCase(value?.toString());\r\n};\r\n\r\n/** Convert to snake_case */\r\nexport const snakeCaseMutator: Mutator = async (value) => {\r\n return toSnakeCase(value?.toString());\r\n};\r\n\r\n/** Convert to kebab-case */\r\nexport const kebabCaseMutator: Mutator = async (value) => {\r\n return toKebabCase(value?.toString());\r\n};\r\n\r\n/** Convert to URL-friendly slug */\r\nexport const slugMutator: Mutator = async (value) => {\r\n return value\r\n ?.toString()\r\n .toLowerCase()\r\n .trim()\r\n .replace(/[^\\w\\s-]/g, \"\")\r\n .replace(/[\\s_]+/g, \"-\")\r\n .replace(/--+/g, \"-\")\r\n .replace(/^-+|-+$/g, \"\");\r\n};\r\n\r\n/** Trim from the left/start */\r\nexport const ltrimMutator: Mutator = async (value, context) => {\r\n return ltrim(value?.toString(), context?.options?.needle ?? \" \");\r\n};\r\n\r\n/** Trim from the right/end */\r\nexport const rtrimMutator: Mutator = async (value, context) => {\r\n return rtrim(value?.toString(), context?.options?.needle ?? \" \");\r\n};\r\n\r\n/** Base64 encode */\r\nexport const base64EncodeMutator: Mutator = async (value) => {\r\n return Buffer.from(value?.toString()).toString(\"base64\");\r\n};\r\n\r\n/** Base64 decode */\r\nexport const base64DecodeMutator: Mutator = async (value) => {\r\n return Buffer.from(value?.toString(), \"base64\").toString(\"utf-8\");\r\n};\r\n\r\n/** Replace substring or pattern */\r\nexport const replaceMutator: Mutator = async (value, context) => {\r\n const { search, replace } = context?.options;\r\n if (!search) return value?.toString();\r\n return value?.toString().replace(search, replace ?? \"\");\r\n};\r\n\r\n/** Replace all occurrences of substring or pattern */\r\nexport const replaceAllMutator: Mutator = async (value, context) => {\r\n const { search, replace } = context?.options;\r\n if (!search) return value?.toString();\r\n const searchValue = typeof search === \"string\" ? new RegExp(search, \"g\") : search;\r\n return value?.toString().replace(searchValue, replace ?? \"\");\r\n};\r\n\r\n/** Append/suffix text to the end */\r\nexport const appendMutator: Mutator = async (value, context) => {\r\n const suffix = context?.options?.suffix ?? \"\";\r\n return value?.toString() + suffix;\r\n};\r\n\r\n/** Prepend/prefix text to the beginning */\r\nexport const prependMutator: Mutator = async (value, context) => {\r\n const prefix = context?.options?.prefix ?? \"\";\r\n return prefix + value?.toString();\r\n};\r\n\r\n/** Reverse the string */\r\nexport const reverseMutator: Mutator = async (value) => {\r\n return value?.toString().split(\"\").reverse().join(\"\");\r\n};\r\n\r\n/** Truncate to a maximum length */\r\nexport const truncateMutator: Mutator = async (value, context) => {\r\n const str = value?.toString();\r\n const maxLength = context?.options?.maxLength ?? 100;\r\n const suffix = context?.options?.suffix ?? \"...\";\r\n return readMoreChars(str, maxLength, suffix);\r\n};\r\n\r\n/** Trim multiple whitespace into single space */\r\nexport const trimMultipleWhitespaceMutator: Mutator = async (value) => {\r\n return value?.toString().replace(/\\s+/g, \" \");\r\n};\r\n\r\n/** Pad string from the start to reach target length */\r\nexport const padStartMutator: Mutator = async (value, context) => {\r\n const length = context?.options?.length ?? 0;\r\n const char = context?.options?.char ?? \" \";\r\n return value?.toString().padStart(length, char);\r\n};\r\n\r\n/** Pad string from the end to reach target length */\r\nexport const padEndMutator: Mutator = async (value, context) => {\r\n const length = context?.options?.length ?? 0;\r\n const char = context?.options?.char ?? \" \";\r\n return value?.toString().padEnd(length, char);\r\n};\r\n\r\n/** Repeat string N times */\r\nexport const repeatMutator: Mutator = async (value, context) => {\r\n const count = context?.options?.count ?? 1;\r\n return value?.toString()?.repeat(count);\r\n};\r\n\r\n/** Mask part of string */\r\nexport const maskMutator: Mutator = async (value, context) => {\r\n const str = value?.toString();\r\n const maskChar = context?.options?.char ?? \"*\";\r\n const start = context?.options?.start ?? 0;\r\n const end = context?.options?.end ?? str?.length;\r\n const visibleStart = str?.substring(0, start);\r\n const visibleEnd = str?.substring(end);\r\n const maskedLength = end - start;\r\n return visibleStart + maskChar.repeat(maskedLength) + visibleEnd;\r\n};\r\n\r\n/** Unescape HTML entities */\r\nexport const unescapeHtmlMutator: Mutator = async (value) => {\r\n return value\r\n ?.toString()\r\n .replace(/&amp;/g, \"&\")\r\n .replace(/&lt;/g, \"<\")\r\n .replace(/&gt;/g, \">\")\r\n .replace(/&quot;/g, '\"')\r\n .replace(/&#039;/g, \"'\");\r\n};\r\n\r\n/** Keep only alphabetic characters */\r\nexport const alphaOnlyMutator: Mutator = async (value) => {\r\n return value.toString().replace(/[^a-zA-Z]/g, \"\");\r\n};\r\n\r\n/** Keep only alphanumeric characters */\r\nexport const alphanumericOnlyMutator: Mutator = async (value) => {\r\n return value.toString().replace(/[^a-zA-Z0-9]/g, \"\");\r\n};\r\n\r\n/** Remove all numeric characters */\r\nexport const removeNumbersMutator: Mutator = async (value) => {\r\n return value.toString().replace(/[0-9]/g, \"\");\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Equal rule - value must be equal to a specific value\r\n */\r\nexport const equalRule: SchemaRule<{ value: any }> = {\r\n name: \"equal\",\r\n defaultErrorMessage: \"The :input must be equal to :value\",\r\n async validate(value: any, context) {\r\n if (value !== this.context.options.value) {\r\n this.context.translatableParams.value = this.context.options.value;\r\n return invalidRule(this, context);\r\n }\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Forbidden rule - value must not be present\r\n */\r\nexport const forbiddenRule: SchemaRule = {\r\n name: \"forbidden\",\r\n defaultErrorMessage: \"The :input is forbidden\",\r\n async validate(value: any, context) {\r\n if (!isEmptyValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport type { BaseValidator } from \"../../validators/base-validator\";\r\n\r\n/**\r\n * Union rule - value must match at least one of the provided validators\r\n */\r\nexport const unionRule: SchemaRule<{ validators: BaseValidator[] }> = {\r\n name: \"union\",\r\n defaultErrorMessage: \"Value must match one of the allowed types\",\r\n async validate(value: any, context) {\r\n const validators = this.context.options.validators;\r\n const firstErrorOnly = context.configurations?.firstErrorOnly ?? true;\r\n const allErrors: string[] = [];\r\n\r\n // Try each validator\r\n for (const validator of validators) {\r\n // Skip if type doesn't match (optimization)\r\n if (!validator.matchesType(value)) {\r\n continue;\r\n }\r\n\r\n // Type matches - validate\r\n const result = await validator.validate(value, context);\r\n\r\n if (result.isValid) {\r\n // Success! Validator matched and validated\r\n return VALID_RULE;\r\n }\r\n\r\n // Failed - collect error message\r\n const errorMsg = result.errors?.[0]?.error || \"Validation failed\";\r\n allErrors.push(errorMsg);\r\n\r\n // If firstErrorOnly, stop after first failed validator\r\n if (firstErrorOnly) {\r\n break;\r\n }\r\n }\r\n\r\n // All failed or no validator matched the type\r\n if (allErrors.length > 0) {\r\n // At least one validator matched type but failed validation\r\n this.context.errorMessage = firstErrorOnly\r\n ? allErrors[0]\r\n : allErrors.join(\"; \");\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule, WhenRuleOptions } from \"../../types\";\r\n\r\n/**\r\n * When rule - conditional validation based on another field value\r\n */\r\nexport const whenRule: SchemaRule<WhenRuleOptions> = {\r\n name: \"when\",\r\n description: \"Apply conditional validation based on another field value\",\r\n async validate(value: any, context) {\r\n const fieldToCheck = this.context.options.field;\r\n const conditions = this.context.options.is;\r\n const otherwise = this.context.options.otherwise;\r\n const scope = this.context.options.scope || \"global\";\r\n\r\n const fieldValue =\r\n scope === \"global\"\r\n ? get(context.allValues, fieldToCheck)\r\n : get(context.parent, fieldToCheck);\r\n\r\n // Convert field value to string for key lookup\r\n // This handles boolean, number, and string field values\r\n const fieldValueKey = String(fieldValue);\r\n\r\n if (conditions[fieldValueKey]) {\r\n const result = await conditions[fieldValueKey].validate(value, context);\r\n if (result.isValid) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Safe error access\r\n this.context.errorMessage =\r\n result.errors?.[0]?.error || \"Validation failed\";\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (otherwise) {\r\n const result = await otherwise.validate(value, context);\r\n\r\n if (result.isValid) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Safe error access\r\n this.context.errorMessage =\r\n result.errors?.[0]?.error || \"Validation failed\";\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Alpha rule - allows only alphabetic characters\r\n */\r\nexport const alphaRule: SchemaRule = {\r\n name: \"alpha\",\r\n defaultErrorMessage: \"The :input must contain only alphabetic characters\",\r\n async validate(value: any, context) {\r\n if (/^[a-zA-Z]+$/.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * AlphaNumeric rule - allows only alphanumeric characters\r\n */\r\nexport const alphaNumericRule: SchemaRule = {\r\n name: \"alphaNumeric\",\r\n defaultErrorMessage: \"The :input must contain only alphanumeric characters\",\r\n async validate(value: any, context) {\r\n if (/^[a-zA-Z0-9]+$/.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Numeric string rule - allows only numeric characters\r\n */\r\nexport const isNumericRule: SchemaRule = {\r\n name: \"numeric\",\r\n defaultErrorMessage: \"The :input must contain only numeric characters\",\r\n async validate(value: any, context) {\r\n if (/^[0-9]+$/.test(String(value))) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Credit card rule - validates credit card number\r\n */\r\nexport const isCreditCardRule: SchemaRule = {\r\n name: \"creditCard\",\r\n defaultErrorMessage: \"The :input must be a valid credit card number\",\r\n async validate(value: any, context) {\r\n // Luhn algorithm for credit card validation\r\n const cardNumber = String(value).replace(/\\s/g, \"\");\r\n\r\n if (!/^\\d+$/.test(cardNumber)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n let sum = 0;\r\n let isEven = false;\r\n\r\n for (let i = cardNumber.length - 1; i >= 0; i--) {\r\n let digit = parseInt(cardNumber[i], 10);\r\n\r\n if (isEven) {\r\n digit *= 2;\r\n if (digit > 9) {\r\n digit -= 9;\r\n }\r\n }\r\n\r\n sum += digit;\r\n isEven = !isEven;\r\n }\r\n\r\n if (sum % 10 === 0) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { isEmail } from \"@mongez/supportive-is\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Email rule - validates email format\r\n */\r\nexport const emailRule: SchemaRule = {\r\n name: \"email\",\r\n defaultErrorMessage: \"The :input must be a valid email address\",\r\n async validate(value: any, context) {\r\n if (isEmail(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Modern ID format validators — UUID, CUID, ULID, nanoid.\n *\n * Each rule asserts the value is a string in the canonical format for its\n * identifier scheme. Rules are intentionally strict (variant nibbles checked\n * for UUID, character classes enforced for ULID's Crockford base32, etc.)\n * so \"looks-like-but-not-valid\" inputs are rejected.\n */\n\nconst UUID_ANY = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nconst UUID_BY_VERSION: Record<1 | 3 | 4 | 5 | 6 | 7, RegExp> = {\n 1: /^[0-9a-f]{8}-[0-9a-f]{4}-1[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 3: /^[0-9a-f]{8}-[0-9a-f]{4}-3[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 4: /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 5: /^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 6: /^[0-9a-f]{8}-[0-9a-f]{4}-6[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 7: /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n};\n\nexport type UUIDVersion = 1 | 3 | 4 | 5 | 6 | 7;\n\n/**\n * UUID rule — value must be a valid UUID. Optionally restrict to a specific version.\n *\n * @example\n * v.string().uuid() // any RFC 4122 UUID\n * v.string().uuid(4) // only v4 (random)\n * v.string().uuid(7) // only v7 (timestamp-ordered)\n */\nexport const uuidRule: SchemaRule<{ version?: UUIDVersion }> = {\n name: \"uuid\",\n defaultErrorMessage: \"The :input must be a valid UUID\",\n async validate(value, context) {\n if (typeof value !== \"string\") return invalidRule(this, context);\n\n const version = this.context.options.version;\n\n const pattern = version ? UUID_BY_VERSION[version] : UUID_ANY;\n if (pattern.test(value)) return VALID_RULE;\n\n if (version !== undefined) {\n this.context.translationParams.version = version;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * CUID rule — value must be a valid CUID.\n *\n * Defaults to CUID2 (24 chars, lowercase, starts with letter — see\n * https://github.com/paralleldrive/cuid2). Pass `{ version: 1 }` for legacy\n * CUID1 format (starts with \"c\", ≥25 chars).\n *\n * @example\n * v.string().cuid() // CUID2\n * v.string().cuid({ version: 1 }) // legacy CUID1\n */\nexport const cuidRule: SchemaRule<{ version?: 1 | 2 }> = {\n name: \"cuid\",\n defaultErrorMessage: \"The :input must be a valid CUID\",\n async validate(value, context) {\n if (typeof value !== \"string\") return invalidRule(this, context);\n const version = this.context.options.version ?? 2;\n const pattern = version === 1 ? /^c[a-z0-9]{24,}$/ : /^[a-z][a-z0-9]{23}$/;\n if (pattern.test(value)) return VALID_RULE;\n this.context.translationParams.version = version;\n return invalidRule(this, context);\n },\n};\n\n/**\n * ULID rule — value must be a valid ULID (26 chars, Crockford base32).\n *\n * Crockford base32 excludes the letters I, L, O, U to avoid ambiguity.\n *\n * @example\n * v.string().ulid()\n */\nexport const ulidRule: SchemaRule = {\n name: \"ulid\",\n defaultErrorMessage: \"The :input must be a valid ULID\",\n async validate(value, context) {\n if (typeof value !== \"string\") return invalidRule(this, context);\n if (/^[0-9A-HJKMNP-TV-Z]{26}$/.test(value)) return VALID_RULE;\n return invalidRule(this, context);\n },\n};\n\n/**\n * nanoid rule — value must be a valid nanoid string.\n *\n * Default length is 21 (standard nanoid). URL-safe alphabet:\n * A–Z, a–z, 0–9, `_`, `-`.\n *\n * @example\n * v.string().nanoid() // 21 chars (default)\n * v.string().nanoid(10) // 10 chars\n */\nexport const nanoidRule: SchemaRule<{ length?: number }> = {\n name: \"nanoid\",\n defaultErrorMessage: \"The :input must be a valid nanoid\",\n async validate(value, context) {\n if (typeof value !== \"string\") return invalidRule(this, context);\n const length = this.context.options.length ?? 21;\n const pattern = new RegExp(`^[A-Za-z0-9_-]{${length}}$`);\n if (pattern.test(value)) return VALID_RULE;\n this.context.translationParams.length = length;\n return invalidRule(this, context);\n },\n};\n","import { isIP } from \"net\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * IP rule - validates IP address (v4 or v6)\r\n */\r\nexport const ipRule: SchemaRule = {\r\n name: \"ip\",\r\n defaultErrorMessage: \"The :input must be a valid IP address\",\r\n async validate(value: any, context) {\r\n if (isIP(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * IPv4 rule - validates IPv4 address\r\n */\r\nexport const ip4Rule: SchemaRule = {\r\n name: \"ip4\",\r\n defaultErrorMessage: \"The :input must be a valid IPv4 address\",\r\n async validate(value: any, context) {\r\n if (isIP(value) === 4) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * IPv6 rule - validates IPv6 address\r\n */\r\nexport const ip6Rule: SchemaRule = {\r\n name: \"ip6\",\r\n defaultErrorMessage: \"The :input must be a valid IPv6 address\",\r\n async validate(value: any, context) {\r\n if (isIP(value) === 6) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Matches rule - value must match another field value\r\n */\r\nexport const matchesRule: SchemaRule<{ field: string }> = {\r\n name: \"matches\",\r\n defaultErrorMessage: \"The :input must match :field\",\r\n async validate(value: any, context) {\r\n const otherFieldValue = get(context.allValues, this.context.options.field);\r\n\r\n if (value === otherFieldValue) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Pattern rule - validates against regex pattern\r\n */\r\nexport const patternRule: SchemaRule<{ pattern: RegExp }> = {\r\n name: \"pattern\",\r\n defaultErrorMessage: \"The :input does not match the required pattern\",\r\n async validate(value: any, context) {\r\n if (this.context.options.pattern.test(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.pattern = this.context.options.pattern.toString();\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Starts with rule\r\n */\r\nexport const startsWithRule: SchemaRule<{ value: string }> = {\r\n name: \"startsWith\",\r\n defaultErrorMessage: \"The :input must start with :value\",\r\n async validate(value: any, context) {\r\n if (String(value).startsWith(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Ends with rule\r\n */\r\nexport const endsWithRule: SchemaRule<{ value: string }> = {\r\n name: \"endsWith\",\r\n defaultErrorMessage: \"The :input must end with :value\",\r\n async validate(value: any, context) {\r\n if (String(value).endsWith(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Contains rule\r\n */\r\nexport const containsRule: SchemaRule<{ value: string }> = {\r\n name: \"contains\",\r\n defaultErrorMessage: \"The :input must contain :value\",\r\n async validate(value: any, context) {\r\n if (String(value).includes(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Not contains rule\r\n */\r\nexport const notContainsRule: SchemaRule<{ value: string }> = {\r\n name: \"notContains\",\r\n defaultErrorMessage: \"The :input must not contain :value\",\r\n async validate(value: any, context) {\r\n if (!String(value).includes(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Strong Password rule - validates password strength\r\n * Requirements:\r\n * - At least 8 characters\r\n * - At least 1 uppercase letter\r\n * - At least 1 lowercase letter\r\n * - At least 1 number\r\n * - At least 1 special character\r\n */\r\nexport const strongPasswordRule: SchemaRule<{ minLength?: number }> = {\r\n name: \"strongPassword\",\r\n defaultErrorMessage:\r\n \"The :input must be at least 8 characters and contain at least one uppercase letter, one lowercase letter, one number, and one special character\",\r\n async validate(value: any, context) {\r\n const password = String(value);\r\n const minLength = this.context.options.minLength ?? 8;\r\n\r\n // Check minimum length\r\n if (password.length < minLength) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Check for at least one uppercase letter\r\n if (!/[A-Z]/.test(password)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Check for at least one lowercase letter\r\n if (!/[a-z]/.test(password)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Check for at least one number\r\n if (!/[0-9]/.test(password)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Check for at least one special character\r\n if (!/[!@#$%^&*()_+\\-=[\\]{};':\"\\\\|,.<>/?]/.test(password)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * URL rule - validates URL format\r\n */\r\nexport const urlRule: SchemaRule = {\r\n name: \"url\",\r\n defaultErrorMessage: \"The :input must be a valid URL\",\r\n async validate(value: any, context) {\r\n try {\r\n new URL(value);\r\n return VALID_RULE;\r\n } catch {\r\n return invalidRule(this, context);\r\n }\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Without whitespace rule - value must not contain whitespace\r\n */\r\nexport const withoutWhitespaceRule: SchemaRule = {\r\n name: \"withoutWhitespace\",\r\n defaultErrorMessage: \"The :input must not contain whitespace\",\r\n async validate(value: any, context) {\r\n if (!/\\s/.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Min rule - value must be equal or greater than minimum\r\n * Supports field names with sibling scope\r\n */\r\nexport const minRule: SchemaRule<{\r\n min: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"min\",\r\n defaultErrorMessage: \"The :input must be at least :min\",\r\n async validate(value: any, context) {\r\n const { min, scope = \"global\" } = this.context.options;\r\n let compareMin: number;\r\n\r\n if (typeof min === \"number\") {\r\n compareMin = min;\r\n this.context.translationParams.min = min;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, min);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.min = min;\r\n\r\n compareMin = Number(fieldValue);\r\n\r\n if (isNaN(compareMin)) {\r\n return VALID_RULE;\r\n }\r\n }\r\n\r\n if (value >= compareMin) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max rule - value must be equal or less than maximum\r\n * Supports field names with sibling scope\r\n */\r\nexport const maxRule: SchemaRule<{\r\n max: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"max\",\r\n defaultErrorMessage: \"The :input must equal to or less than :max\",\r\n async validate(value: any, context) {\r\n const { max, scope = \"global\" } = this.context.options;\r\n let compareMax: number;\r\n\r\n if (typeof max === \"number\") {\r\n compareMax = max;\r\n this.context.translationParams.max = max;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, max);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.max = max;\r\n\r\n compareMax = Number(fieldValue);\r\n\r\n if (isNaN(compareMax)) {\r\n return VALID_RULE;\r\n }\r\n }\r\n\r\n if (value <= compareMax) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Greater than rule - value must be strictly greater than minimum\r\n * Supports field names with sibling scope\r\n */\r\nexport const greaterThanRule: SchemaRule<{\r\n value: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"greaterThan\",\r\n defaultErrorMessage: \"The :input must be greater than :value\",\r\n async validate(value: any, context) {\r\n const { value: compareValue, scope = \"global\" } = this.context.options;\r\n let compareNumber: number;\r\n\r\n if (typeof compareValue === \"number\") {\r\n compareNumber = compareValue;\r\n this.context.translationParams.value = compareValue;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, compareValue);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = compareValue;\r\n\r\n compareNumber = Number(fieldValue);\r\n\r\n if (isNaN(compareNumber)) {\r\n return VALID_RULE;\r\n }\r\n }\r\n\r\n if (value > compareNumber) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Less than rule - value must be strictly less than maximum\r\n * Supports field names with sibling scope\r\n */\r\nexport const lessThanRule: SchemaRule<{\r\n value: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"lessThan\",\r\n defaultErrorMessage: \"The :input must be less than :value\",\r\n async validate(value: any, context) {\r\n const { value: compareValue, scope = \"global\" } = this.context.options;\r\n let compareNumber: number;\r\n\r\n if (typeof compareValue === \"number\") {\r\n compareNumber = compareValue;\r\n this.context.translationParams.value = compareValue;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, compareValue);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = compareValue;\r\n\r\n compareNumber = Number(fieldValue);\r\n\r\n if (isNaN(compareNumber)) {\r\n return VALID_RULE;\r\n }\r\n }\r\n\r\n if (value < compareNumber) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Positive rule - value must be greater than 0\r\n */\r\nexport const positiveRule: SchemaRule = {\r\n name: \"positive\",\r\n defaultErrorMessage: \"The :input must be a positive number\",\r\n async validate(value: any, context) {\r\n if (value > 0) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Negative rule - value must be less than 0\r\n */\r\nexport const negativeRule: SchemaRule = {\r\n name: \"negative\",\r\n defaultErrorMessage: \"The :input must be a negative number\",\r\n async validate(value: any, context) {\r\n if (value < 0) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Odd rule - value must be an odd number\r\n */\r\nexport const oddRule: SchemaRule = {\r\n name: \"odd\",\r\n defaultErrorMessage: \"The :input must be an odd number\",\r\n async validate(value: any, context) {\r\n if (value % 2 !== 0) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Even rule - value must be an even number\r\n */\r\nexport const evenRule: SchemaRule = {\r\n name: \"even\",\r\n defaultErrorMessage: \"The :input must be an even number\",\r\n async validate(value: any, context) {\r\n if (value % 2 === 0) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Modulo rule - value must be divisible by given number\r\n */\r\nexport const moduloRule: SchemaRule<{ value: number }> = {\r\n name: \"modulo\",\r\n defaultErrorMessage: \"The :input must be divisible by :value\",\r\n async validate(value: any, context) {\r\n if (value % this.context.options.value === 0) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between rule - value must be between the given two numbers (Inclusive)\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenNumbersRule: SchemaRule<{\r\n min: number | string;\r\n max: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenNumbers\",\r\n defaultErrorMessage: \"The :input must be between :min and :max\",\r\n async validate(value: any, context) {\r\n const { min, max, scope = \"global\" } = this.context.options;\r\n\r\n // Extract min value\r\n let compareMin: number;\r\n if (typeof min === \"number\") {\r\n compareMin = min;\r\n this.context.translationParams.min = min;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, min);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.min = min;\r\n\r\n compareMin = Number(fieldValue);\r\n if (isNaN(compareMin)) {\r\n return VALID_RULE;\r\n }\r\n }\r\n\r\n // Extract max value\r\n let compareMax: number;\r\n if (typeof max === \"number\") {\r\n compareMax = max;\r\n this.context.translationParams.max = max;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, max);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.max = max;\r\n\r\n compareMax = Number(fieldValue);\r\n if (isNaN(compareMax)) {\r\n return VALID_RULE;\r\n }\r\n }\r\n\r\n if (value >= compareMin && value <= compareMax) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Min length rule - validates minimum length\r\n * Works for any value with a length property (strings, arrays, etc.)\r\n */\r\nexport const minLengthRule: SchemaRule<{ minLength: number }> = {\r\n name: \"minLength\",\r\n defaultErrorMessage: \"The :input must be at least :minLength characters long\",\r\n async validate(value: any, context) {\r\n const length = typeof value?.length === \"number\" ? value.length : String(value || \"\").length;\r\n\r\n if (length >= this.context.options.minLength) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minLength = this.context.options.minLength;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max length rule - validates maximum length\r\n * Works for any value with a length property (strings, arrays, etc.)\r\n */\r\nexport const maxLengthRule: SchemaRule<{ maxLength: number }> = {\r\n name: \"maxLength\",\r\n defaultErrorMessage: \"The :input must not exceed :maxLength characters\",\r\n async validate(value: any, context) {\r\n const length = typeof value?.length === \"number\" ? value.length : String(value || \"\").length;\r\n\r\n if (length <= this.context.options.maxLength) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.maxLength = this.context.options.maxLength;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between length rule - validates length is between min and max (inclusive)\r\n * Works for any value with a length property (strings, arrays, etc.)\r\n */\r\nexport const betweenLengthRule: SchemaRule<{\r\n minLength: number;\r\n maxLength: number;\r\n}> = {\r\n name: \"betweenLength\",\r\n defaultErrorMessage: \"The :input must be between :minLength and :maxLength characters long\",\r\n async validate(value: any, context) {\r\n const length = typeof value?.length === \"number\" ? value.length : String(value || \"\").length;\r\n\r\n if (length >= this.context.options.minLength && length <= this.context.options.maxLength) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minLength = this.context.options.minLength;\r\n this.context.translationParams.maxLength = this.context.options.maxLength;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Length rule - validates exact length\r\n * Works for any value with a length property (strings, arrays, etc.)\r\n */\r\nexport const lengthRule: SchemaRule<{ length: number }> = {\r\n name: \"length\",\r\n defaultErrorMessage: \"The :input must be exactly :length characters long\",\r\n async validate(value: any, context) {\r\n const length = typeof value?.length === \"number\" ? value.length : String(value || \"\").length;\r\n\r\n if (length === this.context.options.length) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.length = this.context.options.length;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min words rule - validates minimum word count\r\n */\r\nexport const minWordsRule: SchemaRule<{ minWords: number }> = {\r\n name: \"minWords\",\r\n defaultErrorMessage: \"The :input must be at least :minWords words\",\r\n async validate(value: any, context) {\r\n if (String(value || \"\").split(\" \").length >= this.context.options.minWords) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minWords = this.context.options.minWords;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max words rule - validates maximum word count\r\n */\r\nexport const maxWordsRule: SchemaRule<{ maxWords: number }> = {\r\n name: \"maxWords\",\r\n defaultErrorMessage: \"The :input must be at most :maxWords words\",\r\n async validate(value: any, context) {\r\n if (String(value || \"\").split(\" \").length <= this.context.options.maxWords) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.maxWords = this.context.options.maxWords;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Words rule - validates exact word count\r\n */\r\nexport const wordsRule: SchemaRule<{ words: number }> = {\r\n name: \"words\",\r\n defaultErrorMessage: \"The :input must be exactly :words words\",\r\n async validate(value: any, context) {\r\n if (String(value || \"\").split(\" \").length === this.context.options.words) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.words = this.context.options.words;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Unique array rule - array must contain unique values\r\n */\r\nexport const uniqueArrayRule: SchemaRule = {\r\n name: \"uniqueArray\",\r\n description: \"The array must contain unique values\",\r\n defaultErrorMessage: \"The :input must contain unique values\",\r\n async validate(value: any, context) {\r\n const uniqueValues = new Set(value);\r\n\r\n if (uniqueValues.size === value.length) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Sorted array rule - array must be sorted\r\n */\r\nexport const sortedArrayRule: SchemaRule<{\r\n direction?: \"asc\" | \"desc\";\r\n}> = {\r\n name: \"sortedArray\",\r\n description: \"The array must be sorted\",\r\n defaultErrorMessage: \"The :input must be sorted\",\r\n async validate(value: any[], context) {\r\n if (!Array.isArray(value) || value.length <= 1) {\r\n return VALID_RULE;\r\n }\r\n\r\n const direction = this.context.options.direction ?? \"asc\";\r\n this.context.translatableParams.direction = direction;\r\n\r\n for (let i = 0; i < value.length - 1; i++) {\r\n const current = value[i];\r\n const next = value[i + 1];\r\n\r\n if (direction === \"asc\") {\r\n if (current > next) {\r\n return invalidRule(this, context);\r\n }\r\n } else {\r\n if (current < next) {\r\n return invalidRule(this, context);\r\n }\r\n }\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","/**\r\n * Week day names for validation\r\n */\r\nexport type WeekDay =\r\n | \"sunday\"\r\n | \"monday\"\r\n | \"tuesday\"\r\n | \"wednesday\"\r\n | \"thursday\"\r\n | \"friday\"\r\n | \"saturday\";\r\n\r\n/**\r\n * Week day numbers mapping\r\n */\r\nexport const WEEK_DAYS: Record<WeekDay, number> = {\r\n sunday: 0,\r\n monday: 1,\r\n tuesday: 2,\r\n wednesday: 3,\r\n thursday: 4,\r\n friday: 5,\r\n saturday: 6,\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isDateValue } from \"../../helpers/date-helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport type { WeekDay } from \"../../types/date-types\";\r\nimport { WEEK_DAYS } from \"../../types/date-types\";\r\n\r\n/**\r\n * Date rule - validates date format\r\n */\r\nexport const dateRule: SchemaRule = {\r\n name: \"date\",\r\n defaultErrorMessage: \"The :input must be a valid date\",\r\n async validate(value: any, context) {\r\n if (value instanceof Date && !isNaN(value.getTime())) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min date rule - date must be >= given date or field\r\n * Smart detection: date value or field name\r\n */\r\nexport const minDateRule: SchemaRule<{\r\n dateOrField: Date | string | number;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minDate\",\r\n description: \"The field must be at least the given date or field\",\r\n defaultErrorMessage: \"The :input must be at least :dateOrField\",\r\n async validate(value: Date, context) {\r\n const { dateOrField, scope = \"global\" } = this.context.options;\r\n let compareDate: Date;\r\n\r\n if (isDateValue(dateOrField)) {\r\n // Value comparison\r\n compareDate = new Date(dateOrField);\r\n } else {\r\n // Field comparison\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dateOrField as string);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n compareDate = new Date(fieldValue);\r\n }\r\n\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate >= compareDate) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max date rule - date must be <= given date or field\r\n * Smart detection: date value or field name\r\n */\r\nexport const maxDateRule: SchemaRule<{\r\n dateOrField: Date | string | number;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxDate\",\r\n defaultErrorMessage: \"The :input must be at most :dateOrField\",\r\n async validate(value: Date, context) {\r\n const { dateOrField, scope = \"global\" } = this.context.options;\r\n let compareDate: Date;\r\n\r\n if (isDateValue(dateOrField)) {\r\n // Value comparison\r\n compareDate = new Date(dateOrField);\r\n } else {\r\n // Field comparison\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dateOrField as string);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n compareDate = new Date(fieldValue);\r\n }\r\n\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate <= compareDate) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * From today rule - date must be today or in the future\r\n */\r\nexport const fromTodayRule: SchemaRule = {\r\n name: \"fromToday\",\r\n defaultErrorMessage: \"The :input must be today or in the future\",\r\n async validate(value: Date, context) {\r\n const today = new Date();\r\n today.setHours(0, 0, 0, 0);\r\n const inputDate = new Date(value);\r\n inputDate.setHours(0, 0, 0, 0);\r\n\r\n if (inputDate >= today) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Before today rule - date must be before today\r\n */\r\nexport const beforeTodayRule: SchemaRule = {\r\n name: \"beforeToday\",\r\n defaultErrorMessage: \"The :input must be before today\",\r\n async validate(value: Date, context) {\r\n const today = new Date();\r\n today.setHours(0, 0, 0, 0);\r\n const inputDate = new Date(value);\r\n inputDate.setHours(0, 0, 0, 0);\r\n\r\n if (inputDate < today) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * From hour rule - time must be from specific hour onwards\r\n */\r\nexport const fromHourRule: SchemaRule<{ hour: number }> = {\r\n name: \"fromHour\",\r\n defaultErrorMessage: \"The :input must be from :hour:00 onwards\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const hour = inputDate.getHours();\r\n\r\n if (hour >= this.context.options.hour) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.hour = this.context.options.hour;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Before hour rule - time must be before specific hour\r\n */\r\nexport const beforeHourRule: SchemaRule<{ hour: number }> = {\r\n name: \"beforeHour\",\r\n defaultErrorMessage: \"The :input must be before :hour:00\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const hour = inputDate.getHours();\r\n\r\n if (hour < this.context.options.hour) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.hour = this.context.options.hour;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between hours rule - time must be between start and end hours\r\n */\r\nexport const betweenHoursRule: SchemaRule<{\r\n startHour: number;\r\n endHour: number;\r\n}> = {\r\n name: \"betweenHours\",\r\n defaultErrorMessage: \"The :input must be between :startHour:00 and :endHour:00\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const hour = inputDate.getHours();\r\n const { startHour, endHour } = this.context.options;\r\n\r\n if (hour >= startHour && hour <= endHour) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startHour = startHour;\r\n this.context.translationParams.endHour = endHour;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * From minute rule - time must be from specific minute onwards\r\n */\r\nexport const fromMinuteRule: SchemaRule<{ minute: number }> = {\r\n name: \"fromMinute\",\r\n defaultErrorMessage: \"The :input must be from minute :minute onwards\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const minute = inputDate.getMinutes();\r\n\r\n if (minute >= this.context.options.minute) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minute = this.context.options.minute;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Before minute rule - time must be before specific minute\r\n */\r\nexport const beforeMinuteRule: SchemaRule<{ minute: number }> = {\r\n name: \"beforeMinute\",\r\n defaultErrorMessage: \"The :input must be before minute :minute\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const minute = inputDate.getMinutes();\r\n\r\n if (minute < this.context.options.minute) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minute = this.context.options.minute;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between minutes rule - time must be between start and end minutes\r\n */\r\nexport const betweenMinutesRule: SchemaRule<{\r\n startMinute: number;\r\n endMinute: number;\r\n}> = {\r\n name: \"betweenMinutes\",\r\n defaultErrorMessage: \"The :input must be between minute :startMinute and :endMinute\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const minute = inputDate.getMinutes();\r\n const { startMinute, endMinute } = this.context.options;\r\n\r\n if (minute >= startMinute && minute <= endMinute) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startMinute = startMinute;\r\n this.context.translationParams.endMinute = endMinute;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Age rule - calculate age from date\r\n */\r\nexport const ageRule: SchemaRule<{ years: number }> = {\r\n name: \"age\",\r\n defaultErrorMessage: \"The :input must be exactly :years years old\",\r\n async validate(value: Date, context) {\r\n const birthDate = new Date(value);\r\n const today = new Date();\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n if (age === this.context.options.years) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.years = this.context.options.years;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min age rule - minimum age requirement\r\n */\r\nexport const minAgeRule: SchemaRule<{ years: number }> = {\r\n name: \"minAge\",\r\n defaultErrorMessage: \"The :input must be at least :years years old\",\r\n async validate(value: Date, context) {\r\n const birthDate = new Date(value);\r\n const today = new Date();\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n if (age >= this.context.options.years) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.years = this.context.options.years;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max age rule - maximum age requirement\r\n */\r\nexport const maxAgeRule: SchemaRule<{ years: number }> = {\r\n name: \"maxAge\",\r\n defaultErrorMessage: \"The :input must be at most :years years old\",\r\n async validate(value: Date, context) {\r\n const birthDate = new Date(value);\r\n const today = new Date();\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n if (age <= this.context.options.years) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.years = this.context.options.years;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Week day rule - date must be specific weekday\r\n */\r\nexport const weekDayRule: SchemaRule<{ day: WeekDay }> = {\r\n name: \"weekDay\",\r\n defaultErrorMessage: \"The :input must be a :day\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n const expectedDay = WEEK_DAYS[this.context.options.day];\r\n\r\n if (dayOfWeek === expectedDay) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.day = this.context.options.day;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Between dates rule - date must be between start and end dates\r\n */\r\nexport const betweenDatesRule: SchemaRule<{\r\n startDate: Date;\r\n endDate: Date;\r\n}> = {\r\n name: \"betweenDates\",\r\n defaultErrorMessage: \"The :input must be between :startDate and :endDate\",\r\n async validate(value: Date, context) {\r\n const { startDate, endDate } = this.context.options;\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate >= startDate && inputDate <= endDate) {\r\n this.context.translationParams.startDate = startDate.toISOString();\r\n this.context.translationParams.endDate = endDate.toISOString();\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Today rule - date must be exactly today\r\n */\r\nexport const todayRule: SchemaRule = {\r\n name: \"today\",\r\n defaultErrorMessage: \"The :input must be today\",\r\n async validate(value: Date, context) {\r\n const today = new Date();\r\n today.setHours(0, 0, 0, 0);\r\n const inputDate = new Date(value);\r\n inputDate.setHours(0, 0, 0, 0);\r\n\r\n if (inputDate.getTime() === today.getTime()) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Past rule - date must be in the past\r\n */\r\nexport const pastRule: SchemaRule = {\r\n name: \"past\",\r\n defaultErrorMessage: \"The :input must be in the past\",\r\n async validate(value: Date, context) {\r\n const now = new Date();\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate < now) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Future rule - date must be in the future\r\n */\r\nexport const futureRule: SchemaRule = {\r\n name: \"future\",\r\n defaultErrorMessage: \"The :input must be in the future\",\r\n async validate(value: Date, context) {\r\n const now = new Date();\r\n\r\n if (value > now) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * After today rule - date must be after today (not including today)\r\n */\r\nexport const afterTodayRule: SchemaRule = {\r\n name: \"afterToday\",\r\n defaultErrorMessage: \"The :input must be after today\",\r\n async validate(value: Date, context) {\r\n const today = new Date();\r\n today.setHours(0, 0, 0, 0);\r\n const inputDate = new Date(value);\r\n inputDate.setHours(0, 0, 0, 0);\r\n\r\n if (inputDate > today) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport type { WeekDay } from \"../../types/date-types\";\r\nimport { WEEK_DAYS } from \"../../types/date-types\";\r\n\r\n/**\r\n * Weekend rule - date must be Saturday or Sunday\r\n */\r\nexport const weekendRule: SchemaRule = {\r\n name: \"weekend\",\r\n defaultErrorMessage: \"The :input must be a weekend (Saturday or Sunday)\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n\r\n // 0 = Sunday, 6 = Saturday\r\n if (dayOfWeek === 0 || dayOfWeek === 6) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Weekday rule - date must be Monday through Friday\r\n */\r\nexport const weekdayRule: SchemaRule = {\r\n name: \"weekday\",\r\n defaultErrorMessage: \"The :input must be a weekday (Monday-Friday)\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n\r\n // 1-5 = Monday-Friday\r\n if (dayOfWeek >= 1 && dayOfWeek <= 5) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Weekdays rule - date must be one of specified weekdays\r\n */\r\nexport const weekdaysRule: SchemaRule<{ days: WeekDay[] }> = {\r\n name: \"weekdays\",\r\n defaultErrorMessage: \"The :input must be one of: :days\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n const { days } = this.context.options;\r\n\r\n const allowedDays = days.map((day) => WEEK_DAYS[day]);\r\n\r\n if (allowedDays.includes(dayOfWeek)) {\r\n return VALID_RULE;\r\n }\r\n\r\n days.forEach((day) => {\r\n this.context.translatableParams[day] = day;\r\n });\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Business day rule - date must be Monday-Friday (no weekends)\r\n */\r\nexport const businessDayRule: SchemaRule = {\r\n name: \"businessDay\",\r\n defaultErrorMessage: \"The :input must be a business day\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n\r\n // 1-5 = Monday-Friday\r\n if (dayOfWeek >= 1 && dayOfWeek <= 5) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isDateValue } from \"../../helpers/date-helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Before field rule - date must be < given date or field\r\n * Smart detection: date value or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const beforeFieldRule: SchemaRule<{\r\n dateOrField: Date | string | number;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"beforeField\",\r\n description: \"The date must be before the given date or field\",\r\n defaultErrorMessage: \"The :input must be before :dateOrField\",\r\n async validate(value: Date, context) {\r\n const { dateOrField, scope = \"global\" } = this.context.options;\r\n let compareDate: Date;\r\n\r\n if (isDateValue(dateOrField)) {\r\n // Value comparison\r\n compareDate = new Date(dateOrField);\r\n } else {\r\n // Field comparison\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dateOrField as string);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n compareDate = new Date(fieldValue);\r\n }\r\n\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate < compareDate) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * After field rule - date must be > given date or field\r\n * Smart detection: date value or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const afterFieldRule: SchemaRule<{\r\n dateOrField: Date | string | number;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"afterField\",\r\n description: \"The date must be after the given date or field\",\r\n defaultErrorMessage: \"The :input must be after :dateOrField\",\r\n async validate(value: Date, context) {\r\n const { dateOrField, scope = \"global\" } = this.context.options;\r\n let compareDate: Date;\r\n\r\n if (isDateValue(dateOrField)) {\r\n // Value comparison\r\n compareDate = new Date(dateOrField);\r\n this.context.translationParams.dateOrField = compareDate.toISOString();\r\n } else {\r\n // Field comparison\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dateOrField as string);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n compareDate = new Date(fieldValue);\r\n this.context.translatableParams.dateOrField = fieldValue;\r\n }\r\n\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate > compareDate) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Same as field rule - date must be the same as another field's date\r\n * Supports both global and sibling scope\r\n */\r\nexport const sameAsFieldDateRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"sameAsFieldDate\",\r\n description: \"The date must be the same as another field's date\",\r\n defaultErrorMessage: \"The :input must be the same as :field\",\r\n async validate(value: Date, context) {\r\n const { field, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, field);\r\n\r\n // Both fields must exist to be considered \"the same\"\r\n if (fieldValue === undefined || value === undefined) {\r\n this.context.translatableParams.field = fieldValue;\r\n return invalidRule(this, context);\r\n }\r\n\r\n const inputDate = new Date(value);\r\n inputDate.setHours(0, 0, 0, 0);\r\n const compareDate = new Date(fieldValue);\r\n compareDate.setHours(0, 0, 0, 0);\r\n\r\n if (inputDate.getTime() === compareDate.getTime()) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.field = fieldValue;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\nconst MONTHS = {\r\n 1: \"january\",\r\n 2: \"february\",\r\n 3: \"march\",\r\n 4: \"april\",\r\n 5: \"may\",\r\n 6: \"june\",\r\n 7: \"july\",\r\n 8: \"august\",\r\n 9: \"september\",\r\n 10: \"october\",\r\n 11: \"november\",\r\n 12: \"december\",\r\n};\r\n\r\nexport type Month = keyof typeof MONTHS;\r\n\r\n/**\r\n * Month rule - date must be in specific month (1-12)\r\n */\r\nexport const monthRule: SchemaRule<{ month: Month }> = {\r\n name: \"month\",\r\n defaultErrorMessage: \"The :input must be in month :month\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const month = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n if (month === this.context.options.month) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.month =\r\n MONTHS[this.context.options.month as keyof typeof MONTHS];\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Year rule - date must be in specific year\r\n */\r\nexport const yearRule: SchemaRule<{ year: number }> = {\r\n name: \"year\",\r\n defaultErrorMessage: \"The :input must be in year :year\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const year = inputDate.getFullYear();\r\n\r\n if (year === this.context.options.year) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.year = this.context.options.year;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between years rule - date must be between start and end years\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenYearsRule: SchemaRule<{\r\n startYear: number | string;\r\n endYear: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenYears\",\r\n defaultErrorMessage: \"The :input must be between :startYear and :endYear\",\r\n async validate(value: Date, context) {\r\n const { startYear, endYear, scope = \"global\" } = this.context.options;\r\n const inputDate = new Date(value);\r\n const inputYear = inputDate.getFullYear();\r\n\r\n // Extract start year\r\n let compareStartYear: number;\r\n if (typeof startYear === \"number\") {\r\n compareStartYear = startYear;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, startYear);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareStartYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareStartYear = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareStartYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n // Extract end year\r\n let compareEndYear: number;\r\n if (typeof endYear === \"number\") {\r\n compareEndYear = endYear;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, endYear);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareEndYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareEndYear = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareEndYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n if (inputYear >= compareStartYear && inputYear <= compareEndYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startYear = compareStartYear;\r\n this.context.translationParams.endYear = compareEndYear;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between months rule - date must be between start and end months (1-12)\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenMonthsRule: SchemaRule<{\r\n startMonth: Month | string;\r\n endMonth: Month | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenMonths\",\r\n defaultErrorMessage: \"The :input must be between month :startMonth and :endMonth\",\r\n async validate(value: Date, context) {\r\n const { startMonth, endMonth, scope = \"global\" } = this.context.options;\r\n const inputDate = new Date(value);\r\n const inputMonth = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n // Extract start month\r\n let compareStartMonth: number;\r\n if (typeof startMonth === \"number\") {\r\n compareStartMonth = startMonth;\r\n this.context.translatableParams.startMonth = MONTHS[compareStartMonth as keyof typeof MONTHS];\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, startMonth);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.startMonth = startMonth;\r\n\r\n if (fieldValue instanceof Date) {\r\n compareStartMonth = fieldValue.getMonth() + 1;\r\n } else if (typeof fieldValue === \"number\") {\r\n compareStartMonth = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareStartMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n // Extract end month\r\n let compareEndMonth: number;\r\n if (typeof endMonth === \"number\") {\r\n compareEndMonth = endMonth;\r\n this.context.translatableParams.endMonth = MONTHS[compareEndMonth as keyof typeof MONTHS];\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, endMonth);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.endMonth = endMonth;\r\n\r\n if (fieldValue instanceof Date) {\r\n compareEndMonth = fieldValue.getMonth() + 1;\r\n } else if (typeof fieldValue === \"number\") {\r\n compareEndMonth = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareEndMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n if (inputMonth >= compareStartMonth && inputMonth <= compareEndMonth) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between days rule - date must be between start and end days (1-31)\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenDaysRule: SchemaRule<{\r\n startDay: number | string;\r\n endDay: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenDays\",\r\n defaultErrorMessage: \"The :input must be between day :startDay and :endDay\",\r\n async validate(value: Date, context) {\r\n const { startDay, endDay, scope = \"global\" } = this.context.options;\r\n const inputDate = new Date(value);\r\n const inputDay = inputDate.getDate();\r\n\r\n // Extract start day\r\n let compareStartDay: number;\r\n if (typeof startDay === \"number\") {\r\n compareStartDay = startDay;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, startDay);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareStartDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareStartDay = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareStartDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n // Extract end day\r\n let compareEndDay: number;\r\n if (typeof endDay === \"number\") {\r\n compareEndDay = endDay;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, endDay);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareEndDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareEndDay = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareEndDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n if (inputDay >= compareStartDay && inputDay <= compareEndDay) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startDay = compareStartDay;\r\n this.context.translationParams.endDay = compareEndDay;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Quarter rule - date must be in specific quarter (1-4)\r\n */\r\nexport const quarterRule: SchemaRule<{ quarter: 1 | 2 | 3 | 4 }> = {\r\n name: \"quarter\",\r\n defaultErrorMessage: \"The :input must be in quarter :quarter\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const month = inputDate.getMonth() + 1;\r\n const quarter = Math.ceil(month / 3);\r\n\r\n if (quarter === this.context.options.quarter) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.quarter = this.context.options.quarter;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between times rule - time must be between start and end times (HH:MM format)\r\n */\r\nexport const betweenTimesRule: SchemaRule<{\r\n startTime: string;\r\n endTime: string;\r\n}> = {\r\n name: \"betweenTimes\",\r\n defaultErrorMessage: \"The :input must be between :startTime and :endTime\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const inputHour = inputDate.getHours();\r\n const inputMinute = inputDate.getMinutes();\r\n const inputTimeInMinutes = inputHour * 60 + inputMinute;\r\n\r\n const { startTime, endTime } = this.context.options;\r\n\r\n // Parse start time\r\n const [startHour, startMinute] = startTime.split(\":\").map(Number);\r\n const startTimeInMinutes = startHour * 60 + startMinute;\r\n\r\n // Parse end time\r\n const [endHour, endMinute] = endTime.split(\":\").map(Number);\r\n const endTimeInMinutes = endHour * 60 + endMinute;\r\n\r\n if (inputTimeInMinutes >= startTimeInMinutes && inputTimeInMinutes <= endTimeInMinutes) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startTime = startTime;\r\n this.context.translationParams.endTime = endTime;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min year rule - year must be >= given year or field\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const minYearRule: SchemaRule<{\r\n yearOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minYear\",\r\n description: \"The date year must be at least the given year or field\",\r\n defaultErrorMessage: \"The :input year must be higher than :yearOrField\",\r\n async validate(value: Date, context) {\r\n const { yearOrField, scope = \"global\" } = this.context.options;\r\n let compareYear: number;\r\n\r\n if (typeof yearOrField === \"number\") {\r\n compareYear = yearOrField;\r\n this.context.translationParams.yearOrField = yearOrField;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, yearOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.yearOrField = yearOrField;\r\n\r\n // If field contains a date, extract the year\r\n if (fieldValue instanceof Date) {\r\n compareYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareYear = fieldValue;\r\n } else {\r\n // Try to parse as date and extract year\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputYear = inputDate.getFullYear();\r\n\r\n if (inputYear >= compareYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max year rule - year must be <= given year or field\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const maxYearRule: SchemaRule<{\r\n yearOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxYear\",\r\n description: \"The date year must be at most the given year or field\",\r\n defaultErrorMessage: \"The :input year must be at most :yearOrField\",\r\n async validate(value: Date, context) {\r\n const { yearOrField, scope = \"global\" } = this.context.options;\r\n let compareYear: number;\r\n\r\n if (typeof yearOrField === \"number\") {\r\n compareYear = yearOrField;\r\n this.context.translationParams.yearOrField = compareYear;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, yearOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.yearOrField = yearOrField;\r\n\r\n // If field contains a date, extract the year\r\n if (fieldValue instanceof Date) {\r\n compareYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareYear = fieldValue;\r\n } else {\r\n // Try to parse as date and extract year\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputYear = inputDate.getFullYear();\r\n\r\n if (inputYear <= compareYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min month rule - month must be >= given month or field (1-12)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const minMonthRule: SchemaRule<{\r\n monthOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minMonth\",\r\n description: \"The date month must be at least the given month or field\",\r\n defaultErrorMessage: \"The :input month must be at least :monthOrField\",\r\n async validate(value: Date, context) {\r\n const { monthOrField, scope = \"global\" } = this.context.options;\r\n let compareMonth: number;\r\n\r\n if (typeof monthOrField === \"number\") {\r\n compareMonth = monthOrField;\r\n this.context.translationParams.monthOrField = compareMonth;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, monthOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.monthOrField = monthOrField;\r\n\r\n // If field contains a date, extract the month\r\n if (fieldValue instanceof Date) {\r\n compareMonth = fieldValue.getMonth() + 1; // getMonth() returns 0-11\r\n } else if (typeof fieldValue === \"number\") {\r\n compareMonth = fieldValue;\r\n } else {\r\n // Try to parse as date and extract month\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputMonth = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n if (inputMonth >= compareMonth) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max month rule - month must be <= given month or field (1-12)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const maxMonthRule: SchemaRule<{\r\n monthOrField: Month | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxMonth\",\r\n description: \"The date month must be at most the given month or field\",\r\n defaultErrorMessage: \"The :input month must be at most :monthOrField\",\r\n async validate(value: Date, context) {\r\n const { monthOrField, scope = \"global\" } = this.context.options;\r\n let compareMonth: number;\r\n\r\n if (typeof monthOrField === \"number\") {\r\n compareMonth = monthOrField;\r\n this.context.translatableParams.monthOrField = MONTHS[monthOrField];\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, monthOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.monthOrField = monthOrField;\r\n\r\n // If field contains a date, extract the month\r\n if (fieldValue instanceof Date) {\r\n compareMonth = fieldValue.getMonth() + 1; // getMonth() returns 0-11\r\n } else if (typeof fieldValue === \"number\") {\r\n compareMonth = fieldValue;\r\n } else {\r\n // Try to parse as date and extract month\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputMonth = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n if (inputMonth <= compareMonth) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min day rule - day must be >= given day or field (1-31)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const minDayRule: SchemaRule<{\r\n dayOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minDay\",\r\n description: \"The date day must be at least the given day or field\",\r\n defaultErrorMessage: \"The :input day must be higher than :dayOrField\",\r\n async validate(value: Date, context) {\r\n const { dayOrField, scope = \"global\" } = this.context.options;\r\n let compareDay: number;\r\n\r\n if (typeof dayOrField === \"number\") {\r\n compareDay = dayOrField;\r\n this.context.translationParams.dayOrField = dayOrField;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dayOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.dayOrField = dayOrField;\r\n\r\n // If field contains a date, extract the day\r\n if (fieldValue instanceof Date) {\r\n compareDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareDay = fieldValue;\r\n } else {\r\n // Try to parse as date and extract day\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputDay = inputDate.getDate();\r\n\r\n if (inputDay >= compareDay) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max day rule - day must be <= given day or field (1-31)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const maxDayRule: SchemaRule<{\r\n dayOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxDay\",\r\n description: \"The date day must be at most the given day or field\",\r\n defaultErrorMessage: \"The :input day must be at most :dayOrField\",\r\n async validate(value: Date, context) {\r\n const { dayOrField, scope = \"global\" } = this.context.options;\r\n let compareDay: number;\r\n\r\n if (typeof dayOrField === \"number\") {\r\n compareDay = dayOrField;\r\n this.context.translationParams.dayOrField = dayOrField;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dayOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.dayOrField = dayOrField;\r\n\r\n // If field contains a date, extract the day\r\n if (fieldValue instanceof Date) {\r\n compareDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareDay = fieldValue;\r\n } else {\r\n // Try to parse as date and extract day\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputDay = inputDate.getDate();\r\n\r\n if (inputDay <= compareDay) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Within days rule - date must be within X days from now (past or future)\r\n */\r\nexport const withinDaysRule: SchemaRule<{ days: number }> = {\r\n name: \"withinDays\",\r\n defaultErrorMessage: \"The :input must be within :days days from now\",\r\n async validate(value: Date, context) {\r\n const now = new Date();\r\n const inputDate = new Date(value);\r\n const diffTime = Math.abs(inputDate.getTime() - now.getTime());\r\n const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));\r\n\r\n if (diffDays <= this.context.options.days) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.days = this.context.options.days;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Within past days rule - date must be within X days in the past\r\n */\r\nexport const withinPastDaysRule: SchemaRule<{ days: number }> = {\r\n name: \"withinPastDays\",\r\n defaultErrorMessage: \"The :input must be within the past :days days\",\r\n async validate(value: Date, context) {\r\n const now = new Date();\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate > now) {\r\n return invalidRule(this, context); // Must be in past\r\n }\r\n\r\n const diffTime = now.getTime() - inputDate.getTime();\r\n const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));\r\n\r\n if (diffDays <= this.context.options.days) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.days = this.context.options.days;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Within future days rule - date must be within X days in the future\r\n */\r\nexport const withinFutureDaysRule: SchemaRule<{ days: number }> = {\r\n name: \"withinFutureDays\",\r\n defaultErrorMessage: \"The :input must be within the next :days days\",\r\n async validate(value: Date, context) {\r\n const now = new Date();\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate < now) {\r\n return invalidRule(this, context); // Must be in future\r\n }\r\n\r\n const diffTime = inputDate.getTime() - now.getTime();\r\n const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));\r\n\r\n if (diffDays <= this.context.options.days) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.days = this.context.options.days;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Birthday rule - valid birthday (not in future, reasonable age)\r\n */\r\nexport const birthdayRule: SchemaRule<{ minAge?: number; maxAge?: number }> = {\r\n name: \"birthday\",\r\n defaultErrorMessage: \"The :input must be a valid birthday\",\r\n async validate(birthDate: Date, context) {\r\n const today = new Date();\r\n\r\n // Must not be in the future\r\n if (birthDate > today) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Calculate age\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n // Check minimum age (default: 0)\r\n const minAge = this.context.options.minAge ?? 0;\r\n if (age < minAge) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Check maximum age (default: 150)\r\n const maxAge = this.context.options.maxAge ?? 150;\r\n if (age > maxAge) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Between age rule - age must be between min and max years\r\n */\r\nexport const betweenAgeRule: SchemaRule<{ minAge: number; maxAge: number }> = {\r\n name: \"betweenAge\",\r\n defaultErrorMessage: \"Age must be between :minAge and :maxAge years\",\r\n async validate(value: Date, context) {\r\n const birthDate = new Date(value);\r\n const today = new Date();\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n const { minAge, maxAge } = this.context.options;\r\n\r\n if (age >= minAge && age <= maxAge) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minAge = minAge;\r\n this.context.translationParams.maxAge = maxAge;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Leap year rule - date must be in a leap year\r\n */\r\nexport const leapYearRule: SchemaRule = {\r\n name: \"leapYear\",\r\n defaultErrorMessage: \"The :input must be in a leap year\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const year = inputDate.getFullYear();\r\n\r\n // Leap year logic: divisible by 4, except century years unless divisible by 400\r\n const isLeapYear = (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\r\n\r\n if (isLeapYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Min width rule - image width validation\r\n */\r\nexport const minWidthRule: SchemaRule<{ minWidth: number }> = {\r\n name: \"minWidth\",\r\n defaultErrorMessage: \"The :input must be at least :minWidth pixels wide\",\r\n async validate(value: any, context) {\r\n const dimensions = await value.dimensions();\r\n\r\n if (dimensions.width >= this.context.options.minWidth) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minWidth = this.context.options.minWidth;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max width rule - image width validation\r\n */\r\nexport const maxWidthRule: SchemaRule<{ maxWidth: number }> = {\r\n name: \"maxWidth\",\r\n defaultErrorMessage: \"The :input must be at most :maxWidth pixels wide\",\r\n async validate(value: any, context) {\r\n const dimensions = await value.dimensions();\r\n\r\n if (dimensions.width <= this.context.options.maxWidth) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.maxWidth = this.context.options.maxWidth;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min height rule - image height validation\r\n */\r\nexport const minHeightRule: SchemaRule<{ minHeight: number }> = {\r\n name: \"minHeight\",\r\n defaultErrorMessage: \"The :input must be at least :minHeight pixels tall\",\r\n async validate(value: any, context) {\r\n const dimensions = await value.dimensions();\r\n\r\n if (dimensions.height >= this.context.options.minHeight) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minHeight = this.context.options.minHeight;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max height rule - image height validation\r\n */\r\nexport const maxHeightRule: SchemaRule<{ maxHeight: number }> = {\r\n name: \"maxHeight\",\r\n defaultErrorMessage: \"The :input must be at most :maxHeight pixels tall\",\r\n async validate(value: any, context) {\r\n const dimensions = await value.dimensions();\r\n\r\n if (dimensions.height <= this.context.options.maxHeight) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.maxHeight = this.context.options.maxHeight;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { humanizeSize, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Max file size rule\r\n */\r\nexport const maxFileSizeRule: SchemaRule<{ maxSize: number }> = {\r\n name: \"maxFileSize\",\r\n defaultErrorMessage: \"The :input must not exceed :maxSize\",\r\n async validate(value: any, context) {\r\n const size = typeof value.size === \"function\" ? await value.size() : value.size;\r\n\r\n if (size <= this.context.options.maxSize) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.maxSize = humanizeSize(this.context.options.maxSize);\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min file size rule\r\n */\r\nexport const minFileSizeRule: SchemaRule<{ minSize: number }> = {\r\n name: \"minFileSize\",\r\n defaultErrorMessage: \"The :input must be at least :minSize\",\r\n async validate(value: any, context) {\r\n const size = typeof value.size === \"function\" ? await value.size() : value.size;\r\n\r\n if (size >= this.context.options.minSize) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minSize = humanizeSize(this.context.options.minSize);\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Color validation regex patterns\r\n */\r\nconst colorValidationRegex = {\r\n hex: /^#([0-9a-f]{3}){1,2}$/i,\r\n rgb: /^rgb\\((\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d{1,3})\\)$/,\r\n rgba: /^rgba\\((\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d{1,3}),\\s*(0?\\.\\d+|1)\\)$/,\r\n hsl: /^hsl\\((\\d{1,3}),\\s*(\\d{1,3})%?,\\s*(\\d{1,3})%?\\)$/,\r\n};\r\n\r\n/**\r\n * Generic color rule - validates any color format\r\n */\r\nexport const colorRule: SchemaRule = {\r\n name: \"color\",\r\n defaultErrorMessage: \"The :input must be a valid color\",\r\n async validate(value: any, context) {\r\n const isValidColor =\r\n colorValidationRegex.hex.test(value) ||\r\n colorValidationRegex.rgb.test(value) ||\r\n colorValidationRegex.rgba.test(value) ||\r\n colorValidationRegex.hsl.test(value);\r\n\r\n if (isValidColor) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Hex color rule\r\n */\r\nexport const hexColorRule: SchemaRule = {\r\n name: \"hexColor\",\r\n defaultErrorMessage: \"The :input must be a valid hex color\",\r\n async validate(value: any, context) {\r\n if (colorValidationRegex.hex.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * RGB color rule\r\n */\r\nexport const rgbColorRule: SchemaRule = {\r\n name: \"rgbColor\",\r\n defaultErrorMessage: \"The :input must be a valid RGB color\",\r\n async validate(value: any, context) {\r\n if (colorValidationRegex.rgb.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * RGBA color rule\r\n */\r\nexport const rgbaColorRule: SchemaRule = {\r\n name: \"rgbaColor\",\r\n defaultErrorMessage: \"The :input must be a valid RGBA color\",\r\n async validate(value: any, context) {\r\n if (colorValidationRegex.rgba.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * HSL color rule\r\n */\r\nexport const hslColorRule: SchemaRule = {\r\n name: \"hslColor\",\r\n defaultErrorMessage: \"The :input must be a valid HSL color\",\r\n async validate(value: any, context) {\r\n if (colorValidationRegex.hsl.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Light color rule\r\n */\r\nexport const lightColorRule: SchemaRule = {\r\n name: \"lightColor\",\r\n defaultErrorMessage: \"The :input must be a light color\",\r\n async validate(value: any, context) {\r\n if (!colorValidationRegex.hex.test(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n const hex = value.replace(\"#\", \"\");\r\n const r = parseInt(hex.substring(0, 2), 16);\r\n const g = parseInt(hex.substring(2, 4), 16);\r\n const b = parseInt(hex.substring(4, 6), 16);\r\n const brightness = (r * 299 + g * 587 + b * 114) / 1000;\r\n\r\n if (brightness > 155) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Dark color rule\r\n */\r\nexport const darkColorRule: SchemaRule = {\r\n name: \"darkColor\",\r\n defaultErrorMessage: \"The :input must be a dark color\",\r\n async validate(value: any, context) {\r\n if (!colorValidationRegex.hex.test(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n const hex = value.replace(\"#\", \"\");\r\n const r = parseInt(hex.substring(0, 2), 16);\r\n const g = parseInt(hex.substring(2, 4), 16);\r\n const b = parseInt(hex.substring(4, 6), 16);\r\n const brightness = (r * 299 + g * 587 + b * 114) / 1000;\r\n\r\n if (brightness <= 155) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Required if rule - field is required if another field equals a specific value\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfRule: SchemaRule<{\r\n field: string;\r\n value: any;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIf\",\r\n description: \"The field is required if another field equals a specific value\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { value: expectedValue } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field equals the expected value\r\n if (isEmptyValue(value) && fieldValue === expectedValue) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if empty rule - field is required if another field is empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfEmptyRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfEmpty\",\r\n description: \"The field is required if :field is empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field is empty\r\n if (isEmptyValue(value) && isEmptyValue(fieldValue)) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if not empty rule - field is required if another field is not empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfNotEmptyRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfNotEmpty\",\r\n description: \"The field is required if :field is not empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field is not empty\r\n if (isEmptyValue(value) && !isEmptyValue(fieldValue)) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if in rule - field is required if another field's value is in the given array\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfInRule: SchemaRule<{\r\n field: string;\r\n values: any[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfIn\",\r\n description: \"The field is required if :field value is in the given array\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { values } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field's value is in the array\r\n if (isEmptyValue(value) && values.includes(fieldValue)) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translationParams.values = this.context.options.values.join(\", \");\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if not in rule - field is required if another field's value is NOT in the given array\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfNotInRule: SchemaRule<{\r\n field: string;\r\n values: any[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfNotIn\",\r\n description: \"The field is required if another field's value is NOT in the given array\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { values } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field's value is NOT in the array\r\n if (isEmptyValue(value) && !values.includes(fieldValue)) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translationParams.values = this.context.options.values.join(\", \");\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Get multiple field values based on scope\r\n */\r\nfunction getFieldsValues(\r\n rule: SchemaRule<{ fields: string[]; scope?: \"global\" | \"sibling\" }>,\r\n context: any,\r\n): any[] {\r\n const { fields, scope = \"global\" } = (rule as any).context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n return fields.map((field: string) => get(source, field));\r\n}\r\n\r\n/**\r\n * Required if all empty rule - field is required if ALL specified fields are empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfAllEmptyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfAllEmpty\",\r\n description: \"The field is required if all :fields are empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValues = getFieldsValues(this, context);\r\n\r\n // Field is required if ALL other fields are empty\r\n const allEmpty = fieldValues.every((v) => isEmptyValue(v));\r\n if (isEmptyValue(value) && allEmpty) {\r\n this.context.options.fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if any empty rule - field is required if ANY of the specified fields is empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfAnyEmptyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfAnyEmpty\",\r\n description: \"The field is required if any of the :fields is empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValues = getFieldsValues(this, context);\r\n\r\n // Field is required if ANY other field is empty\r\n const anyEmpty = fieldValues.some((v) => isEmptyValue(v));\r\n if (isEmptyValue(value) && anyEmpty) {\r\n this.context.options.fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if all not empty rule - field is required if ALL specified fields are NOT empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfAllNotEmptyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfAllNotEmpty\",\r\n description: \"The field is required if all :fields are not empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValues = getFieldsValues(this, context);\r\n\r\n // Field is required if ALL other fields are NOT empty\r\n const allNotEmpty = fieldValues.every((v) => !isEmptyValue(v));\r\n if (isEmptyValue(value) && allNotEmpty) {\r\n this.context.options.fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if any not empty rule - field is required if ANY of the specified fields is NOT empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfAnyNotEmptyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfAnyNotEmpty\",\r\n description: \"The field is required if any of the :fields is not empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValues = getFieldsValues(this, context);\r\n\r\n // Field is required if ANY other field is NOT empty\r\n const anyNotEmpty = fieldValues.some((v) => !isEmptyValue(v));\r\n if (isEmptyValue(value) && anyNotEmpty) {\r\n this.context.options.fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport { isEmptyValue } from \"./../../helpers/is-empty-value\";\r\n\r\n/**\r\n * Required unless rule - field is required unless another field equals a specific value\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredUnlessRule: SchemaRule<{\r\n field: string;\r\n value: any;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredUnless\",\r\n description: \"The field is required unless another field equals a specific value\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { value: expectedValue } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required unless the other field equals the expected value\r\n if (isEmptyValue(value) && fieldValue !== expectedValue) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translationParams.value = this.context.options.value;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\nimport type { SchemaContext, SchemaRule } from \"../../types\";\n\n/**\n * Required when callback returns true.\n *\n * The callback receives only the SchemaContext (not the value),\n * because \"required\" is about surrounding conditions, not the field itself.\n *\n * @example\n * ```ts\n * v.string().requiredWhen((context) => {\n * return context.allData.notificationMethod === 'email';\n * })\n * ```\n */\nexport const requiredWhenRule: SchemaRule<{\n callback: (context: SchemaContext) => boolean | Promise<boolean>;\n}> = {\n name: \"requiredWhen\",\n defaultErrorMessage: \"The :input is required\",\n requiresValue: false,\n sortOrder: -2,\n async validate(value, context) {\n const shouldBeRequired = await this.context.options.callback?.(context);\n\n if (shouldBeRequired && isEmptyValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n","import { get } from \"@mongez/reinforcements\";\r\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Required with rule - field is required if another field is present\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWith\",\r\n description: \"The field is required if another field is present\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field is present\r\n if (isEmptyValue(value) && fieldValue !== undefined) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required with all rule - field is required if all specified fields are present\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithAllRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWithAll\",\r\n description: \"The field is required if all specified fields are present\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if all fields are present\r\n const allPresent = fields.every((field) => get(source, field) !== undefined);\r\n\r\n // Field is required if all other fields are present\r\n if (isEmptyValue(value) && allPresent) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required with any rule - field is required if any of the specified fields is present\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithAnyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWithAny\",\r\n description: \"The field is required if any of the specified fields is present\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if any field is present\r\n const anyPresent = fields.some((field) => get(source, field) !== undefined);\r\n\r\n // Field is required if any other field is present\r\n if (isEmptyValue(value) && anyPresent) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport { isEmptyValue } from \"./../../helpers/is-empty-value\";\r\n\r\n/**\r\n * Required without rule - field is required if another field is missing\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithoutRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWithout\",\r\n description: \"The field is required if another field is missing\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field is missing\r\n if (isEmptyValue(value) && fieldValue === undefined) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required without all rule - field is required if all specified fields are missing\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithoutAllRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWithoutAll\",\r\n description: \"The field is required if all specified fields are missing\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if all fields are missing\r\n const allMissing = fields.every((field) => get(source, field) === undefined);\r\n\r\n // Field is required if all other fields are missing\r\n if (isEmptyValue(value) && allMissing) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required without any rule - field is required if any of the specified fields is missing\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithoutAnyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWithoutAny\",\r\n description: \"The field is required if any of the specified fields is missing\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if any field is missing\r\n const anyMissing = fields.some((field) => get(source, field) === undefined);\r\n\r\n // Field is required if any other field is missing\r\n if (isEmptyValue(value) && anyMissing) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport { isEmptyValue } from \"./../../helpers/is-empty-value\";\r\n\r\n/**\r\n * Present if rule - field must be present if another field equals a specific value\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentIfRule: SchemaRule<{\r\n field: string;\r\n value: any;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentIf\",\r\n description: \"The field must be present if another field equals a specific value\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { value: expectedValue } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field must be present if the other field equals the expected value\r\n if (value === undefined && fieldValue === expectedValue) {\r\n this.context.translationParams.value = expectedValue;\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present if empty rule - field must be present if another field is empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentIfEmptyRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentIfEmpty\",\r\n description: \"The field must be present if another field is empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field must be present if the other field is empty\r\n if (value === undefined && isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present if not empty rule - field must be present if another field is not empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentIfNotEmptyRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentIfNotEmpty\",\r\n description: \"The field must be present if another field is not empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field must be present if the other field is not empty\r\n if (value === undefined && !isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present if in rule - field must be present if another field's value is in the given array\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentIfInRule: SchemaRule<{\r\n field: string;\r\n values: any[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentIfIn\",\r\n description: \"The field must be present if another field's value is in the given array\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { values } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field must be present if the other field's value is in the array\r\n if (value === undefined && values.includes(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present if not in rule - field must be present if another field's value is NOT in the given array\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentIfNotInRule: SchemaRule<{\r\n field: string;\r\n values: any[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentIfNotIn\",\r\n description: \"The field must be present if another field's value is NOT in the given array\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { values } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field must be present if the other field's value is NOT in the array\r\n if (value === undefined && !values.includes(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Present unless rule - field must be present unless another field equals a specific value\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentUnlessRule: SchemaRule<{\r\n field: string;\r\n value: any;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentUnless\",\r\n description: \"The field must be present unless another field equals a specific value\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { value: expectedValue } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field must be present unless the other field equals the expected value\r\n if (value === undefined && fieldValue !== expectedValue) {\r\n this.context.translationParams.value = expectedValue;\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Present with rule - field must be present if another field is present\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentWithRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentWith\",\r\n description: \"The field must be present if another field is present\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // The field must be present if the other field is present\r\n if (value === undefined && fieldValue !== undefined) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present with all rule - field must be present if all specified fields are present\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentWithAllRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentWithAll\",\r\n description: \"The field must be present if all specified fields are present\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if all fields are present\r\n const allPresent = fields.every((field) => get(source, field) !== undefined);\r\n\r\n // Field must be present if all other fields are present\r\n if (value === undefined && allPresent) {\r\n fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present with any rule - field must be present if any of the specified fields is present\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentWithAnyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentWithAny\",\r\n description: \"The field must be present if any of the specified fields is present\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if any field is present\r\n const anyPresent = fields.some((field) => get(source, field) !== undefined);\r\n\r\n // Field must be present if any other field is present\r\n if (value === undefined && anyPresent) {\r\n fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Present without rule - field must be present if another field is missing\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentWithoutRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentWithout\",\r\n description: \"The field must be present if another field is missing\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field must be present if the other field is missing\r\n if (value === undefined && fieldValue === undefined) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present without all rule - field must be present if all specified fields are missing\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentWithoutAllRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentWithoutAll\",\r\n description: \"The field must be present if all specified fields are missing\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if all fields are missing\r\n const allMissing = fields.every((field) => get(source, field) === undefined);\r\n\r\n // Field must be present if all other fields are missing\r\n if (value === undefined && allMissing) {\r\n fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present without any rule - field must be present if any of the specified fields is missing\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentWithoutAnyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentWithoutAny\",\r\n description: \"The field must be present if any of the specified fields is missing\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if any field is missing\r\n const anyMissing = fields.some((field) => get(source, field) === undefined);\r\n\r\n // Field must be present if any other field is missing\r\n if (value === undefined && anyMissing) {\r\n fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Forbidden if rule - field is forbidden if another field equals a specific value\r\n * Supports both global and sibling scope\r\n */\r\nexport const forbiddenIfRule: SchemaRule<{\r\n field: string;\r\n value: any;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"forbiddenIf\",\r\n description: \"The field is forbidden if another field equals a specific value\",\r\n sortOrder: -2,\r\n defaultErrorMessage: \"The :input is forbidden\",\r\n async validate(value: any, context) {\r\n const { value: expectedValue } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is forbidden if it has a value and the other field equals the expected value\r\n if (!isEmptyValue(value) && fieldValue === expectedValue) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translationParams.value = expectedValue;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Forbidden if not rule - field is forbidden if another field does NOT equal a specific value\r\n * Supports both global and sibling scope\r\n */\r\nexport const forbiddenIfNotRule: SchemaRule<{\r\n field: string;\r\n value: any;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"forbiddenIfNot\",\r\n description: \"The field is forbidden if another field does NOT equal a specific value\",\r\n sortOrder: -2,\r\n defaultErrorMessage: \"The :input is forbidden\",\r\n async validate(value: any, context) {\r\n const { value: expectedValue } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is forbidden if it has a value and the other field does NOT equal the expected value\r\n if (!isEmptyValue(value) && fieldValue !== expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Forbidden if empty rule - field is forbidden if another field is empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const forbiddenIfEmptyRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"forbiddenIfEmpty\",\r\n description: \"The field is forbidden if another field is empty\",\r\n sortOrder: -2,\r\n defaultErrorMessage: \"The :input is forbidden\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is forbidden if it has a value and the other field is empty\r\n if (!isEmptyValue(value) && isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Forbidden if not empty rule - field is forbidden if another field is not empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const forbiddenIfNotEmptyRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"forbiddenIfNotEmpty\",\r\n description: \"The field is forbidden if another field is not empty\",\r\n sortOrder: -2,\r\n defaultErrorMessage: \"The :input is forbidden\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is forbidden if it has a value and the other field is not empty\r\n if (!isEmptyValue(value) && !isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Forbidden if in rule - field is forbidden if another field's value is in the given array\r\n * Supports both global and sibling scope\r\n */\r\nexport const forbiddenIfInRule: SchemaRule<{\r\n field: string;\r\n values: any[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"forbiddenIfIn\",\r\n description: \"The field is forbidden if another field's value is in the given array\",\r\n sortOrder: -2,\r\n defaultErrorMessage: \"The :input is forbidden\",\r\n async validate(value: any, context) {\r\n const { values } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is forbidden if it has a value and the other field's value is in the array\r\n if (!isEmptyValue(value) && values.includes(fieldValue)) {\r\n this.context.translationParams.values = values.join(\", \");\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Forbidden if not in rule - field is forbidden if another field's value is NOT in the given array\r\n * Supports both global and sibling scope\r\n */\r\nexport const forbiddenIfNotInRule: SchemaRule<{\r\n field: string;\r\n values: any[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"forbiddenIfNotIn\",\r\n description: \"The field is forbidden if another field's value is NOT in the given array\",\r\n sortOrder: -2,\r\n defaultErrorMessage: \"The :input is forbidden\",\r\n async validate(value: any, context) {\r\n const { values } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is forbidden if it has a value and the other field's value is NOT in the array\r\n if (!isEmptyValue(value) && !values.includes(fieldValue)) {\r\n this.context.translationParams.values = values.join(\", \");\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { invalidRule, resolveTranslation, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Enum rule - value must be one of the enum values\r\n */\r\nexport const enumRule: SchemaRule<{ enum: any }> = {\r\n name: \"enum\",\r\n defaultErrorMessage: \"The :input must be one of the following values: :enum\",\r\n async validate(value: any, context) {\r\n const enumValues = this.context.options.enum;\r\n\r\n if (enumValues.includes(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Translate each enum value individually, then join into a display string\r\n this.context.translationParams.enum = enumValues\r\n .map((v: any) =>\r\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\r\n )\r\n .join(\", \");\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * In rule - value must be in the given array\r\n */\r\nexport const inRule: SchemaRule<{ values: any[] }> = {\r\n name: \"in\",\r\n defaultErrorMessage: \"The :input must be one of the following values: :values\",\r\n async validate(value: any, context) {\r\n if (this.context.options.values.includes(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Translate each value individually, then join\r\n this.context.translationParams.values = this.context.options.values\r\n .map((v: any) =>\r\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\r\n )\r\n .join(\", \");\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Allowed values rule - value must be one of allowed values\r\n */\r\nexport const allowedValuesRule: SchemaRule<{ allowedValues: any[] }> = {\r\n name: \"allowedValues\",\r\n defaultErrorMessage: \"The :input must be one of the allowed values\",\r\n async validate(value: any, context) {\r\n if (this.context.options.allowedValues.includes(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Translate each value individually, then join\r\n this.context.translationParams.allowedValues = this.context.options.allowedValues\r\n .map((v: any) =>\r\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\r\n )\r\n .join(\", \");\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Not allowed values rule - value must not be in forbidden list\r\n */\r\nexport const notAllowedValuesRule: SchemaRule<{ notAllowedValues: any[] }> = {\r\n name: \"notAllowedValues\",\r\n defaultErrorMessage: \"The :input contains a forbidden value\",\r\n async validate(value: any, context) {\r\n if (!this.context.options.notAllowedValues.includes(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Translate each value individually, then join\r\n this.context.translationParams.notAllowedValues = this.context.options.notAllowedValues\r\n .map((v: any) =>\r\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\r\n )\r\n .join(\", \");\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Equals field rule - value must equal another field's value\r\n * Supports both global and sibling scope\r\n */\r\nexport const equalsFieldRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"equalsField\",\r\n description: \"The value must equal another field's value\",\r\n sortOrder: -1,\r\n requiresValue: true,\r\n defaultErrorMessage: \"The :input must match the :field field\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Value must equal the other field's value\r\n if (value !== fieldValue) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Not equals field rule - value must NOT equal another field's value\r\n * Supports both global and sibling scope\r\n */\r\nexport const notEqualsFieldRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"notEqualsField\",\r\n description: \"The value must NOT equal another field's value\",\r\n sortOrder: -1,\r\n requiresValue: true,\r\n defaultErrorMessage: \"The :input must not match the :field field\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Value must NOT equal the other field's value\r\n if (value === fieldValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * InstanceOf rule - value must be an instance of the given constructor.\n *\n * Uses the `instanceof` operator at runtime. Useful for class instances\n * not representable in JSON Schema (File, Buffer, custom domain classes).\n */\nexport const instanceofRule: SchemaRule<{ ctor: new (...args: any[]) => any; name: string }> = {\n name: \"instanceof\",\n defaultErrorMessage: \"The :input must be an instance of :name\",\n async validate(value: any, context) {\n if (value instanceof this.context.options.ctor) {\n return VALID_RULE;\n }\n\n this.context.translationParams.name = this.context.options.name;\n\n return invalidRule(this, context);\n },\n};\n","import { invalidRule, resolveTranslation, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Literal rule - value must be strictly equal to one of the literal values.\n *\n * Uses === (referential / strict equality), so distinguishes 1 from \"1\",\n * true from \"true\", etc. Mirrors `v.string().oneOf([...])` but at the\n * literal type level (TypeScript narrows to the union of literals).\n */\nexport const literalRule: SchemaRule<{ values: readonly (string | number | boolean)[] }> = {\n name: \"literal\",\n defaultErrorMessage: \"The :input must be one of the following values: :values\",\n async validate(value: any, context) {\n if (this.context.options.values.includes(value)) {\n return VALID_RULE;\n }\n\n this.context.translationParams.values = this.context.options.values\n .map(v =>\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\n )\n .join(\", \");\n\n return invalidRule(this, context);\n },\n};\n","import { isObject, isPlainObject } from \"@mongez/supportive-is\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * String rule - validates string type\r\n */\r\nexport const stringRule: SchemaRule = {\r\n name: \"string\",\r\n defaultErrorMessage: \"The :input must be a string\",\r\n async validate(value: any, context) {\r\n if (typeof value === \"string\") {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Number rule - validates number type\r\n */\r\nexport const numberRule: SchemaRule = {\r\n name: \"number\",\r\n defaultErrorMessage: \"The :input must be a number\",\r\n async validate(value: any, context) {\r\n if (typeof value === \"number\") {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Boolean rule - validates boolean type\r\n */\r\nexport const booleanRule: SchemaRule = {\r\n name: \"boolean\",\r\n defaultErrorMessage: \"The :input must be a boolean\",\r\n async validate(value: any, context) {\r\n if (typeof value === \"boolean\") {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Int rule - validates integer type\r\n */\r\nexport const intRule: SchemaRule = {\r\n name: \"int\",\r\n defaultErrorMessage: \"The :input must be an integer\",\r\n async validate(value: any, context) {\r\n if (Number.isInteger(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Float rule - validates float type\r\n */\r\nexport const floatRule: SchemaRule = {\r\n name: \"float\",\r\n defaultErrorMessage: \"The :input must be a float\",\r\n async validate(value: any, context) {\r\n if (Number.isFinite(value) && !Number.isInteger(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Scalar rule - validates scalar value (string, number, or boolean)\r\n */\r\nexport const scalarRule: SchemaRule = {\r\n name: \"scalar\",\r\n defaultErrorMessage: \"The :input must be a scalar value\",\r\n async validate(value: any, context) {\r\n if ([\"string\", \"number\", \"boolean\"].includes(typeof value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Object rule - validates object type\r\n */\r\nexport const objectRule: SchemaRule = {\r\n name: \"object\",\r\n defaultErrorMessage: \"The :input must be an object\",\r\n async validate(value: any, context) {\r\n if (!!isObject(value) && value !== null) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Object rule - validates object type\r\n */\r\nexport const plainObjectRule: SchemaRule = {\r\n name: \"plainObject\",\r\n defaultErrorMessage: \"The :input must be an object\",\r\n async validate(value: any, context) {\r\n if (!!isPlainObject(value) && value !== null) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Array rule - validates array type\r\n */\r\nexport const arrayRule: SchemaRule = {\r\n name: \"array\",\r\n defaultErrorMessage: \"The :input must be an array\",\r\n async validate(value: any, context) {\r\n if (Array.isArray(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { Schema, SchemaRule } from \"../../types\";\n\n/**\n * Unknown key rule - validates that object doesn't have unknown keys\n */\nexport const unknownKeyRule: SchemaRule<{\n schema: Schema;\n allowedKeys: string[];\n}> = {\n name: \"unknownKeys\",\n defaultErrorMessage: \"The :input contains unknown keys: :unknownKeys\",\n async validate(value: any, context) {\n const schema = this.context.options.schema;\n const allowedKeys = [...Object.keys(schema), ...(this.context.options.allowedKeys || [])];\n\n const unknownKeys = Object.keys(value).filter((key) => !allowedKeys.includes(key));\n\n if (unknownKeys.length > 0) {\n this.context.translationParams.unknownKeys = unknownKeys.join(\", \");\n\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n","import { setKeyPath } from \"../helpers\";\r\nimport { flipArrayMutator, sortArrayMutator, uniqueArrayMutator } from \"../mutators\";\r\nimport {\r\n arrayRule,\r\n betweenLengthRule,\r\n lengthRule,\r\n maxLengthRule,\r\n minLengthRule,\r\n sortedArrayRule,\r\n uniqueArrayRule,\r\n} from \"../rules\";\r\nimport type { SchemaContext, ValidationResult } from \"../types\";\r\nimport { BaseValidator } from \"./base-validator\";\r\nimport { applyNullable, getRuleOptions } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Array validator class\r\n */\r\nexport class ArrayValidator extends BaseValidator {\r\n public constructor(\r\n public validator: BaseValidator,\r\n errorMessage?: string,\r\n ) {\r\n super();\r\n this.addMutableRule(arrayRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is an array type\r\n */\r\n public matchesType(value: any): boolean {\r\n return Array.isArray(value);\r\n }\r\n\r\n /**\r\n * Clone the validator\r\n */\r\n public override clone(): this {\r\n const cloned = super.clone();\r\n\r\n cloned.validator = this.validator.clone();\r\n\r\n return cloned;\r\n }\r\n\r\n /** Reverse array order */\r\n public flip() {\r\n return this.addMutator(flipArrayMutator);\r\n }\r\n\r\n /** Reverse array order (alias) */\r\n public reverse() {\r\n return this.addMutator(flipArrayMutator);\r\n }\r\n\r\n /** Make it has only unique values */\r\n public onlyUnique() {\r\n return this.addMutator(uniqueArrayMutator);\r\n }\r\n\r\n /** Sort array */\r\n public sort(direction: \"asc\" | \"desc\" = \"asc\", key?: string) {\r\n return this.addMutator(sortArrayMutator, { direction, key });\r\n }\r\n\r\n /** Array length must be greater than the given length */\r\n public minLength(length: number, errorMessage?: string) {\r\n return this.addRule(minLengthRule, errorMessage, { minLength: length });\r\n }\r\n\r\n /** Array length must be less than the given length */\r\n public maxLength(length: number, errorMessage?: string) {\r\n return this.addRule(maxLengthRule, errorMessage, { maxLength: length });\r\n }\r\n\r\n /** Array length must be of the given length */\r\n public length(length: number, errorMessage?: string) {\r\n return this.addRule(lengthRule, errorMessage, { length });\r\n }\r\n\r\n /**\r\n * Array length must be between min and max (inclusive)\r\n *\r\n * @param min - Minimum length (inclusive)\r\n * @param max - Maximum length (inclusive)\r\n *\r\n * @example\r\n * ```ts\r\n * v.array(v.string()).between(1, 10) // Array must have 1 to 10 items\r\n * v.array(v.number()).lengthBetween(5, 20) // Same using alias\r\n * ```\r\n *\r\n * @category Validation Rule\r\n */\r\n public between(min: number, max: number, errorMessage?: string) {\r\n return this.addRule(betweenLengthRule, errorMessage, {\r\n minLength: min,\r\n maxLength: max,\r\n });\r\n }\r\n\r\n /**\r\n * Alias for between() - array length between min and max\r\n */\r\n public lengthBetween(min: number, max: number, errorMessage?: string) {\r\n return this.between(min, max, errorMessage);\r\n }\r\n\r\n /** Array must have unique values */\r\n public unique(errorMessage?: string) {\r\n return this.addRule(uniqueArrayRule, errorMessage);\r\n }\r\n\r\n /** Array must be sorted */\r\n public sorted(direction: \"asc\" | \"desc\" = \"asc\", errorMessage?: string) {\r\n return this.addRule(sortedArrayRule, errorMessage, { direction });\r\n }\r\n\r\n /** Mutate the data */\r\n public mutate(data: any, context: SchemaContext) {\r\n if (!Array.isArray(data)) return data;\r\n return super.mutate([...data], context);\r\n }\r\n\r\n /** Validate array\r\n *\r\n * Absent input (and absent without `.default()`) propagates as `data: undefined`\r\n * so the parent ObjectValidator can omit the key. Without this, optional array\r\n * fields would silently materialise as `[]` in the validated output.\r\n */\r\n public async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\r\n // Apply default when absent, then mutate. Mirrors BaseValidator's\r\n // `valueForRules = data ?? this.getDefaultValue()` so `.default([...])`\r\n // works on arrays too.\r\n const valueForRules = data ?? this.getDefaultValue();\r\n const mutatedData = await this.mutate(valueForRules, context);\r\n\r\n const result = await super.validate(data, context);\r\n\r\n if (result.isValid === false) return result;\r\n\r\n // Nothing to iterate for absent (no default) or null (nullable) inputs —\r\n // propagate so the parent ObjectValidator can omit the key.\r\n if (mutatedData === undefined || mutatedData === null) return result;\r\n\r\n // Defensive: type rule (arrayRule) should have failed for non-arrays.\r\n if (!Array.isArray(mutatedData)) return result;\r\n\r\n const errors: ValidationResult[\"errors\"] = [];\r\n\r\n // Validate all items in parallel (consistent with ObjectValidator)\r\n const validationPromises = mutatedData.map(async (value: any, index: number) => {\r\n const childContext: SchemaContext = {\r\n ...context,\r\n parent: mutatedData,\r\n value,\r\n key: index.toString(),\r\n path: setKeyPath(context.path, index.toString()),\r\n };\r\n\r\n const childResult = await this.validator.validate(value, childContext);\r\n\r\n // Update mutated data with validated result\r\n mutatedData[index] = childResult.data;\r\n\r\n // Collect errors from this element\r\n if (childResult.isValid === false) {\r\n errors.push(...childResult.errors);\r\n }\r\n });\r\n\r\n await Promise.all(validationPromises);\r\n\r\n return {\r\n isValid: errors.length === 0,\r\n errors,\r\n data: await this.startTransformationPipeline(mutatedData, context),\r\n };\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Recursively generates JSON Schema for the array items.\r\n *\r\n * @example\r\n * ```ts\r\n * v.array(v.string().min(1)).minLength(1).toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"array\", items: { type: \"string\", minLength: 1 }, minItems: 1 }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const schema: JsonSchemaResult = {\r\n type: \"array\",\r\n items: this.validator.toJsonSchema(target),\r\n };\r\n\r\n const minOpts = getRuleOptions(this.rules, \"minLength\");\r\n if (minOpts?.minLength !== undefined) schema.minItems = minOpts.minLength;\r\n\r\n const maxOpts = getRuleOptions(this.rules, \"maxLength\");\r\n if (maxOpts?.maxLength !== undefined) schema.maxItems = maxOpts.maxLength;\r\n\r\n const betweenOpts = getRuleOptions(this.rules, \"betweenLength\");\r\n if (betweenOpts) {\r\n if (betweenOpts.minLength !== undefined) schema.minItems = betweenOpts.minLength;\r\n if (betweenOpts.maxLength !== undefined) schema.maxItems = betweenOpts.maxLength;\r\n }\r\n\r\n const lengthOpts = getRuleOptions(this.rules, \"length\");\r\n if (lengthOpts?.length !== undefined) {\r\n schema.minItems = lengthOpts.length;\r\n schema.maxItems = lengthOpts.length;\r\n }\r\n\r\n if (this.isNullable) applyNullable(schema, target);\r\n\r\n return schema;\r\n }\r\n}\r\n","import { equalsFieldRule, notEqualsFieldRule } from \"../../rules\";\nimport { equalRule } from \"../../rules/core/equal\";\nimport { whenRule } from \"../../rules/core/when\";\nimport type { WhenRuleOptions } from \"../../types\";\nimport { BaseValidator } from \"../base-validator\";\n\ndeclare module \"../base-validator\" {\n interface BaseValidator {\n /**\n * Value must be equal to the given value\n */\n equal(value: any, errorMessage?: string): this;\n\n /**\n * Value must be the same as another field's value\n */\n sameAs(field: string, errorMessage?: string): this;\n\n /**\n * Value must be the same as another sibling field's value\n */\n sameAsSibling(field: string, errorMessage?: string): this;\n\n /**\n * Value must be different from another field's value\n */\n differentFrom(field: string, errorMessage?: string): this;\n\n /**\n * Value must be different from another sibling field's value\n */\n differentFromSibling(field: string, errorMessage?: string): this;\n\n /**\n * Apply different validation rules based on another field's value (global scope)\n *\n * Use this when you need to apply completely different validators\n * based on another field's value (not just required/optional).\n *\n * @param field - Field name to check (can be nested with dot notation)\n * @param options - Validation options per field value\n *\n * @example\n * ```ts\n * // Different allowed values based on user type\n * v.object({\n * userType: v.string().in(['admin', 'user']),\n * role: v.string().when('userType', {\n * is: {\n * admin: v.string().in(['super', 'moderator']),\n * user: v.string().in(['member', 'guest'])\n * },\n * otherwise: v.string().optional()\n * })\n * })\n *\n * // Different validation rules based on type\n * v.object({\n * contactType: v.string().in(['email', 'phone']),\n * contact: v.string().when('contactType', {\n * is: {\n * email: v.string().email(),\n * phone: v.string().pattern(/^\\d{10}$/)\n * }\n * })\n * })\n * ```\n * @category Conditional Validation\n */\n when(field: string, options: Omit<WhenRuleOptions, \"field\" | \"scope\">): this;\n\n /**\n * Apply different validation rules based on sibling field's value\n *\n * Use this for nested objects where you need to check a field\n * within the same parent object.\n *\n * @param siblingField - Sibling field name to check\n * @param options - Validation options per field value\n *\n * @example\n * ```ts\n * // Array of users with role-based permissions\n * v.array(v.object({\n * userType: v.string().in(['admin', 'user']),\n * permissions: v.string().whenSibling('userType', {\n * is: {\n * admin: v.string().in(['read', 'write', 'delete']),\n * user: v.string().in(['read'])\n * }\n * })\n * }))\n * ```\n * @category Conditional Validation\n */\n whenSibling(siblingField: string, options: Omit<WhenRuleOptions, \"field\" | \"scope\">): this;\n }\n}\n\n/**\n * Value must be equal to the given value\n */\nBaseValidator.prototype.equal = function (value: any, errorMessage?: string) {\n return this.addRule(equalRule, errorMessage, { value });\n};\n\n/**\n * Value must be the same as another field's value\n */\nBaseValidator.prototype.sameAs = function (field: string, errorMessage?: string) {\n return this.addRule(equalsFieldRule, errorMessage, {\n field,\n scope: \"global\",\n });\n};\n\n/**\n * Value must be the same as another sibling field's value\n */\nBaseValidator.prototype.sameAsSibling = function (field: string, errorMessage?: string) {\n return this.addRule(equalsFieldRule, errorMessage, {\n field,\n scope: \"sibling\",\n });\n};\n\n/**\n * Value must be different from another field's value\n */\nBaseValidator.prototype.differentFrom = function (field: string, errorMessage?: string) {\n return this.addRule(notEqualsFieldRule, errorMessage, {\n field,\n scope: \"global\",\n });\n};\n\n/**\n * Value must be different from another sibling field's value\n */\nBaseValidator.prototype.differentFromSibling = function (field: string, errorMessage?: string) {\n return this.addRule(notEqualsFieldRule, errorMessage, {\n field,\n scope: \"sibling\",\n });\n};\n\n/**\n * Apply different validation rules based on another field's value (global scope)\n *\n * Use this when you need to apply completely different validators\n * based on another field's value (not just required/optional).\n *\n * @param field - Field name to check (can be nested with dot notation)\n * @param options - Validation options per field value\n *\n * @example\n * ```ts\n * // Different allowed values based on user type\n * v.object({\n * userType: v.string().in(['admin', 'user']),\n * role: v.string().when('userType', {\n * is: {\n * admin: v.string().in(['super', 'moderator']),\n * user: v.string().in(['member', 'guest'])\n * },\n * otherwise: v.string().optional()\n * })\n * })\n *\n * // Different validation rules based on type\n * v.object({\n * contactType: v.string().in(['email', 'phone']),\n * contact: v.string().when('contactType', {\n * is: {\n * email: v.string().email(),\n * phone: v.string().pattern(/^\\d{10}$/)\n * }\n * })\n * })\n * ```\n * @category Conditional Validation\n */\nBaseValidator.prototype.when = function (\n field: string,\n options: Omit<WhenRuleOptions, \"field\" | \"scope\">,\n) {\n return this.addRule(whenRule, undefined, {\n field,\n is: options.is,\n otherwise: options.otherwise,\n scope: \"global\",\n });\n};\n\n/**\n * Apply different validation rules based on sibling field's value\n *\n * Use this for nested objects where you need to check a field\n * within the same parent object.\n *\n * @param siblingField - Sibling field name to check\n * @param options - Validation options per field value\n *\n * @example\n * ```ts\n * // Array of users with role-based permissions\n * v.array(v.object({\n * userType: v.string().in(['admin', 'user']),\n * permissions: v.string().whenSibling('userType', {\n * is: {\n * admin: v.string().in(['read', 'write', 'delete']),\n * user: v.string().in(['read'])\n * }\n * })\n * }))\n * ```\n * @category Conditional Validation\n */\nBaseValidator.prototype.whenSibling = function (\n siblingField: string,\n options: Omit<WhenRuleOptions, \"field\" | \"scope\">,\n) {\n return this.addRule(whenRule, undefined, {\n field: siblingField,\n is: options.is,\n otherwise: options.otherwise,\n scope: \"sibling\",\n });\n};\n","import {\n forbiddenIfEmptyRule,\n forbiddenIfInRule,\n forbiddenIfNotEmptyRule,\n forbiddenIfNotInRule,\n forbiddenIfNotRule,\n forbiddenIfRule,\n} from \"../../rules/conditional/forbidden-if-rules\";\nimport { forbiddenRule } from \"../../rules/core/forbidden\";\nimport { BaseValidator } from \"../base-validator\";\n\ndeclare module \"../base-validator\" {\n interface BaseValidator {\n /**\n * Value is forbidden to be present\n */\n forbidden(errorMessage?: string): this;\n\n /**\n * Value is forbidden if another field equals a specific value (global scope)\n */\n forbiddenIf(field: string, value: any, errorMessage?: string): this;\n\n /**\n * Value is forbidden if another field equals a specific value (sibling scope)\n */\n forbiddenIfSibling(field: string, value: any, errorMessage?: string): this;\n\n /**\n * Value is forbidden if another field does NOT equal a specific value (global scope)\n */\n forbiddenIfNot(field: string, value: any, errorMessage?: string): this;\n\n /**\n * Value is forbidden if another field does NOT equal a specific value (sibling scope)\n */\n forbiddenIfNotSibling(field: string, value: any, errorMessage?: string): this;\n\n /**\n * Value is forbidden if another field is empty (global scope)\n */\n forbiddenIfEmpty(field: string, errorMessage?: string): this;\n\n /**\n * Value is forbidden if another field is empty (sibling scope)\n */\n forbiddenIfEmptySibling(field: string, errorMessage?: string): this;\n\n /**\n * Value is forbidden if another field is not empty (global scope)\n */\n forbiddenIfNotEmpty(field: string, errorMessage?: string): this;\n\n /**\n * Value is forbidden if another field is not empty (sibling scope)\n */\n forbiddenIfNotEmptySibling(field: string, errorMessage?: string): this;\n\n /**\n * Value is forbidden if another field's value is in the given array (global scope)\n */\n forbiddenIfIn(field: string, values: any[], errorMessage?: string): this;\n\n /**\n * Value is forbidden if another field's value is in the given array (sibling scope)\n */\n forbiddenIfInSibling(field: string, values: any[], errorMessage?: string): this;\n\n /**\n * Value is forbidden if another field's value is NOT in the given array (global scope)\n */\n forbiddenIfNotIn(field: string, values: any[], errorMessage?: string): this;\n\n /**\n * Value is forbidden if another field's value is NOT in the given array (sibling scope)\n */\n forbiddenIfNotInSibling(field: string, values: any[], errorMessage?: string): this;\n }\n}\n\n/**\n * Value is forbidden to be present\n */\nBaseValidator.prototype.forbidden = function (errorMessage?: string) {\n return this.addRule(forbiddenRule, errorMessage);\n};\n\n/**\n * Value is forbidden if another field equals a specific value (global scope)\n */\nBaseValidator.prototype.forbiddenIf = function (field: string, value: any, errorMessage?: string) {\n return this.addRule(forbiddenIfRule, errorMessage, {\n field,\n value,\n scope: \"global\",\n });\n};\n\n/**\n * Value is forbidden if another field equals a specific value (sibling scope)\n */\nBaseValidator.prototype.forbiddenIfSibling = function (\n field: string,\n value: any,\n errorMessage?: string,\n) {\n return this.addRule(forbiddenIfRule, errorMessage, {\n field,\n value,\n scope: \"sibling\",\n });\n};\n\n/**\n * Value is forbidden if another field does NOT equal a specific value (global scope)\n */\nBaseValidator.prototype.forbiddenIfNot = function (\n field: string,\n value: any,\n errorMessage?: string,\n) {\n return this.addRule(forbiddenIfNotRule, errorMessage, {\n field,\n value,\n scope: \"global\",\n });\n};\n\n/**\n * Value is forbidden if another field does NOT equal a specific value (sibling scope)\n */\nBaseValidator.prototype.forbiddenIfNotSibling = function (\n field: string,\n value: any,\n errorMessage?: string,\n) {\n return this.addRule(forbiddenIfNotRule, errorMessage, {\n field,\n value,\n scope: \"sibling\",\n });\n};\n\n/**\n * Value is forbidden if another field is empty (global scope)\n */\nBaseValidator.prototype.forbiddenIfEmpty = function (field: string, errorMessage?: string) {\n return this.addRule(forbiddenIfEmptyRule, errorMessage, {\n field,\n scope: \"global\",\n });\n};\n\n/**\n * Value is forbidden if another field is empty (sibling scope)\n */\nBaseValidator.prototype.forbiddenIfEmptySibling = function (field: string, errorMessage?: string) {\n return this.addRule(forbiddenIfEmptyRule, errorMessage, {\n field,\n scope: \"sibling\",\n });\n};\n\n/**\n * Value is forbidden if another field is not empty (global scope)\n */\nBaseValidator.prototype.forbiddenIfNotEmpty = function (field: string, errorMessage?: string) {\n return this.addRule(forbiddenIfNotEmptyRule, errorMessage, {\n field,\n scope: \"global\",\n });\n};\n\n/**\n * Value is forbidden if another field is not empty (sibling scope)\n */\nBaseValidator.prototype.forbiddenIfNotEmptySibling = function (\n field: string,\n errorMessage?: string,\n) {\n return this.addRule(forbiddenIfNotEmptyRule, errorMessage, {\n field,\n scope: \"sibling\",\n });\n};\n\n/**\n * Value is forbidden if another field's value is in the given array (global scope)\n */\nBaseValidator.prototype.forbiddenIfIn = function (\n field: string,\n values: any[],\n errorMessage?: string,\n) {\n return this.addRule(forbiddenIfInRule, errorMessage, {\n field,\n values,\n scope: \"global\",\n });\n};\n\n/**\n * Value is forbidden if another field's value is in the given array (sibling scope)\n */\nBaseValidator.prototype.forbiddenIfInSibling = function (\n field: string,\n values: any[],\n errorMessage?: string,\n) {\n return this.addRule(forbiddenIfInRule, errorMessage, {\n field,\n values,\n scope: \"sibling\",\n });\n};\n\n/**\n * Value is forbidden if another field's value is NOT in the given array (global scope)\n */\nBaseValidator.prototype.forbiddenIfNotIn = function (\n field: string,\n values: any[],\n errorMessage?: string,\n) {\n return this.addRule(forbiddenIfNotInRule, errorMessage, {\n field,\n values,\n scope: \"global\",\n });\n};\n\n/**\n * Value is forbidden if another field's value is NOT in the given array (sibling scope)\n */\nBaseValidator.prototype.forbiddenIfNotInSibling = function (\n field: string,\n values: any[],\n errorMessage?: string,\n) {\n return this.addRule(forbiddenIfNotInRule, errorMessage, {\n field,\n values,\n scope: \"sibling\",\n });\n};\n","import {\n presentIfEmptyRule,\n presentIfInRule,\n presentIfNotEmptyRule,\n presentIfNotInRule,\n presentIfRule,\n} from \"../../rules/conditional/present-if-rules\";\nimport { presentUnlessRule } from \"../../rules/conditional/present-unless-rules\";\nimport {\n presentWithAllRule,\n presentWithAnyRule,\n presentWithRule,\n} from \"../../rules/conditional/present-with-rules\";\nimport {\n presentWithoutAllRule,\n presentWithoutAnyRule,\n presentWithoutRule,\n} from \"../../rules/conditional/present-without-rules\";\nimport { BaseValidator } from \"../base-validator\";\n\ndeclare module \"../base-validator\" {\n interface BaseValidator {\n /**\n * Field must be present if another field exists\n */\n presentWith(field: string, errorMessage?: string): this;\n\n /**\n * Field must be present if another sibling field exists\n */\n presentWithSibling(field: string, errorMessage?: string): this;\n\n /**\n * Field must be present if another field is missing\n */\n presentWithout(field: string, errorMessage?: string): this;\n\n /**\n * Field must be present if another sibling field is missing\n */\n presentWithoutSibling(field: string, errorMessage?: string): this;\n\n /**\n * Field must be present if another field equals a specific value\n */\n presentIf(field: string, value: any, errorMessage?: string): this;\n\n /**\n * Field must be present if another sibling field equals a specific value\n */\n presentIfSibling(field: string, value: any, errorMessage?: string): this;\n\n /**\n * Field must be present unless another field equals a specific value\n */\n presentUnless(field: string, value: any, errorMessage?: string): this;\n\n /**\n * Field must be present unless another sibling field equals a specific value\n */\n presentUnlessSibling(field: string, value: any, errorMessage?: string): this;\n\n /**\n * Field must be present if another field is empty\n */\n presentIfEmpty(field: string, errorMessage?: string): this;\n\n /**\n * Field must be present if another sibling field is empty\n */\n presentIfEmptySibling(field: string, errorMessage?: string): this;\n\n /**\n * Field must be present if another field is not empty\n */\n presentIfNotEmpty(field: string, errorMessage?: string): this;\n\n /**\n * Field must be present if another sibling field is not empty\n */\n presentIfNotEmptySibling(field: string, errorMessage?: string): this;\n\n /**\n * Field must be present if another field's value is in the given array\n */\n presentIfIn(field: string, values: any[], errorMessage?: string): this;\n\n /**\n * Field must be present if another sibling field's value is in the given array\n */\n presentIfInSibling(field: string, values: any[], errorMessage?: string): this;\n\n /**\n * Field must be present if another field's value is NOT in the given array\n */\n presentIfNotIn(field: string, values: any[], errorMessage?: string): this;\n\n /**\n * Field must be present if another sibling field's value is NOT in the given array\n */\n presentIfNotInSibling(field: string, values: any[], errorMessage?: string): this;\n\n /**\n * Field must be present if all specified fields exist\n */\n presentWithAll(fields: string[], errorMessage?: string): this;\n\n /**\n * Field must be present if all specified sibling fields exist\n */\n presentWithAllSiblings(fields: string[], errorMessage?: string): this;\n\n /**\n * Field must be present if all specified fields are missing\n */\n presentWithoutAll(fields: string[], errorMessage?: string): this;\n\n /**\n * Field must be present if all specified sibling fields are missing\n */\n presentWithoutAllSiblings(fields: string[], errorMessage?: string): this;\n\n /**\n * Field must be present if any of the specified fields exists\n */\n presentWithAny(fields: string[], errorMessage?: string): this;\n\n /**\n * Field must be present if any of the specified sibling fields exists\n */\n presentWithAnySiblings(fields: string[], errorMessage?: string): this;\n\n /**\n * Field must be present if any of the specified fields is missing\n */\n presentWithoutAny(fields: string[], errorMessage?: string): this;\n\n /**\n * Field must be present if any of the specified sibling fields is missing\n */\n presentWithoutAnySiblings(fields: string[], errorMessage?: string): this;\n }\n}\n\n// ==================== PRESENT: BASED ON FIELD PRESENCE ====================\n\n/**\n * Field must be present if another field exists\n */\nBaseValidator.prototype.presentWith = function (field: string, errorMessage?: string) {\n return this.addRule(presentWithRule, errorMessage, {\n field,\n scope: \"global\",\n });\n};\n\n/**\n * Field must be present if another sibling field exists\n */\nBaseValidator.prototype.presentWithSibling = function (field: string, errorMessage?: string) {\n return this.addRule(presentWithRule, errorMessage, {\n field,\n scope: \"sibling\",\n });\n};\n\n/**\n * Field must be present if another field is missing\n */\nBaseValidator.prototype.presentWithout = function (field: string, errorMessage?: string) {\n return this.addRule(presentWithoutRule, errorMessage, {\n field,\n scope: \"global\",\n });\n};\n\n/**\n * Field must be present if another sibling field is missing\n */\nBaseValidator.prototype.presentWithoutSibling = function (field: string, errorMessage?: string) {\n return this.addRule(presentWithoutRule, errorMessage, {\n field,\n scope: \"sibling\",\n });\n};\n\n// ==================== PRESENT: BASED ON FIELD VALUE ====================\n\n/**\n * Field must be present if another field equals a specific value\n */\nBaseValidator.prototype.presentIf = function (field: string, value: any, errorMessage?: string) {\n return this.addRule(presentIfRule, errorMessage, {\n field,\n value,\n scope: \"global\",\n });\n};\n\n/**\n * Field must be present if another sibling field equals a specific value\n */\nBaseValidator.prototype.presentIfSibling = function (\n field: string,\n value: any,\n errorMessage?: string,\n) {\n return this.addRule(presentIfRule, errorMessage, {\n field,\n value,\n scope: \"sibling\",\n });\n};\n\n/**\n * Field must be present unless another field equals a specific value\n */\nBaseValidator.prototype.presentUnless = function (\n field: string,\n value: any,\n errorMessage?: string,\n) {\n return this.addRule(presentUnlessRule, errorMessage, {\n field,\n value,\n scope: \"global\",\n });\n};\n\n/**\n * Field must be present unless another sibling field equals a specific value\n */\nBaseValidator.prototype.presentUnlessSibling = function (\n field: string,\n value: any,\n errorMessage?: string,\n) {\n return this.addRule(presentUnlessRule, errorMessage, {\n field,\n value,\n scope: \"sibling\",\n });\n};\n\n// ==================== PRESENT: BASED ON FIELD EMPTY STATE ====================\n\n/**\n * Field must be present if another field is empty\n */\nBaseValidator.prototype.presentIfEmpty = function (field: string, errorMessage?: string) {\n return this.addRule(presentIfEmptyRule, errorMessage, {\n field,\n scope: \"global\",\n });\n};\n\n/**\n * Field must be present if another sibling field is empty\n */\nBaseValidator.prototype.presentIfEmptySibling = function (field: string, errorMessage?: string) {\n return this.addRule(presentIfEmptyRule, errorMessage, {\n field,\n scope: \"sibling\",\n });\n};\n\n/**\n * Field must be present if another field is not empty\n */\nBaseValidator.prototype.presentIfNotEmpty = function (field: string, errorMessage?: string) {\n return this.addRule(presentIfNotEmptyRule, errorMessage, {\n field,\n scope: \"global\",\n });\n};\n\n/**\n * Field must be present if another sibling field is not empty\n */\nBaseValidator.prototype.presentIfNotEmptySibling = function (field: string, errorMessage?: string) {\n return this.addRule(presentIfNotEmptyRule, errorMessage, {\n field,\n scope: \"sibling\",\n });\n};\n\n/**\n * Field must be present if another field's value is in the given array\n */\nBaseValidator.prototype.presentIfIn = function (\n field: string,\n values: any[],\n errorMessage?: string,\n) {\n return this.addRule(presentIfInRule, errorMessage, {\n field,\n values,\n scope: \"global\",\n });\n};\n\n/**\n * Field must be present if another sibling field's value is in the given array\n */\nBaseValidator.prototype.presentIfInSibling = function (\n field: string,\n values: any[],\n errorMessage?: string,\n) {\n return this.addRule(presentIfInRule, errorMessage, {\n field,\n values,\n scope: \"sibling\",\n });\n};\n\n/**\n * Field must be present if another field's value is NOT in the given array\n */\nBaseValidator.prototype.presentIfNotIn = function (\n field: string,\n values: any[],\n errorMessage?: string,\n) {\n return this.addRule(presentIfNotInRule, errorMessage, {\n field,\n values,\n scope: \"global\",\n });\n};\n\n/**\n * Field must be present if another sibling field's value is NOT in the given array\n */\nBaseValidator.prototype.presentIfNotInSibling = function (\n field: string,\n values: any[],\n errorMessage?: string,\n) {\n return this.addRule(presentIfNotInRule, errorMessage, {\n field,\n values,\n scope: \"sibling\",\n });\n};\n\n// ==================== PRESENT: BASED ON MULTIPLE FIELDS (ALL) ====================\n\n/**\n * Field must be present if all specified fields exist\n */\nBaseValidator.prototype.presentWithAll = function (fields: string[], errorMessage?: string) {\n return this.addRule(presentWithAllRule, errorMessage, {\n fields,\n scope: \"global\",\n });\n};\n\n/**\n * Field must be present if all specified sibling fields exist\n */\nBaseValidator.prototype.presentWithAllSiblings = function (\n fields: string[],\n errorMessage?: string,\n) {\n return this.addRule(presentWithAllRule, errorMessage, {\n fields,\n scope: \"sibling\",\n });\n};\n\n/**\n * Field must be present if all specified fields are missing\n */\nBaseValidator.prototype.presentWithoutAll = function (fields: string[], errorMessage?: string) {\n return this.addRule(presentWithoutAllRule, errorMessage, {\n fields,\n scope: \"global\",\n });\n};\n\n/**\n * Field must be present if all specified sibling fields are missing\n */\nBaseValidator.prototype.presentWithoutAllSiblings = function (\n fields: string[],\n errorMessage?: string,\n) {\n return this.addRule(presentWithoutAllRule, errorMessage, {\n fields,\n scope: \"sibling\",\n });\n};\n\n// ==================== PRESENT: BASED ON MULTIPLE FIELDS (ANY) ====================\n\n/**\n * Field must be present if any of the specified fields exists\n */\nBaseValidator.prototype.presentWithAny = function (fields: string[], errorMessage?: string) {\n return this.addRule(presentWithAnyRule, errorMessage, {\n fields,\n scope: \"global\",\n });\n};\n\n/**\n * Field must be present if any of the specified sibling fields exists\n */\nBaseValidator.prototype.presentWithAnySiblings = function (\n fields: string[],\n errorMessage?: string,\n) {\n return this.addRule(presentWithAnyRule, errorMessage, {\n fields,\n scope: \"sibling\",\n });\n};\n\n/**\n * Field must be present if any of the specified fields is missing\n */\nBaseValidator.prototype.presentWithoutAny = function (fields: string[], errorMessage?: string) {\n return this.addRule(presentWithoutAnyRule, errorMessage, {\n fields,\n scope: \"global\",\n });\n};\n\n/**\n * Field must be present if any of the specified sibling fields is missing\n */\nBaseValidator.prototype.presentWithoutAnySiblings = function (\n fields: string[],\n errorMessage?: string,\n) {\n return this.addRule(presentWithoutAnyRule, errorMessage, {\n fields,\n scope: \"sibling\",\n });\n};\n","import {\n requiredIfAllEmptyRule,\n requiredIfAllNotEmptyRule,\n requiredIfAnyEmptyRule,\n requiredIfAnyNotEmptyRule,\n requiredIfEmptyRule,\n requiredIfInRule,\n requiredIfNotEmptyRule,\n requiredIfNotInRule,\n requiredIfRule,\n} from \"../../rules/conditional/required-if-rules\";\nimport { requiredUnlessRule } from \"../../rules/conditional/required-unless-rules\";\nimport { requiredWhenRule } from \"../../rules/conditional/required-when-rule\";\nimport {\n requiredWithAllRule,\n requiredWithAnyRule,\n requiredWithRule,\n} from \"../../rules/conditional/required-with-rules\";\nimport {\n requiredWithoutAllRule,\n requiredWithoutAnyRule,\n requiredWithoutRule,\n} from \"../../rules/conditional/required-without-rules\";\nimport { presentRule, requiredRule } from \"../../rules/core/required\";\nimport type { SchemaContext } from \"../../types\";\nimport { BaseValidator } from \"../base-validator\";\n\ndeclare module \"../base-validator\" {\n interface BaseValidator {\n /**\n * This value must be present and has a value\n */\n required(errorMessage?: string): this;\n\n /**\n * Value must be present but not necessarily has a value\n */\n present(errorMessage?: string): this;\n\n /**\n * Mark the field as optional, so pass it if it has no value or has a value\n * Because this is the default behavior, this method is just syntactic sugar\n */\n optional(): this & { isOptional: true };\n\n /**\n * Sugar for `.optional().nullable()` — the field may be absent OR null.\n *\n * Brands the return type with both `{ isOptional: true }` and `{ isNullable: true }`\n * so `Infer<>` produces `{ field?: T | null }`.\n *\n * @example\n * v.string().nullish()\n * // type: string | null | undefined\n * // absent → key omitted\n * // null → null\n * // \"x\" → \"x\"\n */\n nullish(): this & { isOptional: true; isNullable: true };\n\n /**\n * Value is required if another field exists\n */\n requiredWith(field: string, errorMessage?: string): this;\n\n /**\n * Value is required if another sibling field exists\n */\n requiredWithSibling(field: string, errorMessage?: string): this;\n\n /**\n * Value is required if another field is missing\n */\n requiredWithout(field: string, errorMessage?: string): this;\n\n /**\n * Value is required if another sibling field is missing\n */\n requiredWithoutSibling(field: string, errorMessage?: string): this;\n\n /**\n * Value is required if another field equals a specific value\n */\n requiredIf(field: string, value: any, errorMessage?: string): this;\n\n /**\n * Value is required if another sibling field equals a specific value\n */\n requiredIfSibling(field: string, value: any, errorMessage?: string): this;\n\n /**\n * Value is required unless another field equals a specific value\n */\n requiredUnless(field: string, value: any, errorMessage?: string): this;\n\n /**\n * Value is required unless another sibling field equals a specific value\n */\n requiredUnlessSibling(field: string, value: any, errorMessage?: string): this;\n\n /**\n * Value is required if another field is empty\n */\n requiredIfEmpty(field: string, errorMessage?: string): this;\n\n /**\n * Value is required if another sibling field is empty\n */\n requiredIfEmptySibling(field: string, errorMessage?: string): this;\n\n /**\n * Value is required if another field is not empty\n */\n requiredIfNotEmpty(field: string, errorMessage?: string): this;\n\n /**\n * Value is required if another sibling field is not empty\n */\n requiredIfNotEmptySibling(field: string, errorMessage?: string): this;\n\n /**\n * Value is required if ALL specified fields are empty\n */\n requiredIfAllEmpty(fields: string[], errorMessage?: string): this;\n\n /**\n * Value is required if ALL specified sibling fields are empty\n */\n requiredIfAllEmptySiblings(fields: string[], errorMessage?: string): this;\n\n /**\n * Value is required if ANY of the specified fields is empty\n */\n requiredIfAnyEmpty(fields: string[], errorMessage?: string): this;\n\n /**\n * Value is required if ANY of the specified sibling fields is empty\n */\n requiredIfAnyEmptySiblings(fields: string[], errorMessage?: string): this;\n\n /**\n * Value is required if ALL specified fields are NOT empty\n */\n requiredIfAllNotEmpty(fields: string[], errorMessage?: string): this;\n\n /**\n * Value is required if ALL specified sibling fields are NOT empty\n */\n requiredIfAllNotEmptySiblings(fields: string[], errorMessage?: string): this;\n\n /**\n * Value is required if ANY of the specified fields is NOT empty\n */\n requiredIfAnyNotEmpty(fields: string[], errorMessage?: string): this;\n\n /**\n * Value is required if ANY of the specified sibling fields is NOT empty\n */\n requiredIfAnyNotEmptySiblings(fields: string[], errorMessage?: string): this;\n\n /**\n * Value is required if another field's value is in the given array\n */\n requiredIfIn(field: string, values: any[], errorMessage?: string): this;\n\n /**\n * Value is required if another sibling field's value is in the given array\n */\n requiredIfInSibling(field: string, values: any[], errorMessage?: string): this;\n\n /**\n * Value is required if another field's value is NOT in the given array\n */\n requiredIfNotIn(field: string, values: any[], errorMessage?: string): this;\n\n /**\n * Value is required if another sibling field's value is NOT in the given array\n */\n requiredIfNotInSibling(field: string, values: any[], errorMessage?: string): this;\n\n /**\n * Value is required if all specified fields exist\n */\n requiredWithAll(fields: string[], errorMessage?: string): this;\n\n /**\n * Value is required if all specified sibling fields exist\n */\n requiredWithAllSiblings(fields: string[], errorMessage?: string): this;\n\n /**\n * Value is required if all specified fields are missing\n */\n requiredWithoutAll(fields: string[], errorMessage?: string): this;\n\n /**\n * Value is required if all specified sibling fields are missing\n */\n requiredWithoutAllSiblings(fields: string[], errorMessage?: string): this;\n\n /**\n * Value is required if any of the specified fields exists\n */\n requiredWithAny(fields: string[], errorMessage?: string): this;\n\n /**\n * Value is required if any of the specified sibling fields exists\n */\n requiredWithAnySiblings(fields: string[], errorMessage?: string): this;\n\n /**\n * Value is required if any of the specified fields is missing\n */\n requiredWithoutAny(fields: string[], errorMessage?: string): this;\n\n /**\n * Value is required if any of the specified sibling fields is missing\n */\n requiredWithoutAnySiblings(fields: string[], errorMessage?: string): this;\n\n /**\n * Make this field required based on a custom callback.\n *\n * The callback receives only the `SchemaContext` (not the value),\n * because \"required\" is about surrounding conditions, not the field itself.\n * Return `true` if the field should be required.\n *\n * @param callback - Receives SchemaContext, returns boolean\n * @param errorMessage - Optional custom error message\n *\n * @example\n * ```ts\n * // Required when email notification is enabled\n * v.string().requiredWhen((context) => {\n * return context.allData.notificationMethod === 'email';\n * })\n *\n * // Required based on multiple conditions\n * v.string().requiredWhen((context) => {\n * const { role, department } = context.allData;\n * return role === 'manager' && department === 'finance';\n * })\n * ```\n */\n requiredWhen(\n callback: (context: SchemaContext) => boolean | Promise<boolean>,\n errorMessage?: string,\n ): this;\n }\n}\n\n// ==================== UNCONDITIONAL STATES ====================\n\n/**\n * This value must be present and has a value\n */\nBaseValidator.prototype.required = function (errorMessage?: string) {\n return this.setRequiredRule(requiredRule, errorMessage);\n};\n\n/**\n * Value must be present but not necessarily has a value\n */\nBaseValidator.prototype.present = function (errorMessage?: string) {\n return this.setRequiredRule(presentRule, errorMessage);\n};\n\n/**\n * Mark the field as optional — it may be absent or empty without validation errors.\n * Clears any previously set required rule.\n *\n * The return type is branded with `{ isOptional: true }` so schema inference\n * can mark this key as optional in the inferred TypeScript type.\n */\nBaseValidator.prototype.optional = function (): BaseValidator & { isOptional: true } {\n const instance = this.instance;\n instance.isOptional = true;\n instance.requiredRule = null;\n return instance as BaseValidator & { isOptional: true };\n};\n\n/**\n * Sugar — equivalent to `.optional().nullable()`.\n */\nBaseValidator.prototype.nullish = function (): BaseValidator & {\n isOptional: true;\n isNullable: true;\n} {\n const instance = this.optional().nullable();\n return instance as BaseValidator & { isOptional: true; isNullable: true };\n};\n\n// ==================== REQUIRED: BASED ON FIELD PRESENCE ====================\n\n/**\n * Value is required if another field exists\n */\nBaseValidator.prototype.requiredWith = function (field: string, errorMessage?: string) {\n return this.setRequiredRule(requiredWithRule, errorMessage, { field, scope: \"global\" });\n};\n\n/**\n * Value is required if another sibling field exists\n */\nBaseValidator.prototype.requiredWithSibling = function (field: string, errorMessage?: string) {\n return this.setRequiredRule(requiredWithRule, errorMessage, { field, scope: \"sibling\" });\n};\n\n/**\n * Value is required if another field is missing\n */\nBaseValidator.prototype.requiredWithout = function (field: string, errorMessage?: string) {\n return this.setRequiredRule(requiredWithoutRule, errorMessage, { field, scope: \"global\" });\n};\n\n/**\n * Value is required if another sibling field is missing\n */\nBaseValidator.prototype.requiredWithoutSibling = function (field: string, errorMessage?: string) {\n return this.setRequiredRule(requiredWithoutRule, errorMessage, { field, scope: \"sibling\" });\n};\n\n// ==================== REQUIRED: BASED ON FIELD VALUE ====================\n\n/**\n * Value is required if another field equals a specific value\n */\nBaseValidator.prototype.requiredIf = function (field: string, value: any, errorMessage?: string) {\n return this.setRequiredRule(requiredIfRule, errorMessage, { field, value, scope: \"global\" });\n};\n\n/**\n * Value is required if another sibling field equals a specific value\n */\nBaseValidator.prototype.requiredIfSibling = function (\n field: string,\n value: any,\n errorMessage?: string,\n) {\n return this.setRequiredRule(requiredIfRule, errorMessage, { field, value, scope: \"sibling\" });\n};\n\n/**\n * Value is required unless another field equals a specific value\n */\nBaseValidator.prototype.requiredUnless = function (\n field: string,\n value: any,\n errorMessage?: string,\n) {\n return this.setRequiredRule(requiredUnlessRule, errorMessage, { field, value, scope: \"global\" });\n};\n\n/**\n * Value is required unless another sibling field equals a specific value\n */\nBaseValidator.prototype.requiredUnlessSibling = function (\n field: string,\n value: any,\n errorMessage?: string,\n) {\n return this.setRequiredRule(requiredUnlessRule, errorMessage, { field, value, scope: \"sibling\" });\n};\n\n// ==================== REQUIRED: BASED ON FIELD EMPTY STATE ====================\n\n/**\n * Value is required if another field is empty\n */\nBaseValidator.prototype.requiredIfEmpty = function (field: string, errorMessage?: string) {\n return this.setRequiredRule(requiredIfEmptyRule, errorMessage, { field, scope: \"global\" });\n};\n\n/**\n * Value is required if another sibling field is empty\n */\nBaseValidator.prototype.requiredIfEmptySibling = function (field: string, errorMessage?: string) {\n return this.setRequiredRule(requiredIfEmptyRule, errorMessage, { field, scope: \"sibling\" });\n};\n\n/**\n * Value is required if another field is not empty\n */\nBaseValidator.prototype.requiredIfNotEmpty = function (field: string, errorMessage?: string) {\n return this.setRequiredRule(requiredIfNotEmptyRule, errorMessage, { field, scope: \"global\" });\n};\n\n/**\n * Value is required if another sibling field is not empty\n */\nBaseValidator.prototype.requiredIfNotEmptySibling = function (\n field: string,\n errorMessage?: string,\n) {\n return this.setRequiredRule(requiredIfNotEmptyRule, errorMessage, { field, scope: \"sibling\" });\n};\n\n// ==================== REQUIRED: BASED ON MULTIPLE FIELDS EMPTY STATE ====================\n\n/**\n * Value is required if ALL specified fields are empty\n */\nBaseValidator.prototype.requiredIfAllEmpty = function (fields: string[], errorMessage?: string) {\n return this.setRequiredRule(requiredIfAllEmptyRule, errorMessage, { fields, scope: \"global\" });\n};\n\n/**\n * Value is required if ALL specified sibling fields are empty\n */\nBaseValidator.prototype.requiredIfAllEmptySiblings = function (\n fields: string[],\n errorMessage?: string,\n) {\n return this.setRequiredRule(requiredIfAllEmptyRule, errorMessage, { fields, scope: \"sibling\" });\n};\n\n/**\n * Value is required if ANY of the specified fields is empty\n */\nBaseValidator.prototype.requiredIfAnyEmpty = function (fields: string[], errorMessage?: string) {\n return this.setRequiredRule(requiredIfAnyEmptyRule, errorMessage, { fields, scope: \"global\" });\n};\n\n/**\n * Value is required if ANY of the specified sibling fields is empty\n */\nBaseValidator.prototype.requiredIfAnyEmptySiblings = function (\n fields: string[],\n errorMessage?: string,\n) {\n return this.setRequiredRule(requiredIfAnyEmptyRule, errorMessage, { fields, scope: \"sibling\" });\n};\n\n/**\n * Value is required if ALL specified fields are NOT empty\n */\nBaseValidator.prototype.requiredIfAllNotEmpty = function (fields: string[], errorMessage?: string) {\n return this.setRequiredRule(requiredIfAllNotEmptyRule, errorMessage, { fields, scope: \"global\" });\n};\n\n/**\n * Value is required if ALL specified sibling fields are NOT empty\n */\nBaseValidator.prototype.requiredIfAllNotEmptySiblings = function (\n fields: string[],\n errorMessage?: string,\n) {\n return this.setRequiredRule(requiredIfAllNotEmptyRule, errorMessage, {\n fields,\n scope: \"sibling\",\n });\n};\n\n/**\n * Value is required if ANY of the specified fields is NOT empty\n */\nBaseValidator.prototype.requiredIfAnyNotEmpty = function (fields: string[], errorMessage?: string) {\n return this.setRequiredRule(requiredIfAnyNotEmptyRule, errorMessage, { fields, scope: \"global\" });\n};\n\n/**\n * Value is required if ANY of the specified sibling fields is NOT empty\n */\nBaseValidator.prototype.requiredIfAnyNotEmptySiblings = function (\n fields: string[],\n errorMessage?: string,\n) {\n return this.setRequiredRule(requiredIfAnyNotEmptyRule, errorMessage, {\n fields,\n scope: \"sibling\",\n });\n};\n\n/**\n * Value is required if another field's value is in the given array\n */\nBaseValidator.prototype.requiredIfIn = function (\n field: string,\n values: any[],\n errorMessage?: string,\n) {\n return this.setRequiredRule(requiredIfInRule, errorMessage, { field, values, scope: \"global\" });\n};\n\n/**\n * Value is required if another sibling field's value is in the given array\n */\nBaseValidator.prototype.requiredIfInSibling = function (\n field: string,\n values: any[],\n errorMessage?: string,\n) {\n return this.setRequiredRule(requiredIfInRule, errorMessage, { field, values, scope: \"sibling\" });\n};\n\n/**\n * Value is required if another field's value is NOT in the given array\n */\nBaseValidator.prototype.requiredIfNotIn = function (\n field: string,\n values: any[],\n errorMessage?: string,\n) {\n return this.setRequiredRule(requiredIfNotInRule, errorMessage, {\n field,\n values,\n scope: \"global\",\n });\n};\n\n/**\n * Value is required if another sibling field's value is NOT in the given array\n */\nBaseValidator.prototype.requiredIfNotInSibling = function (\n field: string,\n values: any[],\n errorMessage?: string,\n) {\n return this.setRequiredRule(requiredIfNotInRule, errorMessage, {\n field,\n values,\n scope: \"sibling\",\n });\n};\n\n// ==================== REQUIRED: BASED ON MULTIPLE FIELDS (ALL) ====================\n\n/**\n * Value is required if all specified fields exist\n */\nBaseValidator.prototype.requiredWithAll = function (fields: string[], errorMessage?: string) {\n return this.setRequiredRule(requiredWithAllRule, errorMessage, { fields, scope: \"global\" });\n};\n\n/**\n * Value is required if all specified sibling fields exist\n */\nBaseValidator.prototype.requiredWithAllSiblings = function (\n fields: string[],\n errorMessage?: string,\n) {\n return this.setRequiredRule(requiredWithAllRule, errorMessage, { fields, scope: \"sibling\" });\n};\n\n/**\n * Value is required if all specified fields are missing\n */\nBaseValidator.prototype.requiredWithoutAll = function (fields: string[], errorMessage?: string) {\n return this.setRequiredRule(requiredWithoutAllRule, errorMessage, { fields, scope: \"global\" });\n};\n\n/**\n * Value is required if all specified sibling fields are missing\n */\nBaseValidator.prototype.requiredWithoutAllSiblings = function (\n fields: string[],\n errorMessage?: string,\n) {\n return this.setRequiredRule(requiredWithoutAllRule, errorMessage, { fields, scope: \"sibling\" });\n};\n\n// ==================== REQUIRED: BASED ON MULTIPLE FIELDS (ANY) ====================\n\n/**\n * Value is required if any of the specified fields exists\n */\nBaseValidator.prototype.requiredWithAny = function (fields: string[], errorMessage?: string) {\n return this.setRequiredRule(requiredWithAnyRule, errorMessage, { fields, scope: \"global\" });\n};\n\n/**\n * Value is required if any of the specified sibling fields exists\n */\nBaseValidator.prototype.requiredWithAnySiblings = function (\n fields: string[],\n errorMessage?: string,\n) {\n return this.setRequiredRule(requiredWithAnyRule, errorMessage, { fields, scope: \"sibling\" });\n};\n\n/**\n * Value is required if any of the specified fields is missing\n */\nBaseValidator.prototype.requiredWithoutAny = function (fields: string[], errorMessage?: string) {\n return this.setRequiredRule(requiredWithoutAnyRule, errorMessage, { fields, scope: \"global\" });\n};\n\n/**\n * Value is required if any of the specified sibling fields is missing\n */\nBaseValidator.prototype.requiredWithoutAnySiblings = function (\n fields: string[],\n errorMessage?: string,\n) {\n return this.setRequiredRule(requiredWithoutAnyRule, errorMessage, { fields, scope: \"sibling\" });\n};\n\n// ==================== REQUIRED: BASED ON CUSTOM CALLBACK ====================\n\n/**\n * Make this field required based on a custom callback.\n * Callback receives only SchemaContext — the framework handles empty-value checking.\n */\nBaseValidator.prototype.requiredWhen = function (\n callback: (context: SchemaContext) => boolean | Promise<boolean>,\n errorMessage?: string,\n) {\n return this.setRequiredRule(requiredWhenRule, errorMessage, { callback });\n};\n","import { allowedValuesRule, enumRule, inRule, notAllowedValuesRule } from \"../rules\";\nimport { BaseValidator } from \"./base-validator\";\n\n/**\n * Abstract base validator for primitive-typed fields (string, number, boolean).\n *\n * Provides value-membership rules that are meaningful for any single primitive value\n * but not for complex structures (object, array).\n *\n * Do NOT expose this on the `v` factory — it is an inheritance-only base class.\n *\n * Hierarchy:\n * BaseValidator\n * └── PrimitiveValidator ← enum, in, oneOf, allowsOnly, forbids, notIn\n * ├── StringValidator\n * ├── NumberValidator\n * │ └── FloatValidator\n * ├── BooleanValidator\n * └── ScalarValidator (extends PrimitiveValidator, adds asNumber/asString/accepted/declined)\n *\n * @example\n * class MyValidator extends PrimitiveValidator {\n * // inherits: in(), forbids(), enum(), oneOf(), allowsOnly(), notIn()\n * }\n */\nexport abstract class PrimitiveValidator extends BaseValidator {\n /**\n * Value must be one of the enum's values\n *\n * @example\n * v.string().enum(Direction) // Direction is a TS enum\n */\n public enum(values: any, errorMessage?: string) {\n return this.addRule(enumRule, errorMessage, { enum: Object.values(values) });\n }\n\n /**\n * Value must be one of the given values\n *\n * @example\n * v.string().in([\"admin\", \"user\", \"guest\"])\n * v.number().in([1, 2, 3])\n */\n public in(values: any[], errorMessage?: string) {\n return this.addRule(inRule, errorMessage, { values });\n }\n\n /**\n * Alias for `in()`\n *\n * @example\n * v.string().oneOf([\"active\", \"inactive\"])\n */\n public oneOf(values: any[], errorMessage?: string) {\n return this.in(values, errorMessage);\n }\n\n /**\n * Value must be one of the allowed values (stricter variant)\n *\n * @example\n * v.string().allowsOnly([\"yes\", \"no\"])\n */\n public allowsOnly(values: any[], errorMessage?: string) {\n return this.addRule(allowedValuesRule, errorMessage, { allowedValues: values });\n }\n\n /**\n * Value must NOT be one of the given values\n *\n * @example\n * v.string().forbids([\"banned\", \"blacklisted\"])\n * v.number().forbids([0, -1])\n */\n public forbids(values: any[], errorMessage?: string) {\n return this.addRule(notAllowedValuesRule, errorMessage, { notAllowedValues: values });\n }\n\n /**\n * Alias for `forbids()`\n *\n * @example\n * v.string().notIn([\"OK\", \"NOT OK\"])\n */\n public notIn(values: any[], errorMessage?: string) {\n return this.forbids(values, errorMessage);\n }\n}\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\nconst isAcceptedValue = (value: any) => {\r\n return [\"1\", \"true\", \"yes\", \"y\", \"on\", 1, true, \"Yes\", \"Y\", \"On\"].includes(value);\r\n};\r\n\r\n/**\r\n * Validate value as accepted if it equals:\r\n * 1 | \"1\" | true | \"true\" | \"yes\" | \"y\" | \"on\"\r\n */\r\nexport const acceptedRule: SchemaRule = {\r\n name: \"accepted\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n description:\r\n \"The value must be accepted if it equals: 1 | '1' | true | 'true' | 'yes' | 'y' | 'on' | 1 | true | 'Yes' | 'Y' | 'On'\",\r\n async validate(value: any, context) {\r\n if (isAcceptedValue(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Accepted value if another field's value equals to a specific value\r\n */\r\nexport const acceptedIfRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"acceptedIf\",\r\n description: \"The field must be accepted if :field's value equals to :value\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n if (fieldValue !== expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is not equal to the given value\r\n */\r\nexport const acceptedUnlessRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"acceptedUnless\",\r\n description: \"The field must be accepted if :field's value is not equal to :value\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n if (fieldValue === expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is required\r\n */\r\nexport const acceptedIfRequiredRule: SchemaRule<{ field: string }> = {\r\n name: \"acceptedIfRequired\",\r\n description: \"The field must be accepted if :field is required\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is present\r\n */\r\nexport const acceptedIfPresentRule: SchemaRule<{ field: string }> = {\r\n name: \"acceptedIfPresent\",\r\n description: \"The field must be accepted if :field is present\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue === undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is missing\r\n */\r\nexport const acceptedWithoutRule: SchemaRule<{ field: string }> = {\r\n name: \"acceptedWithout\",\r\n description: \"The field must be accepted if :field is missing\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue !== undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\nconst isDeclinedValue = (value: any) => {\r\n return [\"0\", \"false\", \"no\", \"n\", \"off\", 0, false, \"No\", \"N\", \"Off\"].includes(value);\r\n};\r\n\r\n/**\r\n * Validate value as declined if it equals:\r\n * 0 | \"0\" | false | \"false\" | \"no\" | \"n\" | \"off\" | 0 | false | \"No\" | \"N\" | \"Off\"\r\n */\r\nexport const declinedRule: SchemaRule = {\r\n name: \"declined\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n description:\r\n \"The value must be declined if it equals: 0 | '0' | false | 'false' | 'no' | 'n' | 'off' | 0 | false | 'No' | 'N' | 'Off'\",\r\n async validate(value: any, context) {\r\n if (isDeclinedValue(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Declined value if another field's value equals to a specific value\r\n */\r\nexport const declinedIfRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"declinedIf\",\r\n description: \"The field must be declined if :field's value equals to :value\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n if (fieldValue !== expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is not equal to the given value\r\n */\r\nexport const declinedUnlessRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"declinedUnless\",\r\n description: \"The field must be declined if :field's value is not equal to :value\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n if (fieldValue === expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is required\r\n */\r\nexport const declinedIfRequiredRule: SchemaRule<{ field: string }> = {\r\n name: \"declinedIfRequired\",\r\n description: \"The field must be declined if :field is required\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is present\r\n */\r\nexport const declinedIfPresentRule: SchemaRule<{ field: string }> = {\r\n name: \"declinedIfPresent\",\r\n description: \"The field must be declined if :field is present\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue === undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is missing\r\n */\r\nexport const declinedWithoutRule: SchemaRule<{ field: string }> = {\r\n name: \"declinedWithout\",\r\n description: \"The field must be declined if :field is missing\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue !== undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import {\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\";\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 // ==================== Accepted ====================\n\n /** Value must be accepted (true, \"yes\", 1, \"on\", etc.) */\n public accepted(errorMessage?: string) {\n return this.addRule(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.addRule(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.addRule(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.addRule(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.addRule(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.addRule(acceptedWithoutRule, errorMessage, { field });\n }\n\n // ==================== Declined ====================\n\n /** Value must be declined (false, \"no\", 0, \"off\", etc.) */\n public declined(errorMessage?: string) {\n return this.addRule(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.addRule(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.addRule(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.addRule(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.addRule(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.addRule(declinedWithoutRule, errorMessage, { field });\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","import type { SchemaContext, ValidationResult } from \"../types\";\nimport { BaseValidator } from \"./base-validator\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\n\n/**\n * Callback function for computed fields\n * Receives validated & mutated data and full schema context\n */\nexport type ComputedCallback<TResult = any> = (\n data: any,\n context: SchemaContext,\n) => TResult | Promise<TResult>;\n\n/**\n * Computed field validator\n *\n * Computes a value based on other validated fields in the schema.\n * The computed value is persisted and can optionally be validated.\n *\n * @example\n * ```ts\n * // Basic computed field\n * const schema = v.object({\n * title: v.string().required(),\n * slug: v.computed(data => slugify(data.title)),\n * });\n *\n * // With result validation\n * const schema = v.object({\n * title: v.string().required(),\n * slug: v.computed(\n * data => slugify(data.title),\n * v.string().minLength(3)\n * ),\n * });\n *\n * // Async computation\n * const schema = v.object({\n * image: v.string().url(),\n * thumbnail: v.computed(async data => {\n * return await generateThumbnail(data.image);\n * }),\n * });\n * ```\n */\nexport class ComputedValidator<TResult = any> extends BaseValidator {\n /**\n * Create a new computed field validator\n *\n * @param callback - Function to compute the value from validated data\n * @param resultValidator - Optional validator to validate the computed result\n */\n public constructor(\n protected callback: ComputedCallback<TResult>,\n protected resultValidator?: BaseValidator,\n ) {\n super();\n }\n\n /**\n * Execute the callback and optionally validate the result\n */\n public async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\n try {\n // Execute the callback with validated data\n const result = await this.callback(data, context);\n\n // Optionally validate the computed result\n if (this.resultValidator) {\n const validation = await this.resultValidator.validate(result, context);\n\n if (!validation.isValid) {\n return {\n isValid: false,\n errors: validation.errors,\n data: undefined,\n };\n }\n\n return {\n isValid: true,\n errors: [],\n data: validation.data,\n };\n }\n\n // No validation - return computed result directly\n return {\n isValid: true,\n errors: [],\n data: result,\n };\n } catch (error) {\n // Handle callback execution errors\n return {\n isValid: false,\n errors: [\n {\n type: \"computed\",\n error: error instanceof Error ? error.message : \"Computed field callback failed\",\n input: context.path,\n },\n ],\n data: undefined,\n };\n }\n }\n\n /**\n * Clone this validator with all its configuration\n * Critical for ObjectValidator.clone(), extend(), merge(), etc.\n */\n public override clone(): this {\n const cloned = super.clone();\n\n // Copy ComputedValidator-specific properties\n cloned.callback = this.callback; // Functions are safe to copy by reference\n cloned.resultValidator = this.resultValidator?.clone(); // Deep clone validator\n\n return cloned;\n }\n\n /**\n * Computed fields don't have a specific type to match\n */\n public matchesType(value: any): boolean {\n return true; // Computed fields accept any input (they generate their own value)\n }\n\n /**\n * @inheritdoc\n *\n * Computed fields are server-side runtime values — they have no input schema\n * and cannot be represented in JSON Schema. Calling this method is always a\n * programming error.\n *\n * @throws Error Always throws — computed/managed fields have no JSON Schema representation.\n */\n public override toJsonSchema(_target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n throw new Error(\n `[Seal] toJsonSchema() is not supported on ComputedValidator / ManagedValidator. ` +\n `Computed fields are runtime-only and have no input JSON Schema representation. ` +\n `ObjectValidator.toJsonSchema() automatically skips computed fields — ` +\n `do not call toJsonSchema() on a computed validator directly.`,\n );\n }\n}\n","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 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","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.values = values;\n this.addMutableRule(literalRule, errorMessage, { values });\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","import { isPlainObject } from \"@mongez/supportive-is\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport { applyNullable, wrapNullableStrict } from \"../standard-schema/json-schema\";\nimport type { SchemaContext, ValidationResult } from \"../types\";\nimport { BaseValidator } from \"./base-validator\";\nimport { LiteralValidator } from \"./literal-validator\";\nimport { ObjectValidator } from \"./object-validator\";\n\n/**\n * Discriminated union validator — routes payloads by a shared discriminator field.\n *\n * Plain `v.union()` falls back to `matchesType()` to pick a branch, which is\n * coarse for object-vs-object unions (every branch matches \"is plain object\").\n * Discriminated union reads a known field's value and routes directly to the\n * matching branch, producing precise errors instead of confused mash from the\n * wrong branch.\n *\n * **Construction-time validation.** Every branch must:\n * - Be an `ObjectValidator`\n * - Declare the discriminator field\n * - Type the discriminator as `v.literal(...)` (single or multi-literal both work)\n * - Not collide with another branch's literal values\n *\n * Misconfigurations throw eagerly so tests catch them at schema-build time.\n *\n * @example\n * ```ts\n * const email = v.object({ type: v.literal(\"email\"), email: v.string().email() });\n * const sms = v.object({ type: v.literal(\"sms\"), phone: v.string() });\n * const push = v.object({ type: v.literal(\"push\"), deviceId: v.string() });\n *\n * const notif = v.discriminatedUnion(\"type\", [email, sms, push]);\n *\n * await validate(notif, { type: \"sms\", phone: \"555-1234\" });\n * // → routes to sms branch only; errors (if any) come from sms\n * ```\n *\n * @see `domains/seal/plans/2026-05-12-discriminated-union.md`\n */\nexport class DiscriminatedUnionValidator<\n K extends string = string,\n Branches extends ReadonlyArray<ObjectValidator<any>> = ReadonlyArray<ObjectValidator<any>>,\n> extends BaseValidator {\n /** Map from discriminator literal value → matching branch validator. */\n private branches: Map<string | number | boolean, ObjectValidator<any>>;\n\n public constructor(\n public discriminator: K,\n public validators: Branches,\n ) {\n super();\n\n this.branches = DiscriminatedUnionValidator.buildBranchMap(discriminator, validators);\n }\n\n /**\n * Walk every branch, pull out the discriminator's literal values, and build\n * the lookup map. Throws on misconfiguration (missing discriminator,\n * non-literal discriminator, duplicate literal value).\n */\n private static buildBranchMap(\n discriminator: string,\n validators: ReadonlyArray<ObjectValidator<any>>,\n ): Map<string | number | boolean, ObjectValidator<any>> {\n const map = new Map<string | number | boolean, ObjectValidator<any>>();\n\n for (const branch of validators) {\n const discriminatorValidator = branch.schema?.[discriminator];\n\n if (!discriminatorValidator) {\n throw new Error(\n `[Seal] discriminatedUnion: branch missing discriminator field \"${discriminator}\"`,\n );\n }\n\n if (!(discriminatorValidator instanceof LiteralValidator)) {\n throw new Error(\n `[Seal] discriminatedUnion: discriminator \"${discriminator}\" must be v.literal(...) on every branch`,\n );\n }\n\n for (const value of discriminatorValidator.values) {\n if (map.has(value)) {\n throw new Error(\n `[Seal] discriminatedUnion: duplicate discriminator value \"${String(value)}\"`,\n );\n }\n map.set(value, branch);\n }\n }\n\n return map;\n }\n\n public override matchesType(value: any): boolean {\n return isPlainObject(value);\n }\n\n public override async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\n if (data === null && this.isNullable) {\n return { isValid: true, errors: [], data: null };\n }\n\n if (!isPlainObject(data)) {\n return {\n isValid: false,\n errors: [\n {\n type: \"discriminatedUnion\",\n error: `Expected object with discriminator field \"${this.discriminator}\"`,\n input: context.key || context.path || \"value\",\n },\n ],\n data: undefined,\n };\n }\n\n const discriminatorValue = data[this.discriminator];\n const branch = this.branches.get(discriminatorValue);\n\n if (!branch) {\n const allowed = [...this.branches.keys()].map((k) => String(k)).join(\", \");\n return {\n isValid: false,\n errors: [\n {\n type: \"discriminatedUnion\",\n error: `Field \"${this.discriminator}\" must be one of: ${allowed}`,\n input: this.discriminator,\n },\n ],\n data: undefined,\n };\n }\n\n return branch.validate(data, context);\n }\n\n public override clone(): this {\n const cloned = super.clone() as any;\n cloned.discriminator = this.discriminator;\n cloned.validators = this.validators.map((v: ObjectValidator<any>) => v.clone());\n cloned.branches = DiscriminatedUnionValidator.buildBranchMap(\n cloned.discriminator,\n cloned.validators,\n );\n return cloned;\n }\n\n /**\n * Emit `oneOf` of branch schemas. Each branch's own `toJsonSchema()` handles\n * its `properties.{discriminator}.const` and the surrounding required/optional\n * structure — we just enumerate.\n *\n * For `openai-strict`: the per-branch ObjectValidator already inflates\n * `required` to include every field; `oneOf` is OpenAI-accepted as long as\n * each branch passes strict rules independently.\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const oneOf = this.validators.map((v) => v.toJsonSchema(target));\n const schema: JsonSchemaResult = { oneOf };\n\n if (this.isNullable) {\n if (target === \"openai-strict\") {\n return wrapNullableStrict(schema);\n }\n applyNullable(schema, target);\n }\n\n return schema;\n }\n}\n","import { absMutator, ceilMutator, floorMutator, roundMutator, toFixedMutator } from \"../mutators\";\r\nimport {\r\n betweenNumbersRule,\r\n evenRule,\r\n greaterThanRule,\r\n lengthRule,\r\n lessThanRule,\r\n maxLengthRule,\r\n maxRule,\r\n minLengthRule,\r\n minRule,\r\n moduloRule,\r\n negativeRule,\r\n numberRule,\r\n oddRule,\r\n positiveRule,\r\n} from \"../rules\";\r\nimport { PrimitiveValidator } from \"./primitive-validator\";\r\nimport { applyNullable, getRuleOptions } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Number validator class - base for Int and Float validators\r\n */\r\nexport class NumberValidator extends PrimitiveValidator {\r\n public constructor(errorMessage?: string) {\r\n super();\r\n this.addMutableRule(numberRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is a number type\r\n */\r\n public matchesType(value: any): boolean {\r\n return typeof value === \"number\" && !isNaN(value);\r\n }\r\n\r\n /**\r\n * Value must be equal or higher than the given number or field\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public min(min: number | string, errorMessage?: string) {\r\n return this.addRule(minRule, errorMessage, { min, scope: \"global\" });\r\n }\r\n\r\n /**\r\n * Value must be equal or less than the given number or field\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public max(max: number | string, errorMessage?: string) {\r\n return this.addRule(maxRule, errorMessage, { max, scope: \"global\" });\r\n }\r\n\r\n /**\r\n * Value must be >= sibling field value\r\n * @category Validation Rule\r\n */\r\n public minSibling(field: string, errorMessage?: string) {\r\n return this.addRule(minRule, errorMessage, { min: field, scope: \"sibling\" });\r\n }\r\n\r\n /**\r\n * Value must be <= sibling field value\r\n * @category Validation Rule\r\n */\r\n public maxSibling(field: string, errorMessage?: string) {\r\n return this.addRule(maxRule, errorMessage, { max: field, scope: \"sibling\" });\r\n }\r\n\r\n /**\r\n * Value must be strictly greater than the given number or field (>)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public greaterThan(value: number | string, errorMessage?: string) {\r\n return this.addRule(greaterThanRule, errorMessage, {\r\n value,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Value must be strictly less than the given number or field (<)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public lessThan(value: number | string, errorMessage?: string) {\r\n return this.addRule(lessThanRule, errorMessage, {\r\n value,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Alias for greaterThan() - shorter syntax\r\n * @category Validation Rule\r\n */\r\n public gt(value: number | string, errorMessage?: string) {\r\n return this.greaterThan(value, errorMessage);\r\n }\r\n\r\n /**\r\n * Alias for lessThan() - shorter syntax\r\n * @category Validation Rule\r\n */\r\n public lt(value: number | string, errorMessage?: string) {\r\n return this.lessThan(value, errorMessage);\r\n }\r\n\r\n /**\r\n * Value must be > sibling field value\r\n * @category Validation Rule\r\n */\r\n public greaterThanSibling(field: string, errorMessage?: string) {\r\n return this.addRule(greaterThanRule, errorMessage, {\r\n value: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Alias for greaterThanSibling() - shorter syntax\r\n * @category Validation Rule\r\n */\r\n public gtSibling(field: string, errorMessage?: string) {\r\n return this.greaterThanSibling(field, errorMessage);\r\n }\r\n\r\n /**\r\n * Value must be < sibling field value\r\n * @category Validation Rule\r\n */\r\n public lessThanSibling(field: string, errorMessage?: string) {\r\n return this.addRule(lessThanRule, errorMessage, {\r\n value: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Alias for lessThanSibling() - shorter syntax\r\n * @category Validation Rule\r\n */\r\n public ltSibling(field: string, errorMessage?: string) {\r\n return this.lessThanSibling(field, errorMessage);\r\n }\r\n\r\n /** Value must be a modulo of the given number */\r\n public modulo(value: number, errorMessage?: string) {\r\n return this.addRule(moduloRule, errorMessage, { value });\r\n }\r\n\r\n /**\r\n * Alias for modulo() - Value must be divisible by the given number\r\n */\r\n public divisibleBy(value: number, errorMessage?: string) {\r\n return this.modulo(value, errorMessage);\r\n }\r\n\r\n /**\r\n * Alias for modulo() - Value must be a multiple of the given number\r\n */\r\n public multipleOf(value: number, errorMessage?: string) {\r\n return this.modulo(value, errorMessage);\r\n }\r\n\r\n /**\r\n * Alias for modulo() - Value must be a multiple of the given number\r\n */\r\n public modulusOf(value: number, errorMessage?: string) {\r\n return this.modulo(value, errorMessage);\r\n }\r\n\r\n /** Accept only numbers higher than 0 */\r\n public positive(errorMessage?: string) {\r\n return this.addRule(positiveRule, errorMessage);\r\n }\r\n\r\n /** Accept only negative numbers */\r\n public negative(errorMessage?: string) {\r\n return this.addRule(negativeRule, errorMessage);\r\n }\r\n\r\n /** Accept only odd numbers */\r\n public odd(errorMessage?: string) {\r\n return this.addRule(oddRule, errorMessage);\r\n }\r\n\r\n /** Accept only even numbers */\r\n public even(errorMessage?: string) {\r\n return this.addRule(evenRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Accept only numbers between the given two numbers or fields (Inclusive)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public between(min: number | string, max: number | string, errorMessage?: string) {\r\n return this.addRule(betweenNumbersRule, errorMessage, {\r\n min,\r\n max,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Value must be between sibling field values\r\n * @category Validation Rule\r\n */\r\n public betweenSibling(minField: string, maxField: string, errorMessage?: string) {\r\n return this.addRule(betweenNumbersRule, errorMessage, {\r\n min: minField,\r\n max: maxField,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n // Enum and value membership methods are inherited from PrimitiveValidator.\r\n\r\n /**\r\n * Value (as a string) must be exactly this many characters.\r\n * Useful for fixed-format numeric codes (e.g. 4-digit PIN).\r\n */\r\n public length(length: number, errorMessage?: string) {\r\n return this.addRule(lengthRule, errorMessage, { length });\r\n }\r\n\r\n /** Value (as string representation) length must be ≥ min */\r\n public minLength(length: number, errorMessage?: string) {\r\n return this.addRule(minLengthRule, errorMessage, { minLength: length });\r\n }\r\n\r\n /** Value (as string representation) length must be ≤ max */\r\n public maxLength(length: number, errorMessage?: string) {\r\n return this.addRule(maxLengthRule, errorMessage, { maxLength: length });\r\n }\r\n\r\n // Mutators\r\n\r\n /**\r\n * Convert value to its absolute value\r\n */\r\n public abs() {\r\n return this.addMutator(absMutator);\r\n }\r\n\r\n /**\r\n * Round value up to the nearest integer\r\n */\r\n public ceil() {\r\n return this.addMutator(ceilMutator);\r\n }\r\n\r\n /**\r\n * Round value down to the nearest integer\r\n */\r\n public floor() {\r\n return this.addMutator(floorMutator);\r\n }\r\n\r\n /**\r\n * Round value to the nearest integer or specified decimals\r\n */\r\n public round(decimals = 0) {\r\n return this.addMutator(roundMutator, { decimals });\r\n }\r\n\r\n /**\r\n * Format number using fixed-point notation\r\n */\r\n public toFixed(decimals = 2) {\r\n return this.addMutator(toFixedMutator, { decimals });\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Returns `{ type: \"number\" }` with numeric constraint keywords.\r\n * IntValidator overrides `type` to `\"integer\"`.\r\n *\r\n * @note Sibling-scoped rules (minSibling, maxSibling, etc.) are not representable\r\n * in JSON Schema and are silently omitted.\r\n *\r\n * @example\r\n * ```ts\r\n * v.number().min(0).max(100).toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"number\", minimum: 0, maximum: 100 }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n return this.buildNumberJsonSchema(\"number\", target);\r\n }\r\n\r\n /**\r\n * Shared logic for number/integer JSON Schema generation.\r\n * Called by NumberValidator.toJsonSchema() (→ type: \"number\")\r\n * and IntValidator.toJsonSchema() (→ type: \"integer\").\r\n */\r\n protected buildNumberJsonSchema(\r\n type: \"number\" | \"integer\",\r\n target: JsonSchemaTarget,\r\n ): JsonSchemaResult {\r\n const schema: JsonSchemaResult = { type };\r\n\r\n // minimum (inclusive)\r\n const minOpts = getRuleOptions(this.rules, \"min\");\r\n if (minOpts?.min !== undefined && typeof minOpts.min === \"number\") {\r\n schema.minimum = minOpts.min;\r\n }\r\n\r\n // maximum (inclusive)\r\n const maxOpts = getRuleOptions(this.rules, \"max\");\r\n if (maxOpts?.max !== undefined && typeof maxOpts.max === \"number\") {\r\n schema.maximum = maxOpts.max;\r\n }\r\n\r\n // between (inclusive range)\r\n const betweenOpts = getRuleOptions(this.rules, \"betweenNumbers\");\r\n if (betweenOpts) {\r\n if (typeof betweenOpts.min === \"number\") schema.minimum = betweenOpts.min;\r\n if (typeof betweenOpts.max === \"number\") schema.maximum = betweenOpts.max;\r\n }\r\n\r\n // greaterThan (>) → exclusiveMinimum\r\n const gtOpts = getRuleOptions(this.rules, \"greaterThan\");\r\n if (gtOpts?.value !== undefined && typeof gtOpts.value === \"number\") {\r\n if (target === \"draft-07\") {\r\n schema.minimum = gtOpts.value;\r\n schema.exclusiveMinimum = true;\r\n } else {\r\n schema.exclusiveMinimum = gtOpts.value;\r\n }\r\n }\r\n\r\n // lessThan (<) → exclusiveMaximum\r\n const ltOpts = getRuleOptions(this.rules, \"lessThan\");\r\n if (ltOpts?.value !== undefined && typeof ltOpts.value === \"number\") {\r\n if (target === \"draft-07\") {\r\n schema.maximum = ltOpts.value;\r\n schema.exclusiveMaximum = true;\r\n } else {\r\n schema.exclusiveMaximum = ltOpts.value;\r\n }\r\n }\r\n\r\n // multipleOf / modulo\r\n const moduloOpts = getRuleOptions(this.rules, \"modulo\");\r\n if (moduloOpts?.value !== undefined && typeof moduloOpts.value === \"number\") {\r\n schema.multipleOf = moduloOpts.value;\r\n }\r\n\r\n // enum (from PrimitiveValidator.in / .enum)\r\n const inOpts = getRuleOptions(this.rules, \"in\");\r\n if (inOpts?.values && Array.isArray(inOpts.values)) {\r\n schema.enum = inOpts.values;\r\n }\r\n\r\n if (this.isNullable) applyNullable(schema, target);\r\n\r\n return schema;\r\n }\r\n}\r\n","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","import { instanceofRule } from \"../rules/common/instanceof\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport { BaseValidator } from \"./base-validator\";\n\n/**\n * InstanceOf validator class\n *\n * Validates that the value is an instance of the given constructor (`value instanceof Ctor`).\n * Useful for File uploads, Buffer/Uint8Array payloads, and custom domain classes —\n * anywhere a runtime class identity is the right contract.\n *\n * Note: `Date` is already covered by `v.date()` with richer date-specific rules;\n * reach for `v.instanceof(Date)` only when you specifically want raw `instanceof`\n * semantics with no normalization.\n *\n * @example\n * v.instanceof(File) // type: File\n * v.instanceof(Buffer) // type: Buffer\n * v.instanceof(MyClass) // type: MyClass\n */\nexport class InstanceOfValidator<T = unknown> extends BaseValidator {\n public ctor: new (...args: any[]) => T;\n\n public constructor(ctor: new (...args: any[]) => T, errorMessage?: string) {\n super();\n this.ctor = ctor;\n this.addMutableRule(instanceofRule, errorMessage, { ctor, name: ctor.name || \"instance\" });\n }\n\n /**\n * Check if value is an instance of the configured constructor\n */\n public matchesType(value: any): boolean {\n return value instanceof this.ctor;\n }\n\n /**\n * Clone the validator, preserving the target constructor.\n *\n * The base `clone()` only copies `BaseValidator` fields, so without this\n * override a cloned `instanceof` validator loses its `ctor` reference and\n * `matchesType()` would throw on the next call.\n */\n public override clone(): this {\n const cloned = super.clone();\n cloned.ctor = this.ctor;\n return cloned;\n }\n\n /**\n * @inheritdoc\n *\n * Class instances are not representable in JSON Schema — returns an empty\n * schema (permissive). Consumers serializing to OpenAPI should attach an\n * appropriate format manually if needed (e.g. `{ type: \"string\", format: \"binary\" }`\n * for `File`).\n */\n public override toJsonSchema(_target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n return {};\n }\n}\n","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","import type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport type { SchemaContext, ValidationResult } from \"../types\";\nimport { BaseValidator } from \"./base-validator\";\n\n/**\n * Lazy validator — defers resolution of the inner validator until validate-time.\n *\n * Solves the chicken-and-egg of self-referencing schemas. JavaScript evaluates\n * an object literal before the `const` binding completes, so this can't work:\n *\n * ```ts\n * const categorySchema = v.object({\n * name: v.string(),\n * children: v.array(categorySchema), // ❌ ReferenceError\n * });\n * ```\n *\n * Wrap the recursive reference in `v.lazy(() => …)` — the thunk isn't invoked\n * during construction, only when `validate()` is called:\n *\n * ```ts\n * type Category = { name: string; children: Category[] };\n *\n * const categorySchema: ObjectValidator<...> = v.object({\n * name: v.string(),\n * children: v.array(v.lazy(() => categorySchema)),\n * });\n *\n * type T = Infer<typeof categorySchema>;\n * // { name: string; children: T[] } ← recursive type\n * ```\n *\n * The thunk is memoized — it's invoked once on the first validate (or\n * `matchesType` / `toJsonSchema`) call and the result is cached. The thunk is\n * expected to return a stable validator; calling it on every validate would be\n * wasteful and could mask bugs where the user accidentally returns a fresh\n * validator each time.\n *\n * **JSON Schema caveat.** v1 uses simple resolve-and-delegate — recursive\n * schemas will infinite-loop in `toJsonSchema()`. If you need JSON Schema for\n * a recursive shape, generate it manually with `$defs` + `$ref` until v2 lands.\n *\n * @see `domains/seal/plans/2026-05-12-lazy-validator.md`\n */\nexport class LazyValidator<T extends BaseValidator = BaseValidator> extends BaseValidator {\n private resolvedValidator: T | undefined;\n\n public constructor(private thunk: () => T) {\n super();\n // Lazy itself defers required handling to the inner validator —\n // mark the wrapper as optional so the required check doesn't fire here.\n this.requiredRule = null;\n this.isOptional = true;\n }\n\n /**\n * Resolve the inner validator. Memoizes the result so subsequent calls\n * don't re-execute the thunk.\n */\n private resolve(): T {\n if (this.resolvedValidator === undefined) {\n this.resolvedValidator = this.thunk();\n }\n\n return this.resolvedValidator;\n }\n\n public override async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\n return this.resolve().validate(data, context);\n }\n\n public override matchesType(value: any): boolean {\n return this.resolve().matchesType(value);\n }\n\n public override clone(): this {\n const cloned = super.clone();\n // Share the thunk reference; reset the memo so the clone resolves\n // independently on its first call (in case the thunk closure resolves\n // differently in a different context — unlikely but cheap insurance).\n cloned.thunk = this.thunk;\n cloned.resolvedValidator = undefined;\n\n return cloned;\n }\n\n /**\n * JSON Schema generation — simple resolve-and-delegate.\n *\n * **Recursive schemas will infinite-loop.** Until v2 adds `$ref` + `$defs`\n * generation, callers needing JSON Schema for recursive shapes must build\n * the schema manually.\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n return this.resolve().toJsonSchema(target);\n }\n}\n","import type { SchemaContext } from \"../types\";\nimport type { BaseValidator } from \"./base-validator\";\nimport { ComputedValidator, type ComputedCallback } from \"./computed-validator\";\n\n/**\n * Callback function for managed fields\n * Receives only schema context (no data dependency)\n */\nexport type ManagedCallback<TResult = any> = (context: SchemaContext) => TResult | Promise<TResult>;\n\n/**\n * Managed field validator\n *\n * The callback is optional - if not provided, the framework can inject the value.\n * @example\n * ```ts\n * // With callback (framework executes it)\n * const schema = v.object({\n * name: v.string(),\n * createdAt: v.managed(() => new Date()),\n * updatedAt: v.managed(() => new Date()),\n * });\n *\n * // Without callback (framework injects value)\n * const schema = v.object({\n * name: v.string(),\n * id: v.managed(() => 1),\n * });\n * ```\n */\nexport class ManagedValidator<TResult = any> extends ComputedValidator<TResult> {\n /**\n * Create a new managed field validator\n *\n * @param callback - Optional function to generate the value\n * @param resultValidator - Optional validator to validate the generated result\n */\n constructor(callback: ManagedCallback<TResult>, resultValidator?: BaseValidator) {\n // Convert ManagedCallback to ComputedCallback\n // Managed callbacks don't receive data, only context\n const computedCallback: ComputedCallback<TResult> = (_data, context) => callback(context);\n\n super(computedCallback, resultValidator);\n }\n}\n","import { isNumeric } from \"@mongez/supportive-is\";\r\nimport { numericMutator } from \"../mutators/number-mutators\";\r\nimport { NumberValidator } from \"./number-validator\";\r\n\r\n/**\r\n * Numeric validator class - base for Int and Float validators either as number or string\r\n */\r\nexport class NumericValidator extends NumberValidator {\r\n /**\r\n * Constructor\r\n */\r\n public constructor(errorMessage?: string) {\r\n super(errorMessage);\r\n this.addMutableMutator(numericMutator);\r\n }\r\n\r\n /**\r\n * Check if value is a numeric type\r\n */\r\n public matchesType(value: any): boolean {\r\n return isNumeric(value);\r\n }\r\n}\r\n","import { except } from \"@mongez/reinforcements\";\nimport { isPlainObject } from \"@mongez/supportive-is\";\nimport { setKeyPath } from \"../helpers\";\nimport { objectTrimMutator, stripUnknownMutator } from \"../mutators\";\nimport { objectRule, unknownKeyRule } from \"../rules\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport { applyNullable, wrapNullableStrict } from \"../standard-schema/json-schema\";\nimport type { Schema, SchemaContext, ValidationResult } from \"../types\";\nimport type {\n InferInputObjectShape,\n InferOutputObjectShape,\n} from \"../types/inference-types\";\nimport { BaseValidator } from \"./base-validator\";\nimport { ComputedValidator } from \"./computed-validator\";\n\n/**\n * Object validator class with generic schema type for proper type inference.\n *\n * Threads two distinct inferred shapes into `BaseValidator`'s `TInput`/`TOutput`:\n *\n * - `TInput` = `InferInputObjectShape<TSchema>` — what `~standard.validate()`\n * accepts (caller's pre-validation payload; defaults/catches make\n * keys optional)\n * - `TOutput` = `InferOutputObjectShape<TSchema>` — what `~standard.validate()`\n * returns on success (post-default, post-catch shape; guaranteed\n * keys are required)\n *\n * Both helpers are used directly (not the full `Infer.*` walker) to avoid a\n * recursive class-base evaluation that would otherwise occur when the\n * brand-aware widening tries to inspect the class type.\n */\nexport class ObjectValidator<TSchema extends Schema = Schema> extends BaseValidator<\n InferInputObjectShape<TSchema>,\n InferOutputObjectShape<TSchema>\n> {\n protected shouldAllowUnknown = false;\n protected allowedKeys: string[] = [];\n protected hasUnknownKeyRule = false;\n\n public constructor(\n public schema: TSchema,\n errorMessage?: string,\n ) {\n super();\n this.addMutableRule(objectRule, errorMessage);\n }\n\n /**\n * Check if value is an object type (plain object, not array or date)\n */\n public matchesType(value: any): boolean {\n return isPlainObject(value);\n }\n\n /** Strip unknown keys from the data */\n public stripUnknown() {\n const validator = this.instance;\n return validator.addMutator(stripUnknownMutator, {\n get allowedKeys() {\n return validator.allowedKeys;\n },\n });\n }\n\n /** Add list of allowed keys that could be in the data but not necessarily validated */\n public allow(...keys: string[]) {\n const validator = this.instance;\n validator.allowedKeys.push(...keys);\n return validator;\n }\n\n /** Trim values of the object properties */\n public trim(recursive = true) {\n const validator = this.instance;\n return validator.addMutator(objectTrimMutator, { recursive });\n }\n\n /** Whether to allow unknown properties\n * Please note it will allow only unknown direct children keys, not nested children keys\n */\n public allowUnknown(allow = true) {\n const validator = this.instance;\n validator.shouldAllowUnknown = allow;\n return validator;\n }\n\n /**\n * Create a copy of this object validator with the same configuration\n * Copies schema, rules, mutators, transformers, and object-specific settings\n *\n * @returns A new ObjectValidator instance with copied configuration\n *\n * @example\n * ```ts\n * const baseUser = v.object({ name: v.string() }).allowUnknown();\n * const userCopy = baseUser.clone();\n * // userCopy has the same schema and allowUnknown setting\n * ```\n */\n public override clone(keys?: string[]): this {\n // Get cloned instance with all BaseValidator properties\n const cloned = super.clone();\n\n // Clone schema with deep copy of validators\n const newSchema = {} as TSchema;\n for (const key in this.schema) {\n if (keys && !keys.includes(key)) continue;\n (newSchema as any)[key] = this.schema[key].clone();\n }\n\n cloned.schema = newSchema;\n\n // Add ObjectValidator-specific properties\n cloned.shouldAllowUnknown = this.shouldAllowUnknown;\n cloned.allowedKeys = [...this.allowedKeys];\n // NOTE: hasUnknownKeyRule is intentionally NOT copied.\n // Each clone must add its own unknownKeyRule on first validate()\n // so it holds references to its own schema/allowedKeys, not the original's.\n\n return cloned;\n }\n\n /**\n * Extend this schema with additional fields\n * Clones the current validator and adds new fields to the schema\n * **Keeps original configuration** (allowUnknown, stripUnknown, etc.)\n *\n * If an ObjectValidator is provided, only its schema is used - its configuration is ignored.\n * This is useful for creating reusable field collections that can be added to different schemas.\n *\n * @param schemaOrValidator - Plain schema object or ObjectValidator to extend with\n * @returns A new ObjectValidator with merged schema and original configuration\n *\n * @example\n * ```ts\n * // Extend with plain schema\n * const baseUser = v.object({\n * name: v.string().required(),\n * email: v.string().email().required()\n * }).allowUnknown();\n *\n * const adminUser = baseUser.extend({\n * role: v.string().in(['admin', 'superadmin']).required()\n * });\n * // adminUser has: name, email, role\n * // adminUser keeps: allowUnknown() from base ✅\n *\n * // Extend with ObjectValidator (only schema is used)\n * const auditFields = v.object({\n * createdAt: v.date().required(),\n * updatedAt: v.date().required()\n * }).stripUnknown(); // This config is ignored!\n *\n * const fullUser = baseUser.extend(auditFields);\n * // fullUser has: name, email, createdAt, updatedAt\n * // fullUser keeps: allowUnknown() from base (NOT stripUnknown from auditFields) ✅\n *\n * // Chain multiple extends\n * const complexSchema = baseUser\n * .extend(auditFields)\n * .extend({ metadata: v.object({}) });\n * ```\n */\n public extend<TExtension extends Schema>(\n schemaOrValidator: TExtension | ObjectValidator<TExtension>,\n ): ObjectValidator<TSchema & TExtension> {\n // Clone current validator to preserve original\n const extended = this.clone() as any;\n\n // Extract schema from parameter\n const schemaToAdd =\n schemaOrValidator instanceof ObjectValidator ? schemaOrValidator.schema : schemaOrValidator;\n\n // Merge schemas with cloned validators (later fields override earlier ones)\n for (const key in schemaToAdd) {\n extended.schema[key] = schemaToAdd[key].clone();\n }\n\n return extended as ObjectValidator<TSchema & TExtension>;\n }\n\n /**\n * Merge with another ObjectValidator\n * Clones current validator, merges schemas, and **overrides configuration** with other validator's config\n *\n * Unlike extend(), merge() combines both schemas AND configurations.\n * The other validator's configuration (allowUnknown, stripUnknown, etc.) takes precedence.\n *\n * @param validator - Another ObjectValidator to merge with\n * @returns A new ObjectValidator with merged schema and configuration\n *\n * @example\n * ```ts\n * const baseUser = v.object({\n * name: v.string().required()\n * }).allowUnknown();\n *\n * const timestamps = v.object({\n * createdAt: v.date().required(),\n * updatedAt: v.date().required()\n * }).stripUnknown();\n *\n * const merged = baseUser.merge(timestamps);\n * // merged has: name, createdAt, updatedAt\n * // merged config: stripUnknown() from timestamps (overrides allowUnknown) ✅\n *\n * // Chain multiple merges\n * const full = baseUser.merge(timestamps).merge(softDeleteSchema);\n * ```\n */\n public merge<TMerge extends Schema>(\n validator: ObjectValidator<TMerge>,\n ): ObjectValidator<TSchema & TMerge> {\n // Clone current validator\n const merged = this.clone() as any;\n\n // Merge schemas with cloned validators (later fields override earlier ones)\n for (const key in validator.schema) {\n merged.schema[key] = validator.schema[key].clone();\n }\n\n // Override configuration with other validator's config\n merged.shouldAllowUnknown = validator.shouldAllowUnknown;\n merged.allowedKeys = [...merged.allowedKeys, ...validator.allowedKeys];\n\n // Append rules, mutators, transformers from other validator\n merged.rules.push(...validator.rules);\n merged.mutators.push(...validator.mutators);\n merged.dataTransformers.push(...validator.dataTransformers);\n\n // Merge attributes text (later wins)\n merged.attributesText = {\n ...merged.attributesText,\n ...validator.attributesText,\n };\n\n merged.translatedAttributes = {\n ...merged.translatedAttributes,\n ...validator.translatedAttributes,\n };\n\n return merged as ObjectValidator<TSchema & TMerge>;\n }\n\n /**\n * Create a new schema with only the specified fields\n * Clones the current validator and keeps only the selected fields\n * **Preserves all configuration** (allowUnknown, stripUnknown, etc.)\n *\n * @param keys - Field names to keep in the schema\n * @returns A new ObjectValidator with only the picked fields\n *\n * @example\n * ```ts\n * const fullUser = v.object({\n * id: v.int().required(),\n * name: v.string().required(),\n * email: v.string().email().required(),\n * password: v.string().required(),\n * role: v.string()\n * }).allowUnknown();\n *\n * // For login - only need email and password\n * const loginSchema = fullUser.pick('email', 'password');\n * // loginSchema has: { email, password }\n * // loginSchema keeps: allowUnknown() ✅\n *\n * // For public profile\n * const publicSchema = fullUser.pick('id', 'name', 'role');\n * // publicSchema has: { id, name, role }\n * ```\n */\n public pick<K extends keyof TSchema>(...keys: K[]): ObjectValidator<Pick<TSchema, K>> {\n // Clone current validator\n const picked = this.clone() as any;\n\n // Create new schema with only picked keys\n const newSchema = {} as Pick<TSchema, K>;\n for (const key of keys) {\n if (key in picked.schema) {\n (newSchema as any)[key] = picked.schema[key];\n }\n }\n\n picked.schema = newSchema;\n\n return picked as ObjectValidator<Pick<TSchema, K>>;\n }\n\n /**\n * Mark all or the given schema fields as optional\n */\n public partial<K extends keyof TSchema>(...keys: K[]) {\n const validationSchema = this.clone();\n\n if (keys.length === 0) {\n keys = Object.keys(validationSchema.schema) as K[];\n }\n\n for (const key of keys) {\n validationSchema.schema[key] = validationSchema.schema[key].optional();\n }\n\n return validationSchema;\n }\n\n /**\n * Make the all or the given fields as required\n */\n public requiredFields<K extends keyof TSchema>(...keys: K[]) {\n const validationSchema = this.clone();\n\n if (keys.length === 0) {\n keys = Object.keys(validationSchema.schema) as K[];\n }\n\n for (const key of keys) {\n validationSchema.schema[key] = validationSchema.schema[key].required();\n }\n\n return validationSchema;\n }\n\n /**\n * Create a new schema excluding the specified fields\n * Clones the current validator and removes the specified fields\n * **Preserves all configuration** (allowUnknown, stripUnknown, etc.)\n *\n * @param keys - Field names to exclude from the schema\n * @returns A new ObjectValidator without the excluded fields\n *\n * @example\n * ```ts\n * const fullUser = v.object({\n * id: v.int().required(),\n * name: v.string().required(),\n * email: v.string().email().required(),\n * password: v.string().required(),\n * role: v.string()\n * }).allowUnknown();\n *\n * // For updates - exclude id\n * const updateSchema = fullUser.without('id');\n * // updateSchema has: { name, email, password, role }\n * // updateSchema keeps: allowUnknown() ✅\n *\n * // For public API - exclude sensitive fields\n * const publicSchema = fullUser.without('password', 'role');\n * // publicSchema has: { id, name, email }\n *\n * // Combine with other methods\n * const patchSchema = fullUser.without('id', 'password');\n * // patchSchema has: { name, email, role }\n * ```\n */\n public without<K extends keyof TSchema>(...keys: K[]): ObjectValidator<Omit<TSchema, K>> {\n // Clone current validator\n const filtered = this.clone() as any;\n\n // Create new schema excluding specified keys\n const newSchema = {} as Omit<TSchema, K>;\n for (const key in filtered.schema) {\n if (!keys.includes(key as any)) {\n (newSchema as any)[key] = filtered.schema[key];\n }\n }\n\n filtered.schema = newSchema;\n\n return filtered as ObjectValidator<Omit<TSchema, K>>;\n }\n\n /** Mutate the data */\n public mutate(data: any, context: SchemaContext) {\n if (!isPlainObject(data)) return data;\n return super.mutate({ ...data }, context);\n }\n\n /** Validate the data */\n public async validate(\n data: any,\n context: SchemaContext = { path: \"\" } as SchemaContext,\n ): Promise<ValidationResult> {\n context.schema = this.schema;\n const mutatedData = await this.mutate(data, context);\n\n // Check for unknown properties\n if (this.shouldAllowUnknown === false && !this.hasUnknownKeyRule) {\n this.hasUnknownKeyRule = true;\n const rule = this.addMutableRule(unknownKeyRule, undefined, {\n allowedKeys: this.allowedKeys,\n schema: this.schema,\n });\n\n this.setRuleAttributesList(rule);\n }\n\n const result = await super.validate(mutatedData, context);\n\n if (result.isValid === false) return result;\n if (data === undefined) return result;\n\n // ═══════════════════════════════════════════════════════════\n // PHASE 1: Validate user input fields (skip computed/managed)\n // ═══════════════════════════════════════════════════════════\n const errors: ValidationResult[\"errors\"] = [];\n const validatedData: any = {};\n\n const userInputKeys = Object.keys(this.schema).filter(\n (key) => !this.isComputedValidator(this.schema[key]),\n );\n\n const validationPromises = userInputKeys.map(async (key) => {\n const validator = this.schema[key];\n const value =\n mutatedData?.[key] !== undefined ? mutatedData[key] : validator.getDefaultValue();\n\n const childContext: SchemaContext = {\n ...context,\n parent: mutatedData,\n value,\n key,\n path: setKeyPath(context.path, key),\n };\n\n const childResult = await validator.validate(value, childContext);\n\n // Only include in validated data if not omitted\n if (childResult.data !== undefined && !validator.isOmitted()) {\n validatedData[key] = childResult.data;\n }\n\n if (childResult.isValid === false) {\n errors.push(...childResult.errors);\n }\n });\n\n await Promise.all(validationPromises);\n\n // If Phase 1 failed, return early\n if (errors.length > 0) {\n return {\n isValid: false,\n errors,\n data: undefined,\n };\n }\n\n // ═══════════════════════════════════════════════════════════\n // PHASE 2: Execute computed/managed fields with validated data\n // ═══════════════════════════════════════════════════════════\n const computedFields = this.getComputedFields();\n\n const computedPromises = Object.keys(computedFields).map(async (key) => {\n const validator = computedFields[key];\n\n const childContext: SchemaContext = {\n ...context,\n parent: validatedData,\n value: undefined, // Computed fields don't have input value\n };\n\n // Execute computed callback with validated data\n const childResult = await validator.validate(validatedData, childContext);\n\n // Only include in final data if not omitted\n if (childResult.data !== undefined && !validator.isOmitted()) {\n validatedData[key] = childResult.data;\n }\n\n if (childResult.isValid === false) {\n errors.push(...childResult.errors);\n }\n });\n\n await Promise.all(computedPromises);\n\n // If Phase 2 failed, return early\n if (errors.length > 0) {\n return {\n isValid: false,\n errors,\n data: undefined,\n };\n }\n\n // Remove undefined values\n const cleanedData = removeUndefinedValues(validatedData);\n\n const transformedData = await this.startTransformationPipeline(cleanedData, context);\n\n const output =\n this.shouldAllowUnknown === false\n ? transformedData\n : {\n ...transformedData,\n ...except(mutatedData, Object.keys(this.schema)),\n };\n\n return {\n isValid: true,\n errors: [],\n data: output,\n };\n }\n\n /**\n * Check if a validator is a computed or managed field\n * ManagedValidator extends ComputedValidator, so instanceof catches both\n */\n private isComputedValidator(validator: BaseValidator): boolean {\n return validator instanceof ComputedValidator;\n }\n\n /**\n * Get all computed/managed fields from the schema\n */\n private getComputedFields(): Record<string, ComputedValidator> {\n const computed: Record<string, any> = {};\n\n for (const [key, validator] of Object.entries(this.schema)) {\n if (validator instanceof ComputedValidator) {\n computed[key] = validator;\n }\n }\n\n return computed;\n }\n\n /**\n * @inheritdoc\n *\n * Recursively generates JSON Schema for all input fields in the schema.\n * Computed/managed fields are skipped — they have no input representation.\n *\n * **Standard targets** (`draft-2020-12`, `draft-07`, `openapi-3.0`):\n * - Fields marked `.optional()` are excluded from `required`.\n *\n * **`openai-strict` target** (OpenAI Structured Outputs):\n * - ALL fields appear in `required` — OpenAI rejects schemas with optional fields.\n * - Optional fields are instead expressed as nullable types:\n * `{ type: [\"string\", \"null\"] }` so the model can output `null` for them.\n * - Recursively applies `openai-strict` to all nested objects.\n *\n * @example\n * ```ts\n * v.object({\n * name: v.string().required(),\n * age: v.int().optional(),\n * }).toJsonSchema(\"draft-2020-12\")\n * // → { type: \"object\",\n * // properties: { name: { type: \"string\" }, age: { type: \"integer\" } },\n * // required: [\"name\"], additionalProperties: false }\n *\n * v.object({\n * name: v.string().required(),\n * age: v.int().optional(),\n * }).toJsonSchema(\"openai-strict\")\n * // → { type: \"object\",\n * // properties: { name: { type: \"string\" }, age: { type: [\"integer\", \"null\"] } },\n * // required: [\"name\", \"age\"], ← all fields\n * // additionalProperties: false }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const properties: Record<string, JsonSchemaResult> = {};\n const required: string[] = [];\n const isOpenAIStrict = target === \"openai-strict\";\n\n for (const [key, validator] of Object.entries(this.schema)) {\n // Skip computed/managed — runtime-only, no input schema\n if (validator instanceof ComputedValidator) continue;\n\n let fieldSchema = validator.toJsonSchema(target);\n\n if (isOpenAIStrict) {\n // OpenAI strict: every field must be in required.\n // Optional fields are expressed as nullable rather than absent.\n if (validator.isOptional) {\n fieldSchema = wrapNullableStrict(fieldSchema);\n }\n required.push(key);\n } else {\n // Standard JSON Schema: only non-optional fields go in required\n if (!validator.isOptional) {\n required.push(key);\n }\n }\n\n properties[key] = fieldSchema;\n }\n\n const schema: JsonSchemaResult = { type: \"object\", properties };\n\n if (required.length > 0) schema.required = required;\n if (!this.shouldAllowUnknown) schema.additionalProperties = false;\n if (this.isNullable) applyNullable(schema, target);\n\n return schema;\n }\n}\n\n/** Recursively remove undefined values from an object */\nfunction removeUndefinedValues(obj: any, visited = new WeakMap<object, any>()): any {\n // Handle primitives and null\n if (obj === null) {\n return obj;\n }\n\n // Handle arrays\n if (Array.isArray(obj)) {\n return obj.map((item) => removeUndefinedValues(item, visited));\n }\n\n // Skip non-plain objects (class instances, Dates, Buffers, etc.)\n if (!isPlainObject(obj)) {\n return obj;\n }\n\n // Handle circular references - return already processed result\n if (visited.has(obj)) {\n return visited.get(obj);\n }\n\n // Process plain objects\n const result: any = {};\n visited.set(obj, result); // Mark as processing BEFORE recursion\n\n for (const [key, value] of Object.entries(obj)) {\n if (value !== undefined) {\n result[key] = removeUndefinedValues(value, visited);\n }\n }\n\n return result;\n}\n","import { isPlainObject } from \"@mongez/supportive-is\";\r\nimport { setKeyPath } from \"../helpers\";\r\nimport { objectRule, plainObjectRule } from \"../rules\";\r\nimport type { SchemaContext, ValidationResult } from \"../types\";\r\nimport { BaseValidator } from \"./base-validator\";\r\nimport { applyNullable } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Record validator class - validates objects with dynamic keys and consistent value types\r\n *\r\n * @example\r\n * ```ts\r\n * // Translations object\r\n * v.record(v.string())\r\n * // Valid: { en: \"Hello\", ar: \"مرحبا\", fr: \"Bonjour\" }\r\n *\r\n * // User preferences\r\n * v.record(v.union([v.string(), v.number(), v.boolean()]))\r\n * // Valid: { theme: \"dark\", fontSize: 16, notifications: true }\r\n * ```\r\n */\r\nexport class RecordValidator extends BaseValidator {\r\n public constructor(\r\n public valueValidator: BaseValidator,\r\n errorMessage?: string,\r\n ) {\r\n super();\r\n this.addMutableRule(objectRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Validate it as plain object\r\n */\r\n public plainObject(errorMessage?: string) {\r\n return this.addRule(plainObjectRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is a plain object type\r\n */\r\n public matchesType(value: any): boolean {\r\n return isPlainObject(value);\r\n }\r\n\r\n /**\r\n * Clone the validator\r\n */\r\n public override clone(): this {\r\n const cloned = super.clone();\r\n cloned.valueValidator = this.valueValidator.clone();\r\n return cloned;\r\n }\r\n\r\n /**\r\n * Validate record - iterate all keys and validate each value\r\n *\r\n * Absent input (and absent without `.default()`) propagates as `data: undefined`\r\n * so the parent ObjectValidator can omit the key. Without this, optional record\r\n * fields would silently materialise as `{}` in the validated output.\r\n */\r\n public async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\r\n // Apply default when absent, then mutate. Mirrors BaseValidator's\r\n // `valueForRules = data ?? this.getDefaultValue()` so `.default({...})`\r\n // works on records too.\r\n const valueForRules = data ?? this.getDefaultValue();\r\n const mutatedData = await this.mutate(valueForRules, context);\r\n\r\n const result = await super.validate(data, context);\r\n\r\n if (result.isValid === false) return result;\r\n\r\n // Nothing to iterate for absent (no default) or null (nullable) inputs —\r\n // propagate so the parent ObjectValidator can omit the key.\r\n if (mutatedData === undefined || mutatedData === null) return result;\r\n\r\n // Defensive: type rule (objectRule) should have failed for non-objects.\r\n if (!isPlainObject(mutatedData)) return result;\r\n\r\n const errors: ValidationResult[\"errors\"] = [];\r\n const keys = Object.keys(mutatedData);\r\n\r\n // Validate all values in parallel\r\n const validationPromises = keys.map(async (key) => {\r\n const childContext: SchemaContext = {\r\n ...context,\r\n parent: mutatedData,\r\n value: mutatedData[key],\r\n key,\r\n path: setKeyPath(context.path, key),\r\n };\r\n\r\n const childResult = await this.valueValidator.validate(mutatedData[key], childContext);\r\n\r\n // Update mutated data with validated result\r\n mutatedData[key] = childResult.data;\r\n\r\n // Collect errors from this value\r\n if (childResult.isValid === false) {\r\n errors.push(...childResult.errors);\r\n }\r\n });\r\n\r\n await Promise.all(validationPromises);\r\n\r\n return {\r\n isValid: errors.length === 0,\r\n errors,\r\n data: await this.startTransformationPipeline(mutatedData, context),\r\n };\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Generates `{ type: \"object\", additionalProperties: <valueSchema> }` —\r\n * the standard JSON Schema for a dictionary/map with homogeneous values.\r\n *\r\n * @example\r\n * ```ts\r\n * v.record(v.string()).toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"object\", additionalProperties: { type: \"string\" } }\r\n *\r\n * v.record(v.union([v.string(), v.number()])).toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"object\", additionalProperties: { oneOf: [{ type: \"string\" }, { type: \"number\" }] } }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const schema: JsonSchemaResult = {\r\n type: \"object\",\r\n additionalProperties: this.valueValidator.toJsonSchema(target),\r\n };\r\n\r\n if (this.isNullable) applyNullable(schema, target);\r\n\r\n return schema;\r\n }\r\n}\r\n","import { invalidRule, VALID_RULE } from \"../helpers\";\r\nimport { numberMutator, stringMutator } from \"../mutators\";\r\nimport {\r\n acceptedIfPresentRule,\r\n acceptedIfRequiredRule,\r\n acceptedIfRule,\r\n acceptedRule,\r\n acceptedUnlessRule,\r\n acceptedWithoutRule,\r\n declinedIfPresentRule,\r\n declinedIfRequiredRule,\r\n declinedIfRule,\r\n declinedRule,\r\n declinedUnlessRule,\r\n declinedWithoutRule,\r\n} from \"../rules/scalar\";\r\nimport { PrimitiveValidator } from \"./primitive-validator\";\r\nimport { getRuleOptions } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Scalar validator class\r\n *\r\n * Core validator for scalar values (string, number, boolean).\r\n * Extends PrimitiveValidator (inherits enum/in/oneOf/allowsOnly/forbids/notIn)\r\n * and additionally provides type-coercion mutators and accepted/declined rules.\r\n *\r\n * Database methods (unique, exists, etc.) are injected by the framework\r\n */\r\nexport class ScalarValidator extends PrimitiveValidator {\r\n public constructor(errorMessage?: string) {\r\n super();\r\n this.addMutableRule(\r\n {\r\n name: \"scalar\",\r\n defaultErrorMessage: \"The :input must be a scalar value\",\r\n async validate(value, context) {\r\n if ([\"string\", \"number\", \"boolean\"].includes(typeof value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n },\r\n errorMessage,\r\n );\r\n }\r\n\r\n /**\r\n * Add matches type\r\n */\r\n public matchesType(value: any) {\r\n return typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\";\r\n }\r\n\r\n /**\r\n * Mutate the scalar value to be number\r\n */\r\n public asNumber() {\r\n return this.addMutator(numberMutator);\r\n }\r\n\r\n /**\r\n * Mutate the scalar value to be string\r\n */\r\n public asString() {\r\n return this.addMutator(stringMutator);\r\n }\r\n\r\n /**\r\n * Accepted value\r\n * The value will be valid if it equals 1 | \"1\" | true | \"true\" | \"yes\" | \"y\" | \"on\"\r\n */\r\n public accepted(errorMessage?: string) {\r\n return this.addRule(acceptedRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Accepted value if another field's value equals to a specific value\r\n */\r\n public acceptedIf(field: string, value: any, errorMessage?: string) {\r\n return this.addRule(acceptedIfRule, errorMessage, { field, value });\r\n }\r\n\r\n /**\r\n * Accepted value if another field's value is not equal to the given value\r\n */\r\n public acceptedUnless(field: string, value: any, errorMessage?: string) {\r\n return this.addRule(acceptedUnlessRule, errorMessage, { field, value });\r\n }\r\n\r\n /**\r\n * Accepted value if another field is required\r\n */\r\n public acceptedIfRequired(field: string, errorMessage?: string) {\r\n return this.addRule(acceptedIfRequiredRule, errorMessage, { field });\r\n }\r\n\r\n /**\r\n * Accepted value if another field is present\r\n */\r\n public acceptedIfPresent(field: string, errorMessage?: string) {\r\n return this.addRule(acceptedIfPresentRule, errorMessage, { field });\r\n }\r\n\r\n /**\r\n * Accepted value if another field is missing\r\n */\r\n public acceptedWithout(field: string, errorMessage?: string) {\r\n return this.addRule(acceptedWithoutRule, errorMessage, { field });\r\n }\r\n\r\n /**\r\n * Declined value\r\n * The value will be valid if it equals 0 | \"0\" | false | \"false\" | \"no\" | \"n\" | \"off\"\r\n */\r\n public declined(errorMessage?: string) {\r\n return this.addRule(declinedRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Declined value if another field's value equals to a specific value\r\n */\r\n public declinedIf(field: string, value: any, errorMessage?: string) {\r\n return this.addRule(declinedIfRule, errorMessage, { field, value });\r\n }\r\n\r\n /**\r\n * Declined value if another field's value is not equal to the given value\r\n */\r\n public declinedUnless(field: string, value: any, errorMessage?: string) {\r\n return this.addRule(declinedUnlessRule, errorMessage, { field, value });\r\n }\r\n\r\n /**\r\n * Declined value if another field is required\r\n */\r\n public declinedIfRequired(field: string, errorMessage?: string) {\r\n return this.addRule(declinedIfRequiredRule, errorMessage, { field });\r\n }\r\n\r\n /**\r\n * Declined value if another field is present\r\n */\r\n public declinedIfPresent(field: string, errorMessage?: string) {\r\n return this.addRule(declinedIfPresentRule, errorMessage, { field });\r\n }\r\n\r\n /**\r\n * Declined value if another field is missing\r\n */\r\n public declinedWithout(field: string, errorMessage?: string) {\r\n return this.addRule(declinedWithoutRule, errorMessage, { field });\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * A scalar accepts string | number | boolean. If `.in()` / `.enum()` is used,\r\n * output collapses to a simple `enum` list instead.\r\n *\r\n * @example\r\n * ```ts\r\n * v.scalar().toJsonSchema(\"draft-2020-12\")\r\n * // → { oneOf: [{ type: \"string\" }, { type: \"number\" }, { type: \"boolean\" }] }\r\n *\r\n * v.scalar().in([\"active\", \"inactive\"]).toJsonSchema(\"draft-2020-12\")\r\n * // → { enum: [\"active\", \"inactive\"] }\r\n * ```\r\n */\r\n public override toJsonSchema(_target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n // If a value set is constrained, collapse to enum\r\n const inOpts = getRuleOptions(this.rules, \"in\");\r\n if (inOpts?.values && Array.isArray(inOpts.values)) {\r\n return { enum: inOpts.values };\r\n }\r\n\r\n const enumOpts = getRuleOptions(this.rules, \"enum\");\r\n if (enumOpts?.enum && Array.isArray(enumOpts.enum)) {\r\n return { enum: enumOpts.enum };\r\n }\r\n\r\n return {\r\n oneOf: [\r\n { type: \"string\" },\r\n { type: \"number\" },\r\n { type: \"boolean\" },\r\n ],\r\n };\r\n }\r\n}\n","import {\r\n alphaOnlyMutator,\r\n alphanumericOnlyMutator,\r\n appendMutator,\r\n base64DecodeMutator,\r\n base64EncodeMutator,\r\n camelCaseMutator,\r\n capitalizeMutator,\r\n htmlEscapeMutator,\r\n kebabCaseMutator,\r\n lowercaseMutator,\r\n ltrimMutator,\r\n maskMutator,\r\n padEndMutator,\r\n padStartMutator,\r\n pascalCaseMutator,\r\n prependMutator,\r\n removeNumbersMutator,\r\n removeSpecialCharactersMutator,\r\n repeatMutator,\r\n replaceAllMutator,\r\n replaceMutator,\r\n reverseMutator,\r\n rtrimMutator,\r\n safeHtmlMutator,\r\n slugMutator,\r\n snakeCaseMutator,\r\n stringifyMutator,\r\n titleCaseMutator,\r\n trimMultipleWhitespaceMutator,\r\n trimMutator,\r\n truncateMutator,\r\n unescapeHtmlMutator,\r\n uppercaseMutator,\r\n urlDecodeMutator,\r\n urlEncodeMutator,\r\n} from \"../mutators\";\r\nimport {\r\n alphaNumericRule,\r\n alphaRule,\r\n betweenLengthRule,\r\n colorRule,\r\n containsRule,\r\n cuidRule,\r\n darkColorRule,\r\n emailRule,\r\n endsWithRule,\r\n hexColorRule,\r\n hslColorRule,\r\n ip4Rule,\r\n ip6Rule,\r\n ipRule,\r\n isCreditCardRule,\r\n isNumericRule,\r\n lengthRule,\r\n lightColorRule,\r\n maxLengthRule,\r\n maxWordsRule,\r\n minLengthRule,\r\n minWordsRule,\r\n nanoidRule,\r\n notContainsRule,\r\n patternRule,\r\n rgbColorRule,\r\n rgbaColorRule,\r\n startsWithRule,\r\n stringRule,\r\n strongPasswordRule,\r\n ulidRule,\r\n urlRule,\r\n uuidRule,\r\n withoutWhitespaceRule,\r\n wordsRule,\r\n type UUIDVersion,\r\n} from \"../rules\";\r\nimport { PrimitiveValidator } from \"./primitive-validator\";\r\nimport { applyNullable, getRuleOptions } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * String validator class\r\n */\r\nexport class StringValidator extends PrimitiveValidator {\r\n public constructor(errorMessage?: string) {\r\n super();\r\n this.addMutableRule(stringRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is a string type\r\n */\r\n public matchesType(value: any): boolean {\r\n return typeof value === \"string\";\r\n }\r\n\r\n // ==================== Mutators ====================\r\n\r\n /**\r\n * Stringify the value if not a string\r\n */\r\n public toString() {\r\n return this.addMutator(stringifyMutator);\r\n }\r\n\r\n /** Convert string to uppercase */\r\n public uppercase() {\r\n return this.addMutator(uppercaseMutator);\r\n }\r\n\r\n /** Convert string to lowercase */\r\n public lowercase() {\r\n return this.addMutator(lowercaseMutator);\r\n }\r\n\r\n /** Capitalize only the first letter of the string */\r\n public capitalize() {\r\n return this.addMutator(capitalizeMutator);\r\n }\r\n\r\n /** Capitalize the first letter of each word (Title Case) */\r\n public titleCase() {\r\n return this.addMutator(titleCaseMutator);\r\n }\r\n\r\n /** Convert to camelCase */\r\n public camelCase() {\r\n return this.addMutator(camelCaseMutator);\r\n }\r\n\r\n /** Convert to PascalCase */\r\n public pascalCase() {\r\n return this.addMutator(pascalCaseMutator);\r\n }\r\n\r\n /** Convert to snake_case */\r\n public snakeCase() {\r\n return this.addMutator(snakeCaseMutator);\r\n }\r\n\r\n /** Convert to kebab-case */\r\n public kebabCase() {\r\n return this.addMutator(kebabCaseMutator);\r\n }\r\n\r\n /**\r\n * Trim the given needle from the string\r\n * If no needle is provided, the default is a single space\r\n */\r\n public trim(needle?: string) {\r\n return this.addMutator(trimMutator, { needle });\r\n }\r\n\r\n /** Trim from the left/start */\r\n public ltrim(needle?: string) {\r\n return this.addMutator(ltrimMutator, { needle });\r\n }\r\n\r\n /** Trim from the right/end */\r\n public rtrim(needle?: string) {\r\n return this.addMutator(rtrimMutator, { needle });\r\n }\r\n\r\n /** Trim multiple whitespace into single space */\r\n public trimMultipleWhitespace() {\r\n return this.addMutator(trimMultipleWhitespaceMutator);\r\n }\r\n\r\n /** Pad string from the start to reach target length */\r\n public padStart(length: number, char = \" \") {\r\n return this.addMutator(padStartMutator, { length, char });\r\n }\r\n\r\n /** Pad string from the end to reach target length */\r\n public padEnd(length: number, char = \" \") {\r\n return this.addMutator(padEndMutator, { length, char });\r\n }\r\n\r\n /** Remove HTML tags (safe HTML) */\r\n public safeHtml() {\r\n return this.addMutator(safeHtmlMutator);\r\n }\r\n\r\n /** HTML escape special characters */\r\n public htmlEscape() {\r\n return this.addMutator(htmlEscapeMutator);\r\n }\r\n\r\n /** Unescape HTML entities */\r\n public unescapeHtml() {\r\n return this.addMutator(unescapeHtmlMutator);\r\n }\r\n\r\n /**\r\n * Remove special characters\r\n * This will remove all characters that are not alphanumeric or whitespace\r\n */\r\n public removeSpecialCharacters() {\r\n return this.addMutator(removeSpecialCharactersMutator);\r\n }\r\n\r\n /** Convert to only alphabetic characters */\r\n public toAlpha() {\r\n return this.addMutator(alphaOnlyMutator);\r\n }\r\n\r\n /** Convert to only alphanumeric characters */\r\n public toAlphanumeric() {\r\n return this.addMutator(alphanumericOnlyMutator);\r\n }\r\n\r\n /** Remove all numeric characters */\r\n public removeNumbers() {\r\n return this.addMutator(removeNumbersMutator);\r\n }\r\n\r\n /** URL decode */\r\n public urlDecode() {\r\n return this.addMutator(urlDecodeMutator);\r\n }\r\n\r\n /** URL encode */\r\n public urlEncode() {\r\n return this.addMutator(urlEncodeMutator);\r\n }\r\n\r\n /** Convert to URL-friendly slug */\r\n public slug() {\r\n return this.addMutator(slugMutator);\r\n }\r\n\r\n /** Base64 encode */\r\n public base64Encode() {\r\n return this.addMutator(base64EncodeMutator);\r\n }\r\n\r\n /** Base64 decode */\r\n public base64Decode() {\r\n return this.addMutator(base64DecodeMutator);\r\n }\r\n\r\n /** Replace substring or pattern */\r\n public replace(search: string | RegExp, replace: string) {\r\n return this.addMutator(replaceMutator, { search, replace });\r\n }\r\n\r\n /** Replace all occurrences of substring or pattern */\r\n public replaceAll(search: string | RegExp, replace: string) {\r\n return this.addMutator(replaceAllMutator, { search, replace });\r\n }\r\n\r\n /** Append/suffix text to the end */\r\n public append(suffix: string) {\r\n return this.addMutator(appendMutator, { suffix });\r\n }\r\n\r\n /** Prepend/prefix text to the beginning */\r\n public prepend(prefix: string) {\r\n return this.addMutator(prependMutator, { prefix });\r\n }\r\n\r\n /** Reverse the string */\r\n public reverse() {\r\n return this.addMutator(reverseMutator);\r\n }\r\n\r\n /** Truncate to a maximum length */\r\n public truncate(maxLength: number, suffix = \"...\") {\r\n return this.addMutator(truncateMutator, { maxLength, suffix });\r\n }\r\n\r\n /** Repeat string N times */\r\n public repeat(count: number) {\r\n return this.addMutator(repeatMutator, { count });\r\n }\r\n\r\n /** Mask part of string */\r\n public mask(start: number, end?: number, char = \"*\") {\r\n return this.addMutator(maskMutator, { start, end, char });\r\n }\r\n\r\n // ==================== Validation Rules ====================\r\n\r\n /** Value must be a valid email */\r\n public email(errorMessage?: string) {\r\n return this.addRule(emailRule, errorMessage);\r\n }\r\n\r\n /** Value must be a valid URL */\r\n public url(errorMessage?: string) {\r\n return this.addRule(urlRule, errorMessage);\r\n }\r\n\r\n /** Value can not have whitespace */\r\n public withoutWhitespace(errorMessage?: string) {\r\n return this.addRule(withoutWhitespaceRule, errorMessage);\r\n }\r\n\r\n /** Value must match the given pattern */\r\n public pattern(pattern: RegExp, errorMessage?: string) {\r\n return this.addRule(patternRule, errorMessage, { pattern });\r\n }\r\n\r\n /**\r\n * Value must be a strong password\r\n * Requirements:\r\n * - At least 8 characters\r\n * - At least 1 uppercase letter\r\n * - At least 1 lowercase letter\r\n * - At least 1 number\r\n * - At least 1 special character\r\n */\r\n public strongPassword(minLength?: number, errorMessage?: string) {\r\n return this.addRule(strongPasswordRule, errorMessage, { minLength });\r\n }\r\n\r\n /** Value must be exactly the given number of words */\r\n public words(words: number, errorMessage?: string) {\r\n return this.addRule(wordsRule, errorMessage, { words });\r\n }\r\n\r\n /** Value must be at least the given number of words */\r\n public minWords(words: number, errorMessage?: string) {\r\n return this.addRule(minWordsRule, errorMessage, { minWords: words });\r\n }\r\n\r\n /** Value must be at most the given number of words */\r\n public maxWords(words: number, errorMessage?: string) {\r\n return this.addRule(maxWordsRule, errorMessage, { maxWords: words });\r\n }\r\n\r\n /** Value length must be greater than the given length */\r\n public minLength(length: number, errorMessage?: string) {\r\n return this.addRule(minLengthRule, errorMessage, { minLength: length });\r\n }\r\n\r\n /** @alias minLength */\r\n public min(min: number, errorMessage?: string) {\r\n return this.minLength(min, errorMessage);\r\n }\r\n\r\n /** Value length must be less than the given length */\r\n public maxLength(length: number, errorMessage?: string) {\r\n return this.addRule(maxLengthRule, errorMessage, { maxLength: length });\r\n }\r\n\r\n /** @alias maxLength */\r\n public max(max: number, errorMessage?: string) {\r\n return this.maxLength(max, errorMessage);\r\n }\r\n\r\n /** Value must be of the given length */\r\n public length(length: number, errorMessage?: string) {\r\n return this.addRule(lengthRule, errorMessage, { length });\r\n }\r\n\r\n /**\r\n * String length must be between min and max (inclusive)\r\n *\r\n * @param min - Minimum length (inclusive)\r\n * @param max - Maximum length (inclusive)\r\n *\r\n * @example\r\n * ```ts\r\n * v.string().between(5, 10) // Length: 5 to 10 characters\r\n * v.string().lengthBetween(8, 20) // Same using alias\r\n * ```\r\n *\r\n * @category Validation Rule\r\n */\r\n public lengthBetween(min: number, max: number, errorMessage?: string) {\r\n return this.addRule(betweenLengthRule, errorMessage, {\r\n minLength: min,\r\n maxLength: max,\r\n });\r\n }\r\n\r\n /** Allow only alphabetic characters */\r\n public alpha(errorMessage?: string) {\r\n return this.addRule(alphaRule, errorMessage);\r\n }\r\n\r\n /** Allow only alphanumeric characters */\r\n public alphanumeric(errorMessage?: string) {\r\n return this.addRule(alphaNumericRule, errorMessage);\r\n }\r\n\r\n /** Allow only numeric characters */\r\n public numeric(errorMessage?: string) {\r\n return this.addRule(isNumericRule, errorMessage);\r\n }\r\n\r\n /** Value must starts with the given string */\r\n public startsWith(value: string, errorMessage?: string) {\r\n return this.addRule(startsWithRule, errorMessage, { value });\r\n }\r\n\r\n /** Value must ends with the given string */\r\n public endsWith(value: string, errorMessage?: string) {\r\n return this.addRule(endsWithRule, errorMessage, { value });\r\n }\r\n\r\n /** Value must contain the given string */\r\n public contains(value: string, errorMessage?: string) {\r\n return this.addRule(containsRule, errorMessage, { value });\r\n }\r\n\r\n /** Value must not contain the given string */\r\n public notContains(value: string, errorMessage?: string) {\r\n return this.addRule(notContainsRule, errorMessage, { value });\r\n }\r\n\r\n /** Value must be a valid IP address */\r\n public ip(errorMessage?: string) {\r\n return this.addRule(ipRule, errorMessage);\r\n }\r\n\r\n /** Value must be a valid IPv4 address */\r\n public ip4(errorMessage?: string) {\r\n return this.addRule(ip4Rule, errorMessage);\r\n }\r\n\r\n /** Value must be a valid IPv6 address */\r\n public ip6(errorMessage?: string) {\r\n return this.addRule(ip6Rule, errorMessage);\r\n }\r\n\r\n /** Check if the string matches a credit card number */\r\n public creditCard(errorMessage?: string) {\r\n return this.addRule(isCreditCardRule, errorMessage);\r\n }\r\n\r\n /** Determine if the value is a valid color */\r\n public color(errorMessage?: string) {\r\n return this.addRule(colorRule, errorMessage);\r\n }\r\n\r\n /** Determine if the value is a valid hex color */\r\n public hexColor(errorMessage?: string) {\r\n return this.addRule(hexColorRule, errorMessage);\r\n }\r\n\r\n /** Determine if the value is a valid HSL color */\r\n public hslColor(errorMessage?: string) {\r\n return this.addRule(hslColorRule, errorMessage);\r\n }\r\n\r\n /** Determine if the value is a valid RGB color */\r\n public rgbColor(errorMessage?: string) {\r\n return this.addRule(rgbColorRule, errorMessage);\r\n }\r\n\r\n /** Determine if the value is a valid RGBA color */\r\n public rgbaColor(errorMessage?: string) {\r\n return this.addRule(rgbaColorRule, errorMessage);\r\n }\r\n\r\n /** Determine if the value is a valid light color */\r\n public lightColor(errorMessage?: string) {\r\n return this.addRule(lightColorRule, errorMessage);\r\n }\r\n\r\n /** Determine if the value is a valid dark color */\r\n public darkColor(errorMessage?: string) {\r\n return this.addRule(darkColorRule, errorMessage);\r\n }\r\n\r\n // ==================== ID Format Rules ====================\r\n\r\n /**\r\n * Value must be a valid UUID. Optionally restrict to a specific version.\r\n *\r\n * @example\r\n * v.string().uuid() // any RFC 4122 UUID\r\n * v.string().uuid(4) // only v4 (random)\r\n * v.string().uuid(7) // only v7 (timestamp-ordered)\r\n */\r\n public uuid(version?: UUIDVersion, errorMessage?: string) {\r\n return this.addRule(uuidRule, errorMessage, { version });\r\n }\r\n\r\n /**\r\n * Value must be a valid CUID. Defaults to CUID2; pass `{ version: 1 }` for legacy.\r\n *\r\n * @example\r\n * v.string().cuid() // CUID2\r\n * v.string().cuid({ version: 1 }) // legacy CUID1\r\n */\r\n public cuid(options?: { version?: 1 | 2; errorMessage?: string }) {\r\n const { errorMessage, version } = options ?? {};\r\n return this.addRule(cuidRule, errorMessage, { version });\r\n }\r\n\r\n /** Value must be a valid ULID (26 chars, Crockford base32). */\r\n public ulid(errorMessage?: string) {\r\n return this.addRule(ulidRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Value must be a valid nanoid string. Default length is 21.\r\n *\r\n * @example\r\n * v.string().nanoid() // 21 chars (default)\r\n * v.string().nanoid(10) // 10 chars\r\n */\r\n public nanoid(length?: number, errorMessage?: string) {\r\n return this.addRule(nanoidRule, errorMessage, { length });\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Maps String-specific rule options to JSON Schema keywords.\r\n * Non-representable rules (cross-field, refine, color rules, etc.) are silently omitted.\r\n *\r\n * @example\r\n * ```ts\r\n * v.string().min(2).max(100).email().toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"string\", minLength: 2, maxLength: 100, format: \"email\" }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const schema: JsonSchemaResult = { type: \"string\" };\r\n\r\n // minLength / min\r\n const minOpts = getRuleOptions(this.rules, \"minLength\");\r\n if (minOpts?.minLength !== undefined) schema.minLength = minOpts.minLength;\r\n\r\n // maxLength / max\r\n const maxOpts = getRuleOptions(this.rules, \"maxLength\");\r\n if (maxOpts?.maxLength !== undefined) schema.maxLength = maxOpts.maxLength;\r\n\r\n // betweenLength covers both min and max in one rule\r\n const betweenOpts = getRuleOptions(this.rules, \"betweenLength\");\r\n if (betweenOpts) {\r\n if (betweenOpts.minLength !== undefined) schema.minLength = betweenOpts.minLength;\r\n if (betweenOpts.maxLength !== undefined) schema.maxLength = betweenOpts.maxLength;\r\n }\r\n\r\n // exact length\r\n const lengthOpts = getRuleOptions(this.rules, \"length\");\r\n if (lengthOpts?.length !== undefined) {\r\n schema.minLength = lengthOpts.length;\r\n schema.maxLength = lengthOpts.length;\r\n }\r\n\r\n // pattern (regex)\r\n const patternOpts = getRuleOptions(this.rules, \"pattern\");\r\n if (patternOpts?.pattern instanceof RegExp) {\r\n schema.pattern = patternOpts.pattern.source;\r\n }\r\n\r\n // format hints\r\n if (getRuleOptions(this.rules, \"email\") !== undefined ||\r\n this.rules.some(r => r.name === \"email\")) {\r\n schema.format = \"email\";\r\n } else if (this.rules.some(r => r.name === \"url\")) {\r\n schema.format = \"uri\";\r\n } else if (this.rules.some(r => r.name === \"ip\")) {\r\n schema.format = \"ipv4\";\r\n } else if (this.rules.some(r => r.name === \"ip4\")) {\r\n schema.format = \"ipv4\";\r\n } else if (this.rules.some(r => r.name === \"ip6\")) {\r\n schema.format = \"ipv6\";\r\n } else if (this.rules.some(r => r.name === \"uuid\")) {\r\n schema.format = \"uuid\";\r\n } else if (this.rules.some(r => r.name === \"hexColor\")) {\r\n schema.format = \"color\";\r\n }\r\n\r\n // CUID / ULID / nanoid don't have widely-supported format keywords —\r\n // fall back to pattern so JSON Schema validators still enforce shape.\r\n if (!schema.format) {\r\n const cuidOpts = getRuleOptions(this.rules, \"cuid\");\r\n if (cuidOpts) {\r\n schema.pattern = cuidOpts.version === 1 ? \"^c[a-z0-9]{24,}$\" : \"^[a-z][a-z0-9]{23}$\";\r\n }\r\n if (this.rules.some(r => r.name === \"ulid\")) {\r\n schema.pattern = \"^[0-9A-HJKMNP-TV-Z]{26}$\";\r\n }\r\n const nanoidOpts = getRuleOptions(this.rules, \"nanoid\");\r\n if (nanoidOpts) {\r\n const len = (nanoidOpts.length as number | undefined) ?? 21;\r\n schema.pattern = `^[A-Za-z0-9_-]{${len}}$`;\r\n }\r\n }\r\n\r\n // enum (from PrimitiveValidator.in / .enum)\r\n const inOpts = getRuleOptions(this.rules, \"in\");\r\n if (inOpts?.values && Array.isArray(inOpts.values)) {\r\n schema.enum = inOpts.values;\r\n }\r\n\r\n if (this.isNullable) applyNullable(schema, target);\r\n\r\n return schema;\r\n }\r\n}\r\n","import { setKeyPath } from \"../helpers\";\r\nimport { arrayRule } from \"../rules\";\r\nimport type { SchemaContext, ValidationResult } from \"../types\";\r\nimport { BaseValidator } from \"./base-validator\";\r\nimport { applyNullable } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Tuple validator class - validates fixed-length arrays with position-specific types\r\n *\r\n * @example\r\n * ```ts\r\n * // RGB color tuple\r\n * v.tuple([v.number(), v.number(), v.number()])\r\n * // Valid: [255, 128, 0]\r\n * // Invalid: [255, 128] (too short)\r\n *\r\n * // Mixed types\r\n * v.tuple([v.string(), v.int(), v.boolean()])\r\n * // Valid: [\"John\", 25, true]\r\n * ```\r\n */\r\nexport class TupleValidator extends BaseValidator {\r\n public constructor(\r\n public validators: BaseValidator[],\r\n errorMessage?: string,\r\n ) {\r\n super();\r\n this.addMutableRule(arrayRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is an array type\r\n */\r\n public matchesType(value: any): boolean {\r\n return Array.isArray(value);\r\n }\r\n\r\n /**\r\n * Clone the validator\r\n */\r\n public override clone(): this {\r\n const cloned = super.clone();\r\n cloned.validators = this.validators.map((v) => v.clone());\r\n return cloned;\r\n }\r\n\r\n /**\r\n * Validate tuple - check length then validate each position\r\n *\r\n * Absent input (and absent without `.default()`) propagates as `data: undefined`\r\n * so the parent ObjectValidator can omit the key. Without this, optional tuple\r\n * fields would silently materialise as `[]` in the validated output and then\r\n * fail the length check.\r\n */\r\n public async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\r\n // Apply default when absent, then mutate. Mirrors BaseValidator's\r\n // `valueForRules = data ?? this.getDefaultValue()` so `.default([...])`\r\n // works on tuples too.\r\n const valueForRules = data ?? this.getDefaultValue();\r\n const mutatedData = await this.mutate(valueForRules, context);\r\n\r\n const result = await super.validate(data, context);\r\n\r\n if (result.isValid === false) return result;\r\n\r\n // Nothing to iterate for absent (no default) or null (nullable) inputs —\r\n // propagate so the parent ObjectValidator can omit the key.\r\n if (mutatedData === undefined || mutatedData === null) return result;\r\n\r\n // Defensive: type rule (arrayRule) should have failed for non-arrays.\r\n if (!Array.isArray(mutatedData)) return result;\r\n\r\n const errors: ValidationResult[\"errors\"] = [];\r\n\r\n // Tuple-specific: length validation\r\n if (mutatedData.length !== this.validators.length) {\r\n errors.push({\r\n type: \"tuple\",\r\n input: context.key || \"value\",\r\n error: `Expected exactly ${this.validators.length} items, but got ${mutatedData.length}`,\r\n });\r\n return { isValid: false, errors, data: mutatedData };\r\n }\r\n\r\n // Validate each position with its specific validator in parallel\r\n const validationPromises = this.validators.map(async (validator, index) => {\r\n const childContext: SchemaContext = {\r\n ...context,\r\n parent: mutatedData,\r\n value: mutatedData[index],\r\n key: index.toString(),\r\n path: setKeyPath(context.path, index.toString()),\r\n };\r\n\r\n const childResult = await validator.validate(mutatedData[index], childContext);\r\n\r\n // Update mutated data with validated result\r\n mutatedData[index] = childResult.data;\r\n\r\n // Collect errors from this element\r\n if (childResult.isValid === false) {\r\n errors.push(...childResult.errors);\r\n }\r\n });\r\n\r\n await Promise.all(validationPromises);\r\n\r\n return {\r\n isValid: errors.length === 0,\r\n errors,\r\n data: await this.startTransformationPipeline(mutatedData, context),\r\n };\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Tuple keyword diverges between targets:\r\n * - `draft-2020-12` → `prefixItems` + `items: false` (exact length enforced)\r\n * - `draft-07` → `items` as array + `additionalItems: false`\r\n * - `openapi-3.0` → same as draft-07 (OpenAPI 3.0 is based on draft-07)\r\n *\r\n * @example\r\n * ```ts\r\n * v.tuple([v.string(), v.int(), v.boolean()]).toJsonSchema(\"draft-2020-12\")\r\n * // → {\r\n * // type: \"array\",\r\n * // prefixItems: [{ type: \"string\" }, { type: \"integer\" }, { type: \"boolean\" }],\r\n * // items: false,\r\n * // minItems: 3,\r\n * // maxItems: 3\r\n * // }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const itemSchemas = this.validators.map(v => v.toJsonSchema(target));\r\n const length = this.validators.length;\r\n\r\n const schema: JsonSchemaResult = {\r\n type: \"array\",\r\n minItems: length,\r\n maxItems: length,\r\n };\r\n\r\n if (target === \"draft-2020-12\") {\r\n // prefixItems is the draft-2020-12 keyword for positional tuple items\r\n schema.prefixItems = itemSchemas;\r\n schema.items = false; // no additional items beyond the tuple\r\n } else {\r\n // draft-07 and openapi-3.0: items as array + additionalItems: false\r\n schema.items = itemSchemas;\r\n schema.additionalItems = false;\r\n }\r\n\r\n if (this.isNullable) applyNullable(schema, target);\r\n\r\n return schema;\r\n }\r\n}\r\n","import { unionRule } from \"../rules\";\r\nimport { BaseValidator } from \"./base-validator\";\r\nimport { getRuleOptions } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Union validator class - validates value against multiple validator types\r\n *\r\n * Tries each validator in order until one passes. If a validator's matchesType()\r\n * returns false, it's skipped for optimization. First validator that both matches\r\n * the type and passes validation wins.\r\n *\r\n * @example\r\n * ```ts\r\n * // Accept email or username\r\n * const identifier = v.union([\r\n * v.string().email(),\r\n * v.string().alphanumeric().min(3).max(20)\r\n * ]);\r\n *\r\n * // Accept different types\r\n * const customValue = v.union([\r\n * v.string().required(),\r\n * v.number().required(),\r\n * v.boolean().required(),\r\n * v.file().required()\r\n * ]);\r\n * ```\r\n */\r\nexport class UnionValidator extends BaseValidator {\r\n /**\r\n * Set the validators to try for union validation\r\n *\r\n * @param validators - Array of validators to try\r\n * @param errorMessage - Optional custom error message if all validators fail\r\n * @returns This validator for chaining\r\n *\r\n * @example\r\n * ```ts\r\n * new UnionValidator()\r\n * .union([v.string(), v.number()], 'Must be string or number');\r\n * ```\r\n */\r\n public union(validators: BaseValidator[], errorMessage?: string) {\r\n return this.addRule(unionRule, errorMessage, { validators });\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Generates `{ oneOf: [...] }` by mapping each sub-validator to its JSON Schema.\r\n *\r\n * @example\r\n * ```ts\r\n * v.union([v.string(), v.number()]).toJsonSchema(\"draft-2020-12\")\r\n * // → { oneOf: [{ type: \"string\" }, { type: \"number\" }] }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const opts = getRuleOptions(this.rules, \"union\");\r\n const validators = (opts?.validators ?? []) as BaseValidator[];\r\n\r\n return {\r\n oneOf: validators.map(v => v.toJsonSchema(target)),\r\n };\r\n }\r\n}\r\n","import { SealConfig } from \"../config\";\nimport type { StandardSchemaV1 } from \"../standard-schema/types\";\nimport type { Schema, SchemaContext, ValidationResult } from \"../types\";\nimport type { Infer } from \"../types/inference-types\";\nimport { AnyValidator } from \"../validators/any-validator\";\nimport { ArrayValidator } from \"../validators/array-validator\";\nimport type { BaseValidator } from \"../validators/base-validator\";\nimport { BooleanValidator } from \"../validators/boolean-validator\";\nimport { ComputedValidator } from \"../validators/computed-validator\";\nimport { DateValidator } from \"../validators/date-validator\";\nimport { DiscriminatedUnionValidator } from \"../validators/discriminated-union-validator\";\nimport { FloatValidator } from \"../validators/float-validator\";\nimport { InstanceOfValidator } from \"../validators/instanceof-validator\";\nimport { IntValidator } from \"../validators/int-validator\";\nimport { LazyValidator } from \"../validators/lazy-validator\";\nimport { LiteralValidator } from \"../validators/literal-validator\";\nimport { ManagedValidator } from \"../validators/managed-validator\";\nimport { NumberValidator } from \"../validators/number-validator\";\nimport { NumericValidator } from \"../validators/numeric-validator\";\nimport { ObjectValidator } from \"../validators/object-validator\";\nimport { RecordValidator } from \"../validators/record-validator\";\nimport { ScalarValidator } from \"../validators/scalar-validator\";\nimport { StringValidator } from \"../validators/string-validator\";\nimport { TupleValidator } from \"../validators/tuple-validator\";\nimport { UnionValidator } from \"../validators/union-validator\";\n// BaseValidator prototype augmentations — side-effect imports so the `v`\n// factory always exposes the chain methods (.required, .requiredIf, .sameAs,\n// .present, .forbidden, .when, …) regardless of which entry path loaded it.\n// The package barrel (src/index.ts) loads these via the validators barrel, but\n// importing the factory leaf directly would otherwise yield a half-built `v`.\nimport \"../validators/methods/equality-conditional-methods\";\nimport \"../validators/methods/forbidden-methods\";\nimport \"../validators/methods/present-methods\";\nimport \"../validators/methods/required-methods\";\nimport { validate as validateFunction } from \"./validate\";\n\n/**\n * Seal factory object - creates instances of validators\n *\n * Use 'v' to create validation schemas (seals) for your data\n */\nexport const v: ValidatorV = {\n /** Create an object validator */\n object: <T extends Schema>(schema: T, errorMessage?: string) =>\n new ObjectValidator<T>(schema, errorMessage) as ObjectValidator<T> &\n StandardSchemaV1<Infer<ObjectValidator<T>>>,\n\n /** Create an any validator */\n any: () => new AnyValidator() as AnyValidator & StandardSchemaV1<any>,\n\n /** Create an array validator */\n array: <T extends BaseValidator>(validator: T, errorMessage?: string) =>\n new ArrayValidator(validator, errorMessage) as ArrayValidator & {\n validator: T;\n } & StandardSchemaV1<Array<Infer<T>>>,\n\n /** Create a record validator - object with dynamic keys and consistent value types */\n record: <T extends BaseValidator>(validator?: T, errorMessage?: string) =>\n new RecordValidator(validator || v.any(), errorMessage) as RecordValidator & {\n valueValidator: T;\n } & StandardSchemaV1<Record<string, Infer<T>>>,\n\n /** Create a tuple validator - fixed-length array with position-specific types */\n tuple: <T extends BaseValidator[]>(validators: T, errorMessage?: string) =>\n new TupleValidator(validators, errorMessage) as TupleValidator & {\n validators: T;\n } & StandardSchemaV1<{ [K in keyof T]: Infer<T[K]> }>,\n\n /** Create a date validator */\n date: (errorMessage?: string) =>\n new DateValidator(errorMessage) as DateValidator & StandardSchemaV1<Date>,\n\n /**\n * Create a literal validator — narrows to the union of given literal values\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 */\n literal: <T extends readonly [string | number | boolean, ...(string | number | boolean)[]]>(\n ...values: T\n ) =>\n new LiteralValidator<T>(values) as LiteralValidator<T> & StandardSchemaV1<T[number]>,\n\n /**\n * Create an instanceof validator — value must be `instanceof` the constructor\n *\n * @example\n * v.instanceof(File) // type: File\n * v.instanceof(Buffer) // type: Buffer\n * v.instanceof(MyClass) // type: MyClass\n */\n instanceof: <T>(ctor: new (...args: any[]) => T, errorMessage?: string) =>\n new InstanceOfValidator<T>(ctor, errorMessage) as InstanceOfValidator<T> &\n StandardSchemaV1<T>,\n\n /**\n * Create a lazy validator — defers resolution of the inner validator until\n * validate-time. Use for recursive or forward-referenced schemas.\n *\n * @example\n * type Category = { name: string; children: Category[] };\n *\n * const category: ObjectValidator<...> = v.object({\n * name: v.string(),\n * children: v.array(v.lazy(() => category)),\n * });\n */\n lazy: <T extends BaseValidator>(thunk: () => T) =>\n new LazyValidator(thunk) as LazyValidator<T> & StandardSchemaV1<Infer<T>>,\n\n /** Create a string validator */\n string: (errorMessage?: string) =>\n new StringValidator(errorMessage) as StringValidator & StandardSchemaV1<string>,\n\n /** Create an email validator */\n email: (emailErrorMessage?: string, errorMessage?: string) =>\n new StringValidator(errorMessage).email(emailErrorMessage) as StringValidator &\n StandardSchemaV1<string>,\n\n /**\n * Create an enum validator — preserves the literal union of accepted\n * values in the inferred Standard Schema output.\n *\n * Two input shapes:\n * - Tuple of literals: `v.enum([\"draft\", \"published\"])` →\n * `StandardSchemaV1<\"draft\" | \"published\">`\n * - TypeScript enum object: `v.enum(Status)` →\n * `StandardSchemaV1<Status[keyof Status]>`\n *\n * Implementation is loosely typed; the public `ValidatorV.enum`\n * surface declares the precise overloads.\n */\n enum: ((values: any, errorMessage?: string) =>\n Array.isArray(values)\n ? new StringValidator().oneOf(values, errorMessage)\n : new ScalarValidator().enum(values, errorMessage)) as ValidatorV[\"enum\"],\n\n /** Create a number validator */\n number: (errorMessage?: string) =>\n new NumberValidator(errorMessage) as NumberValidator & StandardSchemaV1<number>,\n\n /** Create a numeric validator */\n numeric: (errorMessage?: string) =>\n new NumericValidator(errorMessage) as NumericValidator & StandardSchemaV1<number>,\n\n /** Create an integer validator */\n int: (errorMessage?: string) =>\n new IntValidator(errorMessage) as IntValidator & StandardSchemaV1<number>,\n\n /** Create a float validator */\n float: (errorMessage?: string) =>\n new FloatValidator(errorMessage) as FloatValidator & StandardSchemaV1<number>,\n\n /** Create a boolean validator */\n boolean: (errorMessage?: string) =>\n new BooleanValidator(errorMessage) as BooleanValidator & StandardSchemaV1<boolean>,\n\n /** Create a scalar validator */\n scalar: (errorMessage?: string) =>\n new ScalarValidator(errorMessage) as ScalarValidator &\n StandardSchemaV1<string | number | boolean>,\n\n /** Create a union validator - validates against multiple types */\n union: <T extends BaseValidator[]>(validators: T, errorMessage?: string) =>\n new UnionValidator().union(validators, errorMessage) as UnionValidator &\n StandardSchemaV1<Infer<T[number]>>,\n\n /**\n * Create a discriminated union — routes payloads by a shared literal\n * discriminator field. Each branch must be a `v.object(...)` with the\n * discriminator typed as `v.literal(...)`.\n *\n * @example\n * const email = v.object({ type: v.literal(\"email\"), email: v.string().email() });\n * const sms = v.object({ type: v.literal(\"sms\"), phone: v.string() });\n * const notif = v.discriminatedUnion(\"type\", [email, sms]);\n * // type T = Infer<typeof notif>;\n * // → { type: \"email\", email: string } | { type: \"sms\", phone: string }\n */\n discriminatedUnion: <\n K extends string,\n Branches extends ReadonlyArray<ObjectValidator<any>>,\n >(\n discriminator: K,\n validators: Branches,\n ) =>\n new DiscriminatedUnionValidator(discriminator, validators) as DiscriminatedUnionValidator<\n K,\n Branches\n > &\n StandardSchemaV1<Infer<Branches[number]>>,\n\n /** Create a computed field validator - derives value from other validated fields */\n computed: <TResult = any>(\n callback: (data: any, context: SchemaContext) => TResult | Promise<TResult>,\n resultValidator?: BaseValidator,\n ) =>\n new ComputedValidator<TResult>(callback, resultValidator) as ComputedValidator<TResult> &\n StandardSchemaV1<TResult>,\n\n /** Create a managed field validator - framework-injected value */\n managed: <TResult = any>(\n callback: (context: SchemaContext) => TResult | Promise<TResult>,\n resultValidator?: BaseValidator,\n ) =>\n new ManagedValidator<TResult>(callback, resultValidator) as ManagedValidator<TResult> &\n StandardSchemaV1<TResult>,\n\n /** Validate data against a schema */\n validate: validateFunction,\n} as unknown as ValidatorV;\n\nexport type ValidateOptions = {\n context?: Record<string, any>;\n} & SealConfig;\n\nexport interface ValidatorV {\n object: <T extends Schema>(\n schema: T,\n errorMessage?: string,\n ) => ObjectValidator<T> & StandardSchemaV1<Infer<ObjectValidator<T>>>;\n any: () => AnyValidator & StandardSchemaV1<any>;\n array: <T extends BaseValidator>(\n validator: T,\n errorMessage?: string,\n ) => ArrayValidator & {\n validator: T;\n } & StandardSchemaV1<Array<Infer<T>>>;\n record: <T extends BaseValidator>(\n validator?: T,\n errorMessage?: string,\n ) => RecordValidator & {\n valueValidator: T;\n } & StandardSchemaV1<Record<string, Infer<T>>>;\n tuple: <T extends BaseValidator[]>(\n validators: T,\n errorMessage?: string,\n ) => TupleValidator & {\n validators: T;\n } & StandardSchemaV1<{ [K in keyof T]: Infer<T[K]> }>;\n date: (errorMessage?: string) => DateValidator & StandardSchemaV1<Date>;\n literal: <T extends readonly [string | number | boolean, ...(string | number | boolean)[]]>(\n ...values: T\n ) => LiteralValidator<T> & StandardSchemaV1<T[number]>;\n instanceof: <T>(\n ctor: new (...args: any[]) => T,\n errorMessage?: string,\n ) => InstanceOfValidator<T> & StandardSchemaV1<T>;\n lazy: <T extends BaseValidator>(\n thunk: () => T,\n ) => LazyValidator<T> & StandardSchemaV1<Infer<T>>;\n string: (errorMessage?: string) => StringValidator & StandardSchemaV1<string>;\n email: (errorMessage?: string) => StringValidator & StandardSchemaV1<string>;\n enum: {\n <const T extends readonly (string | number | boolean)[]>(\n values: T,\n errorMessage?: string,\n ): ScalarValidator & StandardSchemaV1<T[number]>;\n <const T extends Record<string, string | number>>(\n values: T,\n errorMessage?: string,\n ): ScalarValidator & StandardSchemaV1<T[keyof T]>;\n };\n number: (errorMessage?: string) => NumberValidator & StandardSchemaV1<number>;\n numeric: (errorMessage?: string) => NumericValidator & StandardSchemaV1<number>;\n int: (errorMessage?: string) => IntValidator & StandardSchemaV1<number>;\n float: (errorMessage?: string) => FloatValidator & StandardSchemaV1<number>;\n boolean: (errorMessage?: string) => BooleanValidator & StandardSchemaV1<boolean>;\n scalar: (\n errorMessage?: string,\n ) => ScalarValidator & StandardSchemaV1<string | number | boolean>;\n union: <T extends BaseValidator[]>(\n validators: T,\n errorMessage?: string,\n ) => UnionValidator & StandardSchemaV1<Infer<T[number]>>;\n discriminatedUnion: <\n K extends string,\n Branches extends ReadonlyArray<ObjectValidator<any>>,\n >(\n discriminator: K,\n validators: Branches,\n ) => DiscriminatedUnionValidator<K, Branches> & StandardSchemaV1<Infer<Branches[number]>>;\n computed: <TResult = any>(\n callback: (data: any, context: SchemaContext) => TResult | Promise<TResult>,\n resultValidator?: BaseValidator,\n ) => ComputedValidator<TResult> & StandardSchemaV1<TResult>;\n managed: <TResult = any>(\n callback?: (context: SchemaContext) => TResult | Promise<TResult>,\n resultValidator?: BaseValidator,\n ) => ManagedValidator<TResult> & StandardSchemaV1<TResult>;\n validate: <T extends BaseValidator>(\n schema: T,\n data: any,\n options?: ValidateOptions,\n ) => Promise<ValidationResult>;\n}\n","/**\r\n * Seal Plugin System\r\n *\r\n * Allows extending validators with custom functionality via plugins\r\n */\r\n\r\nexport type PluginContext = {\r\n /** Plugin name */\r\n name: string;\r\n /** Plugin version */\r\n version?: string;\r\n};\r\n\r\nexport type SealPlugin = {\r\n /** Plugin metadata */\r\n name: string;\r\n version?: string;\r\n description?: string;\r\n\r\n /**\r\n * Install function - called when plugin is registered\r\n * This is where you inject methods into validators\r\n *\r\n * @example\r\n * ```ts\r\n * install() {\r\n * Object.assign(StringValidator.prototype, {\r\n * slug(this: StringValidator) {\r\n * return this.pattern(/^[a-z0-9-]+$/);\r\n * }\r\n * });\r\n * }\r\n * ```\r\n */\r\n install: (context: PluginContext) => void | Promise<void>;\r\n\r\n /**\r\n * Uninstall the plugin (optional)\r\n * Clean up any injected methods\r\n */\r\n uninstall?: () => void | Promise<void>;\r\n};\r\n\r\n/**\r\n * Registry of installed plugins\r\n */\r\nconst installedPlugins = new Map<string, SealPlugin>();\r\n\r\n/**\r\n * Register a plugin\r\n *\r\n * @example\r\n * ```ts\r\n * const slugPlugin: SealPlugin = {\r\n * name: \"slug\",\r\n * install() {\r\n * Object.assign(StringValidator.prototype, {\r\n * slug(this: StringValidator) {\r\n * return this.pattern(/^[a-z0-9-]+$/);\r\n * }\r\n * });\r\n * }\r\n * };\r\n *\r\n * registerPlugin(slugPlugin);\r\n * ```\r\n */\r\nexport async function registerPlugin(plugin: SealPlugin): Promise<void> {\r\n if (installedPlugins.has(plugin.name)) {\r\n console.warn(`[Seal] Plugin \"${plugin.name}\" is already installed`);\r\n return;\r\n }\r\n\r\n const context: PluginContext = {\r\n name: plugin.name,\r\n version: plugin.version,\r\n };\r\n\r\n // Call install function\r\n await plugin.install(context);\r\n\r\n installedPlugins.set(plugin.name, plugin);\r\n}\r\n\r\n/**\r\n * Unregister a plugin\r\n */\r\nexport async function unregisterPlugin(pluginName: string): Promise<void> {\r\n const plugin = installedPlugins.get(pluginName);\r\n\r\n if (!plugin) {\r\n console.warn(`[Seal] Plugin \"${pluginName}\" is not installed`);\r\n return;\r\n }\r\n\r\n if (plugin.uninstall) {\r\n await plugin.uninstall();\r\n }\r\n\r\n installedPlugins.delete(pluginName);\r\n}\r\n\r\n/**\r\n * Check if a plugin is installed\r\n */\r\nexport function hasPlugin(pluginName: string): boolean {\r\n return installedPlugins.has(pluginName);\r\n}\r\n\r\n/**\r\n * Get list of installed plugins\r\n */\r\nexport function getInstalledPlugins(): SealPlugin[] {\r\n return Array.from(installedPlugins.values());\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,cAAc,QAA0B,QAAgC;CACtF,IAAI,WAAW,eAAe;EAC5B,OAAO,WAAW;EAClB;CACF;CAEA,IAAI,WAAW,mBAAmB,WAAW,iBAAiB;EAC5D,MAAM,WAAW,OAAO;EACxB,OAAO,OAAO,MAAM,QAAQ,QAAQ,IAChC,CAAC,GAAG,UAAU,MAAM,IACpB,CAAC,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,SAAS,OAAO;CAClB;CAGA,MAAM,OAAO,QAAQ,OAAO;CAE5B,iBAAiB,IAAI,OAAO,MAAM,MAAM;AAC1C;;;;AAKA,eAAsB,iBAAiB,YAAmC;CACxE,MAAM,SAAS,iBAAiB,IAAI,UAAU;CAE9C,IAAI,CAAC,QAAQ;EACX,QAAQ,KAAK,kBAAkB,WAAW,mBAAmB;EAC7D;CACF;CAEA,IAAI,OAAO,WACT,MAAM,OAAO,UAAU;CAGzB,iBAAiB,OAAO,UAAU;AACpC;;;;AAKA,SAAgB,UAAU,YAA6B;CACrD,OAAO,iBAAiB,IAAI,UAAU;AACxC;;;;AAKA,SAAgB,sBAAoC;CAClD,OAAO,MAAM,KAAK,iBAAiB,OAAO,CAAC;AAC7C"}
1
+ {"version":3,"file":"index.cjs","names":["defaultRequiredRule","validateFunction"],"sources":["../../../../../@warlock.js/seal/src/standard-schema/json-schema.ts","../../../../../@warlock.js/seal/src/config.ts","../../../../../@warlock.js/seal/src/factory/validate.ts","../../../../../@warlock.js/seal/src/helpers/date-helpers.ts","../../../../../@warlock.js/seal/src/helpers/file.utils.ts","../../../../../@warlock.js/seal/src/helpers/get-field-value.ts","../../../../../@warlock.js/seal/src/helpers/path-helpers.ts","../../../../../@warlock.js/seal/src/helpers/validation-helpers.ts","../../../../../@warlock.js/seal/src/helpers/is-empty-value.ts","../../../../../@warlock.js/seal/src/rules/core/required.ts","../../../../../@warlock.js/seal/src/standard-schema/map-result.ts","../../../../../@warlock.js/seal/src/validators/base-validator.ts","../../../../../@warlock.js/seal/src/validators/any-validator.ts","../../../../../@warlock.js/seal/src/mutators/array-mutators.ts","../../../../../@warlock.js/seal/src/mutators/date-mutators.ts","../../../../../@warlock.js/seal/src/mutators/number-mutators.ts","../../../../../@warlock.js/seal/src/mutators/object-mutators.ts","../../../../../@warlock.js/seal/src/mutators/scalar-mutators.ts","../../../../../@warlock.js/seal/src/mutators/string-mutators.ts","../../../../../@warlock.js/seal/src/rules/core/equal.ts","../../../../../@warlock.js/seal/src/rules/core/forbidden.ts","../../../../../@warlock.js/seal/src/rules/core/union.ts","../../../../../@warlock.js/seal/src/rules/core/when.ts","../../../../../@warlock.js/seal/src/rules/string/alpha.ts","../../../../../@warlock.js/seal/src/rules/string/credit-card.ts","../../../../../@warlock.js/seal/src/rules/string/email.ts","../../../../../@warlock.js/seal/src/rules/string/id-formats.ts","../../../../../@warlock.js/seal/src/rules/string/ip.ts","../../../../../@warlock.js/seal/src/rules/string/matches.ts","../../../../../@warlock.js/seal/src/rules/string/pattern.ts","../../../../../@warlock.js/seal/src/rules/string/string-comparison.ts","../../../../../@warlock.js/seal/src/rules/string/strong-password-rule.ts","../../../../../@warlock.js/seal/src/rules/string/url.ts","../../../../../@warlock.js/seal/src/rules/string/without-whitespace.ts","../../../../../@warlock.js/seal/src/rules/number/number-rules.ts","../../../../../@warlock.js/seal/src/rules/length/length-rules.ts","../../../../../@warlock.js/seal/src/rules/array/array-rules.ts","../../../../../@warlock.js/seal/src/types/date-types.ts","../../../../../@warlock.js/seal/src/rules/date/date.ts","../../../../../@warlock.js/seal/src/rules/date/date-comparison-rules.ts","../../../../../@warlock.js/seal/src/rules/date/date-day-rules.ts","../../../../../@warlock.js/seal/src/rules/date/date-field-comparison-rules.ts","../../../../../@warlock.js/seal/src/rules/date/date-period-rules.ts","../../../../../@warlock.js/seal/src/rules/date/date-relative-rules.ts","../../../../../@warlock.js/seal/src/rules/date/date-special-rules.ts","../../../../../@warlock.js/seal/src/rules/file/dimensions.ts","../../../../../@warlock.js/seal/src/rules/file/file-size.ts","../../../../../@warlock.js/seal/src/rules/color/color-rules.ts","../../../../../@warlock.js/seal/src/rules/conditional/required-if-rules.ts","../../../../../@warlock.js/seal/src/rules/conditional/required-unless-rules.ts","../../../../../@warlock.js/seal/src/rules/conditional/required-when-rule.ts","../../../../../@warlock.js/seal/src/rules/conditional/required-with-rules.ts","../../../../../@warlock.js/seal/src/rules/conditional/required-without-rules.ts","../../../../../@warlock.js/seal/src/rules/conditional/present-if-rules.ts","../../../../../@warlock.js/seal/src/rules/conditional/present-unless-rules.ts","../../../../../@warlock.js/seal/src/rules/conditional/present-with-rules.ts","../../../../../@warlock.js/seal/src/rules/conditional/present-without-rules.ts","../../../../../@warlock.js/seal/src/rules/conditional/forbidden-if-rules.ts","../../../../../@warlock.js/seal/src/rules/common/enum.ts","../../../../../@warlock.js/seal/src/rules/common/equals-field-rules.ts","../../../../../@warlock.js/seal/src/rules/common/instanceof.ts","../../../../../@warlock.js/seal/src/rules/common/literal.ts","../../../../../@warlock.js/seal/src/rules/common/type-rules.ts","../../../../../@warlock.js/seal/src/rules/common/unknown-key.ts","../../../../../@warlock.js/seal/src/validators/array-validator.ts","../../../../../@warlock.js/seal/src/validators/methods/equality-conditional-methods.ts","../../../../../@warlock.js/seal/src/validators/methods/forbidden-methods.ts","../../../../../@warlock.js/seal/src/validators/methods/present-methods.ts","../../../../../@warlock.js/seal/src/validators/methods/required-methods.ts","../../../../../@warlock.js/seal/src/validators/primitive-validator.ts","../../../../../@warlock.js/seal/src/rules/scalar/accepted-rule.ts","../../../../../@warlock.js/seal/src/rules/scalar/declined-rule.ts","../../../../../@warlock.js/seal/src/validators/boolean-validator.ts","../../../../../@warlock.js/seal/src/validators/computed-validator.ts","../../../../../@warlock.js/seal/src/validators/date-validator.ts","../../../../../@warlock.js/seal/src/validators/literal-validator.ts","../../../../../@warlock.js/seal/src/validators/discriminated-union-validator.ts","../../../../../@warlock.js/seal/src/validators/number-validator.ts","../../../../../@warlock.js/seal/src/validators/float-validator.ts","../../../../../@warlock.js/seal/src/validators/instanceof-validator.ts","../../../../../@warlock.js/seal/src/validators/int-validator.ts","../../../../../@warlock.js/seal/src/validators/lazy-validator.ts","../../../../../@warlock.js/seal/src/validators/managed-validator.ts","../../../../../@warlock.js/seal/src/validators/numeric-validator.ts","../../../../../@warlock.js/seal/src/validators/object-validator.ts","../../../../../@warlock.js/seal/src/validators/record-validator.ts","../../../../../@warlock.js/seal/src/validators/scalar-validator.ts","../../../../../@warlock.js/seal/src/validators/string-validator.ts","../../../../../@warlock.js/seal/src/validators/tuple-validator.ts","../../../../../@warlock.js/seal/src/validators/union-validator.ts","../../../../../@warlock.js/seal/src/factory/validators.ts","../../../../../@warlock.js/seal/src/plugins/plugin-system.ts"],"sourcesContent":["import type { StandardJSONSchemaV1 } from \"./types\";\n\n/**\n * Supported JSON Schema generation targets.\n */\nexport type JsonSchemaTarget = StandardJSONSchemaV1.Target;\n\n/**\n * The result shape for a generated JSON Schema.\n */\nexport type JsonSchemaResult = Record<string, unknown>;\n\n/**\n * Apply nullable to a JSON Schema object based on the target dialect.\n *\n * - draft-2020-12 : `type` becomes an array: `[\"string\", \"null\"]`\n * - openai-strict : same as draft-2020-12 (type array form)\n * - draft-07 : wraps in `oneOf: [{ ...schema }, { type: \"null\" }]`\n * - openapi-3.0 : adds `nullable: true` alongside the existing type\n *\n * Mutates the schema in-place.\n *\n * @example\n * ```ts\n * const schema = { type: \"string\" };\n * applyNullable(schema, \"draft-2020-12\");\n * // → { type: [\"string\", \"null\"] }\n * ```\n */\nexport function applyNullable(schema: JsonSchemaResult, target: JsonSchemaTarget): void {\n if (target === \"openapi-3.0\") {\n schema.nullable = true;\n return;\n }\n\n if (target === \"draft-2020-12\" || target === \"openai-strict\") {\n const baseType = schema.type as string | string[] | undefined;\n schema.type = Array.isArray(baseType)\n ? [...baseType, \"null\"]\n : [baseType as string, \"null\"];\n return;\n }\n\n // draft-07: oneOf wrapping\n const copy = { ...schema };\n for (const key of Object.keys(schema)) {\n delete schema[key];\n }\n schema.oneOf = [copy, { type: \"null\" }];\n}\n\n/**\n * Wrap a field schema as nullable for OpenAI strict mode.\n *\n * OpenAI strict requires optional fields to be expressed as a nullable type\n * rather than being omitted from the `required` array. This helper wraps a\n * given schema into its nullable equivalent using the type-array form.\n *\n * Unlike `applyNullable()` (which mutates in-place), this returns a new\n * schema object to avoid side effects when wrapping child schemas.\n *\n * @example\n * ```ts\n * wrapNullableStrict({ type: \"string\", minLength: 3 })\n * // → { type: [\"string\", \"null\"], minLength: 3 }\n *\n * wrapNullableStrict({ type: \"object\", properties: {...} })\n * // → { type: [\"object\", \"null\"], properties: {...} }\n *\n * wrapNullableStrict({ oneOf: [...] })\n * // → { oneOf: [..., { type: \"null\" }] }\n * ```\n */\nexport function wrapNullableStrict(schema: JsonSchemaResult): JsonSchemaResult {\n // If the schema uses oneOf/anyOf (e.g. union), append null to the list\n if (schema.oneOf) {\n return { ...schema, oneOf: [...(schema.oneOf as unknown[]), { type: \"null\" }] };\n }\n\n if (schema.anyOf) {\n return { ...schema, anyOf: [...(schema.anyOf as unknown[]), { type: \"null\" }] };\n }\n\n // If there's no type at all (permissive `{}`), stay permissive\n if (schema.type === undefined) {\n return schema;\n }\n\n // Standard case: wrap type into array with null\n const baseType = schema.type as string | string[];\n return {\n ...schema,\n type: Array.isArray(baseType) ? [...baseType, \"null\"] : [baseType, \"null\"],\n };\n}\n\n/**\n * Find the first rule matching the given name in a rules array,\n * and return its options bag.\n */\nexport function getRuleOptions(\n rules: Array<{ name: string; context: { options: Record<string, unknown> } }>,\n ruleName: string,\n): Record<string, unknown> | undefined {\n const rule = rules.find(r => r.name === ruleName);\n return rule?.context?.options as Record<string, unknown> | undefined;\n}\n","/**\r\n * Seal Configuration\r\n *\r\n * Global configuration for the Seal validation library\r\n */\r\n\r\nimport type { AttributeTranslation, RuleTranslation } from \"./types\";\r\n\r\nexport type TranslateRuleCallback = (\r\n ruleTranslation: RuleTranslation,\r\n) => string;\r\n\r\nexport type TranslateAttributeCallback = (\r\n attributeTranslation: AttributeTranslation,\r\n) => string;\r\n\r\nexport type SealConfig = {\r\n /**\r\n * Translation function for error messages\r\n * Default: returns the key with attributes replaced\r\n */\r\n translateRule?: TranslateRuleCallback;\r\n /**\r\n * Translation function for attribute messages\r\n */\r\n translateAttribute?: TranslateAttributeCallback;\r\n\r\n /**\r\n * Default to first error only in validation\r\n * Default: true\r\n */\r\n firstErrorOnly?: boolean;\r\n};\r\n\r\n/**\r\n * Global Seal configuration\r\n */\r\nconst config: SealConfig = {\r\n firstErrorOnly: true,\r\n};\r\n\r\n/**\r\n * Configure Seal globally\r\n *\r\n * @example\r\n * ```ts\r\n * import { configureSeal } from \"@warlock.js/seal\";\r\n * import { trans } from \"@mongez/localization\";\r\n *\r\n * configureSeal({\r\n * translateRule: (ruleTranslation) => trans(`validation.${ruleTranslation.rule.name}`, ruleTranslation.attributes),\r\n * translateAttribute: (attributeTranslation) => trans(`validation.attributes.${attributeTranslation.rule.name}.${attributeTranslation.attribute}`, attributeTranslation.context.allValues),\r\n * });\r\n * ```\r\n */\r\nexport function configureSeal(options: Partial<SealConfig>): void {\r\n Object.assign(config, options);\r\n}\r\n\r\n/**\r\n * Get current Seal configuration\r\n */\r\nexport function getSealConfig(): SealConfig {\r\n return config;\r\n}\r\n\r\n/**\r\n * Reset configuration to defaults\r\n */\r\nexport function resetSealConfig(): void {\r\n delete config.translateRule;\r\n delete config.translateAttribute;\r\n\r\n config.firstErrorOnly = true;\r\n}\r\n","import { getSealConfig } from \"../config\";\r\nimport type { SchemaContext, ValidationResult } from \"../types\";\r\nimport type { BaseValidator } from \"../validators\";\r\nimport { type ValidateOptions } from \"./validators\";\r\n\r\n/**\r\n * Validate data against a schema\r\n */\r\nexport const validate = async <T extends BaseValidator>(\r\n schema: T,\r\n data: any, // Temporarily use any - will fix type inference\r\n { context: extendedContext, ...configurations }: ValidateOptions = getSealConfig() || {},\r\n): Promise<ValidationResult> => {\r\n const context: SchemaContext = {\r\n allValues: data,\r\n parent: null,\r\n value: data,\r\n key: \"\",\r\n path: \"\",\r\n context: extendedContext,\r\n rootContext: extendedContext,\r\n translateRule(ruleTranslation) {\r\n return configurations.translateRule?.(ruleTranslation) ?? \"\";\r\n },\r\n translateAttribute(attributeTranslation) {\r\n return configurations.translateAttribute?.(attributeTranslation) ?? \"\";\r\n },\r\n configurations,\r\n };\r\n\r\n return await schema.validate(data, context);\r\n};\r\n","/**\r\n * Detect if value is a date value or field name\r\n *\r\n * Date values:\r\n * - Date instance\r\n * - Number (timestamp)\r\n * - String with date separators (- or /)\r\n *\r\n * Field names:\r\n * - Strings without - or /\r\n *\r\n * @param value - Value to check\r\n * @returns true if it's a date value, false if it's a field name\r\n */\r\nexport function isDateValue(value: any): boolean {\r\n if (value instanceof Date) return true;\r\n\r\n const date = new Date(value);\r\n\r\n return !isNaN(date.getTime());\r\n}\r\n","import type { FileSizeOption } from \"../types/file.types\";\n\nexport function resolveFileSize(size: number | FileSizeOption): number {\n if (typeof size === \"number\") {\n return size;\n }\n\n switch (size.unit) {\n case \"B\":\n return size.size;\n case \"KB\":\n return size.size * 1024;\n case \"MB\":\n return size.size * 1024 * 1024;\n case \"GB\":\n return size.size * 1024 * 1024 * 1024;\n }\n}\n\n/**\n * Convert the given size to a human size\n * i.e 2MB, 0.5MB, 120KB, 1.5GB..etc\n */\nexport function humanizeSize(sizeInBits: number): string {\n const units = [\"B\", \"KB\", \"MB\", \"GB\"];\n let size = sizeInBits;\n let unitIndex = 0;\n\n while (size >= 1024 && unitIndex < units.length - 1) {\n size /= 1024;\n unitIndex++;\n }\n\n return `${Number.isInteger(size) ? size : size.toFixed(2)}${units[unitIndex]}`;\n}\n","import { get } from \"@mongez/reinforcements\";\r\nimport type { ContextualSchemaRule, SchemaContext } from \"../types\";\r\n\r\n/**\r\n * Get field value based on scope from rule options\r\n *\r\n * This utility extracts a field value from either the global context or sibling context\r\n * based on the `scope` option in the rule's context.\r\n *\r\n * @param rule - The contextual schema rule containing options with:\r\n * - `field` (or custom fieldKey): The field name to extract\r\n * - `scope` (optional): Either \"global\" (default) or \"sibling\"\r\n * @param context - The schema validation context containing allValues and parent\r\n * @param fieldKey - The key in rule.context.options that contains the field name (defaults to \"field\")\r\n *\r\n * @returns The value of the specified field from the appropriate source\r\n *\r\n * @example\r\n * // In a validation rule with scope support:\r\n * async validate(value: any, context) {\r\n * const otherFieldValue = getFieldValue(this, context);\r\n * // Extracts from context.allValues if scope is \"global\"\r\n * // Extracts from context.parent if scope is \"sibling\"\r\n * }\r\n *\r\n * @example\r\n * // Using a custom field key:\r\n * async validate(value: any, context) {\r\n * const compareValue = getFieldValue(this, context, \"compareField\");\r\n * // Looks for rule.context.options.compareField instead of .field\r\n * }\r\n *\r\n * @remarks\r\n * - **Global scope** (`scope: \"global\"`): Searches the entire input data (context.allValues)\r\n * - **Sibling scope** (`scope: \"sibling\"`): Searches only within the parent object (context.parent)\r\n * - Uses `@mongez/reinforcements.get()` to support nested paths (e.g., \"user.email\")\r\n */\r\nexport function getFieldValue(\r\n rule: ContextualSchemaRule,\r\n context: SchemaContext,\r\n fieldKey = \"field\",\r\n) {\r\n const field = rule.context.options[fieldKey];\r\n const scope = rule.context.options.scope || \"global\";\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n return get(source, field);\r\n}\r\n","/**\r\n * Set the key path for nested validation\r\n */\r\nexport const setKeyPath = (path: string, key: string): string => {\r\n if (!path) return key;\r\n return `${path}.${key}`;\r\n};\r\n","import { getSealConfig } from \"../config\";\nimport type { ContextualSchemaRule, RuleResult, RuleTranslation, SchemaContext } from \"../types\";\n\nexport const VALID_RULE: RuleResult = {\n isValid: true,\n};\n/**\n * Resolve a single attribute value through the full translation priority chain:\n * 1. attributesList[key] — developer direct text override (highest priority)\n * 2. translatedAttributes[key] — developer explicit translation key\n * 3. translator(rawValue) — auto-translate the raw value (fallback)\n *\n * Use this in rule bodies when you need per-item translation\n * (e.g. translating each enum value before joining them).\n *\n * @example\n * // Translate each enum value individually then join\n * const enumList = enumValues\n * .map(v => resolveTranslation(String(v), String(v), this, context))\n * .join(\", \");\n * this.context.translationParams.enumList = enumList;\n */\nexport const resolveTranslation = ({\n key,\n rawValue,\n rule,\n context,\n}: {\n key: string;\n rawValue: any;\n rule: ContextualSchemaRule;\n context: SchemaContext;\n}): string => {\n const translator = getSealConfig().translateAttribute;\n\n // 1. Direct text override wins\n const direct = rule.context.attributesList?.[key];\n if (direct && typeof direct === \"string\") return direct;\n\n if (!translator) return String(rawValue ?? key);\n\n // 2. Explicit translation key\n const transKey = rule.context.translatedAttributes?.[key];\n if (transKey) return translator({ attribute: transKey, context, rule });\n\n // 3. Auto-translate the raw value (fallback)\n return translator({ attribute: String(rawValue ?? key), context, rule });\n};\n\n// Internal alias — invalidRule uses the same function without re-importing config\nconst resolveAttribute = resolveTranslation;\n\nexport const invalidRule = (rule: ContextualSchemaRule, context: SchemaContext): RuleResult => {\n // `input` is always translatable — rules may add more (e.g., field references in sameAs)\n // Rule-defined translatableParams override the default input if the key matches\n const translatableWithInput: Record<string, string> = {\n // Fall back to \"schema\" when validating at the root level (no key)\n input: context.key || \"schema\",\n ...rule.context.translatableParams,\n };\n\n // Resolve all translatable params through the full priority chain\n const resolvedParams = Object.fromEntries(\n Object.entries(translatableWithInput).map(([key, rawValue]) => [\n key,\n resolveAttribute({ key, rawValue, rule, context }),\n ]),\n );\n\n const attributes: RuleTranslation[\"attributes\"] = {\n path: context.path,\n key: context.key,\n value: context.value,\n // Raw placeholders (:enumList, :min, :max, etc.) — no translation\n ...rule.context.translationParams,\n // Translated placeholders (:input, :field, etc.) — override raws if key collides\n ...resolvedParams,\n // Satisfy TypeScript's required field (always present via resolvedParams)\n input: resolvedParams.input,\n };\n\n const rawError =\n rule.context.errorMessage ||\n rule.errorMessage ||\n context.translateRule?.({ rule, context, attributes }) ||\n rule.defaultErrorMessage!;\n\n // Fallback interpolation: replace :placeholder patterns from attributes\n // This kicks in when translateRule is absent or returns \"\" (not configured)\n const error = rawError.replace(/:([a-zA-Z_]+)/g, (match, key) =>\n key in attributes ? String(attributes[key as keyof typeof attributes]) : match,\n );\n\n return {\n isValid: false,\n error,\n input: attributes.input, // use resolved input, not raw context.key (may be \"\")\n path: context.path,\n };\n};\n","import { isEmpty, isObject } from \"@mongez/supportive-is\";\n\nexport function isEmptyValue(value: any) {\n return isEmpty(value) && !isObject(value);\n}\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Required rule - value must be present and not empty\r\n */\r\nexport const requiredRule: SchemaRule = {\r\n name: \"required\",\r\n defaultErrorMessage: \"The :input is required\",\r\n requiresValue: false,\r\n sortOrder: -2,\r\n async validate(value: any, context) {\r\n if (isEmptyValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present rule - key must exist in the data, but value can be anything\r\n * (empty string, null are all valid as long as the key exists)\r\n */\r\nexport const presentRule: SchemaRule = {\r\n name: \"present\",\r\n defaultErrorMessage: \"The :input field is required\",\r\n requiresValue: false,\r\n sortOrder: -2,\r\n async validate(value: any, context) {\r\n if (value === undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import type { ValidationResult } from \"../types\";\nimport type { StandardSchemaV1 } from \"./types\";\n\n/**\n * Maps a Seal ValidationResult to a Standard Schema result shape.\n *\n * Seal error paths are dot-notation strings (e.g. \"address.city\").\n * Standard Schema expects an array of path segments: [{ key: \"address\" }, { key: \"city\" }].\n *\n * @example\n * ```ts\n * const result = await validator.validate(value, context);\n * return mapToStandardResult(result);\n * // Success → { value: <data> }\n * // Failure → { issues: [{ message: \"...\", path: [{ key: \"...\" }] }] }\n * ```\n */\nexport function mapToStandardResult(\n result: ValidationResult,\n): StandardSchemaV1.Result<unknown> {\n if (result.isValid) {\n return { value: result.data };\n }\n\n return {\n issues: result.errors.map(e => ({\n message: e.error,\n path: e.input\n ? e.input.split(\".\").map(key => ({ key }))\n : undefined,\n })),\n };\n}\n","import { clone } from \"@mongez/reinforcements\";\nimport { validate } from \"../factory/validate\";\nimport { VALID_RULE, invalidRule } from \"../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\n | ((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 in attributes) {\n instance.attributesText[key] = attributes[key];\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 in attributes) {\n instance.translatedAttributes[key] = attributes[key];\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\n | ((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 const mutatedData = 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 // 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) && isEmpty) 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","import type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\nimport { applyNullable } from \"../standard-schema/json-schema\";\r\nimport { BaseValidator } from \"./base-validator\";\r\n\r\n/**\r\n * Any validator - accepts any value\r\n */\r\nexport class AnyValidator extends BaseValidator {\r\n /**\r\n * Any validator means any value, so we disable the default required requirement.\r\n */\r\n public override requiredRule = null;\r\n\r\n /**\r\n * Set is optional to be true\r\n */\r\n public override isOptional = true;\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Any validator accepts anything. In JSON Schema, an empty object `{}`\r\n * is the permissive schema that accepts any valid JSON value.\r\n *\r\n * @example\r\n * ```ts\r\n * v.any().toJsonSchema(\"draft-2020-12\")\r\n * // → {}\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const schema: JsonSchemaResult = {};\r\n if (this.isNullable) applyNullable(schema, target);\r\n return schema;\r\n }\r\n}\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { isEmptyValue } from \"../helpers/is-empty-value\";\r\nimport type { Mutator } from \"../types\";\r\n\r\n/** Reverse array order */\r\nexport const flipArrayMutator: Mutator = async (value) => {\r\n return value.reverse();\r\n};\r\n\r\n/** Reverse array order (alias) */\r\nexport const reverseArrayMutator: Mutator = async (value) => {\r\n return value.reverse();\r\n};\r\n\r\n/** Sort array */\r\nexport const sortArrayMutator: Mutator = async (value, context) => {\r\n if (!Array.isArray(value)) return value;\r\n\r\n const sortDirection = context?.options.direction ?? \"asc\";\r\n const sortByKey = context?.options.key ?? null;\r\n\r\n return value.sort((a: any, b: any) => {\r\n if (sortByKey) {\r\n const aValue = get(a, sortByKey);\r\n const bValue = get(b, sortByKey);\r\n\r\n if (sortDirection === \"asc\") {\r\n return aValue - bValue;\r\n }\r\n return bValue - aValue;\r\n }\r\n\r\n if (sortDirection === \"asc\") {\r\n return a - b;\r\n }\r\n return b - a;\r\n });\r\n};\r\n\r\n/** Make array have only unique values */\r\nexport const uniqueArrayMutator: Mutator = async (value) => {\r\n return [...new Set(value)];\r\n};\r\n\r\n/** Remove empty elements from array */\r\nexport const removeEmptyArrayElementsMutator: Mutator = async (value) => {\r\n return value.filter((item: any) => !isEmptyValue(item));\r\n};\r\n","import dayjs from \"dayjs\";\r\nimport type { Mutator } from \"../types\";\r\n\r\n/**\r\n * Convert value to Date object\r\n * Returns Invalid Date if value cannot be converted\r\n */\r\nexport const dateMutator: Mutator = async (value) => {\r\n // Handle null/undefined\r\n if (!value) {\r\n return;\r\n }\r\n\r\n // Already a Date object\r\n if (value instanceof Date) {\r\n return value;\r\n }\r\n\r\n // Try to convert to Date\r\n const date = new Date(value);\r\n\r\n // Return the date (valid or Invalid Date)\r\n // dateRule will validate and fail if invalid\r\n return date;\r\n};\r\n\r\n/** Convert date to ISO string format */\r\nexport const toISOStringMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n return date.toISOString();\r\n};\r\n\r\n/** Convert date to Unix timestamp (milliseconds) */\r\nexport const toTimestampMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n return date.getTime();\r\n};\r\n\r\n/** Convert date to start of day (00:00:00) */\r\nexport const toStartOfDayMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n date.setHours(0, 0, 0, 0);\r\n return date;\r\n};\r\n\r\n/** Convert date to end of day (23:59:59.999) */\r\nexport const toEndOfDayMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n date.setHours(23, 59, 59, 999);\r\n return date;\r\n};\r\n\r\n/** Add or subtract days from date */\r\nexport const addDaysMutator: Mutator = async (value, context) => {\r\n const date = new Date(value);\r\n const days = context?.options.days ?? 0;\r\n date.setDate(date.getDate() + days);\r\n return date;\r\n};\r\n\r\n/** Add or subtract months from date */\r\nexport const addMonthsMutator: Mutator = async (value, context) => {\r\n const date = new Date(value);\r\n const months = context?.options.months ?? 0;\r\n date.setMonth(date.getMonth() + months);\r\n return date;\r\n};\r\n\r\n/** Add or subtract years from date */\r\nexport const addYearsMutator: Mutator = async (value, context) => {\r\n const date = new Date(value);\r\n const years = context?.options.years ?? 0;\r\n date.setFullYear(date.getFullYear() + years);\r\n return date;\r\n};\r\n\r\n/** Add or subtract hours from date */\r\nexport const addHoursMutator: Mutator = async (value, context) => {\r\n const date = new Date(value);\r\n const hours = context?.options.hours ?? 0;\r\n date.setHours(date.getHours() + hours);\r\n return date;\r\n};\r\n\r\n/** Convert date to UTC */\r\nexport const toUTCMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n return new Date(date.toUTCString());\r\n};\r\n\r\n/** Convert date to specific format using dayjs */\r\nexport const toFormatMutator: Mutator = async (value, context) => {\r\n const format = context?.options.format ?? \"YYYY-MM-DD\";\r\n return dayjs(value).format(format);\r\n};\r\n\r\n/** Convert to date only (remove time) */\r\nexport const toDateOnlyMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n return date.toISOString().split(\"T\")[0];\r\n};\r\n\r\n/** Convert to time only (HH:MM:SS) */\r\nexport const toTimeOnlyMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n return date.toTimeString().split(\" \")[0];\r\n};\r\n\r\n/** Set to start of month */\r\nexport const toStartOfMonthMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n date.setDate(1);\r\n date.setHours(0, 0, 0, 0);\r\n return date;\r\n};\r\n\r\n/** Set to end of month */\r\nexport const toEndOfMonthMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n date.setMonth(date.getMonth() + 1);\r\n date.setDate(0);\r\n date.setHours(23, 59, 59, 999);\r\n return date;\r\n};\r\n\r\n/** Set to start of year */\r\nexport const toStartOfYearMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n date.setMonth(0);\r\n date.setDate(1);\r\n date.setHours(0, 0, 0, 0);\r\n return date;\r\n};\r\n\r\n/** Set to end of year */\r\nexport const toEndOfYearMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n date.setMonth(11);\r\n date.setDate(31);\r\n date.setHours(23, 59, 59, 999);\r\n return date;\r\n};\r\n","import { round } from \"@mongez/reinforcements\";\r\nimport { isNumeric } from \"@mongez/supportive-is\";\r\nimport type { Mutator } from \"../types\";\r\n\r\n/** Convert value to number */\r\nexport const numberMutator: Mutator = async (value) => {\r\n if (!value) return value;\r\n return Number(value);\r\n};\r\n\r\n/** Round number to specified decimals */\r\nexport const roundNumberMutator: Mutator = async (value, context) => {\r\n return round(value, context?.options?.decimals ?? 2);\r\n};\r\n\r\n/** Convert to boolean */\r\nexport const booleanMutator: Mutator = async (value) => {\r\n if (value === \"true\") return true;\r\n if (value === \"false\") return false;\r\n return Boolean(value);\r\n};\r\n\r\nexport const numericMutator: Mutator = async (value) => {\r\n if (!isNumeric(value)) return value;\r\n return Number(value);\r\n};\r\n\r\n/** Absolute value mutator */\r\nexport const absMutator: Mutator = async (value) => {\r\n return Math.abs(Number(value));\r\n};\r\n\r\n/** Ceil mutator */\r\nexport const ceilMutator: Mutator = async (value) => {\r\n return Math.ceil(Number(value));\r\n};\r\n\r\n/** Floor mutator */\r\nexport const floorMutator: Mutator = async (value) => {\r\n return Math.floor(Number(value));\r\n};\r\n\r\n/**\r\n * Round mutator\r\n * Supports decimal precision via options.decimals\r\n */\r\nexport const roundMutator: Mutator = async (value, context) => {\r\n const decimals = context?.options?.decimals ?? 0;\r\n // If decimals is 0, use standard Math.round for integers\r\n if (decimals === 0) {\r\n return Math.round(Number(value));\r\n }\r\n // Otherwise use reinforcements round helper for precision\r\n return round(Number(value), decimals);\r\n};\r\n\r\n/** To fixed mutator */\r\nexport const toFixedMutator: Mutator = async (value, context) => {\r\n const decimals = context?.options?.decimals ?? 2;\r\n return Number(value).toFixed(decimals);\r\n};\r\n","import { trim } from \"@mongez/reinforcements\";\r\nimport { isPlainObject } from \"@mongez/supportive-is\";\r\nimport type { Mutator } from \"../types\";\r\n\r\n/** Strip unknown keys from object */\r\nexport const stripUnknownMutator: Mutator = async (value, context) => {\r\n const allowedKeys = [\r\n ...(context?.ctx.schema ? Object.keys(context.ctx.schema) : []),\r\n ...(context?.options.allowedKeys ?? []),\r\n ];\r\n\r\n const result: Record<string, any> = {};\r\n\r\n for (const key in value) {\r\n if (allowedKeys.includes(key)) {\r\n result[key] = value[key];\r\n }\r\n }\r\n\r\n return result;\r\n};\r\n\r\n/** Trim all string values in object */\r\nexport const objectTrimMutator: Mutator = async (value, context) => {\r\n if (!isPlainObject(value)) return value;\r\n\r\n const result: Record<string, any> = {};\r\n const recursive = context?.options.recursive ?? false;\r\n\r\n for (const key in value) {\r\n const item = value[key];\r\n\r\n if (recursive) {\r\n if (Array.isArray(item)) {\r\n result[key] = await Promise.all(\r\n item.map(async (i: any) =>\r\n typeof i === \"string\" ? trim(i) : await objectTrimMutator(i, context),\r\n ),\r\n );\r\n } else if (isPlainObject(item)) {\r\n result[key] = await objectTrimMutator(item, context);\r\n } else {\r\n result[key] = typeof item === \"string\" ? trim(item) : item;\r\n }\r\n } else {\r\n result[key] = typeof item === \"string\" ? trim(item) : item;\r\n }\r\n }\r\n\r\n return result;\r\n};\r\n\r\n/** Parse JSON string */\r\nexport const jsonMutator: Mutator = async (value) => {\r\n try {\r\n return JSON.parse(value);\r\n } catch {\r\n return value;\r\n }\r\n};\r\n","import type { Mutator } from \"../types\";\r\n\r\nexport const stringMutator: Mutator = async (value) => {\r\n if ([undefined, null].includes(value)) {\r\n return value;\r\n }\r\n\r\n return String(value);\r\n};\r\n","import {\r\n capitalize,\r\n ltrim,\r\n readMoreChars,\r\n rtrim,\r\n toCamelCase,\r\n toKebabCase,\r\n toSnakeCase,\r\n toStudlyCase,\r\n trim,\r\n} from \"@mongez/reinforcements\";\r\nimport type { Mutator } from \"../types\";\r\n\r\n/** Convert string to lowercase */\r\nexport const lowercaseMutator: Mutator = async (value) => {\r\n return value?.toString().toLowerCase();\r\n};\r\n\r\n/** Convert string to uppercase */\r\nexport const uppercaseMutator: Mutator = async (value) => {\r\n return value?.toString().toUpperCase();\r\n};\r\n\r\n/** Capitalize only the first letter of the string */\r\nexport const capitalizeMutator: Mutator = async (value) => {\r\n const str = value?.toString();\r\n return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();\r\n};\r\n\r\n/** Capitalize the first letter of each word (Title Case) */\r\nexport const titleCaseMutator: Mutator = async (value) => {\r\n return capitalize(value?.toString());\r\n};\r\n\r\n/** Convert value to string */\r\nexport const stringifyMutator: Mutator = async (value) => {\r\n if (!value && value !== 0) return \"\";\r\n // only convert numbers, boolean and strings\r\n\r\n // Handle strings (pass through)\r\n if (typeof value === \"string\") return value;\r\n\r\n // Handle scalar types (number, boolean)\r\n if (typeof value === \"number\" || typeof value === \"boolean\") {\r\n return String(value);\r\n }\r\n};\r\n\r\n/** Trim whitespace */\r\nexport const trimMutator: Mutator = async (value, context) => {\r\n return trim(value?.toString(), context?.options?.needle ?? \" \");\r\n};\r\n\r\n/** Remove HTML tags (safe HTML) */\r\nexport const safeHtmlMutator: Mutator = async (value) => {\r\n return value?.toString().replace(/<[^>]*>?/gm, \"\");\r\n};\r\n\r\n/** HTML escape */\r\nexport const htmlEscapeMutator: Mutator = async (value) => {\r\n return value\r\n ?.toString()\r\n .replace(/&/g, \"&amp;\")\r\n .replace(/</g, \"&lt;\")\r\n .replace(/>/g, \"&gt;\")\r\n .replace(/\"/g, \"&quot;\")\r\n .replace(/'/g, \"&#039;\");\r\n};\r\n\r\n/** Remove special characters */\r\nexport const removeSpecialCharactersMutator: Mutator = async (value) => {\r\n return value?.toString().replace(/[^a-zA-Z0-9]/g, \"\");\r\n};\r\n\r\n/** URL decode */\r\nexport const urlDecodeMutator: Mutator = async (value) => {\r\n return decodeURIComponent(value);\r\n};\r\n\r\n/** URL encode */\r\nexport const urlEncodeMutator: Mutator = async (value) => {\r\n return encodeURIComponent(value);\r\n};\r\n\r\n/** Convert to camelCase */\r\nexport const camelCaseMutator: Mutator = async (value) => {\r\n return toCamelCase(value?.toString());\r\n};\r\n\r\n/** Convert to PascalCase */\r\nexport const pascalCaseMutator: Mutator = async (value) => {\r\n return toStudlyCase(value?.toString());\r\n};\r\n\r\n/** Convert to snake_case */\r\nexport const snakeCaseMutator: Mutator = async (value) => {\r\n return toSnakeCase(value?.toString());\r\n};\r\n\r\n/** Convert to kebab-case */\r\nexport const kebabCaseMutator: Mutator = async (value) => {\r\n return toKebabCase(value?.toString());\r\n};\r\n\r\n/** Convert to URL-friendly slug */\r\nexport const slugMutator: Mutator = async (value) => {\r\n return value\r\n ?.toString()\r\n .toLowerCase()\r\n .trim()\r\n .replace(/[^\\w\\s-]/g, \"\")\r\n .replace(/[\\s_]+/g, \"-\")\r\n .replace(/--+/g, \"-\")\r\n .replace(/^-+|-+$/g, \"\");\r\n};\r\n\r\n/** Trim from the left/start */\r\nexport const ltrimMutator: Mutator = async (value, context) => {\r\n return ltrim(value?.toString(), context?.options?.needle ?? \" \");\r\n};\r\n\r\n/** Trim from the right/end */\r\nexport const rtrimMutator: Mutator = async (value, context) => {\r\n return rtrim(value?.toString(), context?.options?.needle ?? \" \");\r\n};\r\n\r\n/** Base64 encode */\r\nexport const base64EncodeMutator: Mutator = async (value) => {\r\n return Buffer.from(value?.toString()).toString(\"base64\");\r\n};\r\n\r\n/** Base64 decode */\r\nexport const base64DecodeMutator: Mutator = async (value) => {\r\n return Buffer.from(value?.toString(), \"base64\").toString(\"utf-8\");\r\n};\r\n\r\n/** Replace substring or pattern */\r\nexport const replaceMutator: Mutator = async (value, context) => {\r\n const { search, replace } = context?.options;\r\n if (!search) return value?.toString();\r\n return value?.toString().replace(search, replace ?? \"\");\r\n};\r\n\r\n/** Replace all occurrences of substring or pattern */\r\nexport const replaceAllMutator: Mutator = async (value, context) => {\r\n const { search, replace } = context?.options;\r\n if (!search) return value?.toString();\r\n const searchValue = typeof search === \"string\" ? new RegExp(search, \"g\") : search;\r\n return value?.toString().replace(searchValue, replace ?? \"\");\r\n};\r\n\r\n/** Append/suffix text to the end */\r\nexport const appendMutator: Mutator = async (value, context) => {\r\n const suffix = context?.options?.suffix ?? \"\";\r\n return value?.toString() + suffix;\r\n};\r\n\r\n/** Prepend/prefix text to the beginning */\r\nexport const prependMutator: Mutator = async (value, context) => {\r\n const prefix = context?.options?.prefix ?? \"\";\r\n return prefix + value?.toString();\r\n};\r\n\r\n/** Reverse the string */\r\nexport const reverseMutator: Mutator = async (value) => {\r\n return value?.toString().split(\"\").reverse().join(\"\");\r\n};\r\n\r\n/** Truncate to a maximum length */\r\nexport const truncateMutator: Mutator = async (value, context) => {\r\n const str = value?.toString();\r\n const maxLength = context?.options?.maxLength ?? 100;\r\n const suffix = context?.options?.suffix ?? \"...\";\r\n return readMoreChars(str, maxLength, suffix);\r\n};\r\n\r\n/** Trim multiple whitespace into single space */\r\nexport const trimMultipleWhitespaceMutator: Mutator = async (value) => {\r\n return value?.toString().replace(/\\s+/g, \" \");\r\n};\r\n\r\n/** Pad string from the start to reach target length */\r\nexport const padStartMutator: Mutator = async (value, context) => {\r\n const length = context?.options?.length ?? 0;\r\n const char = context?.options?.char ?? \" \";\r\n return value?.toString().padStart(length, char);\r\n};\r\n\r\n/** Pad string from the end to reach target length */\r\nexport const padEndMutator: Mutator = async (value, context) => {\r\n const length = context?.options?.length ?? 0;\r\n const char = context?.options?.char ?? \" \";\r\n return value?.toString().padEnd(length, char);\r\n};\r\n\r\n/** Repeat string N times */\r\nexport const repeatMutator: Mutator = async (value, context) => {\r\n const count = context?.options?.count ?? 1;\r\n return value?.toString()?.repeat(count);\r\n};\r\n\r\n/** Mask part of string */\r\nexport const maskMutator: Mutator = async (value, context) => {\r\n const str = value?.toString();\r\n const maskChar = context?.options?.char ?? \"*\";\r\n const start = context?.options?.start ?? 0;\r\n const end = context?.options?.end ?? str?.length;\r\n const visibleStart = str?.substring(0, start);\r\n const visibleEnd = str?.substring(end);\r\n const maskedLength = end - start;\r\n return visibleStart + maskChar.repeat(maskedLength) + visibleEnd;\r\n};\r\n\r\n/** Unescape HTML entities */\r\nexport const unescapeHtmlMutator: Mutator = async (value) => {\r\n return value\r\n ?.toString()\r\n .replace(/&amp;/g, \"&\")\r\n .replace(/&lt;/g, \"<\")\r\n .replace(/&gt;/g, \">\")\r\n .replace(/&quot;/g, '\"')\r\n .replace(/&#039;/g, \"'\");\r\n};\r\n\r\n/** Keep only alphabetic characters */\r\nexport const alphaOnlyMutator: Mutator = async (value) => {\r\n return value.toString().replace(/[^a-zA-Z]/g, \"\");\r\n};\r\n\r\n/** Keep only alphanumeric characters */\r\nexport const alphanumericOnlyMutator: Mutator = async (value) => {\r\n return value.toString().replace(/[^a-zA-Z0-9]/g, \"\");\r\n};\r\n\r\n/** Remove all numeric characters */\r\nexport const removeNumbersMutator: Mutator = async (value) => {\r\n return value.toString().replace(/[0-9]/g, \"\");\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Equal rule - value must be equal to a specific value\r\n */\r\nexport const equalRule: SchemaRule<{ value: any }> = {\r\n name: \"equal\",\r\n defaultErrorMessage: \"The :input must be equal to :value\",\r\n async validate(value: any, context) {\r\n if (value !== this.context.options.value) {\r\n this.context.translatableParams.value = this.context.options.value;\r\n return invalidRule(this, context);\r\n }\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Forbidden rule - value must not be present\r\n */\r\nexport const forbiddenRule: SchemaRule = {\r\n name: \"forbidden\",\r\n defaultErrorMessage: \"The :input is forbidden\",\r\n async validate(value: any, context) {\r\n if (!isEmptyValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport type { BaseValidator } from \"../../validators/base-validator\";\r\n\r\n/**\r\n * Union rule - value must match at least one of the provided validators\r\n */\r\nexport const unionRule: SchemaRule<{ validators: BaseValidator[] }> = {\r\n name: \"union\",\r\n defaultErrorMessage: \"Value must match one of the allowed types\",\r\n async validate(value: any, context) {\r\n const validators = this.context.options.validators;\r\n const firstErrorOnly = context.configurations?.firstErrorOnly ?? true;\r\n const allErrors: string[] = [];\r\n\r\n // Try each validator\r\n for (const validator of validators) {\r\n // Skip if type doesn't match (optimization)\r\n if (!validator.matchesType(value)) {\r\n continue;\r\n }\r\n\r\n // Type matches - validate\r\n const result = await validator.validate(value, context);\r\n\r\n if (result.isValid) {\r\n // Success! Validator matched and validated\r\n return VALID_RULE;\r\n }\r\n\r\n // Failed - collect error message\r\n const errorMsg = result.errors?.[0]?.error || \"Validation failed\";\r\n allErrors.push(errorMsg);\r\n\r\n // If firstErrorOnly, stop after first failed validator\r\n if (firstErrorOnly) {\r\n break;\r\n }\r\n }\r\n\r\n // All failed or no validator matched the type\r\n if (allErrors.length > 0) {\r\n // At least one validator matched type but failed validation\r\n this.context.errorMessage = firstErrorOnly\r\n ? allErrors[0]\r\n : allErrors.join(\"; \");\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule, WhenRuleOptions } from \"../../types\";\r\n\r\n/**\r\n * When rule - conditional validation based on another field value\r\n */\r\nexport const whenRule: SchemaRule<WhenRuleOptions> = {\r\n name: \"when\",\r\n description: \"Apply conditional validation based on another field value\",\r\n async validate(value: any, context) {\r\n const fieldToCheck = this.context.options.field;\r\n const conditions = this.context.options.is;\r\n const otherwise = this.context.options.otherwise;\r\n const scope = this.context.options.scope || \"global\";\r\n\r\n const fieldValue =\r\n scope === \"global\"\r\n ? get(context.allValues, fieldToCheck)\r\n : get(context.parent, fieldToCheck);\r\n\r\n // Convert field value to string for key lookup\r\n // This handles boolean, number, and string field values\r\n const fieldValueKey = String(fieldValue);\r\n\r\n if (conditions[fieldValueKey]) {\r\n const result = await conditions[fieldValueKey].validate(value, context);\r\n if (result.isValid) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Safe error access\r\n this.context.errorMessage =\r\n result.errors?.[0]?.error || \"Validation failed\";\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (otherwise) {\r\n const result = await otherwise.validate(value, context);\r\n\r\n if (result.isValid) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Safe error access\r\n this.context.errorMessage =\r\n result.errors?.[0]?.error || \"Validation failed\";\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Alpha rule - allows only alphabetic characters\r\n */\r\nexport const alphaRule: SchemaRule = {\r\n name: \"alpha\",\r\n defaultErrorMessage: \"The :input must contain only alphabetic characters\",\r\n async validate(value: any, context) {\r\n if (/^[a-zA-Z]+$/.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * AlphaNumeric rule - allows only alphanumeric characters\r\n */\r\nexport const alphaNumericRule: SchemaRule = {\r\n name: \"alphaNumeric\",\r\n defaultErrorMessage: \"The :input must contain only alphanumeric characters\",\r\n async validate(value: any, context) {\r\n if (/^[a-zA-Z0-9]+$/.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Numeric string rule - allows only numeric characters\r\n */\r\nexport const isNumericRule: SchemaRule = {\r\n name: \"numeric\",\r\n defaultErrorMessage: \"The :input must contain only numeric characters\",\r\n async validate(value: any, context) {\r\n if (/^[0-9]+$/.test(String(value))) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Credit card rule - validates credit card number\r\n */\r\nexport const isCreditCardRule: SchemaRule = {\r\n name: \"creditCard\",\r\n defaultErrorMessage: \"The :input must be a valid credit card number\",\r\n async validate(value: any, context) {\r\n // Luhn algorithm for credit card validation\r\n const cardNumber = String(value).replace(/\\s/g, \"\");\r\n\r\n if (!/^\\d+$/.test(cardNumber)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n let sum = 0;\r\n let isEven = false;\r\n\r\n for (let i = cardNumber.length - 1; i >= 0; i--) {\r\n let digit = parseInt(cardNumber[i], 10);\r\n\r\n if (isEven) {\r\n digit *= 2;\r\n if (digit > 9) {\r\n digit -= 9;\r\n }\r\n }\r\n\r\n sum += digit;\r\n isEven = !isEven;\r\n }\r\n\r\n if (sum % 10 === 0) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { isEmail } from \"@mongez/supportive-is\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Email rule - validates email format\r\n */\r\nexport const emailRule: SchemaRule = {\r\n name: \"email\",\r\n defaultErrorMessage: \"The :input must be a valid email address\",\r\n async validate(value: any, context) {\r\n if (isEmail(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Modern ID format validators — UUID, CUID, ULID, nanoid.\n *\n * Each rule asserts the value is a string in the canonical format for its\n * identifier scheme. Rules are intentionally strict (variant nibbles checked\n * for UUID, character classes enforced for ULID's Crockford base32, etc.)\n * so \"looks-like-but-not-valid\" inputs are rejected.\n */\n\nconst UUID_ANY = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nconst UUID_BY_VERSION: Record<1 | 3 | 4 | 5 | 6 | 7, RegExp> = {\n 1: /^[0-9a-f]{8}-[0-9a-f]{4}-1[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 3: /^[0-9a-f]{8}-[0-9a-f]{4}-3[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 4: /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 5: /^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 6: /^[0-9a-f]{8}-[0-9a-f]{4}-6[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 7: /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n};\n\nexport type UUIDVersion = 1 | 3 | 4 | 5 | 6 | 7;\n\n/**\n * UUID rule — value must be a valid UUID. Optionally restrict to a specific version.\n *\n * @example\n * v.string().uuid() // any RFC 4122 UUID\n * v.string().uuid(4) // only v4 (random)\n * v.string().uuid(7) // only v7 (timestamp-ordered)\n */\nexport const uuidRule: SchemaRule<{ version?: UUIDVersion }> = {\n name: \"uuid\",\n defaultErrorMessage: \"The :input must be a valid UUID\",\n async validate(value, context) {\n if (typeof value !== \"string\") return invalidRule(this, context);\n\n const version = this.context.options.version;\n\n const pattern = version ? UUID_BY_VERSION[version] : UUID_ANY;\n if (pattern.test(value)) return VALID_RULE;\n\n if (version !== undefined) {\n this.context.translationParams.version = version;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * CUID rule — value must be a valid CUID.\n *\n * Defaults to CUID2 (24 chars, lowercase, starts with letter — see\n * https://github.com/paralleldrive/cuid2). Pass `{ version: 1 }` for legacy\n * CUID1 format (starts with \"c\", ≥25 chars).\n *\n * @example\n * v.string().cuid() // CUID2\n * v.string().cuid({ version: 1 }) // legacy CUID1\n */\nexport const cuidRule: SchemaRule<{ version?: 1 | 2 }> = {\n name: \"cuid\",\n defaultErrorMessage: \"The :input must be a valid CUID\",\n async validate(value, context) {\n if (typeof value !== \"string\") return invalidRule(this, context);\n const version = this.context.options.version ?? 2;\n const pattern = version === 1 ? /^c[a-z0-9]{24,}$/ : /^[a-z][a-z0-9]{23}$/;\n if (pattern.test(value)) return VALID_RULE;\n this.context.translationParams.version = version;\n return invalidRule(this, context);\n },\n};\n\n/**\n * ULID rule — value must be a valid ULID (26 chars, Crockford base32).\n *\n * Crockford base32 excludes the letters I, L, O, U to avoid ambiguity.\n *\n * @example\n * v.string().ulid()\n */\nexport const ulidRule: SchemaRule = {\n name: \"ulid\",\n defaultErrorMessage: \"The :input must be a valid ULID\",\n async validate(value, context) {\n if (typeof value !== \"string\") return invalidRule(this, context);\n if (/^[0-9A-HJKMNP-TV-Z]{26}$/.test(value)) return VALID_RULE;\n return invalidRule(this, context);\n },\n};\n\n/**\n * nanoid rule — value must be a valid nanoid string.\n *\n * Default length is 21 (standard nanoid). URL-safe alphabet:\n * A–Z, a–z, 0–9, `_`, `-`.\n *\n * @example\n * v.string().nanoid() // 21 chars (default)\n * v.string().nanoid(10) // 10 chars\n */\nexport const nanoidRule: SchemaRule<{ length?: number }> = {\n name: \"nanoid\",\n defaultErrorMessage: \"The :input must be a valid nanoid\",\n async validate(value, context) {\n if (typeof value !== \"string\") return invalidRule(this, context);\n const length = this.context.options.length ?? 21;\n const pattern = new RegExp(`^[A-Za-z0-9_-]{${length}}$`);\n if (pattern.test(value)) return VALID_RULE;\n this.context.translationParams.length = length;\n return invalidRule(this, context);\n },\n};\n","import { isIP } from \"net\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * IP rule - validates IP address (v4 or v6)\r\n */\r\nexport const ipRule: SchemaRule = {\r\n name: \"ip\",\r\n defaultErrorMessage: \"The :input must be a valid IP address\",\r\n async validate(value: any, context) {\r\n if (isIP(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * IPv4 rule - validates IPv4 address\r\n */\r\nexport const ip4Rule: SchemaRule = {\r\n name: \"ip4\",\r\n defaultErrorMessage: \"The :input must be a valid IPv4 address\",\r\n async validate(value: any, context) {\r\n if (isIP(value) === 4) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * IPv6 rule - validates IPv6 address\r\n */\r\nexport const ip6Rule: SchemaRule = {\r\n name: \"ip6\",\r\n defaultErrorMessage: \"The :input must be a valid IPv6 address\",\r\n async validate(value: any, context) {\r\n if (isIP(value) === 6) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Matches rule - value must match another field value\r\n */\r\nexport const matchesRule: SchemaRule<{ field: string }> = {\r\n name: \"matches\",\r\n defaultErrorMessage: \"The :input must match :field\",\r\n async validate(value: any, context) {\r\n const otherFieldValue = get(context.allValues, this.context.options.field);\r\n\r\n if (value === otherFieldValue) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Pattern rule - validates against regex pattern\r\n */\r\nexport const patternRule: SchemaRule<{ pattern: RegExp }> = {\r\n name: \"pattern\",\r\n defaultErrorMessage: \"The :input does not match the required pattern\",\r\n async validate(value: any, context) {\r\n if (this.context.options.pattern.test(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.pattern = this.context.options.pattern.toString();\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Starts with rule\r\n */\r\nexport const startsWithRule: SchemaRule<{ value: string }> = {\r\n name: \"startsWith\",\r\n defaultErrorMessage: \"The :input must start with :value\",\r\n async validate(value: any, context) {\r\n if (String(value).startsWith(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Ends with rule\r\n */\r\nexport const endsWithRule: SchemaRule<{ value: string }> = {\r\n name: \"endsWith\",\r\n defaultErrorMessage: \"The :input must end with :value\",\r\n async validate(value: any, context) {\r\n if (String(value).endsWith(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Contains rule\r\n */\r\nexport const containsRule: SchemaRule<{ value: string }> = {\r\n name: \"contains\",\r\n defaultErrorMessage: \"The :input must contain :value\",\r\n async validate(value: any, context) {\r\n if (String(value).includes(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Not contains rule\r\n */\r\nexport const notContainsRule: SchemaRule<{ value: string }> = {\r\n name: \"notContains\",\r\n defaultErrorMessage: \"The :input must not contain :value\",\r\n async validate(value: any, context) {\r\n if (!String(value).includes(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Strong Password rule - validates password strength\r\n * Requirements:\r\n * - At least 8 characters\r\n * - At least 1 uppercase letter\r\n * - At least 1 lowercase letter\r\n * - At least 1 number\r\n * - At least 1 special character\r\n */\r\nexport const strongPasswordRule: SchemaRule<{ minLength?: number }> = {\r\n name: \"strongPassword\",\r\n defaultErrorMessage:\r\n \"The :input must be at least 8 characters and contain at least one uppercase letter, one lowercase letter, one number, and one special character\",\r\n async validate(value: any, context) {\r\n const password = String(value);\r\n const minLength = this.context.options.minLength ?? 8;\r\n\r\n // Check minimum length\r\n if (password.length < minLength) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Check for at least one uppercase letter\r\n if (!/[A-Z]/.test(password)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Check for at least one lowercase letter\r\n if (!/[a-z]/.test(password)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Check for at least one number\r\n if (!/[0-9]/.test(password)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Check for at least one special character\r\n if (!/[!@#$%^&*()_+\\-=[\\]{};':\"\\\\|,.<>/?]/.test(password)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * URL rule - validates URL format\r\n */\r\nexport const urlRule: SchemaRule = {\r\n name: \"url\",\r\n defaultErrorMessage: \"The :input must be a valid URL\",\r\n async validate(value: any, context) {\r\n try {\r\n new URL(value);\r\n return VALID_RULE;\r\n } catch {\r\n return invalidRule(this, context);\r\n }\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Without whitespace rule - value must not contain whitespace\r\n */\r\nexport const withoutWhitespaceRule: SchemaRule = {\r\n name: \"withoutWhitespace\",\r\n defaultErrorMessage: \"The :input must not contain whitespace\",\r\n async validate(value: any, context) {\r\n if (!/\\s/.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Min rule - value must be equal or greater than minimum\r\n * Supports field names with sibling scope\r\n */\r\nexport const minRule: SchemaRule<{\r\n min: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"min\",\r\n defaultErrorMessage: \"The :input must be at least :min\",\r\n async validate(value: any, context) {\r\n const { min, scope = \"global\" } = this.context.options;\r\n let compareMin: number;\r\n\r\n if (typeof min === \"number\") {\r\n compareMin = min;\r\n this.context.translationParams.min = min;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, min);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.min = min;\r\n\r\n compareMin = Number(fieldValue);\r\n\r\n if (isNaN(compareMin)) {\r\n return VALID_RULE;\r\n }\r\n }\r\n\r\n if (value >= compareMin) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max rule - value must be equal or less than maximum\r\n * Supports field names with sibling scope\r\n */\r\nexport const maxRule: SchemaRule<{\r\n max: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"max\",\r\n defaultErrorMessage: \"The :input must equal to or less than :max\",\r\n async validate(value: any, context) {\r\n const { max, scope = \"global\" } = this.context.options;\r\n let compareMax: number;\r\n\r\n if (typeof max === \"number\") {\r\n compareMax = max;\r\n this.context.translationParams.max = max;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, max);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.max = max;\r\n\r\n compareMax = Number(fieldValue);\r\n\r\n if (isNaN(compareMax)) {\r\n return VALID_RULE;\r\n }\r\n }\r\n\r\n if (value <= compareMax) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Greater than rule - value must be strictly greater than minimum\r\n * Supports field names with sibling scope\r\n */\r\nexport const greaterThanRule: SchemaRule<{\r\n value: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"greaterThan\",\r\n defaultErrorMessage: \"The :input must be greater than :value\",\r\n async validate(value: any, context) {\r\n const { value: compareValue, scope = \"global\" } = this.context.options;\r\n let compareNumber: number;\r\n\r\n if (typeof compareValue === \"number\") {\r\n compareNumber = compareValue;\r\n this.context.translationParams.value = compareValue;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, compareValue);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = compareValue;\r\n\r\n compareNumber = Number(fieldValue);\r\n\r\n if (isNaN(compareNumber)) {\r\n return VALID_RULE;\r\n }\r\n }\r\n\r\n if (value > compareNumber) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Less than rule - value must be strictly less than maximum\r\n * Supports field names with sibling scope\r\n */\r\nexport const lessThanRule: SchemaRule<{\r\n value: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"lessThan\",\r\n defaultErrorMessage: \"The :input must be less than :value\",\r\n async validate(value: any, context) {\r\n const { value: compareValue, scope = \"global\" } = this.context.options;\r\n let compareNumber: number;\r\n\r\n if (typeof compareValue === \"number\") {\r\n compareNumber = compareValue;\r\n this.context.translationParams.value = compareValue;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, compareValue);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = compareValue;\r\n\r\n compareNumber = Number(fieldValue);\r\n\r\n if (isNaN(compareNumber)) {\r\n return VALID_RULE;\r\n }\r\n }\r\n\r\n if (value < compareNumber) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Positive rule - value must be greater than 0\r\n */\r\nexport const positiveRule: SchemaRule = {\r\n name: \"positive\",\r\n defaultErrorMessage: \"The :input must be a positive number\",\r\n async validate(value: any, context) {\r\n if (value > 0) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Negative rule - value must be less than 0\r\n */\r\nexport const negativeRule: SchemaRule = {\r\n name: \"negative\",\r\n defaultErrorMessage: \"The :input must be a negative number\",\r\n async validate(value: any, context) {\r\n if (value < 0) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Odd rule - value must be an odd number\r\n */\r\nexport const oddRule: SchemaRule = {\r\n name: \"odd\",\r\n defaultErrorMessage: \"The :input must be an odd number\",\r\n async validate(value: any, context) {\r\n if (value % 2 !== 0) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Even rule - value must be an even number\r\n */\r\nexport const evenRule: SchemaRule = {\r\n name: \"even\",\r\n defaultErrorMessage: \"The :input must be an even number\",\r\n async validate(value: any, context) {\r\n if (value % 2 === 0) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Modulo rule - value must be divisible by given number\r\n */\r\nexport const moduloRule: SchemaRule<{ value: number }> = {\r\n name: \"modulo\",\r\n defaultErrorMessage: \"The :input must be divisible by :value\",\r\n async validate(value: any, context) {\r\n if (value % this.context.options.value === 0) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between rule - value must be between the given two numbers (Inclusive)\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenNumbersRule: SchemaRule<{\r\n min: number | string;\r\n max: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenNumbers\",\r\n defaultErrorMessage: \"The :input must be between :min and :max\",\r\n async validate(value: any, context) {\r\n const { min, max, scope = \"global\" } = this.context.options;\r\n\r\n // Extract min value\r\n let compareMin: number;\r\n if (typeof min === \"number\") {\r\n compareMin = min;\r\n this.context.translationParams.min = min;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, min);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.min = min;\r\n\r\n compareMin = Number(fieldValue);\r\n if (isNaN(compareMin)) {\r\n return VALID_RULE;\r\n }\r\n }\r\n\r\n // Extract max value\r\n let compareMax: number;\r\n if (typeof max === \"number\") {\r\n compareMax = max;\r\n this.context.translationParams.max = max;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, max);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.max = max;\r\n\r\n compareMax = Number(fieldValue);\r\n if (isNaN(compareMax)) {\r\n return VALID_RULE;\r\n }\r\n }\r\n\r\n if (value >= compareMin && value <= compareMax) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Min length rule - validates minimum length\r\n * Works for any value with a length property (strings, arrays, etc.)\r\n */\r\nexport const minLengthRule: SchemaRule<{ minLength: number }> = {\r\n name: \"minLength\",\r\n defaultErrorMessage: \"The :input must be at least :minLength characters long\",\r\n async validate(value: any, context) {\r\n const length = typeof value?.length === \"number\" ? value.length : String(value || \"\").length;\r\n\r\n if (length >= this.context.options.minLength) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minLength = this.context.options.minLength;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max length rule - validates maximum length\r\n * Works for any value with a length property (strings, arrays, etc.)\r\n */\r\nexport const maxLengthRule: SchemaRule<{ maxLength: number }> = {\r\n name: \"maxLength\",\r\n defaultErrorMessage: \"The :input must not exceed :maxLength characters\",\r\n async validate(value: any, context) {\r\n const length = typeof value?.length === \"number\" ? value.length : String(value || \"\").length;\r\n\r\n if (length <= this.context.options.maxLength) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.maxLength = this.context.options.maxLength;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between length rule - validates length is between min and max (inclusive)\r\n * Works for any value with a length property (strings, arrays, etc.)\r\n */\r\nexport const betweenLengthRule: SchemaRule<{\r\n minLength: number;\r\n maxLength: number;\r\n}> = {\r\n name: \"betweenLength\",\r\n defaultErrorMessage: \"The :input must be between :minLength and :maxLength characters long\",\r\n async validate(value: any, context) {\r\n const length = typeof value?.length === \"number\" ? value.length : String(value || \"\").length;\r\n\r\n if (length >= this.context.options.minLength && length <= this.context.options.maxLength) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minLength = this.context.options.minLength;\r\n this.context.translationParams.maxLength = this.context.options.maxLength;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Length rule - validates exact length\r\n * Works for any value with a length property (strings, arrays, etc.)\r\n */\r\nexport const lengthRule: SchemaRule<{ length: number }> = {\r\n name: \"length\",\r\n defaultErrorMessage: \"The :input must be exactly :length characters long\",\r\n async validate(value: any, context) {\r\n const length = typeof value?.length === \"number\" ? value.length : String(value || \"\").length;\r\n\r\n if (length === this.context.options.length) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.length = this.context.options.length;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min words rule - validates minimum word count\r\n */\r\nexport const minWordsRule: SchemaRule<{ minWords: number }> = {\r\n name: \"minWords\",\r\n defaultErrorMessage: \"The :input must be at least :minWords words\",\r\n async validate(value: any, context) {\r\n if (String(value || \"\").split(\" \").length >= this.context.options.minWords) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minWords = this.context.options.minWords;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max words rule - validates maximum word count\r\n */\r\nexport const maxWordsRule: SchemaRule<{ maxWords: number }> = {\r\n name: \"maxWords\",\r\n defaultErrorMessage: \"The :input must be at most :maxWords words\",\r\n async validate(value: any, context) {\r\n if (String(value || \"\").split(\" \").length <= this.context.options.maxWords) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.maxWords = this.context.options.maxWords;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Words rule - validates exact word count\r\n */\r\nexport const wordsRule: SchemaRule<{ words: number }> = {\r\n name: \"words\",\r\n defaultErrorMessage: \"The :input must be exactly :words words\",\r\n async validate(value: any, context) {\r\n if (String(value || \"\").split(\" \").length === this.context.options.words) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.words = this.context.options.words;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Unique array rule - array must contain unique values\r\n */\r\nexport const uniqueArrayRule: SchemaRule = {\r\n name: \"uniqueArray\",\r\n description: \"The array must contain unique values\",\r\n defaultErrorMessage: \"The :input must contain unique values\",\r\n async validate(value: any, context) {\r\n const uniqueValues = new Set(value);\r\n\r\n if (uniqueValues.size === value.length) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Sorted array rule - array must be sorted\r\n */\r\nexport const sortedArrayRule: SchemaRule<{\r\n direction?: \"asc\" | \"desc\";\r\n}> = {\r\n name: \"sortedArray\",\r\n description: \"The array must be sorted\",\r\n defaultErrorMessage: \"The :input must be sorted\",\r\n async validate(value: any[], context) {\r\n if (!Array.isArray(value) || value.length <= 1) {\r\n return VALID_RULE;\r\n }\r\n\r\n const direction = this.context.options.direction ?? \"asc\";\r\n this.context.translatableParams.direction = direction;\r\n\r\n for (let i = 0; i < value.length - 1; i++) {\r\n const current = value[i];\r\n const next = value[i + 1];\r\n\r\n if (direction === \"asc\") {\r\n if (current > next) {\r\n return invalidRule(this, context);\r\n }\r\n } else {\r\n if (current < next) {\r\n return invalidRule(this, context);\r\n }\r\n }\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","/**\r\n * Week day names for validation\r\n */\r\nexport type WeekDay =\r\n | \"sunday\"\r\n | \"monday\"\r\n | \"tuesday\"\r\n | \"wednesday\"\r\n | \"thursday\"\r\n | \"friday\"\r\n | \"saturday\";\r\n\r\n/**\r\n * Week day numbers mapping\r\n */\r\nexport const WEEK_DAYS: Record<WeekDay, number> = {\r\n sunday: 0,\r\n monday: 1,\r\n tuesday: 2,\r\n wednesday: 3,\r\n thursday: 4,\r\n friday: 5,\r\n saturday: 6,\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isDateValue } from \"../../helpers/date-helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport type { WeekDay } from \"../../types/date-types\";\r\nimport { WEEK_DAYS } from \"../../types/date-types\";\r\n\r\n/**\r\n * Date rule - validates date format\r\n */\r\nexport const dateRule: SchemaRule = {\r\n name: \"date\",\r\n defaultErrorMessage: \"The :input must be a valid date\",\r\n async validate(value: any, context) {\r\n if (value instanceof Date && !isNaN(value.getTime())) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min date rule - date must be >= given date or field\r\n * Smart detection: date value or field name\r\n */\r\nexport const minDateRule: SchemaRule<{\r\n dateOrField: Date | string | number;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minDate\",\r\n description: \"The field must be at least the given date or field\",\r\n defaultErrorMessage: \"The :input must be at least :dateOrField\",\r\n async validate(value: Date, context) {\r\n const { dateOrField, scope = \"global\" } = this.context.options;\r\n let compareDate: Date;\r\n\r\n if (isDateValue(dateOrField)) {\r\n // Value comparison\r\n compareDate = new Date(dateOrField);\r\n } else {\r\n // Field comparison\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dateOrField as string);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n compareDate = new Date(fieldValue);\r\n }\r\n\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate >= compareDate) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max date rule - date must be <= given date or field\r\n * Smart detection: date value or field name\r\n */\r\nexport const maxDateRule: SchemaRule<{\r\n dateOrField: Date | string | number;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxDate\",\r\n defaultErrorMessage: \"The :input must be at most :dateOrField\",\r\n async validate(value: Date, context) {\r\n const { dateOrField, scope = \"global\" } = this.context.options;\r\n let compareDate: Date;\r\n\r\n if (isDateValue(dateOrField)) {\r\n // Value comparison\r\n compareDate = new Date(dateOrField);\r\n } else {\r\n // Field comparison\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dateOrField as string);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n compareDate = new Date(fieldValue);\r\n }\r\n\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate <= compareDate) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * From today rule - date must be today or in the future\r\n */\r\nexport const fromTodayRule: SchemaRule = {\r\n name: \"fromToday\",\r\n defaultErrorMessage: \"The :input must be today or in the future\",\r\n async validate(value: Date, context) {\r\n const today = new Date();\r\n today.setHours(0, 0, 0, 0);\r\n const inputDate = new Date(value);\r\n inputDate.setHours(0, 0, 0, 0);\r\n\r\n if (inputDate >= today) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Before today rule - date must be before today\r\n */\r\nexport const beforeTodayRule: SchemaRule = {\r\n name: \"beforeToday\",\r\n defaultErrorMessage: \"The :input must be before today\",\r\n async validate(value: Date, context) {\r\n const today = new Date();\r\n today.setHours(0, 0, 0, 0);\r\n const inputDate = new Date(value);\r\n inputDate.setHours(0, 0, 0, 0);\r\n\r\n if (inputDate < today) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * From hour rule - time must be from specific hour onwards\r\n */\r\nexport const fromHourRule: SchemaRule<{ hour: number }> = {\r\n name: \"fromHour\",\r\n defaultErrorMessage: \"The :input must be from :hour:00 onwards\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const hour = inputDate.getHours();\r\n\r\n if (hour >= this.context.options.hour) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.hour = this.context.options.hour;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Before hour rule - time must be before specific hour\r\n */\r\nexport const beforeHourRule: SchemaRule<{ hour: number }> = {\r\n name: \"beforeHour\",\r\n defaultErrorMessage: \"The :input must be before :hour:00\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const hour = inputDate.getHours();\r\n\r\n if (hour < this.context.options.hour) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.hour = this.context.options.hour;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between hours rule - time must be between start and end hours\r\n */\r\nexport const betweenHoursRule: SchemaRule<{\r\n startHour: number;\r\n endHour: number;\r\n}> = {\r\n name: \"betweenHours\",\r\n defaultErrorMessage: \"The :input must be between :startHour:00 and :endHour:00\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const hour = inputDate.getHours();\r\n const { startHour, endHour } = this.context.options;\r\n\r\n if (hour >= startHour && hour <= endHour) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startHour = startHour;\r\n this.context.translationParams.endHour = endHour;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * From minute rule - time must be from specific minute onwards\r\n */\r\nexport const fromMinuteRule: SchemaRule<{ minute: number }> = {\r\n name: \"fromMinute\",\r\n defaultErrorMessage: \"The :input must be from minute :minute onwards\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const minute = inputDate.getMinutes();\r\n\r\n if (minute >= this.context.options.minute) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minute = this.context.options.minute;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Before minute rule - time must be before specific minute\r\n */\r\nexport const beforeMinuteRule: SchemaRule<{ minute: number }> = {\r\n name: \"beforeMinute\",\r\n defaultErrorMessage: \"The :input must be before minute :minute\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const minute = inputDate.getMinutes();\r\n\r\n if (minute < this.context.options.minute) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minute = this.context.options.minute;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between minutes rule - time must be between start and end minutes\r\n */\r\nexport const betweenMinutesRule: SchemaRule<{\r\n startMinute: number;\r\n endMinute: number;\r\n}> = {\r\n name: \"betweenMinutes\",\r\n defaultErrorMessage: \"The :input must be between minute :startMinute and :endMinute\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const minute = inputDate.getMinutes();\r\n const { startMinute, endMinute } = this.context.options;\r\n\r\n if (minute >= startMinute && minute <= endMinute) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startMinute = startMinute;\r\n this.context.translationParams.endMinute = endMinute;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Age rule - calculate age from date\r\n */\r\nexport const ageRule: SchemaRule<{ years: number }> = {\r\n name: \"age\",\r\n defaultErrorMessage: \"The :input must be exactly :years years old\",\r\n async validate(value: Date, context) {\r\n const birthDate = new Date(value);\r\n const today = new Date();\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n if (age === this.context.options.years) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.years = this.context.options.years;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min age rule - minimum age requirement\r\n */\r\nexport const minAgeRule: SchemaRule<{ years: number }> = {\r\n name: \"minAge\",\r\n defaultErrorMessage: \"The :input must be at least :years years old\",\r\n async validate(value: Date, context) {\r\n const birthDate = new Date(value);\r\n const today = new Date();\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n if (age >= this.context.options.years) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.years = this.context.options.years;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max age rule - maximum age requirement\r\n */\r\nexport const maxAgeRule: SchemaRule<{ years: number }> = {\r\n name: \"maxAge\",\r\n defaultErrorMessage: \"The :input must be at most :years years old\",\r\n async validate(value: Date, context) {\r\n const birthDate = new Date(value);\r\n const today = new Date();\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n if (age <= this.context.options.years) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.years = this.context.options.years;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Week day rule - date must be specific weekday\r\n */\r\nexport const weekDayRule: SchemaRule<{ day: WeekDay }> = {\r\n name: \"weekDay\",\r\n defaultErrorMessage: \"The :input must be a :day\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n const expectedDay = WEEK_DAYS[this.context.options.day];\r\n\r\n if (dayOfWeek === expectedDay) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.day = this.context.options.day;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Between dates rule - date must be between start and end dates\r\n */\r\nexport const betweenDatesRule: SchemaRule<{\r\n startDate: Date;\r\n endDate: Date;\r\n}> = {\r\n name: \"betweenDates\",\r\n defaultErrorMessage: \"The :input must be between :startDate and :endDate\",\r\n async validate(value: Date, context) {\r\n const { startDate, endDate } = this.context.options;\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate >= startDate && inputDate <= endDate) {\r\n this.context.translationParams.startDate = startDate.toISOString();\r\n this.context.translationParams.endDate = endDate.toISOString();\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Today rule - date must be exactly today\r\n */\r\nexport const todayRule: SchemaRule = {\r\n name: \"today\",\r\n defaultErrorMessage: \"The :input must be today\",\r\n async validate(value: Date, context) {\r\n const today = new Date();\r\n today.setHours(0, 0, 0, 0);\r\n const inputDate = new Date(value);\r\n inputDate.setHours(0, 0, 0, 0);\r\n\r\n if (inputDate.getTime() === today.getTime()) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Past rule - date must be in the past\r\n */\r\nexport const pastRule: SchemaRule = {\r\n name: \"past\",\r\n defaultErrorMessage: \"The :input must be in the past\",\r\n async validate(value: Date, context) {\r\n const now = new Date();\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate < now) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Future rule - date must be in the future\r\n */\r\nexport const futureRule: SchemaRule = {\r\n name: \"future\",\r\n defaultErrorMessage: \"The :input must be in the future\",\r\n async validate(value: Date, context) {\r\n const now = new Date();\r\n\r\n if (value > now) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * After today rule - date must be after today (not including today)\r\n */\r\nexport const afterTodayRule: SchemaRule = {\r\n name: \"afterToday\",\r\n defaultErrorMessage: \"The :input must be after today\",\r\n async validate(value: Date, context) {\r\n const today = new Date();\r\n today.setHours(0, 0, 0, 0);\r\n const inputDate = new Date(value);\r\n inputDate.setHours(0, 0, 0, 0);\r\n\r\n if (inputDate > today) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport type { WeekDay } from \"../../types/date-types\";\r\nimport { WEEK_DAYS } from \"../../types/date-types\";\r\n\r\n/**\r\n * Weekend rule - date must be Saturday or Sunday\r\n */\r\nexport const weekendRule: SchemaRule = {\r\n name: \"weekend\",\r\n defaultErrorMessage: \"The :input must be a weekend (Saturday or Sunday)\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n\r\n // 0 = Sunday, 6 = Saturday\r\n if (dayOfWeek === 0 || dayOfWeek === 6) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Weekday rule - date must be Monday through Friday\r\n */\r\nexport const weekdayRule: SchemaRule = {\r\n name: \"weekday\",\r\n defaultErrorMessage: \"The :input must be a weekday (Monday-Friday)\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n\r\n // 1-5 = Monday-Friday\r\n if (dayOfWeek >= 1 && dayOfWeek <= 5) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Weekdays rule - date must be one of specified weekdays\r\n */\r\nexport const weekdaysRule: SchemaRule<{ days: WeekDay[] }> = {\r\n name: \"weekdays\",\r\n defaultErrorMessage: \"The :input must be one of: :days\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n const { days } = this.context.options;\r\n\r\n const allowedDays = days.map((day) => WEEK_DAYS[day]);\r\n\r\n if (allowedDays.includes(dayOfWeek)) {\r\n return VALID_RULE;\r\n }\r\n\r\n days.forEach((day) => {\r\n this.context.translatableParams[day] = day;\r\n });\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Business day rule - date must be Monday-Friday (no weekends)\r\n */\r\nexport const businessDayRule: SchemaRule = {\r\n name: \"businessDay\",\r\n defaultErrorMessage: \"The :input must be a business day\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n\r\n // 1-5 = Monday-Friday\r\n if (dayOfWeek >= 1 && dayOfWeek <= 5) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isDateValue } from \"../../helpers/date-helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Before field rule - date must be < given date or field\r\n * Smart detection: date value or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const beforeFieldRule: SchemaRule<{\r\n dateOrField: Date | string | number;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"beforeField\",\r\n description: \"The date must be before the given date or field\",\r\n defaultErrorMessage: \"The :input must be before :dateOrField\",\r\n async validate(value: Date, context) {\r\n const { dateOrField, scope = \"global\" } = this.context.options;\r\n let compareDate: Date;\r\n\r\n if (isDateValue(dateOrField)) {\r\n // Value comparison\r\n compareDate = new Date(dateOrField);\r\n } else {\r\n // Field comparison\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dateOrField as string);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n compareDate = new Date(fieldValue);\r\n }\r\n\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate < compareDate) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * After field rule - date must be > given date or field\r\n * Smart detection: date value or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const afterFieldRule: SchemaRule<{\r\n dateOrField: Date | string | number;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"afterField\",\r\n description: \"The date must be after the given date or field\",\r\n defaultErrorMessage: \"The :input must be after :dateOrField\",\r\n async validate(value: Date, context) {\r\n const { dateOrField, scope = \"global\" } = this.context.options;\r\n let compareDate: Date;\r\n\r\n if (isDateValue(dateOrField)) {\r\n // Value comparison\r\n compareDate = new Date(dateOrField);\r\n this.context.translationParams.dateOrField = compareDate.toISOString();\r\n } else {\r\n // Field comparison\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dateOrField as string);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n compareDate = new Date(fieldValue);\r\n this.context.translatableParams.dateOrField = fieldValue;\r\n }\r\n\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate > compareDate) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Same as field rule - date must be the same as another field's date\r\n * Supports both global and sibling scope\r\n */\r\nexport const sameAsFieldDateRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"sameAsFieldDate\",\r\n description: \"The date must be the same as another field's date\",\r\n defaultErrorMessage: \"The :input must be the same as :field\",\r\n async validate(value: Date, context) {\r\n const { field, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, field);\r\n\r\n // Both fields must exist to be considered \"the same\"\r\n if (fieldValue === undefined || value === undefined) {\r\n this.context.translatableParams.field = fieldValue;\r\n return invalidRule(this, context);\r\n }\r\n\r\n const inputDate = new Date(value);\r\n inputDate.setHours(0, 0, 0, 0);\r\n const compareDate = new Date(fieldValue);\r\n compareDate.setHours(0, 0, 0, 0);\r\n\r\n if (inputDate.getTime() === compareDate.getTime()) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.field = fieldValue;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\nconst MONTHS = {\r\n 1: \"january\",\r\n 2: \"february\",\r\n 3: \"march\",\r\n 4: \"april\",\r\n 5: \"may\",\r\n 6: \"june\",\r\n 7: \"july\",\r\n 8: \"august\",\r\n 9: \"september\",\r\n 10: \"october\",\r\n 11: \"november\",\r\n 12: \"december\",\r\n};\r\n\r\nexport type Month = keyof typeof MONTHS;\r\n\r\n/**\r\n * Month rule - date must be in specific month (1-12)\r\n */\r\nexport const monthRule: SchemaRule<{ month: Month }> = {\r\n name: \"month\",\r\n defaultErrorMessage: \"The :input must be in month :month\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const month = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n if (month === this.context.options.month) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.month =\r\n MONTHS[this.context.options.month as keyof typeof MONTHS];\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Year rule - date must be in specific year\r\n */\r\nexport const yearRule: SchemaRule<{ year: number }> = {\r\n name: \"year\",\r\n defaultErrorMessage: \"The :input must be in year :year\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const year = inputDate.getFullYear();\r\n\r\n if (year === this.context.options.year) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.year = this.context.options.year;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between years rule - date must be between start and end years\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenYearsRule: SchemaRule<{\r\n startYear: number | string;\r\n endYear: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenYears\",\r\n defaultErrorMessage: \"The :input must be between :startYear and :endYear\",\r\n async validate(value: Date, context) {\r\n const { startYear, endYear, scope = \"global\" } = this.context.options;\r\n const inputDate = new Date(value);\r\n const inputYear = inputDate.getFullYear();\r\n\r\n // Extract start year\r\n let compareStartYear: number;\r\n if (typeof startYear === \"number\") {\r\n compareStartYear = startYear;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, startYear);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareStartYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareStartYear = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareStartYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n // Extract end year\r\n let compareEndYear: number;\r\n if (typeof endYear === \"number\") {\r\n compareEndYear = endYear;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, endYear);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareEndYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareEndYear = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareEndYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n if (inputYear >= compareStartYear && inputYear <= compareEndYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startYear = compareStartYear;\r\n this.context.translationParams.endYear = compareEndYear;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between months rule - date must be between start and end months (1-12)\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenMonthsRule: SchemaRule<{\r\n startMonth: Month | string;\r\n endMonth: Month | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenMonths\",\r\n defaultErrorMessage: \"The :input must be between month :startMonth and :endMonth\",\r\n async validate(value: Date, context) {\r\n const { startMonth, endMonth, scope = \"global\" } = this.context.options;\r\n const inputDate = new Date(value);\r\n const inputMonth = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n // Extract start month\r\n let compareStartMonth: number;\r\n if (typeof startMonth === \"number\") {\r\n compareStartMonth = startMonth;\r\n this.context.translatableParams.startMonth = MONTHS[compareStartMonth as keyof typeof MONTHS];\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, startMonth);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.startMonth = startMonth;\r\n\r\n if (fieldValue instanceof Date) {\r\n compareStartMonth = fieldValue.getMonth() + 1;\r\n } else if (typeof fieldValue === \"number\") {\r\n compareStartMonth = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareStartMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n // Extract end month\r\n let compareEndMonth: number;\r\n if (typeof endMonth === \"number\") {\r\n compareEndMonth = endMonth;\r\n this.context.translatableParams.endMonth = MONTHS[compareEndMonth as keyof typeof MONTHS];\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, endMonth);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.endMonth = endMonth;\r\n\r\n if (fieldValue instanceof Date) {\r\n compareEndMonth = fieldValue.getMonth() + 1;\r\n } else if (typeof fieldValue === \"number\") {\r\n compareEndMonth = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareEndMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n if (inputMonth >= compareStartMonth && inputMonth <= compareEndMonth) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between days rule - date must be between start and end days (1-31)\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenDaysRule: SchemaRule<{\r\n startDay: number | string;\r\n endDay: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenDays\",\r\n defaultErrorMessage: \"The :input must be between day :startDay and :endDay\",\r\n async validate(value: Date, context) {\r\n const { startDay, endDay, scope = \"global\" } = this.context.options;\r\n const inputDate = new Date(value);\r\n const inputDay = inputDate.getDate();\r\n\r\n // Extract start day\r\n let compareStartDay: number;\r\n if (typeof startDay === \"number\") {\r\n compareStartDay = startDay;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, startDay);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareStartDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareStartDay = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareStartDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n // Extract end day\r\n let compareEndDay: number;\r\n if (typeof endDay === \"number\") {\r\n compareEndDay = endDay;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, endDay);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareEndDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareEndDay = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareEndDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n if (inputDay >= compareStartDay && inputDay <= compareEndDay) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startDay = compareStartDay;\r\n this.context.translationParams.endDay = compareEndDay;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Quarter rule - date must be in specific quarter (1-4)\r\n */\r\nexport const quarterRule: SchemaRule<{ quarter: 1 | 2 | 3 | 4 }> = {\r\n name: \"quarter\",\r\n defaultErrorMessage: \"The :input must be in quarter :quarter\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const month = inputDate.getMonth() + 1;\r\n const quarter = Math.ceil(month / 3);\r\n\r\n if (quarter === this.context.options.quarter) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.quarter = this.context.options.quarter;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between times rule - time must be between start and end times (HH:MM format)\r\n */\r\nexport const betweenTimesRule: SchemaRule<{\r\n startTime: string;\r\n endTime: string;\r\n}> = {\r\n name: \"betweenTimes\",\r\n defaultErrorMessage: \"The :input must be between :startTime and :endTime\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const inputHour = inputDate.getHours();\r\n const inputMinute = inputDate.getMinutes();\r\n const inputTimeInMinutes = inputHour * 60 + inputMinute;\r\n\r\n const { startTime, endTime } = this.context.options;\r\n\r\n // Parse start time\r\n const [startHour, startMinute] = startTime.split(\":\").map(Number);\r\n const startTimeInMinutes = startHour * 60 + startMinute;\r\n\r\n // Parse end time\r\n const [endHour, endMinute] = endTime.split(\":\").map(Number);\r\n const endTimeInMinutes = endHour * 60 + endMinute;\r\n\r\n if (inputTimeInMinutes >= startTimeInMinutes && inputTimeInMinutes <= endTimeInMinutes) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startTime = startTime;\r\n this.context.translationParams.endTime = endTime;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min year rule - year must be >= given year or field\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const minYearRule: SchemaRule<{\r\n yearOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minYear\",\r\n description: \"The date year must be at least the given year or field\",\r\n defaultErrorMessage: \"The :input year must be higher than :yearOrField\",\r\n async validate(value: Date, context) {\r\n const { yearOrField, scope = \"global\" } = this.context.options;\r\n let compareYear: number;\r\n\r\n if (typeof yearOrField === \"number\") {\r\n compareYear = yearOrField;\r\n this.context.translationParams.yearOrField = yearOrField;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, yearOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.yearOrField = yearOrField;\r\n\r\n // If field contains a date, extract the year\r\n if (fieldValue instanceof Date) {\r\n compareYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareYear = fieldValue;\r\n } else {\r\n // Try to parse as date and extract year\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputYear = inputDate.getFullYear();\r\n\r\n if (inputYear >= compareYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max year rule - year must be <= given year or field\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const maxYearRule: SchemaRule<{\r\n yearOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxYear\",\r\n description: \"The date year must be at most the given year or field\",\r\n defaultErrorMessage: \"The :input year must be at most :yearOrField\",\r\n async validate(value: Date, context) {\r\n const { yearOrField, scope = \"global\" } = this.context.options;\r\n let compareYear: number;\r\n\r\n if (typeof yearOrField === \"number\") {\r\n compareYear = yearOrField;\r\n this.context.translationParams.yearOrField = compareYear;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, yearOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.yearOrField = yearOrField;\r\n\r\n // If field contains a date, extract the year\r\n if (fieldValue instanceof Date) {\r\n compareYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareYear = fieldValue;\r\n } else {\r\n // Try to parse as date and extract year\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputYear = inputDate.getFullYear();\r\n\r\n if (inputYear <= compareYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min month rule - month must be >= given month or field (1-12)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const minMonthRule: SchemaRule<{\r\n monthOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minMonth\",\r\n description: \"The date month must be at least the given month or field\",\r\n defaultErrorMessage: \"The :input month must be at least :monthOrField\",\r\n async validate(value: Date, context) {\r\n const { monthOrField, scope = \"global\" } = this.context.options;\r\n let compareMonth: number;\r\n\r\n if (typeof monthOrField === \"number\") {\r\n compareMonth = monthOrField;\r\n this.context.translationParams.monthOrField = compareMonth;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, monthOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.monthOrField = monthOrField;\r\n\r\n // If field contains a date, extract the month\r\n if (fieldValue instanceof Date) {\r\n compareMonth = fieldValue.getMonth() + 1; // getMonth() returns 0-11\r\n } else if (typeof fieldValue === \"number\") {\r\n compareMonth = fieldValue;\r\n } else {\r\n // Try to parse as date and extract month\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputMonth = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n if (inputMonth >= compareMonth) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max month rule - month must be <= given month or field (1-12)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const maxMonthRule: SchemaRule<{\r\n monthOrField: Month | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxMonth\",\r\n description: \"The date month must be at most the given month or field\",\r\n defaultErrorMessage: \"The :input month must be at most :monthOrField\",\r\n async validate(value: Date, context) {\r\n const { monthOrField, scope = \"global\" } = this.context.options;\r\n let compareMonth: number;\r\n\r\n if (typeof monthOrField === \"number\") {\r\n compareMonth = monthOrField;\r\n this.context.translatableParams.monthOrField = MONTHS[monthOrField];\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, monthOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.monthOrField = monthOrField;\r\n\r\n // If field contains a date, extract the month\r\n if (fieldValue instanceof Date) {\r\n compareMonth = fieldValue.getMonth() + 1; // getMonth() returns 0-11\r\n } else if (typeof fieldValue === \"number\") {\r\n compareMonth = fieldValue;\r\n } else {\r\n // Try to parse as date and extract month\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputMonth = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n if (inputMonth <= compareMonth) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min day rule - day must be >= given day or field (1-31)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const minDayRule: SchemaRule<{\r\n dayOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minDay\",\r\n description: \"The date day must be at least the given day or field\",\r\n defaultErrorMessage: \"The :input day must be higher than :dayOrField\",\r\n async validate(value: Date, context) {\r\n const { dayOrField, scope = \"global\" } = this.context.options;\r\n let compareDay: number;\r\n\r\n if (typeof dayOrField === \"number\") {\r\n compareDay = dayOrField;\r\n this.context.translationParams.dayOrField = dayOrField;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dayOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.dayOrField = dayOrField;\r\n\r\n // If field contains a date, extract the day\r\n if (fieldValue instanceof Date) {\r\n compareDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareDay = fieldValue;\r\n } else {\r\n // Try to parse as date and extract day\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputDay = inputDate.getDate();\r\n\r\n if (inputDay >= compareDay) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max day rule - day must be <= given day or field (1-31)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const maxDayRule: SchemaRule<{\r\n dayOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxDay\",\r\n description: \"The date day must be at most the given day or field\",\r\n defaultErrorMessage: \"The :input day must be at most :dayOrField\",\r\n async validate(value: Date, context) {\r\n const { dayOrField, scope = \"global\" } = this.context.options;\r\n let compareDay: number;\r\n\r\n if (typeof dayOrField === \"number\") {\r\n compareDay = dayOrField;\r\n this.context.translationParams.dayOrField = dayOrField;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dayOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.dayOrField = dayOrField;\r\n\r\n // If field contains a date, extract the day\r\n if (fieldValue instanceof Date) {\r\n compareDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareDay = fieldValue;\r\n } else {\r\n // Try to parse as date and extract day\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputDay = inputDate.getDate();\r\n\r\n if (inputDay <= compareDay) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Within days rule - date must be within X days from now (past or future)\r\n */\r\nexport const withinDaysRule: SchemaRule<{ days: number }> = {\r\n name: \"withinDays\",\r\n defaultErrorMessage: \"The :input must be within :days days from now\",\r\n async validate(value: Date, context) {\r\n const now = new Date();\r\n const inputDate = new Date(value);\r\n const diffTime = Math.abs(inputDate.getTime() - now.getTime());\r\n const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));\r\n\r\n if (diffDays <= this.context.options.days) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.days = this.context.options.days;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Within past days rule - date must be within X days in the past\r\n */\r\nexport const withinPastDaysRule: SchemaRule<{ days: number }> = {\r\n name: \"withinPastDays\",\r\n defaultErrorMessage: \"The :input must be within the past :days days\",\r\n async validate(value: Date, context) {\r\n const now = new Date();\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate > now) {\r\n return invalidRule(this, context); // Must be in past\r\n }\r\n\r\n const diffTime = now.getTime() - inputDate.getTime();\r\n const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));\r\n\r\n if (diffDays <= this.context.options.days) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.days = this.context.options.days;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Within future days rule - date must be within X days in the future\r\n */\r\nexport const withinFutureDaysRule: SchemaRule<{ days: number }> = {\r\n name: \"withinFutureDays\",\r\n defaultErrorMessage: \"The :input must be within the next :days days\",\r\n async validate(value: Date, context) {\r\n const now = new Date();\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate < now) {\r\n return invalidRule(this, context); // Must be in future\r\n }\r\n\r\n const diffTime = inputDate.getTime() - now.getTime();\r\n const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));\r\n\r\n if (diffDays <= this.context.options.days) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.days = this.context.options.days;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Birthday rule - valid birthday (not in future, reasonable age)\r\n */\r\nexport const birthdayRule: SchemaRule<{ minAge?: number; maxAge?: number }> = {\r\n name: \"birthday\",\r\n defaultErrorMessage: \"The :input must be a valid birthday\",\r\n async validate(birthDate: Date, context) {\r\n const today = new Date();\r\n\r\n // Must not be in the future\r\n if (birthDate > today) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Calculate age\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n // Check minimum age (default: 0)\r\n const minAge = this.context.options.minAge ?? 0;\r\n if (age < minAge) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Check maximum age (default: 150)\r\n const maxAge = this.context.options.maxAge ?? 150;\r\n if (age > maxAge) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Between age rule - age must be between min and max years\r\n */\r\nexport const betweenAgeRule: SchemaRule<{ minAge: number; maxAge: number }> = {\r\n name: \"betweenAge\",\r\n defaultErrorMessage: \"Age must be between :minAge and :maxAge years\",\r\n async validate(value: Date, context) {\r\n const birthDate = new Date(value);\r\n const today = new Date();\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n const { minAge, maxAge } = this.context.options;\r\n\r\n if (age >= minAge && age <= maxAge) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minAge = minAge;\r\n this.context.translationParams.maxAge = maxAge;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Leap year rule - date must be in a leap year\r\n */\r\nexport const leapYearRule: SchemaRule = {\r\n name: \"leapYear\",\r\n defaultErrorMessage: \"The :input must be in a leap year\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const year = inputDate.getFullYear();\r\n\r\n // Leap year logic: divisible by 4, except century years unless divisible by 400\r\n const isLeapYear = (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\r\n\r\n if (isLeapYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Min width rule - image width validation\r\n */\r\nexport const minWidthRule: SchemaRule<{ minWidth: number }> = {\r\n name: \"minWidth\",\r\n defaultErrorMessage: \"The :input must be at least :minWidth pixels wide\",\r\n async validate(value: any, context) {\r\n const dimensions = await value.dimensions();\r\n\r\n if (dimensions.width >= this.context.options.minWidth) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minWidth = this.context.options.minWidth;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max width rule - image width validation\r\n */\r\nexport const maxWidthRule: SchemaRule<{ maxWidth: number }> = {\r\n name: \"maxWidth\",\r\n defaultErrorMessage: \"The :input must be at most :maxWidth pixels wide\",\r\n async validate(value: any, context) {\r\n const dimensions = await value.dimensions();\r\n\r\n if (dimensions.width <= this.context.options.maxWidth) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.maxWidth = this.context.options.maxWidth;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min height rule - image height validation\r\n */\r\nexport const minHeightRule: SchemaRule<{ minHeight: number }> = {\r\n name: \"minHeight\",\r\n defaultErrorMessage: \"The :input must be at least :minHeight pixels tall\",\r\n async validate(value: any, context) {\r\n const dimensions = await value.dimensions();\r\n\r\n if (dimensions.height >= this.context.options.minHeight) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minHeight = this.context.options.minHeight;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max height rule - image height validation\r\n */\r\nexport const maxHeightRule: SchemaRule<{ maxHeight: number }> = {\r\n name: \"maxHeight\",\r\n defaultErrorMessage: \"The :input must be at most :maxHeight pixels tall\",\r\n async validate(value: any, context) {\r\n const dimensions = await value.dimensions();\r\n\r\n if (dimensions.height <= this.context.options.maxHeight) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.maxHeight = this.context.options.maxHeight;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { humanizeSize, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Max file size rule\r\n */\r\nexport const maxFileSizeRule: SchemaRule<{ maxSize: number }> = {\r\n name: \"maxFileSize\",\r\n defaultErrorMessage: \"The :input must not exceed :maxSize\",\r\n async validate(value: any, context) {\r\n const size = typeof value.size === \"function\" ? await value.size() : value.size;\r\n\r\n if (size <= this.context.options.maxSize) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.maxSize = humanizeSize(this.context.options.maxSize);\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min file size rule\r\n */\r\nexport const minFileSizeRule: SchemaRule<{ minSize: number }> = {\r\n name: \"minFileSize\",\r\n defaultErrorMessage: \"The :input must be at least :minSize\",\r\n async validate(value: any, context) {\r\n const size = typeof value.size === \"function\" ? await value.size() : value.size;\r\n\r\n if (size >= this.context.options.minSize) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minSize = humanizeSize(this.context.options.minSize);\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Color validation regex patterns\r\n */\r\nconst colorValidationRegex = {\r\n hex: /^#([0-9a-f]{3}){1,2}$/i,\r\n rgb: /^rgb\\((\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d{1,3})\\)$/,\r\n rgba: /^rgba\\((\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d{1,3}),\\s*(0?\\.\\d+|1)\\)$/,\r\n hsl: /^hsl\\((\\d{1,3}),\\s*(\\d{1,3})%?,\\s*(\\d{1,3})%?\\)$/,\r\n};\r\n\r\n/**\r\n * Generic color rule - validates any color format\r\n */\r\nexport const colorRule: SchemaRule = {\r\n name: \"color\",\r\n defaultErrorMessage: \"The :input must be a valid color\",\r\n async validate(value: any, context) {\r\n const isValidColor =\r\n colorValidationRegex.hex.test(value) ||\r\n colorValidationRegex.rgb.test(value) ||\r\n colorValidationRegex.rgba.test(value) ||\r\n colorValidationRegex.hsl.test(value);\r\n\r\n if (isValidColor) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Hex color rule\r\n */\r\nexport const hexColorRule: SchemaRule = {\r\n name: \"hexColor\",\r\n defaultErrorMessage: \"The :input must be a valid hex color\",\r\n async validate(value: any, context) {\r\n if (colorValidationRegex.hex.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * RGB color rule\r\n */\r\nexport const rgbColorRule: SchemaRule = {\r\n name: \"rgbColor\",\r\n defaultErrorMessage: \"The :input must be a valid RGB color\",\r\n async validate(value: any, context) {\r\n if (colorValidationRegex.rgb.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * RGBA color rule\r\n */\r\nexport const rgbaColorRule: SchemaRule = {\r\n name: \"rgbaColor\",\r\n defaultErrorMessage: \"The :input must be a valid RGBA color\",\r\n async validate(value: any, context) {\r\n if (colorValidationRegex.rgba.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * HSL color rule\r\n */\r\nexport const hslColorRule: SchemaRule = {\r\n name: \"hslColor\",\r\n defaultErrorMessage: \"The :input must be a valid HSL color\",\r\n async validate(value: any, context) {\r\n if (colorValidationRegex.hsl.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Light color rule\r\n */\r\nexport const lightColorRule: SchemaRule = {\r\n name: \"lightColor\",\r\n defaultErrorMessage: \"The :input must be a light color\",\r\n async validate(value: any, context) {\r\n if (!colorValidationRegex.hex.test(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n const hex = value.replace(\"#\", \"\");\r\n const r = parseInt(hex.substring(0, 2), 16);\r\n const g = parseInt(hex.substring(2, 4), 16);\r\n const b = parseInt(hex.substring(4, 6), 16);\r\n const brightness = (r * 299 + g * 587 + b * 114) / 1000;\r\n\r\n if (brightness > 155) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Dark color rule\r\n */\r\nexport const darkColorRule: SchemaRule = {\r\n name: \"darkColor\",\r\n defaultErrorMessage: \"The :input must be a dark color\",\r\n async validate(value: any, context) {\r\n if (!colorValidationRegex.hex.test(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n const hex = value.replace(\"#\", \"\");\r\n const r = parseInt(hex.substring(0, 2), 16);\r\n const g = parseInt(hex.substring(2, 4), 16);\r\n const b = parseInt(hex.substring(4, 6), 16);\r\n const brightness = (r * 299 + g * 587 + b * 114) / 1000;\r\n\r\n if (brightness <= 155) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Required if rule - field is required if another field equals a specific value\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfRule: SchemaRule<{\r\n field: string;\r\n value: any;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIf\",\r\n description: \"The field is required if another field equals a specific value\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { value: expectedValue } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field equals the expected value\r\n if (isEmptyValue(value) && fieldValue === expectedValue) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if empty rule - field is required if another field is empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfEmptyRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfEmpty\",\r\n description: \"The field is required if :field is empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field is empty\r\n if (isEmptyValue(value) && isEmptyValue(fieldValue)) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if not empty rule - field is required if another field is not empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfNotEmptyRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfNotEmpty\",\r\n description: \"The field is required if :field is not empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field is not empty\r\n if (isEmptyValue(value) && !isEmptyValue(fieldValue)) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if in rule - field is required if another field's value is in the given array\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfInRule: SchemaRule<{\r\n field: string;\r\n values: any[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfIn\",\r\n description: \"The field is required if :field value is in the given array\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { values } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field's value is in the array\r\n if (isEmptyValue(value) && values.includes(fieldValue)) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translationParams.values = this.context.options.values.join(\", \");\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if not in rule - field is required if another field's value is NOT in the given array\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfNotInRule: SchemaRule<{\r\n field: string;\r\n values: any[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfNotIn\",\r\n description: \"The field is required if another field's value is NOT in the given array\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { values } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field's value is NOT in the array\r\n if (isEmptyValue(value) && !values.includes(fieldValue)) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translationParams.values = this.context.options.values.join(\", \");\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Get multiple field values based on scope\r\n */\r\nfunction getFieldsValues(\r\n rule: SchemaRule<{ fields: string[]; scope?: \"global\" | \"sibling\" }>,\r\n context: any,\r\n): any[] {\r\n const { fields, scope = \"global\" } = (rule as any).context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n return fields.map((field: string) => get(source, field));\r\n}\r\n\r\n/**\r\n * Required if all empty rule - field is required if ALL specified fields are empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfAllEmptyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfAllEmpty\",\r\n description: \"The field is required if all :fields are empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValues = getFieldsValues(this, context);\r\n\r\n // Field is required if ALL other fields are empty\r\n const allEmpty = fieldValues.every((v) => isEmptyValue(v));\r\n if (isEmptyValue(value) && allEmpty) {\r\n this.context.options.fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if any empty rule - field is required if ANY of the specified fields is empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfAnyEmptyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfAnyEmpty\",\r\n description: \"The field is required if any of the :fields is empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValues = getFieldsValues(this, context);\r\n\r\n // Field is required if ANY other field is empty\r\n const anyEmpty = fieldValues.some((v) => isEmptyValue(v));\r\n if (isEmptyValue(value) && anyEmpty) {\r\n this.context.options.fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if all not empty rule - field is required if ALL specified fields are NOT empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfAllNotEmptyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfAllNotEmpty\",\r\n description: \"The field is required if all :fields are not empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValues = getFieldsValues(this, context);\r\n\r\n // Field is required if ALL other fields are NOT empty\r\n const allNotEmpty = fieldValues.every((v) => !isEmptyValue(v));\r\n if (isEmptyValue(value) && allNotEmpty) {\r\n this.context.options.fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if any not empty rule - field is required if ANY of the specified fields is NOT empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfAnyNotEmptyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfAnyNotEmpty\",\r\n description: \"The field is required if any of the :fields is not empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValues = getFieldsValues(this, context);\r\n\r\n // Field is required if ANY other field is NOT empty\r\n const anyNotEmpty = fieldValues.some((v) => !isEmptyValue(v));\r\n if (isEmptyValue(value) && anyNotEmpty) {\r\n this.context.options.fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport { isEmptyValue } from \"./../../helpers/is-empty-value\";\r\n\r\n/**\r\n * Required unless rule - field is required unless another field equals a specific value\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredUnlessRule: SchemaRule<{\r\n field: string;\r\n value: any;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredUnless\",\r\n description: \"The field is required unless another field equals a specific value\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { value: expectedValue } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required unless the other field equals the expected value\r\n if (isEmptyValue(value) && fieldValue !== expectedValue) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translationParams.value = this.context.options.value;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\nimport type { SchemaContext, SchemaRule } from \"../../types\";\n\n/**\n * Required when callback returns true.\n *\n * The callback receives only the SchemaContext (not the value),\n * because \"required\" is about surrounding conditions, not the field itself.\n *\n * @example\n * ```ts\n * v.string().requiredWhen((context) => {\n * return context.allData.notificationMethod === 'email';\n * })\n * ```\n */\nexport const requiredWhenRule: SchemaRule<{\n callback: (context: SchemaContext) => boolean | Promise<boolean>;\n}> = {\n name: \"requiredWhen\",\n defaultErrorMessage: \"The :input is required\",\n requiresValue: false,\n sortOrder: -2,\n async validate(value, context) {\n const shouldBeRequired = await this.context.options.callback?.(context);\n\n if (shouldBeRequired && isEmptyValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n","import { get } from \"@mongez/reinforcements\";\r\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Required with rule - field is required if another field is present\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWith\",\r\n description: \"The field is required if another field is present\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field is present\r\n if (isEmptyValue(value) && fieldValue !== undefined) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required with all rule - field is required if all specified fields are present\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithAllRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWithAll\",\r\n description: \"The field is required if all specified fields are present\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if all fields are present\r\n const allPresent = fields.every((field) => get(source, field) !== undefined);\r\n\r\n // Field is required if all other fields are present\r\n if (isEmptyValue(value) && allPresent) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required with any rule - field is required if any of the specified fields is present\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithAnyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWithAny\",\r\n description: \"The field is required if any of the specified fields is present\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if any field is present\r\n const anyPresent = fields.some((field) => get(source, field) !== undefined);\r\n\r\n // Field is required if any other field is present\r\n if (isEmptyValue(value) && anyPresent) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport { isEmptyValue } from \"./../../helpers/is-empty-value\";\r\n\r\n/**\r\n * Required without rule - field is required if another field is missing\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithoutRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWithout\",\r\n description: \"The field is required if another field is missing\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field is missing\r\n if (isEmptyValue(value) && fieldValue === undefined) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required without all rule - field is required if all specified fields are missing\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithoutAllRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWithoutAll\",\r\n description: \"The field is required if all specified fields are missing\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if all fields are missing\r\n const allMissing = fields.every((field) => get(source, field) === undefined);\r\n\r\n // Field is required if all other fields are missing\r\n if (isEmptyValue(value) && allMissing) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required without any rule - field is required if any of the specified fields is missing\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithoutAnyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWithoutAny\",\r\n description: \"The field is required if any of the specified fields is missing\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if any field is missing\r\n const anyMissing = fields.some((field) => get(source, field) === undefined);\r\n\r\n // Field is required if any other field is missing\r\n if (isEmptyValue(value) && anyMissing) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport { isEmptyValue } from \"./../../helpers/is-empty-value\";\r\n\r\n/**\r\n * Present if rule - field must be present if another field equals a specific value\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentIfRule: SchemaRule<{\r\n field: string;\r\n value: any;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentIf\",\r\n description: \"The field must be present if another field equals a specific value\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { value: expectedValue } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field must be present if the other field equals the expected value\r\n if (value === undefined && fieldValue === expectedValue) {\r\n this.context.translationParams.value = expectedValue;\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present if empty rule - field must be present if another field is empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentIfEmptyRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentIfEmpty\",\r\n description: \"The field must be present if another field is empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field must be present if the other field is empty\r\n if (value === undefined && isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present if not empty rule - field must be present if another field is not empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentIfNotEmptyRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentIfNotEmpty\",\r\n description: \"The field must be present if another field is not empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field must be present if the other field is not empty\r\n if (value === undefined && !isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present if in rule - field must be present if another field's value is in the given array\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentIfInRule: SchemaRule<{\r\n field: string;\r\n values: any[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentIfIn\",\r\n description: \"The field must be present if another field's value is in the given array\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { values } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field must be present if the other field's value is in the array\r\n if (value === undefined && values.includes(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present if not in rule - field must be present if another field's value is NOT in the given array\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentIfNotInRule: SchemaRule<{\r\n field: string;\r\n values: any[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentIfNotIn\",\r\n description: \"The field must be present if another field's value is NOT in the given array\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { values } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field must be present if the other field's value is NOT in the array\r\n if (value === undefined && !values.includes(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Present unless rule - field must be present unless another field equals a specific value\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentUnlessRule: SchemaRule<{\r\n field: string;\r\n value: any;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentUnless\",\r\n description: \"The field must be present unless another field equals a specific value\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { value: expectedValue } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field must be present unless the other field equals the expected value\r\n if (value === undefined && fieldValue !== expectedValue) {\r\n this.context.translationParams.value = expectedValue;\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Present with rule - field must be present if another field is present\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentWithRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentWith\",\r\n description: \"The field must be present if another field is present\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // The field must be present if the other field is present\r\n if (value === undefined && fieldValue !== undefined) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present with all rule - field must be present if all specified fields are present\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentWithAllRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentWithAll\",\r\n description: \"The field must be present if all specified fields are present\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if all fields are present\r\n const allPresent = fields.every((field) => get(source, field) !== undefined);\r\n\r\n // Field must be present if all other fields are present\r\n if (value === undefined && allPresent) {\r\n fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present with any rule - field must be present if any of the specified fields is present\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentWithAnyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentWithAny\",\r\n description: \"The field must be present if any of the specified fields is present\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if any field is present\r\n const anyPresent = fields.some((field) => get(source, field) !== undefined);\r\n\r\n // Field must be present if any other field is present\r\n if (value === undefined && anyPresent) {\r\n fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Present without rule - field must be present if another field is missing\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentWithoutRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentWithout\",\r\n description: \"The field must be present if another field is missing\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field must be present if the other field is missing\r\n if (value === undefined && fieldValue === undefined) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present without all rule - field must be present if all specified fields are missing\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentWithoutAllRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentWithoutAll\",\r\n description: \"The field must be present if all specified fields are missing\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if all fields are missing\r\n const allMissing = fields.every((field) => get(source, field) === undefined);\r\n\r\n // Field must be present if all other fields are missing\r\n if (value === undefined && allMissing) {\r\n fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present without any rule - field must be present if any of the specified fields is missing\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentWithoutAnyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentWithoutAny\",\r\n description: \"The field must be present if any of the specified fields is missing\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if any field is missing\r\n const anyMissing = fields.some((field) => get(source, field) === undefined);\r\n\r\n // Field must be present if any other field is missing\r\n if (value === undefined && anyMissing) {\r\n fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Forbidden if rule - field is forbidden if another field equals a specific value\r\n * Supports both global and sibling scope\r\n */\r\nexport const forbiddenIfRule: SchemaRule<{\r\n field: string;\r\n value: any;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"forbiddenIf\",\r\n description: \"The field is forbidden if another field equals a specific value\",\r\n sortOrder: -2,\r\n defaultErrorMessage: \"The :input is forbidden\",\r\n async validate(value: any, context) {\r\n const { value: expectedValue } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is forbidden if it has a value and the other field equals the expected value\r\n if (!isEmptyValue(value) && fieldValue === expectedValue) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translationParams.value = expectedValue;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Forbidden if not rule - field is forbidden if another field does NOT equal a specific value\r\n * Supports both global and sibling scope\r\n */\r\nexport const forbiddenIfNotRule: SchemaRule<{\r\n field: string;\r\n value: any;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"forbiddenIfNot\",\r\n description: \"The field is forbidden if another field does NOT equal a specific value\",\r\n sortOrder: -2,\r\n defaultErrorMessage: \"The :input is forbidden\",\r\n async validate(value: any, context) {\r\n const { value: expectedValue } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is forbidden if it has a value and the other field does NOT equal the expected value\r\n if (!isEmptyValue(value) && fieldValue !== expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Forbidden if empty rule - field is forbidden if another field is empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const forbiddenIfEmptyRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"forbiddenIfEmpty\",\r\n description: \"The field is forbidden if another field is empty\",\r\n sortOrder: -2,\r\n defaultErrorMessage: \"The :input is forbidden\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is forbidden if it has a value and the other field is empty\r\n if (!isEmptyValue(value) && isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Forbidden if not empty rule - field is forbidden if another field is not empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const forbiddenIfNotEmptyRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"forbiddenIfNotEmpty\",\r\n description: \"The field is forbidden if another field is not empty\",\r\n sortOrder: -2,\r\n defaultErrorMessage: \"The :input is forbidden\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is forbidden if it has a value and the other field is not empty\r\n if (!isEmptyValue(value) && !isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Forbidden if in rule - field is forbidden if another field's value is in the given array\r\n * Supports both global and sibling scope\r\n */\r\nexport const forbiddenIfInRule: SchemaRule<{\r\n field: string;\r\n values: any[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"forbiddenIfIn\",\r\n description: \"The field is forbidden if another field's value is in the given array\",\r\n sortOrder: -2,\r\n defaultErrorMessage: \"The :input is forbidden\",\r\n async validate(value: any, context) {\r\n const { values } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is forbidden if it has a value and the other field's value is in the array\r\n if (!isEmptyValue(value) && values.includes(fieldValue)) {\r\n this.context.translationParams.values = values.join(\", \");\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Forbidden if not in rule - field is forbidden if another field's value is NOT in the given array\r\n * Supports both global and sibling scope\r\n */\r\nexport const forbiddenIfNotInRule: SchemaRule<{\r\n field: string;\r\n values: any[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"forbiddenIfNotIn\",\r\n description: \"The field is forbidden if another field's value is NOT in the given array\",\r\n sortOrder: -2,\r\n defaultErrorMessage: \"The :input is forbidden\",\r\n async validate(value: any, context) {\r\n const { values } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is forbidden if it has a value and the other field's value is NOT in the array\r\n if (!isEmptyValue(value) && !values.includes(fieldValue)) {\r\n this.context.translationParams.values = values.join(\", \");\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { invalidRule, resolveTranslation, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Enum rule - value must be one of the enum values\r\n */\r\nexport const enumRule: SchemaRule<{ enum: any }> = {\r\n name: \"enum\",\r\n defaultErrorMessage: \"The :input must be one of the following values: :enum\",\r\n async validate(value: any, context) {\r\n const enumValues = this.context.options.enum;\r\n\r\n if (enumValues.includes(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Translate each enum value individually, then join into a display string\r\n this.context.translationParams.enum = enumValues\r\n .map((v: any) =>\r\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\r\n )\r\n .join(\", \");\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * In rule - value must be in the given array\r\n */\r\nexport const inRule: SchemaRule<{ values: any[] }> = {\r\n name: \"in\",\r\n defaultErrorMessage: \"The :input must be one of the following values: :values\",\r\n async validate(value: any, context) {\r\n if (this.context.options.values.includes(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Translate each value individually, then join\r\n this.context.translationParams.values = this.context.options.values\r\n .map((v: any) =>\r\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\r\n )\r\n .join(\", \");\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Allowed values rule - value must be one of allowed values\r\n */\r\nexport const allowedValuesRule: SchemaRule<{ allowedValues: any[] }> = {\r\n name: \"allowedValues\",\r\n defaultErrorMessage: \"The :input must be one of the allowed values\",\r\n async validate(value: any, context) {\r\n if (this.context.options.allowedValues.includes(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Translate each value individually, then join\r\n this.context.translationParams.allowedValues = this.context.options.allowedValues\r\n .map((v: any) =>\r\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\r\n )\r\n .join(\", \");\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Not allowed values rule - value must not be in forbidden list\r\n */\r\nexport const notAllowedValuesRule: SchemaRule<{ notAllowedValues: any[] }> = {\r\n name: \"notAllowedValues\",\r\n defaultErrorMessage: \"The :input contains a forbidden value\",\r\n async validate(value: any, context) {\r\n if (!this.context.options.notAllowedValues.includes(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Translate each value individually, then join\r\n this.context.translationParams.notAllowedValues = this.context.options.notAllowedValues\r\n .map((v: any) =>\r\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\r\n )\r\n .join(\", \");\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Equals field rule - value must equal another field's value\r\n * Supports both global and sibling scope\r\n */\r\nexport const equalsFieldRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"equalsField\",\r\n description: \"The value must equal another field's value\",\r\n sortOrder: -1,\r\n requiresValue: true,\r\n defaultErrorMessage: \"The :input must match the :field field\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Value must equal the other field's value\r\n if (value !== fieldValue) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Not equals field rule - value must NOT equal another field's value\r\n * Supports both global and sibling scope\r\n */\r\nexport const notEqualsFieldRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"notEqualsField\",\r\n description: \"The value must NOT equal another field's value\",\r\n sortOrder: -1,\r\n requiresValue: true,\r\n defaultErrorMessage: \"The :input must not match the :field field\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Value must NOT equal the other field's value\r\n if (value === fieldValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * InstanceOf rule - value must be an instance of the given constructor.\n *\n * Uses the `instanceof` operator at runtime. Useful for class instances\n * not representable in JSON Schema (File, Buffer, custom domain classes).\n */\nexport const instanceofRule: SchemaRule<{ ctor: new (...args: any[]) => any; name: string }> = {\n name: \"instanceof\",\n defaultErrorMessage: \"The :input must be an instance of :name\",\n async validate(value: any, context) {\n if (value instanceof this.context.options.ctor) {\n return VALID_RULE;\n }\n\n this.context.translationParams.name = this.context.options.name;\n\n return invalidRule(this, context);\n },\n};\n","import { invalidRule, resolveTranslation, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Literal rule - value must be strictly equal to one of the literal values.\n *\n * Uses === (referential / strict equality), so distinguishes 1 from \"1\",\n * true from \"true\", etc. Mirrors `v.string().oneOf([...])` but at the\n * literal type level (TypeScript narrows to the union of literals).\n */\nexport const literalRule: SchemaRule<{ values: readonly (string | number | boolean)[] }> = {\n name: \"literal\",\n defaultErrorMessage: \"The :input must be one of the following values: :values\",\n async validate(value: any, context) {\n if (this.context.options.values.includes(value)) {\n return VALID_RULE;\n }\n\n this.context.translationParams.values = this.context.options.values\n .map(v =>\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\n )\n .join(\", \");\n\n return invalidRule(this, context);\n },\n};\n","import { isObject, isPlainObject } from \"@mongez/supportive-is\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * String rule - validates string type\r\n */\r\nexport const stringRule: SchemaRule = {\r\n name: \"string\",\r\n defaultErrorMessage: \"The :input must be a string\",\r\n async validate(value: any, context) {\r\n if (typeof value === \"string\") {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Number rule - validates number type\r\n */\r\nexport const numberRule: SchemaRule = {\r\n name: \"number\",\r\n defaultErrorMessage: \"The :input must be a number\",\r\n async validate(value: any, context) {\r\n if (typeof value === \"number\") {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Boolean rule - validates boolean type\r\n */\r\nexport const booleanRule: SchemaRule = {\r\n name: \"boolean\",\r\n defaultErrorMessage: \"The :input must be a boolean\",\r\n async validate(value: any, context) {\r\n if (typeof value === \"boolean\") {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Int rule - validates integer type\r\n */\r\nexport const intRule: SchemaRule = {\r\n name: \"int\",\r\n defaultErrorMessage: \"The :input must be an integer\",\r\n async validate(value: any, context) {\r\n if (Number.isInteger(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Float rule - validates float type\r\n */\r\nexport const floatRule: SchemaRule = {\r\n name: \"float\",\r\n defaultErrorMessage: \"The :input must be a float\",\r\n async validate(value: any, context) {\r\n if (Number.isFinite(value) && !Number.isInteger(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Scalar rule - validates scalar value (string, number, or boolean)\r\n */\r\nexport const scalarRule: SchemaRule = {\r\n name: \"scalar\",\r\n defaultErrorMessage: \"The :input must be a scalar value\",\r\n async validate(value: any, context) {\r\n if ([\"string\", \"number\", \"boolean\"].includes(typeof value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Object rule - validates object type\r\n */\r\nexport const objectRule: SchemaRule = {\r\n name: \"object\",\r\n defaultErrorMessage: \"The :input must be an object\",\r\n async validate(value: any, context) {\r\n if (!!isObject(value) && value !== null) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Object rule - validates object type\r\n */\r\nexport const plainObjectRule: SchemaRule = {\r\n name: \"plainObject\",\r\n defaultErrorMessage: \"The :input must be an object\",\r\n async validate(value: any, context) {\r\n if (!!isPlainObject(value) && value !== null) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Array rule - validates array type\r\n */\r\nexport const arrayRule: SchemaRule = {\r\n name: \"array\",\r\n defaultErrorMessage: \"The :input must be an array\",\r\n async validate(value: any, context) {\r\n if (Array.isArray(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { Schema, SchemaRule } from \"../../types\";\n\n/**\n * Unknown key rule - validates that object doesn't have unknown keys\n */\nexport const unknownKeyRule: SchemaRule<{\n schema: Schema;\n allowedKeys: string[];\n}> = {\n name: \"unknownKeys\",\n defaultErrorMessage: \"The :input contains unknown keys: :unknownKeys\",\n async validate(value: any, context) {\n const schema = this.context.options.schema;\n const allowedKeys = [...Object.keys(schema), ...(this.context.options.allowedKeys || [])];\n\n const unknownKeys = Object.keys(value).filter((key) => !allowedKeys.includes(key));\n\n if (unknownKeys.length > 0) {\n this.context.translationParams.unknownKeys = unknownKeys.join(\", \");\n\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n","import { setKeyPath } from \"../helpers\";\r\nimport { flipArrayMutator, sortArrayMutator, uniqueArrayMutator } from \"../mutators\";\r\nimport {\r\n arrayRule,\r\n betweenLengthRule,\r\n lengthRule,\r\n maxLengthRule,\r\n minLengthRule,\r\n sortedArrayRule,\r\n uniqueArrayRule,\r\n} from \"../rules\";\r\nimport type { SchemaContext, ValidationResult } from \"../types\";\r\nimport { BaseValidator } from \"./base-validator\";\r\nimport { applyNullable, getRuleOptions } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Array validator class\r\n */\r\nexport class ArrayValidator extends BaseValidator {\r\n public constructor(\r\n public validator: BaseValidator,\r\n errorMessage?: string,\r\n ) {\r\n super();\r\n this.addMutableRule(arrayRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is an array type\r\n */\r\n public matchesType(value: any): boolean {\r\n return Array.isArray(value);\r\n }\r\n\r\n /**\r\n * Clone the validator\r\n */\r\n public override clone(): this {\r\n const cloned = super.clone();\r\n\r\n cloned.validator = this.validator.clone();\r\n\r\n return cloned;\r\n }\r\n\r\n /** Reverse array order */\r\n public flip() {\r\n return this.addMutator(flipArrayMutator);\r\n }\r\n\r\n /** Reverse array order (alias) */\r\n public reverse() {\r\n return this.addMutator(flipArrayMutator);\r\n }\r\n\r\n /** Make it has only unique values */\r\n public onlyUnique() {\r\n return this.addMutator(uniqueArrayMutator);\r\n }\r\n\r\n /** Sort array */\r\n public sort(direction: \"asc\" | \"desc\" = \"asc\", key?: string) {\r\n return this.addMutator(sortArrayMutator, { direction, key });\r\n }\r\n\r\n /** Array length must be greater than the given length */\r\n public minLength(length: number, errorMessage?: string) {\r\n return this.addRule(minLengthRule, errorMessage, { minLength: length });\r\n }\r\n\r\n /** Array length must be less than the given length */\r\n public maxLength(length: number, errorMessage?: string) {\r\n return this.addRule(maxLengthRule, errorMessage, { maxLength: length });\r\n }\r\n\r\n /** Array length must be of the given length */\r\n public length(length: number, errorMessage?: string) {\r\n return this.addRule(lengthRule, errorMessage, { length });\r\n }\r\n\r\n /**\r\n * Array length must be between min and max (inclusive)\r\n *\r\n * @param min - Minimum length (inclusive)\r\n * @param max - Maximum length (inclusive)\r\n *\r\n * @example\r\n * ```ts\r\n * v.array(v.string()).between(1, 10) // Array must have 1 to 10 items\r\n * v.array(v.number()).lengthBetween(5, 20) // Same using alias\r\n * ```\r\n *\r\n * @category Validation Rule\r\n */\r\n public between(min: number, max: number, errorMessage?: string) {\r\n return this.addRule(betweenLengthRule, errorMessage, {\r\n minLength: min,\r\n maxLength: max,\r\n });\r\n }\r\n\r\n /**\r\n * Alias for between() - array length between min and max\r\n */\r\n public lengthBetween(min: number, max: number, errorMessage?: string) {\r\n return this.between(min, max, errorMessage);\r\n }\r\n\r\n /** Array must have unique values */\r\n public unique(errorMessage?: string) {\r\n return this.addRule(uniqueArrayRule, errorMessage);\r\n }\r\n\r\n /** Array must be sorted */\r\n public sorted(direction: \"asc\" | \"desc\" = \"asc\", errorMessage?: string) {\r\n return this.addRule(sortedArrayRule, errorMessage, { direction });\r\n }\r\n\r\n /** Mutate the data */\r\n public mutate(data: any, context: SchemaContext) {\r\n if (!Array.isArray(data)) return data;\r\n return super.mutate([...data], context);\r\n }\r\n\r\n /** Validate array\r\n *\r\n * Absent input (and absent without `.default()`) propagates as `data: undefined`\r\n * so the parent ObjectValidator can omit the key. Without this, optional array\r\n * fields would silently materialise as `[]` in the validated output.\r\n */\r\n public async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\r\n // Apply default when absent, then mutate. Mirrors BaseValidator's\r\n // `valueForRules = data ?? this.getDefaultValue()` so `.default([...])`\r\n // works on arrays too.\r\n const valueForRules = data ?? this.getDefaultValue();\r\n const mutatedData = await this.mutate(valueForRules, context);\r\n\r\n const result = await super.validate(data, context);\r\n\r\n if (result.isValid === false) return result;\r\n\r\n // Nothing to iterate for absent (no default) or null (nullable) inputs —\r\n // propagate so the parent ObjectValidator can omit the key.\r\n if (mutatedData === undefined || mutatedData === null) return result;\r\n\r\n // Defensive: type rule (arrayRule) should have failed for non-arrays.\r\n if (!Array.isArray(mutatedData)) return result;\r\n\r\n const errors: ValidationResult[\"errors\"] = [];\r\n\r\n // Validate all items in parallel (consistent with ObjectValidator)\r\n const validationPromises = mutatedData.map(async (value: any, index: number) => {\r\n const childContext: SchemaContext = {\r\n ...context,\r\n parent: mutatedData,\r\n value,\r\n key: index.toString(),\r\n path: setKeyPath(context.path, index.toString()),\r\n };\r\n\r\n const childResult = await this.validator.validate(value, childContext);\r\n\r\n // Update mutated data with validated result\r\n mutatedData[index] = childResult.data;\r\n\r\n // Collect errors from this element\r\n if (childResult.isValid === false) {\r\n errors.push(...childResult.errors);\r\n }\r\n });\r\n\r\n await Promise.all(validationPromises);\r\n\r\n return {\r\n isValid: errors.length === 0,\r\n errors,\r\n data: await this.startTransformationPipeline(mutatedData, context),\r\n };\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Recursively generates JSON Schema for the array items.\r\n *\r\n * @example\r\n * ```ts\r\n * v.array(v.string().min(1)).minLength(1).toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"array\", items: { type: \"string\", minLength: 1 }, minItems: 1 }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const schema: JsonSchemaResult = {\r\n type: \"array\",\r\n items: this.validator.toJsonSchema(target),\r\n };\r\n\r\n const minOpts = getRuleOptions(this.rules, \"minLength\");\r\n if (minOpts?.minLength !== undefined) schema.minItems = minOpts.minLength;\r\n\r\n const maxOpts = getRuleOptions(this.rules, \"maxLength\");\r\n if (maxOpts?.maxLength !== undefined) schema.maxItems = maxOpts.maxLength;\r\n\r\n const betweenOpts = getRuleOptions(this.rules, \"betweenLength\");\r\n if (betweenOpts) {\r\n if (betweenOpts.minLength !== undefined) schema.minItems = betweenOpts.minLength;\r\n if (betweenOpts.maxLength !== undefined) schema.maxItems = betweenOpts.maxLength;\r\n }\r\n\r\n const lengthOpts = getRuleOptions(this.rules, \"length\");\r\n if (lengthOpts?.length !== undefined) {\r\n schema.minItems = lengthOpts.length;\r\n schema.maxItems = lengthOpts.length;\r\n }\r\n\r\n if (this.isNullable) applyNullable(schema, target);\r\n\r\n return schema;\r\n }\r\n}\r\n","import { equalsFieldRule, notEqualsFieldRule } from \"../../rules\";\r\nimport { equalRule } from \"../../rules/core/equal\";\r\nimport { whenRule } from \"../../rules/core/when\";\r\nimport type { WhenRuleOptions } from \"../../types\";\r\nimport { BaseValidator } from \"../base-validator\";\r\n\r\ndeclare module \"../base-validator\" {\r\n interface BaseValidator {\r\n /**\r\n * Value must be equal to the given value\r\n */\r\n equal(value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value must be the same as another field's value\r\n */\r\n sameAs(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value must be the same as another sibling field's value\r\n */\r\n sameAsSibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value must be different from another field's value\r\n */\r\n differentFrom(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value must be different from another sibling field's value\r\n */\r\n differentFromSibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Apply different validation rules based on another field's value (global scope)\r\n *\r\n * Use this when you need to apply completely different validators\r\n * based on another field's value (not just required/optional).\r\n *\r\n * @param field - Field name to check (can be nested with dot notation)\r\n * @param options - Validation options per field value\r\n *\r\n * @example\r\n * ```ts\r\n * // Different allowed values based on user type\r\n * v.object({\r\n * userType: v.string().in(['admin', 'user']),\r\n * role: v.string().when('userType', {\r\n * is: {\r\n * admin: v.string().in(['super', 'moderator']),\r\n * user: v.string().in(['member', 'guest'])\r\n * },\r\n * otherwise: v.string().optional()\r\n * })\r\n * })\r\n *\r\n * // Different validation rules based on type\r\n * v.object({\r\n * contactType: v.string().in(['email', 'phone']),\r\n * contact: v.string().when('contactType', {\r\n * is: {\r\n * email: v.string().email(),\r\n * phone: v.string().pattern(/^\\d{10}$/)\r\n * }\r\n * })\r\n * })\r\n * ```\r\n * @category Conditional Validation\r\n */\r\n when(field: string, options: Omit<WhenRuleOptions, \"field\" | \"scope\">): this;\r\n\r\n /**\r\n * Apply different validation rules based on sibling field's value\r\n *\r\n * Use this for nested objects where you need to check a field\r\n * within the same parent object.\r\n *\r\n * @param siblingField - Sibling field name to check\r\n * @param options - Validation options per field value\r\n *\r\n * @example\r\n * ```ts\r\n * // Array of users with role-based permissions\r\n * v.array(v.object({\r\n * userType: v.string().in(['admin', 'user']),\r\n * permissions: v.string().whenSibling('userType', {\r\n * is: {\r\n * admin: v.string().in(['read', 'write', 'delete']),\r\n * user: v.string().in(['read'])\r\n * }\r\n * })\r\n * }))\r\n * ```\r\n * @category Conditional Validation\r\n */\r\n whenSibling(siblingField: string, options: Omit<WhenRuleOptions, \"field\" | \"scope\">): this;\r\n }\r\n}\r\n\r\n/**\r\n * Value must be equal to the given value\r\n */\r\nBaseValidator.prototype.equal = function (value: any, errorMessage?: string) {\r\n return this.addRule(equalRule, errorMessage, { value });\r\n};\r\n\r\n/**\r\n * Value must be the same as another field's value\r\n */\r\nBaseValidator.prototype.sameAs = function (field: string, errorMessage?: string) {\r\n return this.addRule(equalsFieldRule, errorMessage, {\r\n field,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value must be the same as another sibling field's value\r\n */\r\nBaseValidator.prototype.sameAsSibling = function (field: string, errorMessage?: string) {\r\n return this.addRule(equalsFieldRule, errorMessage, {\r\n field,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value must be different from another field's value\r\n */\r\nBaseValidator.prototype.differentFrom = function (field: string, errorMessage?: string) {\r\n return this.addRule(notEqualsFieldRule, errorMessage, {\r\n field,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value must be different from another sibling field's value\r\n */\r\nBaseValidator.prototype.differentFromSibling = function (field: string, errorMessage?: string) {\r\n return this.addRule(notEqualsFieldRule, errorMessage, {\r\n field,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Apply different validation rules based on another field's value (global scope)\r\n *\r\n * Use this when you need to apply completely different validators\r\n * based on another field's value (not just required/optional).\r\n *\r\n * @param field - Field name to check (can be nested with dot notation)\r\n * @param options - Validation options per field value\r\n *\r\n * @example\r\n * ```ts\r\n * // Different allowed values based on user type\r\n * v.object({\r\n * userType: v.string().in(['admin', 'user']),\r\n * role: v.string().when('userType', {\r\n * is: {\r\n * admin: v.string().in(['super', 'moderator']),\r\n * user: v.string().in(['member', 'guest'])\r\n * },\r\n * otherwise: v.string().optional()\r\n * })\r\n * })\r\n *\r\n * // Different validation rules based on type\r\n * v.object({\r\n * contactType: v.string().in(['email', 'phone']),\r\n * contact: v.string().when('contactType', {\r\n * is: {\r\n * email: v.string().email(),\r\n * phone: v.string().pattern(/^\\d{10}$/)\r\n * }\r\n * })\r\n * })\r\n * ```\r\n * @category Conditional Validation\r\n */\r\nBaseValidator.prototype.when = function (\r\n field: string,\r\n options: Omit<WhenRuleOptions, \"field\" | \"scope\">,\r\n) {\r\n return this.addRule(whenRule, undefined, {\r\n field,\r\n is: options.is,\r\n otherwise: options.otherwise,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Apply different validation rules based on sibling field's value\r\n *\r\n * Use this for nested objects where you need to check a field\r\n * within the same parent object.\r\n *\r\n * @param siblingField - Sibling field name to check\r\n * @param options - Validation options per field value\r\n *\r\n * @example\r\n * ```ts\r\n * // Array of users with role-based permissions\r\n * v.array(v.object({\r\n * userType: v.string().in(['admin', 'user']),\r\n * permissions: v.string().whenSibling('userType', {\r\n * is: {\r\n * admin: v.string().in(['read', 'write', 'delete']),\r\n * user: v.string().in(['read'])\r\n * }\r\n * })\r\n * }))\r\n * ```\r\n * @category Conditional Validation\r\n */\r\nBaseValidator.prototype.whenSibling = function (\r\n siblingField: string,\r\n options: Omit<WhenRuleOptions, \"field\" | \"scope\">,\r\n) {\r\n return this.addRule(whenRule, undefined, {\r\n field: siblingField,\r\n is: options.is,\r\n otherwise: options.otherwise,\r\n scope: \"sibling\",\r\n });\r\n};\r\n","import {\r\n forbiddenIfEmptyRule,\r\n forbiddenIfInRule,\r\n forbiddenIfNotEmptyRule,\r\n forbiddenIfNotInRule,\r\n forbiddenIfNotRule,\r\n forbiddenIfRule,\r\n} from \"../../rules/conditional/forbidden-if-rules\";\r\nimport { forbiddenRule } from \"../../rules/core/forbidden\";\r\nimport { BaseValidator } from \"../base-validator\";\r\n\r\ndeclare module \"../base-validator\" {\r\n interface BaseValidator {\r\n /**\r\n * Value is forbidden to be present\r\n */\r\n forbidden(errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field equals a specific value (global scope)\r\n */\r\n forbiddenIf(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field equals a specific value (sibling scope)\r\n */\r\n forbiddenIfSibling(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field does NOT equal a specific value (global scope)\r\n */\r\n forbiddenIfNot(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field does NOT equal a specific value (sibling scope)\r\n */\r\n forbiddenIfNotSibling(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field is empty (global scope)\r\n */\r\n forbiddenIfEmpty(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field is empty (sibling scope)\r\n */\r\n forbiddenIfEmptySibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field is not empty (global scope)\r\n */\r\n forbiddenIfNotEmpty(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field is not empty (sibling scope)\r\n */\r\n forbiddenIfNotEmptySibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field's value is in the given array (global scope)\r\n */\r\n forbiddenIfIn(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field's value is in the given array (sibling scope)\r\n */\r\n forbiddenIfInSibling(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field's value is NOT in the given array (global scope)\r\n */\r\n forbiddenIfNotIn(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field's value is NOT in the given array (sibling scope)\r\n */\r\n forbiddenIfNotInSibling(field: string, values: any[], errorMessage?: string): this;\r\n }\r\n}\r\n\r\n/**\r\n * Value is forbidden to be present\r\n */\r\nBaseValidator.prototype.forbidden = function (errorMessage?: string) {\r\n return this.addRule(forbiddenRule, errorMessage);\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field equals a specific value (global scope)\r\n */\r\nBaseValidator.prototype.forbiddenIf = function (field: string, value: any, errorMessage?: string) {\r\n return this.addRule(forbiddenIfRule, errorMessage, {\r\n field,\r\n value,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field equals a specific value (sibling scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfSibling = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfRule, errorMessage, {\r\n field,\r\n value,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field does NOT equal a specific value (global scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfNot = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfNotRule, errorMessage, {\r\n field,\r\n value,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field does NOT equal a specific value (sibling scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfNotSibling = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfNotRule, errorMessage, {\r\n field,\r\n value,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field is empty (global scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfEmpty = function (field: string, errorMessage?: string) {\r\n return this.addRule(forbiddenIfEmptyRule, errorMessage, {\r\n field,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field is empty (sibling scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfEmptySibling = function (field: string, errorMessage?: string) {\r\n return this.addRule(forbiddenIfEmptyRule, errorMessage, {\r\n field,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field is not empty (global scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfNotEmpty = function (field: string, errorMessage?: string) {\r\n return this.addRule(forbiddenIfNotEmptyRule, errorMessage, {\r\n field,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field is not empty (sibling scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfNotEmptySibling = function (\r\n field: string,\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfNotEmptyRule, errorMessage, {\r\n field,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field's value is in the given array (global scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfIn = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field's value is in the given array (sibling scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfInSibling = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field's value is NOT in the given array (global scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfNotIn = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfNotInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field's value is NOT in the given array (sibling scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfNotInSibling = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfNotInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"sibling\",\r\n });\r\n};\r\n","import {\r\n presentIfEmptyRule,\r\n presentIfInRule,\r\n presentIfNotEmptyRule,\r\n presentIfNotInRule,\r\n presentIfRule,\r\n} from \"../../rules/conditional/present-if-rules\";\r\nimport { presentUnlessRule } from \"../../rules/conditional/present-unless-rules\";\r\nimport {\r\n presentWithAllRule,\r\n presentWithAnyRule,\r\n presentWithRule,\r\n} from \"../../rules/conditional/present-with-rules\";\r\nimport {\r\n presentWithoutAllRule,\r\n presentWithoutAnyRule,\r\n presentWithoutRule,\r\n} from \"../../rules/conditional/present-without-rules\";\r\nimport { BaseValidator } from \"../base-validator\";\r\n\r\ndeclare module \"../base-validator\" {\r\n interface BaseValidator {\r\n /**\r\n * Field must be present if another field exists\r\n */\r\n presentWith(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another sibling field exists\r\n */\r\n presentWithSibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another field is missing\r\n */\r\n presentWithout(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another sibling field is missing\r\n */\r\n presentWithoutSibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another field equals a specific value\r\n */\r\n presentIf(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another sibling field equals a specific value\r\n */\r\n presentIfSibling(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present unless another field equals a specific value\r\n */\r\n presentUnless(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present unless another sibling field equals a specific value\r\n */\r\n presentUnlessSibling(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another field is empty\r\n */\r\n presentIfEmpty(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another sibling field is empty\r\n */\r\n presentIfEmptySibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another field is not empty\r\n */\r\n presentIfNotEmpty(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another sibling field is not empty\r\n */\r\n presentIfNotEmptySibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another field's value is in the given array\r\n */\r\n presentIfIn(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another sibling field's value is in the given array\r\n */\r\n presentIfInSibling(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another field's value is NOT in the given array\r\n */\r\n presentIfNotIn(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another sibling field's value is NOT in the given array\r\n */\r\n presentIfNotInSibling(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if all specified fields exist\r\n */\r\n presentWithAll(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if all specified sibling fields exist\r\n */\r\n presentWithAllSiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if all specified fields are missing\r\n */\r\n presentWithoutAll(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if all specified sibling fields are missing\r\n */\r\n presentWithoutAllSiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if any of the specified fields exists\r\n */\r\n presentWithAny(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if any of the specified sibling fields exists\r\n */\r\n presentWithAnySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if any of the specified fields is missing\r\n */\r\n presentWithoutAny(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if any of the specified sibling fields is missing\r\n */\r\n presentWithoutAnySiblings(fields: string[], errorMessage?: string): this;\r\n }\r\n}\r\n\r\n// ==================== PRESENT: BASED ON FIELD PRESENCE ====================\r\n\r\n/**\r\n * Field must be present if another field exists\r\n */\r\nBaseValidator.prototype.presentWith = function (field: string, errorMessage?: string) {\r\n return this.addRule(presentWithRule, errorMessage, {\r\n field,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if another sibling field exists\r\n */\r\nBaseValidator.prototype.presentWithSibling = function (field: string, errorMessage?: string) {\r\n return this.addRule(presentWithRule, errorMessage, {\r\n field,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if another field is missing\r\n */\r\nBaseValidator.prototype.presentWithout = function (field: string, errorMessage?: string) {\r\n return this.addRule(presentWithoutRule, errorMessage, {\r\n field,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if another sibling field is missing\r\n */\r\nBaseValidator.prototype.presentWithoutSibling = function (field: string, errorMessage?: string) {\r\n return this.addRule(presentWithoutRule, errorMessage, {\r\n field,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n// ==================== PRESENT: BASED ON FIELD VALUE ====================\r\n\r\n/**\r\n * Field must be present if another field equals a specific value\r\n */\r\nBaseValidator.prototype.presentIf = function (field: string, value: any, errorMessage?: string) {\r\n return this.addRule(presentIfRule, errorMessage, {\r\n field,\r\n value,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if another sibling field equals a specific value\r\n */\r\nBaseValidator.prototype.presentIfSibling = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(presentIfRule, errorMessage, {\r\n field,\r\n value,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present unless another field equals a specific value\r\n */\r\nBaseValidator.prototype.presentUnless = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(presentUnlessRule, errorMessage, {\r\n field,\r\n value,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present unless another sibling field equals a specific value\r\n */\r\nBaseValidator.prototype.presentUnlessSibling = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(presentUnlessRule, errorMessage, {\r\n field,\r\n value,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n// ==================== PRESENT: BASED ON FIELD EMPTY STATE ====================\r\n\r\n/**\r\n * Field must be present if another field is empty\r\n */\r\nBaseValidator.prototype.presentIfEmpty = function (field: string, errorMessage?: string) {\r\n return this.addRule(presentIfEmptyRule, errorMessage, {\r\n field,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if another sibling field is empty\r\n */\r\nBaseValidator.prototype.presentIfEmptySibling = function (field: string, errorMessage?: string) {\r\n return this.addRule(presentIfEmptyRule, errorMessage, {\r\n field,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if another field is not empty\r\n */\r\nBaseValidator.prototype.presentIfNotEmpty = function (field: string, errorMessage?: string) {\r\n return this.addRule(presentIfNotEmptyRule, errorMessage, {\r\n field,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if another sibling field is not empty\r\n */\r\nBaseValidator.prototype.presentIfNotEmptySibling = function (field: string, errorMessage?: string) {\r\n return this.addRule(presentIfNotEmptyRule, errorMessage, {\r\n field,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if another field's value is in the given array\r\n */\r\nBaseValidator.prototype.presentIfIn = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(presentIfInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if another sibling field's value is in the given array\r\n */\r\nBaseValidator.prototype.presentIfInSibling = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(presentIfInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if another field's value is NOT in the given array\r\n */\r\nBaseValidator.prototype.presentIfNotIn = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(presentIfNotInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if another sibling field's value is NOT in the given array\r\n */\r\nBaseValidator.prototype.presentIfNotInSibling = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(presentIfNotInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n// ==================== PRESENT: BASED ON MULTIPLE FIELDS (ALL) ====================\r\n\r\n/**\r\n * Field must be present if all specified fields exist\r\n */\r\nBaseValidator.prototype.presentWithAll = function (fields: string[], errorMessage?: string) {\r\n return this.addRule(presentWithAllRule, errorMessage, {\r\n fields,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if all specified sibling fields exist\r\n */\r\nBaseValidator.prototype.presentWithAllSiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(presentWithAllRule, errorMessage, {\r\n fields,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if all specified fields are missing\r\n */\r\nBaseValidator.prototype.presentWithoutAll = function (fields: string[], errorMessage?: string) {\r\n return this.addRule(presentWithoutAllRule, errorMessage, {\r\n fields,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if all specified sibling fields are missing\r\n */\r\nBaseValidator.prototype.presentWithoutAllSiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(presentWithoutAllRule, errorMessage, {\r\n fields,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n// ==================== PRESENT: BASED ON MULTIPLE FIELDS (ANY) ====================\r\n\r\n/**\r\n * Field must be present if any of the specified fields exists\r\n */\r\nBaseValidator.prototype.presentWithAny = function (fields: string[], errorMessage?: string) {\r\n return this.addRule(presentWithAnyRule, errorMessage, {\r\n fields,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if any of the specified sibling fields exists\r\n */\r\nBaseValidator.prototype.presentWithAnySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(presentWithAnyRule, errorMessage, {\r\n fields,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if any of the specified fields is missing\r\n */\r\nBaseValidator.prototype.presentWithoutAny = function (fields: string[], errorMessage?: string) {\r\n return this.addRule(presentWithoutAnyRule, errorMessage, {\r\n fields,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if any of the specified sibling fields is missing\r\n */\r\nBaseValidator.prototype.presentWithoutAnySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(presentWithoutAnyRule, errorMessage, {\r\n fields,\r\n scope: \"sibling\",\r\n });\r\n};\r\n","import {\r\n requiredIfAllEmptyRule,\r\n requiredIfAllNotEmptyRule,\r\n requiredIfAnyEmptyRule,\r\n requiredIfAnyNotEmptyRule,\r\n requiredIfEmptyRule,\r\n requiredIfInRule,\r\n requiredIfNotEmptyRule,\r\n requiredIfNotInRule,\r\n requiredIfRule,\r\n} from \"../../rules/conditional/required-if-rules\";\r\nimport { requiredUnlessRule } from \"../../rules/conditional/required-unless-rules\";\r\nimport { requiredWhenRule } from \"../../rules/conditional/required-when-rule\";\r\nimport {\r\n requiredWithAllRule,\r\n requiredWithAnyRule,\r\n requiredWithRule,\r\n} from \"../../rules/conditional/required-with-rules\";\r\nimport {\r\n requiredWithoutAllRule,\r\n requiredWithoutAnyRule,\r\n requiredWithoutRule,\r\n} from \"../../rules/conditional/required-without-rules\";\r\nimport { presentRule, requiredRule } from \"../../rules/core/required\";\r\nimport type { SchemaContext } from \"../../types\";\r\nimport { BaseValidator } from \"../base-validator\";\r\n\r\ndeclare module \"../base-validator\" {\r\n interface BaseValidator {\r\n /**\r\n * This value must be present and has a value\r\n */\r\n required(errorMessage?: string): this;\r\n\r\n /**\r\n * Value must be present but not necessarily has a value\r\n */\r\n present(errorMessage?: string): this;\r\n\r\n /**\r\n * Mark the field as optional, so pass it if it has no value or has a value\r\n * Because this is the default behavior, this method is just syntactic sugar\r\n */\r\n optional(): this & { isOptional: true };\r\n\r\n /**\r\n * Sugar for `.optional().nullable()` — the field may be absent OR null.\r\n *\r\n * Brands the return type with both `{ isOptional: true }` and `{ isNullable: true }`\r\n * so `Infer<>` produces `{ field?: T | null }`.\r\n *\r\n * @example\r\n * v.string().nullish()\r\n * // type: string | null | undefined\r\n * // absent → key omitted\r\n * // null → null\r\n * // \"x\" → \"x\"\r\n */\r\n nullish(): this & { isOptional: true; isNullable: true };\r\n\r\n /**\r\n * Value is required if another field exists\r\n */\r\n requiredWith(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field exists\r\n */\r\n requiredWithSibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field is missing\r\n */\r\n requiredWithout(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field is missing\r\n */\r\n requiredWithoutSibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field equals a specific value\r\n */\r\n requiredIf(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field equals a specific value\r\n */\r\n requiredIfSibling(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required unless another field equals a specific value\r\n */\r\n requiredUnless(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required unless another sibling field equals a specific value\r\n */\r\n requiredUnlessSibling(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field is empty\r\n */\r\n requiredIfEmpty(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field is empty\r\n */\r\n requiredIfEmptySibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field is not empty\r\n */\r\n requiredIfNotEmpty(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field is not empty\r\n */\r\n requiredIfNotEmptySibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ALL specified fields are empty\r\n */\r\n requiredIfAllEmpty(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ALL specified sibling fields are empty\r\n */\r\n requiredIfAllEmptySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ANY of the specified fields is empty\r\n */\r\n requiredIfAnyEmpty(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ANY of the specified sibling fields is empty\r\n */\r\n requiredIfAnyEmptySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ALL specified fields are NOT empty\r\n */\r\n requiredIfAllNotEmpty(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ALL specified sibling fields are NOT empty\r\n */\r\n requiredIfAllNotEmptySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ANY of the specified fields is NOT empty\r\n */\r\n requiredIfAnyNotEmpty(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ANY of the specified sibling fields is NOT empty\r\n */\r\n requiredIfAnyNotEmptySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field's value is in the given array\r\n */\r\n requiredIfIn(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field's value is in the given array\r\n */\r\n requiredIfInSibling(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field's value is NOT in the given array\r\n */\r\n requiredIfNotIn(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field's value is NOT in the given array\r\n */\r\n requiredIfNotInSibling(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if all specified fields exist\r\n */\r\n requiredWithAll(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if all specified sibling fields exist\r\n */\r\n requiredWithAllSiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if all specified fields are missing\r\n */\r\n requiredWithoutAll(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if all specified sibling fields are missing\r\n */\r\n requiredWithoutAllSiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if any of the specified fields exists\r\n */\r\n requiredWithAny(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if any of the specified sibling fields exists\r\n */\r\n requiredWithAnySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if any of the specified fields is missing\r\n */\r\n requiredWithoutAny(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if any of the specified sibling fields is missing\r\n */\r\n requiredWithoutAnySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Make this field required based on a custom callback.\r\n *\r\n * The callback receives only the `SchemaContext` (not the value),\r\n * because \"required\" is about surrounding conditions, not the field itself.\r\n * Return `true` if the field should be required.\r\n *\r\n * @param callback - Receives SchemaContext, returns boolean\r\n * @param errorMessage - Optional custom error message\r\n *\r\n * @example\r\n * ```ts\r\n * // Required when email notification is enabled\r\n * v.string().requiredWhen((context) => {\r\n * return context.allData.notificationMethod === 'email';\r\n * })\r\n *\r\n * // Required based on multiple conditions\r\n * v.string().requiredWhen((context) => {\r\n * const { role, department } = context.allData;\r\n * return role === 'manager' && department === 'finance';\r\n * })\r\n * ```\r\n */\r\n requiredWhen(\r\n callback: (context: SchemaContext) => boolean | Promise<boolean>,\r\n errorMessage?: string,\r\n ): this;\r\n }\r\n}\r\n\r\n// ==================== UNCONDITIONAL STATES ====================\r\n\r\n/**\r\n * This value must be present and has a value\r\n */\r\nBaseValidator.prototype.required = function (errorMessage?: string) {\r\n return this.setRequiredRule(requiredRule, errorMessage);\r\n};\r\n\r\n/**\r\n * Value must be present but not necessarily has a value\r\n */\r\nBaseValidator.prototype.present = function (errorMessage?: string) {\r\n return this.setRequiredRule(presentRule, errorMessage);\r\n};\r\n\r\n/**\r\n * Mark the field as optional — it may be absent or empty without validation errors.\r\n * Clears any previously set required rule.\r\n *\r\n * The return type is branded with `{ isOptional: true }` so schema inference\r\n * can mark this key as optional in the inferred TypeScript type.\r\n */\r\nBaseValidator.prototype.optional = function (): BaseValidator & { isOptional: true } {\r\n const instance = this.instance;\r\n instance.isOptional = true;\r\n instance.requiredRule = null;\r\n return instance as BaseValidator & { isOptional: true };\r\n};\r\n\r\n/**\r\n * Sugar — equivalent to `.optional().nullable()`.\r\n */\r\nBaseValidator.prototype.nullish = function (): BaseValidator & {\r\n isOptional: true;\r\n isNullable: true;\r\n} {\r\n const instance = this.optional().nullable();\r\n return instance as BaseValidator & { isOptional: true; isNullable: true };\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON FIELD PRESENCE ====================\r\n\r\n/**\r\n * Value is required if another field exists\r\n */\r\nBaseValidator.prototype.requiredWith = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithRule, errorMessage, { field, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field exists\r\n */\r\nBaseValidator.prototype.requiredWithSibling = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithRule, errorMessage, { field, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if another field is missing\r\n */\r\nBaseValidator.prototype.requiredWithout = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithoutRule, errorMessage, { field, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field is missing\r\n */\r\nBaseValidator.prototype.requiredWithoutSibling = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithoutRule, errorMessage, { field, scope: \"sibling\" });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON FIELD VALUE ====================\r\n\r\n/**\r\n * Value is required if another field equals a specific value\r\n */\r\nBaseValidator.prototype.requiredIf = function (field: string, value: any, errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfRule, errorMessage, { field, value, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field equals a specific value\r\n */\r\nBaseValidator.prototype.requiredIfSibling = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfRule, errorMessage, { field, value, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required unless another field equals a specific value\r\n */\r\nBaseValidator.prototype.requiredUnless = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredUnlessRule, errorMessage, { field, value, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required unless another sibling field equals a specific value\r\n */\r\nBaseValidator.prototype.requiredUnlessSibling = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredUnlessRule, errorMessage, { field, value, scope: \"sibling\" });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON FIELD EMPTY STATE ====================\r\n\r\n/**\r\n * Value is required if another field is empty\r\n */\r\nBaseValidator.prototype.requiredIfEmpty = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfEmptyRule, errorMessage, { field, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field is empty\r\n */\r\nBaseValidator.prototype.requiredIfEmptySibling = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfEmptyRule, errorMessage, { field, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if another field is not empty\r\n */\r\nBaseValidator.prototype.requiredIfNotEmpty = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfNotEmptyRule, errorMessage, { field, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field is not empty\r\n */\r\nBaseValidator.prototype.requiredIfNotEmptySibling = function (\r\n field: string,\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfNotEmptyRule, errorMessage, { field, scope: \"sibling\" });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON MULTIPLE FIELDS EMPTY STATE ====================\r\n\r\n/**\r\n * Value is required if ALL specified fields are empty\r\n */\r\nBaseValidator.prototype.requiredIfAllEmpty = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfAllEmptyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if ALL specified sibling fields are empty\r\n */\r\nBaseValidator.prototype.requiredIfAllEmptySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfAllEmptyRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if ANY of the specified fields is empty\r\n */\r\nBaseValidator.prototype.requiredIfAnyEmpty = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfAnyEmptyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if ANY of the specified sibling fields is empty\r\n */\r\nBaseValidator.prototype.requiredIfAnyEmptySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfAnyEmptyRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if ALL specified fields are NOT empty\r\n */\r\nBaseValidator.prototype.requiredIfAllNotEmpty = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfAllNotEmptyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if ALL specified sibling fields are NOT empty\r\n */\r\nBaseValidator.prototype.requiredIfAllNotEmptySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfAllNotEmptyRule, errorMessage, {\r\n fields,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is required if ANY of the specified fields is NOT empty\r\n */\r\nBaseValidator.prototype.requiredIfAnyNotEmpty = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfAnyNotEmptyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if ANY of the specified sibling fields is NOT empty\r\n */\r\nBaseValidator.prototype.requiredIfAnyNotEmptySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfAnyNotEmptyRule, errorMessage, {\r\n fields,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is required if another field's value is in the given array\r\n */\r\nBaseValidator.prototype.requiredIfIn = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfInRule, errorMessage, { field, values, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field's value is in the given array\r\n */\r\nBaseValidator.prototype.requiredIfInSibling = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfInRule, errorMessage, { field, values, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if another field's value is NOT in the given array\r\n */\r\nBaseValidator.prototype.requiredIfNotIn = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfNotInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field's value is NOT in the given array\r\n */\r\nBaseValidator.prototype.requiredIfNotInSibling = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfNotInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON MULTIPLE FIELDS (ALL) ====================\r\n\r\n/**\r\n * Value is required if all specified fields exist\r\n */\r\nBaseValidator.prototype.requiredWithAll = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithAllRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if all specified sibling fields exist\r\n */\r\nBaseValidator.prototype.requiredWithAllSiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredWithAllRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if all specified fields are missing\r\n */\r\nBaseValidator.prototype.requiredWithoutAll = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithoutAllRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if all specified sibling fields are missing\r\n */\r\nBaseValidator.prototype.requiredWithoutAllSiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredWithoutAllRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON MULTIPLE FIELDS (ANY) ====================\r\n\r\n/**\r\n * Value is required if any of the specified fields exists\r\n */\r\nBaseValidator.prototype.requiredWithAny = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithAnyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if any of the specified sibling fields exists\r\n */\r\nBaseValidator.prototype.requiredWithAnySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredWithAnyRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if any of the specified fields is missing\r\n */\r\nBaseValidator.prototype.requiredWithoutAny = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithoutAnyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if any of the specified sibling fields is missing\r\n */\r\nBaseValidator.prototype.requiredWithoutAnySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredWithoutAnyRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON CUSTOM CALLBACK ====================\r\n\r\n/**\r\n * Make this field required based on a custom callback.\r\n * Callback receives only SchemaContext — the framework handles empty-value checking.\r\n */\r\nBaseValidator.prototype.requiredWhen = function (\r\n callback: (context: SchemaContext) => boolean | Promise<boolean>,\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredWhenRule, errorMessage, { callback });\r\n};\r\n","import { allowedValuesRule, enumRule, inRule, notAllowedValuesRule } from \"../rules\";\nimport { BaseValidator } from \"./base-validator\";\n\n/**\n * Abstract base validator for primitive-typed fields (string, number, boolean).\n *\n * Provides value-membership rules that are meaningful for any single primitive value\n * but not for complex structures (object, array).\n *\n * Do NOT expose this on the `v` factory — it is an inheritance-only base class.\n *\n * Hierarchy:\n * BaseValidator\n * └── PrimitiveValidator ← enum, in, oneOf, allowsOnly, forbids, notIn\n * ├── StringValidator\n * ├── NumberValidator\n * │ └── FloatValidator\n * ├── BooleanValidator\n * └── ScalarValidator (extends PrimitiveValidator, adds asNumber/asString/accepted/declined)\n *\n * @example\n * class MyValidator extends PrimitiveValidator {\n * // inherits: in(), forbids(), enum(), oneOf(), allowsOnly(), notIn()\n * }\n */\nexport abstract class PrimitiveValidator extends BaseValidator {\n /**\n * Value must be one of the enum's values\n *\n * @example\n * v.string().enum(Direction) // Direction is a TS enum\n */\n public enum(values: any, errorMessage?: string) {\n return this.addRule(enumRule, errorMessage, { enum: Object.values(values) });\n }\n\n /**\n * Value must be one of the given values\n *\n * @example\n * v.string().in([\"admin\", \"user\", \"guest\"])\n * v.number().in([1, 2, 3])\n */\n public in(values: any[], errorMessage?: string) {\n return this.addRule(inRule, errorMessage, { values });\n }\n\n /**\n * Alias for `in()`\n *\n * @example\n * v.string().oneOf([\"active\", \"inactive\"])\n */\n public oneOf(values: any[], errorMessage?: string) {\n return this.in(values, errorMessage);\n }\n\n /**\n * Value must be one of the allowed values (stricter variant)\n *\n * @example\n * v.string().allowsOnly([\"yes\", \"no\"])\n */\n public allowsOnly(values: any[], errorMessage?: string) {\n return this.addRule(allowedValuesRule, errorMessage, { allowedValues: values });\n }\n\n /**\n * Value must NOT be one of the given values\n *\n * @example\n * v.string().forbids([\"banned\", \"blacklisted\"])\n * v.number().forbids([0, -1])\n */\n public forbids(values: any[], errorMessage?: string) {\n return this.addRule(notAllowedValuesRule, errorMessage, { notAllowedValues: values });\n }\n\n /**\n * Alias for `forbids()`\n *\n * @example\n * v.string().notIn([\"OK\", \"NOT OK\"])\n */\n public notIn(values: any[], errorMessage?: string) {\n return this.forbids(values, errorMessage);\n }\n}\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\nconst isAcceptedValue = (value: any) => {\r\n return [\"1\", \"true\", \"yes\", \"y\", \"on\", 1, true, \"Yes\", \"Y\", \"On\"].includes(value);\r\n};\r\n\r\n/**\r\n * Validate value as accepted if it equals:\r\n * 1 | \"1\" | true | \"true\" | \"yes\" | \"y\" | \"on\"\r\n */\r\nexport const acceptedRule: SchemaRule = {\r\n name: \"accepted\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n description:\r\n \"The value must be accepted if it equals: 1 | '1' | true | 'true' | 'yes' | 'y' | 'on' | 1 | true | 'Yes' | 'Y' | 'On'\",\r\n async validate(value: any, context) {\r\n if (isAcceptedValue(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Accepted value if another field's value equals to a specific value\r\n */\r\nexport const acceptedIfRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"acceptedIf\",\r\n description: \"The field must be accepted if :field's value equals to :value\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n if (fieldValue !== expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is not equal to the given value\r\n */\r\nexport const acceptedUnlessRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"acceptedUnless\",\r\n description: \"The field must be accepted if :field's value is not equal to :value\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n if (fieldValue === expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is required\r\n */\r\nexport const acceptedIfRequiredRule: SchemaRule<{ field: string }> = {\r\n name: \"acceptedIfRequired\",\r\n description: \"The field must be accepted if :field is required\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is present\r\n */\r\nexport const acceptedIfPresentRule: SchemaRule<{ field: string }> = {\r\n name: \"acceptedIfPresent\",\r\n description: \"The field must be accepted if :field is present\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue === undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is missing\r\n */\r\nexport const acceptedWithoutRule: SchemaRule<{ field: string }> = {\r\n name: \"acceptedWithout\",\r\n description: \"The field must be accepted if :field is missing\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue !== undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\nconst isDeclinedValue = (value: any) => {\r\n return [\"0\", \"false\", \"no\", \"n\", \"off\", 0, false, \"No\", \"N\", \"Off\"].includes(value);\r\n};\r\n\r\n/**\r\n * Validate value as declined if it equals:\r\n * 0 | \"0\" | false | \"false\" | \"no\" | \"n\" | \"off\" | 0 | false | \"No\" | \"N\" | \"Off\"\r\n */\r\nexport const declinedRule: SchemaRule = {\r\n name: \"declined\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n description:\r\n \"The value must be declined if it equals: 0 | '0' | false | 'false' | 'no' | 'n' | 'off' | 0 | false | 'No' | 'N' | 'Off'\",\r\n async validate(value: any, context) {\r\n if (isDeclinedValue(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Declined value if another field's value equals to a specific value\r\n */\r\nexport const declinedIfRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"declinedIf\",\r\n description: \"The field must be declined if :field's value equals to :value\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n if (fieldValue !== expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is not equal to the given value\r\n */\r\nexport const declinedUnlessRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"declinedUnless\",\r\n description: \"The field must be declined if :field's value is not equal to :value\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n if (fieldValue === expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is required\r\n */\r\nexport const declinedIfRequiredRule: SchemaRule<{ field: string }> = {\r\n name: \"declinedIfRequired\",\r\n description: \"The field must be declined if :field is required\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is present\r\n */\r\nexport const declinedIfPresentRule: SchemaRule<{ field: string }> = {\r\n name: \"declinedIfPresent\",\r\n description: \"The field must be declined if :field is present\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue === undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is missing\r\n */\r\nexport const declinedWithoutRule: SchemaRule<{ field: string }> = {\r\n name: \"declinedWithout\",\r\n description: \"The field must be declined if :field is missing\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue !== undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import {\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\";\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 // ==================== Accepted ====================\n\n /** Value must be accepted (true, \"yes\", 1, \"on\", etc.) */\n public accepted(errorMessage?: string) {\n return this.addRule(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.addRule(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.addRule(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.addRule(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.addRule(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.addRule(acceptedWithoutRule, errorMessage, { field });\n }\n\n // ==================== Declined ====================\n\n /** Value must be declined (false, \"no\", 0, \"off\", etc.) */\n public declined(errorMessage?: string) {\n return this.addRule(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.addRule(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.addRule(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.addRule(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.addRule(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.addRule(declinedWithoutRule, errorMessage, { field });\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","import type { SchemaContext, ValidationResult } from \"../types\";\nimport { BaseValidator } from \"./base-validator\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\n\n/**\n * Callback function for computed fields\n * Receives validated & mutated data and full schema context\n */\nexport type ComputedCallback<TResult = any> = (\n data: any,\n context: SchemaContext,\n) => TResult | Promise<TResult>;\n\n/**\n * Computed field validator\n *\n * Computes a value based on other validated fields in the schema.\n * The computed value is persisted and can optionally be validated.\n *\n * @example\n * ```ts\n * // Basic computed field\n * const schema = v.object({\n * title: v.string().required(),\n * slug: v.computed(data => slugify(data.title)),\n * });\n *\n * // With result validation\n * const schema = v.object({\n * title: v.string().required(),\n * slug: v.computed(\n * data => slugify(data.title),\n * v.string().minLength(3)\n * ),\n * });\n *\n * // Async computation\n * const schema = v.object({\n * image: v.string().url(),\n * thumbnail: v.computed(async data => {\n * return await generateThumbnail(data.image);\n * }),\n * });\n * ```\n */\nexport class ComputedValidator<TResult = any> extends BaseValidator {\n /**\n * Create a new computed field validator\n *\n * @param callback - Function to compute the value from validated data\n * @param resultValidator - Optional validator to validate the computed result\n */\n public constructor(\n protected callback: ComputedCallback<TResult>,\n protected resultValidator?: BaseValidator,\n ) {\n super();\n }\n\n /**\n * Execute the callback and optionally validate the result\n */\n public async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\n try {\n // Execute the callback with validated data\n const result = await this.callback(data, context);\n\n // Optionally validate the computed result\n if (this.resultValidator) {\n const validation = await this.resultValidator.validate(result, context);\n\n if (!validation.isValid) {\n return {\n isValid: false,\n errors: validation.errors,\n data: undefined,\n };\n }\n\n return {\n isValid: true,\n errors: [],\n data: validation.data,\n };\n }\n\n // No validation - return computed result directly\n return {\n isValid: true,\n errors: [],\n data: result,\n };\n } catch (error) {\n // Handle callback execution errors\n return {\n isValid: false,\n errors: [\n {\n type: \"computed\",\n error: error instanceof Error ? error.message : \"Computed field callback failed\",\n input: context.path,\n },\n ],\n data: undefined,\n };\n }\n }\n\n /**\n * Clone this validator with all its configuration\n * Critical for ObjectValidator.clone(), extend(), merge(), etc.\n */\n public override clone(): this {\n const cloned = super.clone();\n\n // Copy ComputedValidator-specific properties\n cloned.callback = this.callback; // Functions are safe to copy by reference\n cloned.resultValidator = this.resultValidator?.clone(); // Deep clone validator\n\n return cloned;\n }\n\n /**\n * Computed fields don't have a specific type to match\n */\n public matchesType(value: any): boolean {\n return true; // Computed fields accept any input (they generate their own value)\n }\n\n /**\n * @inheritdoc\n *\n * Computed fields are server-side runtime values — they have no input schema\n * and cannot be represented in JSON Schema. Calling this method is always a\n * programming error.\n *\n * @throws Error Always throws — computed/managed fields have no JSON Schema representation.\n */\n public override toJsonSchema(_target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n throw new Error(\n `[Seal] toJsonSchema() is not supported on ComputedValidator / ManagedValidator. ` +\n `Computed fields are runtime-only and have no input JSON Schema representation. ` +\n `ObjectValidator.toJsonSchema() automatically skips computed fields — ` +\n `do not call toJsonSchema() on a computed validator directly.`,\n );\n }\n}\n","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 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","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.values = values;\n this.addMutableRule(literalRule, errorMessage, { values });\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","import { isPlainObject } from \"@mongez/supportive-is\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport { applyNullable, wrapNullableStrict } from \"../standard-schema/json-schema\";\nimport type { SchemaContext, ValidationResult } from \"../types\";\nimport { BaseValidator } from \"./base-validator\";\nimport { LiteralValidator } from \"./literal-validator\";\nimport { ObjectValidator } from \"./object-validator\";\n\n/**\n * Discriminated union validator — routes payloads by a shared discriminator field.\n *\n * Plain `v.union()` falls back to `matchesType()` to pick a branch, which is\n * coarse for object-vs-object unions (every branch matches \"is plain object\").\n * Discriminated union reads a known field's value and routes directly to the\n * matching branch, producing precise errors instead of confused mash from the\n * wrong branch.\n *\n * **Construction-time validation.** Every branch must:\n * - Be an `ObjectValidator`\n * - Declare the discriminator field\n * - Type the discriminator as `v.literal(...)` (single or multi-literal both work)\n * - Not collide with another branch's literal values\n *\n * Misconfigurations throw eagerly so tests catch them at schema-build time.\n *\n * @example\n * ```ts\n * const email = v.object({ type: v.literal(\"email\"), email: v.string().email() });\n * const sms = v.object({ type: v.literal(\"sms\"), phone: v.string() });\n * const push = v.object({ type: v.literal(\"push\"), deviceId: v.string() });\n *\n * const notif = v.discriminatedUnion(\"type\", [email, sms, push]);\n *\n * await validate(notif, { type: \"sms\", phone: \"555-1234\" });\n * // → routes to sms branch only; errors (if any) come from sms\n * ```\n *\n * @see `domains/seal/plans/2026-05-12-discriminated-union.md`\n */\nexport class DiscriminatedUnionValidator<\n K extends string = string,\n Branches extends ReadonlyArray<ObjectValidator<any>> = ReadonlyArray<ObjectValidator<any>>,\n> extends BaseValidator {\n /** Map from discriminator literal value → matching branch validator. */\n private branches: Map<string | number | boolean, ObjectValidator<any>>;\n\n public constructor(\n public discriminator: K,\n public validators: Branches,\n ) {\n super();\n\n this.branches = DiscriminatedUnionValidator.buildBranchMap(discriminator, validators);\n }\n\n /**\n * Walk every branch, pull out the discriminator's literal values, and build\n * the lookup map. Throws on misconfiguration (missing discriminator,\n * non-literal discriminator, duplicate literal value).\n */\n private static buildBranchMap(\n discriminator: string,\n validators: ReadonlyArray<ObjectValidator<any>>,\n ): Map<string | number | boolean, ObjectValidator<any>> {\n const map = new Map<string | number | boolean, ObjectValidator<any>>();\n\n for (const branch of validators) {\n const discriminatorValidator = branch.schema?.[discriminator];\n\n if (!discriminatorValidator) {\n throw new Error(\n `[Seal] discriminatedUnion: branch missing discriminator field \"${discriminator}\"`,\n );\n }\n\n if (!(discriminatorValidator instanceof LiteralValidator)) {\n throw new Error(\n `[Seal] discriminatedUnion: discriminator \"${discriminator}\" must be v.literal(...) on every branch`,\n );\n }\n\n for (const value of discriminatorValidator.values) {\n if (map.has(value)) {\n throw new Error(\n `[Seal] discriminatedUnion: duplicate discriminator value \"${String(value)}\"`,\n );\n }\n map.set(value, branch);\n }\n }\n\n return map;\n }\n\n public override matchesType(value: any): boolean {\n return isPlainObject(value);\n }\n\n public override async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\n if (data === null && this.isNullable) {\n return { isValid: true, errors: [], data: null };\n }\n\n if (!isPlainObject(data)) {\n return {\n isValid: false,\n errors: [\n {\n type: \"discriminatedUnion\",\n error: `Expected object with discriminator field \"${this.discriminator}\"`,\n input: context.key || context.path || \"value\",\n },\n ],\n data: undefined,\n };\n }\n\n const discriminatorValue = data[this.discriminator];\n const branch = this.branches.get(discriminatorValue);\n\n if (!branch) {\n const allowed = [...this.branches.keys()].map((k) => String(k)).join(\", \");\n return {\n isValid: false,\n errors: [\n {\n type: \"discriminatedUnion\",\n error: `Field \"${this.discriminator}\" must be one of: ${allowed}`,\n input: this.discriminator,\n },\n ],\n data: undefined,\n };\n }\n\n return branch.validate(data, context);\n }\n\n public override clone(): this {\n const cloned = super.clone() as any;\n cloned.discriminator = this.discriminator;\n cloned.validators = this.validators.map((v: ObjectValidator<any>) => v.clone());\n cloned.branches = DiscriminatedUnionValidator.buildBranchMap(\n cloned.discriminator,\n cloned.validators,\n );\n return cloned;\n }\n\n /**\n * Emit `oneOf` of branch schemas. Each branch's own `toJsonSchema()` handles\n * its `properties.{discriminator}.const` and the surrounding required/optional\n * structure — we just enumerate.\n *\n * For `openai-strict`: the per-branch ObjectValidator already inflates\n * `required` to include every field; `oneOf` is OpenAI-accepted as long as\n * each branch passes strict rules independently.\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const oneOf = this.validators.map((v) => v.toJsonSchema(target));\n const schema: JsonSchemaResult = { oneOf };\n\n if (this.isNullable) {\n if (target === \"openai-strict\") {\n return wrapNullableStrict(schema);\n }\n applyNullable(schema, target);\n }\n\n return schema;\n }\n}\n","import { absMutator, ceilMutator, floorMutator, roundMutator, toFixedMutator } from \"../mutators\";\r\nimport {\r\n betweenNumbersRule,\r\n evenRule,\r\n greaterThanRule,\r\n lengthRule,\r\n lessThanRule,\r\n maxLengthRule,\r\n maxRule,\r\n minLengthRule,\r\n minRule,\r\n moduloRule,\r\n negativeRule,\r\n numberRule,\r\n oddRule,\r\n positiveRule,\r\n} from \"../rules\";\r\nimport { PrimitiveValidator } from \"./primitive-validator\";\r\nimport { applyNullable, getRuleOptions } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Number validator class - base for Int and Float validators\r\n */\r\nexport class NumberValidator extends PrimitiveValidator {\r\n public constructor(errorMessage?: string) {\r\n super();\r\n this.addMutableRule(numberRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is a number type\r\n */\r\n public matchesType(value: any): boolean {\r\n return typeof value === \"number\" && !isNaN(value);\r\n }\r\n\r\n /**\r\n * Value must be equal or higher than the given number or field\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public min(min: number | string, errorMessage?: string) {\r\n return this.addRule(minRule, errorMessage, { min, scope: \"global\" });\r\n }\r\n\r\n /**\r\n * Value must be equal or less than the given number or field\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public max(max: number | string, errorMessage?: string) {\r\n return this.addRule(maxRule, errorMessage, { max, scope: \"global\" });\r\n }\r\n\r\n /**\r\n * Value must be >= sibling field value\r\n * @category Validation Rule\r\n */\r\n public minSibling(field: string, errorMessage?: string) {\r\n return this.addRule(minRule, errorMessage, { min: field, scope: \"sibling\" });\r\n }\r\n\r\n /**\r\n * Value must be <= sibling field value\r\n * @category Validation Rule\r\n */\r\n public maxSibling(field: string, errorMessage?: string) {\r\n return this.addRule(maxRule, errorMessage, { max: field, scope: \"sibling\" });\r\n }\r\n\r\n /**\r\n * Value must be strictly greater than the given number or field (>)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public greaterThan(value: number | string, errorMessage?: string) {\r\n return this.addRule(greaterThanRule, errorMessage, {\r\n value,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Value must be strictly less than the given number or field (<)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public lessThan(value: number | string, errorMessage?: string) {\r\n return this.addRule(lessThanRule, errorMessage, {\r\n value,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Alias for greaterThan() - shorter syntax\r\n * @category Validation Rule\r\n */\r\n public gt(value: number | string, errorMessage?: string) {\r\n return this.greaterThan(value, errorMessage);\r\n }\r\n\r\n /**\r\n * Alias for lessThan() - shorter syntax\r\n * @category Validation Rule\r\n */\r\n public lt(value: number | string, errorMessage?: string) {\r\n return this.lessThan(value, errorMessage);\r\n }\r\n\r\n /**\r\n * Value must be > sibling field value\r\n * @category Validation Rule\r\n */\r\n public greaterThanSibling(field: string, errorMessage?: string) {\r\n return this.addRule(greaterThanRule, errorMessage, {\r\n value: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Alias for greaterThanSibling() - shorter syntax\r\n * @category Validation Rule\r\n */\r\n public gtSibling(field: string, errorMessage?: string) {\r\n return this.greaterThanSibling(field, errorMessage);\r\n }\r\n\r\n /**\r\n * Value must be < sibling field value\r\n * @category Validation Rule\r\n */\r\n public lessThanSibling(field: string, errorMessage?: string) {\r\n return this.addRule(lessThanRule, errorMessage, {\r\n value: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Alias for lessThanSibling() - shorter syntax\r\n * @category Validation Rule\r\n */\r\n public ltSibling(field: string, errorMessage?: string) {\r\n return this.lessThanSibling(field, errorMessage);\r\n }\r\n\r\n /** Value must be a modulo of the given number */\r\n public modulo(value: number, errorMessage?: string) {\r\n return this.addRule(moduloRule, errorMessage, { value });\r\n }\r\n\r\n /**\r\n * Alias for modulo() - Value must be divisible by the given number\r\n */\r\n public divisibleBy(value: number, errorMessage?: string) {\r\n return this.modulo(value, errorMessage);\r\n }\r\n\r\n /**\r\n * Alias for modulo() - Value must be a multiple of the given number\r\n */\r\n public multipleOf(value: number, errorMessage?: string) {\r\n return this.modulo(value, errorMessage);\r\n }\r\n\r\n /**\r\n * Alias for modulo() - Value must be a multiple of the given number\r\n */\r\n public modulusOf(value: number, errorMessage?: string) {\r\n return this.modulo(value, errorMessage);\r\n }\r\n\r\n /** Accept only numbers higher than 0 */\r\n public positive(errorMessage?: string) {\r\n return this.addRule(positiveRule, errorMessage);\r\n }\r\n\r\n /** Accept only negative numbers */\r\n public negative(errorMessage?: string) {\r\n return this.addRule(negativeRule, errorMessage);\r\n }\r\n\r\n /** Accept only odd numbers */\r\n public odd(errorMessage?: string) {\r\n return this.addRule(oddRule, errorMessage);\r\n }\r\n\r\n /** Accept only even numbers */\r\n public even(errorMessage?: string) {\r\n return this.addRule(evenRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Accept only numbers between the given two numbers or fields (Inclusive)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public between(min: number | string, max: number | string, errorMessage?: string) {\r\n return this.addRule(betweenNumbersRule, errorMessage, {\r\n min,\r\n max,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Value must be between sibling field values\r\n * @category Validation Rule\r\n */\r\n public betweenSibling(minField: string, maxField: string, errorMessage?: string) {\r\n return this.addRule(betweenNumbersRule, errorMessage, {\r\n min: minField,\r\n max: maxField,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n // Enum and value membership methods are inherited from PrimitiveValidator.\r\n\r\n /**\r\n * Value (as a string) must be exactly this many characters.\r\n * Useful for fixed-format numeric codes (e.g. 4-digit PIN).\r\n */\r\n public length(length: number, errorMessage?: string) {\r\n return this.addRule(lengthRule, errorMessage, { length });\r\n }\r\n\r\n /** Value (as string representation) length must be ≥ min */\r\n public minLength(length: number, errorMessage?: string) {\r\n return this.addRule(minLengthRule, errorMessage, { minLength: length });\r\n }\r\n\r\n /** Value (as string representation) length must be ≤ max */\r\n public maxLength(length: number, errorMessage?: string) {\r\n return this.addRule(maxLengthRule, errorMessage, { maxLength: length });\r\n }\r\n\r\n // Mutators\r\n\r\n /**\r\n * Convert value to its absolute value\r\n */\r\n public abs() {\r\n return this.addMutator(absMutator);\r\n }\r\n\r\n /**\r\n * Round value up to the nearest integer\r\n */\r\n public ceil() {\r\n return this.addMutator(ceilMutator);\r\n }\r\n\r\n /**\r\n * Round value down to the nearest integer\r\n */\r\n public floor() {\r\n return this.addMutator(floorMutator);\r\n }\r\n\r\n /**\r\n * Round value to the nearest integer or specified decimals\r\n */\r\n public round(decimals = 0) {\r\n return this.addMutator(roundMutator, { decimals });\r\n }\r\n\r\n /**\r\n * Format number using fixed-point notation\r\n */\r\n public toFixed(decimals = 2) {\r\n return this.addMutator(toFixedMutator, { decimals });\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Returns `{ type: \"number\" }` with numeric constraint keywords.\r\n * IntValidator overrides `type` to `\"integer\"`.\r\n *\r\n * @note Sibling-scoped rules (minSibling, maxSibling, etc.) are not representable\r\n * in JSON Schema and are silently omitted.\r\n *\r\n * @example\r\n * ```ts\r\n * v.number().min(0).max(100).toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"number\", minimum: 0, maximum: 100 }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n return this.buildNumberJsonSchema(\"number\", target);\r\n }\r\n\r\n /**\r\n * Shared logic for number/integer JSON Schema generation.\r\n * Called by NumberValidator.toJsonSchema() (→ type: \"number\")\r\n * and IntValidator.toJsonSchema() (→ type: \"integer\").\r\n */\r\n protected buildNumberJsonSchema(\r\n type: \"number\" | \"integer\",\r\n target: JsonSchemaTarget,\r\n ): JsonSchemaResult {\r\n const schema: JsonSchemaResult = { type };\r\n\r\n // minimum (inclusive)\r\n const minOpts = getRuleOptions(this.rules, \"min\");\r\n if (minOpts?.min !== undefined && typeof minOpts.min === \"number\") {\r\n schema.minimum = minOpts.min;\r\n }\r\n\r\n // maximum (inclusive)\r\n const maxOpts = getRuleOptions(this.rules, \"max\");\r\n if (maxOpts?.max !== undefined && typeof maxOpts.max === \"number\") {\r\n schema.maximum = maxOpts.max;\r\n }\r\n\r\n // between (inclusive range)\r\n const betweenOpts = getRuleOptions(this.rules, \"betweenNumbers\");\r\n if (betweenOpts) {\r\n if (typeof betweenOpts.min === \"number\") schema.minimum = betweenOpts.min;\r\n if (typeof betweenOpts.max === \"number\") schema.maximum = betweenOpts.max;\r\n }\r\n\r\n // greaterThan (>) → exclusiveMinimum\r\n const gtOpts = getRuleOptions(this.rules, \"greaterThan\");\r\n if (gtOpts?.value !== undefined && typeof gtOpts.value === \"number\") {\r\n if (target === \"draft-07\") {\r\n schema.minimum = gtOpts.value;\r\n schema.exclusiveMinimum = true;\r\n } else {\r\n schema.exclusiveMinimum = gtOpts.value;\r\n }\r\n }\r\n\r\n // lessThan (<) → exclusiveMaximum\r\n const ltOpts = getRuleOptions(this.rules, \"lessThan\");\r\n if (ltOpts?.value !== undefined && typeof ltOpts.value === \"number\") {\r\n if (target === \"draft-07\") {\r\n schema.maximum = ltOpts.value;\r\n schema.exclusiveMaximum = true;\r\n } else {\r\n schema.exclusiveMaximum = ltOpts.value;\r\n }\r\n }\r\n\r\n // multipleOf / modulo\r\n const moduloOpts = getRuleOptions(this.rules, \"modulo\");\r\n if (moduloOpts?.value !== undefined && typeof moduloOpts.value === \"number\") {\r\n schema.multipleOf = moduloOpts.value;\r\n }\r\n\r\n // enum (from PrimitiveValidator.in / .enum)\r\n const inOpts = getRuleOptions(this.rules, \"in\");\r\n if (inOpts?.values && Array.isArray(inOpts.values)) {\r\n schema.enum = inOpts.values;\r\n }\r\n\r\n if (this.isNullable) applyNullable(schema, target);\r\n\r\n return schema;\r\n }\r\n}\r\n","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","import { instanceofRule } from \"../rules/common/instanceof\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport { BaseValidator } from \"./base-validator\";\n\n/**\n * InstanceOf validator class\n *\n * Validates that the value is an instance of the given constructor (`value instanceof Ctor`).\n * Useful for File uploads, Buffer/Uint8Array payloads, and custom domain classes —\n * anywhere a runtime class identity is the right contract.\n *\n * Note: `Date` is already covered by `v.date()` with richer date-specific rules;\n * reach for `v.instanceof(Date)` only when you specifically want raw `instanceof`\n * semantics with no normalization.\n *\n * @example\n * v.instanceof(File) // type: File\n * v.instanceof(Buffer) // type: Buffer\n * v.instanceof(MyClass) // type: MyClass\n */\nexport class InstanceOfValidator<T = unknown> extends BaseValidator {\n public ctor: new (...args: any[]) => T;\n\n public constructor(ctor: new (...args: any[]) => T, errorMessage?: string) {\n super();\n this.ctor = ctor;\n this.addMutableRule(instanceofRule, errorMessage, { ctor, name: ctor.name || \"instance\" });\n }\n\n /**\n * Check if value is an instance of the configured constructor\n */\n public matchesType(value: any): boolean {\n return value instanceof this.ctor;\n }\n\n /**\n * Clone the validator, preserving the target constructor.\n *\n * The base `clone()` only copies `BaseValidator` fields, so without this\n * override a cloned `instanceof` validator loses its `ctor` reference and\n * `matchesType()` would throw on the next call.\n */\n public override clone(): this {\n const cloned = super.clone();\n cloned.ctor = this.ctor;\n return cloned;\n }\n\n /**\n * @inheritdoc\n *\n * Class instances are not representable in JSON Schema — returns an empty\n * schema (permissive). Consumers serializing to OpenAPI should attach an\n * appropriate format manually if needed (e.g. `{ type: \"string\", format: \"binary\" }`\n * for `File`).\n */\n public override toJsonSchema(_target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n return {};\n }\n}\n","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","import type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport type { SchemaContext, ValidationResult } from \"../types\";\nimport { BaseValidator } from \"./base-validator\";\n\n/**\n * Lazy validator — defers resolution of the inner validator until validate-time.\n *\n * Solves the chicken-and-egg of self-referencing schemas. JavaScript evaluates\n * an object literal before the `const` binding completes, so this can't work:\n *\n * ```ts\n * const categorySchema = v.object({\n * name: v.string(),\n * children: v.array(categorySchema), // ❌ ReferenceError\n * });\n * ```\n *\n * Wrap the recursive reference in `v.lazy(() => …)` — the thunk isn't invoked\n * during construction, only when `validate()` is called:\n *\n * ```ts\n * type Category = { name: string; children: Category[] };\n *\n * const categorySchema: ObjectValidator<...> = v.object({\n * name: v.string(),\n * children: v.array(v.lazy(() => categorySchema)),\n * });\n *\n * type T = Infer<typeof categorySchema>;\n * // { name: string; children: T[] } ← recursive type\n * ```\n *\n * The thunk is memoized — it's invoked once on the first validate (or\n * `matchesType` / `toJsonSchema`) call and the result is cached. The thunk is\n * expected to return a stable validator; calling it on every validate would be\n * wasteful and could mask bugs where the user accidentally returns a fresh\n * validator each time.\n *\n * **JSON Schema caveat.** v1 uses simple resolve-and-delegate — recursive\n * schemas will infinite-loop in `toJsonSchema()`. If you need JSON Schema for\n * a recursive shape, generate it manually with `$defs` + `$ref` until v2 lands.\n *\n * @see `domains/seal/plans/2026-05-12-lazy-validator.md`\n */\nexport class LazyValidator<T extends BaseValidator = BaseValidator> extends BaseValidator {\n private resolvedValidator: T | undefined;\n\n public constructor(private thunk: () => T) {\n super();\n // Lazy itself defers required handling to the inner validator —\n // mark the wrapper as optional so the required check doesn't fire here.\n this.requiredRule = null;\n this.isOptional = true;\n }\n\n /**\n * Resolve the inner validator. Memoizes the result so subsequent calls\n * don't re-execute the thunk.\n */\n private resolve(): T {\n if (this.resolvedValidator === undefined) {\n this.resolvedValidator = this.thunk();\n }\n\n return this.resolvedValidator;\n }\n\n public override async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\n return this.resolve().validate(data, context);\n }\n\n public override matchesType(value: any): boolean {\n return this.resolve().matchesType(value);\n }\n\n public override clone(): this {\n const cloned = super.clone();\n // Share the thunk reference; reset the memo so the clone resolves\n // independently on its first call (in case the thunk closure resolves\n // differently in a different context — unlikely but cheap insurance).\n cloned.thunk = this.thunk;\n cloned.resolvedValidator = undefined;\n\n return cloned;\n }\n\n /**\n * JSON Schema generation — simple resolve-and-delegate.\n *\n * **Recursive schemas will infinite-loop.** Until v2 adds `$ref` + `$defs`\n * generation, callers needing JSON Schema for recursive shapes must build\n * the schema manually.\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n return this.resolve().toJsonSchema(target);\n }\n}\n","import type { SchemaContext } from \"../types\";\nimport type { BaseValidator } from \"./base-validator\";\nimport { ComputedValidator, type ComputedCallback } from \"./computed-validator\";\n\n/**\n * Callback function for managed fields\n * Receives only schema context (no data dependency)\n */\nexport type ManagedCallback<TResult = any> = (context: SchemaContext) => TResult | Promise<TResult>;\n\n/**\n * Managed field validator\n *\n * The callback is optional - if not provided, the framework can inject the value.\n * @example\n * ```ts\n * // With callback (framework executes it)\n * const schema = v.object({\n * name: v.string(),\n * createdAt: v.managed(() => new Date()),\n * updatedAt: v.managed(() => new Date()),\n * });\n *\n * // Without callback (framework injects value)\n * const schema = v.object({\n * name: v.string(),\n * id: v.managed(() => 1),\n * });\n * ```\n */\nexport class ManagedValidator<TResult = any> extends ComputedValidator<TResult> {\n /**\n * Create a new managed field validator\n *\n * @param callback - Optional function to generate the value\n * @param resultValidator - Optional validator to validate the generated result\n */\n constructor(callback: ManagedCallback<TResult>, resultValidator?: BaseValidator) {\n // Convert ManagedCallback to ComputedCallback\n // Managed callbacks don't receive data, only context\n const computedCallback: ComputedCallback<TResult> = (_data, context) => callback(context);\n\n super(computedCallback, resultValidator);\n }\n}\n","import { isNumeric } from \"@mongez/supportive-is\";\r\nimport { numericMutator } from \"../mutators/number-mutators\";\r\nimport { NumberValidator } from \"./number-validator\";\r\n\r\n/**\r\n * Numeric validator class - base for Int and Float validators either as number or string\r\n */\r\nexport class NumericValidator extends NumberValidator {\r\n /**\r\n * Constructor\r\n */\r\n public constructor(errorMessage?: string) {\r\n super(errorMessage);\r\n this.addMutableMutator(numericMutator);\r\n }\r\n\r\n /**\r\n * Check if value is a numeric type\r\n */\r\n public matchesType(value: any): boolean {\r\n return isNumeric(value);\r\n }\r\n}\r\n","import { except } from \"@mongez/reinforcements\";\nimport { isPlainObject } from \"@mongez/supportive-is\";\nimport { setKeyPath } from \"../helpers\";\nimport { objectTrimMutator, stripUnknownMutator } from \"../mutators\";\nimport { objectRule, unknownKeyRule } from \"../rules\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport { applyNullable, wrapNullableStrict } from \"../standard-schema/json-schema\";\nimport type { Schema, SchemaContext, ValidationResult } from \"../types\";\nimport type {\n InferInputObjectShape,\n InferOutputObjectShape,\n} from \"../types/inference-types\";\nimport { BaseValidator } from \"./base-validator\";\nimport { ComputedValidator } from \"./computed-validator\";\n\n/**\n * Object validator class with generic schema type for proper type inference.\n *\n * Threads two distinct inferred shapes into `BaseValidator`'s `TInput`/`TOutput`:\n *\n * - `TInput` = `InferInputObjectShape<TSchema>` — what `~standard.validate()`\n * accepts (caller's pre-validation payload; defaults/catches make\n * keys optional)\n * - `TOutput` = `InferOutputObjectShape<TSchema>` — what `~standard.validate()`\n * returns on success (post-default, post-catch shape; guaranteed\n * keys are required)\n *\n * Both helpers are used directly (not the full `Infer.*` walker) to avoid a\n * recursive class-base evaluation that would otherwise occur when the\n * brand-aware widening tries to inspect the class type.\n */\nexport class ObjectValidator<TSchema extends Schema = Schema> extends BaseValidator<\n InferInputObjectShape<TSchema>,\n InferOutputObjectShape<TSchema>\n> {\n protected shouldAllowUnknown = false;\n protected allowedKeys: string[] = [];\n protected hasUnknownKeyRule = false;\n\n public constructor(\n public schema: TSchema,\n errorMessage?: string,\n ) {\n super();\n this.addMutableRule(objectRule, errorMessage);\n }\n\n /**\n * Check if value is an object type (plain object, not array or date)\n */\n public matchesType(value: any): boolean {\n return isPlainObject(value);\n }\n\n /** Strip unknown keys from the data */\n public stripUnknown() {\n const validator = this.instance;\n return validator.addMutator(stripUnknownMutator, {\n get allowedKeys() {\n return validator.allowedKeys;\n },\n });\n }\n\n /** Add list of allowed keys that could be in the data but not necessarily validated */\n public allow(...keys: string[]) {\n const validator = this.instance;\n validator.allowedKeys.push(...keys);\n return validator;\n }\n\n /** Trim values of the object properties */\n public trim(recursive = true) {\n const validator = this.instance;\n return validator.addMutator(objectTrimMutator, { recursive });\n }\n\n /** Whether to allow unknown properties\n * Please note it will allow only unknown direct children keys, not nested children keys\n */\n public allowUnknown(allow = true) {\n const validator = this.instance;\n validator.shouldAllowUnknown = allow;\n return validator;\n }\n\n /**\n * Create a copy of this object validator with the same configuration\n * Copies schema, rules, mutators, transformers, and object-specific settings\n *\n * @returns A new ObjectValidator instance with copied configuration\n *\n * @example\n * ```ts\n * const baseUser = v.object({ name: v.string() }).allowUnknown();\n * const userCopy = baseUser.clone();\n * // userCopy has the same schema and allowUnknown setting\n * ```\n */\n public override clone(keys?: string[]): this {\n // Get cloned instance with all BaseValidator properties\n const cloned = super.clone();\n\n // Clone schema with deep copy of validators\n const newSchema = {} as TSchema;\n for (const key in this.schema) {\n if (keys && !keys.includes(key)) continue;\n (newSchema as any)[key] = this.schema[key].clone();\n }\n\n cloned.schema = newSchema;\n\n // Add ObjectValidator-specific properties\n cloned.shouldAllowUnknown = this.shouldAllowUnknown;\n cloned.allowedKeys = [...this.allowedKeys];\n // NOTE: hasUnknownKeyRule is intentionally NOT copied.\n // Each clone must add its own unknownKeyRule on first validate()\n // so it holds references to its own schema/allowedKeys, not the original's.\n\n return cloned;\n }\n\n /**\n * Extend this schema with additional fields\n * Clones the current validator and adds new fields to the schema\n * **Keeps original configuration** (allowUnknown, stripUnknown, etc.)\n *\n * If an ObjectValidator is provided, only its schema is used - its configuration is ignored.\n * This is useful for creating reusable field collections that can be added to different schemas.\n *\n * @param schemaOrValidator - Plain schema object or ObjectValidator to extend with\n * @returns A new ObjectValidator with merged schema and original configuration\n *\n * @example\n * ```ts\n * // Extend with plain schema\n * const baseUser = v.object({\n * name: v.string().required(),\n * email: v.string().email().required()\n * }).allowUnknown();\n *\n * const adminUser = baseUser.extend({\n * role: v.string().in(['admin', 'superadmin']).required()\n * });\n * // adminUser has: name, email, role\n * // adminUser keeps: allowUnknown() from base ✅\n *\n * // Extend with ObjectValidator (only schema is used)\n * const auditFields = v.object({\n * createdAt: v.date().required(),\n * updatedAt: v.date().required()\n * }).stripUnknown(); // This config is ignored!\n *\n * const fullUser = baseUser.extend(auditFields);\n * // fullUser has: name, email, createdAt, updatedAt\n * // fullUser keeps: allowUnknown() from base (NOT stripUnknown from auditFields) ✅\n *\n * // Chain multiple extends\n * const complexSchema = baseUser\n * .extend(auditFields)\n * .extend({ metadata: v.object({}) });\n * ```\n */\n public extend<TExtension extends Schema>(\n schemaOrValidator: TExtension | ObjectValidator<TExtension>,\n ): ObjectValidator<TSchema & TExtension> {\n // Clone current validator to preserve original\n const extended = this.clone() as any;\n\n // Extract schema from parameter\n const schemaToAdd =\n schemaOrValidator instanceof ObjectValidator ? schemaOrValidator.schema : schemaOrValidator;\n\n // Merge schemas with cloned validators (later fields override earlier ones)\n for (const key in schemaToAdd) {\n extended.schema[key] = schemaToAdd[key].clone();\n }\n\n return extended as ObjectValidator<TSchema & TExtension>;\n }\n\n /**\n * Merge with another ObjectValidator\n * Clones current validator, merges schemas, and **overrides configuration** with other validator's config\n *\n * Unlike extend(), merge() combines both schemas AND configurations.\n * The other validator's configuration (allowUnknown, stripUnknown, etc.) takes precedence.\n *\n * @param validator - Another ObjectValidator to merge with\n * @returns A new ObjectValidator with merged schema and configuration\n *\n * @example\n * ```ts\n * const baseUser = v.object({\n * name: v.string().required()\n * }).allowUnknown();\n *\n * const timestamps = v.object({\n * createdAt: v.date().required(),\n * updatedAt: v.date().required()\n * }).stripUnknown();\n *\n * const merged = baseUser.merge(timestamps);\n * // merged has: name, createdAt, updatedAt\n * // merged config: stripUnknown() from timestamps (overrides allowUnknown) ✅\n *\n * // Chain multiple merges\n * const full = baseUser.merge(timestamps).merge(softDeleteSchema);\n * ```\n */\n public merge<TMerge extends Schema>(\n validator: ObjectValidator<TMerge>,\n ): ObjectValidator<TSchema & TMerge> {\n // Clone current validator\n const merged = this.clone() as any;\n\n // Merge schemas with cloned validators (later fields override earlier ones)\n for (const key in validator.schema) {\n merged.schema[key] = validator.schema[key].clone();\n }\n\n // Override configuration with other validator's config\n merged.shouldAllowUnknown = validator.shouldAllowUnknown;\n merged.allowedKeys = [...merged.allowedKeys, ...validator.allowedKeys];\n\n // Append rules, mutators, transformers from other validator\n merged.rules.push(...validator.rules);\n merged.mutators.push(...validator.mutators);\n merged.dataTransformers.push(...validator.dataTransformers);\n\n // Merge attributes text (later wins)\n merged.attributesText = {\n ...merged.attributesText,\n ...validator.attributesText,\n };\n\n merged.translatedAttributes = {\n ...merged.translatedAttributes,\n ...validator.translatedAttributes,\n };\n\n return merged as ObjectValidator<TSchema & TMerge>;\n }\n\n /**\n * Create a new schema with only the specified fields\n * Clones the current validator and keeps only the selected fields\n * **Preserves all configuration** (allowUnknown, stripUnknown, etc.)\n *\n * @param keys - Field names to keep in the schema\n * @returns A new ObjectValidator with only the picked fields\n *\n * @example\n * ```ts\n * const fullUser = v.object({\n * id: v.int().required(),\n * name: v.string().required(),\n * email: v.string().email().required(),\n * password: v.string().required(),\n * role: v.string()\n * }).allowUnknown();\n *\n * // For login - only need email and password\n * const loginSchema = fullUser.pick('email', 'password');\n * // loginSchema has: { email, password }\n * // loginSchema keeps: allowUnknown() ✅\n *\n * // For public profile\n * const publicSchema = fullUser.pick('id', 'name', 'role');\n * // publicSchema has: { id, name, role }\n * ```\n */\n public pick<K extends keyof TSchema>(...keys: K[]): ObjectValidator<Pick<TSchema, K>> {\n // Clone current validator\n const picked = this.clone() as any;\n\n // Create new schema with only picked keys\n const newSchema = {} as Pick<TSchema, K>;\n for (const key of keys) {\n if (key in picked.schema) {\n (newSchema as any)[key] = picked.schema[key];\n }\n }\n\n picked.schema = newSchema;\n\n return picked as ObjectValidator<Pick<TSchema, K>>;\n }\n\n /**\n * Mark all or the given schema fields as optional\n */\n public partial<K extends keyof TSchema>(...keys: K[]) {\n const validationSchema = this.clone();\n\n if (keys.length === 0) {\n keys = Object.keys(validationSchema.schema) as K[];\n }\n\n for (const key of keys) {\n validationSchema.schema[key] = validationSchema.schema[key].optional();\n }\n\n return validationSchema;\n }\n\n /**\n * Make the all or the given fields as required\n */\n public requiredFields<K extends keyof TSchema>(...keys: K[]) {\n const validationSchema = this.clone();\n\n if (keys.length === 0) {\n keys = Object.keys(validationSchema.schema) as K[];\n }\n\n for (const key of keys) {\n validationSchema.schema[key] = validationSchema.schema[key].required();\n }\n\n return validationSchema;\n }\n\n /**\n * Create a new schema excluding the specified fields\n * Clones the current validator and removes the specified fields\n * **Preserves all configuration** (allowUnknown, stripUnknown, etc.)\n *\n * @param keys - Field names to exclude from the schema\n * @returns A new ObjectValidator without the excluded fields\n *\n * @example\n * ```ts\n * const fullUser = v.object({\n * id: v.int().required(),\n * name: v.string().required(),\n * email: v.string().email().required(),\n * password: v.string().required(),\n * role: v.string()\n * }).allowUnknown();\n *\n * // For updates - exclude id\n * const updateSchema = fullUser.without('id');\n * // updateSchema has: { name, email, password, role }\n * // updateSchema keeps: allowUnknown() ✅\n *\n * // For public API - exclude sensitive fields\n * const publicSchema = fullUser.without('password', 'role');\n * // publicSchema has: { id, name, email }\n *\n * // Combine with other methods\n * const patchSchema = fullUser.without('id', 'password');\n * // patchSchema has: { name, email, role }\n * ```\n */\n public without<K extends keyof TSchema>(...keys: K[]): ObjectValidator<Omit<TSchema, K>> {\n // Clone current validator\n const filtered = this.clone() as any;\n\n // Create new schema excluding specified keys\n const newSchema = {} as Omit<TSchema, K>;\n for (const key in filtered.schema) {\n if (!keys.includes(key as any)) {\n (newSchema as any)[key] = filtered.schema[key];\n }\n }\n\n filtered.schema = newSchema;\n\n return filtered as ObjectValidator<Omit<TSchema, K>>;\n }\n\n /** Mutate the data */\n public mutate(data: any, context: SchemaContext) {\n if (!isPlainObject(data)) return data;\n return super.mutate({ ...data }, context);\n }\n\n /** Validate the data */\n public async validate(\n data: any,\n context: SchemaContext = { path: \"\" } as SchemaContext,\n ): Promise<ValidationResult> {\n context.schema = this.schema;\n const mutatedData = await this.mutate(data, context);\n\n // Check for unknown properties\n if (this.shouldAllowUnknown === false && !this.hasUnknownKeyRule) {\n this.hasUnknownKeyRule = true;\n const rule = this.addMutableRule(unknownKeyRule, undefined, {\n allowedKeys: this.allowedKeys,\n schema: this.schema,\n });\n\n this.setRuleAttributesList(rule);\n }\n\n const result = await super.validate(mutatedData, context);\n\n if (result.isValid === false) return result;\n if (data === undefined) return result;\n\n // ═══════════════════════════════════════════════════════════\n // PHASE 1: Validate user input fields (skip computed/managed)\n // ═══════════════════════════════════════════════════════════\n const errors: ValidationResult[\"errors\"] = [];\n const validatedData: any = {};\n\n const userInputKeys = Object.keys(this.schema).filter(\n (key) => !this.isComputedValidator(this.schema[key]),\n );\n\n const validationPromises = userInputKeys.map(async (key) => {\n const validator = this.schema[key];\n const value =\n mutatedData?.[key] !== undefined ? mutatedData[key] : validator.getDefaultValue();\n\n const childContext: SchemaContext = {\n ...context,\n parent: mutatedData,\n value,\n key,\n path: setKeyPath(context.path, key),\n };\n\n const childResult = await validator.validate(value, childContext);\n\n // Only include in validated data if not omitted\n if (childResult.data !== undefined && !validator.isOmitted()) {\n validatedData[key] = childResult.data;\n }\n\n if (childResult.isValid === false) {\n errors.push(...childResult.errors);\n }\n });\n\n await Promise.all(validationPromises);\n\n // If Phase 1 failed, return early\n if (errors.length > 0) {\n return {\n isValid: false,\n errors,\n data: undefined,\n };\n }\n\n // ═══════════════════════════════════════════════════════════\n // PHASE 2: Execute computed/managed fields with validated data\n // ═══════════════════════════════════════════════════════════\n const computedFields = this.getComputedFields();\n\n const computedPromises = Object.keys(computedFields).map(async (key) => {\n const validator = computedFields[key];\n\n const childContext: SchemaContext = {\n ...context,\n parent: validatedData,\n value: undefined, // Computed fields don't have input value\n };\n\n // Execute computed callback with validated data\n const childResult = await validator.validate(validatedData, childContext);\n\n // Only include in final data if not omitted\n if (childResult.data !== undefined && !validator.isOmitted()) {\n validatedData[key] = childResult.data;\n }\n\n if (childResult.isValid === false) {\n errors.push(...childResult.errors);\n }\n });\n\n await Promise.all(computedPromises);\n\n // If Phase 2 failed, return early\n if (errors.length > 0) {\n return {\n isValid: false,\n errors,\n data: undefined,\n };\n }\n\n // Remove undefined values\n const cleanedData = removeUndefinedValues(validatedData);\n\n const transformedData = await this.startTransformationPipeline(cleanedData, context);\n\n const output =\n this.shouldAllowUnknown === false\n ? transformedData\n : {\n ...transformedData,\n ...except(mutatedData, Object.keys(this.schema)),\n };\n\n return {\n isValid: true,\n errors: [],\n data: output,\n };\n }\n\n /**\n * Check if a validator is a computed or managed field\n * ManagedValidator extends ComputedValidator, so instanceof catches both\n */\n private isComputedValidator(validator: BaseValidator): boolean {\n return validator instanceof ComputedValidator;\n }\n\n /**\n * Get all computed/managed fields from the schema\n */\n private getComputedFields(): Record<string, ComputedValidator> {\n const computed: Record<string, any> = {};\n\n for (const [key, validator] of Object.entries(this.schema)) {\n if (validator instanceof ComputedValidator) {\n computed[key] = validator;\n }\n }\n\n return computed;\n }\n\n /**\n * @inheritdoc\n *\n * Recursively generates JSON Schema for all input fields in the schema.\n * Computed/managed fields are skipped — they have no input representation.\n *\n * **Standard targets** (`draft-2020-12`, `draft-07`, `openapi-3.0`):\n * - Fields marked `.optional()` are excluded from `required`.\n *\n * **`openai-strict` target** (OpenAI Structured Outputs):\n * - ALL fields appear in `required` — OpenAI rejects schemas with optional fields.\n * - Optional fields are instead expressed as nullable types:\n * `{ type: [\"string\", \"null\"] }` so the model can output `null` for them.\n * - Recursively applies `openai-strict` to all nested objects.\n *\n * @example\n * ```ts\n * v.object({\n * name: v.string().required(),\n * age: v.int().optional(),\n * }).toJsonSchema(\"draft-2020-12\")\n * // → { type: \"object\",\n * // properties: { name: { type: \"string\" }, age: { type: \"integer\" } },\n * // required: [\"name\"], additionalProperties: false }\n *\n * v.object({\n * name: v.string().required(),\n * age: v.int().optional(),\n * }).toJsonSchema(\"openai-strict\")\n * // → { type: \"object\",\n * // properties: { name: { type: \"string\" }, age: { type: [\"integer\", \"null\"] } },\n * // required: [\"name\", \"age\"], ← all fields\n * // additionalProperties: false }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const properties: Record<string, JsonSchemaResult> = {};\n const required: string[] = [];\n const isOpenAIStrict = target === \"openai-strict\";\n\n for (const [key, validator] of Object.entries(this.schema)) {\n // Skip computed/managed — runtime-only, no input schema\n if (validator instanceof ComputedValidator) continue;\n\n let fieldSchema = validator.toJsonSchema(target);\n\n if (isOpenAIStrict) {\n // OpenAI strict: every field must be in required.\n // Optional fields are expressed as nullable rather than absent.\n if (validator.isOptional) {\n fieldSchema = wrapNullableStrict(fieldSchema);\n }\n required.push(key);\n } else {\n // Standard JSON Schema: only non-optional fields go in required\n if (!validator.isOptional) {\n required.push(key);\n }\n }\n\n properties[key] = fieldSchema;\n }\n\n const schema: JsonSchemaResult = { type: \"object\", properties };\n\n if (required.length > 0) schema.required = required;\n if (!this.shouldAllowUnknown) schema.additionalProperties = false;\n if (this.isNullable) applyNullable(schema, target);\n\n return schema;\n }\n}\n\n/** Recursively remove undefined values from an object */\nfunction removeUndefinedValues(obj: any, visited = new WeakMap<object, any>()): any {\n // Handle primitives and null\n if (obj === null) {\n return obj;\n }\n\n // Handle arrays\n if (Array.isArray(obj)) {\n return obj.map((item) => removeUndefinedValues(item, visited));\n }\n\n // Skip non-plain objects (class instances, Dates, Buffers, etc.)\n if (!isPlainObject(obj)) {\n return obj;\n }\n\n // Handle circular references - return already processed result\n if (visited.has(obj)) {\n return visited.get(obj);\n }\n\n // Process plain objects\n const result: any = {};\n visited.set(obj, result); // Mark as processing BEFORE recursion\n\n for (const [key, value] of Object.entries(obj)) {\n if (value !== undefined) {\n result[key] = removeUndefinedValues(value, visited);\n }\n }\n\n return result;\n}\n","import { isPlainObject } from \"@mongez/supportive-is\";\r\nimport { setKeyPath } from \"../helpers\";\r\nimport { objectRule, plainObjectRule } from \"../rules\";\r\nimport type { SchemaContext, ValidationResult } from \"../types\";\r\nimport { BaseValidator } from \"./base-validator\";\r\nimport { applyNullable } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Record validator class - validates objects with dynamic keys and consistent value types\r\n *\r\n * @example\r\n * ```ts\r\n * // Translations object\r\n * v.record(v.string())\r\n * // Valid: { en: \"Hello\", ar: \"مرحبا\", fr: \"Bonjour\" }\r\n *\r\n * // User preferences\r\n * v.record(v.union([v.string(), v.number(), v.boolean()]))\r\n * // Valid: { theme: \"dark\", fontSize: 16, notifications: true }\r\n * ```\r\n */\r\nexport class RecordValidator extends BaseValidator {\r\n public constructor(\r\n public valueValidator: BaseValidator,\r\n errorMessage?: string,\r\n ) {\r\n super();\r\n this.addMutableRule(objectRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Validate it as plain object\r\n */\r\n public plainObject(errorMessage?: string) {\r\n return this.addRule(plainObjectRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is a plain object type\r\n */\r\n public matchesType(value: any): boolean {\r\n return isPlainObject(value);\r\n }\r\n\r\n /**\r\n * Clone the validator\r\n */\r\n public override clone(): this {\r\n const cloned = super.clone();\r\n cloned.valueValidator = this.valueValidator.clone();\r\n return cloned;\r\n }\r\n\r\n /**\r\n * Validate record - iterate all keys and validate each value\r\n *\r\n * Absent input (and absent without `.default()`) propagates as `data: undefined`\r\n * so the parent ObjectValidator can omit the key. Without this, optional record\r\n * fields would silently materialise as `{}` in the validated output.\r\n */\r\n public async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\r\n // Apply default when absent, then mutate. Mirrors BaseValidator's\r\n // `valueForRules = data ?? this.getDefaultValue()` so `.default({...})`\r\n // works on records too.\r\n const valueForRules = data ?? this.getDefaultValue();\r\n const mutatedData = await this.mutate(valueForRules, context);\r\n\r\n const result = await super.validate(data, context);\r\n\r\n if (result.isValid === false) return result;\r\n\r\n // Nothing to iterate for absent (no default) or null (nullable) inputs —\r\n // propagate so the parent ObjectValidator can omit the key.\r\n if (mutatedData === undefined || mutatedData === null) return result;\r\n\r\n // Defensive: type rule (objectRule) should have failed for non-objects.\r\n if (!isPlainObject(mutatedData)) return result;\r\n\r\n const errors: ValidationResult[\"errors\"] = [];\r\n const keys = Object.keys(mutatedData);\r\n\r\n // Validate all values in parallel\r\n const validationPromises = keys.map(async (key) => {\r\n const childContext: SchemaContext = {\r\n ...context,\r\n parent: mutatedData,\r\n value: mutatedData[key],\r\n key,\r\n path: setKeyPath(context.path, key),\r\n };\r\n\r\n const childResult = await this.valueValidator.validate(mutatedData[key], childContext);\r\n\r\n // Update mutated data with validated result\r\n mutatedData[key] = childResult.data;\r\n\r\n // Collect errors from this value\r\n if (childResult.isValid === false) {\r\n errors.push(...childResult.errors);\r\n }\r\n });\r\n\r\n await Promise.all(validationPromises);\r\n\r\n return {\r\n isValid: errors.length === 0,\r\n errors,\r\n data: await this.startTransformationPipeline(mutatedData, context),\r\n };\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Generates `{ type: \"object\", additionalProperties: <valueSchema> }` —\r\n * the standard JSON Schema for a dictionary/map with homogeneous values.\r\n *\r\n * @example\r\n * ```ts\r\n * v.record(v.string()).toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"object\", additionalProperties: { type: \"string\" } }\r\n *\r\n * v.record(v.union([v.string(), v.number()])).toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"object\", additionalProperties: { oneOf: [{ type: \"string\" }, { type: \"number\" }] } }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const schema: JsonSchemaResult = {\r\n type: \"object\",\r\n additionalProperties: this.valueValidator.toJsonSchema(target),\r\n };\r\n\r\n if (this.isNullable) applyNullable(schema, target);\r\n\r\n return schema;\r\n }\r\n}\r\n","import { invalidRule, VALID_RULE } from \"../helpers\";\r\nimport { numberMutator, stringMutator } from \"../mutators\";\r\nimport {\r\n acceptedIfPresentRule,\r\n acceptedIfRequiredRule,\r\n acceptedIfRule,\r\n acceptedRule,\r\n acceptedUnlessRule,\r\n acceptedWithoutRule,\r\n declinedIfPresentRule,\r\n declinedIfRequiredRule,\r\n declinedIfRule,\r\n declinedRule,\r\n declinedUnlessRule,\r\n declinedWithoutRule,\r\n} from \"../rules/scalar\";\r\nimport { PrimitiveValidator } from \"./primitive-validator\";\r\nimport { getRuleOptions } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Scalar validator class\r\n *\r\n * Core validator for scalar values (string, number, boolean).\r\n * Extends PrimitiveValidator (inherits enum/in/oneOf/allowsOnly/forbids/notIn)\r\n * and additionally provides type-coercion mutators and accepted/declined rules.\r\n *\r\n * Database methods (unique, exists, etc.) are injected by the framework\r\n */\r\nexport class ScalarValidator extends PrimitiveValidator {\r\n public constructor(errorMessage?: string) {\r\n super();\r\n this.addMutableRule(\r\n {\r\n name: \"scalar\",\r\n defaultErrorMessage: \"The :input must be a scalar value\",\r\n async validate(value, context) {\r\n if ([\"string\", \"number\", \"boolean\"].includes(typeof value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n },\r\n errorMessage,\r\n );\r\n }\r\n\r\n /**\r\n * Add matches type\r\n */\r\n public matchesType(value: any) {\r\n return typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\";\r\n }\r\n\r\n /**\r\n * Mutate the scalar value to be number\r\n */\r\n public asNumber() {\r\n return this.addMutator(numberMutator);\r\n }\r\n\r\n /**\r\n * Mutate the scalar value to be string\r\n */\r\n public asString() {\r\n return this.addMutator(stringMutator);\r\n }\r\n\r\n /**\r\n * Accepted value\r\n * The value will be valid if it equals 1 | \"1\" | true | \"true\" | \"yes\" | \"y\" | \"on\"\r\n */\r\n public accepted(errorMessage?: string) {\r\n return this.addRule(acceptedRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Accepted value if another field's value equals to a specific value\r\n */\r\n public acceptedIf(field: string, value: any, errorMessage?: string) {\r\n return this.addRule(acceptedIfRule, errorMessage, { field, value });\r\n }\r\n\r\n /**\r\n * Accepted value if another field's value is not equal to the given value\r\n */\r\n public acceptedUnless(field: string, value: any, errorMessage?: string) {\r\n return this.addRule(acceptedUnlessRule, errorMessage, { field, value });\r\n }\r\n\r\n /**\r\n * Accepted value if another field is required\r\n */\r\n public acceptedIfRequired(field: string, errorMessage?: string) {\r\n return this.addRule(acceptedIfRequiredRule, errorMessage, { field });\r\n }\r\n\r\n /**\r\n * Accepted value if another field is present\r\n */\r\n public acceptedIfPresent(field: string, errorMessage?: string) {\r\n return this.addRule(acceptedIfPresentRule, errorMessage, { field });\r\n }\r\n\r\n /**\r\n * Accepted value if another field is missing\r\n */\r\n public acceptedWithout(field: string, errorMessage?: string) {\r\n return this.addRule(acceptedWithoutRule, errorMessage, { field });\r\n }\r\n\r\n /**\r\n * Declined value\r\n * The value will be valid if it equals 0 | \"0\" | false | \"false\" | \"no\" | \"n\" | \"off\"\r\n */\r\n public declined(errorMessage?: string) {\r\n return this.addRule(declinedRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Declined value if another field's value equals to a specific value\r\n */\r\n public declinedIf(field: string, value: any, errorMessage?: string) {\r\n return this.addRule(declinedIfRule, errorMessage, { field, value });\r\n }\r\n\r\n /**\r\n * Declined value if another field's value is not equal to the given value\r\n */\r\n public declinedUnless(field: string, value: any, errorMessage?: string) {\r\n return this.addRule(declinedUnlessRule, errorMessage, { field, value });\r\n }\r\n\r\n /**\r\n * Declined value if another field is required\r\n */\r\n public declinedIfRequired(field: string, errorMessage?: string) {\r\n return this.addRule(declinedIfRequiredRule, errorMessage, { field });\r\n }\r\n\r\n /**\r\n * Declined value if another field is present\r\n */\r\n public declinedIfPresent(field: string, errorMessage?: string) {\r\n return this.addRule(declinedIfPresentRule, errorMessage, { field });\r\n }\r\n\r\n /**\r\n * Declined value if another field is missing\r\n */\r\n public declinedWithout(field: string, errorMessage?: string) {\r\n return this.addRule(declinedWithoutRule, errorMessage, { field });\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * A scalar accepts string | number | boolean. If `.in()` / `.enum()` is used,\r\n * output collapses to a simple `enum` list instead.\r\n *\r\n * @example\r\n * ```ts\r\n * v.scalar().toJsonSchema(\"draft-2020-12\")\r\n * // → { oneOf: [{ type: \"string\" }, { type: \"number\" }, { type: \"boolean\" }] }\r\n *\r\n * v.scalar().in([\"active\", \"inactive\"]).toJsonSchema(\"draft-2020-12\")\r\n * // → { enum: [\"active\", \"inactive\"] }\r\n * ```\r\n */\r\n public override toJsonSchema(_target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n // If a value set is constrained, collapse to enum\r\n const inOpts = getRuleOptions(this.rules, \"in\");\r\n if (inOpts?.values && Array.isArray(inOpts.values)) {\r\n return { enum: inOpts.values };\r\n }\r\n\r\n const enumOpts = getRuleOptions(this.rules, \"enum\");\r\n if (enumOpts?.enum && Array.isArray(enumOpts.enum)) {\r\n return { enum: enumOpts.enum };\r\n }\r\n\r\n return {\r\n oneOf: [\r\n { type: \"string\" },\r\n { type: \"number\" },\r\n { type: \"boolean\" },\r\n ],\r\n };\r\n }\r\n}\n","import {\r\n alphaOnlyMutator,\r\n alphanumericOnlyMutator,\r\n appendMutator,\r\n base64DecodeMutator,\r\n base64EncodeMutator,\r\n camelCaseMutator,\r\n capitalizeMutator,\r\n htmlEscapeMutator,\r\n kebabCaseMutator,\r\n lowercaseMutator,\r\n ltrimMutator,\r\n maskMutator,\r\n padEndMutator,\r\n padStartMutator,\r\n pascalCaseMutator,\r\n prependMutator,\r\n removeNumbersMutator,\r\n removeSpecialCharactersMutator,\r\n repeatMutator,\r\n replaceAllMutator,\r\n replaceMutator,\r\n reverseMutator,\r\n rtrimMutator,\r\n safeHtmlMutator,\r\n slugMutator,\r\n snakeCaseMutator,\r\n stringifyMutator,\r\n titleCaseMutator,\r\n trimMultipleWhitespaceMutator,\r\n trimMutator,\r\n truncateMutator,\r\n unescapeHtmlMutator,\r\n uppercaseMutator,\r\n urlDecodeMutator,\r\n urlEncodeMutator,\r\n} from \"../mutators\";\r\nimport {\r\n alphaNumericRule,\r\n alphaRule,\r\n betweenLengthRule,\r\n colorRule,\r\n containsRule,\r\n cuidRule,\r\n darkColorRule,\r\n emailRule,\r\n endsWithRule,\r\n hexColorRule,\r\n hslColorRule,\r\n ip4Rule,\r\n ip6Rule,\r\n ipRule,\r\n isCreditCardRule,\r\n isNumericRule,\r\n lengthRule,\r\n lightColorRule,\r\n maxLengthRule,\r\n maxWordsRule,\r\n minLengthRule,\r\n minWordsRule,\r\n nanoidRule,\r\n notContainsRule,\r\n patternRule,\r\n rgbColorRule,\r\n rgbaColorRule,\r\n startsWithRule,\r\n stringRule,\r\n strongPasswordRule,\r\n ulidRule,\r\n urlRule,\r\n uuidRule,\r\n withoutWhitespaceRule,\r\n wordsRule,\r\n type UUIDVersion,\r\n} from \"../rules\";\r\nimport { PrimitiveValidator } from \"./primitive-validator\";\r\nimport { applyNullable, getRuleOptions } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * String validator class\r\n */\r\nexport class StringValidator extends PrimitiveValidator {\r\n public constructor(errorMessage?: string) {\r\n super();\r\n this.addMutableRule(stringRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is a string type\r\n */\r\n public matchesType(value: any): boolean {\r\n return typeof value === \"string\";\r\n }\r\n\r\n // ==================== Mutators ====================\r\n\r\n /**\r\n * Stringify the value if not a string\r\n */\r\n public toString() {\r\n return this.addMutator(stringifyMutator);\r\n }\r\n\r\n /** Convert string to uppercase */\r\n public uppercase() {\r\n return this.addMutator(uppercaseMutator);\r\n }\r\n\r\n /** Convert string to lowercase */\r\n public lowercase() {\r\n return this.addMutator(lowercaseMutator);\r\n }\r\n\r\n /** Capitalize only the first letter of the string */\r\n public capitalize() {\r\n return this.addMutator(capitalizeMutator);\r\n }\r\n\r\n /** Capitalize the first letter of each word (Title Case) */\r\n public titleCase() {\r\n return this.addMutator(titleCaseMutator);\r\n }\r\n\r\n /** Convert to camelCase */\r\n public camelCase() {\r\n return this.addMutator(camelCaseMutator);\r\n }\r\n\r\n /** Convert to PascalCase */\r\n public pascalCase() {\r\n return this.addMutator(pascalCaseMutator);\r\n }\r\n\r\n /** Convert to snake_case */\r\n public snakeCase() {\r\n return this.addMutator(snakeCaseMutator);\r\n }\r\n\r\n /** Convert to kebab-case */\r\n public kebabCase() {\r\n return this.addMutator(kebabCaseMutator);\r\n }\r\n\r\n /**\r\n * Trim the given needle from the string\r\n * If no needle is provided, the default is a single space\r\n */\r\n public trim(needle?: string) {\r\n return this.addMutator(trimMutator, { needle });\r\n }\r\n\r\n /** Trim from the left/start */\r\n public ltrim(needle?: string) {\r\n return this.addMutator(ltrimMutator, { needle });\r\n }\r\n\r\n /** Trim from the right/end */\r\n public rtrim(needle?: string) {\r\n return this.addMutator(rtrimMutator, { needle });\r\n }\r\n\r\n /** Trim multiple whitespace into single space */\r\n public trimMultipleWhitespace() {\r\n return this.addMutator(trimMultipleWhitespaceMutator);\r\n }\r\n\r\n /** Pad string from the start to reach target length */\r\n public padStart(length: number, char = \" \") {\r\n return this.addMutator(padStartMutator, { length, char });\r\n }\r\n\r\n /** Pad string from the end to reach target length */\r\n public padEnd(length: number, char = \" \") {\r\n return this.addMutator(padEndMutator, { length, char });\r\n }\r\n\r\n /** Remove HTML tags (safe HTML) */\r\n public safeHtml() {\r\n return this.addMutator(safeHtmlMutator);\r\n }\r\n\r\n /** HTML escape special characters */\r\n public htmlEscape() {\r\n return this.addMutator(htmlEscapeMutator);\r\n }\r\n\r\n /** Unescape HTML entities */\r\n public unescapeHtml() {\r\n return this.addMutator(unescapeHtmlMutator);\r\n }\r\n\r\n /**\r\n * Remove special characters\r\n * This will remove all characters that are not alphanumeric or whitespace\r\n */\r\n public removeSpecialCharacters() {\r\n return this.addMutator(removeSpecialCharactersMutator);\r\n }\r\n\r\n /** Convert to only alphabetic characters */\r\n public toAlpha() {\r\n return this.addMutator(alphaOnlyMutator);\r\n }\r\n\r\n /** Convert to only alphanumeric characters */\r\n public toAlphanumeric() {\r\n return this.addMutator(alphanumericOnlyMutator);\r\n }\r\n\r\n /** Remove all numeric characters */\r\n public removeNumbers() {\r\n return this.addMutator(removeNumbersMutator);\r\n }\r\n\r\n /** URL decode */\r\n public urlDecode() {\r\n return this.addMutator(urlDecodeMutator);\r\n }\r\n\r\n /** URL encode */\r\n public urlEncode() {\r\n return this.addMutator(urlEncodeMutator);\r\n }\r\n\r\n /** Convert to URL-friendly slug */\r\n public slug() {\r\n return this.addMutator(slugMutator);\r\n }\r\n\r\n /** Base64 encode */\r\n public base64Encode() {\r\n return this.addMutator(base64EncodeMutator);\r\n }\r\n\r\n /** Base64 decode */\r\n public base64Decode() {\r\n return this.addMutator(base64DecodeMutator);\r\n }\r\n\r\n /** Replace substring or pattern */\r\n public replace(search: string | RegExp, replace: string) {\r\n return this.addMutator(replaceMutator, { search, replace });\r\n }\r\n\r\n /** Replace all occurrences of substring or pattern */\r\n public replaceAll(search: string | RegExp, replace: string) {\r\n return this.addMutator(replaceAllMutator, { search, replace });\r\n }\r\n\r\n /** Append/suffix text to the end */\r\n public append(suffix: string) {\r\n return this.addMutator(appendMutator, { suffix });\r\n }\r\n\r\n /** Prepend/prefix text to the beginning */\r\n public prepend(prefix: string) {\r\n return this.addMutator(prependMutator, { prefix });\r\n }\r\n\r\n /** Reverse the string */\r\n public reverse() {\r\n return this.addMutator(reverseMutator);\r\n }\r\n\r\n /** Truncate to a maximum length */\r\n public truncate(maxLength: number, suffix = \"...\") {\r\n return this.addMutator(truncateMutator, { maxLength, suffix });\r\n }\r\n\r\n /** Repeat string N times */\r\n public repeat(count: number) {\r\n return this.addMutator(repeatMutator, { count });\r\n }\r\n\r\n /** Mask part of string */\r\n public mask(start: number, end?: number, char = \"*\") {\r\n return this.addMutator(maskMutator, { start, end, char });\r\n }\r\n\r\n // ==================== Validation Rules ====================\r\n\r\n /** Value must be a valid email */\r\n public email(errorMessage?: string) {\r\n return this.addRule(emailRule, errorMessage);\r\n }\r\n\r\n /** Value must be a valid URL */\r\n public url(errorMessage?: string) {\r\n return this.addRule(urlRule, errorMessage);\r\n }\r\n\r\n /** Value can not have whitespace */\r\n public withoutWhitespace(errorMessage?: string) {\r\n return this.addRule(withoutWhitespaceRule, errorMessage);\r\n }\r\n\r\n /** Value must match the given pattern */\r\n public pattern(pattern: RegExp, errorMessage?: string) {\r\n return this.addRule(patternRule, errorMessage, { pattern });\r\n }\r\n\r\n /**\r\n * Value must be a strong password\r\n * Requirements:\r\n * - At least 8 characters\r\n * - At least 1 uppercase letter\r\n * - At least 1 lowercase letter\r\n * - At least 1 number\r\n * - At least 1 special character\r\n */\r\n public strongPassword(minLength?: number, errorMessage?: string) {\r\n return this.addRule(strongPasswordRule, errorMessage, { minLength });\r\n }\r\n\r\n /** Value must be exactly the given number of words */\r\n public words(words: number, errorMessage?: string) {\r\n return this.addRule(wordsRule, errorMessage, { words });\r\n }\r\n\r\n /** Value must be at least the given number of words */\r\n public minWords(words: number, errorMessage?: string) {\r\n return this.addRule(minWordsRule, errorMessage, { minWords: words });\r\n }\r\n\r\n /** Value must be at most the given number of words */\r\n public maxWords(words: number, errorMessage?: string) {\r\n return this.addRule(maxWordsRule, errorMessage, { maxWords: words });\r\n }\r\n\r\n /** Value length must be greater than the given length */\r\n public minLength(length: number, errorMessage?: string) {\r\n return this.addRule(minLengthRule, errorMessage, { minLength: length });\r\n }\r\n\r\n /** @alias minLength */\r\n public min(min: number, errorMessage?: string) {\r\n return this.minLength(min, errorMessage);\r\n }\r\n\r\n /** Value length must be less than the given length */\r\n public maxLength(length: number, errorMessage?: string) {\r\n return this.addRule(maxLengthRule, errorMessage, { maxLength: length });\r\n }\r\n\r\n /** @alias maxLength */\r\n public max(max: number, errorMessage?: string) {\r\n return this.maxLength(max, errorMessage);\r\n }\r\n\r\n /** Value must be of the given length */\r\n public length(length: number, errorMessage?: string) {\r\n return this.addRule(lengthRule, errorMessage, { length });\r\n }\r\n\r\n /**\r\n * String length must be between min and max (inclusive)\r\n *\r\n * @param min - Minimum length (inclusive)\r\n * @param max - Maximum length (inclusive)\r\n *\r\n * @example\r\n * ```ts\r\n * v.string().between(5, 10) // Length: 5 to 10 characters\r\n * v.string().lengthBetween(8, 20) // Same using alias\r\n * ```\r\n *\r\n * @category Validation Rule\r\n */\r\n public lengthBetween(min: number, max: number, errorMessage?: string) {\r\n return this.addRule(betweenLengthRule, errorMessage, {\r\n minLength: min,\r\n maxLength: max,\r\n });\r\n }\r\n\r\n /** Allow only alphabetic characters */\r\n public alpha(errorMessage?: string) {\r\n return this.addRule(alphaRule, errorMessage);\r\n }\r\n\r\n /** Allow only alphanumeric characters */\r\n public alphanumeric(errorMessage?: string) {\r\n return this.addRule(alphaNumericRule, errorMessage);\r\n }\r\n\r\n /** Allow only numeric characters */\r\n public numeric(errorMessage?: string) {\r\n return this.addRule(isNumericRule, errorMessage);\r\n }\r\n\r\n /** Value must starts with the given string */\r\n public startsWith(value: string, errorMessage?: string) {\r\n return this.addRule(startsWithRule, errorMessage, { value });\r\n }\r\n\r\n /** Value must ends with the given string */\r\n public endsWith(value: string, errorMessage?: string) {\r\n return this.addRule(endsWithRule, errorMessage, { value });\r\n }\r\n\r\n /** Value must contain the given string */\r\n public contains(value: string, errorMessage?: string) {\r\n return this.addRule(containsRule, errorMessage, { value });\r\n }\r\n\r\n /** Value must not contain the given string */\r\n public notContains(value: string, errorMessage?: string) {\r\n return this.addRule(notContainsRule, errorMessage, { value });\r\n }\r\n\r\n /** Value must be a valid IP address */\r\n public ip(errorMessage?: string) {\r\n return this.addRule(ipRule, errorMessage);\r\n }\r\n\r\n /** Value must be a valid IPv4 address */\r\n public ip4(errorMessage?: string) {\r\n return this.addRule(ip4Rule, errorMessage);\r\n }\r\n\r\n /** Value must be a valid IPv6 address */\r\n public ip6(errorMessage?: string) {\r\n return this.addRule(ip6Rule, errorMessage);\r\n }\r\n\r\n /** Check if the string matches a credit card number */\r\n public creditCard(errorMessage?: string) {\r\n return this.addRule(isCreditCardRule, errorMessage);\r\n }\r\n\r\n /** Determine if the value is a valid color */\r\n public color(errorMessage?: string) {\r\n return this.addRule(colorRule, errorMessage);\r\n }\r\n\r\n /** Determine if the value is a valid hex color */\r\n public hexColor(errorMessage?: string) {\r\n return this.addRule(hexColorRule, errorMessage);\r\n }\r\n\r\n /** Determine if the value is a valid HSL color */\r\n public hslColor(errorMessage?: string) {\r\n return this.addRule(hslColorRule, errorMessage);\r\n }\r\n\r\n /** Determine if the value is a valid RGB color */\r\n public rgbColor(errorMessage?: string) {\r\n return this.addRule(rgbColorRule, errorMessage);\r\n }\r\n\r\n /** Determine if the value is a valid RGBA color */\r\n public rgbaColor(errorMessage?: string) {\r\n return this.addRule(rgbaColorRule, errorMessage);\r\n }\r\n\r\n /** Determine if the value is a valid light color */\r\n public lightColor(errorMessage?: string) {\r\n return this.addRule(lightColorRule, errorMessage);\r\n }\r\n\r\n /** Determine if the value is a valid dark color */\r\n public darkColor(errorMessage?: string) {\r\n return this.addRule(darkColorRule, errorMessage);\r\n }\r\n\r\n // ==================== ID Format Rules ====================\r\n\r\n /**\r\n * Value must be a valid UUID. Optionally restrict to a specific version.\r\n *\r\n * @example\r\n * v.string().uuid() // any RFC 4122 UUID\r\n * v.string().uuid(4) // only v4 (random)\r\n * v.string().uuid(7) // only v7 (timestamp-ordered)\r\n */\r\n public uuid(version?: UUIDVersion, errorMessage?: string) {\r\n return this.addRule(uuidRule, errorMessage, { version });\r\n }\r\n\r\n /**\r\n * Value must be a valid CUID. Defaults to CUID2; pass `{ version: 1 }` for legacy.\r\n *\r\n * @example\r\n * v.string().cuid() // CUID2\r\n * v.string().cuid({ version: 1 }) // legacy CUID1\r\n */\r\n public cuid(options?: { version?: 1 | 2; errorMessage?: string }) {\r\n const { errorMessage, version } = options ?? {};\r\n return this.addRule(cuidRule, errorMessage, { version });\r\n }\r\n\r\n /** Value must be a valid ULID (26 chars, Crockford base32). */\r\n public ulid(errorMessage?: string) {\r\n return this.addRule(ulidRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Value must be a valid nanoid string. Default length is 21.\r\n *\r\n * @example\r\n * v.string().nanoid() // 21 chars (default)\r\n * v.string().nanoid(10) // 10 chars\r\n */\r\n public nanoid(length?: number, errorMessage?: string) {\r\n return this.addRule(nanoidRule, errorMessage, { length });\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Maps String-specific rule options to JSON Schema keywords.\r\n * Non-representable rules (cross-field, refine, color rules, etc.) are silently omitted.\r\n *\r\n * @example\r\n * ```ts\r\n * v.string().min(2).max(100).email().toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"string\", minLength: 2, maxLength: 100, format: \"email\" }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const schema: JsonSchemaResult = { type: \"string\" };\r\n\r\n // minLength / min\r\n const minOpts = getRuleOptions(this.rules, \"minLength\");\r\n if (minOpts?.minLength !== undefined) schema.minLength = minOpts.minLength;\r\n\r\n // maxLength / max\r\n const maxOpts = getRuleOptions(this.rules, \"maxLength\");\r\n if (maxOpts?.maxLength !== undefined) schema.maxLength = maxOpts.maxLength;\r\n\r\n // betweenLength covers both min and max in one rule\r\n const betweenOpts = getRuleOptions(this.rules, \"betweenLength\");\r\n if (betweenOpts) {\r\n if (betweenOpts.minLength !== undefined) schema.minLength = betweenOpts.minLength;\r\n if (betweenOpts.maxLength !== undefined) schema.maxLength = betweenOpts.maxLength;\r\n }\r\n\r\n // exact length\r\n const lengthOpts = getRuleOptions(this.rules, \"length\");\r\n if (lengthOpts?.length !== undefined) {\r\n schema.minLength = lengthOpts.length;\r\n schema.maxLength = lengthOpts.length;\r\n }\r\n\r\n // pattern (regex)\r\n const patternOpts = getRuleOptions(this.rules, \"pattern\");\r\n if (patternOpts?.pattern instanceof RegExp) {\r\n schema.pattern = patternOpts.pattern.source;\r\n }\r\n\r\n // format hints\r\n if (getRuleOptions(this.rules, \"email\") !== undefined ||\r\n this.rules.some(r => r.name === \"email\")) {\r\n schema.format = \"email\";\r\n } else if (this.rules.some(r => r.name === \"url\")) {\r\n schema.format = \"uri\";\r\n } else if (this.rules.some(r => r.name === \"ip\")) {\r\n schema.format = \"ipv4\";\r\n } else if (this.rules.some(r => r.name === \"ip4\")) {\r\n schema.format = \"ipv4\";\r\n } else if (this.rules.some(r => r.name === \"ip6\")) {\r\n schema.format = \"ipv6\";\r\n } else if (this.rules.some(r => r.name === \"uuid\")) {\r\n schema.format = \"uuid\";\r\n } else if (this.rules.some(r => r.name === \"hexColor\")) {\r\n schema.format = \"color\";\r\n }\r\n\r\n // CUID / ULID / nanoid don't have widely-supported format keywords —\r\n // fall back to pattern so JSON Schema validators still enforce shape.\r\n if (!schema.format) {\r\n const cuidOpts = getRuleOptions(this.rules, \"cuid\");\r\n if (cuidOpts) {\r\n schema.pattern = cuidOpts.version === 1 ? \"^c[a-z0-9]{24,}$\" : \"^[a-z][a-z0-9]{23}$\";\r\n }\r\n if (this.rules.some(r => r.name === \"ulid\")) {\r\n schema.pattern = \"^[0-9A-HJKMNP-TV-Z]{26}$\";\r\n }\r\n const nanoidOpts = getRuleOptions(this.rules, \"nanoid\");\r\n if (nanoidOpts) {\r\n const len = (nanoidOpts.length as number | undefined) ?? 21;\r\n schema.pattern = `^[A-Za-z0-9_-]{${len}}$`;\r\n }\r\n }\r\n\r\n // enum (from PrimitiveValidator.in / .enum)\r\n const inOpts = getRuleOptions(this.rules, \"in\");\r\n if (inOpts?.values && Array.isArray(inOpts.values)) {\r\n schema.enum = inOpts.values;\r\n }\r\n\r\n if (this.isNullable) applyNullable(schema, target);\r\n\r\n return schema;\r\n }\r\n}\r\n","import { setKeyPath } from \"../helpers\";\r\nimport { arrayRule } from \"../rules\";\r\nimport type { SchemaContext, ValidationResult } from \"../types\";\r\nimport { BaseValidator } from \"./base-validator\";\r\nimport { applyNullable } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Tuple validator class - validates fixed-length arrays with position-specific types\r\n *\r\n * @example\r\n * ```ts\r\n * // RGB color tuple\r\n * v.tuple([v.number(), v.number(), v.number()])\r\n * // Valid: [255, 128, 0]\r\n * // Invalid: [255, 128] (too short)\r\n *\r\n * // Mixed types\r\n * v.tuple([v.string(), v.int(), v.boolean()])\r\n * // Valid: [\"John\", 25, true]\r\n * ```\r\n */\r\nexport class TupleValidator extends BaseValidator {\r\n public constructor(\r\n public validators: BaseValidator[],\r\n errorMessage?: string,\r\n ) {\r\n super();\r\n this.addMutableRule(arrayRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is an array type\r\n */\r\n public matchesType(value: any): boolean {\r\n return Array.isArray(value);\r\n }\r\n\r\n /**\r\n * Clone the validator\r\n */\r\n public override clone(): this {\r\n const cloned = super.clone();\r\n cloned.validators = this.validators.map((v) => v.clone());\r\n return cloned;\r\n }\r\n\r\n /**\r\n * Validate tuple - check length then validate each position\r\n *\r\n * Absent input (and absent without `.default()`) propagates as `data: undefined`\r\n * so the parent ObjectValidator can omit the key. Without this, optional tuple\r\n * fields would silently materialise as `[]` in the validated output and then\r\n * fail the length check.\r\n */\r\n public async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\r\n // Apply default when absent, then mutate. Mirrors BaseValidator's\r\n // `valueForRules = data ?? this.getDefaultValue()` so `.default([...])`\r\n // works on tuples too.\r\n const valueForRules = data ?? this.getDefaultValue();\r\n const mutatedData = await this.mutate(valueForRules, context);\r\n\r\n const result = await super.validate(data, context);\r\n\r\n if (result.isValid === false) return result;\r\n\r\n // Nothing to iterate for absent (no default) or null (nullable) inputs —\r\n // propagate so the parent ObjectValidator can omit the key.\r\n if (mutatedData === undefined || mutatedData === null) return result;\r\n\r\n // Defensive: type rule (arrayRule) should have failed for non-arrays.\r\n if (!Array.isArray(mutatedData)) return result;\r\n\r\n const errors: ValidationResult[\"errors\"] = [];\r\n\r\n // Tuple-specific: length validation\r\n if (mutatedData.length !== this.validators.length) {\r\n errors.push({\r\n type: \"tuple\",\r\n input: context.key || \"value\",\r\n error: `Expected exactly ${this.validators.length} items, but got ${mutatedData.length}`,\r\n });\r\n return { isValid: false, errors, data: mutatedData };\r\n }\r\n\r\n // Validate each position with its specific validator in parallel\r\n const validationPromises = this.validators.map(async (validator, index) => {\r\n const childContext: SchemaContext = {\r\n ...context,\r\n parent: mutatedData,\r\n value: mutatedData[index],\r\n key: index.toString(),\r\n path: setKeyPath(context.path, index.toString()),\r\n };\r\n\r\n const childResult = await validator.validate(mutatedData[index], childContext);\r\n\r\n // Update mutated data with validated result\r\n mutatedData[index] = childResult.data;\r\n\r\n // Collect errors from this element\r\n if (childResult.isValid === false) {\r\n errors.push(...childResult.errors);\r\n }\r\n });\r\n\r\n await Promise.all(validationPromises);\r\n\r\n return {\r\n isValid: errors.length === 0,\r\n errors,\r\n data: await this.startTransformationPipeline(mutatedData, context),\r\n };\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Tuple keyword diverges between targets:\r\n * - `draft-2020-12` → `prefixItems` + `items: false` (exact length enforced)\r\n * - `draft-07` → `items` as array + `additionalItems: false`\r\n * - `openapi-3.0` → same as draft-07 (OpenAPI 3.0 is based on draft-07)\r\n *\r\n * @example\r\n * ```ts\r\n * v.tuple([v.string(), v.int(), v.boolean()]).toJsonSchema(\"draft-2020-12\")\r\n * // → {\r\n * // type: \"array\",\r\n * // prefixItems: [{ type: \"string\" }, { type: \"integer\" }, { type: \"boolean\" }],\r\n * // items: false,\r\n * // minItems: 3,\r\n * // maxItems: 3\r\n * // }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const itemSchemas = this.validators.map(v => v.toJsonSchema(target));\r\n const length = this.validators.length;\r\n\r\n const schema: JsonSchemaResult = {\r\n type: \"array\",\r\n minItems: length,\r\n maxItems: length,\r\n };\r\n\r\n if (target === \"draft-2020-12\") {\r\n // prefixItems is the draft-2020-12 keyword for positional tuple items\r\n schema.prefixItems = itemSchemas;\r\n schema.items = false; // no additional items beyond the tuple\r\n } else {\r\n // draft-07 and openapi-3.0: items as array + additionalItems: false\r\n schema.items = itemSchemas;\r\n schema.additionalItems = false;\r\n }\r\n\r\n if (this.isNullable) applyNullable(schema, target);\r\n\r\n return schema;\r\n }\r\n}\r\n","import { unionRule } from \"../rules\";\r\nimport { BaseValidator } from \"./base-validator\";\r\nimport { getRuleOptions } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Union validator class - validates value against multiple validator types\r\n *\r\n * Tries each validator in order until one passes. If a validator's matchesType()\r\n * returns false, it's skipped for optimization. First validator that both matches\r\n * the type and passes validation wins.\r\n *\r\n * @example\r\n * ```ts\r\n * // Accept email or username\r\n * const identifier = v.union([\r\n * v.string().email(),\r\n * v.string().alphanumeric().min(3).max(20)\r\n * ]);\r\n *\r\n * // Accept different types\r\n * const customValue = v.union([\r\n * v.string().required(),\r\n * v.number().required(),\r\n * v.boolean().required(),\r\n * v.file().required()\r\n * ]);\r\n * ```\r\n */\r\nexport class UnionValidator extends BaseValidator {\r\n /**\r\n * Set the validators to try for union validation\r\n *\r\n * @param validators - Array of validators to try\r\n * @param errorMessage - Optional custom error message if all validators fail\r\n * @returns This validator for chaining\r\n *\r\n * @example\r\n * ```ts\r\n * new UnionValidator()\r\n * .union([v.string(), v.number()], 'Must be string or number');\r\n * ```\r\n */\r\n public union(validators: BaseValidator[], errorMessage?: string) {\r\n return this.addRule(unionRule, errorMessage, { validators });\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Generates `{ oneOf: [...] }` by mapping each sub-validator to its JSON Schema.\r\n *\r\n * @example\r\n * ```ts\r\n * v.union([v.string(), v.number()]).toJsonSchema(\"draft-2020-12\")\r\n * // → { oneOf: [{ type: \"string\" }, { type: \"number\" }] }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const opts = getRuleOptions(this.rules, \"union\");\r\n const validators = (opts?.validators ?? []) as BaseValidator[];\r\n\r\n return {\r\n oneOf: validators.map(v => v.toJsonSchema(target)),\r\n };\r\n }\r\n}\r\n","import { SealConfig } from \"../config\";\nimport type { StandardSchemaV1 } from \"../standard-schema/types\";\nimport type { Schema, SchemaContext, ValidationResult } from \"../types\";\nimport type { Infer } from \"../types/inference-types\";\nimport { AnyValidator } from \"../validators/any-validator\";\nimport { ArrayValidator } from \"../validators/array-validator\";\nimport type { BaseValidator } from \"../validators/base-validator\";\nimport { BooleanValidator } from \"../validators/boolean-validator\";\nimport { ComputedValidator } from \"../validators/computed-validator\";\nimport { DateValidator } from \"../validators/date-validator\";\nimport { DiscriminatedUnionValidator } from \"../validators/discriminated-union-validator\";\nimport { FloatValidator } from \"../validators/float-validator\";\nimport { InstanceOfValidator } from \"../validators/instanceof-validator\";\nimport { IntValidator } from \"../validators/int-validator\";\nimport { LazyValidator } from \"../validators/lazy-validator\";\nimport { LiteralValidator } from \"../validators/literal-validator\";\nimport { ManagedValidator } from \"../validators/managed-validator\";\nimport { NumberValidator } from \"../validators/number-validator\";\nimport { NumericValidator } from \"../validators/numeric-validator\";\nimport { ObjectValidator } from \"../validators/object-validator\";\nimport { RecordValidator } from \"../validators/record-validator\";\nimport { ScalarValidator } from \"../validators/scalar-validator\";\nimport { StringValidator } from \"../validators/string-validator\";\nimport { TupleValidator } from \"../validators/tuple-validator\";\nimport { UnionValidator } from \"../validators/union-validator\";\n// BaseValidator prototype augmentations — side-effect imports so the `v`\n// factory always exposes the chain methods (.required, .requiredIf, .sameAs,\n// .present, .forbidden, .when, …) regardless of which entry path loaded it.\n// The package barrel (src/index.ts) loads these via the validators barrel, but\n// importing the factory leaf directly would otherwise yield a half-built `v`.\nimport \"../validators/methods/equality-conditional-methods\";\nimport \"../validators/methods/forbidden-methods\";\nimport \"../validators/methods/present-methods\";\nimport \"../validators/methods/required-methods\";\nimport { validate as validateFunction } from \"./validate\";\n\n/**\n * Seal factory object - creates instances of validators\n *\n * Use 'v' to create validation schemas (seals) for your data\n */\nexport const v: ValidatorV = {\n /** Create an object validator */\n object: <T extends Schema>(schema: T, errorMessage?: string) =>\n new ObjectValidator<T>(schema, errorMessage) as ObjectValidator<T> &\n StandardSchemaV1<Infer<ObjectValidator<T>>>,\n\n /** Create an any validator */\n any: () => new AnyValidator() as AnyValidator & StandardSchemaV1<any>,\n\n /** Create an array validator */\n array: <T extends BaseValidator>(validator: T, errorMessage?: string) =>\n new ArrayValidator(validator, errorMessage) as ArrayValidator & {\n validator: T;\n } & StandardSchemaV1<Array<Infer<T>>>,\n\n /** Create a record validator - object with dynamic keys and consistent value types */\n record: <T extends BaseValidator>(validator?: T, errorMessage?: string) =>\n new RecordValidator(validator || v.any(), errorMessage) as RecordValidator & {\n valueValidator: T;\n } & StandardSchemaV1<Record<string, Infer<T>>>,\n\n /** Create a tuple validator - fixed-length array with position-specific types */\n tuple: <T extends BaseValidator[]>(validators: T, errorMessage?: string) =>\n new TupleValidator(validators, errorMessage) as TupleValidator & {\n validators: T;\n } & StandardSchemaV1<{ [K in keyof T]: Infer<T[K]> }>,\n\n /** Create a date validator */\n date: (errorMessage?: string) =>\n new DateValidator(errorMessage) as DateValidator & StandardSchemaV1<Date>,\n\n /**\n * Create a literal validator — narrows to the union of given literal values\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 */\n literal: <T extends readonly [string | number | boolean, ...(string | number | boolean)[]]>(\n ...values: T\n ) =>\n new LiteralValidator<T>(values) as LiteralValidator<T> & StandardSchemaV1<T[number]>,\n\n /**\n * Create an instanceof validator — value must be `instanceof` the constructor\n *\n * @example\n * v.instanceof(File) // type: File\n * v.instanceof(Buffer) // type: Buffer\n * v.instanceof(MyClass) // type: MyClass\n */\n instanceof: <T>(ctor: new (...args: any[]) => T, errorMessage?: string) =>\n new InstanceOfValidator<T>(ctor, errorMessage) as InstanceOfValidator<T> &\n StandardSchemaV1<T>,\n\n /**\n * Create a lazy validator — defers resolution of the inner validator until\n * validate-time. Use for recursive or forward-referenced schemas.\n *\n * @example\n * type Category = { name: string; children: Category[] };\n *\n * const category: ObjectValidator<...> = v.object({\n * name: v.string(),\n * children: v.array(v.lazy(() => category)),\n * });\n */\n lazy: <T extends BaseValidator>(thunk: () => T) =>\n new LazyValidator(thunk) as LazyValidator<T> & StandardSchemaV1<Infer<T>>,\n\n /** Create a string validator */\n string: (errorMessage?: string) =>\n new StringValidator(errorMessage) as StringValidator & StandardSchemaV1<string>,\n\n /** Create an email validator */\n email: (emailErrorMessage?: string, errorMessage?: string) =>\n new StringValidator(errorMessage).email(emailErrorMessage) as StringValidator &\n StandardSchemaV1<string>,\n\n /**\n * Create an enum validator — preserves the literal union of accepted\n * values in the inferred Standard Schema output.\n *\n * Two input shapes:\n * - Tuple of literals: `v.enum([\"draft\", \"published\"])` →\n * `StandardSchemaV1<\"draft\" | \"published\">`\n * - TypeScript enum object: `v.enum(Status)` →\n * `StandardSchemaV1<Status[keyof Status]>`\n *\n * Implementation is loosely typed; the public `ValidatorV.enum`\n * surface declares the precise overloads.\n */\n enum: ((values: any, errorMessage?: string) =>\n Array.isArray(values)\n ? new StringValidator().oneOf(values, errorMessage)\n : new ScalarValidator().enum(values, errorMessage)) as ValidatorV[\"enum\"],\n\n /** Create a number validator */\n number: (errorMessage?: string) =>\n new NumberValidator(errorMessage) as NumberValidator & StandardSchemaV1<number>,\n\n /** Create a numeric validator */\n numeric: (errorMessage?: string) =>\n new NumericValidator(errorMessage) as NumericValidator & StandardSchemaV1<number>,\n\n /** Create an integer validator */\n int: (errorMessage?: string) =>\n new IntValidator(errorMessage) as IntValidator & StandardSchemaV1<number>,\n\n /** Create a float validator */\n float: (errorMessage?: string) =>\n new FloatValidator(errorMessage) as FloatValidator & StandardSchemaV1<number>,\n\n /** Create a boolean validator */\n boolean: (errorMessage?: string) =>\n new BooleanValidator(errorMessage) as BooleanValidator & StandardSchemaV1<boolean>,\n\n /** Create a scalar validator */\n scalar: (errorMessage?: string) =>\n new ScalarValidator(errorMessage) as ScalarValidator &\n StandardSchemaV1<string | number | boolean>,\n\n /** Create a union validator - validates against multiple types */\n union: <T extends BaseValidator[]>(validators: T, errorMessage?: string) =>\n new UnionValidator().union(validators, errorMessage) as UnionValidator &\n StandardSchemaV1<Infer<T[number]>>,\n\n /**\n * Create a discriminated union — routes payloads by a shared literal\n * discriminator field. Each branch must be a `v.object(...)` with the\n * discriminator typed as `v.literal(...)`.\n *\n * @example\n * const email = v.object({ type: v.literal(\"email\"), email: v.string().email() });\n * const sms = v.object({ type: v.literal(\"sms\"), phone: v.string() });\n * const notif = v.discriminatedUnion(\"type\", [email, sms]);\n * // type T = Infer<typeof notif>;\n * // → { type: \"email\", email: string } | { type: \"sms\", phone: string }\n */\n discriminatedUnion: <\n K extends string,\n Branches extends ReadonlyArray<ObjectValidator<any>>,\n >(\n discriminator: K,\n validators: Branches,\n ) =>\n new DiscriminatedUnionValidator(discriminator, validators) as DiscriminatedUnionValidator<\n K,\n Branches\n > &\n StandardSchemaV1<Infer<Branches[number]>>,\n\n /** Create a computed field validator - derives value from other validated fields */\n computed: <TResult = any>(\n callback: (data: any, context: SchemaContext) => TResult | Promise<TResult>,\n resultValidator?: BaseValidator,\n ) =>\n new ComputedValidator<TResult>(callback, resultValidator) as ComputedValidator<TResult> &\n StandardSchemaV1<TResult>,\n\n /** Create a managed field validator - framework-injected value */\n managed: <TResult = any>(\n callback: (context: SchemaContext) => TResult | Promise<TResult>,\n resultValidator?: BaseValidator,\n ) =>\n new ManagedValidator<TResult>(callback, resultValidator) as ManagedValidator<TResult> &\n StandardSchemaV1<TResult>,\n\n /** Validate data against a schema */\n validate: validateFunction,\n} as unknown as ValidatorV;\n\nexport type ValidateOptions = {\n context?: Record<string, any>;\n} & SealConfig;\n\nexport interface ValidatorV {\n object: <T extends Schema>(\n schema: T,\n errorMessage?: string,\n ) => ObjectValidator<T> & StandardSchemaV1<Infer<ObjectValidator<T>>>;\n any: () => AnyValidator & StandardSchemaV1<any>;\n array: <T extends BaseValidator>(\n validator: T,\n errorMessage?: string,\n ) => ArrayValidator & {\n validator: T;\n } & StandardSchemaV1<Array<Infer<T>>>;\n record: <T extends BaseValidator>(\n validator?: T,\n errorMessage?: string,\n ) => RecordValidator & {\n valueValidator: T;\n } & StandardSchemaV1<Record<string, Infer<T>>>;\n tuple: <T extends BaseValidator[]>(\n validators: T,\n errorMessage?: string,\n ) => TupleValidator & {\n validators: T;\n } & StandardSchemaV1<{ [K in keyof T]: Infer<T[K]> }>;\n date: (errorMessage?: string) => DateValidator & StandardSchemaV1<Date>;\n literal: <T extends readonly [string | number | boolean, ...(string | number | boolean)[]]>(\n ...values: T\n ) => LiteralValidator<T> & StandardSchemaV1<T[number]>;\n instanceof: <T>(\n ctor: new (...args: any[]) => T,\n errorMessage?: string,\n ) => InstanceOfValidator<T> & StandardSchemaV1<T>;\n lazy: <T extends BaseValidator>(\n thunk: () => T,\n ) => LazyValidator<T> & StandardSchemaV1<Infer<T>>;\n string: (errorMessage?: string) => StringValidator & StandardSchemaV1<string>;\n email: (errorMessage?: string) => StringValidator & StandardSchemaV1<string>;\n enum: {\n <const T extends readonly (string | number | boolean)[]>(\n values: T,\n errorMessage?: string,\n ): ScalarValidator & StandardSchemaV1<T[number]>;\n <const T extends Record<string, string | number>>(\n values: T,\n errorMessage?: string,\n ): ScalarValidator & StandardSchemaV1<T[keyof T]>;\n };\n number: (errorMessage?: string) => NumberValidator & StandardSchemaV1<number>;\n numeric: (errorMessage?: string) => NumericValidator & StandardSchemaV1<number>;\n int: (errorMessage?: string) => IntValidator & StandardSchemaV1<number>;\n float: (errorMessage?: string) => FloatValidator & StandardSchemaV1<number>;\n boolean: (errorMessage?: string) => BooleanValidator & StandardSchemaV1<boolean>;\n scalar: (\n errorMessage?: string,\n ) => ScalarValidator & StandardSchemaV1<string | number | boolean>;\n union: <T extends BaseValidator[]>(\n validators: T,\n errorMessage?: string,\n ) => UnionValidator & StandardSchemaV1<Infer<T[number]>>;\n discriminatedUnion: <\n K extends string,\n Branches extends ReadonlyArray<ObjectValidator<any>>,\n >(\n discriminator: K,\n validators: Branches,\n ) => DiscriminatedUnionValidator<K, Branches> & StandardSchemaV1<Infer<Branches[number]>>;\n computed: <TResult = any>(\n callback: (data: any, context: SchemaContext) => TResult | Promise<TResult>,\n resultValidator?: BaseValidator,\n ) => ComputedValidator<TResult> & StandardSchemaV1<TResult>;\n managed: <TResult = any>(\n callback?: (context: SchemaContext) => TResult | Promise<TResult>,\n resultValidator?: BaseValidator,\n ) => ManagedValidator<TResult> & StandardSchemaV1<TResult>;\n validate: <T extends BaseValidator>(\n schema: T,\n data: any,\n options?: ValidateOptions,\n ) => Promise<ValidationResult>;\n}\n","/**\r\n * Seal Plugin System\r\n *\r\n * Allows extending validators with custom functionality via plugins\r\n */\r\n\r\nexport type PluginContext = {\r\n /** Plugin name */\r\n name: string;\r\n /** Plugin version */\r\n version?: string;\r\n};\r\n\r\nexport type SealPlugin = {\r\n /** Plugin metadata */\r\n name: string;\r\n version?: string;\r\n description?: string;\r\n\r\n /**\r\n * Install function - called when plugin is registered\r\n * This is where you inject methods into validators\r\n *\r\n * @example\r\n * ```ts\r\n * install() {\r\n * Object.assign(StringValidator.prototype, {\r\n * slug(this: StringValidator) {\r\n * return this.pattern(/^[a-z0-9-]+$/);\r\n * }\r\n * });\r\n * }\r\n * ```\r\n */\r\n install: (context: PluginContext) => void | Promise<void>;\r\n\r\n /**\r\n * Uninstall the plugin (optional)\r\n * Clean up any injected methods\r\n */\r\n uninstall?: () => void | Promise<void>;\r\n};\r\n\r\n/**\r\n * Registry of installed plugins\r\n */\r\nconst installedPlugins = new Map<string, SealPlugin>();\r\n\r\n/**\r\n * Register a plugin\r\n *\r\n * @example\r\n * ```ts\r\n * const slugPlugin: SealPlugin = {\r\n * name: \"slug\",\r\n * install() {\r\n * Object.assign(StringValidator.prototype, {\r\n * slug(this: StringValidator) {\r\n * return this.pattern(/^[a-z0-9-]+$/);\r\n * }\r\n * });\r\n * }\r\n * };\r\n *\r\n * registerPlugin(slugPlugin);\r\n * ```\r\n */\r\nexport async function registerPlugin(plugin: SealPlugin): Promise<void> {\r\n if (installedPlugins.has(plugin.name)) {\r\n console.warn(`[Seal] Plugin \"${plugin.name}\" is already installed`);\r\n return;\r\n }\r\n\r\n const context: PluginContext = {\r\n name: plugin.name,\r\n version: plugin.version,\r\n };\r\n\r\n // Call install function\r\n await plugin.install(context);\r\n\r\n installedPlugins.set(plugin.name, plugin);\r\n}\r\n\r\n/**\r\n * Unregister a plugin\r\n */\r\nexport async function unregisterPlugin(pluginName: string): Promise<void> {\r\n const plugin = installedPlugins.get(pluginName);\r\n\r\n if (!plugin) {\r\n console.warn(`[Seal] Plugin \"${pluginName}\" is not installed`);\r\n return;\r\n }\r\n\r\n if (plugin.uninstall) {\r\n await plugin.uninstall();\r\n }\r\n\r\n installedPlugins.delete(pluginName);\r\n}\r\n\r\n/**\r\n * Check if a plugin is installed\r\n */\r\nexport function hasPlugin(pluginName: string): boolean {\r\n return installedPlugins.has(pluginName);\r\n}\r\n\r\n/**\r\n * Get list of installed plugins\r\n */\r\nexport function getInstalledPlugins(): SealPlugin[] {\r\n return Array.from(installedPlugins.values());\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,cAAc,QAA0B,QAAgC;CACtF,IAAI,WAAW,eAAe;EAC5B,OAAO,WAAW;EAClB;CACF;CAEA,IAAI,WAAW,mBAAmB,WAAW,iBAAiB;EAC5D,MAAM,WAAW,OAAO;EACxB,OAAO,OAAO,MAAM,QAAQ,QAAQ,IAChC,CAAC,GAAG,UAAU,MAAM,IACpB,CAAC,UAAoB,MAAM;EAC/B;CACF;CAGA,MAAM,OAAO,EAAE,GAAG,OAAO;CACzB,KAAK,MAAM,OAAO,OAAO,KAAK,MAAM,GAClC,OAAO,OAAO;CAEhB,OAAO,QAAQ,CAAC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