@warlock.js/seal 5.2.3 → 5.3.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 (53) hide show
  1. package/cjs/index.cjs.map +1 -1
  2. package/esm/config.d.mts.map +1 -1
  3. package/esm/factory/validators.mjs.map +1 -1
  4. package/esm/helpers/validation-helpers.mjs.map +1 -1
  5. package/esm/mutators/date-mutators.mjs.map +1 -1
  6. package/esm/mutators/number-mutators.mjs.map +1 -1
  7. package/esm/mutators/scalar-mutators.mjs.map +1 -1
  8. package/esm/mutators/string-mutators.mjs.map +1 -1
  9. package/esm/plugins/plugin-system.d.mts.map +1 -1
  10. package/esm/rules/array/array-rules.mjs.map +1 -1
  11. package/esm/rules/common/enum.mjs.map +1 -1
  12. package/esm/rules/common/literal.mjs.map +1 -1
  13. package/esm/rules/common/type-rules.mjs.map +1 -1
  14. package/esm/rules/common/unknown-key.mjs.map +1 -1
  15. package/esm/rules/conditional/required-if-rules.mjs.map +1 -1
  16. package/esm/rules/core/union.mjs.map +1 -1
  17. package/esm/rules/core/when.mjs.map +1 -1
  18. package/esm/rules/date/date-day-rules.mjs.map +1 -1
  19. package/esm/rules/date/date-period-rules.mjs.map +1 -1
  20. package/esm/rules/date/date-special-rules.mjs.map +1 -1
  21. package/esm/rules/date/date.mjs.map +1 -1
  22. package/esm/rules/file/dimensions.mjs.map +1 -1
  23. package/esm/rules/length/length-rules.mjs.map +1 -1
  24. package/esm/rules/scalar/accepted-rule.mjs.map +1 -1
  25. package/esm/rules/scalar/declined-rule.mjs.map +1 -1
  26. package/esm/rules/string/credit-card.mjs.map +1 -1
  27. package/esm/rules/string/id-formats.mjs.map +1 -1
  28. package/esm/rules/string/string-comparison.mjs.map +1 -1
  29. package/esm/standard-schema/json-schema.mjs.map +1 -1
  30. package/esm/standard-schema/map-result.mjs.map +1 -1
  31. package/esm/validators/array-validator.d.mts.map +1 -1
  32. package/esm/validators/base-validator.d.mts.map +1 -1
  33. package/esm/validators/computed-validator.d.mts.map +1 -1
  34. package/esm/validators/date-validator.d.mts.map +1 -1
  35. package/esm/validators/date-validator.mjs.map +1 -1
  36. package/esm/validators/discriminated-union-validator.d.mts.map +1 -1
  37. package/esm/validators/discriminated-union-validator.mjs.map +1 -1
  38. package/esm/validators/instanceof-validator.d.mts.map +1 -1
  39. package/esm/validators/lazy-validator.d.mts.map +1 -1
  40. package/esm/validators/lazy-validator.mjs.map +1 -1
  41. package/esm/validators/literal-validator.d.mts.map +1 -1
  42. package/esm/validators/methods/required-methods.mjs.map +1 -1
  43. package/esm/validators/number-validator.d.mts.map +1 -1
  44. package/esm/validators/object-validator.d.mts.map +1 -1
  45. package/esm/validators/object-validator.mjs.map +1 -1
  46. package/esm/validators/record-validator.d.mts.map +1 -1
  47. package/esm/validators/record-validator.mjs.map +1 -1
  48. package/esm/validators/scalar-validator.d.mts.map +1 -1
  49. package/esm/validators/scalar-validator.mjs.map +1 -1
  50. package/esm/validators/string-validator.d.mts.map +1 -1
  51. package/esm/validators/tuple-validator.d.mts.map +1 -1
  52. package/esm/validators/union-validator.mjs.map +1 -1
  53. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"date-period-rules.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/date/date-period-rules.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\nconst MONTHS = {\r\n 1: \"january\",\r\n 2: \"february\",\r\n 3: \"march\",\r\n 4: \"april\",\r\n 5: \"may\",\r\n 6: \"june\",\r\n 7: \"july\",\r\n 8: \"august\",\r\n 9: \"september\",\r\n 10: \"october\",\r\n 11: \"november\",\r\n 12: \"december\",\r\n};\r\n\r\nexport type Month = keyof typeof MONTHS;\r\n\r\n/**\r\n * Month rule - date must be in specific month (1-12)\r\n */\r\nexport const monthRule: SchemaRule<{ month: Month }> = {\r\n name: \"month\",\r\n defaultErrorMessage: \"The :input must be in month :month\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const month = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n if (month === this.context.options.month) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.month =\r\n MONTHS[this.context.options.month as keyof typeof MONTHS];\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Year rule - date must be in specific year\r\n */\r\nexport const yearRule: SchemaRule<{ year: number }> = {\r\n name: \"year\",\r\n defaultErrorMessage: \"The :input must be in year :year\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const year = inputDate.getFullYear();\r\n\r\n if (year === this.context.options.year) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.year = this.context.options.year;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between years rule - date must be between start and end years\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenYearsRule: SchemaRule<{\r\n startYear: number | string;\r\n endYear: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenYears\",\r\n defaultErrorMessage: \"The :input must be between :startYear and :endYear\",\r\n async validate(value: Date, context) {\r\n const { startYear, endYear, scope = \"global\" } = this.context.options;\r\n const inputDate = new Date(value);\r\n const inputYear = inputDate.getFullYear();\r\n\r\n // Extract start year\r\n let compareStartYear: number;\r\n if (typeof startYear === \"number\") {\r\n compareStartYear = startYear;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, startYear);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareStartYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareStartYear = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareStartYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n // Extract end year\r\n let compareEndYear: number;\r\n if (typeof endYear === \"number\") {\r\n compareEndYear = endYear;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, endYear);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareEndYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareEndYear = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareEndYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n if (inputYear >= compareStartYear && inputYear <= compareEndYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startYear = compareStartYear;\r\n this.context.translationParams.endYear = compareEndYear;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between months rule - date must be between start and end months (1-12)\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenMonthsRule: SchemaRule<{\r\n startMonth: Month | string;\r\n endMonth: Month | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenMonths\",\r\n defaultErrorMessage: \"The :input must be between month :startMonth and :endMonth\",\r\n async validate(value: Date, context) {\r\n const { startMonth, endMonth, scope = \"global\" } = this.context.options;\r\n const inputDate = new Date(value);\r\n const inputMonth = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n // Extract start month\r\n let compareStartMonth: number;\r\n if (typeof startMonth === \"number\") {\r\n compareStartMonth = startMonth;\r\n this.context.translatableParams.startMonth = MONTHS[compareStartMonth as keyof typeof MONTHS];\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, startMonth);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.startMonth = startMonth;\r\n\r\n if (fieldValue instanceof Date) {\r\n compareStartMonth = fieldValue.getMonth() + 1;\r\n } else if (typeof fieldValue === \"number\") {\r\n compareStartMonth = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareStartMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n // Extract end month\r\n let compareEndMonth: number;\r\n if (typeof endMonth === \"number\") {\r\n compareEndMonth = endMonth;\r\n this.context.translatableParams.endMonth = MONTHS[compareEndMonth as keyof typeof MONTHS];\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, endMonth);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.endMonth = endMonth;\r\n\r\n if (fieldValue instanceof Date) {\r\n compareEndMonth = fieldValue.getMonth() + 1;\r\n } else if (typeof fieldValue === \"number\") {\r\n compareEndMonth = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareEndMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n if (inputMonth >= compareStartMonth && inputMonth <= compareEndMonth) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between days rule - date must be between start and end days (1-31)\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenDaysRule: SchemaRule<{\r\n startDay: number | string;\r\n endDay: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenDays\",\r\n defaultErrorMessage: \"The :input must be between day :startDay and :endDay\",\r\n async validate(value: Date, context) {\r\n const { startDay, endDay, scope = \"global\" } = this.context.options;\r\n const inputDate = new Date(value);\r\n const inputDay = inputDate.getDate();\r\n\r\n // Extract start day\r\n let compareStartDay: number;\r\n if (typeof startDay === \"number\") {\r\n compareStartDay = startDay;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, startDay);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareStartDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareStartDay = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareStartDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n // Extract end day\r\n let compareEndDay: number;\r\n if (typeof endDay === \"number\") {\r\n compareEndDay = endDay;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, endDay);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareEndDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareEndDay = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareEndDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n if (inputDay >= compareStartDay && inputDay <= compareEndDay) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startDay = compareStartDay;\r\n this.context.translationParams.endDay = compareEndDay;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Quarter rule - date must be in specific quarter (1-4)\r\n */\r\nexport const quarterRule: SchemaRule<{ quarter: 1 | 2 | 3 | 4 }> = {\r\n name: \"quarter\",\r\n defaultErrorMessage: \"The :input must be in quarter :quarter\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const month = inputDate.getMonth() + 1;\r\n const quarter = Math.ceil(month / 3);\r\n\r\n if (quarter === this.context.options.quarter) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.quarter = this.context.options.quarter;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between times rule - time must be between start and end times (HH:MM format)\r\n */\r\nexport const betweenTimesRule: SchemaRule<{\r\n startTime: string;\r\n endTime: string;\r\n}> = {\r\n name: \"betweenTimes\",\r\n defaultErrorMessage: \"The :input must be between :startTime and :endTime\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const inputHour = inputDate.getHours();\r\n const inputMinute = inputDate.getMinutes();\r\n const inputTimeInMinutes = inputHour * 60 + inputMinute;\r\n\r\n const { startTime, endTime } = this.context.options;\r\n\r\n // Parse start time\r\n const [startHour, startMinute] = startTime.split(\":\").map(Number);\r\n const startTimeInMinutes = startHour * 60 + startMinute;\r\n\r\n // Parse end time\r\n const [endHour, endMinute] = endTime.split(\":\").map(Number);\r\n const endTimeInMinutes = endHour * 60 + endMinute;\r\n\r\n if (inputTimeInMinutes >= startTimeInMinutes && inputTimeInMinutes <= endTimeInMinutes) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startTime = startTime;\r\n this.context.translationParams.endTime = endTime;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min year rule - year must be >= given year or field\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const minYearRule: SchemaRule<{\r\n yearOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minYear\",\r\n description: \"The date year must be at least the given year or field\",\r\n defaultErrorMessage: \"The :input year must be higher than :yearOrField\",\r\n async validate(value: Date, context) {\r\n const { yearOrField, scope = \"global\" } = this.context.options;\r\n let compareYear: number;\r\n\r\n if (typeof yearOrField === \"number\") {\r\n compareYear = yearOrField;\r\n this.context.translationParams.yearOrField = yearOrField;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, yearOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.yearOrField = yearOrField;\r\n\r\n // If field contains a date, extract the year\r\n if (fieldValue instanceof Date) {\r\n compareYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareYear = fieldValue;\r\n } else {\r\n // Try to parse as date and extract year\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputYear = inputDate.getFullYear();\r\n\r\n if (inputYear >= compareYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max year rule - year must be <= given year or field\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const maxYearRule: SchemaRule<{\r\n yearOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxYear\",\r\n description: \"The date year must be at most the given year or field\",\r\n defaultErrorMessage: \"The :input year must be at most :yearOrField\",\r\n async validate(value: Date, context) {\r\n const { yearOrField, scope = \"global\" } = this.context.options;\r\n let compareYear: number;\r\n\r\n if (typeof yearOrField === \"number\") {\r\n compareYear = yearOrField;\r\n this.context.translationParams.yearOrField = compareYear;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, yearOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.yearOrField = yearOrField;\r\n\r\n // If field contains a date, extract the year\r\n if (fieldValue instanceof Date) {\r\n compareYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareYear = fieldValue;\r\n } else {\r\n // Try to parse as date and extract year\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputYear = inputDate.getFullYear();\r\n\r\n if (inputYear <= compareYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min month rule - month must be >= given month or field (1-12)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const minMonthRule: SchemaRule<{\r\n monthOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minMonth\",\r\n description: \"The date month must be at least the given month or field\",\r\n defaultErrorMessage: \"The :input month must be at least :monthOrField\",\r\n async validate(value: Date, context) {\r\n const { monthOrField, scope = \"global\" } = this.context.options;\r\n let compareMonth: number;\r\n\r\n if (typeof monthOrField === \"number\") {\r\n compareMonth = monthOrField;\r\n this.context.translationParams.monthOrField = compareMonth;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, monthOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.monthOrField = monthOrField;\r\n\r\n // If field contains a date, extract the month\r\n if (fieldValue instanceof Date) {\r\n compareMonth = fieldValue.getMonth() + 1; // getMonth() returns 0-11\r\n } else if (typeof fieldValue === \"number\") {\r\n compareMonth = fieldValue;\r\n } else {\r\n // Try to parse as date and extract month\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputMonth = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n if (inputMonth >= compareMonth) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max month rule - month must be <= given month or field (1-12)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const maxMonthRule: SchemaRule<{\r\n monthOrField: Month | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxMonth\",\r\n description: \"The date month must be at most the given month or field\",\r\n defaultErrorMessage: \"The :input month must be at most :monthOrField\",\r\n async validate(value: Date, context) {\r\n const { monthOrField, scope = \"global\" } = this.context.options;\r\n let compareMonth: number;\r\n\r\n if (typeof monthOrField === \"number\") {\r\n compareMonth = monthOrField;\r\n this.context.translatableParams.monthOrField = MONTHS[monthOrField];\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, monthOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.monthOrField = monthOrField;\r\n\r\n // If field contains a date, extract the month\r\n if (fieldValue instanceof Date) {\r\n compareMonth = fieldValue.getMonth() + 1; // getMonth() returns 0-11\r\n } else if (typeof fieldValue === \"number\") {\r\n compareMonth = fieldValue;\r\n } else {\r\n // Try to parse as date and extract month\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputMonth = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n if (inputMonth <= compareMonth) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min day rule - day must be >= given day or field (1-31)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const minDayRule: SchemaRule<{\r\n dayOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minDay\",\r\n description: \"The date day must be at least the given day or field\",\r\n defaultErrorMessage: \"The :input day must be higher than :dayOrField\",\r\n async validate(value: Date, context) {\r\n const { dayOrField, scope = \"global\" } = this.context.options;\r\n let compareDay: number;\r\n\r\n if (typeof dayOrField === \"number\") {\r\n compareDay = dayOrField;\r\n this.context.translationParams.dayOrField = dayOrField;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dayOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.dayOrField = dayOrField;\r\n\r\n // If field contains a date, extract the day\r\n if (fieldValue instanceof Date) {\r\n compareDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareDay = fieldValue;\r\n } else {\r\n // Try to parse as date and extract day\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputDay = inputDate.getDate();\r\n\r\n if (inputDay >= compareDay) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max day rule - day must be <= given day or field (1-31)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const maxDayRule: SchemaRule<{\r\n dayOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxDay\",\r\n description: \"The date day must be at most the given day or field\",\r\n defaultErrorMessage: \"The :input day must be at most :dayOrField\",\r\n async validate(value: Date, context) {\r\n const { dayOrField, scope = \"global\" } = this.context.options;\r\n let compareDay: number;\r\n\r\n if (typeof dayOrField === \"number\") {\r\n compareDay = dayOrField;\r\n this.context.translationParams.dayOrField = dayOrField;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dayOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.dayOrField = dayOrField;\r\n\r\n // If field contains a date, extract the day\r\n if (fieldValue instanceof Date) {\r\n compareDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareDay = fieldValue;\r\n } else {\r\n // Try to parse as date and extract day\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputDay = inputDate.getDate();\r\n\r\n if (inputDay <= compareDay) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;AAIA,MAAM,SAAS;CACb,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;;;;AAOA,MAAa,YAA0C;CACrD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAInC,IAFc,IADQ,KAAK,KACL,EAAE,SAAS,IAAI,MAEvB,KAAK,QAAQ,QAAQ,OACjC,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAC9B,OAAO,KAAK,QAAQ,QAAQ;EAC9B,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,WAAyC;CACpD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAInC,IAFa,IADS,KAAK,KACN,EAAE,YAEhB,MAAM,KAAK,QAAQ,QAAQ,MAChC,OAAO;EAGT,KAAK,QAAQ,kBAAkB,OAAO,KAAK,QAAQ,QAAQ;EAC3D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;AAMA,MAAa,mBAIR;CACH,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,EAAE,WAAW,SAAS,QAAQ,aAAa,KAAK,QAAQ;EAE9D,MAAM,YAAY,IADI,KAAK,KACD,EAAE,YAAY;EAGxC,IAAI;EACJ,IAAI,OAAO,cAAc,UACvB,mBAAmB;OACd;GAEL,MAAM,aAAa,IADJ,UAAU,YAAY,QAAQ,SAAS,QAAQ,WAC/B,SAAS;GAExC,IAAI,eAAe,QACjB,OAAO;GAGT,IAAI,sBAAs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KA,IAFiB,IADK,KAAK,KACF,EAAE,QAEhB,KAAK,YACd,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;;AAOA,MAAa,aAGR;CACH,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,EAAE,YAAY,QAAQ,aAAa,KAAK,QAAQ;EACtD,IAAI;EAEJ,IAAI,OAAO,eAAe,UAAU;GAClC,aAAa;GACb,KAAK,QAAQ,kBAAkB,aAAa;EAC9C,OAAO;GAEL,MAAM,aAAa,IADJ,UAAU,YAAY,QAAQ,SAAS,QAAQ,WAC/B,UAAU;GAEzC,IAAI,eAAe,QACjB,OAAO;GAGT,KAAK,QAAQ,mBAAmB,aAAa;GAG7C,IAAI,sBAAsB,MACxB,aAAa,WAAW,QAAQ;QAC3B,IAAI,OAAO,eAAe,UAC/B,aAAa;QACR;IAEL,MAAM,OAAO,IAAI,KAAK,UAAU;IAChC,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,GACvB,aAAa,KAAK,QAAQ;SAE1B,OAAO;GAEX;EACF;EAKA,IAFiB,IADK,KAAK,KACF,EAAE,QAEhB,KAAK,YACd,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
