@warlock.js/seal 5.23.2 → 5.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE +21 -21
  3. package/cjs/index.cjs +10 -5
  4. package/cjs/index.cjs.map +1 -1
  5. package/cjs/{object-DPPttDAF.cjs → object-BuKApaax.cjs} +3 -3
  6. package/cjs/object-BuKApaax.cjs.map +1 -0
  7. package/cjs/object.cjs +2 -2
  8. package/cjs/{required-methods-DJTm7yNP.cjs → required-methods-BOVNRtci.cjs} +12 -2
  9. package/cjs/required-methods-BOVNRtci.cjs.map +1 -0
  10. package/cjs/{string-C_pAtZPC.cjs → string-DpDpgefH.cjs} +2 -2
  11. package/cjs/string-DpDpgefH.cjs.map +1 -0
  12. package/cjs/string.cjs +2 -2
  13. package/esm/config.mjs.map +1 -1
  14. package/esm/factory/validate.mjs.map +1 -1
  15. package/esm/factory/validators.mjs +1 -1
  16. package/esm/factory/validators.mjs.map +1 -1
  17. package/esm/helpers/date-helpers.mjs.map +1 -1
  18. package/esm/helpers/get-field-value.mjs.map +1 -1
  19. package/esm/helpers/path-helpers.mjs.map +1 -1
  20. package/esm/mutators/array-mutators.mjs.map +1 -1
  21. package/esm/mutators/date-mutators.mjs.map +1 -1
  22. package/esm/mutators/number-mutators.mjs.map +1 -1
  23. package/esm/mutators/object-mutators.mjs.map +1 -1
  24. package/esm/mutators/scalar-mutators.mjs.map +1 -1
  25. package/esm/mutators/string-mutators.mjs.map +1 -1
  26. package/esm/plugins/plugin-system.mjs.map +1 -1
  27. package/esm/rules/array/array-rules.mjs.map +1 -1
  28. package/esm/rules/color/color-rules.mjs.map +1 -1
  29. package/esm/rules/common/enum.mjs.map +1 -1
  30. package/esm/rules/common/equals-field-rules.mjs.map +1 -1
  31. package/esm/rules/common/type-rules.mjs.map +1 -1
  32. package/esm/rules/conditional/forbidden-if-rules.mjs.map +1 -1
  33. package/esm/rules/conditional/present-if-rules.mjs.map +1 -1
  34. package/esm/rules/conditional/present-unless-rules.mjs.map +1 -1
  35. package/esm/rules/conditional/present-with-rules.mjs.map +1 -1
  36. package/esm/rules/conditional/present-without-rules.mjs.map +1 -1
  37. package/esm/rules/conditional/required-if-rules.mjs.map +1 -1
  38. package/esm/rules/conditional/required-unless-rules.mjs.map +1 -1
  39. package/esm/rules/conditional/required-with-rules.mjs.map +1 -1
  40. package/esm/rules/conditional/required-without-rules.mjs.map +1 -1
  41. package/esm/rules/core/equal.mjs.map +1 -1
  42. package/esm/rules/core/forbidden.mjs.map +1 -1
  43. package/esm/rules/core/required.mjs.map +1 -1
  44. package/esm/rules/core/union.mjs.map +1 -1
  45. package/esm/rules/core/when.mjs.map +1 -1
  46. package/esm/rules/date/date-comparison-rules.mjs.map +1 -1
  47. package/esm/rules/date/date-day-rules.mjs.map +1 -1
  48. package/esm/rules/date/date-field-comparison-rules.mjs.map +1 -1
  49. package/esm/rules/date/date-period-rules.mjs.map +1 -1
  50. package/esm/rules/date/date-relative-rules.mjs.map +1 -1
  51. package/esm/rules/date/date-special-rules.mjs.map +1 -1
  52. package/esm/rules/date/date.mjs.map +1 -1
  53. package/esm/rules/file/dimensions.mjs.map +1 -1
  54. package/esm/rules/file/file-size.mjs.map +1 -1
  55. package/esm/rules/length/length-rules.mjs.map +1 -1
  56. package/esm/rules/number/number-rules.mjs.map +1 -1
  57. package/esm/rules/scalar/accepted-rule.mjs.map +1 -1
  58. package/esm/rules/scalar/declined-rule.mjs.map +1 -1
  59. package/esm/rules/string/alpha.mjs.map +1 -1
  60. package/esm/rules/string/credit-card.mjs.map +1 -1
  61. package/esm/rules/string/email.mjs.map +1 -1
  62. package/esm/rules/string/matches.mjs.map +1 -1
  63. package/esm/rules/string/pattern.mjs.map +1 -1
  64. package/esm/rules/string/string-comparison.mjs.map +1 -1
  65. package/esm/rules/string/strong-password-rule.mjs.map +1 -1
  66. package/esm/rules/string/url.mjs.map +1 -1
  67. package/esm/rules/string/without-whitespace.mjs.map +1 -1
  68. package/esm/types/date-types.mjs.map +1 -1
  69. package/esm/validators/any-validator.mjs.map +1 -1
  70. package/esm/validators/array-validator.d.mts.map +1 -1
  71. package/esm/validators/array-validator.mjs +1 -0
  72. package/esm/validators/array-validator.mjs.map +1 -1
  73. package/esm/validators/base-validator.d.mts +2 -0
  74. package/esm/validators/base-validator.d.mts.map +1 -1
  75. package/esm/validators/base-validator.mjs +11 -1
  76. package/esm/validators/base-validator.mjs.map +1 -1
  77. package/esm/validators/boolean-validator.d.mts.map +1 -1
  78. package/esm/validators/boolean-validator.mjs +1 -0
  79. package/esm/validators/boolean-validator.mjs.map +1 -1
  80. package/esm/validators/date-validator.d.mts.map +1 -1
  81. package/esm/validators/date-validator.mjs +1 -0
  82. package/esm/validators/date-validator.mjs.map +1 -1
  83. package/esm/validators/float-validator.mjs.map +1 -1
  84. package/esm/validators/int-validator.mjs.map +1 -1
  85. package/esm/validators/literal-validator.d.mts.map +1 -1
  86. package/esm/validators/literal-validator.mjs +1 -3
  87. package/esm/validators/literal-validator.mjs.map +1 -1
  88. package/esm/validators/methods/equality-conditional-methods.mjs.map +1 -1
  89. package/esm/validators/methods/forbidden-methods.mjs.map +1 -1
  90. package/esm/validators/methods/present-methods.mjs.map +1 -1
  91. package/esm/validators/methods/required-methods.mjs.map +1 -1
  92. package/esm/validators/number-validator.d.mts.map +1 -1
  93. package/esm/validators/number-validator.mjs +1 -0
  94. package/esm/validators/number-validator.mjs.map +1 -1
  95. package/esm/validators/numeric-validator.mjs.map +1 -1
  96. package/esm/validators/object-validator.d.mts.map +1 -1
  97. package/esm/validators/object-validator.mjs +1 -1
  98. package/esm/validators/object-validator.mjs.map +1 -1
  99. package/esm/validators/record-validator.mjs.map +1 -1
  100. package/esm/validators/scalar-validator.d.mts.map +1 -1
  101. package/esm/validators/scalar-validator.mjs +1 -0
  102. package/esm/validators/scalar-validator.mjs.map +1 -1
  103. package/esm/validators/string-validator.mjs.map +1 -1
  104. package/esm/validators/tuple-validator.mjs.map +1 -1
  105. package/esm/validators/union-validator.mjs.map +1 -1
  106. package/llms-full.txt +1165 -1165
  107. package/package.json +1 -1
  108. package/skills/bridge-standard-schema/SKILL.md +138 -138
  109. package/skills/define-structural-shape/SKILL.md +138 -138
  110. package/skills/extend-seal-with-plugins/SKILL.md +178 -178
  111. package/skills/generate-json-schema/SKILL.md +143 -143
  112. package/skills/handle-seal-errors/SKILL.md +148 -148
  113. package/skills/pick-seal-primitive/SKILL.md +149 -149
  114. package/cjs/object-DPPttDAF.cjs.map +0 -1
  115. package/cjs/required-methods-DJTm7yNP.cjs.map +0 -1
  116. package/cjs/string-C_pAtZPC.cjs.map +0 -1