1
+ {"version":3,"file":"date-period-rules.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/date/date-period-rules.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\nconst MONTHS = {\r\n 1: \"january\",\r\n 2: \"february\",\r\n 3: \"march\",\r\n 4: \"april\",\r\n 5: \"may\",\r\n 6: \"june\",\r\n 7: \"july\",\r\n 8: \"august\",\r\n 9: \"september\",\r\n 10: \"october\",\r\n 11: \"november\",\r\n 12: \"december\",\r\n};\r\n\r\nexport type Month = keyof typeof MONTHS;\r\n\r\n/**\r\n * Month rule - date must be in specific month (1-12)\r\n */\r\nexport const monthRule: SchemaRule<{ month: Month }> = {\r\n name: \"month\",\r\n defaultErrorMessage: \"The :input must be in month :month\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const month = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n if (month === this.context.options.month) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.month =\r\n MONTHS[this.context.options.month as keyof typeof MONTHS];\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Year rule - date must be in specific year\r\n */\r\nexport const yearRule: SchemaRule<{ year: number }> = {\r\n name: \"year\",\r\n defaultErrorMessage: \"The :input must be in year :year\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const year = inputDate.getFullYear();\r\n\r\n if (year === this.context.options.year) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.year = this.context.options.year;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between years rule - date must be between start and end years\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenYearsRule: SchemaRule<{\r\n startYear: number | string;\r\n endYear: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenYears\",\r\n defaultErrorMessage: \"The :input must be between :startYear and :endYear\",\r\n async validate(value: Date, context) {\r\n const { startYear, endYear, scope = \"global\" } = this.context.options;\r\n const inputDate = new Date(value);\r\n const inputYear = inputDate.getFullYear();\r\n\r\n // Extract start year\r\n let compareStartYear: number;\r\n if (typeof startYear === \"number\") {\r\n compareStartYear = startYear;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, startYear);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareStartYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareStartYear = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareStartYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n // Extract end year\r\n let compareEndYear: number;\r\n if (typeof endYear === \"number\") {\r\n compareEndYear = endYear;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, endYear);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareEndYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareEndYear = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareEndYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n if (inputYear >= compareStartYear && inputYear <= compareEndYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startYear = compareStartYear;\r\n this.context.translationParams.endYear = compareEndYear;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between months rule - date must be between start and end months (1-12)\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenMonthsRule: SchemaRule<{\r\n startMonth: Month | string;\r\n endMonth: Month | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenMonths\",\r\n defaultErrorMessage: \"The :input must be between month :startMonth and :endMonth\",\r\n async validate(value: Date, context) {\r\n const { startMonth, endMonth, scope = \"global\" } = this.context.options;\r\n const inputDate = new Date(value);\r\n const inputMonth = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n // Extract start month\r\n let compareStartMonth: number;\r\n if (typeof startMonth === \"number\") {\r\n compareStartMonth = startMonth;\r\n this.context.translatableParams.startMonth = MONTHS[compareStartMonth as keyof typeof MONTHS];\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, startMonth);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.startMonth = startMonth;\r\n\r\n if (fieldValue instanceof Date) {\r\n compareStartMonth = fieldValue.getMonth() + 1;\r\n } else if (typeof fieldValue === \"number\") {\r\n compareStartMonth = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareStartMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n // Extract end month\r\n let compareEndMonth: number;\r\n if (typeof endMonth === \"number\") {\r\n compareEndMonth = endMonth;\r\n this.context.translatableParams.endMonth = MONTHS[compareEndMonth as keyof typeof MONTHS];\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, endMonth);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.endMonth = endMonth;\r\n\r\n if (fieldValue instanceof Date) {\r\n compareEndMonth = fieldValue.getMonth() + 1;\r\n } else if (typeof fieldValue === \"number\") {\r\n compareEndMonth = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareEndMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n if (inputMonth >= compareStartMonth && inputMonth <= compareEndMonth) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between days rule - date must be between start and end days (1-31)\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenDaysRule: SchemaRule<{\r\n startDay: number | string;\r\n endDay: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenDays\",\r\n defaultErrorMessage: \"The :input must be between day :startDay and :endDay\",\r\n async validate(value: Date, context) {\r\n const { startDay, endDay, scope = \"global\" } = this.context.options;\r\n const inputDate = new Date(value);\r\n const inputDay = inputDate.getDate();\r\n\r\n // Extract start day\r\n let compareStartDay: number;\r\n if (typeof startDay === \"number\") {\r\n compareStartDay = startDay;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, startDay);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareStartDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareStartDay = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareStartDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n // Extract end day\r\n let compareEndDay: number;\r\n if (typeof endDay === \"number\") {\r\n compareEndDay = endDay;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, endDay);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareEndDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareEndDay = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareEndDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n if (inputDay >= compareStartDay && inputDay <= compareEndDay) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startDay = compareStartDay;\r\n this.context.translationParams.endDay = compareEndDay;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Quarter rule - date must be in specific quarter (1-4)\r\n */\r\nexport const quarterRule: SchemaRule<{ quarter: 1 | 2 | 3 | 4 }> = {\r\n name: \"quarter\",\r\n defaultErrorMessage: \"The :input must be in quarter :quarter\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const month = inputDate.getMonth() + 1;\r\n const quarter = Math.ceil(month / 3);\r\n\r\n if (quarter === this.context.options.quarter) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.quarter = this.context.options.quarter;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between times rule - time must be between start and end times (HH:MM format)\r\n */\r\nexport const betweenTimesRule: SchemaRule<{\r\n startTime: string;\r\n endTime: string;\r\n}> = {\r\n name: \"betweenTimes\",\r\n defaultErrorMessage: \"The :input must be between :startTime and :endTime\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const inputHour = inputDate.getHours();\r\n const inputMinute = inputDate.getMinutes();\r\n const inputTimeInMinutes = inputHour * 60 + inputMinute;\r\n\r\n const { startTime, endTime } = this.context.options;\r\n\r\n // Parse start time\r\n const [startHour, startMinute] = startTime.split(\":\").map(Number);\r\n const startTimeInMinutes = startHour * 60 + startMinute;\r\n\r\n // Parse end time\r\n const [endHour, endMinute] = endTime.split(\":\").map(Number);\r\n const endTimeInMinutes = endHour * 60 + endMinute;\r\n\r\n if (inputTimeInMinutes >= startTimeInMinutes && inputTimeInMinutes <= endTimeInMinutes) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startTime = startTime;\r\n this.context.translationParams.endTime = endTime;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min year rule - year must be >= given year or field\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const minYearRule: SchemaRule<{\r\n yearOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minYear\",\r\n description: \"The date year must be at least the given year or field\",\r\n defaultErrorMessage: \"The :input year must be higher than :yearOrField\",\r\n async validate(value: Date, context) {\r\n const { yearOrField, scope = \"global\" } = this.context.options;\r\n let compareYear: number;\r\n\r\n if (typeof yearOrField === \"number\") {\r\n compareYear = yearOrField;\r\n this.context.translationParams.yearOrField = yearOrField;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, yearOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.yearOrField = yearOrField;\r\n\r\n // If field contains a date, extract the year\r\n if (fieldValue instanceof Date) {\r\n compareYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareYear = fieldValue;\r\n } else {\r\n // Try to parse as date and extract year\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputYear = inputDate.getFullYear();\r\n\r\n if (inputYear >= compareYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max year rule - year must be <= given year or field\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const maxYearRule: SchemaRule<{\r\n yearOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxYear\",\r\n description: \"The date year must be at most the given year or field\",\r\n defaultErrorMessage: \"The :input year must be at most :yearOrField\",\r\n async validate(value: Date, context) {\r\n const { yearOrField, scope = \"global\" } = this.context.options;\r\n let compareYear: number;\r\n\r\n if (typeof yearOrField === \"number\") {\r\n compareYear = yearOrField;\r\n this.context.translationParams.yearOrField = compareYear;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, yearOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.yearOrField = yearOrField;\r\n\r\n // If field contains a date, extract the year\r\n if (fieldValue instanceof Date) {\r\n compareYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareYear = fieldValue;\r\n } else {\r\n // Try to parse as date and extract year\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputYear = inputDate.getFullYear();\r\n\r\n if (inputYear <= compareYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min month rule - month must be >= given month or field (1-12)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const minMonthRule: SchemaRule<{\r\n monthOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minMonth\",\r\n description: \"The date month must be at least the given month or field\",\r\n defaultErrorMessage: \"The :input month must be at least :monthOrField\",\r\n async validate(value: Date, context) {\r\n const { monthOrField, scope = \"global\" } = this.context.options;\r\n let compareMonth: number;\r\n\r\n if (typeof monthOrField === \"number\") {\r\n compareMonth = monthOrField;\r\n this.context.translationParams.monthOrField = compareMonth;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, monthOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.monthOrField = monthOrField;\r\n\r\n // If field contains a date, extract the month\r\n if (fieldValue instanceof Date) {\r\n compareMonth = fieldValue.getMonth() + 1; // getMonth() returns 0-11\r\n } else if (typeof fieldValue === \"number\") {\r\n compareMonth = fieldValue;\r\n } else {\r\n // Try to parse as date and extract month\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputMonth = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n if (inputMonth >= compareMonth) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max month rule - month must be <= given month or field (1-12)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const maxMonthRule: SchemaRule<{\r\n monthOrField: Month | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxMonth\",\r\n description: \"The date month must be at most the given month or field\",\r\n defaultErrorMessage: \"The :input month must be at most :monthOrField\",\r\n async validate(value: Date, context) {\r\n const { monthOrField, scope = \"global\" } = this.context.options;\r\n let compareMonth: number;\r\n\r\n if (typeof monthOrField === \"number\") {\r\n compareMonth = monthOrField;\r\n this.context.translatableParams.monthOrField = MONTHS[monthOrField];\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, monthOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.monthOrField = monthOrField;\r\n\r\n // If field contains a date, extract the month\r\n if (fieldValue instanceof Date) {\r\n compareMonth = fieldValue.getMonth() + 1; // getMonth() returns 0-11\r\n } else if (typeof fieldValue === \"number\") {\r\n compareMonth = fieldValue;\r\n } else {\r\n // Try to parse as date and extract month\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputMonth = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n if (inputMonth <= compareMonth) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min day rule - day must be >= given day or field (1-31)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const minDayRule: SchemaRule<{\r\n dayOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minDay\",\r\n description: \"The date day must be at least the given day or field\",\r\n defaultErrorMessage: \"The :input day must be higher than :dayOrField\",\r\n async validate(value: Date, context) {\r\n const { dayOrField, scope = \"global\" } = this.context.options;\r\n let compareDay: number;\r\n\r\n if (typeof dayOrField === \"number\") {\r\n compareDay = dayOrField;\r\n this.context.translationParams.dayOrField = dayOrField;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dayOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.dayOrField = dayOrField;\r\n\r\n // If field contains a date, extract the day\r\n if (fieldValue instanceof Date) {\r\n compareDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareDay = fieldValue;\r\n } else {\r\n // Try to parse as date and extract day\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputDay = inputDate.getDate();\r\n\r\n if (inputDay >= compareDay) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max day rule - day must be <= given day or field (1-31)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const maxDayRule: SchemaRule<{\r\n dayOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxDay\",\r\n description: \"The date day must be at most the given day or field\",\r\n defaultErrorMessage: \"The :input day must be at most :dayOrField\",\r\n async validate(value: Date, context) {\r\n const { dayOrField, scope = \"global\" } = this.context.options;\r\n let compareDay: number;\r\n\r\n if (typeof dayOrField === \"number\") {\r\n compareDay = dayOrField;\r\n this.context.translationParams.dayOrField = dayOrField;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dayOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.dayOrField = dayOrField;\r\n\r\n // If field contains a date, extract the day\r\n if (fieldValue instanceof Date) {\r\n compareDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareDay = fieldValue;\r\n } else {\r\n // Try to parse as date and extract day\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputDay = inputDate.getDate();\r\n\r\n if (inputDay <= compareDay) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;AAIA,MAAM,SAAS;CACb,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;;;;AAOA,MAAa,YAA0C;CACrD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAInC,IAFc,IADQ,KAAK,KACL,CAAC,CAAC,SAAS,IAAI,MAEvB,KAAK,QAAQ,QAAQ,OACjC,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAC9B,OAAO,KAAK,QAAQ,QAAQ;EAC9B,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,WAAyC;CACpD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAInC,IAFa,IADS,KAAK,KACN,CAAC,CAAC,YAEhB,MAAM,KAAK,QAAQ,QAAQ,MAChC,OAAO;EAGT,KAAK,QAAQ,kBAAkB,OAAO,KAAK,QAAQ,QAAQ;EAC3D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;AAMA,MAAa,mBAIR;CACH,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,EAAE,WAAW,SAAS,QAAQ,aAAa,KAAK,QAAQ;EAE9D,MAAM,YAAY,IADI,KAAK,KACD,CAAC,CAAC,YAAY;EAGxC,IAAI;EACJ,IAAI,OAAO,cAAc,UACvB,mBAAmB;OACd;GAEL,MAAM,aAAa,IADJ,UAAU,YAAY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;QACR;IAEL,MAAM,OAAO,IAAI,KAAK,UAAU;IAChC,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,GACvB,aAAa,KAAK,QAAQ;SAE1B,OAAO;GAEX;EACF;EAKA,IAFiB,IADK,KAAK,KACF,CAAC,CAAC,QAEhB,KAAK,YACd,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;;AAOA,MAAa,aAGR;CACH,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,EAAE,YAAY,QAAQ,aAAa,KAAK,QAAQ;EACtD,IAAI;EAEJ,IAAI,OAAO,eAAe,UAAU;GAClC,aAAa;GACb,KAAK,QAAQ,kBAAkB,aAAa;EAC9C,OAAO;GAEL,MAAM,aAAa,IADJ,UAAU,YAAY,QAAQ,SAAS,QAAQ,WAC/B,UAAU;GAEzC,IAAI,eAAe,QACjB,OAAO;GAGT,KAAK,QAAQ,mBAAmB,aAAa;GAG7C,IAAI,sBAAsB,MACxB,aAAa,WAAW,QAAQ;QAC3B,IAAI,OAAO,eAAe,UAC/B,aAAa;QACR;IAEL,MAAM,OAAO,IAAI,KAAK,UAAU;IAChC,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,GACvB,aAAa,KAAK,QAAQ;SAE1B,OAAO;GAEX;EACF;EAKA,IAFiB,IADK,KAAK,KACF,CAAC,CAAC,QAEhB,KAAK,YACd,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"date-special-rules.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/date/date-special-rules.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Birthday rule - valid birthday (not in future, reasonable age)\r\n */\r\nexport const birthdayRule: SchemaRule<{ minAge?: number; maxAge?: number }> = {\r\n name: \"birthday\",\r\n defaultErrorMessage: \"The :input must be a valid birthday\",\r\n async validate(birthDate: Date, context) {\r\n const today = new Date();\r\n\r\n // Must not be in the future\r\n if (birthDate > today) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Calculate age\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n // Check minimum age (default: 0)\r\n const minAge = this.context.options.minAge ?? 0;\r\n if (age < minAge) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Check maximum age (default: 150)\r\n const maxAge = this.context.options.maxAge ?? 150;\r\n if (age > maxAge) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Between age rule - age must be between min and max years\r\n */\r\nexport const betweenAgeRule: SchemaRule<{ minAge: number; maxAge: number }> = {\r\n name: \"betweenAge\",\r\n defaultErrorMessage: \"Age must be between :minAge and :maxAge years\",\r\n async validate(value: Date, context) {\r\n const birthDate = new Date(value);\r\n const today = new Date();\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n const { minAge, maxAge } = this.context.options;\r\n\r\n if (age >= minAge && age <= maxAge) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minAge = minAge;\r\n this.context.translationParams.maxAge = maxAge;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Leap year rule - date must be in a leap year\r\n */\r\nexport const leapYearRule: SchemaRule = {\r\n name: \"leapYear\",\r\n defaultErrorMessage: \"The :input must be in a leap year\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const year = inputDate.getFullYear();\r\n\r\n // Leap year logic: divisible by 4, except century years unless divisible by 400\r\n const isLeapYear = (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\r\n\r\n if (isLeapYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAMA,MAAa,eAAiE;CAC5E,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,WAAiB,SAAS;EACvC,MAAM,wBAAQ,IAAI,KAAK;EAGvB,IAAI,YAAY,OACd,OAAO,YAAY,MAAM,OAAO;EAIlC,IAAI,MAAM,MAAM,YAAY,IAAI,UAAU,YAAY;EACtD,MAAM,YAAY,MAAM,SAAS,IAAI,UAAU,SAAS;EAExD,IAAI,YAAY,KAAM,cAAc,KAAK,MAAM,QAAQ,IAAI,UAAU,QAAQ,GAC3E;EAIF,MAAM,SAAS,KAAK,QAAQ,QAAQ,UAAU;EAC9C,IAAI,MAAM,QACR,OAAO,YAAY,MAAM,OAAO;EAIlC,MAAM,SAAS,KAAK,QAAQ,QAAQ,UAAU;EAC9C,IAAI,MAAM,QACR,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,iBAAiE;CAC5E,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,YAAY,IAAI,KAAK,KAAK;EAChC,MAAM,wBAAQ,IAAI,KAAK;EACvB,IAAI,MAAM,MAAM,YAAY,IAAI,UAAU,YAAY;EACtD,MAAM,YAAY,MAAM,SAAS,IAAI,UAAU,SAAS;EAExD,IAAI,YAAY,KAAM,cAAc,KAAK,MAAM,QAAQ,IAAI,UAAU,QAAQ,GAC3E;EAGF,MAAM,EAAE,QAAQ,WAAW,KAAK,QAAQ;EAExC,IAAI,OAAO,UAAU,OAAO,QAC1B,OAAO;EAGT,KAAK,QAAQ,kBAAkB,SAAS;EACxC,KAAK,QAAQ,kBAAkB,SAAS;EAExC,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,eAA2B;CACtC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAEnC,MAAM,OAAO,IADS,KAAK,KACN,EAAE,YAAY;EAKnC,IAFoB,OAAO,MAAM,KAAK,OAAO,QAAQ,KAAM,OAAO,QAAQ,GAGxE,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
1
+ {"version":3,"file":"date-special-rules.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/date/date-special-rules.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Birthday rule - valid birthday (not in future, reasonable age)\r\n */\r\nexport const birthdayRule: SchemaRule<{ minAge?: number; maxAge?: number }> = {\r\n name: \"birthday\",\r\n defaultErrorMessage: \"The :input must be a valid birthday\",\r\n async validate(birthDate: Date, context) {\r\n const today = new Date();\r\n\r\n // Must not be in the future\r\n if (birthDate > today) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Calculate age\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n // Check minimum age (default: 0)\r\n const minAge = this.context.options.minAge ?? 0;\r\n if (age < minAge) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Check maximum age (default: 150)\r\n const maxAge = this.context.options.maxAge ?? 150;\r\n if (age > maxAge) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Between age rule - age must be between min and max years\r\n */\r\nexport const betweenAgeRule: SchemaRule<{ minAge: number; maxAge: number }> = {\r\n name: \"betweenAge\",\r\n defaultErrorMessage: \"Age must be between :minAge and :maxAge years\",\r\n async validate(value: Date, context) {\r\n const birthDate = new Date(value);\r\n const today = new Date();\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n const { minAge, maxAge } = this.context.options;\r\n\r\n if (age >= minAge && age <= maxAge) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minAge = minAge;\r\n this.context.translationParams.maxAge = maxAge;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Leap year rule - date must be in a leap year\r\n */\r\nexport const leapYearRule: SchemaRule = {\r\n name: \"leapYear\",\r\n defaultErrorMessage: \"The :input must be in a leap year\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const year = inputDate.getFullYear();\r\n\r\n // Leap year logic: divisible by 4, except century years unless divisible by 400\r\n const isLeapYear = (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\r\n\r\n if (isLeapYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAMA,MAAa,eAAiE;CAC5E,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,WAAiB,SAAS;EACvC,MAAM,wBAAQ,IAAI,KAAK;EAGvB,IAAI,YAAY,OACd,OAAO,YAAY,MAAM,OAAO;EAIlC,IAAI,MAAM,MAAM,YAAY,IAAI,UAAU,YAAY;EACtD,MAAM,YAAY,MAAM,SAAS,IAAI,UAAU,SAAS;EAExD,IAAI,YAAY,KAAM,cAAc,KAAK,MAAM,QAAQ,IAAI,UAAU,QAAQ,GAC3E;EAIF,MAAM,SAAS,KAAK,QAAQ,QAAQ,UAAU;EAC9C,IAAI,MAAM,QACR,OAAO,YAAY,MAAM,OAAO;EAIlC,MAAM,SAAS,KAAK,QAAQ,QAAQ,UAAU;EAC9C,IAAI,MAAM,QACR,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,iBAAiE;CAC5E,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,YAAY,IAAI,KAAK,KAAK;EAChC,MAAM,wBAAQ,IAAI,KAAK;EACvB,IAAI,MAAM,MAAM,YAAY,IAAI,UAAU,YAAY;EACtD,MAAM,YAAY,MAAM,SAAS,IAAI,UAAU,SAAS;EAExD,IAAI,YAAY,KAAM,cAAc,KAAK,MAAM,QAAQ,IAAI,UAAU,QAAQ,GAC3E;EAGF,MAAM,EAAE,QAAQ,WAAW,KAAK,QAAQ;EAExC,IAAI,OAAO,UAAU,OAAO,QAC1B,OAAO;EAGT,KAAK,QAAQ,kBAAkB,SAAS;EACxC,KAAK,QAAQ,kBAAkB,SAAS;EAExC,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,eAA2B;CACtC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAEnC,MAAM,OAAO,IADS,KAAK,KACN,CAAC,CAAC,YAAY;EAKnC,IAFoB,OAAO,MAAM,KAAK,OAAO,QAAQ,KAAM,OAAO,QAAQ,GAGxE,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"date.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/date/date.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isDateValue } from \"../../helpers/date-helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport type { WeekDay } from \"../../types/date-types\";\r\nimport { WEEK_DAYS } from \"../../types/date-types\";\r\n\r\n/**\r\n * Date rule - validates date format\r\n */\r\nexport const dateRule: SchemaRule = {\r\n name: \"date\",\r\n defaultErrorMessage: \"The :input must be a valid date\",\r\n async validate(value: any, context) {\r\n if (value instanceof Date && !isNaN(value.getTime())) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min date rule - date must be >= given date or field\r\n * Smart detection: date value or field name\r\n */\r\nexport const minDateRule: SchemaRule<{\r\n dateOrField: Date | string | number;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minDate\",\r\n description: \"The field must be at least the given date or field\",\r\n defaultErrorMessage: \"The :input must be at least :dateOrField\",\r\n async validate(value: Date, context) {\r\n const { dateOrField, scope = \"global\" } = this.context.options;\r\n let compareDate: Date;\r\n\r\n if (isDateValue(dateOrField)) {\r\n // Value comparison\r\n compareDate = new Date(dateOrField);\r\n } else {\r\n // Field comparison\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dateOrField as string);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n compareDate = new Date(fieldValue);\r\n }\r\n\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate >= compareDate) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max date rule - date must be <= given date or field\r\n * Smart detection: date value or field name\r\n */\r\nexport const maxDateRule: SchemaRule<{\r\n dateOrField: Date | string | number;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxDate\",\r\n defaultErrorMessage: \"The :input must be at most :dateOrField\",\r\n async validate(value: Date, context) {\r\n const { dateOrField, scope = \"global\" } = this.context.options;\r\n let compareDate: Date;\r\n\r\n if (isDateValue(dateOrField)) {\r\n // Value comparison\r\n compareDate = new Date(dateOrField);\r\n } else {\r\n // Field comparison\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dateOrField as string);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n compareDate = new Date(fieldValue);\r\n }\r\n\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate <= compareDate) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * From today rule - date must be today or in the future\r\n */\r\nexport const fromTodayRule: SchemaRule = {\r\n name: \"fromToday\",\r\n defaultErrorMessage: \"The :input must be today or in the future\",\r\n async validate(value: Date, context) {\r\n const today = new Date();\r\n today.setHours(0, 0, 0, 0);\r\n const inputDate = new Date(value);\r\n inputDate.setHours(0, 0, 0, 0);\r\n\r\n if (inputDate >= today) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Before today rule - date must be before today\r\n */\r\nexport const beforeTodayRule: SchemaRule = {\r\n name: \"beforeToday\",\r\n defaultErrorMessage: \"The :input must be before today\",\r\n async validate(value: Date, context) {\r\n const today = new Date();\r\n today.setHours(0, 0, 0, 0);\r\n const inputDate = new Date(value);\r\n inputDate.setHours(0, 0, 0, 0);\r\n\r\n if (inputDate < today) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * From hour rule - time must be from specific hour onwards\r\n */\r\nexport const fromHourRule: SchemaRule<{ hour: number }> = {\r\n name: \"fromHour\",\r\n defaultErrorMessage: \"The :input must be from :hour:00 onwards\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const hour = inputDate.getHours();\r\n\r\n if (hour >= this.context.options.hour) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.hour = this.context.options.hour;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Before hour rule - time must be before specific hour\r\n */\r\nexport const beforeHourRule: SchemaRule<{ hour: number }> = {\r\n name: \"beforeHour\",\r\n defaultErrorMessage: \"The :input must be before :hour:00\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const hour = inputDate.getHours();\r\n\r\n if (hour < this.context.options.hour) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.hour = this.context.options.hour;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between hours rule - time must be between start and end hours\r\n */\r\nexport const betweenHoursRule: SchemaRule<{\r\n startHour: number;\r\n endHour: number;\r\n}> = {\r\n name: \"betweenHours\",\r\n defaultErrorMessage: \"The :input must be between :startHour:00 and :endHour:00\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const hour = inputDate.getHours();\r\n const { startHour, endHour } = this.context.options;\r\n\r\n if (hour >= startHour && hour <= endHour) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startHour = startHour;\r\n this.context.translationParams.endHour = endHour;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * From minute rule - time must be from specific minute onwards\r\n */\r\nexport const fromMinuteRule: SchemaRule<{ minute: number }> = {\r\n name: \"fromMinute\",\r\n defaultErrorMessage: \"The :input must be from minute :minute onwards\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const minute = inputDate.getMinutes();\r\n\r\n if (minute >= this.context.options.minute) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minute = this.context.options.minute;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Before minute rule - time must be before specific minute\r\n */\r\nexport const beforeMinuteRule: SchemaRule<{ minute: number }> = {\r\n name: \"beforeMinute\",\r\n defaultErrorMessage: \"The :input must be before minute :minute\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const minute = inputDate.getMinutes();\r\n\r\n if (minute < this.context.options.minute) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minute = this.context.options.minute;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between minutes rule - time must be between start and end minutes\r\n */\r\nexport const betweenMinutesRule: SchemaRule<{\r\n startMinute: number;\r\n endMinute: number;\r\n}> = {\r\n name: \"betweenMinutes\",\r\n defaultErrorMessage: \"The :input must be between minute :startMinute and :endMinute\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const minute = inputDate.getMinutes();\r\n const { startMinute, endMinute } = this.context.options;\r\n\r\n if (minute >= startMinute && minute <= endMinute) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startMinute = startMinute;\r\n this.context.translationParams.endMinute = endMinute;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Age rule - calculate age from date\r\n */\r\nexport const ageRule: SchemaRule<{ years: number }> = {\r\n name: \"age\",\r\n defaultErrorMessage: \"The :input must be exactly :years years old\",\r\n async validate(value: Date, context) {\r\n const birthDate = new Date(value);\r\n const today = new Date();\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n if (age === this.context.options.years) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.years = this.context.options.years;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min age rule - minimum age requirement\r\n */\r\nexport const minAgeRule: SchemaRule<{ years: number }> = {\r\n name: \"minAge\",\r\n defaultErrorMessage: \"The :input must be at least :years years old\",\r\n async validate(value: Date, context) {\r\n const birthDate = new Date(value);\r\n const today = new Date();\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n if (age >= this.context.options.years) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.years = this.context.options.years;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max age rule - maximum age requirement\r\n */\r\nexport const maxAgeRule: SchemaRule<{ years: number }> = {\r\n name: \"maxAge\",\r\n defaultErrorMessage: \"The :input must be at most :years years old\",\r\n async validate(value: Date, context) {\r\n const birthDate = new Date(value);\r\n const today = new Date();\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n if (age <= this.context.options.years) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.years = this.context.options.years;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Week day rule - date must be specific weekday\r\n */\r\nexport const weekDayRule: SchemaRule<{ day: WeekDay }> = {\r\n name: \"weekDay\",\r\n defaultErrorMessage: \"The :input must be a :day\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n const expectedDay = WEEK_DAYS[this.context.options.day];\r\n\r\n if (dayOfWeek === expectedDay) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.day = this.context.options.day;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;;;;AAUA,MAAa,WAAuB;CAClC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,iBAAiB,QAAQ,CAAC,MAAM,MAAM,QAAQ,CAAC,GACjD,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;AAMA,MAAa,cAGR;CACH,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,EAAE,aAAa,QAAQ,aAAa,KAAK,QAAQ;EACvD,IAAI;EAEJ,IAAI,YAAY,WAAW,GAEzB,cAAc,IAAI,KAAK,WAAW;OAC7B;GAGL,MAAM,aAAa,IADJ,UAAU,YAAY,QAAQ,SAAS,QAAQ,WAC/B,WAAqB;GAEpD,IAAI,eAAe,QACjB,OAAO;GAGT,cAAc,IAAI,KAAK,UAAU;EACnC;EAIA,IAAI,IAFkB,KAAK,KAEf,KAAK,aACf,OAAO;EAET,OAAO,YAAY,MAAM,O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ACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,YAAY,IAAI,KAAK,KAAK;EAChC,MAAM,wBAAQ,IAAI,KAAK;EACvB,IAAI,MAAM,MAAM,YAAY,IAAI,UAAU,YAAY;EACtD,MAAM,YAAY,MAAM,SAAS,IAAI,UAAU,SAAS;EAExD,IAAI,YAAY,KAAM,cAAc,KAAK,MAAM,QAAQ,IAAI,UAAU,QAAQ,GAC3E;EAGF,IAAI,OAAO,KAAK,QAAQ,QAAQ,OAC9B,OAAO;EAGT,KAAK,QAAQ,kBAAkB,QAAQ,KAAK,QAAQ,QAAQ;EAE5D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,cAA4C;CACvD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAKnC,IAHkB,IADI,KAAK,KACD,EAAE,OAGhB,MAFQ,UAAU,KAAK,QAAQ,QAAQ,MAGjD,OAAO;EAGT,KAAK,QAAQ,mBAAmB,MAAM,KAAK,QAAQ,QAAQ;EAE3D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
1
+ {"version":3,"file":"date.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/date/date.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isDateValue } from \"../../helpers/date-helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport type { WeekDay } from \"../../types/date-types\";\r\nimport { WEEK_DAYS } from \"../../types/date-types\";\r\n\r\n/**\r\n * Date rule - validates date format\r\n */\r\nexport const dateRule: SchemaRule = {\r\n name: \"date\",\r\n defaultErrorMessage: \"The :input must be a valid date\",\r\n async validate(value: any, context) {\r\n if (value instanceof Date && !isNaN(value.getTime())) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min date rule - date must be >= given date or field\r\n * Smart detection: date value or field name\r\n */\r\nexport const minDateRule: SchemaRule<{\r\n dateOrField: Date | string | number;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minDate\",\r\n description: \"The field must be at least the given date or field\",\r\n defaultErrorMessage: \"The :input must be at least :dateOrField\",\r\n async validate(value: Date, context) {\r\n const { dateOrField, scope = \"global\" } = this.context.options;\r\n let compareDate: Date;\r\n\r\n if (isDateValue(dateOrField)) {\r\n // Value comparison\r\n compareDate = new Date(dateOrField);\r\n } else {\r\n // Field comparison\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dateOrField as string);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n compareDate = new Date(fieldValue);\r\n }\r\n\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate >= compareDate) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max date rule - date must be <= given date or field\r\n * Smart detection: date value or field name\r\n */\r\nexport const maxDateRule: SchemaRule<{\r\n dateOrField: Date | string | number;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxDate\",\r\n defaultErrorMessage: \"The :input must be at most :dateOrField\",\r\n async validate(value: Date, context) {\r\n const { dateOrField, scope = \"global\" } = this.context.options;\r\n let compareDate: Date;\r\n\r\n if (isDateValue(dateOrField)) {\r\n // Value comparison\r\n compareDate = new Date(dateOrField);\r\n } else {\r\n // Field comparison\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dateOrField as string);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n compareDate = new Date(fieldValue);\r\n }\r\n\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate <= compareDate) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * From today rule - date must be today or in the future\r\n */\r\nexport const fromTodayRule: SchemaRule = {\r\n name: \"fromToday\",\r\n defaultErrorMessage: \"The :input must be today or in the future\",\r\n async validate(value: Date, context) {\r\n const today = new Date();\r\n today.setHours(0, 0, 0, 0);\r\n const inputDate = new Date(value);\r\n inputDate.setHours(0, 0, 0, 0);\r\n\r\n if (inputDate >= today) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Before today rule - date must be before today\r\n */\r\nexport const beforeTodayRule: SchemaRule = {\r\n name: \"beforeToday\",\r\n defaultErrorMessage: \"The :input must be before today\",\r\n async validate(value: Date, context) {\r\n const today = new Date();\r\n today.setHours(0, 0, 0, 0);\r\n const inputDate = new Date(value);\r\n inputDate.setHours(0, 0, 0, 0);\r\n\r\n if (inputDate < today) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * From hour rule - time must be from specific hour onwards\r\n */\r\nexport const fromHourRule: SchemaRule<{ hour: number }> = {\r\n name: \"fromHour\",\r\n defaultErrorMessage: \"The :input must be from :hour:00 onwards\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const hour = inputDate.getHours();\r\n\r\n if (hour >= this.context.options.hour) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.hour = this.context.options.hour;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Before hour rule - time must be before specific hour\r\n */\r\nexport const beforeHourRule: SchemaRule<{ hour: number }> = {\r\n name: \"beforeHour\",\r\n defaultErrorMessage: \"The :input must be before :hour:00\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const hour = inputDate.getHours();\r\n\r\n if (hour < this.context.options.hour) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.hour = this.context.options.hour;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between hours rule - time must be between start and end hours\r\n */\r\nexport const betweenHoursRule: SchemaRule<{\r\n startHour: number;\r\n endHour: number;\r\n}> = {\r\n name: \"betweenHours\",\r\n defaultErrorMessage: \"The :input must be between :startHour:00 and :endHour:00\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const hour = inputDate.getHours();\r\n const { startHour, endHour } = this.context.options;\r\n\r\n if (hour >= startHour && hour <= endHour) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startHour = startHour;\r\n this.context.translationParams.endHour = endHour;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * From minute rule - time must be from specific minute onwards\r\n */\r\nexport const fromMinuteRule: SchemaRule<{ minute: number }> = {\r\n name: \"fromMinute\",\r\n defaultErrorMessage: \"The :input must be from minute :minute onwards\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const minute = inputDate.getMinutes();\r\n\r\n if (minute >= this.context.options.minute) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minute = this.context.options.minute;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Before minute rule - time must be before specific minute\r\n */\r\nexport const beforeMinuteRule: SchemaRule<{ minute: number }> = {\r\n name: \"beforeMinute\",\r\n defaultErrorMessage: \"The :input must be before minute :minute\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const minute = inputDate.getMinutes();\r\n\r\n if (minute < this.context.options.minute) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minute = this.context.options.minute;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between minutes rule - time must be between start and end minutes\r\n */\r\nexport const betweenMinutesRule: SchemaRule<{\r\n startMinute: number;\r\n endMinute: number;\r\n}> = {\r\n name: \"betweenMinutes\",\r\n defaultErrorMessage: \"The :input must be between minute :startMinute and :endMinute\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const minute = inputDate.getMinutes();\r\n const { startMinute, endMinute } = this.context.options;\r\n\r\n if (minute >= startMinute && minute <= endMinute) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startMinute = startMinute;\r\n this.context.translationParams.endMinute = endMinute;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Age rule - calculate age from date\r\n */\r\nexport const ageRule: SchemaRule<{ years: number }> = {\r\n name: \"age\",\r\n defaultErrorMessage: \"The :input must be exactly :years years old\",\r\n async validate(value: Date, context) {\r\n const birthDate = new Date(value);\r\n const today = new Date();\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n if (age === this.context.options.years) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.years = this.context.options.years;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min age rule - minimum age requirement\r\n */\r\nexport const minAgeRule: SchemaRule<{ years: number }> = {\r\n name: \"minAge\",\r\n defaultErrorMessage: \"The :input must be at least :years years old\",\r\n async validate(value: Date, context) {\r\n const birthDate = new Date(value);\r\n const today = new Date();\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n if (age >= this.context.options.years) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.years = this.context.options.years;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max age rule - maximum age requirement\r\n */\r\nexport const maxAgeRule: SchemaRule<{ years: number }> = {\r\n name: \"maxAge\",\r\n defaultErrorMessage: \"The :input must be at most :years years old\",\r\n async validate(value: Date, context) {\r\n const birthDate = new Date(value);\r\n const today = new Date();\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n if (age <= this.context.options.years) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.years = this.context.options.years;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Week day rule - date must be specific weekday\r\n */\r\nexport const weekDayRule: SchemaRule<{ day: WeekDay }> = {\r\n name: \"weekDay\",\r\n defaultErrorMessage: \"The :input must be a :day\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n const expectedDay = WEEK_DAYS[this.context.options.day];\r\n\r\n if (dayOfWeek === expectedDay) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.day = this.context.options.day;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;;;;AAUA,MAAa,WAAuB;CAClC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,iBAAiB,QAAQ,CAAC,MAAM,MAAM,QAAQ,CAAC,GACjD,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;AAMA,MAAa,cAGR;CACH,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,EAAE,aAAa,QAAQ,aAAa,KAAK,QAAQ;EACvD,IAAI;EAEJ,IAAI,YAAY,WAAW,GAEzB,cAAc,IAAI,KAAK,WAAW;OAC7B;GAGL,MAAM,aAAa,IADJ,UAAU,YAAY,QAAQ,SAAS,QAAQ,WAC/B,WAAqB;GAEpD,IAAI,eAAe,QACjB,OAAO;GAGT,cAAc,IAAI,KAAK,UAAU;EACnC;EAIA,IAAI,IAFkB,KAAK,KAEf,KAAK,aACf,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;AAMA,MAAa,cAGR;CACH,MAAM;CACN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,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,YAAY,IAAI,KAAK,KAAK;EAChC,MAAM,wBAAQ,IAAI,KAAK;EACvB,IAAI,MAAM,MAAM,YAAY,IAAI,UAAU,YAAY;EACtD,MAAM,YAAY,MAAM,SAAS,IAAI,UAAU,SAAS;EAExD,IAAI,YAAY,KAAM,cAAc,KAAK,MAAM,QAAQ,IAAI,UAAU,QAAQ,GAC3E;EAGF,IAAI,OAAO,KAAK,QAAQ,QAAQ,OAC9B,OAAO;EAGT,KAAK,QAAQ,kBAAkB,QAAQ,KAAK,QAAQ,QAAQ;EAE5D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,cAA4C;CACvD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAKnC,IAHkB,IADI,KAAK,KACD,CAAC,CAAC,OAGhB,MAFQ,UAAU,KAAK,QAAQ,QAAQ,MAGjD,OAAO;EAGT,KAAK,QAAQ,mBAAmB,MAAM,KAAK,QAAQ,QAAQ;EAE3D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"dimensions.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/file/dimensions.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Min width rule - image width validation\r\n */\r\nexport const minWidthRule: SchemaRule<{ minWidth: number }> = {\r\n name: \"minWidth\",\r\n defaultErrorMessage: \"The :input must be at least :minWidth pixels wide\",\r\n async validate(value: any, context) {\r\n const dimensions = await value.dimensions();\r\n\r\n if (dimensions.width >= this.context.options.minWidth) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minWidth = this.context.options.minWidth;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max width rule - image width validation\r\n */\r\nexport const maxWidthRule: SchemaRule<{ maxWidth: number }> = {\r\n name: \"maxWidth\",\r\n defaultErrorMessage: \"The :input must be at most :maxWidth pixels wide\",\r\n async validate(value: any, context) {\r\n const dimensions = await value.dimensions();\r\n\r\n if (dimensions.width <= this.context.options.maxWidth) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.maxWidth = this.context.options.maxWidth;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min height rule - image height validation\r\n */\r\nexport const minHeightRule: SchemaRule<{ minHeight: number }> = {\r\n name: \"minHeight\",\r\n defaultErrorMessage: \"The :input must be at least :minHeight pixels tall\",\r\n async validate(value: any, context) {\r\n const dimensions = await value.dimensions();\r\n\r\n if (dimensions.height >= this.context.options.minHeight) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minHeight = this.context.options.minHeight;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max height rule - image height validation\r\n */\r\nexport const maxHeightRule: SchemaRule<{ maxHeight: number }> = {\r\n name: \"maxHeight\",\r\n defaultErrorMessage: \"The :input must be at most :maxHeight pixels tall\",\r\n async validate(value: any, context) {\r\n const dimensions = await value.dimensions();\r\n\r\n if (dimensions.height <= this.context.options.maxHeight) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.maxHeight = this.context.options.maxHeight;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAMA,MAAa,eAAiD;CAC5D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAGlC,KAAI,MAFqB,MAAM,WAAW,GAE3B,SAAS,KAAK,QAAQ,QAAQ,UAC3C,OAAO;EAGT,KAAK,QAAQ,kBAAkB,WAAW,KAAK,QAAQ,QAAQ;EAE/D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,eAAiD;CAC5D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAGlC,KAAI,MAFqB,MAAM,WAAW,GAE3B,SAAS,KAAK,QAAQ,QAAQ,UAC3C,OAAO;EAGT,KAAK,QAAQ,kBAAkB,WAAW,KAAK,QAAQ,QAAQ;EAE/D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,gBAAmD;CAC9D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAGlC,KAAI,MAFqB,MAAM,WAAW,GAE3B,UAAU,KAAK,QAAQ,QAAQ,WAC5C,OAAO;EAGT,KAAK,QAAQ,kBAAkB,YAAY,KAAK,QAAQ,QAAQ;EAEhE,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,gBAAmD;CAC9D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAGlC,KAAI,MAFqB,MAAM,WAAW,GAE3B,UAAU,KAAK,QAAQ,QAAQ,WAC5C,OAAO;EAGT,KAAK,QAAQ,kBAAkB,YAAY,KAAK,QAAQ,QAAQ;EAEhE,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
1
+ {"version":3,"file":"dimensions.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/file/dimensions.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Min width rule - image width validation\r\n */\r\nexport const minWidthRule: SchemaRule<{ minWidth: number }> = {\r\n name: \"minWidth\",\r\n defaultErrorMessage: \"The :input must be at least :minWidth pixels wide\",\r\n async validate(value: any, context) {\r\n const dimensions = await value.dimensions();\r\n\r\n if (dimensions.width >= this.context.options.minWidth) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minWidth = this.context.options.minWidth;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max width rule - image width validation\r\n */\r\nexport const maxWidthRule: SchemaRule<{ maxWidth: number }> = {\r\n name: \"maxWidth\",\r\n defaultErrorMessage: \"The :input must be at most :maxWidth pixels wide\",\r\n async validate(value: any, context) {\r\n const dimensions = await value.dimensions();\r\n\r\n if (dimensions.width <= this.context.options.maxWidth) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.maxWidth = this.context.options.maxWidth;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min height rule - image height validation\r\n */\r\nexport const minHeightRule: SchemaRule<{ minHeight: number }> = {\r\n name: \"minHeight\",\r\n defaultErrorMessage: \"The :input must be at least :minHeight pixels tall\",\r\n async validate(value: any, context) {\r\n const dimensions = await value.dimensions();\r\n\r\n if (dimensions.height >= this.context.options.minHeight) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minHeight = this.context.options.minHeight;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max height rule - image height validation\r\n */\r\nexport const maxHeightRule: SchemaRule<{ maxHeight: number }> = {\r\n name: \"maxHeight\",\r\n defaultErrorMessage: \"The :input must be at most :maxHeight pixels tall\",\r\n async validate(value: any, context) {\r\n const dimensions = await value.dimensions();\r\n\r\n if (dimensions.height <= this.context.options.maxHeight) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.maxHeight = this.context.options.maxHeight;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAMA,MAAa,eAAiD;CAC5D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAGlC,KAAI,MAFqB,MAAM,WAAW,EAE5B,CAAC,SAAS,KAAK,QAAQ,QAAQ,UAC3C,OAAO;EAGT,KAAK,QAAQ,kBAAkB,WAAW,KAAK,QAAQ,QAAQ;EAE/D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,eAAiD;CAC5D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAGlC,KAAI,MAFqB,MAAM,WAAW,EAE5B,CAAC,SAAS,KAAK,QAAQ,QAAQ,UAC3C,OAAO;EAGT,KAAK,QAAQ,kBAAkB,WAAW,KAAK,QAAQ,QAAQ;EAE/D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,gBAAmD;CAC9D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAGlC,KAAI,MAFqB,MAAM,WAAW,EAE5B,CAAC,UAAU,KAAK,QAAQ,QAAQ,WAC5C,OAAO;EAGT,KAAK,QAAQ,kBAAkB,YAAY,KAAK,QAAQ,QAAQ;EAEhE,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,gBAAmD;CAC9D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAGlC,KAAI,MAFqB,MAAM,WAAW,EAE5B,CAAC,UAAU,KAAK,QAAQ,QAAQ,WAC5C,OAAO;EAGT,KAAK,QAAQ,kBAAkB,YAAY,KAAK,QAAQ,QAAQ;EAEhE,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"length-rules.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/length/length-rules.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Min length rule - validates minimum length\r\n * Works for any value with a length property (strings, arrays, etc.)\r\n */\r\nexport const minLengthRule: SchemaRule<{ minLength: number }> = {\r\n name: \"minLength\",\r\n defaultErrorMessage: \"The :input must be at least :minLength characters long\",\r\n async validate(value: any, context) {\r\n const length = typeof value?.length === \"number\" ? value.length : String(value || \"\").length;\r\n\r\n if (length >= this.context.options.minLength) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minLength = this.context.options.minLength;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max length rule - validates maximum length\r\n * Works for any value with a length property (strings, arrays, etc.)\r\n */\r\nexport const maxLengthRule: SchemaRule<{ maxLength: number }> = {\r\n name: \"maxLength\",\r\n defaultErrorMessage: \"The :input must not exceed :maxLength characters\",\r\n async validate(value: any, context) {\r\n const length = typeof value?.length === \"number\" ? value.length : String(value || \"\").length;\r\n\r\n if (length <= this.context.options.maxLength) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.maxLength = this.context.options.maxLength;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between length rule - validates length is between min and max (inclusive)\r\n * Works for any value with a length property (strings, arrays, etc.)\r\n */\r\nexport const betweenLengthRule: SchemaRule<{\r\n minLength: number;\r\n maxLength: number;\r\n}> = {\r\n name: \"betweenLength\",\r\n defaultErrorMessage: \"The :input must be between :minLength and :maxLength characters long\",\r\n async validate(value: any, context) {\r\n const length = typeof value?.length === \"number\" ? value.length : String(value || \"\").length;\r\n\r\n if (length >= this.context.options.minLength && length <= this.context.options.maxLength) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minLength = this.context.options.minLength;\r\n this.context.translationParams.maxLength = this.context.options.maxLength;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Length rule - validates exact length\r\n * Works for any value with a length property (strings, arrays, etc.)\r\n */\r\nexport const lengthRule: SchemaRule<{ length: number }> = {\r\n name: \"length\",\r\n defaultErrorMessage: \"The :input must be exactly :length characters long\",\r\n async validate(value: any, context) {\r\n const length = typeof value?.length === \"number\" ? value.length : String(value || \"\").length;\r\n\r\n if (length === this.context.options.length) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.length = this.context.options.length;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min words rule - validates minimum word count\r\n */\r\nexport const minWordsRule: SchemaRule<{ minWords: number }> = {\r\n name: \"minWords\",\r\n defaultErrorMessage: \"The :input must be at least :minWords words\",\r\n async validate(value: any, context) {\r\n if (String(value || \"\").split(\" \").length >= this.context.options.minWords) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minWords = this.context.options.minWords;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max words rule - validates maximum word count\r\n */\r\nexport const maxWordsRule: SchemaRule<{ maxWords: number }> = {\r\n name: \"maxWords\",\r\n defaultErrorMessage: \"The :input must be at most :maxWords words\",\r\n async validate(value: any, context) {\r\n if (String(value || \"\").split(\" \").length <= this.context.options.maxWords) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.maxWords = this.context.options.maxWords;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Words rule - validates exact word count\r\n */\r\nexport const wordsRule: SchemaRule<{ words: number }> = {\r\n name: \"words\",\r\n defaultErrorMessage: \"The :input must be exactly :words words\",\r\n async validate(value: any, context) {\r\n if (String(value || \"\").split(\" \").length === this.context.options.words) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.words = this.context.options.words;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;;AAOA,MAAa,gBAAmD;CAC9D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAGlC,KAFe,OAAO,OAAO,WAAW,WAAW,MAAM,SAAS,OAAO,SAAS,EAAE,EAAE,WAExE,KAAK,QAAQ,QAAQ,WACjC,OAAO;EAGT,KAAK,QAAQ,kBAAkB,YAAY,KAAK,QAAQ,QAAQ;EAEhE,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;AAMA,MAAa,gBAAmD;CAC9D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAGlC,KAFe,OAAO,OAAO,WAAW,WAAW,MAAM,SAAS,OAAO,SAAS,EAAE,EAAE,WAExE,KAAK,QAAQ,QAAQ,WACjC,OAAO;EAGT,KAAK,QAAQ,kBAAkB,YAAY,KAAK,QAAQ,QAAQ;EAEhE,OAAO,YAAY,MAA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AACF;;;;AAKA,MAAa,YAA2C;CACtD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,OAAO,SAAS,EAAE,EAAE,MAAM,GAAG,EAAE,WAAW,KAAK,QAAQ,QAAQ,OACjE,OAAO;EAGT,KAAK,QAAQ,kBAAkB,QAAQ,KAAK,QAAQ,QAAQ;EAE5D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
1
+ {"version":3,"file":"length-rules.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/length/length-rules.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Min length rule - validates minimum length\r\n * Works for any value with a length property (strings, arrays, etc.)\r\n */\r\nexport const minLengthRule: SchemaRule<{ minLength: number }> = {\r\n name: \"minLength\",\r\n defaultErrorMessage: \"The :input must be at least :minLength characters long\",\r\n async validate(value: any, context) {\r\n const length = typeof value?.length === \"number\" ? value.length : String(value || \"\").length;\r\n\r\n if (length >= this.context.options.minLength) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minLength = this.context.options.minLength;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max length rule - validates maximum length\r\n * Works for any value with a length property (strings, arrays, etc.)\r\n */\r\nexport const maxLengthRule: SchemaRule<{ maxLength: number }> = {\r\n name: \"maxLength\",\r\n defaultErrorMessage: \"The :input must not exceed :maxLength characters\",\r\n async validate(value: any, context) {\r\n const length = typeof value?.length === \"number\" ? value.length : String(value || \"\").length;\r\n\r\n if (length <= this.context.options.maxLength) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.maxLength = this.context.options.maxLength;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between length rule - validates length is between min and max (inclusive)\r\n * Works for any value with a length property (strings, arrays, etc.)\r\n */\r\nexport const betweenLengthRule: SchemaRule<{\r\n minLength: number;\r\n maxLength: number;\r\n}> = {\r\n name: \"betweenLength\",\r\n defaultErrorMessage: \"The :input must be between :minLength and :maxLength characters long\",\r\n async validate(value: any, context) {\r\n const length = typeof value?.length === \"number\" ? value.length : String(value || \"\").length;\r\n\r\n if (length >= this.context.options.minLength && length <= this.context.options.maxLength) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minLength = this.context.options.minLength;\r\n this.context.translationParams.maxLength = this.context.options.maxLength;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Length rule - validates exact length\r\n * Works for any value with a length property (strings, arrays, etc.)\r\n */\r\nexport const lengthRule: SchemaRule<{ length: number }> = {\r\n name: \"length\",\r\n defaultErrorMessage: \"The :input must be exactly :length characters long\",\r\n async validate(value: any, context) {\r\n const length = typeof value?.length === \"number\" ? value.length : String(value || \"\").length;\r\n\r\n if (length === this.context.options.length) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.length = this.context.options.length;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min words rule - validates minimum word count\r\n */\r\nexport const minWordsRule: SchemaRule<{ minWords: number }> = {\r\n name: \"minWords\",\r\n defaultErrorMessage: \"The :input must be at least :minWords words\",\r\n async validate(value: any, context) {\r\n if (String(value || \"\").split(\" \").length >= this.context.options.minWords) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minWords = this.context.options.minWords;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max words rule - validates maximum word count\r\n */\r\nexport const maxWordsRule: SchemaRule<{ maxWords: number }> = {\r\n name: \"maxWords\",\r\n defaultErrorMessage: \"The :input must be at most :maxWords words\",\r\n async validate(value: any, context) {\r\n if (String(value || \"\").split(\" \").length <= this.context.options.maxWords) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.maxWords = this.context.options.maxWords;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Words rule - validates exact word count\r\n */\r\nexport const wordsRule: SchemaRule<{ words: number }> = {\r\n name: \"words\",\r\n defaultErrorMessage: \"The :input must be exactly :words words\",\r\n async validate(value: any, context) {\r\n if (String(value || \"\").split(\" \").length === this.context.options.words) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.words = this.context.options.words;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;;AAOA,MAAa,gBAAmD;CAC9D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAGlC,KAFe,OAAO,OAAO,WAAW,WAAW,MAAM,SAAS,OAAO,SAAS,EAAE,CAAC,CAAC,WAExE,KAAK,QAAQ,QAAQ,WACjC,OAAO;EAGT,KAAK,QAAQ,kBAAkB,YAAY,KAAK,QAAQ,QAAQ;EAEhE,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;AAMA,MAAa,gBAAmD;CAC9D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAGlC,KAFe,OAAO,OAAO,WAAW,WAAW,MAAM,SAAS,OAAO,SAAS,EAAE,CAAC,CAAC,WAExE,KAAK,QAAQ,QAAQ,WACjC,OAAO;EAGT,KAAK,QAAQ,kBAAkB,YAAY,KAAK,QAAQ,QAAQ;EAEhE,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;AAMA,MAAa,oBAGR;CACH,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,SAAS,OAAO,OAAO,WAAW,WAAW,MAAM,SAAS,OAAO,SAAS,EAAE,CAAC,CAAC;EAEtF,IAAI,UAAU,KAAK,QAAQ,QAAQ,aAAa,UAAU,KAAK,QAAQ,QAAQ,WAC7E,OAAO;EAGT,KAAK,QAAQ,kBAAkB,YAAY,KAAK,QAAQ,QAAQ;EAChE,KAAK,QAAQ,kBAAkB,YAAY,KAAK,QAAQ,QAAQ;EAE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../../../../../../../seal/src/rules/scalar/accepted-rule.ts"],"sourcesContent":["import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\nconst isAcceptedValue = (value: any) => {\r\n return [\"1\", \"true\", \"yes\", \"y\", \"on\", 1, true, \"Yes\", \"Y\", \"On\"].includes(value);\r\n};\r\n\r\n/**\r\n * Validate value as accepted if it equals:\r\n * 1 | \"1\" | true | \"true\" | \"yes\" | \"y\" | \"on\"\r\n */\r\nexport const acceptedRule: SchemaRule = {\r\n name: \"accepted\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n description:\r\n \"The value must be accepted if it equals: 1 | '1' | true | 'true' | 'yes' | 'y' | 'on' | 1 | true | 'Yes' | 'Y' | 'On'\",\r\n async validate(value: any, context) {\r\n if (isAcceptedValue(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Accepted value if another field's value equals to a specific value\r\n */\r\nexport const acceptedIfRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"acceptedIf\",\r\n description: \"The field must be accepted if :field's value equals to :value\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n if (fieldValue !== expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is not equal to the given value\r\n */\r\nexport const acceptedUnlessRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"acceptedUnless\",\r\n description: \"The field must be accepted if :field's value is not equal to :value\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n if (fieldValue === expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is required\r\n */\r\nexport const acceptedIfRequiredRule: SchemaRule<{ field: string }> = {\r\n name: \"acceptedIfRequired\",\r\n description: \"The field must be accepted if :field is required\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is present\r\n */\r\nexport const acceptedIfPresentRule: SchemaRule<{ field: string }> = {\r\n name: \"acceptedIfPresent\",\r\n description: \"The field must be accepted if :field is present\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue === undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is missing\r\n */\r\nexport const acceptedWithoutRule: SchemaRule<{ field: string }> = {\r\n name: \"acceptedWithout\",\r\n description: \"The field must be accepted if :field is missing\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue !== undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n"],"mappings":";;;;;;AAIA,MAAM,mBAAmB,UAAe;CACtC,OAAO;EAAC;EAAK;EAAQ;EAAO;EAAK;EAAM;EAAG;EAAM;EAAO;EAAK;CAAI,EAAE,SAAS,KAAK;AAClF;;;;;AAMA,MAAa,eAA2B;CACtC,MAAM;CACN,qBAAqB;CACrB,aACE;CACF,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,gBAAgB,KAAK,GACvB,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,iBAA4D;CACvE,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,MAAM,EAAE,OAAO,kBAAkB,KAAK,QAAQ;EAE9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAC7D,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAC7D,IAAI,eAAe,eACjB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,qBAAgE;CAC3E,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,MAAM,EAAE,OAAO,kBAAkB,KAAK,QAAQ;EAE9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAC7D,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,eAAe,eACjB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,yBAAwD;CACnE,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,aAAa,UAAU,GACzB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,wBAAuD;CAClE,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,eAAe,QACjB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,sBAAqD;CAChE,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,eAAe,QACjB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"accepted-rule.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/scalar/accepted-rule.ts"],"sourcesContent":["import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\nconst isAcceptedValue = (value: any) => {\r\n return [\"1\", \"true\", \"yes\", \"y\", \"on\", 1, true, \"Yes\", \"Y\", \"On\"].includes(value);\r\n};\r\n\r\n/**\r\n * Validate value as accepted if it equals:\r\n * 1 | \"1\" | true | \"true\" | \"yes\" | \"y\" | \"on\"\r\n */\r\nexport const acceptedRule: SchemaRule = {\r\n name: \"accepted\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n description:\r\n \"The value must be accepted if it equals: 1 | '1' | true | 'true' | 'yes' | 'y' | 'on' | 1 | true | 'Yes' | 'Y' | 'On'\",\r\n async validate(value: any, context) {\r\n if (isAcceptedValue(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Accepted value if another field's value equals to a specific value\r\n */\r\nexport const acceptedIfRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"acceptedIf\",\r\n description: \"The field must be accepted if :field's value equals to :value\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n if (fieldValue !== expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is not equal to the given value\r\n */\r\nexport const acceptedUnlessRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"acceptedUnless\",\r\n description: \"The field must be accepted if :field's value is not equal to :value\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n if (fieldValue === expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is required\r\n */\r\nexport const acceptedIfRequiredRule: SchemaRule<{ field: string }> = {\r\n name: \"acceptedIfRequired\",\r\n description: \"The field must be accepted if :field is required\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is present\r\n */\r\nexport const acceptedIfPresentRule: SchemaRule<{ field: string }> = {\r\n name: \"acceptedIfPresent\",\r\n description: \"The field must be accepted if :field is present\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue === undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is missing\r\n */\r\nexport const acceptedWithoutRule: SchemaRule<{ field: string }> = {\r\n name: \"acceptedWithout\",\r\n description: \"The field must be accepted if :field is missing\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue !== undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n"],"mapp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SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,aAAa,UAAU,GACzB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,wBAAuD;CAClE,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,eAAe,QACjB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,sBAAqD;CAChE,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,eAAe,QACjB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"declined-rule.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/scalar/declined-rule.ts"],"sourcesContent":["import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\nconst isDeclinedValue = (value: any) => {\r\n return [\"0\", \"false\", \"no\", \"n\", \"off\", 0, false, \"No\", \"N\", \"Off\"].includes(value);\r\n};\r\n\r\n/**\r\n * Validate value as declined if it equals:\r\n * 0 | \"0\" | false | \"false\" | \"no\" | \"n\" | \"off\" | 0 | false | \"No\" | \"N\" | \"Off\"\r\n */\r\nexport const declinedRule: SchemaRule = {\r\n name: \"declined\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n description:\r\n \"The value must be declined if it equals: 0 | '0' | false | 'false' | 'no' | 'n' | 'off' | 0 | false | 'No' | 'N' | 'Off'\",\r\n async validate(value: any, context) {\r\n if (isDeclinedValue(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Declined value if another field's value equals to a specific value\r\n */\r\nexport const declinedIfRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"declinedIf\",\r\n description: \"The field must be declined if :field's value equals to :value\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n if (fieldValue !== expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is not equal to the given value\r\n */\r\nexport const declinedUnlessRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"declinedUnless\",\r\n description: \"The field must be declined if :field's value is not equal to :value\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n if (fieldValue === expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is required\r\n */\r\nexport const declinedIfRequiredRule: SchemaRule<{ field: string }> = {\r\n name: \"declinedIfRequired\",\r\n description: \"The field must be declined if :field is required\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is present\r\n */\r\nexport const declinedIfPresentRule: SchemaRule<{ field: string }> = {\r\n name: \"declinedIfPresent\",\r\n description: \"The field must be declined if :field is present\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue === undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is missing\r\n */\r\nexport const declinedWithoutRule: SchemaRule<{ field: string }> = {\r\n name: \"declinedWithout\",\r\n description: \"The field must be declined if :field is missing\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue !== undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n"],"mappings":";;;;;;AAIA,MAAM,mBAAmB,UAAe;CACtC,OAAO;EAAC;EAAK;EAAS;EAAM;EAAK;EAAO;EAAG;EAAO;EAAM;EAAK;CAAK,EAAE,SAAS,KAAK;AACpF;;;;;AAMA,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AM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,wBAAuD;CAClE,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,eAAe,QACjB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,sBAAqD;CAChE,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,eAAe,QACjB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"declined-rule.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/scalar/declined-rule.ts"],"sourcesContent":["import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\nconst isDeclinedValue = (value: any) => {\r\n return [\"0\", \"false\", \"no\", \"n\", \"off\", 0, false, \"No\", \"N\", \"Off\"].includes(value);\r\n};\r\n\r\n/**\r\n * Validate value as declined if it equals:\r\n * 0 | \"0\" | false | \"false\" | \"no\" | \"n\" | \"off\" | 0 | false | \"No\" | \"N\" | \"Off\"\r\n */\r\nexport const declinedRule: SchemaRule = {\r\n name: \"declined\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n description:\r\n \"The value must be declined if it equals: 0 | '0' | false | 'false' | 'no' | 'n' | 'off' | 0 | false | 'No' | 'N' | 'Off'\",\r\n async validate(value: any, context) {\r\n if (isDeclinedValue(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Declined value if another field's value equals to a specific value\r\n */\r\nexport const declinedIfRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"declinedIf\",\r\n description: \"The field must be declined if :field's value equals to :value\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n if (fieldValue !== expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is not equal to the given value\r\n */\r\nexport const declinedUnlessRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"declinedUnless\",\r\n description: \"The field must be declined if :field's value is not equal to :value\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n if (fieldValue === expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is required\r\n */\r\nexport const declinedIfRequiredRule: SchemaRule<{ field: string }> = {\r\n name: \"declinedIfRequired\",\r\n description: \"The field must be declined if :field is required\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is present\r\n */\r\nexport const declinedIfPresentRule: SchemaRule<{ field: string }> = {\r\n name: \"declinedIfPresent\",\r\n description: \"The field must be declined if :field is present\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue === undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is missing\r\n */\r\nexport const declinedWithoutRule: SchemaRule<{ field: string }> = {\r\n name: \"declinedWithout\",\r\n description: \"The field must be declined if :field is missing\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue !== undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n"],"mappings":";;;;;;AAIA,MAAM,mBAAmB,UAAe;CACtC,OAAO;EAAC;EAAK;EAAS;EAAM;EAAK;EAAO;EAAG;EAAO;EAAM;EAAK;CAAK,CAAC,CAAC,SAAS,KAAK;AACpF;;;;;AAMA,MAAa,eAA2B;CACtC,MAAM;CACN,qBAAqB;CACrB,aACE;CACF,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,gBAAgB,KAAK,GACvB,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AA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AAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,eAAe,QACjB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,sBAAqD;CAChE,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,eAAe,QACjB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"credit-card.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/credit-card.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Credit card rule - validates credit card number\r\n */\r\nexport const isCreditCardRule: SchemaRule = {\r\n name: \"creditCard\",\r\n defaultErrorMessage: \"The :input must be a valid credit card number\",\r\n async validate(value: any, context) {\r\n // Luhn algorithm for credit card validation\r\n const cardNumber = String(value).replace(/\\s/g, \"\");\r\n\r\n if (!/^\\d+$/.test(cardNumber)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n let sum = 0;\r\n let isEven = false;\r\n\r\n for (let i = cardNumber.length - 1; i >= 0; i--) {\r\n let digit = parseInt(cardNumber[i], 10);\r\n\r\n if (isEven) {\r\n digit *= 2;\r\n if (digit > 9) {\r\n digit -= 9;\r\n }\r\n }\r\n\r\n sum += digit;\r\n isEven = !isEven;\r\n }\r\n\r\n if (sum % 10 === 0) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAMA,MAAa,mBAA+B;CAC1C,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAElC,MAAM,aAAa,OAAO,KAAK,EAAE,QAAQ,OAAO,EAAE;EAElD,IAAI,CAAC,QAAQ,KAAK,UAAU,GAC1B,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,MAAM;EACV,IAAI,SAAS;EAEb,KAAK,IAAI,IAAI,WAAW,SAAS,GAAG,KAAK,GAAG,KAAK;GAC/C,IAAI,QAAQ,SAAS,WAAW,IAAI,EAAE;GAEtC,IAAI,QAAQ;IACV,SAAS;IACT,IAAI,QAAQ,GACV,SAAS;GAEb;GAEA,OAAO;GACP,SAAS,CAAC;EACZ;EAEA,IAAI,MAAM,OAAO,GACf,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
1
+ {"version":3,"file":"credit-card.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/credit-card.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Credit card rule - validates credit card number\r\n */\r\nexport const isCreditCardRule: SchemaRule = {\r\n name: \"creditCard\",\r\n defaultErrorMessage: \"The :input must be a valid credit card number\",\r\n async validate(value: any, context) {\r\n // Luhn algorithm for credit card validation\r\n const cardNumber = String(value).replace(/\\s/g, \"\");\r\n\r\n if (!/^\\d+$/.test(cardNumber)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n let sum = 0;\r\n let isEven = false;\r\n\r\n for (let i = cardNumber.length - 1; i >= 0; i--) {\r\n let digit = parseInt(cardNumber[i], 10);\r\n\r\n if (isEven) {\r\n digit *= 2;\r\n if (digit > 9) {\r\n digit -= 9;\r\n }\r\n }\r\n\r\n sum += digit;\r\n isEven = !isEven;\r\n }\r\n\r\n if (sum % 10 === 0) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAMA,MAAa,mBAA+B;CAC1C,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAElC,MAAM,aAAa,OAAO,KAAK,CAAC,CAAC,QAAQ,OAAO,EAAE;EAElD,IAAI,CAAC,QAAQ,KAAK,UAAU,GAC1B,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,MAAM;EACV,IAAI,SAAS;EAEb,KAAK,IAAI,IAAI,WAAW,SAAS,GAAG,KAAK,GAAG,KAAK;GAC/C,IAAI,QAAQ,SAAS,WAAW,IAAI,EAAE;GAEtC,IAAI,QAAQ;IACV,SAAS;IACT,IAAI,QAAQ,GACV,SAAS;GAEb;GAEA,OAAO;GACP,SAAS,CAAC;EACZ;EAEA,IAAI,MAAM,OAAO,GACf,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"id-formats.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/id-formats.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Modern ID format validators — UUID, CUID, ULID, nanoid.\n *\n * Each rule asserts the value is a string in the canonical format for its\n * identifier scheme. Rules are intentionally strict (variant nibbles checked\n * for UUID, character classes enforced for ULID's Crockford base32, etc.)\n * so \"looks-like-but-not-valid\" inputs are rejected.\n */\n\nconst UUID_ANY = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nconst UUID_BY_VERSION: Record<1 | 3 | 4 | 5 | 6 | 7, RegExp> = {\n 1: /^[0-9a-f]{8}-[0-9a-f]{4}-1[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 3: /^[0-9a-f]{8}-[0-9a-f]{4}-3[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 4: /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 5: /^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 6: /^[0-9a-f]{8}-[0-9a-f]{4}-6[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 7: /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n};\n\nexport type UUIDVersion = 1 | 3 | 4 | 5 | 6 | 7;\n\n/**\n * UUID rule — value must be a valid UUID. Optionally restrict to a specific version.\n *\n * @example\n * v.string().uuid() // any RFC 4122 UUID\n * v.string().uuid(4) // only v4 (random)\n * v.string().uuid(7) // only v7 (timestamp-ordered)\n */\nexport const uuidRule: SchemaRule<{ version?: UUIDVersion }> = {\n name: \"uuid\",\n defaultErrorMessage: \"The :input must be a valid UUID\",\n async validate(value, context) {\n if (typeof value !== \"string\") return invalidRule(this, context);\n\n const version = this.context.options.version;\n\n const pattern = version ? UUID_BY_VERSION[version] : UUID_ANY;\n if (pattern.test(value)) return VALID_RULE;\n\n if (version !== undefined) {\n this.context.translationParams.version = version;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * CUID rule — value must be a valid CUID.\n *\n * Defaults to CUID2 (24 chars, lowercase, starts with letter — see\n * https://github.com/paralleldrive/cuid2). Pass `{ version: 1 }` for legacy\n * CUID1 format (starts with \"c\", ≥25 chars).\n *\n * @example\n * v.string().cuid() // CUID2\n * v.string().cuid({ version: 1 }) // legacy CUID1\n */\nexport const cuidRule: SchemaRule<{ version?: 1 | 2 }> = {\n name: \"cuid\",\n defaultErrorMessage: \"The :input must be a valid CUID\",\n async validate(value, context) {\n if (typeof value !== \"string\") return invalidRule(this, context);\n const version = this.context.options.version ?? 2;\n const pattern = version === 1 ? /^c[a-z0-9]{24,}$/ : /^[a-z][a-z0-9]{23}$/;\n if (pattern.test(value)) return VALID_RULE;\n this.context.translationParams.version = version;\n return invalidRule(this, context);\n },\n};\n\n/**\n * ULID rule — value must be a valid ULID (26 chars, Crockford base32).\n *\n * Crockford base32 excludes the letters I, L, O, U to avoid ambiguity.\n *\n * @example\n * v.string().ulid()\n */\nexport const ulidRule: SchemaRule = {\n name: \"ulid\",\n defaultErrorMessage: \"The :input must be a valid ULID\",\n async validate(value, context) {\n if (typeof value !== \"string\") return invalidRule(this, context);\n if (/^[0-9A-HJKMNP-TV-Z]{26}$/.test(value)) return VALID_RULE;\n return invalidRule(this, context);\n },\n};\n\n/**\n * nanoid rule — value must be a valid nanoid string.\n *\n * Default length is 21 (standard nanoid). URL-safe alphabet:\n * A–Z, a–z, 0–9, `_`, `-`.\n *\n * @example\n * v.string().nanoid() // 21 chars (default)\n * v.string().nanoid(10) // 10 chars\n */\nexport const nanoidRule: SchemaRule<{ length?: number }> = {\n name: \"nanoid\",\n defaultErrorMessage: \"The :input must be a valid nanoid\",\n async validate(value, context) {\n if (typeof value !== \"string\") return invalidRule(this, context);\n const length = this.context.options.length ?? 21;\n const pattern = new RegExp(`^[A-Za-z0-9_-]{${length}}$`);\n if (pattern.test(value)) return VALID_RULE;\n this.context.translationParams.length = length;\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;;;;;;AAYA,MAAM,WAAW;AAEjB,MAAM,kBAAyD;CAC7D,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;AACL;;;;;;;;;AAYA,MAAa,WAAkD;CAC7D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAO,SAAS;EAC7B,IAAI,OAAO,UAAU,UAAU,OAAO,YAAY,MAAM,OAAO;EAE/D,MAAM,UAAU,KAAK,QAAQ,QAAQ;EAGrC,KADgB,UAAU,gBAAgB,WAAW,UACzC,KAAK,KAAK,GAAG,OAAO;EAEhC,IAAI,YAAY,QACd,KAAK,QAAQ,kBAAkB,UAAU;EAG3C,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;;;;;;;;AAaA,MAAa,WAA4C;CACvD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAO,SAAS;EAC7B,IAAI,OAAO,UAAU,UAAU,OAAO,YAAY,MAAM,OAAO;EAC/D,MAAM,UAAU,KAAK,QAAQ,QAAQ,WAAW;EAEhD,KADgB,YAAY,IAAI,qBAAqB,uBACzC,KAAK,KAAK,GAAG,OAAO;EAChC,KAAK,QAAQ,kBAAkB,UAAU;EACzC,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;;;;;AAUA,MAAa,WAAuB;CAClC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAO,SAAS;EAC7B,IAAI,OAAO,UAAU,UAAU,OAAO,YAAY,MAAM,OAAO;EAC/D,IAAI,2BAA2B,KAAK,KAAK,GAAG,OAAO;EACnD,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;;;;;;;AAYA,MAAa,aAA8C;CACzD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAO,SAAS;EAC7B,IAAI,OAAO,UAAU,UAAU,OAAO,YAAY,MAAM,OAAO;EAC/D,MAAM,SAAS,KAAK,QAAQ,QAAQ,UAAU;EAE9C,IAAI,IADgB,OAAO,kBAAkB,OAAO,GAC1C,EAAE,KAAK,KAAK,GAAG,OAAO;EAChC,KAAK,QAAQ,kBAAkB,SAAS;EACxC,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
1
+ {"version":3,"file":"id-formats.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/id-formats.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Modern ID format validators — UUID, CUID, ULID, nanoid.\n *\n * Each rule asserts the value is a string in the canonical format for its\n * identifier scheme. Rules are intentionally strict (variant nibbles checked\n * for UUID, character classes enforced for ULID's Crockford base32, etc.)\n * so \"looks-like-but-not-valid\" inputs are rejected.\n */\n\nconst UUID_ANY = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nconst UUID_BY_VERSION: Record<1 | 3 | 4 | 5 | 6 | 7, RegExp> = {\n 1: /^[0-9a-f]{8}-[0-9a-f]{4}-1[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 3: /^[0-9a-f]{8}-[0-9a-f]{4}-3[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 4: /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 5: /^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 6: /^[0-9a-f]{8}-[0-9a-f]{4}-6[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 7: /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n};\n\nexport type UUIDVersion = 1 | 3 | 4 | 5 | 6 | 7;\n\n/**\n * UUID rule — value must be a valid UUID. Optionally restrict to a specific version.\n *\n * @example\n * v.string().uuid() // any RFC 4122 UUID\n * v.string().uuid(4) // only v4 (random)\n * v.string().uuid(7) // only v7 (timestamp-ordered)\n */\nexport const uuidRule: SchemaRule<{ version?: UUIDVersion }> = {\n name: \"uuid\",\n defaultErrorMessage: \"The :input must be a valid UUID\",\n async validate(value, context) {\n if (typeof value !== \"string\") return invalidRule(this, context);\n\n const version = this.context.options.version;\n\n const pattern = version ? UUID_BY_VERSION[version] : UUID_ANY;\n if (pattern.test(value)) return VALID_RULE;\n\n if (version !== undefined) {\n this.context.translationParams.version = version;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * CUID rule — value must be a valid CUID.\n *\n * Defaults to CUID2 (24 chars, lowercase, starts with letter — see\n * https://github.com/paralleldrive/cuid2). Pass `{ version: 1 }` for legacy\n * CUID1 format (starts with \"c\", ≥25 chars).\n *\n * @example\n * v.string().cuid() // CUID2\n * v.string().cuid({ version: 1 }) // legacy CUID1\n */\nexport const cuidRule: SchemaRule<{ version?: 1 | 2 }> = {\n name: \"cuid\",\n defaultErrorMessage: \"The :input must be a valid CUID\",\n async validate(value, context) {\n if (typeof value !== \"string\") return invalidRule(this, context);\n const version = this.context.options.version ?? 2;\n const pattern = version === 1 ? /^c[a-z0-9]{24,}$/ : /^[a-z][a-z0-9]{23}$/;\n if (pattern.test(value)) return VALID_RULE;\n this.context.translationParams.version = version;\n return invalidRule(this, context);\n },\n};\n\n/**\n * ULID rule — value must be a valid ULID (26 chars, Crockford base32).\n *\n * Crockford base32 excludes the letters I, L, O, U to avoid ambiguity.\n *\n * @example\n * v.string().ulid()\n */\nexport const ulidRule: SchemaRule = {\n name: \"ulid\",\n defaultErrorMessage: \"The :input must be a valid ULID\",\n async validate(value, context) {\n if (typeof value !== \"string\") return invalidRule(this, context);\n if (/^[0-9A-HJKMNP-TV-Z]{26}$/.test(value)) return VALID_RULE;\n return invalidRule(this, context);\n },\n};\n\n/**\n * nanoid rule — value must be a valid nanoid string.\n *\n * Default length is 21 (standard nanoid). URL-safe alphabet:\n * A–Z, a–z, 0–9, `_`, `-`.\n *\n * @example\n * v.string().nanoid() // 21 chars (default)\n * v.string().nanoid(10) // 10 chars\n */\nexport const nanoidRule: SchemaRule<{ length?: number }> = {\n name: \"nanoid\",\n defaultErrorMessage: \"The :input must be a valid nanoid\",\n async validate(value, context) {\n if (typeof value !== \"string\") return invalidRule(this, context);\n const length = this.context.options.length ?? 21;\n const pattern = new RegExp(`^[A-Za-z0-9_-]{${length}}$`);\n if (pattern.test(value)) return VALID_RULE;\n this.context.translationParams.length = length;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K,QAAQ,QAAQ,UAAU;EAE9C,IAAI,IADgB,OAAO,kBAAkB,OAAO,GAC1C,CAAC,CAAC,KAAK,KAAK,GAAG,OAAO;EAChC,KAAK,QAAQ,kBAAkB,SAAS;EACxC,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"string-comparison.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/string-comparison.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Starts with rule\r\n */\r\nexport const startsWithRule: SchemaRule<{ value: string }> = {\r\n name: \"startsWith\",\r\n defaultErrorMessage: \"The :input must start with :value\",\r\n async validate(value: any, context) {\r\n if (String(value).startsWith(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Ends with rule\r\n */\r\nexport const endsWithRule: SchemaRule<{ value: string }> = {\r\n name: \"endsWith\",\r\n defaultErrorMessage: \"The :input must end with :value\",\r\n async validate(value: any, context) {\r\n if (String(value).endsWith(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Contains rule\r\n */\r\nexport const containsRule: SchemaRule<{ value: string }> = {\r\n name: \"contains\",\r\n defaultErrorMessage: \"The :input must contain :value\",\r\n async validate(value: any, context) {\r\n if (String(value).includes(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Not contains rule\r\n */\r\nexport const notContainsRule: SchemaRule<{ value: string }> = {\r\n name: \"notContains\",\r\n defaultErrorMessage: \"The :input must not contain :value\",\r\n async validate(value: any, context) {\r\n if (!String(value).includes(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAMA,MAAa,iBAAgD;CAC3D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,OAAO,KAAK,EAAE,WAAW,KAAK,QAAQ,QAAQ,KAAK,GACrD,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,eAA8C;CACzD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,OAAO,KAAK,EAAE,SAAS,KAAK,QAAQ,QAAQ,KAAK,GACnD,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,eAA8C;CACzD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,OAAO,KAAK,EAAE,SAAS,KAAK,QAAQ,QAAQ,KAAK,GACnD,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,kBAAiD;CAC5D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,CAAC,OAAO,KAAK,EAAE,SAAS,KAAK,QAAQ,QAAQ,KAAK,GACpD,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
1
+ {"version":3,"file":"string-comparison.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/string/string-comparison.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Starts with rule\r\n */\r\nexport const startsWithRule: SchemaRule<{ value: string }> = {\r\n name: \"startsWith\",\r\n defaultErrorMessage: \"The :input must start with :value\",\r\n async validate(value: any, context) {\r\n if (String(value).startsWith(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Ends with rule\r\n */\r\nexport const endsWithRule: SchemaRule<{ value: string }> = {\r\n name: \"endsWith\",\r\n defaultErrorMessage: \"The :input must end with :value\",\r\n async validate(value: any, context) {\r\n if (String(value).endsWith(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Contains rule\r\n */\r\nexport const containsRule: SchemaRule<{ value: string }> = {\r\n name: \"contains\",\r\n defaultErrorMessage: \"The :input must contain :value\",\r\n async validate(value: any, context) {\r\n if (String(value).includes(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Not contains rule\r\n */\r\nexport const notContainsRule: SchemaRule<{ value: string }> = {\r\n name: \"notContains\",\r\n defaultErrorMessage: \"The :input must not contain :value\",\r\n async validate(value: any, context) {\r\n if (!String(value).includes(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAMA,MAAa,iBAAgD;CAC3D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,OAAO,KAAK,CAAC,CAAC,WAAW,KAAK,QAAQ,QAAQ,KAAK,GACrD,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,eAA8C;CACzD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,OAAO,KAAK,CAAC,CAAC,SAAS,KAAK,QAAQ,QAAQ,KAAK,GACnD,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,eAA8C;CACzD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,OAAO,KAAK,CAAC,CAAC,SAAS,KAAK,QAAQ,QAAQ,KAAK,GACnD,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,kBAAiD;CAC5D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,CAAC,OAAO,KAAK,CAAC,CAAC,SAAS,KAAK,QAAQ,QAAQ,KAAK,GACpD,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"json-schema.mjs","names":[],"sources":["../../../../../../../seal/src/standard-schema/json-schema.ts"],"sourcesContent":["import type { StandardJSONSchemaV1 } from \"./types\";\n\n/**\n * Supported JSON Schema generation targets.\n */\nexport type JsonSchemaTarget = StandardJSONSchemaV1.Target;\n\n/**\n * The result shape for a generated JSON Schema.\n */\nexport type JsonSchemaResult = Record<string, unknown>;\n\n/**\n * Apply nullable to a JSON Schema object based on the target dialect.\n *\n * - draft-2020-12 : `type` becomes an array: `[\"string\", \"null\"]`\n * - openai-strict : same as draft-2020-12 (type array form)\n * - draft-07 : wraps in `oneOf: [{ ...schema }, { type: \"null\" }]`\n * - openapi-3.0 : adds `nullable: true` alongside the existing type\n *\n * Mutates the schema in-place.\n *\n * @example\n * ```ts\n * const schema = { type: \"string\" };\n * applyNullable(schema, \"draft-2020-12\");\n * // → { type: [\"string\", \"null\"] }\n * ```\n */\nexport function applyNullable(schema: JsonSchemaResult, target: JsonSchemaTarget): void {\n if (target === \"openapi-3.0\") {\n schema.nullable = true;\n return;\n }\n\n if (target === \"draft-2020-12\" || target === \"openai-strict\") {\n const baseType = schema.type as string | string[] | undefined;\n schema.type = Array.isArray(baseType)\n ? [...baseType, \"null\"]\n : [baseType as string, \"null\"];\n return;\n }\n\n // draft-07: oneOf wrapping\n const copy = { ...schema };\n for (const key of Object.keys(schema)) {\n delete schema[key];\n }\n schema.oneOf = [copy, { type: \"null\" }];\n}\n\n/**\n * Wrap a field schema as nullable for OpenAI strict mode.\n *\n * OpenAI strict requires optional fields to be expressed as a nullable type\n * rather than being omitted from the `required` array. This helper wraps a\n * given schema into its nullable equivalent using the type-array form.\n *\n * Unlike `applyNullable()` (which mutates in-place), this returns a new\n * schema object to avoid side effects when wrapping child schemas.\n *\n * @example\n * ```ts\n * wrapNullableStrict({ type: \"string\", minLength: 3 })\n * // → { type: [\"string\", \"null\"], minLength: 3 }\n *\n * wrapNullableStrict({ type: \"object\", properties: {...} })\n * // → { type: [\"object\", \"null\"], properties: {...} }\n *\n * wrapNullableStrict({ oneOf: [...] })\n * // → { oneOf: [..., { type: \"null\" }] }\n * ```\n */\nexport function wrapNullableStrict(schema: JsonSchemaResult): JsonSchemaResult {\n // If the schema uses oneOf/anyOf (e.g. union), append null to the list\n if (schema.oneOf) {\n return { ...schema, oneOf: [...(schema.oneOf as unknown[]), { type: \"null\" }] };\n }\n\n if (schema.anyOf) {\n return { ...schema, anyOf: [...(schema.anyOf as unknown[]), { type: \"null\" }] };\n }\n\n // If there's no type at all (permissive `{}`), stay permissive\n if (schema.type === undefined) {\n return schema;\n }\n\n // Standard case: wrap type into array with null\n const baseType = schema.type as string | string[];\n return {\n ...schema,\n type: Array.isArray(baseType) ? [...baseType, \"null\"] : [baseType, \"null\"],\n };\n}\n\n/**\n * Find the first rule matching the given name in a rules array,\n * and return its options bag.\n */\nexport function getRuleOptions(\n rules: Array<{ name: string; context: { options: Record<string, unknown> } }>,\n ruleName: string,\n): Record<string, unknown> | undefined {\n const rule = rules.find(r => r.name === ruleName);\n return rule?.context?.options as Record<string, unknown> | undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA6BA,SAAgB,cAAc,QAA0B,QAAgC;CACtF,IAAI,WAAW,eAAe;EAC5B,OAAO,WAAW;EAClB;CACF;CAEA,IAAI,WAAW,mBAAmB,WAAW,iBAAiB;EAC5D,MAAM,WAAW,OAAO;EACxB,OAAO,OAAO,MAAM,QAAQ,QAAQ,IAChC,CAAC,GAAG,UAAU,MAAM,IACpB,CAAC,UAAoB,MAAM;EAC/B;CACF;CAGA,MAAM,OAAO,EAAE,GAAG,OAAO;CACzB,KAAK,MAAM,OAAO,OAAO,KAAK,MAAM,GAClC,OAAO,OAAO;CAEhB,OAAO,QAAQ,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC;AACxC;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,mBAAmB,QAA4C;CAE7E,IAAI,OAAO,OACT,OAAO;EAAE,GAAG;EAAQ,OAAO,CAAC,GAAI,OAAO,OAAqB,EAAE,MAAM,OAAO,CAAC;CAAE;CAGhF,IAAI,OAAO,OACT,OAAO;EAAE,GAAG;EAAQ,OAAO,CAAC,GAAI,OAAO,OAAqB,EAAE,MAAM,OAAO,CAAC;CAAE;CAIhF,IAAI,OAAO,SAAS,QAClB,OAAO;CAIT,MAAM,WAAW,OAAO;CACxB,OAAO;EACL,GAAG;EACH,MAAM,MAAM,QAAQ,QAAQ,IAAI,CAAC,GAAG,UAAU,MAAM,IAAI,CAAC,UAAU,MAAM;CAC3E;AACF;;;;;AAMA,SAAgB,eACd,OACA,UACqC;CAErC,OADa,MAAM,MAAK,MAAK,EAAE,SAAS,QAC9B,GAAG,SAAS;AACxB"}
1
+ {"version":3,"file":"json-schema.mjs","names":[],"sources":["../../../../../../../seal/src/standard-schema/json-schema.ts"],"sourcesContent":["import type { StandardJSONSchemaV1 } from \"./types\";\n\n/**\n * Supported JSON Schema generation targets.\n */\nexport type JsonSchemaTarget = StandardJSONSchemaV1.Target;\n\n/**\n * The result shape for a generated JSON Schema.\n */\nexport type JsonSchemaResult = Record<string, unknown>;\n\n/**\n * Apply nullable to a JSON Schema object based on the target dialect.\n *\n * - draft-2020-12 : `type` becomes an array: `[\"string\", \"null\"]`\n * - openai-strict : same as draft-2020-12 (type array form)\n * - draft-07 : wraps in `oneOf: [{ ...schema }, { type: \"null\" }]`\n * - openapi-3.0 : adds `nullable: true` alongside the existing type\n *\n * Mutates the schema in-place.\n *\n * @example\n * ```ts\n * const schema = { type: \"string\" };\n * applyNullable(schema, \"draft-2020-12\");\n * // → { type: [\"string\", \"null\"] }\n * ```\n */\nexport function applyNullable(schema: JsonSchemaResult, target: JsonSchemaTarget): void {\n if (target === \"openapi-3.0\") {\n schema.nullable = true;\n return;\n }\n\n if (target === \"draft-2020-12\" || target === \"openai-strict\") {\n const baseType = schema.type as string | string[] | undefined;\n schema.type = Array.isArray(baseType)\n ? [...baseType, \"null\"]\n : [baseType as string, \"null\"];\n return;\n }\n\n // draft-07: oneOf wrapping\n const copy = { ...schema };\n for (const key of Object.keys(schema)) {\n delete schema[key];\n }\n schema.oneOf = [copy, { type: \"null\" }];\n}\n\n/**\n * Wrap a field schema as nullable for OpenAI strict mode.\n *\n * OpenAI strict requires optional fields to be expressed as a nullable type\n * rather than being omitted from the `required` array. This helper wraps a\n * given schema into its nullable equivalent using the type-array form.\n *\n * Unlike `applyNullable()` (which mutates in-place), this returns a new\n * schema object to avoid side effects when wrapping child schemas.\n *\n * @example\n * ```ts\n * wrapNullableStrict({ type: \"string\", minLength: 3 })\n * // → { type: [\"string\", \"null\"], minLength: 3 }\n *\n * wrapNullableStrict({ type: \"object\", properties: {...} })\n * // → { type: [\"object\", \"null\"], properties: {...} }\n *\n * wrapNullableStrict({ oneOf: [...] })\n * // → { oneOf: [..., { type: \"null\" }] }\n * ```\n */\nexport function wrapNullableStrict(schema: JsonSchemaResult): JsonSchemaResult {\n // If the schema uses oneOf/anyOf (e.g. union), append null to the list\n if (schema.oneOf) {\n return { ...schema, oneOf: [...(schema.oneOf as unknown[]), { type: \"null\" }] };\n }\n\n if (schema.anyOf) {\n return { ...schema, anyOf: [...(schema.anyOf as unknown[]), { type: \"null\" }] };\n }\n\n // If there's no type at all (permissive `{}`), stay permissive\n if (schema.type === undefined) {\n return schema;\n }\n\n // Standard case: wrap type into array with null\n const baseType = schema.type as string | string[];\n return {\n ...schema,\n type: Array.isArray(baseType) ? [...baseType, \"null\"] : [baseType, \"null\"],\n };\n}\n\n/**\n * Find the first rule matching the given name in a rules array,\n * and return its options bag.\n */\nexport function getRuleOptions(\n rules: Array<{ name: string; context: { options: Record<string, unknown> } }>,\n ruleName: string,\n): Record<string, unknown> | undefined {\n const rule = rules.find(r => r.name === ruleName);\n return rule?.context?.options as Record<string, unknown> | undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA6BA,SAAgB,cAAc,QAA0B,QAAgC;CACtF,IAAI,WAAW,eAAe;EAC5B,OAAO,WAAW;EAClB;CACF;CAEA,IAAI,WAAW,mBAAmB,WAAW,iBAAiB;EAC5D,MAAM,WAAW,OAAO;EACxB,OAAO,OAAO,MAAM,QAAQ,QAAQ,IAChC,CAAC,GAAG,UAAU,MAAM,IACpB,CAAC,UAAoB,MAAM;EAC/B;CACF;CAGA,MAAM,OAAO,EAAE,GAAG,OAAO;CACzB,KAAK,MAAM,OAAO,OAAO,KAAK,MAAM,GAClC,OAAO,OAAO;CAEhB,OAAO,QAAQ,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC;AACxC;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,mBAAmB,QAA4C;CAE7E,IAAI,OAAO,OACT,OAAO;EAAE,GAAG;EAAQ,OAAO,CAAC,GAAI,OAAO,OAAqB,EAAE,MAAM,OAAO,CAAC;CAAE;CAGhF,IAAI,OAAO,OACT,OAAO;EAAE,GAAG;EAAQ,OAAO,CAAC,GAAI,OAAO,OAAqB,EAAE,MAAM,OAAO,CAAC;CAAE;CAIhF,IAAI,OAAO,SAAS,QAClB,OAAO;CAIT,MAAM,WAAW,OAAO;CACxB,OAAO;EACL,GAAG;EACH,MAAM,MAAM,QAAQ,QAAQ,IAAI,CAAC,GAAG,UAAU,MAAM,IAAI,CAAC,UAAU,MAAM;CAC3E;AACF;;;;;AAMA,SAAgB,eACd,OACA,UACqC;CAErC,OADa,MAAM,MAAK,MAAK,EAAE,SAAS,QAC9B,CAAC,EAAE,SAAS;AACxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"map-result.mjs","names":[],"sources":["../../../../../../../seal/src/standard-schema/map-result.ts"],"sourcesContent":["import type { ValidationResult } from \"../types\";\nimport type { StandardSchemaV1 } from \"./types\";\n\n/**\n * Maps a Seal ValidationResult to a Standard Schema result shape.\n *\n * Seal error paths are dot-notation strings (e.g. \"address.city\").\n * Standard Schema expects an array of path segments: [{ key: \"address\" }, { key: \"city\" }].\n *\n * @example\n * ```ts\n * const result = await validator.validate(value, context);\n * return mapToStandardResult(result);\n * // Success → { value: <data> }\n * // Failure → { issues: [{ message: \"...\", path: [{ key: \"...\" }] }] }\n * ```\n */\nexport function mapToStandardResult(\n result: ValidationResult,\n): StandardSchemaV1.Result<unknown> {\n if (result.isValid) {\n return { value: result.data };\n }\n\n return {\n issues: result.errors.map(e => ({\n message: e.error,\n path: e.input\n ? e.input.split(\".\").map(key => ({ key }))\n : undefined,\n })),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiBA,SAAgB,oBACd,QACkC;CAClC,IAAI,OAAO,SACT,OAAO,EAAE,OAAO,OAAO,KAAK;CAG9B,OAAO,EACL,QAAQ,OAAO,OAAO,KAAI,OAAM;EAC9B,SAAS,EAAE;EACX,MAAM,EAAE,QACJ,EAAE,MAAM,MAAM,GAAG,EAAE,KAAI,SAAQ,EAAE,IAAI,EAAE,IACvC;CACN,EAAE,EACJ;AACF"}
1
+ {"version":3,"file":"map-result.mjs","names":[],"sources":["../../../../../../../seal/src/standard-schema/map-result.ts"],"sourcesContent":["import type { ValidationResult } from \"../types\";\nimport type { StandardSchemaV1 } from \"./types\";\n\n/**\n * Maps a Seal ValidationResult to a Standard Schema result shape.\n *\n * Seal error paths are dot-notation strings (e.g. \"address.city\").\n * Standard Schema expects an array of path segments: [{ key: \"address\" }, { key: \"city\" }].\n *\n * @example\n * ```ts\n * const result = await validator.validate(value, context);\n * return mapToStandardResult(result);\n * // Success → { value: <data> }\n * // Failure → { issues: [{ message: \"...\", path: [{ key: \"...\" }] }] }\n * ```\n */\nexport function mapToStandardResult(\n result: ValidationResult,\n): StandardSchemaV1.Result<unknown> {\n if (result.isValid) {\n return { value: result.data };\n }\n\n return {\n issues: result.errors.map(e => ({\n message: e.error,\n path: e.input\n ? e.input.split(\".\").map(key => ({ key }))\n : undefined,\n })),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiBA,SAAgB,oBACd,QACkC;CAClC,IAAI,OAAO,SACT,OAAO,EAAE,OAAO,OAAO,KAAK;CAG9B,OAAO,EACL,QAAQ,OAAO,OAAO,KAAI,OAAM;EAC9B,SAAS,EAAE;EACX,MAAM,EAAE,QACJ,EAAE,MAAM,MAAM,GAAG,CAAC,CAAC,KAAI,SAAQ,EAAE,IAAI,EAAE,IACvC;CACN,EAAE,EACJ;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"array-validator.d.mts","names":[],"sources":["../../../../../../../seal/src/validators/array-validator.ts"],"mappings":";;;;;;;;;cAmBa,cAAA,SAAuB,aAAA;EAEzB,SAAA,EAAW,aAAA;cAAX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EAYC,MAAA,CAAO,IAAA,OAAW,OAAA,EAAS,aAAA,GAAa,OAAA;;;;EAc9C,KAAA,CAAM,KAAA;;;;EASA,QAAA,CAAS,IAAA,OAAW,OAAA,EAAS,aAAA,GAAgB,OAAA,CAAQ,gBAAA;;;;YA6ExD,qBAAA,CAAsB,IAAA,EAAM,oBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAmDjB,oBAAA,CAAqB,KAAA,CAAM,MAAA,EAAQ,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;EAyCjD,YAAA,CAAa,OAAA,GAAS,gBAAA,GAAqC,gBAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"computed-validator.d.mts","names":[],"sources":["../../../../../../../seal/src/validators/computed-validator.ts"],"mappings":";;;;;;;;;AAQA;KAAY,gBAAA,mBACV,IAAA,OACA,OAAA,EAAS,aAAA,KACN,OAAA,GAAU,OAAA,CAAQ,OAAA;;;;;;;;;;;;;;;;AAAO;AAkC9B;;;;;;;;;;;;;;;;cAAa,iBAAA,wBAAyC,aAAA;EAAA,UAQxC,QAAA,EAAU,gBAAA,CAAiB,OAAA;EAAA,UAC3B,eAAA,GAAkB,aAAA;EADlB;;;;;;cAAA,QAAA,EAAU,gBAAA,CAAiB,OAAA,GAC3B,eAAA,GAAkB,aAAA;EADS;;;EAS1B,QAAA,CAAS,IAAA,OAAW,OAAA,EAAS,aAAA,GAAgB,OAAA,CAAQ,gBAAA;EAArD;;;;EAkDG,KAAA,CAAA;EAlDkD;;;EA+D3D,WAAA,CAAY,KAAA;EAaH;;;;;AAA2E;;;;EAA3E,YAAA,CAAa,OAAA,GAAS,gBAAA,GAAqC,gBAAA;AAAA"}
1
+ {"version":3,"file":"computed-validator.d.mts","names":[],"sources":["../../../../../../../seal/src/validators/computed-validator.ts"],"mappings":";;;;;;;;;AAQA;KAAY,gBAAA,mBACV,IAAA,OACA,OAAA,EAAS,aAAA,KACN,OAAA,GAAU,O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