package/cjs/index.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["BaseValidator","isEmptyValue","VALID_RULE","invalidRule","getFieldValue","isEmptyValue","VALID_RULE","invalidRule","getFieldValue","isEmptyValue","BaseValidator","arrayRule","minLengthRule","maxLengthRule","lengthRule","betweenLengthRule","uniqueArrayRule","sortedArrayRule","setKeyPath","getRuleOptions","PrimitiveValidator","booleanRule","BaseValidator","dateRule","isDateValue","minDateRule","maxDateRule","beforeFieldRule","afterFieldRule","betweenDatesRule","todayRule","fromTodayRule","beforeTodayRule","afterTodayRule","pastRule","futureRule","sameAsFieldDateRule","fromHourRule","beforeHourRule","betweenHoursRule","fromMinuteRule","beforeMinuteRule","betweenMinutesRule","betweenTimesRule","ageRule","minAgeRule","maxAgeRule","betweenAgeRule","weekDayRule","weekdaysRule","weekendRule","businessDayRule","withinDaysRule","withinPastDaysRule","withinFutureDaysRule","monthRule","yearRule","betweenYearsRule","betweenMonthsRule","betweenDaysRule","minYearRule","maxYearRule","minMonthRule","maxMonthRule","minDayRule","maxDayRule","quarterRule","birthdayRule","leapYearRule","getRuleOptions","BaseValidator","literalRule","isEmptyValue","presentRule","BaseValidator","wrapNullableStrict","PrimitiveValidator","numberRule","minRule","maxRule","greaterThanRule","lessThanRule","moduloRule","positiveRule","negativeRule","oddRule","evenRule","betweenNumbersRule","lengthRule","minLengthRule","maxLengthRule","getRuleOptions","floatRule","BaseValidator","instanceofRule","intRule","BaseValidator","ComputedValidator","BaseValidator","objectRule","plainObjectRule","setKeyPath","PrimitiveValidator","VALID_RULE","invalidRule","getRuleOptions","BaseValidator","arrayRule","setKeyPath","BaseValidator","unionRule","getRuleOptions","StringValidator","ComputedValidator","validateFunction"],"sources":["../../../../../../seal/src/validators/any-validator.ts","../../../../../../seal/src/mutators/array-mutators.ts","../../../../../../seal/src/rules/scalar/accepted-rule.ts","../../../../../../seal/src/rules/scalar/declined-rule.ts","../../../../../../seal/src/mutators/boolean-mutators.ts","../../../../../../seal/src/mutators/date-mutators.ts","../../../../../../seal/src/mutators/number-mutators.ts","../../../../../../seal/src/mutators/scalar-mutators.ts","../../../../../../seal/src/validators/array-validator.ts","../../../../../../seal/src/validators/boolean-validator.ts","../../../../../../seal/src/validators/date-validator.ts","../../../../../../seal/src/validators/literal-validator.ts","../../../../../../seal/src/validators/discriminated-union-validator.ts","../../../../../../seal/src/validators/number-validator.ts","../../../../../../seal/src/validators/float-validator.ts","../../../../../../seal/src/validators/instanceof-validator.ts","../../../../../../seal/src/validators/int-validator.ts","../../../../../../seal/src/validators/lazy-validator.ts","../../../../../../seal/src/validators/managed-validator.ts","../../../../../../seal/src/validators/numeric-validator.ts","../../../../../../seal/src/validators/record-validator.ts","../../../../../../seal/src/validators/scalar-validator.ts","../../../../../../seal/src/validators/tuple-validator.ts","../../../../../../seal/src/validators/union-validator.ts","../../../../../../seal/src/factory/validators.ts","../../../../../../seal/src/plugins/plugin-system.ts"],"sourcesContent":["import type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\nimport { applyNullable } from \"../standard-schema/json-schema\";\r\nimport { BaseValidator } from \"./base-validator\";\r\n\r\n/**\r\n * Any validator - accepts any value\r\n */\r\nexport class AnyValidator extends BaseValidator {\r\n /**\r\n * Any validator means any value, so we disable the default required requirement.\r\n */\r\n public override requiredRule = null;\r\n\r\n /**\r\n * Set is optional to be true\r\n */\r\n public override isOptional = true;\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Any validator accepts anything. In JSON Schema, an empty object `{}`\r\n * is the permissive schema that accepts any valid JSON value.\r\n *\r\n * @example\r\n * ```ts\r\n * v.any().toJsonSchema(\"draft-2020-12\")\r\n * // → {}\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const schema: JsonSchemaResult = {};\r\n if (this.isNullable) applyNullable(schema, target);\r\n return schema;\r\n }\r\n}\r\n","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 { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * The full set of values treated as \"accepted\" by `acceptedRule` and its\r\n * conditional variants. Shared with `formBooleanMutator` (see\r\n * `../../mutators/boolean-mutators`) so `v.boolean().accepted()` recognizes\r\n * exactly this list — single source of truth, no duplicated literals.\r\n */\r\nexport const ACCEPTED_VALUES: readonly unknown[] = [\r\n \"1\",\r\n \"true\",\r\n \"yes\",\r\n \"y\",\r\n \"on\",\r\n 1,\r\n true,\r\n \"Yes\",\r\n \"Y\",\r\n \"On\",\r\n];\r\n\r\nconst isAcceptedValue = (value: any) => {\r\n return ACCEPTED_VALUES.includes(value);\r\n};\r\n\r\n/**\r\n * Validate value as accepted if it equals:\r\n * 1 | \"1\" | true | \"true\" | \"yes\" | \"y\" | \"on\"\r\n */\r\nexport const acceptedRule: SchemaRule = {\r\n name: \"accepted\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n description:\r\n \"The value must be accepted if it equals: 1 | '1' | true | 'true' | 'yes' | 'y' | 'on' | 1 | true | 'Yes' | 'Y' | 'On'\",\r\n async validate(value: any, context) {\r\n if (isAcceptedValue(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Accepted value if another field's value equals to a specific value\r\n */\r\nexport const acceptedIfRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"acceptedIf\",\r\n description: \"The field must be accepted if :field's value equals to :value\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n if (fieldValue !== expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is not equal to the given value\r\n */\r\nexport const acceptedUnlessRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"acceptedUnless\",\r\n description: \"The field must be accepted if :field's value is not equal to :value\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n if (fieldValue === expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is required\r\n */\r\nexport const acceptedIfRequiredRule: SchemaRule<{ field: string }> = {\r\n name: \"acceptedIfRequired\",\r\n description: \"The field must be accepted if :field is required\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is present\r\n */\r\nexport const acceptedIfPresentRule: SchemaRule<{ field: string }> = {\r\n name: \"acceptedIfPresent\",\r\n description: \"The field must be accepted if :field is present\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue === undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is missing\r\n */\r\nexport const acceptedWithoutRule: SchemaRule<{ field: string }> = {\r\n name: \"acceptedWithout\",\r\n description: \"The field must be accepted if :field is missing\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue !== undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * The full set of values treated as \"declined\" by `declinedRule` and its\r\n * conditional variants. Shared with `formBooleanMutator` (see\r\n * `../../mutators/boolean-mutators`) so `v.boolean().declined()` recognizes\r\n * exactly this list — single source of truth, no duplicated literals.\r\n */\r\nexport const DECLINED_VALUES: readonly unknown[] = [\r\n \"0\",\r\n \"false\",\r\n \"no\",\r\n \"n\",\r\n \"off\",\r\n 0,\r\n false,\r\n \"No\",\r\n \"N\",\r\n \"Off\",\r\n];\r\n\r\nconst isDeclinedValue = (value: any) => {\r\n return DECLINED_VALUES.includes(value);\r\n};\r\n\r\n/**\r\n * Validate value as declined if it equals:\r\n * 0 | \"0\" | false | \"false\" | \"no\" | \"n\" | \"off\" | 0 | false | \"No\" | \"N\" | \"Off\"\r\n */\r\nexport const declinedRule: SchemaRule = {\r\n name: \"declined\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n description:\r\n \"The value must be declined if it equals: 0 | '0' | false | 'false' | 'no' | 'n' | 'off' | 0 | false | 'No' | 'N' | 'Off'\",\r\n async validate(value: any, context) {\r\n if (isDeclinedValue(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Declined value if another field's value equals to a specific value\r\n */\r\nexport const declinedIfRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"declinedIf\",\r\n description: \"The field must be declined if :field's value equals to :value\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n if (fieldValue !== expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is not equal to the given value\r\n */\r\nexport const declinedUnlessRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"declinedUnless\",\r\n description: \"The field must be declined if :field's value is not equal to :value\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n if (fieldValue === expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is required\r\n */\r\nexport const declinedIfRequiredRule: SchemaRule<{ field: string }> = {\r\n name: \"declinedIfRequired\",\r\n description: \"The field must be declined if :field is required\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is present\r\n */\r\nexport const declinedIfPresentRule: SchemaRule<{ field: string }> = {\r\n name: \"declinedIfPresent\",\r\n description: \"The field must be declined if :field is present\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue === undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is missing\r\n */\r\nexport const declinedWithoutRule: SchemaRule<{ field: string }> = {\r\n name: \"declinedWithout\",\r\n description: \"The field must be declined if :field is missing\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue !== undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { ACCEPTED_VALUES } from \"../rules/scalar/accepted-rule\";\nimport { DECLINED_VALUES } from \"../rules/scalar/declined-rule\";\nimport type { Mutator } from \"../types\";\n\n/**\n * Coerce a query-string-shaped boolean into a real boolean.\n *\n * Converts exactly: `\"true\"` / `\"1\"` / `1` → `true`, `\"false\"` / `\"0\"` / `0` → `false`.\n * Case-sensitive, no trimming. Any other value (`\"yes\"`, `\"on\"`, `\"TRUE\"`, `\"\"`,\n * `2`, `null`, etc.) passes through unchanged so the boolean type rule rejects it.\n */\nexport const booleanCoerceMutator: Mutator = async (value) => {\n if (value === \"true\" || value === \"1\" || value === 1) {\n return true;\n }\n\n if (value === \"false\" || value === \"0\" || value === 0) {\n return false;\n }\n\n return value;\n};\n\n/**\n * Parse form-shaped boolean values into a real boolean, ahead of the type\n * rule.\n *\n * Opted into by calling any `accepted*`/`declined*` method on\n * `v.boolean()` (see `BooleanValidator`'s `withFormBooleanMutator`). Converts\n * every value in `ACCEPTED_VALUES` (`1`, `\"1\"`, `true`, `\"true\"`, `\"yes\"`,\n * `\"y\"`, `\"on\"`, `\"Yes\"`, `\"Y\"`, `\"On\"`) to `true`, and every value in\n * `DECLINED_VALUES` (`0`, `\"0\"`, `false`, `\"false\"`, `\"no\"`, `\"n\"`, `\"off\"`,\n * `\"No\"`, `\"N\"`, `\"Off\"`) to `false`. Any other value passes through\n * unchanged so the boolean type rule still rejects it.\n *\n * Named (not anonymous) so callers can detect whether it has already been\n * added — see the idempotence check in `BooleanValidator`.\n */\nexport const formBooleanMutator: Mutator = async (value) => {\n if (ACCEPTED_VALUES.includes(value)) {\n return true;\n }\n\n if (DECLINED_VALUES.includes(value)) {\n return false;\n }\n\n return value;\n};\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/**\r\n * To fixed mutator — rounds to a fixed number of decimal places, as a number.\r\n *\r\n * `Number.prototype.toFixed` returns a *string*, which the number validator's\r\n * own type rule then rejected: `v.number().toFixed(2)` could never produce a\r\n * valid result. Coercing back to a number keeps the method usable where it\r\n * lives. For the fixed-point string form, format at the edge instead of asking\r\n * a number schema to output a string.\r\n */\r\nexport const toFixedMutator: Mutator = async (value, context) => {\r\n const decimals = context?.options?.decimals ?? 2;\r\n return Number(Number(value).toFixed(decimals));\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 { setKeyPath } from \"../helpers\";\r\nimport { flipArrayMutator, sortArrayMutator, uniqueArrayMutator } from \"../mutators\";\r\nimport {\r\n arrayRule,\r\n betweenLengthRule,\r\n lengthRule,\r\n maxLengthRule,\r\n minLengthRule,\r\n sortedArrayRule,\r\n uniqueArrayRule,\r\n} from \"../rules\";\r\nimport type { SchemaContext, ValidationResult } from \"../types\";\r\nimport { BaseValidator } from \"./base-validator\";\r\nimport { applyNullable, getRuleOptions } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Array validator class\r\n */\r\nexport class ArrayValidator extends BaseValidator {\r\n public constructor(\r\n public validator: BaseValidator,\r\n errorMessage?: string,\r\n ) {\r\n super();\r\n this.addMutableRule(arrayRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is an array type\r\n */\r\n public matchesType(value: any): boolean {\r\n return Array.isArray(value);\r\n }\r\n\r\n /**\r\n * Clone the validator\r\n */\r\n public override clone(): this {\r\n const cloned = super.clone();\r\n\r\n cloned.validator = this.validator.clone();\r\n\r\n return cloned;\r\n }\r\n\r\n /** Reverse array order */\r\n public flip() {\r\n return this.addMutator(flipArrayMutator);\r\n }\r\n\r\n /** Reverse array order (alias) */\r\n public reverse() {\r\n return this.addMutator(flipArrayMutator);\r\n }\r\n\r\n /** Make it has only unique values */\r\n public onlyUnique() {\r\n return this.addMutator(uniqueArrayMutator);\r\n }\r\n\r\n /** Sort array */\r\n public sort(direction: \"asc\" | \"desc\" = \"asc\", key?: string) {\r\n return this.addMutator(sortArrayMutator, { direction, key });\r\n }\r\n\r\n /** Array length must be greater than the given length */\n public min(min: number, errorMessage?: string) {\n return this.addRule(minLengthRule, errorMessage, { minLength: min });\n }\n\n /** @alias min */\n public minLength(length: number, errorMessage?: string) {\n return this.min(length, errorMessage);\n }\n\n /** Array length must be less than the given length */\n public max(max: number, errorMessage?: string) {\n return this.addRule(maxLengthRule, errorMessage, { maxLength: max });\n }\n\n /** @alias max */\n public maxLength(length: number, errorMessage?: string) {\n return this.max(length, errorMessage);\n }\n\r\n /** Array length must be of the given length */\r\n public length(length: number, errorMessage?: string) {\r\n return this.addRule(lengthRule, errorMessage, { length });\r\n }\r\n\r\n /**\r\n * Array length must be between min and max (inclusive)\r\n *\r\n * @param min - Minimum length (inclusive)\r\n * @param max - Maximum length (inclusive)\r\n *\r\n * @example\r\n * ```ts\r\n * v.array(v.string()).between(1, 10) // Array must have 1 to 10 items\r\n * v.array(v.number()).lengthBetween(5, 20) // Same using alias\r\n * ```\r\n *\r\n * @category Validation Rule\r\n */\r\n public between(min: number, max: number, errorMessage?: string) {\r\n return this.addRule(betweenLengthRule, errorMessage, {\r\n minLength: min,\r\n maxLength: max,\r\n });\r\n }\r\n\r\n /**\r\n * Alias for between() - array length between min and max\r\n */\r\n public lengthBetween(min: number, max: number, errorMessage?: string) {\r\n return this.between(min, max, errorMessage);\r\n }\r\n\r\n /** Array must have unique values */\r\n public unique(errorMessage?: string) {\r\n return this.addRule(uniqueArrayRule, errorMessage);\r\n }\r\n\r\n /** Array must be sorted */\r\n public sorted(direction: \"asc\" | \"desc\" = \"asc\", errorMessage?: string) {\r\n return this.addRule(sortedArrayRule, errorMessage, { direction });\r\n }\r\n\r\n /** Mutate the data */\r\n public mutate(data: any, context: SchemaContext) {\r\n if (!Array.isArray(data)) return data;\r\n return super.mutate([...data], context);\r\n }\r\n\r\n /** Validate array\r\n *\r\n * Absent input (and absent without `.default()`) propagates as `data: undefined`\r\n * so the parent ObjectValidator can omit the key. Without this, optional array\r\n * fields would silently materialise as `[]` in the validated output.\r\n */\r\n public async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\r\n // Apply default when absent, then mutate. Mirrors BaseValidator's\r\n // `valueForRules = data ?? this.getDefaultValue()` so `.default([...])`\r\n // works on arrays too.\r\n const valueForRules = data ?? this.getDefaultValue();\r\n const mutatedData = await this.mutate(valueForRules, context);\r\n\r\n const result = await super.validate(data, context);\r\n\r\n if (result.isValid === false) return result;\r\n\r\n // Nothing to iterate for absent (no default) or null (nullable) inputs —\r\n // propagate so the parent ObjectValidator can omit the key.\r\n if (mutatedData === undefined || mutatedData === null) return result;\r\n\r\n // Defensive: type rule (arrayRule) should have failed for non-arrays.\r\n if (!Array.isArray(mutatedData)) return result;\r\n\r\n const errors: ValidationResult[\"errors\"] = [];\r\n\r\n // Validate all items in parallel (consistent with ObjectValidator)\r\n const validationPromises = mutatedData.map(async (value: any, index: number) => {\r\n const childContext: SchemaContext = {\r\n ...context,\r\n parent: mutatedData,\r\n value,\r\n key: index.toString(),\r\n path: setKeyPath(context.path, index.toString()),\r\n };\r\n\r\n const childResult = await this.validator.validate(value, childContext);\r\n\r\n // Update mutated data with validated result\r\n mutatedData[index] = childResult.data;\r\n\r\n // Collect errors from this element\r\n if (childResult.isValid === false) {\r\n errors.push(...childResult.errors);\r\n }\r\n });\r\n\r\n await Promise.all(validationPromises);\r\n\r\n return {\r\n isValid: errors.length === 0,\r\n errors,\r\n data: await this.startTransformationPipeline(mutatedData, context),\r\n };\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Recursively generates JSON Schema for the array items.\r\n *\r\n * @example\r\n * ```ts\r\n * v.array(v.string().min(1)).minLength(1).toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"array\", items: { type: \"string\", minLength: 1 }, minItems: 1 }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const schema: JsonSchemaResult = {\r\n type: \"array\",\r\n items: this.validator.toJsonSchema(target),\r\n };\r\n\r\n const minOpts = getRuleOptions(this.rules, \"minLength\");\r\n if (minOpts?.minLength !== undefined) schema.minItems = minOpts.minLength;\r\n\r\n const maxOpts = getRuleOptions(this.rules, \"maxLength\");\r\n if (maxOpts?.maxLength !== undefined) schema.maxItems = maxOpts.maxLength;\r\n\r\n const betweenOpts = getRuleOptions(this.rules, \"betweenLength\");\r\n if (betweenOpts) {\r\n if (betweenOpts.minLength !== undefined) schema.minItems = betweenOpts.minLength;\r\n if (betweenOpts.maxLength !== undefined) schema.maxItems = betweenOpts.maxLength;\r\n }\r\n\r\n const lengthOpts = getRuleOptions(this.rules, \"length\");\r\n if (lengthOpts?.length !== undefined) {\r\n schema.minItems = lengthOpts.length;\r\n schema.maxItems = lengthOpts.length;\r\n }\r\n\r\n if (this.isNullable) applyNullable(schema, target);\r\n\r\n return schema;\r\n }\r\n}\r\n","import { booleanCoerceMutator, formBooleanMutator } from \"../mutators/boolean-mutators\";\nimport {\n acceptedIfPresentRule,\n acceptedIfRequiredRule,\n acceptedIfRule,\n acceptedRule,\n acceptedUnlessRule,\n acceptedWithoutRule,\n declinedIfPresentRule,\n declinedIfRequiredRule,\n declinedIfRule,\n declinedRule,\n declinedUnlessRule,\n declinedWithoutRule,\n} from \"../rules/scalar\";\nimport { booleanRule } from \"../rules\";\nimport { PrimitiveValidator } from \"./primitive-validator\";\nimport { applyNullable } from \"../standard-schema/json-schema\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport type { SchemaRule, SchemaRuleOptions } from \"../types\";\n\n/**\n * Boolean validator class\n *\n * Extends PrimitiveValidator — inherits enum/in/oneOf/allowsOnly/forbids/notIn.\n * Defines accepted/declined directly as real methods (not ScalarValidator field copies)\n * so they survive cloning correctly.\n */\nexport class BooleanValidator extends PrimitiveValidator {\n public constructor(errorMessage?: string) {\n super();\n this.addMutableRule(booleanRule, errorMessage);\n }\n\n /**\n * Check if value is a boolean type\n */\n public matchesType(value: any): boolean {\n return typeof value === \"boolean\";\n }\n\n /**\n * Add a rule from the accepted/declined family, opting the validator into\n * form-boolean parsing.\n *\n * Calling ANY `accepted*`/`declined*` method on `v.boolean()` adds (once,\n * idempotently — checked by mutator identity so chaining several of these\n * methods never stacks duplicates) `formBooleanMutator`, which runs before\n * the type rule and converts the accepted set (`1`, `\"1\"`, `true`,\n * `\"true\"`, `\"yes\"`, `\"y\"`, `\"on\"`, `\"Yes\"`, `\"Y\"`, `\"On\"`) to `true` and\n * the declined set (`0`, `\"0\"`, `false`, `\"false\"`, `\"no\"`, `\"n\"`, `\"off\"`,\n * `\"No\"`, `\"N\"`, `\"Off\"`) to `false`; any other value passes through\n * unchanged and is rejected by the strict type rule as before.\n *\n * The mutator and the rule are added to the SAME resolved instance in one\n * pass — resolving `this.instance` twice (once per `addRule`/`addMutator`\n * call) would clone twice on an immutable validator and silently drop one\n * of the two additions.\n */\n private addFormBooleanRule<T extends SchemaRuleOptions = SchemaRuleOptions>(\n rule: SchemaRule<T>,\n errorMessage?: string,\n options: T = {} as T,\n ): this {\n const instance = this.instance;\n\n if (!instance.mutators.some((mutator) => mutator.mutate === formBooleanMutator)) {\n instance.addMutableMutator(formBooleanMutator);\n }\n\n instance.addMutableRule(rule, errorMessage, options);\n\n return instance;\n }\n\n // ==================== Accepted ====================\n\n /** Value must be accepted (true, \"yes\", 1, \"on\", etc. — form strings are parsed into a real boolean first) */\n public accepted(errorMessage?: string) {\n return this.addFormBooleanRule(acceptedRule, errorMessage);\n }\n\n /** Value must be accepted if another field equals a value */\n public acceptedIf(field: string, value: any, errorMessage?: string) {\n return this.addFormBooleanRule(acceptedIfRule, errorMessage, { field, value });\n }\n\n /** Value must be accepted unless another field equals a value */\n public acceptedUnless(field: string, value: any, errorMessage?: string) {\n return this.addFormBooleanRule(acceptedUnlessRule, errorMessage, { field, value });\n }\n\n /** Value must be accepted if another field is required */\n public acceptedIfRequired(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(acceptedIfRequiredRule, errorMessage, { field });\n }\n\n /** Value must be accepted if another field is present */\n public acceptedIfPresent(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(acceptedIfPresentRule, errorMessage, { field });\n }\n\n /** Value must be accepted if another field is missing */\n public acceptedWithout(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(acceptedWithoutRule, errorMessage, { field });\n }\n\n // ==================== Declined ====================\n\n /** Value must be declined (false, \"no\", 0, \"off\", etc. — form strings are parsed into a real boolean first) */\n public declined(errorMessage?: string) {\n return this.addFormBooleanRule(declinedRule, errorMessage);\n }\n\n /** Value must be declined if another field equals a value */\n public declinedIf(field: string, value: any, errorMessage?: string) {\n return this.addFormBooleanRule(declinedIfRule, errorMessage, { field, value });\n }\n\n /** Value must be declined unless another field equals a value */\n public declinedUnless(field: string, value: any, errorMessage?: string) {\n return this.addFormBooleanRule(declinedUnlessRule, errorMessage, { field, value });\n }\n\n /** Value must be declined if another field is required */\n public declinedIfRequired(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(declinedIfRequiredRule, errorMessage, { field });\n }\n\n /** Value must be declined if another field is present */\n public declinedIfPresent(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(declinedIfPresentRule, errorMessage, { field });\n }\n\n /** Value must be declined if another field is missing */\n public declinedWithout(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(declinedWithoutRule, errorMessage, { field });\n }\n\n // ==================== Coercion ====================\n\n /**\n * Opt in to coercion: an exact query-string-shaped boolean is converted to a\n * real boolean **before** the type rules run; any other value passes through\n * unchanged so bad input still fails the type rule.\n *\n * Converts exactly `\"true\"` / `\"1\"` / `1` → `true` and `\"false\"` / `\"0\"` / `0`\n * → `false`. Case-sensitive, no trimming — `\"TRUE\"`, `\"yes\"`, `\"on\"`, `\"\"`, and\n * `2` all pass through unchanged and fail the type rule. `v.boolean()` does\n * **not** coerce by default; this only takes effect when explicitly chained.\n * For form-style truthy strings like `\"yes\"` / `\"on\"`, use `.accepted()` /\n * `.declined()` instead — those methods opt into their own form-boolean\n * parsing (a wider value set, case-insensitive on a few forms) and then\n * apply the accepted/declined pass-fail rule on top of the parsed boolean.\n *\n * The output type is unchanged (`Infer<>` keys off the validator class), so\n * `v.boolean().coerce()` still infers `boolean`.\n *\n * @example\n * v.boolean().coerce() // \"true\" → true; \"1\" → true; \"0\" → false; \"yes\" → invalid\n */\n public coerce() {\n return this.addMutator(booleanCoerceMutator) as this & { isCoerced: true };\n }\n\n // ==================== Strict boolean checks ====================\n\n /**\n * Value must be strictly true (not \"yes\", \"on\", 1, etc.)\n * @alias accepted - strict version\n */\n public mustBeTrue(errorMessage?: string) {\n return this.equal(true, errorMessage);\n }\n\n /**\n * Value must be strictly false (not \"no\", \"off\", 0, etc.)\n * @alias declined - strict version\n */\n public mustBeFalse(errorMessage?: string) {\n return this.equal(false, errorMessage);\n }\n\n /**\n * @inheritdoc\n *\n * @note accepted/declined rules and all cross-field boolean rules\n * are not representable in JSON Schema and are silently omitted.\n *\n * @example\n * ```ts\n * v.boolean().toJsonSchema(\"draft-2020-12\")\n * // → { type: \"boolean\" }\n *\n * v.boolean().nullable().toJsonSchema(\"openapi-3.0\")\n * // → { type: \"boolean\", nullable: true }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const schema: JsonSchemaResult = { type: \"boolean\" };\n if (this.isNullable) applyNullable(schema, target);\n return schema;\n }\n}\n","import dayjs from \"dayjs\";\r\nimport {\r\n addDaysMutator,\r\n addHoursMutator,\r\n addMonthsMutator,\r\n addYearsMutator,\r\n dateMutator,\r\n toEndOfDayMutator,\r\n toEndOfMonthMutator,\r\n toEndOfYearMutator,\r\n toStartOfDayMutator,\r\n toStartOfMonthMutator,\r\n toStartOfYearMutator,\r\n toUTCMutator,\r\n} from \"../mutators\";\r\nimport {\r\n afterFieldRule,\r\n afterTodayRule,\r\n ageRule,\r\n beforeFieldRule,\r\n beforeHourRule,\r\n beforeMinuteRule,\r\n beforeTodayRule,\r\n betweenAgeRule,\r\n betweenDatesRule,\r\n betweenDaysRule,\r\n betweenHoursRule,\r\n betweenMinutesRule,\r\n betweenMonthsRule,\r\n betweenTimesRule,\r\n betweenYearsRule,\r\n birthdayRule,\r\n businessDayRule,\r\n dateRule,\r\n fromHourRule,\r\n fromMinuteRule,\r\n fromTodayRule,\r\n futureRule,\r\n leapYearRule,\r\n maxAgeRule,\r\n maxDateRule,\r\n maxDayRule,\r\n maxMonthRule,\r\n maxYearRule,\r\n minAgeRule,\r\n minDateRule,\r\n minDayRule,\r\n minMonthRule,\r\n minYearRule,\r\n type Month,\r\n monthRule,\r\n pastRule,\r\n quarterRule,\r\n sameAsFieldDateRule,\r\n todayRule,\r\n weekDayRule,\r\n weekdaysRule,\r\n weekendRule,\r\n withinDaysRule,\r\n withinFutureDaysRule,\r\n withinPastDaysRule,\r\n yearRule,\r\n} from \"../rules\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\nimport { applyNullable, getRuleOptions } from \"../standard-schema/json-schema\";\r\nimport type { WeekDay } from \"../types/date-types\";\r\nimport { isDateValue } from \"./../helpers/date-helpers\";\r\nimport { BaseValidator } from \"./base-validator\";\r\n\r\n/**\r\n * Date validator class\r\n */\r\nexport class DateValidator extends BaseValidator {\r\n public constructor(errorMessage?: string) {\r\n super();\r\n this.addMutableMutator(dateMutator); // Normalize to Date object first\r\n this.addMutableRule(dateRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is a Date type\r\n */\r\n public matchesType(value: any): boolean {\r\n return isDateValue(value);\r\n }\r\n\r\n // ==================== Output Transformers ====================\r\n // These transform the Date after validation into different formats\r\n\r\n /**\r\n * Convert date to ISO string format\r\n * @category transformer\r\n */\r\n public toISOString() {\r\n return this.addTransformer((data) => (data instanceof Date ? data.toISOString() : data));\r\n }\r\n\r\n /** Convert date to Unix timestamp (milliseconds) */\r\n public toTimestamp() {\r\n return this.addTransformer((data) => (data instanceof Date ? data.getTime() : data));\r\n }\r\n\r\n // ==================== String Format Transformers ====================\r\n // These convert Date to formatted strings after validation\r\n\r\n /** Convert date to specific format using dayjs */\r\n public toFormat(format: string) {\r\n return this.addTransformer(\r\n (data, { options }) => (data instanceof Date ? dayjs(data).format(options.format) : data),\r\n { format },\r\n );\r\n }\r\n\r\n /** Convert to date only (remove time, returns YYYY-MM-DD) */\r\n public toDateOnly() {\r\n return this.addTransformer(\r\n (data) => (data instanceof Date ? dayjs(data).format(\"YYYY-MM-DD\") : data),\r\n { __jsonSchemaFormat: \"date\" },\r\n );\r\n }\r\n\r\n /** Convert to time only (returns HH:MM:SS) */\r\n public toTimeOnly() {\r\n return this.addTransformer(\r\n (data) => (data instanceof Date ? dayjs(data).format(\"HH:mm:ss\") : data),\r\n { __jsonSchemaFormat: \"time\" },\r\n );\r\n }\r\n\r\n // ==================== Date Mutators ====================\r\n // These modify the Date object before validation\r\n\r\n /**\r\n * Convert date to start of day (00:00:00)\r\n * @category mutator\r\n */\r\n public toStartOfDay() {\r\n return this.addMutator(toStartOfDayMutator);\r\n }\r\n\r\n /** Convert date to end of day (23:59:59.999) */\r\n public toEndOfDay() {\r\n return this.addMutator(toEndOfDayMutator);\r\n }\r\n\r\n /** Add or subtract days from date */\r\n public addDays(days: number) {\r\n return this.addMutator(addDaysMutator, { days });\r\n }\r\n\r\n /** Add or subtract months from date */\r\n public addMonths(months: number) {\r\n return this.addMutator(addMonthsMutator, { months });\r\n }\r\n\r\n /** Add or subtract years from date */\r\n public addYears(years: number) {\r\n return this.addMutator(addYearsMutator, { years });\r\n }\r\n\r\n /** Add or subtract hours from date */\r\n public addHours(hours: number) {\r\n return this.addMutator(addHoursMutator, { hours });\r\n }\r\n\r\n /** Convert date to UTC */\r\n public toUTC() {\r\n return this.addMutator(toUTCMutator);\r\n }\r\n\r\n // ==================== Date Range Mutators ====================\r\n\r\n /** Set to start of month */\r\n public toStartOfMonth() {\r\n return this.addMutator(toStartOfMonthMutator);\r\n }\r\n\r\n /** Set to end of month */\r\n public toEndOfMonth() {\r\n return this.addMutator(toEndOfMonthMutator);\r\n }\r\n\r\n /** Set to start of year */\r\n public toStartOfYear() {\r\n return this.addMutator(toStartOfYearMutator);\r\n }\r\n\r\n /** Set to end of year */\r\n public toEndOfYear() {\r\n return this.addMutator(toEndOfYearMutator);\r\n }\r\n\r\n // ==================== Date Comparison ====================\r\n\r\n /**\r\n * Date must be greater than or equal to the given date or field (inclusive)\r\n *\r\n * Smart detection:\r\n * - Date instance, timestamp, or date string (with - or /) → value comparison\r\n * - Plain string → field comparison\r\n *\r\n * @param dateOrField - Date, timestamp, date string, or field name\r\n *\r\n * @example\r\n * ```ts\r\n * // Value comparison\r\n * v.date().min('2024-01-01')\r\n * v.date().min(new Date())\r\n * v.date().min(1698278400000)\r\n *\r\n * // Field comparison\r\n * v.date().min('startsAt')\r\n * ```\r\n *\r\n * @category Validation Rule\r\n */\r\n public min(dateOrField: Date | string | number, errorMessage?: string): this {\r\n return this.addRule(minDateRule, errorMessage, {\r\n dateOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be less than or equal to the given date or field (inclusive)\r\n *\r\n * Smart detection:\r\n * - Date instance, timestamp, or date string (with - or /) → value comparison\r\n * - Plain string → field comparison\r\n *\r\n * @category Validation Rule\r\n */\r\n public max(dateOrField: Date | string | number, errorMessage?: string): this {\r\n return this.addRule(maxDateRule, errorMessage, {\r\n dateOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be strictly less than the given date or field (exclusive)\r\n *\r\n * Smart detection:\r\n * - Date instance, timestamp, or date string (with - or /) → value comparison\r\n * - Plain string → field comparison\r\n *\r\n * @category Validation Rule\r\n */\r\n public before(dateOrField: Date | string | number, errorMessage?: string): this {\r\n return this.addRule(beforeFieldRule, errorMessage, {\r\n dateOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be strictly greater than the given date or field (exclusive)\r\n *\r\n * Smart detection:\r\n * - Date instance, timestamp, or date string (with - or /) → value comparison\r\n * - Plain string → field comparison\r\n *\r\n * @category Validation Rule\r\n */\r\n public after(dateOrField: Date | string | number, errorMessage?: string): this {\r\n return this.addRule(afterFieldRule, errorMessage, {\r\n dateOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /** Date must be between start and end dates */\r\n public between(startDate: Date, endDate: Date, errorMessage?: string) {\r\n return this.addRule(betweenDatesRule, errorMessage, { startDate, endDate });\r\n }\r\n\r\n /** Date must be exactly today */\r\n public today(errorMessage?: string) {\r\n return this.addRule(todayRule, errorMessage);\r\n }\r\n\r\n /** Date must be today or in the future */\r\n public fromToday(errorMessage?: string) {\r\n return this.addRule(fromTodayRule, errorMessage);\r\n }\r\n\r\n /** Date must be before today */\r\n public beforeToday(errorMessage?: string) {\r\n return this.addRule(beforeTodayRule, errorMessage);\r\n }\r\n\r\n /** Date must be after today (not including today) */\r\n public afterToday(errorMessage?: string) {\r\n return this.addRule(afterTodayRule, errorMessage);\r\n }\r\n\r\n /** Date must be in the past */\r\n public past(errorMessage?: string) {\r\n return this.addRule(pastRule, errorMessage);\r\n }\r\n\r\n /** Date must be in the future */\r\n public future(errorMessage?: string) {\r\n return this.addRule(futureRule, errorMessage);\r\n }\r\n\r\n // ==================== Sibling Field Comparison ====================\r\n // Explicit sibling scope methods\r\n\r\n /**\r\n * Date must be >= sibling field value (inclusive)\r\n * @category Validation Rule\r\n */\r\n public minSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(minDateRule, errorMessage, {\r\n dateOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be <= sibling field value (inclusive)\r\n * @category Validation Rule\r\n */\r\n public maxSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(maxDateRule, errorMessage, {\r\n dateOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be < sibling field value (exclusive)\r\n * @category Validation Rule\r\n */\r\n public beforeSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(beforeFieldRule, errorMessage, {\r\n dateOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be > sibling field value (exclusive)\r\n * @category Validation Rule\r\n */\r\n public afterSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(afterFieldRule, errorMessage, {\r\n dateOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /** Date must be the same as another field's date */\r\n public sameAsField(field: string, errorMessage?: string) {\r\n return this.addRule(sameAsFieldDateRule, errorMessage, {\r\n field,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /** Date must be the same as another sibling field's date */\r\n public sameAsFieldSibling(field: string, errorMessage?: string) {\r\n return this.addRule(sameAsFieldDateRule, errorMessage, {\r\n field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n // ==================== Time Validation ====================\r\n\r\n /** Time must be from specific hour onwards (0-23) */\r\n public fromHour(hour: number, errorMessage?: string) {\r\n return this.addRule(fromHourRule, errorMessage, { hour });\r\n }\r\n\r\n /** Time must be before specific hour (0-23) */\r\n public beforeHour(hour: number, errorMessage?: string) {\r\n return this.addRule(beforeHourRule, errorMessage, { hour });\r\n }\r\n\r\n /** Time must be between start and end hours (0-23) */\r\n public betweenHours(startHour: number, endHour: number, errorMessage?: string) {\r\n return this.addRule(betweenHoursRule, errorMessage, { startHour, endHour });\r\n }\r\n\r\n /** Time must be from specific minute onwards (0-59) */\r\n public fromMinute(minute: number, errorMessage?: string) {\r\n return this.addRule(fromMinuteRule, errorMessage, { minute });\r\n }\r\n\r\n /** Time must be before specific minute (0-59) */\r\n public beforeMinute(minute: number, errorMessage?: string) {\r\n return this.addRule(beforeMinuteRule, errorMessage, { minute });\r\n }\r\n\r\n /** Time must be between start and end minutes (0-59) */\r\n public betweenMinutes(startMinute: number, endMinute: number, errorMessage?: string) {\r\n return this.addRule(betweenMinutesRule, errorMessage, {\r\n startMinute,\r\n endMinute,\r\n });\r\n }\r\n\r\n /** Time must be between start and end times (HH:MM format) */\r\n public betweenTimes(startTime: string, endTime: string, errorMessage?: string) {\r\n return this.addRule(betweenTimesRule, errorMessage, { startTime, endTime });\r\n }\r\n\r\n // ==================== Age Validation ====================\r\n\r\n /** Age must be exactly the given years */\r\n public age(years: number, errorMessage?: string) {\r\n return this.addRule(ageRule, errorMessage, { years });\r\n }\r\n\r\n /** Minimum age requirement */\r\n public minAge(years: number, errorMessage?: string) {\r\n return this.addRule(minAgeRule, errorMessage, { years });\r\n }\r\n\r\n /** Maximum age requirement */\r\n public maxAge(years: number, errorMessage?: string) {\r\n return this.addRule(maxAgeRule, errorMessage, { years });\r\n }\r\n\r\n /** Age must be between min and max years */\r\n public betweenAge(minAge: number, maxAge: number, errorMessage?: string) {\r\n return this.addRule(betweenAgeRule, errorMessage, { minAge, maxAge });\r\n }\r\n\r\n // ==================== Day Validation ====================\r\n\r\n /** Date must be specific weekday */\r\n public weekDay(day: WeekDay, errorMessage?: string) {\r\n return this.addRule(weekDayRule, errorMessage, { day });\r\n }\r\n\r\n /** Date must be one of specified weekdays */\r\n public weekdays(days: WeekDay[], errorMessage?: string) {\r\n return this.addRule(weekdaysRule, errorMessage, { days });\r\n }\r\n\r\n /** Date must be a weekend (Saturday or Sunday) */\r\n public weekend(errorMessage?: string) {\r\n return this.addRule(weekendRule, errorMessage);\r\n }\r\n\r\n /** Date must be a business day (Monday-Friday) */\r\n public businessDay(errorMessage?: string) {\r\n return this.addRule(businessDayRule, errorMessage);\r\n }\r\n\r\n /** Date must match specific format */\r\n public format(format: string, errorMessage?: string) {\r\n return this.addRule(dateRule, errorMessage, { format });\r\n }\r\n\r\n // ==================== Relative Date Validation ====================\r\n\r\n /** Date must be within X days from now (past or future) */\r\n public withinDays(days: number, errorMessage?: string) {\r\n return this.addRule(withinDaysRule, errorMessage, { days });\r\n }\r\n\r\n /** Date must be within X days in the past */\r\n public withinPastDays(days: number, errorMessage?: string) {\r\n return this.addRule(withinPastDaysRule, errorMessage, { days });\r\n }\r\n\r\n /** Date must be within X days in the future */\r\n public withinFutureDays(days: number, errorMessage?: string) {\r\n return this.addRule(withinFutureDaysRule, errorMessage, { days });\r\n }\r\n\r\n // ==================== Period Validation ====================\r\n\r\n /** Date must be in specific month (1-12) */\r\n public month(month: Month, errorMessage?: string) {\r\n return this.addRule(monthRule, errorMessage, { month });\r\n }\r\n\r\n /** Date must be in specific year */\r\n public year(year: number, errorMessage?: string) {\r\n return this.addRule(yearRule, errorMessage, { year });\r\n }\r\n\r\n /**\r\n * Date must be between start and end years\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public betweenYears(startYear: number | string, endYear: number | string, errorMessage?: string) {\r\n return this.addRule(betweenYearsRule, errorMessage, {\r\n startYear,\r\n endYear,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be between start and end months (1-12)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public betweenMonths(\r\n startMonth: Month | string,\r\n endMonth: Month | string,\r\n errorMessage?: string,\r\n ) {\r\n return this.addRule(betweenMonthsRule, errorMessage, {\r\n startMonth,\r\n endMonth,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be between start and end days (1-31)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public betweenDays(startDay: number | string, endDay: number | string, errorMessage?: string) {\r\n return this.addRule(betweenDaysRule, errorMessage, {\r\n startDay,\r\n endDay,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be between sibling field years\r\n * @category Validation Rule\r\n */\r\n public betweenYearsSibling(startYearField: string, endYearField: string, errorMessage?: string) {\r\n return this.addRule(betweenYearsRule, errorMessage, {\r\n startYear: startYearField,\r\n endYear: endYearField,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be between sibling field months\r\n * @category Validation Rule\r\n */\r\n public betweenMonthsSibling(\r\n startMonthField: string,\r\n endMonthField: string,\r\n errorMessage?: string,\r\n ) {\r\n return this.addRule(betweenMonthsRule, errorMessage, {\r\n startMonth: startMonthField,\r\n endMonth: endMonthField,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be between sibling field days\r\n * @category Validation Rule\r\n */\r\n public betweenDaysSibling(startDayField: string, endDayField: string, errorMessage?: string) {\r\n return this.addRule(betweenDaysRule, errorMessage, {\r\n startDay: startDayField,\r\n endDay: endDayField,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Year must be >= given year or field\r\n * Smart detection: number or field name\r\n *\r\n * @example\r\n * ```ts\r\n * // Value comparison\r\n * v.date().minYear(2024)\r\n *\r\n * // Field comparison\r\n * v.date().minYear('startYear')\r\n * ```\r\n *\r\n * @category Validation Rule\r\n */\r\n public minYear(yearOrField: number | string, errorMessage?: string): this {\r\n return this.addRule(minYearRule, errorMessage, {\r\n yearOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Year must be <= given year or field\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public maxYear(yearOrField: number | string, errorMessage?: string): this {\r\n return this.addRule(maxYearRule, errorMessage, {\r\n yearOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Month must be >= given month or field (1-12)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public minMonth(monthOrField: number | string, errorMessage?: string): this {\r\n return this.addRule(minMonthRule, errorMessage, {\r\n monthOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Month must be <= given month or field (1-12)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public maxMonth(monthOrField: Month | string, errorMessage?: string): this {\r\n return this.addRule(maxMonthRule, errorMessage, {\r\n monthOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Day must be >= given day or field (1-31)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public minDay(dayOrField: number | string, errorMessage?: string): this {\r\n return this.addRule(minDayRule, errorMessage, {\r\n dayOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Day must be <= given day or field (1-31)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public maxDay(dayOrField: number | string, errorMessage?: string): this {\r\n return this.addRule(maxDayRule, errorMessage, {\r\n dayOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Year must be >= sibling field year\r\n * @category Validation Rule\r\n */\r\n public minYearSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(minYearRule, errorMessage, {\r\n yearOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Year must be <= sibling field year\r\n * @category Validation Rule\r\n */\r\n public maxYearSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(maxYearRule, errorMessage, {\r\n yearOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Month must be >= sibling field month\r\n * @category Validation Rule\r\n */\r\n public minMonthSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(minMonthRule, errorMessage, {\r\n monthOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Month must be <= sibling field month\r\n * @category Validation Rule\r\n */\r\n public maxMonthSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(maxMonthRule, errorMessage, {\r\n monthOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Day must be >= sibling field day\r\n * @category Validation Rule\r\n */\r\n public minDaySibling(field: string, errorMessage?: string): this {\r\n return this.addRule(minDayRule, errorMessage, {\r\n dayOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Day must be <= sibling field day\r\n * @category Validation Rule\r\n */\r\n public maxDaySibling(field: string, errorMessage?: string): this {\r\n return this.addRule(maxDayRule, errorMessage, {\r\n dayOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /** Date must be in specific quarter (1-4) */\r\n public quarter(quarter: 1 | 2 | 3 | 4, errorMessage?: string) {\r\n return this.addRule(quarterRule, errorMessage, { quarter });\r\n }\r\n\r\n // ==================== Special Validation ====================\r\n\r\n /** Valid birthday (not in future, reasonable age) */\r\n public birthday(minAge?: number, maxAge?: number, errorMessage?: string) {\r\n return this.addRule(birthdayRule, errorMessage, { minAge, maxAge });\r\n }\r\n\r\n /** Date must be in a leap year */\r\n public leapYear(errorMessage?: string) {\r\n return this.addRule(leapYearRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Set default value as current time of exeuction\r\n */\r\n public defaultNow() {\r\n return this.default(() => new Date());\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Maps DateValidator to JSON Schema format keywords.\r\n * Default is `date-time`. If `.toDateOnly()` or `.toTimeOnly()` are used,\r\n * falls back to `date` or `time` formats respectively.\r\n *\r\n * @example\r\n * ```ts\r\n * v.date().toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"string\", format: \"date-time\" }\r\n *\r\n * v.date().toDateOnly().toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"string\", format: \"date\" }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const schema: JsonSchemaResult = { type: \"string\", format: \"date-time\" };\r\n\r\n // Check if an explicit format rule was applied via v.date().format()\r\n const dateOpts = getRuleOptions(this.rules, \"date\");\r\n if (dateOpts?.format === \"YYYY-MM-DD\") {\r\n schema.format = \"date\";\r\n } else if (dateOpts?.format === \"HH:mm:ss\") {\r\n schema.format = \"time\";\r\n }\r\n\r\n // Transformer-based detection (marker-driven; minifier-safe).\r\n // toDateOnly/toTimeOnly tag their options bag with __jsonSchemaFormat.\r\n // toFormat() exposes the user-supplied format string in options.format.\r\n if (schema.format === \"date-time\") {\r\n for (const t of this.dataTransformers) {\r\n const hint = t.options?.__jsonSchemaFormat;\r\n if (hint === \"date\" || hint === \"time\") {\r\n schema.format = hint;\r\n break;\r\n }\r\n\r\n const userFormat = t.options?.format;\r\n\r\n if (userFormat === \"YYYY-MM-DD\") {\r\n schema.format = \"date\";\r\n break;\r\n }\r\n\r\n if (userFormat === \"HH:mm:ss\") {\r\n schema.format = \"time\";\r\n break;\r\n }\r\n }\r\n }\r\n\r\n if (this.isNullable) applyNullable(schema, target);\r\n\r\n return schema;\r\n }\r\n}\r\n","import { isEmptyValue } from \"../helpers/is-empty-value\";\nimport { literalRule } from \"../rules/common/literal\";\nimport { presentRule } from \"../rules/core/required\";\nimport { applyNullable } from \"../standard-schema/json-schema\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport { BaseValidator } from \"./base-validator\";\n\n/**\n * Literal validator class\n *\n * Accepts a fixed tuple of primitive literal values (string, number, boolean).\n * The TypeScript type narrows to the union of those literals — `v.literal(\"a\", \"b\")`\n * infers as `\"a\" | \"b\"`, not `string`. Use for discriminator fields, enum-like\n * unions of constants, and any case where `oneOf([...])` would lose literal types.\n *\n * @example\n * v.literal(\"items\") // type: \"items\"\n * v.literal(\"draft\", \"published\") // type: \"draft\" | \"published\"\n * v.literal(1, 2, 3) // type: 1 | 2 | 3\n * v.literal(true) // type: true\n */\nexport class LiteralValidator<\n T extends readonly (string | number | boolean)[] = readonly (string | number | boolean)[],\n> extends BaseValidator {\n public values: T;\n\n public constructor(values: T, errorMessage?: string) {\n super();\n this.values = values;\n this.addMutableRule(literalRule, errorMessage, { values });\n\n // `\"\"` is a value, not an absence. Every validator is required by default,\n // and `required` rejects anything `isEmptyValue` calls empty — including the\n // empty string — so `v.literal(\"\")` could never pass. When the author has\n // explicitly listed an empty value as acceptable, swap `required` for\n // `present`: the key must still exist, but judging the value is the literal\n // set's job, and it is already the stricter statement of intent.\n //\n // Dropping the rule entirely instead would make a missing key valid, which\n // is the opposite mistake — `alt=\"\"` and no `alt` at all are different\n // things to a screen reader, and to anything else reading the schema.\n if (values.some(value => isEmptyValue(value))) {\n this.requiredRule = this.createRule(presentRule);\n }\n }\n\n /**\n * Check if value is one of the configured literals\n */\n public matchesType(value: any): boolean {\n return (this.values as readonly any[]).includes(value);\n }\n\n /**\n * Clone the validator, preserving the literal `values` set.\n *\n * The base `clone()` only copies `BaseValidator` fields, so without this\n * override a cloned literal loses its public `values` array — which breaks\n * any consumer that reads it (e.g. `discriminatedUnion` branch routing).\n */\n public override clone(): this {\n const cloned = super.clone();\n cloned.values = this.values;\n return cloned;\n }\n\n /**\n * @inheritdoc\n *\n * Single literal → `{ const: <value> }`. Multiple → `{ enum: [...] }`.\n *\n * @example\n * ```ts\n * v.literal(\"items\").toJsonSchema()\n * // → { const: \"items\" }\n *\n * v.literal(\"draft\", \"published\").toJsonSchema()\n * // → { enum: [\"draft\", \"published\"] }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const schema: JsonSchemaResult =\n this.values.length === 1 ? { const: this.values[0] } : { enum: [...this.values] };\n if (this.isNullable) applyNullable(schema, target);\n return schema;\n }\n}\n","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 {\r\n absMutator,\r\n ceilMutator,\r\n floorMutator,\r\n numericMutator,\r\n roundMutator,\r\n toFixedMutator,\r\n} 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 * Round to a fixed number of decimal places, keeping the value a **number**.\r\n *\r\n * `v.number().toFixed(2)` on `3.14159` yields `3.14`, not `\"3.14\"` — a number\r\n * schema has to output a number, or its own type rule rejects the result.\r\n * Format to a fixed-point *string* at the presentation edge instead.\r\n *\r\n * @example\r\n * v.number().toFixed(2) // 3.14159 → 3.14\r\n */\r\n public toFixed(decimals = 2) {\r\n return this.addMutator(toFixedMutator, { decimals });\r\n }\r\n\r\n /**\r\n * Opt in to coercion: a numeric-shaped string is converted to a number\r\n * **before** the type rules run; any other value passes through unchanged\r\n * so bad input still fails the type rule.\r\n *\r\n * Strictness is preserved — coercion only fixes the string *representation*,\r\n * not the value's shape. `v.int().coerce()` turns `\"5\"` into `5` (valid) but\r\n * `\"5.5\"` into `5.5`, which still fails the integer rule. Number validators\r\n * do **not** coerce by default; this only takes effect when explicitly chained.\r\n *\r\n * The output type is unchanged (`Infer<>` keys off the validator class), so\r\n * `v.int().coerce()` still infers `number`.\r\n *\r\n * @example\r\n * v.int().coerce() // \"5\" → 5 (valid); \"5.5\" → 5.5 (invalid); \"abc\" → invalid\r\n * v.number().coerce() // \"5.5\" → 5.5 (valid)\r\n */\r\n public coerce() {\r\n return this.addMutator(numericMutator) as this & { isCoerced: true };\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 { 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 { 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 type { SealConfig } from \"../config\";\r\nimport { object } from \"../object\";\r\nimport { string } from \"../string\";\r\nimport type { StandardSchemaV1 } from \"../standard-schema/types\";\r\nimport type { Schema, SchemaContext, ValidationResult } from \"../types\";\r\nimport type { Infer } from \"../types/inference-types\";\r\nimport { AnyValidator } from \"../validators/any-validator\";\r\nimport { ArrayValidator } from \"../validators/array-validator\";\r\nimport type { BaseValidator } from \"../validators/base-validator\";\r\nimport { BooleanValidator } from \"../validators/boolean-validator\";\r\nimport { ComputedValidator } from \"../validators/computed-validator\";\r\nimport { DateValidator } from \"../validators/date-validator\";\r\nimport { DiscriminatedUnionValidator } from \"../validators/discriminated-union-validator\";\r\nimport { FloatValidator } from \"../validators/float-validator\";\r\nimport { InstanceOfValidator } from \"../validators/instanceof-validator\";\r\nimport { IntValidator } from \"../validators/int-validator\";\r\nimport { LazyValidator } from \"../validators/lazy-validator\";\r\nimport { LiteralValidator } from \"../validators/literal-validator\";\r\nimport { ManagedValidator } from \"../validators/managed-validator\";\r\nimport { NumberValidator } from \"../validators/number-validator\";\r\nimport { NumericValidator } from \"../validators/numeric-validator\";\r\nimport { ObjectValidator } from \"../validators/object-validator\";\r\nimport { RecordValidator } from \"../validators/record-validator\";\r\nimport { ScalarValidator } from \"../validators/scalar-validator\";\r\nimport { StringValidator } from \"../validators/string-validator\";\r\nimport { TupleValidator } from \"../validators/tuple-validator\";\r\nimport { UnionValidator } from \"../validators/union-validator\";\r\n// BaseValidator prototype augmentations — side-effect imports so the `v`\r\n// factory always exposes the chain methods (.required, .requiredIf, .sameAs,\r\n// .present, .forbidden, .when, …) regardless of which entry path loaded it.\r\n// The package barrel (src/index.ts) loads these via the validators barrel, but\r\n// importing the factory leaf directly would otherwise yield a half-built `v`.\r\nimport \"../validators/methods/equality-conditional-methods\";\r\nimport \"../validators/methods/forbidden-methods\";\r\nimport \"../validators/methods/present-methods\";\r\nimport \"../validators/methods/required-methods\";\r\nimport { validate as validateFunction } from \"./validate\";\r\n\r\n/**\r\n * Seal factory object - creates instances of validators\r\n *\r\n * Use 'v' to create validation schemas (seals) for your data\r\n */\r\nexport const v: ValidatorV = {\r\n /** Create an object validator */\r\n object,\r\n\r\n /** Create an any validator */\r\n any: () => new AnyValidator() as AnyValidator & StandardSchemaV1<any>,\r\n\r\n /** Create an array validator */\r\n array: <T extends BaseValidator>(validator: T, errorMessage?: string) =>\r\n new ArrayValidator(validator, errorMessage) as ArrayValidator & {\r\n validator: T;\r\n } & StandardSchemaV1<Array<Infer<T>>>,\r\n\r\n /** Create a record validator - object with dynamic keys and consistent value types */\r\n record: <T extends BaseValidator>(validator?: T, errorMessage?: string) =>\r\n new RecordValidator(validator || v.any(), errorMessage) as RecordValidator & {\r\n valueValidator: T;\r\n } & StandardSchemaV1<Record<string, Infer<T>>>,\r\n\r\n /** Create a tuple validator - fixed-length array with position-specific types */\r\n tuple: <T extends BaseValidator[]>(validators: T, errorMessage?: string) =>\r\n new TupleValidator(validators, errorMessage) as TupleValidator & {\r\n validators: T;\r\n } & StandardSchemaV1<{ [K in keyof T]: Infer<T[K]> }>,\r\n\r\n /** Create a date validator */\r\n date: (errorMessage?: string) =>\r\n new DateValidator(errorMessage) as DateValidator & StandardSchemaV1<Date>,\r\n\r\n /**\r\n * Create a literal validator — narrows to the union of given literal values\r\n *\r\n * @example\r\n * v.literal(\"items\") // type: \"items\"\r\n * v.literal(\"draft\", \"published\") // type: \"draft\" | \"published\"\r\n * v.literal(1, 2, 3) // type: 1 | 2 | 3\r\n */\r\n literal: <T extends readonly [string | number | boolean, ...(string | number | boolean)[]]>(\r\n ...values: T\r\n ) => new LiteralValidator<T>(values) as LiteralValidator<T> & StandardSchemaV1<T[number]>,\r\n\r\n /**\r\n * Create an instanceof validator — value must be `instanceof` the constructor\r\n *\r\n * @example\r\n * v.instanceof(File) // type: File\r\n * v.instanceof(Buffer) // type: Buffer\r\n * v.instanceof(MyClass) // type: MyClass\r\n */\r\n instanceof: <T>(ctor: new (...args: any[]) => T, errorMessage?: string) =>\r\n new InstanceOfValidator<T>(ctor, errorMessage) as InstanceOfValidator<T> & StandardSchemaV1<T>,\r\n\r\n /**\r\n * Create a lazy validator — defers resolution of the inner validator until\r\n * validate-time. Use for recursive or forward-referenced schemas.\r\n *\r\n * @example\r\n * type Category = { name: string; children: Category[] };\r\n *\r\n * const category: ObjectValidator<...> = v.object({\r\n * name: v.string(),\r\n * children: v.array(v.lazy(() => category)),\r\n * });\r\n */\r\n lazy: <T extends BaseValidator>(thunk: () => T) =>\r\n new LazyValidator(thunk) as LazyValidator<T> & StandardSchemaV1<Infer<T>>,\r\n\r\n /** Create a string validator */\r\n string,\r\n\r\n /** Create an email validator */\r\n email: (emailErrorMessage?: string, errorMessage?: string) =>\r\n new StringValidator(errorMessage).email(emailErrorMessage) as StringValidator &\r\n StandardSchemaV1<string>,\r\n\r\n /**\r\n * Create an enum validator — preserves the literal union of accepted\r\n * values in the inferred Standard Schema output.\r\n *\r\n * Two input shapes:\r\n * - Tuple of literals: `v.enum([\"draft\", \"published\"])` →\r\n * `StandardSchemaV1<\"draft\" | \"published\">`\r\n * - TypeScript enum object: `v.enum(Status)` →\r\n * `StandardSchemaV1<Status[keyof Status]>`\r\n *\r\n * Implementation is loosely typed; the public `ValidatorV.enum`\r\n * surface declares the precise overloads.\r\n */\r\n enum: ((values: any, errorMessage?: string) =>\r\n Array.isArray(values)\r\n ? new StringValidator().oneOf(values, errorMessage)\r\n : new ScalarValidator().enum(values, errorMessage)) as ValidatorV[\"enum\"],\r\n\r\n /** Create a number validator */\r\n number: (errorMessage?: string) =>\r\n new NumberValidator(errorMessage) as NumberValidator & StandardSchemaV1<number>,\r\n\r\n /** Create a numeric validator */\r\n numeric: (errorMessage?: string) =>\r\n new NumericValidator(errorMessage) as NumericValidator & StandardSchemaV1<number>,\r\n\r\n /** Create an integer validator */\r\n int: (errorMessage?: string) =>\r\n new IntValidator(errorMessage) as IntValidator & StandardSchemaV1<number>,\r\n\r\n /** Create a float validator */\r\n float: (errorMessage?: string) =>\r\n new FloatValidator(errorMessage) as FloatValidator & StandardSchemaV1<number>,\r\n\r\n /** Create a boolean validator */\r\n boolean: (errorMessage?: string) =>\r\n new BooleanValidator(errorMessage) as BooleanValidator & StandardSchemaV1<boolean>,\r\n\r\n /** Create a scalar validator */\r\n scalar: (errorMessage?: string) =>\r\n new ScalarValidator(errorMessage) as ScalarValidator &\r\n StandardSchemaV1<string | number | boolean>,\r\n\r\n /** Create a union validator - validates against multiple types */\r\n union: <T extends BaseValidator[]>(validators: T, errorMessage?: string) =>\r\n new UnionValidator().union(validators, errorMessage) as UnionValidator &\r\n StandardSchemaV1<Infer<T[number]>>,\r\n\r\n /**\r\n * Create a discriminated union — routes payloads by a shared literal\r\n * discriminator field. Each branch must be a `v.object(...)` with the\r\n * discriminator typed as `v.literal(...)`.\r\n *\r\n * @example\r\n * const email = v.object({ type: v.literal(\"email\"), email: v.string().email() });\r\n * const sms = v.object({ type: v.literal(\"sms\"), phone: v.string() });\r\n * const notif = v.discriminatedUnion(\"type\", [email, sms]);\r\n * // type T = Infer<typeof notif>;\r\n * // → { type: \"email\", email: string } | { type: \"sms\", phone: string }\r\n */\r\n discriminatedUnion: <K extends string, Branches extends ReadonlyArray<ObjectValidator<any>>>(\r\n discriminator: K,\r\n validators: Branches,\r\n ) =>\r\n new DiscriminatedUnionValidator(discriminator, validators) as DiscriminatedUnionValidator<\r\n K,\r\n Branches\r\n > &\r\n StandardSchemaV1<Infer<Branches[number]>>,\r\n\r\n /** Create a computed field validator - derives value from other validated fields */\r\n computed: <TResult = any>(\r\n callback: (data: any, context: SchemaContext) => TResult | Promise<TResult>,\r\n resultValidator?: BaseValidator,\r\n ) =>\r\n new ComputedValidator<TResult>(callback, resultValidator) as ComputedValidator<TResult> &\r\n StandardSchemaV1<TResult>,\r\n\r\n /** Create a managed field validator - framework-injected value */\r\n managed: <TResult = any>(\r\n callback: (context: SchemaContext) => TResult | Promise<TResult>,\r\n resultValidator?: BaseValidator,\r\n ) =>\r\n new ManagedValidator<TResult>(callback, resultValidator) as ManagedValidator<TResult> &\r\n StandardSchemaV1<TResult>,\r\n\r\n /** Validate data against a schema */\r\n validate: validateFunction,\r\n} as unknown as ValidatorV;\r\n\r\nexport type ValidateOptions = {\r\n context?: Record<string, any>;\r\n /**\r\n * Rendered as `:value` in every error message — translated or custom —\r\n * instead of the submitted input. Unset keeps the raw value.\r\n */\r\n redactValue?: string;\r\n} & SealConfig;\r\n\r\nexport interface ValidatorV {\r\n object: <T extends Schema>(\r\n schema: T,\r\n errorMessage?: string,\r\n ) => ObjectValidator<T> & StandardSchemaV1<Infer<ObjectValidator<T>>>;\r\n any: () => AnyValidator & StandardSchemaV1<any>;\r\n array: <T extends BaseValidator>(\r\n validator: T,\r\n errorMessage?: string,\r\n ) => ArrayValidator & {\r\n validator: T;\r\n } & StandardSchemaV1<Array<Infer<T>>>;\r\n record: <T extends BaseValidator>(\r\n validator?: T,\r\n errorMessage?: string,\r\n ) => RecordValidator & {\r\n valueValidator: T;\r\n } & StandardSchemaV1<Record<string, Infer<T>>>;\r\n tuple: <T extends BaseValidator[]>(\r\n validators: T,\r\n errorMessage?: string,\r\n ) => TupleValidator & {\r\n validators: T;\r\n } & StandardSchemaV1<{ [K in keyof T]: Infer<T[K]> }>;\r\n date: (errorMessage?: string) => DateValidator & StandardSchemaV1<Date>;\r\n literal: <T extends readonly [string | number | boolean, ...(string | number | boolean)[]]>(\r\n ...values: T\r\n ) => LiteralValidator<T> & StandardSchemaV1<T[number]>;\r\n instanceof: <T>(\r\n ctor: new (...args: any[]) => T,\r\n errorMessage?: string,\r\n ) => InstanceOfValidator<T> & StandardSchemaV1<T>;\r\n lazy: <T extends BaseValidator>(thunk: () => T) => LazyValidator<T> & StandardSchemaV1<Infer<T>>;\r\n string: (errorMessage?: string) => StringValidator & StandardSchemaV1<string>;\r\n email: (errorMessage?: string) => StringValidator & StandardSchemaV1<string>;\r\n enum: {\r\n <const T extends readonly (string | number | boolean)[]>(\r\n values: T,\r\n errorMessage?: string,\r\n ): ScalarValidator & StandardSchemaV1<T[number]>;\r\n <const T extends Record<string, string | number>>(\r\n values: T,\r\n errorMessage?: string,\r\n ): ScalarValidator & StandardSchemaV1<T[keyof T]>;\r\n };\r\n number: (errorMessage?: string) => NumberValidator & StandardSchemaV1<number>;\r\n numeric: (errorMessage?: string) => NumericValidator & StandardSchemaV1<number>;\r\n int: (errorMessage?: string) => IntValidator & StandardSchemaV1<number>;\r\n float: (errorMessage?: string) => FloatValidator & StandardSchemaV1<number>;\r\n boolean: (errorMessage?: string) => BooleanValidator & StandardSchemaV1<boolean>;\r\n scalar: (errorMessage?: string) => ScalarValidator & StandardSchemaV1<string | number | boolean>;\r\n union: <T extends BaseValidator[]>(\r\n validators: T,\r\n errorMessage?: string,\r\n ) => UnionValidator & StandardSchemaV1<Infer<T[number]>>;\r\n discriminatedUnion: <K extends string, Branches extends ReadonlyArray<ObjectValidator<any>>>(\r\n discriminator: K,\r\n validators: Branches,\r\n ) => DiscriminatedUnionValidator<K, Branches> & StandardSchemaV1<Infer<Branches[number]>>;\r\n computed: <TResult = any>(\r\n callback: (data: any, context: SchemaContext) => TResult | Promise<TResult>,\r\n resultValidator?: BaseValidator,\r\n ) => ComputedValidator<TResult> & StandardSchemaV1<TResult>;\r\n managed: <TResult = any>(\r\n callback?: (context: SchemaContext) => TResult | Promise<TResult>,\r\n resultValidator?: BaseValidator,\r\n ) => ManagedValidator<TResult> & StandardSchemaV1<TResult>;\r\n validate: <T extends BaseValidator>(\r\n schema: T,\r\n data: any,\r\n options?: ValidateOptions,\r\n ) => Promise<ValidationResult>;\r\n}\r\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAa,eAAb,cAAkCA,uCAAc;;;sBAIf;oBAKF;;;;;;;;;;;;;;CAc7B,AAAgB,aAAa,SAA2B,iBAAmC;EACzF,MAAM,SAA2B,CAAC;EAClC,IAAI,KAAK,YAAY,uCAAc,QAAQ,MAAM;EACjD,OAAO;CACT;AACF;;;;;AC9BA,MAAa,mBAA4B,OAAO,UAAU;CACxD,OAAO,MAAM,QAAQ;AACvB;;AAGA,MAAa,sBAA+B,OAAO,UAAU;CAC3D,OAAO,MAAM,QAAQ;AACvB;;AAGA,MAAa,mBAA4B,OAAO,OAAO,YAAY;CACjE,IAAI,CAAC,MAAM,QAAQ,KAAK,GAAG,OAAO;CAElC,MAAM,gBAAgB,SAAS,QAAQ,aAAa;CACpD,MAAM,YAAY,SAAS,QAAQ,OAAO;CAE1C,OAAO,MAAM,MAAM,GAAQ,MAAW;EACpC,IAAI,WAAW;GACb,MAAM,yCAAa,GAAG,SAAS;GAC/B,MAAM,yCAAa,GAAG,SAAS;GAE/B,IAAI,kBAAkB,OACpB,OAA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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":["BaseValidator","isEmptyValue","VALID_RULE","invalidRule","getFieldValue","isEmptyValue","VALID_RULE","invalidRule","getFieldValue","isEmptyValue","BaseValidator","arrayRule","minLengthRule","maxLengthRule","lengthRule","betweenLengthRule","uniqueArrayRule","sortedArrayRule","setKeyPath","getRuleOptions","PrimitiveValidator","booleanRule","BaseValidator","dateRule","isDateValue","minDateRule","maxDateRule","beforeFieldRule","afterFieldRule","betweenDatesRule","todayRule","fromTodayRule","beforeTodayRule","afterTodayRule","pastRule","futureRule","sameAsFieldDateRule","fromHourRule","beforeHourRule","betweenHoursRule","fromMinuteRule","beforeMinuteRule","betweenMinutesRule","betweenTimesRule","ageRule","minAgeRule","maxAgeRule","betweenAgeRule","weekDayRule","weekdaysRule","weekendRule","businessDayRule","withinDaysRule","withinPastDaysRule","withinFutureDaysRule","monthRule","yearRule","betweenYearsRule","betweenMonthsRule","betweenDaysRule","minYearRule","maxYearRule","minMonthRule","maxMonthRule","minDayRule","maxDayRule","quarterRule","birthdayRule","leapYearRule","getRuleOptions","BaseValidator","literalRule","BaseValidator","wrapNullableStrict","PrimitiveValidator","numberRule","minRule","maxRule","greaterThanRule","lessThanRule","moduloRule","positiveRule","negativeRule","oddRule","evenRule","betweenNumbersRule","lengthRule","minLengthRule","maxLengthRule","getRuleOptions","floatRule","BaseValidator","instanceofRule","intRule","BaseValidator","ComputedValidator","BaseValidator","objectRule","plainObjectRule","setKeyPath","PrimitiveValidator","VALID_RULE","invalidRule","getRuleOptions","BaseValidator","arrayRule","setKeyPath","BaseValidator","unionRule","getRuleOptions","StringValidator","ComputedValidator","validateFunction"],"sources":["../../../../../../seal/src/validators/any-validator.ts","../../../../../../seal/src/mutators/array-mutators.ts","../../../../../../seal/src/rules/scalar/accepted-rule.ts","../../../../../../seal/src/rules/scalar/declined-rule.ts","../../../../../../seal/src/mutators/boolean-mutators.ts","../../../../../../seal/src/mutators/date-mutators.ts","../../../../../../seal/src/mutators/number-mutators.ts","../../../../../../seal/src/mutators/scalar-mutators.ts","../../../../../../seal/src/validators/array-validator.ts","../../../../../../seal/src/validators/boolean-validator.ts","../../../../../../seal/src/validators/date-validator.ts","../../../../../../seal/src/validators/literal-validator.ts","../../../../../../seal/src/validators/discriminated-union-validator.ts","../../../../../../seal/src/validators/number-validator.ts","../../../../../../seal/src/validators/float-validator.ts","../../../../../../seal/src/validators/instanceof-validator.ts","../../../../../../seal/src/validators/int-validator.ts","../../../../../../seal/src/validators/lazy-validator.ts","../../../../../../seal/src/validators/managed-validator.ts","../../../../../../seal/src/validators/numeric-validator.ts","../../../../../../seal/src/validators/record-validator.ts","../../../../../../seal/src/validators/scalar-validator.ts","../../../../../../seal/src/validators/tuple-validator.ts","../../../../../../seal/src/validators/union-validator.ts","../../../../../../seal/src/factory/validators.ts","../../../../../../seal/src/plugins/plugin-system.ts"],"sourcesContent":["import type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport { applyNullable } from \"../standard-schema/json-schema\";\nimport { BaseValidator } from \"./base-validator\";\n\n/**\n * Any validator - accepts any value\n */\nexport class AnyValidator extends BaseValidator {\n /**\n * Any validator means any value, so we disable the default required requirement.\n */\n public override requiredRule = null;\n\n /**\n * Set is optional to be true\n */\n public override isOptional = true;\n\n /**\n * @inheritdoc\n *\n * Any validator accepts anything. In JSON Schema, an empty object `{}`\n * is the permissive schema that accepts any valid JSON value.\n *\n * @example\n * ```ts\n * v.any().toJsonSchema(\"draft-2020-12\")\n * // → {}\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const schema: JsonSchemaResult = {};\n if (this.isNullable) applyNullable(schema, target);\n return schema;\n }\n}\n","import { get } from \"@mongez/reinforcements\";\nimport { isEmptyValue } from \"../helpers/is-empty-value\";\nimport type { Mutator } from \"../types\";\n\n/** Reverse array order */\nexport const flipArrayMutator: Mutator = async (value) => {\n return value.reverse();\n};\n\n/** Reverse array order (alias) */\nexport const reverseArrayMutator: Mutator = async (value) => {\n return value.reverse();\n};\n\n/** Sort array */\nexport const sortArrayMutator: Mutator = async (value, context) => {\n if (!Array.isArray(value)) return value;\n\n const sortDirection = context?.options.direction ?? \"asc\";\n const sortByKey = context?.options.key ?? null;\n\n return value.sort((a: any, b: any) => {\n if (sortByKey) {\n const aValue = get(a, sortByKey);\n const bValue = get(b, sortByKey);\n\n if (sortDirection === \"asc\") {\n return aValue - bValue;\n }\n return bValue - aValue;\n }\n\n if (sortDirection === \"asc\") {\n return a - b;\n }\n return b - a;\n });\n};\n\n/** Make array have only unique values */\nexport const uniqueArrayMutator: Mutator = async (value) => {\n return [...new Set(value)];\n};\n\n/** Remove empty elements from array */\nexport const removeEmptyArrayElementsMutator: Mutator = async (value) => {\n return value.filter((item: any) => !isEmptyValue(item));\n};\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * The full set of values treated as \"accepted\" by `acceptedRule` and its\n * conditional variants. Shared with `formBooleanMutator` (see\n * `../../mutators/boolean-mutators`) so `v.boolean().accepted()` recognizes\n * exactly this list — single source of truth, no duplicated literals.\n */\nexport const ACCEPTED_VALUES: readonly unknown[] = [\n \"1\",\n \"true\",\n \"yes\",\n \"y\",\n \"on\",\n 1,\n true,\n \"Yes\",\n \"Y\",\n \"On\",\n];\n\nconst isAcceptedValue = (value: any) => {\n return ACCEPTED_VALUES.includes(value);\n};\n\n/**\n * Validate value as accepted if it equals:\n * 1 | \"1\" | true | \"true\" | \"yes\" | \"y\" | \"on\"\n */\nexport const acceptedRule: SchemaRule = {\n name: \"accepted\",\n defaultErrorMessage: \"The :input must be accepted\",\n description:\n \"The value must be accepted if it equals: 1 | '1' | true | 'true' | 'yes' | 'y' | 'on' | 1 | true | 'Yes' | 'Y' | 'On'\",\n async validate(value: any, context) {\n if (isAcceptedValue(value)) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Accepted value if another field's value equals to a specific value\n */\nexport const acceptedIfRule: SchemaRule<{ field: string; value: any }> = {\n name: \"acceptedIf\",\n description: \"The field must be accepted if :field's value equals to :value\",\n defaultErrorMessage: \"The :input must be accepted\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n const { value: expectedValue } = this.context.options;\n\n this.context.translatableParams.field = this.context.options.field;\n this.context.translatableParams.value = this.context.options.value;\n if (fieldValue !== expectedValue) {\n return invalidRule(this, context);\n }\n\n if (!isAcceptedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Accepted if another field is not equal to the given value\n */\nexport const acceptedUnlessRule: SchemaRule<{ field: string; value: any }> = {\n name: \"acceptedUnless\",\n description: \"The field must be accepted if :field's value is not equal to :value\",\n defaultErrorMessage: \"The :input must be accepted\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n const { value: expectedValue } = this.context.options;\n\n this.context.translatableParams.field = this.context.options.field;\n this.context.translatableParams.value = this.context.options.value;\n\n if (fieldValue === expectedValue) {\n return invalidRule(this, context);\n }\n\n if (!isAcceptedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Accepted if another field is required\n */\nexport const acceptedIfRequiredRule: SchemaRule<{ field: string }> = {\n name: \"acceptedIfRequired\",\n description: \"The field must be accepted if :field is required\",\n defaultErrorMessage: \"The :input must be accepted\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n this.context.translatableParams.field = this.context.options.field;\n\n if (isEmptyValue(fieldValue)) {\n return invalidRule(this, context);\n }\n\n if (!isAcceptedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Accepted if another field is present\n */\nexport const acceptedIfPresentRule: SchemaRule<{ field: string }> = {\n name: \"acceptedIfPresent\",\n description: \"The field must be accepted if :field is present\",\n defaultErrorMessage: \"The :input must be accepted\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n this.context.translatableParams.field = this.context.options.field;\n\n if (fieldValue === undefined) {\n return invalidRule(this, context);\n }\n\n if (!isAcceptedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Accepted if another field is missing\n */\nexport const acceptedWithoutRule: SchemaRule<{ field: string }> = {\n name: \"acceptedWithout\",\n description: \"The field must be accepted if :field is missing\",\n defaultErrorMessage: \"The :input must be accepted\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n this.context.translatableParams.field = this.context.options.field;\n\n if (fieldValue !== undefined) {\n return invalidRule(this, context);\n }\n\n if (!isAcceptedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * The full set of values treated as \"declined\" by `declinedRule` and its\n * conditional variants. Shared with `formBooleanMutator` (see\n * `../../mutators/boolean-mutators`) so `v.boolean().declined()` recognizes\n * exactly this list — single source of truth, no duplicated literals.\n */\nexport const DECLINED_VALUES: readonly unknown[] = [\n \"0\",\n \"false\",\n \"no\",\n \"n\",\n \"off\",\n 0,\n false,\n \"No\",\n \"N\",\n \"Off\",\n];\n\nconst isDeclinedValue = (value: any) => {\n return DECLINED_VALUES.includes(value);\n};\n\n/**\n * Validate value as declined if it equals:\n * 0 | \"0\" | false | \"false\" | \"no\" | \"n\" | \"off\" | 0 | false | \"No\" | \"N\" | \"Off\"\n */\nexport const declinedRule: SchemaRule = {\n name: \"declined\",\n defaultErrorMessage: \"The :input must be declined\",\n description:\n \"The value must be declined if it equals: 0 | '0' | false | 'false' | 'no' | 'n' | 'off' | 0 | false | 'No' | 'N' | 'Off'\",\n async validate(value: any, context) {\n if (isDeclinedValue(value)) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Declined value if another field's value equals to a specific value\n */\nexport const declinedIfRule: SchemaRule<{ field: string; value: any }> = {\n name: \"declinedIf\",\n description: \"The field must be declined if :field's value equals to :value\",\n defaultErrorMessage: \"The :input must be declined\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n const { value: expectedValue } = this.context.options;\n\n this.context.translatableParams.field = this.context.options.field;\n this.context.translatableParams.value = this.context.options.value;\n\n if (fieldValue !== expectedValue) {\n return invalidRule(this, context);\n }\n\n if (!isDeclinedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Declined if another field is not equal to the given value\n */\nexport const declinedUnlessRule: SchemaRule<{ field: string; value: any }> = {\n name: \"declinedUnless\",\n description: \"The field must be declined if :field's value is not equal to :value\",\n defaultErrorMessage: \"The :input must be declined\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n const { value: expectedValue } = this.context.options;\n\n this.context.translatableParams.field = this.context.options.field;\n this.context.translatableParams.value = this.context.options.value;\n if (fieldValue === expectedValue) {\n return invalidRule(this, context);\n }\n\n if (!isDeclinedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Declined if another field is required\n */\nexport const declinedIfRequiredRule: SchemaRule<{ field: string }> = {\n name: \"declinedIfRequired\",\n description: \"The field must be declined if :field is required\",\n defaultErrorMessage: \"The :input must be declined\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n this.context.translatableParams.field = this.context.options.field;\n\n if (isEmptyValue(fieldValue)) {\n return invalidRule(this, context);\n }\n\n if (!isDeclinedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Declined if another field is present\n */\nexport const declinedIfPresentRule: SchemaRule<{ field: string }> = {\n name: \"declinedIfPresent\",\n description: \"The field must be declined if :field is present\",\n defaultErrorMessage: \"The :input must be declined\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n this.context.translatableParams.field = this.context.options.field;\n\n if (fieldValue === undefined) {\n return invalidRule(this, context);\n }\n\n if (!isDeclinedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Declined if another field is missing\n */\nexport const declinedWithoutRule: SchemaRule<{ field: string }> = {\n name: \"declinedWithout\",\n description: \"The field must be declined if :field is missing\",\n defaultErrorMessage: \"The :input must be declined\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n this.context.translatableParams.field = this.context.options.field;\n\n if (fieldValue !== undefined) {\n return invalidRule(this, context);\n }\n\n if (!isDeclinedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n","import { ACCEPTED_VALUES } from \"../rules/scalar/accepted-rule\";\nimport { DECLINED_VALUES } from \"../rules/scalar/declined-rule\";\nimport type { Mutator } from \"../types\";\n\n/**\n * Coerce a query-string-shaped boolean into a real boolean.\n *\n * Converts exactly: `\"true\"` / `\"1\"` / `1` → `true`, `\"false\"` / `\"0\"` / `0` → `false`.\n * Case-sensitive, no trimming. Any other value (`\"yes\"`, `\"on\"`, `\"TRUE\"`, `\"\"`,\n * `2`, `null`, etc.) passes through unchanged so the boolean type rule rejects it.\n */\nexport const booleanCoerceMutator: Mutator = async (value) => {\n if (value === \"true\" || value === \"1\" || value === 1) {\n return true;\n }\n\n if (value === \"false\" || value === \"0\" || value === 0) {\n return false;\n }\n\n return value;\n};\n\n/**\n * Parse form-shaped boolean values into a real boolean, ahead of the type\n * rule.\n *\n * Opted into by calling any `accepted*`/`declined*` method on\n * `v.boolean()` (see `BooleanValidator`'s `withFormBooleanMutator`). Converts\n * every value in `ACCEPTED_VALUES` (`1`, `\"1\"`, `true`, `\"true\"`, `\"yes\"`,\n * `\"y\"`, `\"on\"`, `\"Yes\"`, `\"Y\"`, `\"On\"`) to `true`, and every value in\n * `DECLINED_VALUES` (`0`, `\"0\"`, `false`, `\"false\"`, `\"no\"`, `\"n\"`, `\"off\"`,\n * `\"No\"`, `\"N\"`, `\"Off\"`) to `false`. Any other value passes through\n * unchanged so the boolean type rule still rejects it.\n *\n * Named (not anonymous) so callers can detect whether it has already been\n * added — see the idempotence check in `BooleanValidator`.\n */\nexport const formBooleanMutator: Mutator = async (value) => {\n if (ACCEPTED_VALUES.includes(value)) {\n return true;\n }\n\n if (DECLINED_VALUES.includes(value)) {\n return false;\n }\n\n return value;\n};\n","import dayjs from \"dayjs\";\nimport type { Mutator } from \"../types\";\n\n/**\n * Convert value to Date object\n * Returns Invalid Date if value cannot be converted\n */\nexport const dateMutator: Mutator = async (value) => {\n // Handle null/undefined\n if (!value) {\n return;\n }\n\n // Already a Date object\n if (value instanceof Date) {\n return value;\n }\n\n // Try to convert to Date\n const date = new Date(value);\n\n // Return the date (valid or Invalid Date)\n // dateRule will validate and fail if invalid\n return date;\n};\n\n/** Convert date to ISO string format */\nexport const toISOStringMutator: Mutator = async (value) => {\n const date = new Date(value);\n return date.toISOString();\n};\n\n/** Convert date to Unix timestamp (milliseconds) */\nexport const toTimestampMutator: Mutator = async (value) => {\n const date = new Date(value);\n return date.getTime();\n};\n\n/** Convert date to start of day (00:00:00) */\nexport const toStartOfDayMutator: Mutator = async (value) => {\n const date = new Date(value);\n date.setHours(0, 0, 0, 0);\n return date;\n};\n\n/** Convert date to end of day (23:59:59.999) */\nexport const toEndOfDayMutator: Mutator = async (value) => {\n const date = new Date(value);\n date.setHours(23, 59, 59, 999);\n return date;\n};\n\n/** Add or subtract days from date */\nexport const addDaysMutator: Mutator = async (value, context) => {\n const date = new Date(value);\n const days = context?.options.days ?? 0;\n date.setDate(date.getDate() + days);\n return date;\n};\n\n/** Add or subtract months from date */\nexport const addMonthsMutator: Mutator = async (value, context) => {\n const date = new Date(value);\n const months = context?.options.months ?? 0;\n date.setMonth(date.getMonth() + months);\n return date;\n};\n\n/** Add or subtract years from date */\nexport const addYearsMutator: Mutator = async (value, context) => {\n const date = new Date(value);\n const years = context?.options.years ?? 0;\n date.setFullYear(date.getFullYear() + years);\n return date;\n};\n\n/** Add or subtract hours from date */\nexport const addHoursMutator: Mutator = async (value, context) => {\n const date = new Date(value);\n const hours = context?.options.hours ?? 0;\n date.setHours(date.getHours() + hours);\n return date;\n};\n\n/** Convert date to UTC */\nexport const toUTCMutator: Mutator = async (value) => {\n const date = new Date(value);\n return new Date(date.toUTCString());\n};\n\n/** Convert date to specific format using dayjs */\nexport const toFormatMutator: Mutator = async (value, context) => {\n const format = context?.options.format ?? \"YYYY-MM-DD\";\n return dayjs(value).format(format);\n};\n\n/** Convert to date only (remove time) */\nexport const toDateOnlyMutator: Mutator = async (value) => {\n const date = new Date(value);\n return date.toISOString().split(\"T\")[0];\n};\n\n/** Convert to time only (HH:MM:SS) */\nexport const toTimeOnlyMutator: Mutator = async (value) => {\n const date = new Date(value);\n return date.toTimeString().split(\" \")[0];\n};\n\n/** Set to start of month */\nexport const toStartOfMonthMutator: Mutator = async (value) => {\n const date = new Date(value);\n date.setDate(1);\n date.setHours(0, 0, 0, 0);\n return date;\n};\n\n/** Set to end of month */\nexport const toEndOfMonthMutator: Mutator = async (value) => {\n const date = new Date(value);\n date.setMonth(date.getMonth() + 1);\n date.setDate(0);\n date.setHours(23, 59, 59, 999);\n return date;\n};\n\n/** Set to start of year */\nexport const toStartOfYearMutator: Mutator = async (value) => {\n const date = new Date(value);\n date.setMonth(0);\n date.setDate(1);\n date.setHours(0, 0, 0, 0);\n return date;\n};\n\n/** Set to end of year */\nexport const toEndOfYearMutator: Mutator = async (value) => {\n const date = new Date(value);\n date.setMonth(11);\n date.setDate(31);\n date.setHours(23, 59, 59, 999);\n return date;\n};\n","import { round } from \"@mongez/reinforcements\";\nimport { isNumeric } from \"@mongez/supportive-is\";\nimport type { Mutator } from \"../types\";\n\n/** Convert value to number */\nexport const numberMutator: Mutator = async (value) => {\n if (!value) return value;\n return Number(value);\n};\n\n/** Round number to specified decimals */\nexport const roundNumberMutator: Mutator = async (value, context) => {\n return round(value, context?.options?.decimals ?? 2);\n};\n\n/** Convert to boolean */\nexport const booleanMutator: Mutator = async (value) => {\n if (value === \"true\") return true;\n if (value === \"false\") return false;\n return Boolean(value);\n};\n\nexport const numericMutator: Mutator = async (value) => {\n if (!isNumeric(value)) return value;\n return Number(value);\n};\n\n/** Absolute value mutator */\nexport const absMutator: Mutator = async (value) => {\n return Math.abs(Number(value));\n};\n\n/** Ceil mutator */\nexport const ceilMutator: Mutator = async (value) => {\n return Math.ceil(Number(value));\n};\n\n/** Floor mutator */\nexport const floorMutator: Mutator = async (value) => {\n return Math.floor(Number(value));\n};\n\n/**\n * Round mutator\n * Supports decimal precision via options.decimals\n */\nexport const roundMutator: Mutator = async (value, context) => {\n const decimals = context?.options?.decimals ?? 0;\n // If decimals is 0, use standard Math.round for integers\n if (decimals === 0) {\n return Math.round(Number(value));\n }\n // Otherwise use reinforcements round helper for precision\n return round(Number(value), decimals);\n};\n\n/**\n * To fixed mutator — rounds to a fixed number of decimal places, as a number.\n *\n * `Number.prototype.toFixed` returns a *string*, which the number validator's\n * own type rule then rejected: `v.number().toFixed(2)` could never produce a\n * valid result. Coercing back to a number keeps the method usable where it\n * lives. For the fixed-point string form, format at the edge instead of asking\n * a number schema to output a string.\n */\nexport const toFixedMutator: Mutator = async (value, context) => {\n const decimals = context?.options?.decimals ?? 2;\n return Number(Number(value).toFixed(decimals));\n};\n","import type { Mutator } from \"../types\";\n\nexport const stringMutator: Mutator = async (value) => {\n if ([undefined, null].includes(value)) {\n return value;\n }\n\n return String(value);\n};\n","import { setKeyPath } from \"../helpers\";\nimport { flipArrayMutator, sortArrayMutator, uniqueArrayMutator } from \"../mutators\";\nimport {\n arrayRule,\n betweenLengthRule,\n lengthRule,\n maxLengthRule,\n minLengthRule,\n sortedArrayRule,\n uniqueArrayRule,\n} from \"../rules\";\nimport type { SchemaContext, ValidationResult } from \"../types\";\nimport { BaseValidator } from \"./base-validator\";\nimport { applyNullable, getRuleOptions } from \"../standard-schema/json-schema\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\n\n/**\n * Array validator class\n */\nexport class ArrayValidator extends BaseValidator {\n public constructor(\n public validator: BaseValidator,\n errorMessage?: string,\n ) {\n super();\n this.blankIsMissing = true;\n this.addMutableRule(arrayRule, errorMessage);\n }\n\n /**\n * Check if value is an array type\n */\n public matchesType(value: any): boolean {\n return Array.isArray(value);\n }\n\n /**\n * Clone the validator\n */\n public override clone(): this {\n const cloned = super.clone();\n\n cloned.validator = this.validator.clone();\n\n return cloned;\n }\n\n /** Reverse array order */\n public flip() {\n return this.addMutator(flipArrayMutator);\n }\n\n /** Reverse array order (alias) */\n public reverse() {\n return this.addMutator(flipArrayMutator);\n }\n\n /** Make it has only unique values */\n public onlyUnique() {\n return this.addMutator(uniqueArrayMutator);\n }\n\n /** Sort array */\n public sort(direction: \"asc\" | \"desc\" = \"asc\", key?: string) {\n return this.addMutator(sortArrayMutator, { direction, key });\n }\n\n /** Array length must be greater than the given length */\n public min(min: number, errorMessage?: string) {\n return this.addRule(minLengthRule, errorMessage, { minLength: min });\n }\n\n /** @alias min */\n public minLength(length: number, errorMessage?: string) {\n return this.min(length, errorMessage);\n }\n\n /** Array length must be less than the given length */\n public max(max: number, errorMessage?: string) {\n return this.addRule(maxLengthRule, errorMessage, { maxLength: max });\n }\n\n /** @alias max */\n public maxLength(length: number, errorMessage?: string) {\n return this.max(length, errorMessage);\n }\n\n /** Array length must be of the given length */\n public length(length: number, errorMessage?: string) {\n return this.addRule(lengthRule, errorMessage, { length });\n }\n\n /**\n * Array length must be between min and max (inclusive)\n *\n * @param min - Minimum length (inclusive)\n * @param max - Maximum length (inclusive)\n *\n * @example\n * ```ts\n * v.array(v.string()).between(1, 10) // Array must have 1 to 10 items\n * v.array(v.number()).lengthBetween(5, 20) // Same using alias\n * ```\n *\n * @category Validation Rule\n */\n public between(min: number, max: number, errorMessage?: string) {\n return this.addRule(betweenLengthRule, errorMessage, {\n minLength: min,\n maxLength: max,\n });\n }\n\n /**\n * Alias for between() - array length between min and max\n */\n public lengthBetween(min: number, max: number, errorMessage?: string) {\n return this.between(min, max, errorMessage);\n }\n\n /** Array must have unique values */\n public unique(errorMessage?: string) {\n return this.addRule(uniqueArrayRule, errorMessage);\n }\n\n /** Array must be sorted */\n public sorted(direction: \"asc\" | \"desc\" = \"asc\", errorMessage?: string) {\n return this.addRule(sortedArrayRule, errorMessage, { direction });\n }\n\n /** Mutate the data */\n public mutate(data: any, context: SchemaContext) {\n if (!Array.isArray(data)) return data;\n return super.mutate([...data], context);\n }\n\n /** Validate array\n *\n * Absent input (and absent without `.default()`) propagates as `data: undefined`\n * so the parent ObjectValidator can omit the key. Without this, optional array\n * fields would silently materialise as `[]` in the validated output.\n */\n public async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\n // Apply default when absent, then mutate. Mirrors BaseValidator's\n // `valueForRules = data ?? this.getDefaultValue()` so `.default([...])`\n // works on arrays too.\n const valueForRules = data ?? this.getDefaultValue();\n const mutatedData = await this.mutate(valueForRules, context);\n\n const result = await super.validate(data, context);\n\n if (result.isValid === false) return result;\n\n // Nothing to iterate for absent (no default) or null (nullable) inputs —\n // propagate so the parent ObjectValidator can omit the key.\n if (mutatedData === undefined || mutatedData === null) return result;\n\n // Defensive: type rule (arrayRule) should have failed for non-arrays.\n if (!Array.isArray(mutatedData)) return result;\n\n const errors: ValidationResult[\"errors\"] = [];\n\n // Validate all items in parallel (consistent with ObjectValidator)\n const validationPromises = mutatedData.map(async (value: any, index: number) => {\n const childContext: SchemaContext = {\n ...context,\n parent: mutatedData,\n value,\n key: index.toString(),\n path: setKeyPath(context.path, index.toString()),\n };\n\n const childResult = await this.validator.validate(value, childContext);\n\n // Update mutated data with validated result\n mutatedData[index] = childResult.data;\n\n // Collect errors from this element\n if (childResult.isValid === false) {\n errors.push(...childResult.errors);\n }\n });\n\n await Promise.all(validationPromises);\n\n return {\n isValid: errors.length === 0,\n errors,\n data: await this.startTransformationPipeline(mutatedData, context),\n };\n }\n\n /**\n * @inheritdoc\n *\n * Recursively generates JSON Schema for the array items.\n *\n * @example\n * ```ts\n * v.array(v.string().min(1)).minLength(1).toJsonSchema(\"draft-2020-12\")\n * // → { type: \"array\", items: { type: \"string\", minLength: 1 }, minItems: 1 }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const schema: JsonSchemaResult = {\n type: \"array\",\n items: this.validator.toJsonSchema(target),\n };\n\n const minOpts = getRuleOptions(this.rules, \"minLength\");\n if (minOpts?.minLength !== undefined) schema.minItems = minOpts.minLength;\n\n const maxOpts = getRuleOptions(this.rules, \"maxLength\");\n if (maxOpts?.maxLength !== undefined) schema.maxItems = maxOpts.maxLength;\n\n const betweenOpts = getRuleOptions(this.rules, \"betweenLength\");\n if (betweenOpts) {\n if (betweenOpts.minLength !== undefined) schema.minItems = betweenOpts.minLength;\n if (betweenOpts.maxLength !== undefined) schema.maxItems = betweenOpts.maxLength;\n }\n\n const lengthOpts = getRuleOptions(this.rules, \"length\");\n if (lengthOpts?.length !== undefined) {\n schema.minItems = lengthOpts.length;\n schema.maxItems = lengthOpts.length;\n }\n\n if (this.isNullable) applyNullable(schema, target);\n\n return schema;\n }\n}\n","import { booleanCoerceMutator, formBooleanMutator } from \"../mutators/boolean-mutators\";\nimport {\n acceptedIfPresentRule,\n acceptedIfRequiredRule,\n acceptedIfRule,\n acceptedRule,\n acceptedUnlessRule,\n acceptedWithoutRule,\n declinedIfPresentRule,\n declinedIfRequiredRule,\n declinedIfRule,\n declinedRule,\n declinedUnlessRule,\n declinedWithoutRule,\n} from \"../rules/scalar\";\nimport { booleanRule } from \"../rules\";\nimport { PrimitiveValidator } from \"./primitive-validator\";\nimport { applyNullable } from \"../standard-schema/json-schema\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport type { SchemaRule, SchemaRuleOptions } from \"../types\";\n\n/**\n * Boolean validator class\n *\n * Extends PrimitiveValidator — inherits enum/in/oneOf/allowsOnly/forbids/notIn.\n * Defines accepted/declined directly as real methods (not ScalarValidator field copies)\n * so they survive cloning correctly.\n */\nexport class BooleanValidator extends PrimitiveValidator {\n public constructor(errorMessage?: string) {\n super();\n this.blankIsMissing = true;\n this.addMutableRule(booleanRule, errorMessage);\n }\n\n /**\n * Check if value is a boolean type\n */\n public matchesType(value: any): boolean {\n return typeof value === \"boolean\";\n }\n\n /**\n * Add a rule from the accepted/declined family, opting the validator into\n * form-boolean parsing.\n *\n * Calling ANY `accepted*`/`declined*` method on `v.boolean()` adds (once,\n * idempotently — checked by mutator identity so chaining several of these\n * methods never stacks duplicates) `formBooleanMutator`, which runs before\n * the type rule and converts the accepted set (`1`, `\"1\"`, `true`,\n * `\"true\"`, `\"yes\"`, `\"y\"`, `\"on\"`, `\"Yes\"`, `\"Y\"`, `\"On\"`) to `true` and\n * the declined set (`0`, `\"0\"`, `false`, `\"false\"`, `\"no\"`, `\"n\"`, `\"off\"`,\n * `\"No\"`, `\"N\"`, `\"Off\"`) to `false`; any other value passes through\n * unchanged and is rejected by the strict type rule as before.\n *\n * The mutator and the rule are added to the SAME resolved instance in one\n * pass — resolving `this.instance` twice (once per `addRule`/`addMutator`\n * call) would clone twice on an immutable validator and silently drop one\n * of the two additions.\n */\n private addFormBooleanRule<T extends SchemaRuleOptions = SchemaRuleOptions>(\n rule: SchemaRule<T>,\n errorMessage?: string,\n options: T = {} as T,\n ): this {\n const instance = this.instance;\n\n if (!instance.mutators.some((mutator) => mutator.mutate === formBooleanMutator)) {\n instance.addMutableMutator(formBooleanMutator);\n }\n\n instance.addMutableRule(rule, errorMessage, options);\n\n return instance;\n }\n\n // ==================== Accepted ====================\n\n /** Value must be accepted (true, \"yes\", 1, \"on\", etc. — form strings are parsed into a real boolean first) */\n public accepted(errorMessage?: string) {\n return this.addFormBooleanRule(acceptedRule, errorMessage);\n }\n\n /** Value must be accepted if another field equals a value */\n public acceptedIf(field: string, value: any, errorMessage?: string) {\n return this.addFormBooleanRule(acceptedIfRule, errorMessage, { field, value });\n }\n\n /** Value must be accepted unless another field equals a value */\n public acceptedUnless(field: string, value: any, errorMessage?: string) {\n return this.addFormBooleanRule(acceptedUnlessRule, errorMessage, { field, value });\n }\n\n /** Value must be accepted if another field is required */\n public acceptedIfRequired(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(acceptedIfRequiredRule, errorMessage, { field });\n }\n\n /** Value must be accepted if another field is present */\n public acceptedIfPresent(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(acceptedIfPresentRule, errorMessage, { field });\n }\n\n /** Value must be accepted if another field is missing */\n public acceptedWithout(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(acceptedWithoutRule, errorMessage, { field });\n }\n\n // ==================== Declined ====================\n\n /** Value must be declined (false, \"no\", 0, \"off\", etc. — form strings are parsed into a real boolean first) */\n public declined(errorMessage?: string) {\n return this.addFormBooleanRule(declinedRule, errorMessage);\n }\n\n /** Value must be declined if another field equals a value */\n public declinedIf(field: string, value: any, errorMessage?: string) {\n return this.addFormBooleanRule(declinedIfRule, errorMessage, { field, value });\n }\n\n /** Value must be declined unless another field equals a value */\n public declinedUnless(field: string, value: any, errorMessage?: string) {\n return this.addFormBooleanRule(declinedUnlessRule, errorMessage, { field, value });\n }\n\n /** Value must be declined if another field is required */\n public declinedIfRequired(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(declinedIfRequiredRule, errorMessage, { field });\n }\n\n /** Value must be declined if another field is present */\n public declinedIfPresent(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(declinedIfPresentRule, errorMessage, { field });\n }\n\n /** Value must be declined if another field is missing */\n public declinedWithout(field: string, errorMessage?: string) {\n return this.addFormBooleanRule(declinedWithoutRule, errorMessage, { field });\n }\n\n // ==================== Coercion ====================\n\n /**\n * Opt in to coercion: an exact query-string-shaped boolean is converted to a\n * real boolean **before** the type rules run; any other value passes through\n * unchanged so bad input still fails the type rule.\n *\n * Converts exactly `\"true\"` / `\"1\"` / `1` → `true` and `\"false\"` / `\"0\"` / `0`\n * → `false`. Case-sensitive, no trimming — `\"TRUE\"`, `\"yes\"`, `\"on\"`, `\"\"`, and\n * `2` all pass through unchanged and fail the type rule. `v.boolean()` does\n * **not** coerce by default; this only takes effect when explicitly chained.\n * For form-style truthy strings like `\"yes\"` / `\"on\"`, use `.accepted()` /\n * `.declined()` instead — those methods opt into their own form-boolean\n * parsing (a wider value set, case-insensitive on a few forms) and then\n * apply the accepted/declined pass-fail rule on top of the parsed boolean.\n *\n * The output type is unchanged (`Infer<>` keys off the validator class), so\n * `v.boolean().coerce()` still infers `boolean`.\n *\n * @example\n * v.boolean().coerce() // \"true\" → true; \"1\" → true; \"0\" → false; \"yes\" → invalid\n */\n public coerce() {\n return this.addMutator(booleanCoerceMutator) as this & { isCoerced: true };\n }\n\n // ==================== Strict boolean checks ====================\n\n /**\n * Value must be strictly true (not \"yes\", \"on\", 1, etc.)\n * @alias accepted - strict version\n */\n public mustBeTrue(errorMessage?: string) {\n return this.equal(true, errorMessage);\n }\n\n /**\n * Value must be strictly false (not \"no\", \"off\", 0, etc.)\n * @alias declined - strict version\n */\n public mustBeFalse(errorMessage?: string) {\n return this.equal(false, errorMessage);\n }\n\n /**\n * @inheritdoc\n *\n * @note accepted/declined rules and all cross-field boolean rules\n * are not representable in JSON Schema and are silently omitted.\n *\n * @example\n * ```ts\n * v.boolean().toJsonSchema(\"draft-2020-12\")\n * // → { type: \"boolean\" }\n *\n * v.boolean().nullable().toJsonSchema(\"openapi-3.0\")\n * // → { type: \"boolean\", nullable: true }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const schema: JsonSchemaResult = { type: \"boolean\" };\n if (this.isNullable) applyNullable(schema, target);\n return schema;\n }\n}\n","import dayjs from \"dayjs\";\nimport {\n addDaysMutator,\n addHoursMutator,\n addMonthsMutator,\n addYearsMutator,\n dateMutator,\n toEndOfDayMutator,\n toEndOfMonthMutator,\n toEndOfYearMutator,\n toStartOfDayMutator,\n toStartOfMonthMutator,\n toStartOfYearMutator,\n toUTCMutator,\n} from \"../mutators\";\nimport {\n afterFieldRule,\n afterTodayRule,\n ageRule,\n beforeFieldRule,\n beforeHourRule,\n beforeMinuteRule,\n beforeTodayRule,\n betweenAgeRule,\n betweenDatesRule,\n betweenDaysRule,\n betweenHoursRule,\n betweenMinutesRule,\n betweenMonthsRule,\n betweenTimesRule,\n betweenYearsRule,\n birthdayRule,\n businessDayRule,\n dateRule,\n fromHourRule,\n fromMinuteRule,\n fromTodayRule,\n futureRule,\n leapYearRule,\n maxAgeRule,\n maxDateRule,\n maxDayRule,\n maxMonthRule,\n maxYearRule,\n minAgeRule,\n minDateRule,\n minDayRule,\n minMonthRule,\n minYearRule,\n type Month,\n monthRule,\n pastRule,\n quarterRule,\n sameAsFieldDateRule,\n todayRule,\n weekDayRule,\n weekdaysRule,\n weekendRule,\n withinDaysRule,\n withinFutureDaysRule,\n withinPastDaysRule,\n yearRule,\n} from \"../rules\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport { applyNullable, getRuleOptions } from \"../standard-schema/json-schema\";\nimport type { WeekDay } from \"../types/date-types\";\nimport { isDateValue } from \"./../helpers/date-helpers\";\nimport { BaseValidator } from \"./base-validator\";\n\n/**\n * Date validator class\n */\nexport class DateValidator extends BaseValidator {\n public constructor(errorMessage?: string) {\n super();\n this.blankIsMissing = true;\n this.addMutableMutator(dateMutator); // Normalize to Date object first\n this.addMutableRule(dateRule, errorMessage);\n }\n\n /**\n * Check if value is a Date type\n */\n public matchesType(value: any): boolean {\n return isDateValue(value);\n }\n\n // ==================== Output Transformers ====================\n // These transform the Date after validation into different formats\n\n /**\n * Convert date to ISO string format\n * @category transformer\n */\n public toISOString() {\n return this.addTransformer((data) => (data instanceof Date ? data.toISOString() : data));\n }\n\n /** Convert date to Unix timestamp (milliseconds) */\n public toTimestamp() {\n return this.addTransformer((data) => (data instanceof Date ? data.getTime() : data));\n }\n\n // ==================== String Format Transformers ====================\n // These convert Date to formatted strings after validation\n\n /** Convert date to specific format using dayjs */\n public toFormat(format: string) {\n return this.addTransformer(\n (data, { options }) => (data instanceof Date ? dayjs(data).format(options.format) : data),\n { format },\n );\n }\n\n /** Convert to date only (remove time, returns YYYY-MM-DD) */\n public toDateOnly() {\n return this.addTransformer(\n (data) => (data instanceof Date ? dayjs(data).format(\"YYYY-MM-DD\") : data),\n { __jsonSchemaFormat: \"date\" },\n );\n }\n\n /** Convert to time only (returns HH:MM:SS) */\n public toTimeOnly() {\n return this.addTransformer(\n (data) => (data instanceof Date ? dayjs(data).format(\"HH:mm:ss\") : data),\n { __jsonSchemaFormat: \"time\" },\n );\n }\n\n // ==================== Date Mutators ====================\n // These modify the Date object before validation\n\n /**\n * Convert date to start of day (00:00:00)\n * @category mutator\n */\n public toStartOfDay() {\n return this.addMutator(toStartOfDayMutator);\n }\n\n /** Convert date to end of day (23:59:59.999) */\n public toEndOfDay() {\n return this.addMutator(toEndOfDayMutator);\n }\n\n /** Add or subtract days from date */\n public addDays(days: number) {\n return this.addMutator(addDaysMutator, { days });\n }\n\n /** Add or subtract months from date */\n public addMonths(months: number) {\n return this.addMutator(addMonthsMutator, { months });\n }\n\n /** Add or subtract years from date */\n public addYears(years: number) {\n return this.addMutator(addYearsMutator, { years });\n }\n\n /** Add or subtract hours from date */\n public addHours(hours: number) {\n return this.addMutator(addHoursMutator, { hours });\n }\n\n /** Convert date to UTC */\n public toUTC() {\n return this.addMutator(toUTCMutator);\n }\n\n // ==================== Date Range Mutators ====================\n\n /** Set to start of month */\n public toStartOfMonth() {\n return this.addMutator(toStartOfMonthMutator);\n }\n\n /** Set to end of month */\n public toEndOfMonth() {\n return this.addMutator(toEndOfMonthMutator);\n }\n\n /** Set to start of year */\n public toStartOfYear() {\n return this.addMutator(toStartOfYearMutator);\n }\n\n /** Set to end of year */\n public toEndOfYear() {\n return this.addMutator(toEndOfYearMutator);\n }\n\n // ==================== Date Comparison ====================\n\n /**\n * Date must be greater than or equal to the given date or field (inclusive)\n *\n * Smart detection:\n * - Date instance, timestamp, or date string (with - or /) → value comparison\n * - Plain string → field comparison\n *\n * @param dateOrField - Date, timestamp, date string, or field name\n *\n * @example\n * ```ts\n * // Value comparison\n * v.date().min('2024-01-01')\n * v.date().min(new Date())\n * v.date().min(1698278400000)\n *\n * // Field comparison\n * v.date().min('startsAt')\n * ```\n *\n * @category Validation Rule\n */\n public min(dateOrField: Date | string | number, errorMessage?: string): this {\n return this.addRule(minDateRule, errorMessage, {\n dateOrField,\n scope: \"global\",\n });\n }\n\n /**\n * Date must be less than or equal to the given date or field (inclusive)\n *\n * Smart detection:\n * - Date instance, timestamp, or date string (with - or /) → value comparison\n * - Plain string → field comparison\n *\n * @category Validation Rule\n */\n public max(dateOrField: Date | string | number, errorMessage?: string): this {\n return this.addRule(maxDateRule, errorMessage, {\n dateOrField,\n scope: \"global\",\n });\n }\n\n /**\n * Date must be strictly less than the given date or field (exclusive)\n *\n * Smart detection:\n * - Date instance, timestamp, or date string (with - or /) → value comparison\n * - Plain string → field comparison\n *\n * @category Validation Rule\n */\n public before(dateOrField: Date | string | number, errorMessage?: string): this {\n return this.addRule(beforeFieldRule, errorMessage, {\n dateOrField,\n scope: \"global\",\n });\n }\n\n /**\n * Date must be strictly greater than the given date or field (exclusive)\n *\n * Smart detection:\n * - Date instance, timestamp, or date string (with - or /) → value comparison\n * - Plain string → field comparison\n *\n * @category Validation Rule\n */\n public after(dateOrField: Date | string | number, errorMessage?: string): this {\n return this.addRule(afterFieldRule, errorMessage, {\n dateOrField,\n scope: \"global\",\n });\n }\n\n /** Date must be between start and end dates */\n public between(startDate: Date, endDate: Date, errorMessage?: string) {\n return this.addRule(betweenDatesRule, errorMessage, { startDate, endDate });\n }\n\n /** Date must be exactly today */\n public today(errorMessage?: string) {\n return this.addRule(todayRule, errorMessage);\n }\n\n /** Date must be today or in the future */\n public fromToday(errorMessage?: string) {\n return this.addRule(fromTodayRule, errorMessage);\n }\n\n /** Date must be before today */\n public beforeToday(errorMessage?: string) {\n return this.addRule(beforeTodayRule, errorMessage);\n }\n\n /** Date must be after today (not including today) */\n public afterToday(errorMessage?: string) {\n return this.addRule(afterTodayRule, errorMessage);\n }\n\n /** Date must be in the past */\n public past(errorMessage?: string) {\n return this.addRule(pastRule, errorMessage);\n }\n\n /** Date must be in the future */\n public future(errorMessage?: string) {\n return this.addRule(futureRule, errorMessage);\n }\n\n // ==================== Sibling Field Comparison ====================\n // Explicit sibling scope methods\n\n /**\n * Date must be >= sibling field value (inclusive)\n * @category Validation Rule\n */\n public minSibling(field: string, errorMessage?: string): this {\n return this.addRule(minDateRule, errorMessage, {\n dateOrField: field,\n scope: \"sibling\",\n });\n }\n\n /**\n * Date must be <= sibling field value (inclusive)\n * @category Validation Rule\n */\n public maxSibling(field: string, errorMessage?: string): this {\n return this.addRule(maxDateRule, errorMessage, {\n dateOrField: field,\n scope: \"sibling\",\n });\n }\n\n /**\n * Date must be < sibling field value (exclusive)\n * @category Validation Rule\n */\n public beforeSibling(field: string, errorMessage?: string): this {\n return this.addRule(beforeFieldRule, errorMessage, {\n dateOrField: field,\n scope: \"sibling\",\n });\n }\n\n /**\n * Date must be > sibling field value (exclusive)\n * @category Validation Rule\n */\n public afterSibling(field: string, errorMessage?: string): this {\n return this.addRule(afterFieldRule, errorMessage, {\n dateOrField: field,\n scope: \"sibling\",\n });\n }\n\n /** Date must be the same as another field's date */\n public sameAsField(field: string, errorMessage?: string) {\n return this.addRule(sameAsFieldDateRule, errorMessage, {\n field,\n scope: \"global\",\n });\n }\n\n /** Date must be the same as another sibling field's date */\n public sameAsFieldSibling(field: string, errorMessage?: string) {\n return this.addRule(sameAsFieldDateRule, errorMessage, {\n field,\n scope: \"sibling\",\n });\n }\n\n // ==================== Time Validation ====================\n\n /** Time must be from specific hour onwards (0-23) */\n public fromHour(hour: number, errorMessage?: string) {\n return this.addRule(fromHourRule, errorMessage, { hour });\n }\n\n /** Time must be before specific hour (0-23) */\n public beforeHour(hour: number, errorMessage?: string) {\n return this.addRule(beforeHourRule, errorMessage, { hour });\n }\n\n /** Time must be between start and end hours (0-23) */\n public betweenHours(startHour: number, endHour: number, errorMessage?: string) {\n return this.addRule(betweenHoursRule, errorMessage, { startHour, endHour });\n }\n\n /** Time must be from specific minute onwards (0-59) */\n public fromMinute(minute: number, errorMessage?: string) {\n return this.addRule(fromMinuteRule, errorMessage, { minute });\n }\n\n /** Time must be before specific minute (0-59) */\n public beforeMinute(minute: number, errorMessage?: string) {\n return this.addRule(beforeMinuteRule, errorMessage, { minute });\n }\n\n /** Time must be between start and end minutes (0-59) */\n public betweenMinutes(startMinute: number, endMinute: number, errorMessage?: string) {\n return this.addRule(betweenMinutesRule, errorMessage, {\n startMinute,\n endMinute,\n });\n }\n\n /** Time must be between start and end times (HH:MM format) */\n public betweenTimes(startTime: string, endTime: string, errorMessage?: string) {\n return this.addRule(betweenTimesRule, errorMessage, { startTime, endTime });\n }\n\n // ==================== Age Validation ====================\n\n /** Age must be exactly the given years */\n public age(years: number, errorMessage?: string) {\n return this.addRule(ageRule, errorMessage, { years });\n }\n\n /** Minimum age requirement */\n public minAge(years: number, errorMessage?: string) {\n return this.addRule(minAgeRule, errorMessage, { years });\n }\n\n /** Maximum age requirement */\n public maxAge(years: number, errorMessage?: string) {\n return this.addRule(maxAgeRule, errorMessage, { years });\n }\n\n /** Age must be between min and max years */\n public betweenAge(minAge: number, maxAge: number, errorMessage?: string) {\n return this.addRule(betweenAgeRule, errorMessage, { minAge, maxAge });\n }\n\n // ==================== Day Validation ====================\n\n /** Date must be specific weekday */\n public weekDay(day: WeekDay, errorMessage?: string) {\n return this.addRule(weekDayRule, errorMessage, { day });\n }\n\n /** Date must be one of specified weekdays */\n public weekdays(days: WeekDay[], errorMessage?: string) {\n return this.addRule(weekdaysRule, errorMessage, { days });\n }\n\n /** Date must be a weekend (Saturday or Sunday) */\n public weekend(errorMessage?: string) {\n return this.addRule(weekendRule, errorMessage);\n }\n\n /** Date must be a business day (Monday-Friday) */\n public businessDay(errorMessage?: string) {\n return this.addRule(businessDayRule, errorMessage);\n }\n\n /** Date must match specific format */\n public format(format: string, errorMessage?: string) {\n return this.addRule(dateRule, errorMessage, { format });\n }\n\n // ==================== Relative Date Validation ====================\n\n /** Date must be within X days from now (past or future) */\n public withinDays(days: number, errorMessage?: string) {\n return this.addRule(withinDaysRule, errorMessage, { days });\n }\n\n /** Date must be within X days in the past */\n public withinPastDays(days: number, errorMessage?: string) {\n return this.addRule(withinPastDaysRule, errorMessage, { days });\n }\n\n /** Date must be within X days in the future */\n public withinFutureDays(days: number, errorMessage?: string) {\n return this.addRule(withinFutureDaysRule, errorMessage, { days });\n }\n\n // ==================== Period Validation ====================\n\n /** Date must be in specific month (1-12) */\n public month(month: Month, errorMessage?: string) {\n return this.addRule(monthRule, errorMessage, { month });\n }\n\n /** Date must be in specific year */\n public year(year: number, errorMessage?: string) {\n return this.addRule(yearRule, errorMessage, { year });\n }\n\n /**\n * Date must be between start and end years\n * Smart detection: number or field name\n *\n * @category Validation Rule\n */\n public betweenYears(startYear: number | string, endYear: number | string, errorMessage?: string) {\n return this.addRule(betweenYearsRule, errorMessage, {\n startYear,\n endYear,\n scope: \"global\",\n });\n }\n\n /**\n * Date must be between start and end months (1-12)\n * Smart detection: number or field name\n *\n * @category Validation Rule\n */\n public betweenMonths(\n startMonth: Month | string,\n endMonth: Month | string,\n errorMessage?: string,\n ) {\n return this.addRule(betweenMonthsRule, errorMessage, {\n startMonth,\n endMonth,\n scope: \"global\",\n });\n }\n\n /**\n * Date must be between start and end days (1-31)\n * Smart detection: number or field name\n *\n * @category Validation Rule\n */\n public betweenDays(startDay: number | string, endDay: number | string, errorMessage?: string) {\n return this.addRule(betweenDaysRule, errorMessage, {\n startDay,\n endDay,\n scope: \"global\",\n });\n }\n\n /**\n * Date must be between sibling field years\n * @category Validation Rule\n */\n public betweenYearsSibling(startYearField: string, endYearField: string, errorMessage?: string) {\n return this.addRule(betweenYearsRule, errorMessage, {\n startYear: startYearField,\n endYear: endYearField,\n scope: \"sibling\",\n });\n }\n\n /**\n * Date must be between sibling field months\n * @category Validation Rule\n */\n public betweenMonthsSibling(\n startMonthField: string,\n endMonthField: string,\n errorMessage?: string,\n ) {\n return this.addRule(betweenMonthsRule, errorMessage, {\n startMonth: startMonthField,\n endMonth: endMonthField,\n scope: \"sibling\",\n });\n }\n\n /**\n * Date must be between sibling field days\n * @category Validation Rule\n */\n public betweenDaysSibling(startDayField: string, endDayField: string, errorMessage?: string) {\n return this.addRule(betweenDaysRule, errorMessage, {\n startDay: startDayField,\n endDay: endDayField,\n scope: \"sibling\",\n });\n }\n\n /**\n * Year must be >= given year or field\n * Smart detection: number or field name\n *\n * @example\n * ```ts\n * // Value comparison\n * v.date().minYear(2024)\n *\n * // Field comparison\n * v.date().minYear('startYear')\n * ```\n *\n * @category Validation Rule\n */\n public minYear(yearOrField: number | string, errorMessage?: string): this {\n return this.addRule(minYearRule, errorMessage, {\n yearOrField,\n scope: \"global\",\n });\n }\n\n /**\n * Year must be <= given year or field\n * Smart detection: number or field name\n *\n * @category Validation Rule\n */\n public maxYear(yearOrField: number | string, errorMessage?: string): this {\n return this.addRule(maxYearRule, errorMessage, {\n yearOrField,\n scope: \"global\",\n });\n }\n\n /**\n * Month must be >= given month or field (1-12)\n * Smart detection: number or field name\n *\n * @category Validation Rule\n */\n public minMonth(monthOrField: number | string, errorMessage?: string): this {\n return this.addRule(minMonthRule, errorMessage, {\n monthOrField,\n scope: \"global\",\n });\n }\n\n /**\n * Month must be <= given month or field (1-12)\n * Smart detection: number or field name\n *\n * @category Validation Rule\n */\n public maxMonth(monthOrField: Month | string, errorMessage?: string): this {\n return this.addRule(maxMonthRule, errorMessage, {\n monthOrField,\n scope: \"global\",\n });\n }\n\n /**\n * Day must be >= given day or field (1-31)\n * Smart detection: number or field name\n *\n * @category Validation Rule\n */\n public minDay(dayOrField: number | string, errorMessage?: string): this {\n return this.addRule(minDayRule, errorMessage, {\n dayOrField,\n scope: \"global\",\n });\n }\n\n /**\n * Day must be <= given day or field (1-31)\n * Smart detection: number or field name\n *\n * @category Validation Rule\n */\n public maxDay(dayOrField: number | string, errorMessage?: string): this {\n return this.addRule(maxDayRule, errorMessage, {\n dayOrField,\n scope: \"global\",\n });\n }\n\n /**\n * Year must be >= sibling field year\n * @category Validation Rule\n */\n public minYearSibling(field: string, errorMessage?: string): this {\n return this.addRule(minYearRule, errorMessage, {\n yearOrField: field,\n scope: \"sibling\",\n });\n }\n\n /**\n * Year must be <= sibling field year\n * @category Validation Rule\n */\n public maxYearSibling(field: string, errorMessage?: string): this {\n return this.addRule(maxYearRule, errorMessage, {\n yearOrField: field,\n scope: \"sibling\",\n });\n }\n\n /**\n * Month must be >= sibling field month\n * @category Validation Rule\n */\n public minMonthSibling(field: string, errorMessage?: string): this {\n return this.addRule(minMonthRule, errorMessage, {\n monthOrField: field,\n scope: \"sibling\",\n });\n }\n\n /**\n * Month must be <= sibling field month\n * @category Validation Rule\n */\n public maxMonthSibling(field: string, errorMessage?: string): this {\n return this.addRule(maxMonthRule, errorMessage, {\n monthOrField: field,\n scope: \"sibling\",\n });\n }\n\n /**\n * Day must be >= sibling field day\n * @category Validation Rule\n */\n public minDaySibling(field: string, errorMessage?: string): this {\n return this.addRule(minDayRule, errorMessage, {\n dayOrField: field,\n scope: \"sibling\",\n });\n }\n\n /**\n * Day must be <= sibling field day\n * @category Validation Rule\n */\n public maxDaySibling(field: string, errorMessage?: string): this {\n return this.addRule(maxDayRule, errorMessage, {\n dayOrField: field,\n scope: \"sibling\",\n });\n }\n\n /** Date must be in specific quarter (1-4) */\n public quarter(quarter: 1 | 2 | 3 | 4, errorMessage?: string) {\n return this.addRule(quarterRule, errorMessage, { quarter });\n }\n\n // ==================== Special Validation ====================\n\n /** Valid birthday (not in future, reasonable age) */\n public birthday(minAge?: number, maxAge?: number, errorMessage?: string) {\n return this.addRule(birthdayRule, errorMessage, { minAge, maxAge });\n }\n\n /** Date must be in a leap year */\n public leapYear(errorMessage?: string) {\n return this.addRule(leapYearRule, errorMessage);\n }\n\n /**\n * Set default value as current time of exeuction\n */\n public defaultNow() {\n return this.default(() => new Date());\n }\n\n /**\n * @inheritdoc\n *\n * Maps DateValidator to JSON Schema format keywords.\n * Default is `date-time`. If `.toDateOnly()` or `.toTimeOnly()` are used,\n * falls back to `date` or `time` formats respectively.\n *\n * @example\n * ```ts\n * v.date().toJsonSchema(\"draft-2020-12\")\n * // → { type: \"string\", format: \"date-time\" }\n *\n * v.date().toDateOnly().toJsonSchema(\"draft-2020-12\")\n * // → { type: \"string\", format: \"date\" }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const schema: JsonSchemaResult = { type: \"string\", format: \"date-time\" };\n\n // Check if an explicit format rule was applied via v.date().format()\n const dateOpts = getRuleOptions(this.rules, \"date\");\n if (dateOpts?.format === \"YYYY-MM-DD\") {\n schema.format = \"date\";\n } else if (dateOpts?.format === \"HH:mm:ss\") {\n schema.format = \"time\";\n }\n\n // Transformer-based detection (marker-driven; minifier-safe).\n // toDateOnly/toTimeOnly tag their options bag with __jsonSchemaFormat.\n // toFormat() exposes the user-supplied format string in options.format.\n if (schema.format === \"date-time\") {\n for (const t of this.dataTransformers) {\n const hint = t.options?.__jsonSchemaFormat;\n if (hint === \"date\" || hint === \"time\") {\n schema.format = hint;\n break;\n }\n\n const userFormat = t.options?.format;\n\n if (userFormat === \"YYYY-MM-DD\") {\n schema.format = \"date\";\n break;\n }\n\n if (userFormat === \"HH:mm:ss\") {\n schema.format = \"time\";\n break;\n }\n }\n }\n\n if (this.isNullable) applyNullable(schema, target);\n\n return schema;\n }\n}\n","import { literalRule } from \"../rules/common/literal\";\nimport { applyNullable } from \"../standard-schema/json-schema\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport { BaseValidator } from \"./base-validator\";\n\n/**\n * Literal validator class\n *\n * Accepts a fixed tuple of primitive literal values (string, number, boolean).\n * The TypeScript type narrows to the union of those literals — `v.literal(\"a\", \"b\")`\n * infers as `\"a\" | \"b\"`, not `string`. Use for discriminator fields, enum-like\n * unions of constants, and any case where `oneOf([...])` would lose literal types.\n *\n * @example\n * v.literal(\"items\") // type: \"items\"\n * v.literal(\"draft\", \"published\") // type: \"draft\" | \"published\"\n * v.literal(1, 2, 3) // type: 1 | 2 | 3\n * v.literal(true) // type: true\n */\nexport class LiteralValidator<\n T extends readonly (string | number | boolean)[] = readonly (string | number | boolean)[],\n> extends BaseValidator {\n public values: T;\n\n public constructor(values: T, errorMessage?: string) {\n super();\n this.blankIsMissing = true;\n this.values = values;\n this.addMutableRule(literalRule, errorMessage, { values });\n\n // `\"\"` is a value, not an absence. Every validator is required by default,\n // and `required` rejects anything `isEmptyValue` calls empty — including the\n // empty string — so `v.literal(\"\")` could never pass. When the author has\n // explicitly listed an empty value as acceptable, swap `required` for\n // `present`: the key must still exist, but judging the value is the literal\n // set's job, and it is already the stricter statement of intent.\n //\n // Dropping the rule entirely instead would make a missing key valid, which\n // is the opposite mistake — `alt=\"\"` and no `alt` at all are different\n // things to a screen reader, and to anything else reading the schema.\n }\n\n /**\n * Check if value is one of the configured literals\n */\n public matchesType(value: any): boolean {\n return (this.values as readonly any[]).includes(value);\n }\n\n /**\n * Clone the validator, preserving the literal `values` set.\n *\n * The base `clone()` only copies `BaseValidator` fields, so without this\n * override a cloned literal loses its public `values` array — which breaks\n * any consumer that reads it (e.g. `discriminatedUnion` branch routing).\n */\n public override clone(): this {\n const cloned = super.clone();\n cloned.values = this.values;\n return cloned;\n }\n\n /**\n * @inheritdoc\n *\n * Single literal → `{ const: <value> }`. Multiple → `{ enum: [...] }`.\n *\n * @example\n * ```ts\n * v.literal(\"items\").toJsonSchema()\n * // → { const: \"items\" }\n *\n * v.literal(\"draft\", \"published\").toJsonSchema()\n * // → { enum: [\"draft\", \"published\"] }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const schema: JsonSchemaResult =\n this.values.length === 1 ? { const: this.values[0] } : { enum: [...this.values] };\n if (this.isNullable) applyNullable(schema, target);\n return schema;\n }\n}\n","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 {\n absMutator,\n ceilMutator,\n floorMutator,\n numericMutator,\n roundMutator,\n toFixedMutator,\n} from \"../mutators\";\nimport {\n betweenNumbersRule,\n evenRule,\n greaterThanRule,\n lengthRule,\n lessThanRule,\n maxLengthRule,\n maxRule,\n minLengthRule,\n minRule,\n moduloRule,\n negativeRule,\n numberRule,\n oddRule,\n positiveRule,\n} from \"../rules\";\nimport { PrimitiveValidator } from \"./primitive-validator\";\nimport { applyNullable, getRuleOptions } from \"../standard-schema/json-schema\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\n\n/**\n * Number validator class - base for Int and Float validators\n */\nexport class NumberValidator extends PrimitiveValidator {\n public constructor(errorMessage?: string) {\n super();\n this.blankIsMissing = true;\n this.addMutableRule(numberRule, errorMessage);\n }\n\n /**\n * Check if value is a number type\n */\n public matchesType(value: any): boolean {\n return typeof value === \"number\" && !isNaN(value);\n }\n\n /**\n * Value must be equal or higher than the given number or field\n * Smart detection: number or field name\n *\n * @category Validation Rule\n */\n public min(min: number | string, errorMessage?: string) {\n return this.addRule(minRule, errorMessage, { min, scope: \"global\" });\n }\n\n /**\n * Value must be equal or less than the given number or field\n * Smart detection: number or field name\n *\n * @category Validation Rule\n */\n public max(max: number | string, errorMessage?: string) {\n return this.addRule(maxRule, errorMessage, { max, scope: \"global\" });\n }\n\n /**\n * Value must be >= sibling field value\n * @category Validation Rule\n */\n public minSibling(field: string, errorMessage?: string) {\n return this.addRule(minRule, errorMessage, { min: field, scope: \"sibling\" });\n }\n\n /**\n * Value must be <= sibling field value\n * @category Validation Rule\n */\n public maxSibling(field: string, errorMessage?: string) {\n return this.addRule(maxRule, errorMessage, { max: field, scope: \"sibling\" });\n }\n\n /**\n * Value must be strictly greater than the given number or field (>)\n * Smart detection: number or field name\n *\n * @category Validation Rule\n */\n public greaterThan(value: number | string, errorMessage?: string) {\n return this.addRule(greaterThanRule, errorMessage, {\n value,\n scope: \"global\",\n });\n }\n\n /**\n * Value must be strictly less than the given number or field (<)\n * Smart detection: number or field name\n *\n * @category Validation Rule\n */\n public lessThan(value: number | string, errorMessage?: string) {\n return this.addRule(lessThanRule, errorMessage, {\n value,\n scope: \"global\",\n });\n }\n\n /**\n * Alias for greaterThan() - shorter syntax\n * @category Validation Rule\n */\n public gt(value: number | string, errorMessage?: string) {\n return this.greaterThan(value, errorMessage);\n }\n\n /**\n * Alias for lessThan() - shorter syntax\n * @category Validation Rule\n */\n public lt(value: number | string, errorMessage?: string) {\n return this.lessThan(value, errorMessage);\n }\n\n /**\n * Value must be > sibling field value\n * @category Validation Rule\n */\n public greaterThanSibling(field: string, errorMessage?: string) {\n return this.addRule(greaterThanRule, errorMessage, {\n value: field,\n scope: \"sibling\",\n });\n }\n\n /**\n * Alias for greaterThanSibling() - shorter syntax\n * @category Validation Rule\n */\n public gtSibling(field: string, errorMessage?: string) {\n return this.greaterThanSibling(field, errorMessage);\n }\n\n /**\n * Value must be < sibling field value\n * @category Validation Rule\n */\n public lessThanSibling(field: string, errorMessage?: string) {\n return this.addRule(lessThanRule, errorMessage, {\n value: field,\n scope: \"sibling\",\n });\n }\n\n /**\n * Alias for lessThanSibling() - shorter syntax\n * @category Validation Rule\n */\n public ltSibling(field: string, errorMessage?: string) {\n return this.lessThanSibling(field, errorMessage);\n }\n\n /** Value must be a modulo of the given number */\n public modulo(value: number, errorMessage?: string) {\n return this.addRule(moduloRule, errorMessage, { value });\n }\n\n /**\n * Alias for modulo() - Value must be divisible by the given number\n */\n public divisibleBy(value: number, errorMessage?: string) {\n return this.modulo(value, errorMessage);\n }\n\n /**\n * Alias for modulo() - Value must be a multiple of the given number\n */\n public multipleOf(value: number, errorMessage?: string) {\n return this.modulo(value, errorMessage);\n }\n\n /**\n * Alias for modulo() - Value must be a multiple of the given number\n */\n public modulusOf(value: number, errorMessage?: string) {\n return this.modulo(value, errorMessage);\n }\n\n /** Accept only numbers higher than 0 */\n public positive(errorMessage?: string) {\n return this.addRule(positiveRule, errorMessage);\n }\n\n /** Accept only negative numbers */\n public negative(errorMessage?: string) {\n return this.addRule(negativeRule, errorMessage);\n }\n\n /** Accept only odd numbers */\n public odd(errorMessage?: string) {\n return this.addRule(oddRule, errorMessage);\n }\n\n /** Accept only even numbers */\n public even(errorMessage?: string) {\n return this.addRule(evenRule, errorMessage);\n }\n\n /**\n * Accept only numbers between the given two numbers or fields (Inclusive)\n * Smart detection: number or field name\n *\n * @category Validation Rule\n */\n public between(min: number | string, max: number | string, errorMessage?: string) {\n return this.addRule(betweenNumbersRule, errorMessage, {\n min,\n max,\n scope: \"global\",\n });\n }\n\n /**\n * Value must be between sibling field values\n * @category Validation Rule\n */\n public betweenSibling(minField: string, maxField: string, errorMessage?: string) {\n return this.addRule(betweenNumbersRule, errorMessage, {\n min: minField,\n max: maxField,\n scope: \"sibling\",\n });\n }\n\n // Enum and value membership methods are inherited from PrimitiveValidator.\n\n /**\n * Value (as a string) must be exactly this many characters.\n * Useful for fixed-format numeric codes (e.g. 4-digit PIN).\n */\n public length(length: number, errorMessage?: string) {\n return this.addRule(lengthRule, errorMessage, { length });\n }\n\n /** Value (as string representation) length must be ≥ min */\n public minLength(length: number, errorMessage?: string) {\n return this.addRule(minLengthRule, errorMessage, { minLength: length });\n }\n\n /** Value (as string representation) length must be ≤ max */\n public maxLength(length: number, errorMessage?: string) {\n return this.addRule(maxLengthRule, errorMessage, { maxLength: length });\n }\n\n // Mutators\n\n /**\n * Convert value to its absolute value\n */\n public abs() {\n return this.addMutator(absMutator);\n }\n\n /**\n * Round value up to the nearest integer\n */\n public ceil() {\n return this.addMutator(ceilMutator);\n }\n\n /**\n * Round value down to the nearest integer\n */\n public floor() {\n return this.addMutator(floorMutator);\n }\n\n /**\n * Round value to the nearest integer or specified decimals\n */\n public round(decimals = 0) {\n return this.addMutator(roundMutator, { decimals });\n }\n\n /**\n * Round to a fixed number of decimal places, keeping the value a **number**.\n *\n * `v.number().toFixed(2)` on `3.14159` yields `3.14`, not `\"3.14\"` — a number\n * schema has to output a number, or its own type rule rejects the result.\n * Format to a fixed-point *string* at the presentation edge instead.\n *\n * @example\n * v.number().toFixed(2) // 3.14159 → 3.14\n */\n public toFixed(decimals = 2) {\n return this.addMutator(toFixedMutator, { decimals });\n }\n\n /**\n * Opt in to coercion: a numeric-shaped string is converted to a number\n * **before** the type rules run; any other value passes through unchanged\n * so bad input still fails the type rule.\n *\n * Strictness is preserved — coercion only fixes the string *representation*,\n * not the value's shape. `v.int().coerce()` turns `\"5\"` into `5` (valid) but\n * `\"5.5\"` into `5.5`, which still fails the integer rule. Number validators\n * do **not** coerce by default; this only takes effect when explicitly chained.\n *\n * The output type is unchanged (`Infer<>` keys off the validator class), so\n * `v.int().coerce()` still infers `number`.\n *\n * @example\n * v.int().coerce() // \"5\" → 5 (valid); \"5.5\" → 5.5 (invalid); \"abc\" → invalid\n * v.number().coerce() // \"5.5\" → 5.5 (valid)\n */\n public coerce() {\n return this.addMutator(numericMutator) as this & { isCoerced: true };\n }\n\n /**\n * @inheritdoc\n *\n * Returns `{ type: \"number\" }` with numeric constraint keywords.\n * IntValidator overrides `type` to `\"integer\"`.\n *\n * @note Sibling-scoped rules (minSibling, maxSibling, etc.) are not representable\n * in JSON Schema and are silently omitted.\n *\n * @example\n * ```ts\n * v.number().min(0).max(100).toJsonSchema(\"draft-2020-12\")\n * // → { type: \"number\", minimum: 0, maximum: 100 }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n return this.buildNumberJsonSchema(\"number\", target);\n }\n\n /**\n * Shared logic for number/integer JSON Schema generation.\n * Called by NumberValidator.toJsonSchema() (→ type: \"number\")\n * and IntValidator.toJsonSchema() (→ type: \"integer\").\n */\n protected buildNumberJsonSchema(\n type: \"number\" | \"integer\",\n target: JsonSchemaTarget,\n ): JsonSchemaResult {\n const schema: JsonSchemaResult = { type };\n\n // minimum (inclusive)\n const minOpts = getRuleOptions(this.rules, \"min\");\n if (minOpts?.min !== undefined && typeof minOpts.min === \"number\") {\n schema.minimum = minOpts.min;\n }\n\n // maximum (inclusive)\n const maxOpts = getRuleOptions(this.rules, \"max\");\n if (maxOpts?.max !== undefined && typeof maxOpts.max === \"number\") {\n schema.maximum = maxOpts.max;\n }\n\n // between (inclusive range)\n const betweenOpts = getRuleOptions(this.rules, \"betweenNumbers\");\n if (betweenOpts) {\n if (typeof betweenOpts.min === \"number\") schema.minimum = betweenOpts.min;\n if (typeof betweenOpts.max === \"number\") schema.maximum = betweenOpts.max;\n }\n\n // greaterThan (>) → exclusiveMinimum\n const gtOpts = getRuleOptions(this.rules, \"greaterThan\");\n if (gtOpts?.value !== undefined && typeof gtOpts.value === \"number\") {\n if (target === \"draft-07\") {\n schema.minimum = gtOpts.value;\n schema.exclusiveMinimum = true;\n } else {\n schema.exclusiveMinimum = gtOpts.value;\n }\n }\n\n // lessThan (<) → exclusiveMaximum\n const ltOpts = getRuleOptions(this.rules, \"lessThan\");\n if (ltOpts?.value !== undefined && typeof ltOpts.value === \"number\") {\n if (target === \"draft-07\") {\n schema.maximum = ltOpts.value;\n schema.exclusiveMaximum = true;\n } else {\n schema.exclusiveMaximum = ltOpts.value;\n }\n }\n\n // multipleOf / modulo\n const moduloOpts = getRuleOptions(this.rules, \"modulo\");\n if (moduloOpts?.value !== undefined && typeof moduloOpts.value === \"number\") {\n schema.multipleOf = moduloOpts.value;\n }\n\n // enum (from PrimitiveValidator.in / .enum)\n const inOpts = getRuleOptions(this.rules, \"in\");\n if (inOpts?.values && Array.isArray(inOpts.values)) {\n schema.enum = inOpts.values;\n }\n\n if (this.isNullable) applyNullable(schema, target);\n\n return schema;\n }\n}\n","import { floatRule } from \"../rules\";\nimport { NumberValidator } from \"./number-validator\";\n\n/**\n * Float validator class\n */\nexport class FloatValidator extends NumberValidator {\n public constructor(errorMessage?: string) {\n super();\n this.addMutableRule(floatRule, errorMessage);\n }\n}\n","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\";\nimport { NumberValidator } from \"./number-validator\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\n\n/**\n * Integer validator class\n */\nexport class IntValidator extends NumberValidator {\n public constructor(errorMessage?: string) {\n super();\n this.addMutableRule(intRule, errorMessage);\n }\n\n /**\n * @inheritdoc — returns `{ type: \"integer\" }` instead of `{ type: \"number\" }`\n *\n * @example\n * ```ts\n * v.int().min(1).max(100).toJsonSchema(\"draft-2020-12\")\n * // → { type: \"integer\", minimum: 1, maximum: 100 }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n return this.buildNumberJsonSchema(\"integer\", target);\n }\n}\n","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\";\nimport { numericMutator } from \"../mutators/number-mutators\";\nimport { NumberValidator } from \"./number-validator\";\n\n/**\n * Numeric validator class - base for Int and Float validators either as number or string\n */\nexport class NumericValidator extends NumberValidator {\n /**\n * Constructor\n */\n public constructor(errorMessage?: string) {\n super(errorMessage);\n this.addMutableMutator(numericMutator);\n }\n\n /**\n * Check if value is a numeric type\n */\n public matchesType(value: any): boolean {\n return isNumeric(value);\n }\n}\n","import { isPlainObject } from \"@mongez/supportive-is\";\nimport { setKeyPath } from \"../helpers\";\nimport { objectRule, plainObjectRule } from \"../rules\";\nimport type { SchemaContext, ValidationResult } from \"../types\";\nimport { BaseValidator } from \"./base-validator\";\nimport { applyNullable } from \"../standard-schema/json-schema\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\n\n/**\n * Record validator class - validates objects with dynamic keys and consistent value types\n *\n * @example\n * ```ts\n * // Translations object\n * v.record(v.string())\n * // Valid: { en: \"Hello\", ar: \"مرحبا\", fr: \"Bonjour\" }\n *\n * // User preferences\n * v.record(v.union([v.string(), v.number(), v.boolean()]))\n * // Valid: { theme: \"dark\", fontSize: 16, notifications: true }\n * ```\n */\nexport class RecordValidator extends BaseValidator {\n public constructor(\n public valueValidator: BaseValidator,\n errorMessage?: string,\n ) {\n super();\n this.addMutableRule(objectRule, errorMessage);\n }\n\n /**\n * Validate it as plain object\n */\n public plainObject(errorMessage?: string) {\n return this.addRule(plainObjectRule, errorMessage);\n }\n\n /**\n * Check if value is a plain object type\n */\n public matchesType(value: any): boolean {\n return isPlainObject(value);\n }\n\n /**\n * Clone the validator\n */\n public override clone(): this {\n const cloned = super.clone();\n cloned.valueValidator = this.valueValidator.clone();\n return cloned;\n }\n\n /**\n * Validate record - iterate all keys and validate each value\n *\n * Absent input (and absent without `.default()`) propagates as `data: undefined`\n * so the parent ObjectValidator can omit the key. Without this, optional record\n * fields would silently materialise as `{}` in the validated output.\n */\n public async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\n // Apply default when absent, then mutate. Mirrors BaseValidator's\n // `valueForRules = data ?? this.getDefaultValue()` so `.default({...})`\n // works on records too.\n const valueForRules = data ?? this.getDefaultValue();\n const mutatedData = await this.mutate(valueForRules, context);\n\n const result = await super.validate(data, context);\n\n if (result.isValid === false) return result;\n\n // Nothing to iterate for absent (no default) or null (nullable) inputs —\n // propagate so the parent ObjectValidator can omit the key.\n if (mutatedData === undefined || mutatedData === null) return result;\n\n // Defensive: type rule (objectRule) should have failed for non-objects.\n if (!isPlainObject(mutatedData)) return result;\n\n const errors: ValidationResult[\"errors\"] = [];\n const keys = Object.keys(mutatedData);\n\n // Validate all values in parallel\n const validationPromises = keys.map(async (key) => {\n const childContext: SchemaContext = {\n ...context,\n parent: mutatedData,\n value: mutatedData[key],\n key,\n path: setKeyPath(context.path, key),\n };\n\n const childResult = await this.valueValidator.validate(mutatedData[key], childContext);\n\n // Update mutated data with validated result\n mutatedData[key] = childResult.data;\n\n // Collect errors from this value\n if (childResult.isValid === false) {\n errors.push(...childResult.errors);\n }\n });\n\n await Promise.all(validationPromises);\n\n return {\n isValid: errors.length === 0,\n errors,\n data: await this.startTransformationPipeline(mutatedData, context),\n };\n }\n\n /**\n * @inheritdoc\n *\n * Generates `{ type: \"object\", additionalProperties: <valueSchema> }` —\n * the standard JSON Schema for a dictionary/map with homogeneous values.\n *\n * @example\n * ```ts\n * v.record(v.string()).toJsonSchema(\"draft-2020-12\")\n * // → { type: \"object\", additionalProperties: { type: \"string\" } }\n *\n * v.record(v.union([v.string(), v.number()])).toJsonSchema(\"draft-2020-12\")\n * // → { type: \"object\", additionalProperties: { oneOf: [{ type: \"string\" }, { type: \"number\" }] } }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const schema: JsonSchemaResult = {\n type: \"object\",\n additionalProperties: this.valueValidator.toJsonSchema(target),\n };\n\n if (this.isNullable) applyNullable(schema, target);\n\n return schema;\n }\n}\n","import { invalidRule, VALID_RULE } from \"../helpers\";\nimport { numberMutator, stringMutator } from \"../mutators\";\nimport {\n acceptedIfPresentRule,\n acceptedIfRequiredRule,\n acceptedIfRule,\n acceptedRule,\n acceptedUnlessRule,\n acceptedWithoutRule,\n declinedIfPresentRule,\n declinedIfRequiredRule,\n declinedIfRule,\n declinedRule,\n declinedUnlessRule,\n declinedWithoutRule,\n} from \"../rules/scalar\";\nimport { PrimitiveValidator } from \"./primitive-validator\";\nimport { getRuleOptions } from \"../standard-schema/json-schema\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\n\n/**\n * Scalar validator class\n *\n * Core validator for scalar values (string, number, boolean).\n * Extends PrimitiveValidator (inherits enum/in/oneOf/allowsOnly/forbids/notIn)\n * and additionally provides type-coercion mutators and accepted/declined rules.\n *\n * Database methods (unique, exists, etc.) are injected by the framework\n */\nexport class ScalarValidator extends PrimitiveValidator {\n public constructor(errorMessage?: string) {\n super();\n this.blankIsMissing = true;\n this.addMutableRule(\n {\n name: \"scalar\",\n defaultErrorMessage: \"The :input must be a scalar value\",\n async validate(value, context) {\n if ([\"string\", \"number\", \"boolean\"].includes(typeof value)) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n },\n errorMessage,\n );\n }\n\n /**\n * Add matches type\n */\n public matchesType(value: any) {\n return typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\";\n }\n\n /**\n * Mutate the scalar value to be number\n */\n public asNumber() {\n return this.addMutator(numberMutator);\n }\n\n /**\n * Mutate the scalar value to be string\n */\n public asString() {\n return this.addMutator(stringMutator);\n }\n\n /**\n * Accepted value\n * The value will be valid if it equals 1 | \"1\" | true | \"true\" | \"yes\" | \"y\" | \"on\"\n */\n public accepted(errorMessage?: string) {\n return this.addRule(acceptedRule, errorMessage);\n }\n\n /**\n * Accepted value if another field's value equals to a specific value\n */\n public acceptedIf(field: string, value: any, errorMessage?: string) {\n return this.addRule(acceptedIfRule, errorMessage, { field, value });\n }\n\n /**\n * Accepted value if another field's value is not equal to the given value\n */\n public acceptedUnless(field: string, value: any, errorMessage?: string) {\n return this.addRule(acceptedUnlessRule, errorMessage, { field, value });\n }\n\n /**\n * Accepted value if another field is required\n */\n public acceptedIfRequired(field: string, errorMessage?: string) {\n return this.addRule(acceptedIfRequiredRule, errorMessage, { field });\n }\n\n /**\n * Accepted value if another field is present\n */\n public acceptedIfPresent(field: string, errorMessage?: string) {\n return this.addRule(acceptedIfPresentRule, errorMessage, { field });\n }\n\n /**\n * Accepted value if another field is missing\n */\n public acceptedWithout(field: string, errorMessage?: string) {\n return this.addRule(acceptedWithoutRule, errorMessage, { field });\n }\n\n /**\n * Declined value\n * The value will be valid if it equals 0 | \"0\" | false | \"false\" | \"no\" | \"n\" | \"off\"\n */\n public declined(errorMessage?: string) {\n return this.addRule(declinedRule, errorMessage);\n }\n\n /**\n * Declined value if another field's value equals to a specific value\n */\n public declinedIf(field: string, value: any, errorMessage?: string) {\n return this.addRule(declinedIfRule, errorMessage, { field, value });\n }\n\n /**\n * Declined value if another field's value is not equal to the given value\n */\n public declinedUnless(field: string, value: any, errorMessage?: string) {\n return this.addRule(declinedUnlessRule, errorMessage, { field, value });\n }\n\n /**\n * Declined value if another field is required\n */\n public declinedIfRequired(field: string, errorMessage?: string) {\n return this.addRule(declinedIfRequiredRule, errorMessage, { field });\n }\n\n /**\n * Declined value if another field is present\n */\n public declinedIfPresent(field: string, errorMessage?: string) {\n return this.addRule(declinedIfPresentRule, errorMessage, { field });\n }\n\n /**\n * Declined value if another field is missing\n */\n public declinedWithout(field: string, errorMessage?: string) {\n return this.addRule(declinedWithoutRule, errorMessage, { field });\n }\n\n /**\n * @inheritdoc\n *\n * A scalar accepts string | number | boolean. If `.in()` / `.enum()` is used,\n * output collapses to a simple `enum` list instead.\n *\n * @example\n * ```ts\n * v.scalar().toJsonSchema(\"draft-2020-12\")\n * // → { oneOf: [{ type: \"string\" }, { type: \"number\" }, { type: \"boolean\" }] }\n *\n * v.scalar().in([\"active\", \"inactive\"]).toJsonSchema(\"draft-2020-12\")\n * // → { enum: [\"active\", \"inactive\"] }\n * ```\n */\n public override toJsonSchema(_target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n // If a value set is constrained, collapse to enum\n const inOpts = getRuleOptions(this.rules, \"in\");\n if (inOpts?.values && Array.isArray(inOpts.values)) {\n return { enum: inOpts.values };\n }\n\n const enumOpts = getRuleOptions(this.rules, \"enum\");\n if (enumOpts?.enum && Array.isArray(enumOpts.enum)) {\n return { enum: enumOpts.enum };\n }\n\n return {\n oneOf: [\n { type: \"string\" },\n { type: \"number\" },\n { type: \"boolean\" },\n ],\n };\n }\n}\n","import { setKeyPath } from \"../helpers\";\nimport { arrayRule } from \"../rules\";\nimport type { SchemaContext, ValidationResult } from \"../types\";\nimport { BaseValidator } from \"./base-validator\";\nimport { applyNullable } from \"../standard-schema/json-schema\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\n\n/**\n * Tuple validator class - validates fixed-length arrays with position-specific types\n *\n * @example\n * ```ts\n * // RGB color tuple\n * v.tuple([v.number(), v.number(), v.number()])\n * // Valid: [255, 128, 0]\n * // Invalid: [255, 128] (too short)\n *\n * // Mixed types\n * v.tuple([v.string(), v.int(), v.boolean()])\n * // Valid: [\"John\", 25, true]\n * ```\n */\nexport class TupleValidator extends BaseValidator {\n public constructor(\n public validators: BaseValidator[],\n errorMessage?: string,\n ) {\n super();\n this.addMutableRule(arrayRule, errorMessage);\n }\n\n /**\n * Check if value is an array type\n */\n public matchesType(value: any): boolean {\n return Array.isArray(value);\n }\n\n /**\n * Clone the validator\n */\n public override clone(): this {\n const cloned = super.clone();\n cloned.validators = this.validators.map((v) => v.clone());\n return cloned;\n }\n\n /**\n * Validate tuple - check length then validate each position\n *\n * Absent input (and absent without `.default()`) propagates as `data: undefined`\n * so the parent ObjectValidator can omit the key. Without this, optional tuple\n * fields would silently materialise as `[]` in the validated output and then\n * fail the length check.\n */\n public async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\n // Apply default when absent, then mutate. Mirrors BaseValidator's\n // `valueForRules = data ?? this.getDefaultValue()` so `.default([...])`\n // works on tuples too.\n const valueForRules = data ?? this.getDefaultValue();\n const mutatedData = await this.mutate(valueForRules, context);\n\n const result = await super.validate(data, context);\n\n if (result.isValid === false) return result;\n\n // Nothing to iterate for absent (no default) or null (nullable) inputs —\n // propagate so the parent ObjectValidator can omit the key.\n if (mutatedData === undefined || mutatedData === null) return result;\n\n // Defensive: type rule (arrayRule) should have failed for non-arrays.\n if (!Array.isArray(mutatedData)) return result;\n\n const errors: ValidationResult[\"errors\"] = [];\n\n // Tuple-specific: length validation\n if (mutatedData.length !== this.validators.length) {\n errors.push({\n type: \"tuple\",\n input: context.key || \"value\",\n error: `Expected exactly ${this.validators.length} items, but got ${mutatedData.length}`,\n });\n return { isValid: false, errors, data: mutatedData };\n }\n\n // Validate each position with its specific validator in parallel\n const validationPromises = this.validators.map(async (validator, index) => {\n const childContext: SchemaContext = {\n ...context,\n parent: mutatedData,\n value: mutatedData[index],\n key: index.toString(),\n path: setKeyPath(context.path, index.toString()),\n };\n\n const childResult = await validator.validate(mutatedData[index], childContext);\n\n // Update mutated data with validated result\n mutatedData[index] = childResult.data;\n\n // Collect errors from this element\n if (childResult.isValid === false) {\n errors.push(...childResult.errors);\n }\n });\n\n await Promise.all(validationPromises);\n\n return {\n isValid: errors.length === 0,\n errors,\n data: await this.startTransformationPipeline(mutatedData, context),\n };\n }\n\n /**\n * @inheritdoc\n *\n * Tuple keyword diverges between targets:\n * - `draft-2020-12` → `prefixItems` + `items: false` (exact length enforced)\n * - `draft-07` → `items` as array + `additionalItems: false`\n * - `openapi-3.0` → same as draft-07 (OpenAPI 3.0 is based on draft-07)\n *\n * @example\n * ```ts\n * v.tuple([v.string(), v.int(), v.boolean()]).toJsonSchema(\"draft-2020-12\")\n * // → {\n * // type: \"array\",\n * // prefixItems: [{ type: \"string\" }, { type: \"integer\" }, { type: \"boolean\" }],\n * // items: false,\n * // minItems: 3,\n * // maxItems: 3\n * // }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const itemSchemas = this.validators.map(v => v.toJsonSchema(target));\n const length = this.validators.length;\n\n const schema: JsonSchemaResult = {\n type: \"array\",\n minItems: length,\n maxItems: length,\n };\n\n if (target === \"draft-2020-12\") {\n // prefixItems is the draft-2020-12 keyword for positional tuple items\n schema.prefixItems = itemSchemas;\n schema.items = false; // no additional items beyond the tuple\n } else {\n // draft-07 and openapi-3.0: items as array + additionalItems: false\n schema.items = itemSchemas;\n schema.additionalItems = false;\n }\n\n if (this.isNullable) applyNullable(schema, target);\n\n return schema;\n }\n}\n","import { unionRule } from \"../rules\";\nimport { BaseValidator } from \"./base-validator\";\nimport { getRuleOptions } from \"../standard-schema/json-schema\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\n\n/**\n * Union validator class - validates value against multiple validator types\n *\n * Tries each validator in order until one passes. If a validator's matchesType()\n * returns false, it's skipped for optimization. First validator that both matches\n * the type and passes validation wins.\n *\n * @example\n * ```ts\n * // Accept email or username\n * const identifier = v.union([\n * v.string().email(),\n * v.string().alphanumeric().min(3).max(20)\n * ]);\n *\n * // Accept different types\n * const customValue = v.union([\n * v.string().required(),\n * v.number().required(),\n * v.boolean().required(),\n * v.file().required()\n * ]);\n * ```\n */\nexport class UnionValidator extends BaseValidator {\n /**\n * Set the validators to try for union validation\n *\n * @param validators - Array of validators to try\n * @param errorMessage - Optional custom error message if all validators fail\n * @returns This validator for chaining\n *\n * @example\n * ```ts\n * new UnionValidator()\n * .union([v.string(), v.number()], 'Must be string or number');\n * ```\n */\n public union(validators: BaseValidator[], errorMessage?: string) {\n return this.addRule(unionRule, errorMessage, { validators });\n }\n\n /**\n * @inheritdoc\n *\n * Generates `{ oneOf: [...] }` by mapping each sub-validator to its JSON Schema.\n *\n * @example\n * ```ts\n * v.union([v.string(), v.number()]).toJsonSchema(\"draft-2020-12\")\n * // → { oneOf: [{ type: \"string\" }, { type: \"number\" }] }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const opts = getRuleOptions(this.rules, \"union\");\n const validators = (opts?.validators ?? []) as BaseValidator[];\n\n return {\n oneOf: validators.map(v => v.toJsonSchema(target)),\n };\n }\n}\n","import type { SealConfig } from \"../config\";\nimport { object } from \"../object\";\nimport { string } from \"../string\";\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,\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 ) => 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> & 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,\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 ScalarValidator().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: <K extends string, Branches extends ReadonlyArray<ObjectValidator<any>>>(\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 /**\n * Rendered as `:value` in every error message — translated or custom —\n * instead of the submitted input. Unset keeps the raw value.\n */\n redactValue?: string;\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>(thunk: () => T) => 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: (errorMessage?: string) => ScalarValidator & StandardSchemaV1<string | number | boolean>;\n union: <T extends BaseValidator[]>(\n validators: T,\n errorMessage?: string,\n ) => UnionValidator & StandardSchemaV1<Infer<T[number]>>;\n discriminatedUnion: <K extends string, Branches extends ReadonlyArray<ObjectValidator<any>>>(\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","/**\n * Seal Plugin System\n *\n * Allows extending validators with custom functionality via plugins\n */\n\nexport type PluginContext = {\n /** Plugin name */\n name: string;\n /** Plugin version */\n version?: string;\n};\n\nexport type SealPlugin = {\n /** Plugin metadata */\n name: string;\n version?: string;\n description?: string;\n\n /**\n * Install function - called when plugin is registered\n * This is where you inject methods into validators\n *\n * @example\n * ```ts\n * install() {\n * Object.assign(StringValidator.prototype, {\n * slug(this: StringValidator) {\n * return this.pattern(/^[a-z0-9-]+$/);\n * }\n * });\n * }\n * ```\n */\n install: (context: PluginContext) => void | Promise<void>;\n\n /**\n * Uninstall the plugin (optional)\n * Clean up any injected methods\n */\n uninstall?: () => void | Promise<void>;\n};\n\n/**\n * Registry of installed plugins\n */\nconst installedPlugins = new Map<string, SealPlugin>();\n\n/**\n * Register a plugin\n *\n * @example\n * ```ts\n * const slugPlugin: SealPlugin = {\n * name: \"slug\",\n * install() {\n * Object.assign(StringValidator.prototype, {\n * slug(this: StringValidator) {\n * return this.pattern(/^[a-z0-9-]+$/);\n * }\n * });\n * }\n * };\n *\n * registerPlugin(slugPlugin);\n * ```\n */\nexport async function registerPlugin(plugin: SealPlugin): Promise<void> {\n if (installedPlugins.has(plugin.name)) {\n console.warn(`[Seal] Plugin \"${plugin.name}\" is already installed`);\n return;\n }\n\n const context: PluginContext = {\n name: plugin.name,\n version: plugin.version,\n };\n\n // Call install function\n await plugin.install(context);\n\n installedPlugins.set(plugin.name, plugin);\n}\n\n/**\n * Unregister a plugin\n */\nexport async function unregisterPlugin(pluginName: string): Promise<void> {\n const plugin = installedPlugins.get(pluginName);\n\n if (!plugin) {\n console.warn(`[Seal] Plugin \"${pluginName}\" is not installed`);\n return;\n }\n\n if (plugin.uninstall) {\n await plugin.uninstall();\n }\n\n installedPlugins.delete(pluginName);\n}\n\n/**\n * Check if a plugin is installed\n */\nexport function hasPlugin(pluginName: string): boolean {\n return installedPlugins.has(pluginName);\n}\n\n/**\n * Get list of installed plugins\n */\nexport function getInstalledPlugins(): SealPlugin[] {\n return Array.from(installedPlugins.values());\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAa,eAAb,cAAkCA,uCAAc;;;sBAIf;oBAKF;;;;;;;;;;;;;;CAc7B,AAAgB,aAAa,SAA2B,iBAAmC;EACzF,MAAM,SAA2B,CAAC;EAClC,IAAI,KAAK,YAAY,uCAAc,QAAQ,MAAM;EACjD,OAAO;CACT;AACF;;;;;AC9BA,MAAa,mBAA4B,OAAO,UAAU;CACxD,OAAO,MAAM,QAAQ;AACvB;;AAGA,MAAa,sBAA+B,OAAO,UAAU;CAC3D,OAAO,MAAM,QAAQ;AACvB;;AAGA,MAAa,mBAA4B,OAAO,OAAO,YAAY;CACjE,IAAI,CAAC,MAAM,QAAQ,KAAK,GAAG,OAAO;CAElC,MAAM,gBAAgB,SAAS,QAAQ,aAAa;CACpD,MAAM,YAAY,SAAS,QAAQ,OAAO;CAE1C,OAAO,MAAM,MAAM,GAAQ,MAAW;EACpC,IAAI,WAAW;GACb,MAAM,yCAAa,GAAG,SAAS;GAC/B,MAAM,yCAAa,GAAG,SAAS;GAE/B,IAAI,kBAAkB,OACpB,OAAO,SAAS;GAElB,OAAO,SAAS;EAClB;EAEA,IAAI,kBAAkB,OACpB,OAAO,IAAI;EAEb,OAAO,IAAI;CACb,CAAC;AACH;;AAGA,MAAa,qBAA8B,OAAO,UAAU;CAC1D,OAAO,CAAC,GAAG,IAAI,IAAI,KAAK,CAAC;AAC3B;;AAGA,MAAa,kCAA2C,OA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