@warlock.js/notifications 5.1.0 → 5.2.2
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.
- package/CHANGELOG.md +11 -0
- package/README.md +8 -0
- package/cjs/{channel_api-CH3DxhRU.cjs → channel_api-ChOeNKM1.cjs} +42 -42
- package/cjs/channel_api-ChOeNKM1.cjs.map +1 -0
- package/cjs/index.cjs +1 -1
- package/cjs/index.cjs.map +1 -1
- package/cjs/rabbitmq-driver-Drn1T40o.cjs +3 -0
- package/cjs/{src-Cus6pYPC.cjs → src-Dy5nwVcs.cjs} +57 -29
- package/cjs/src-Dy5nwVcs.cjs.map +1 -0
- package/esm/channels/database-channel.d.mts.map +1 -1
- package/esm/config.d.mts.map +1 -1
- package/esm/dispatch/define-channel.d.mts.map +1 -1
- package/esm/dispatch/define-notification.d.mts.map +1 -1
- package/esm/dispatch/define-notification.mjs.map +1 -1
- package/esm/dispatch/notifications-event-bus.mjs.map +1 -1
- package/esm/dispatch/notify.mjs.map +1 -1
- package/esm/errors.d.mts.map +1 -1
- package/esm/herald/src/communicators/broker.mjs.map +1 -1
- package/esm/herald/src/drivers/rabbitmq/rabbitmq-channel.mjs.map +1 -1
- package/esm/herald/src/drivers/rabbitmq/rabbitmq-driver.mjs +1 -1
- package/esm/herald/src/drivers/rabbitmq/rabbitmq-driver.mjs.map +1 -1
- package/esm/herald/src/message-managers/event-consumer.mjs.map +1 -1
- package/esm/herald/src/message-managers/event-message.mjs.map +1 -1
- package/esm/herald/src/message-managers/prepare-consumer-subscription.mjs.map +1 -1
- package/esm/herald/src/use-case-broadcast.mjs.map +1 -1
- package/esm/herald/src/utils/connect-to-broker.mjs.map +1 -1
- package/esm/in-app/base-notifications-repository.d.mts.map +1 -1
- package/esm/in-app/database-notification.d.mts.map +1 -1
- package/esm/in-app/in-app.d.mts.map +1 -1
- package/esm/migration/notification-columns.mjs.map +1 -1
- package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/Random/_internal.mjs +6 -0
- package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/Random/_internal.mjs.map +1 -0
- package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/mixed/clone/clone.mjs +1 -1
- package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/mixed/clone/clone.mjs.map +1 -0
- package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/number/round.mjs +1 -1
- package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/number/round.mjs.map +1 -0
- package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/object/except.mjs +1 -1
- package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/object/except.mjs.map +1 -0
- package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/object/get.mjs +1 -1
- package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/object/get.mjs.map +1 -0
- package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/object/omit.mjs +1 -1
- package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/object/omit.mjs.map +1 -0
- package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/object/unset.mjs +1 -1
- package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/object/unset.mjs.map +1 -0
- package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/string/capitalize.mjs +1 -1
- package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/capitalize.mjs.map +1 -0
- package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/string/ltrim.mjs +1 -1
- package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/ltrim.mjs.map +1 -0
- package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/string/readMoreChars.mjs +1 -1
- package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/readMoreChars.mjs.map +1 -0
- package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/string/rtrim.mjs +1 -1
- package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/rtrim.mjs.map +1 -0
- package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/string/toCamelCase.mjs +1 -1
- package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/toCamelCase.mjs.map +1 -0
- package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/string/toKebabCase.mjs +1 -1
- package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/toKebabCase.mjs.map +1 -0
- package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/string/toSnakeCase.mjs +1 -1
- package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/toSnakeCase.mjs.map +1 -0
- package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/string/toStudlyCase.mjs +1 -1
- package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/toStudlyCase.mjs.map +1 -0
- package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/string/trim.mjs +1 -1
- package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/trim.mjs.map +1 -0
- package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/string/ucfirst.mjs +1 -1
- package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/ucfirst.mjs.map +1 -0
- package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/string/words.mjs +1 -1
- package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/words.mjs.map +1 -0
- package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/utils/escapeRegex.mjs +1 -1
- package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/utils/escapeRegex.mjs.map +1 -0
- package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/utils/lazy.mjs +1 -1
- package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/utils/lazy.mjs.map +1 -0
- package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/utils/tap.mjs +1 -1
- package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/utils/tap.mjs.map +1 -0
- package/esm/node_modules/{@mongez → .pnpm/@mongez_supportive-is@2.1.4/node_modules/@mongez}/supportive-is/esm/index.mjs +1 -1
- package/esm/node_modules/.pnpm/@mongez_supportive-is@2.1.4/node_modules/@mongez/supportive-is/esm/index.mjs.map +1 -0
- package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/channel_api.mjs +2 -2
- package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/channel_api.mjs.map +1 -0
- package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/api_args.mjs +2 -2
- package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/api_args.mjs.map +1 -0
- package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/bitset.mjs +2 -2
- package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/bitset.mjs.map +1 -0
- package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/channel.mjs +2 -2
- package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/channel.mjs.map +1 -0
- package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/channel_model.mjs +2 -2
- package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/channel_model.mjs.map +1 -0
- package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/codec.mjs +3 -3
- package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/codec.mjs.map +1 -0
- package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/connect.mjs +3 -3
- package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/connect.mjs.map +1 -0
- package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/connection.mjs +2 -2
- package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/connection.mjs.map +1 -0
- package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/credentials.mjs +2 -2
- package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/credentials.mjs.map +1 -0
- package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/defs.mjs +3 -3
- package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/defs.mjs.map +1 -0
- package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/error.mjs +2 -2
- package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/error.mjs.map +1 -0
- package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/format.mjs +2 -2
- package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/format.mjs.map +1 -0
- package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/frame.mjs +3 -3
- package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/frame.mjs.map +1 -0
- package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/heartbeat.mjs +2 -2
- package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/heartbeat.mjs.map +1 -0
- package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/mux.mjs +2 -2
- package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/mux.mjs.map +1 -0
- package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/package.mjs +2 -2
- package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/package.mjs.map +1 -0
- package/esm/node_modules/{buffer-more-ints → .pnpm/buffer-more-ints@1.0.0/node_modules/buffer-more-ints}/buffer-more-ints.mjs +2 -2
- package/esm/node_modules/.pnpm/buffer-more-ints@1.0.0/node_modules/buffer-more-ints/buffer-more-ints.mjs.map +1 -0
- package/esm/node_modules/{dayjs → .pnpm/dayjs@1.11.23/node_modules/dayjs}/dayjs.min.mjs +2 -2
- package/esm/node_modules/.pnpm/dayjs@1.11.23/node_modules/dayjs/dayjs.min.mjs.map +1 -0
- package/esm/node_modules/{querystringify → .pnpm/querystringify@2.2.0/node_modules/querystringify}/index.mjs +2 -2
- package/esm/node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.mjs.map +1 -0
- package/esm/node_modules/{requires-port → .pnpm/requires-port@1.0.0/node_modules/requires-port}/index.mjs +2 -2
- package/esm/node_modules/.pnpm/requires-port@1.0.0/node_modules/requires-port/index.mjs.map +1 -0
- package/esm/node_modules/{url-parse → .pnpm/url-parse@1.5.10/node_modules/url-parse}/index.mjs +4 -4
- package/esm/node_modules/.pnpm/url-parse@1.5.10/node_modules/url-parse/index.mjs.map +1 -0
- package/esm/queue/herald-queue.mjs.map +1 -1
- package/esm/queue/notifications-worker.mjs.map +1 -1
- package/esm/seal/src/factory/validators.mjs.map +1 -1
- package/esm/seal/src/helpers/get-field-value.mjs +2 -2
- package/esm/seal/src/helpers/is-empty-value.mjs +1 -1
- package/esm/seal/src/helpers/validation-helpers.mjs.map +1 -1
- package/esm/seal/src/mutators/array-mutators.mjs +2 -2
- package/esm/seal/src/mutators/date-mutators.mjs +1 -1
- package/esm/seal/src/mutators/number-mutators.mjs +3 -3
- package/esm/seal/src/mutators/number-mutators.mjs.map +1 -1
- package/esm/seal/src/mutators/object-mutators.mjs +3 -3
- package/esm/seal/src/mutators/scalar-mutators.mjs.map +1 -1
- package/esm/seal/src/mutators/string-mutators.mjs +10 -10
- package/esm/seal/src/mutators/string-mutators.mjs.map +1 -1
- package/esm/seal/src/rules/array/array-rules.mjs.map +1 -1
- package/esm/seal/src/rules/common/enum.mjs.map +1 -1
- package/esm/seal/src/rules/common/literal.mjs.map +1 -1
- package/esm/seal/src/rules/common/type-rules.mjs +1 -1
- package/esm/seal/src/rules/common/unknown-key.mjs.map +1 -1
- package/esm/seal/src/rules/conditional/present-with-rules.mjs +2 -2
- package/esm/seal/src/rules/conditional/present-without-rules.mjs +2 -2
- package/esm/seal/src/rules/conditional/required-if-rules.mjs +2 -2
- package/esm/seal/src/rules/conditional/required-if-rules.mjs.map +1 -1
- package/esm/seal/src/rules/conditional/required-with-rules.mjs +2 -2
- package/esm/seal/src/rules/conditional/required-without-rules.mjs +2 -2
- package/esm/seal/src/rules/core/union.mjs.map +1 -1
- package/esm/seal/src/rules/core/when.mjs +2 -2
- package/esm/seal/src/rules/core/when.mjs.map +1 -1
- package/esm/seal/src/rules/date/date-day-rules.mjs.map +1 -1
- package/esm/seal/src/rules/date/date-field-comparison-rules.mjs +2 -2
- package/esm/seal/src/rules/date/date-period-rules.mjs +2 -2
- package/esm/seal/src/rules/date/date-period-rules.mjs.map +1 -1
- package/esm/seal/src/rules/date/date-special-rules.mjs.map +1 -1
- package/esm/seal/src/rules/date/date.mjs +2 -2
- package/esm/seal/src/rules/date/date.mjs.map +1 -1
- package/esm/seal/src/rules/length/length-rules.mjs.map +1 -1
- package/esm/seal/src/rules/number/number-rules.mjs +2 -2
- package/esm/seal/src/rules/scalar/accepted-rule.mjs.map +1 -1
- package/esm/seal/src/rules/scalar/declined-rule.mjs.map +1 -1
- package/esm/seal/src/rules/string/credit-card.mjs.map +1 -1
- package/esm/seal/src/rules/string/email.mjs +1 -1
- package/esm/seal/src/rules/string/id-formats.mjs.map +1 -1
- package/esm/seal/src/rules/string/matches.mjs +1 -1
- package/esm/seal/src/rules/string/string-comparison.mjs.map +1 -1
- package/esm/seal/src/standard-schema/json-schema.mjs.map +1 -1
- package/esm/seal/src/standard-schema/map-result.mjs.map +1 -1
- package/esm/seal/src/validators/base-validator.mjs +2 -2
- package/esm/seal/src/validators/date-validator.mjs +1 -1
- package/esm/seal/src/validators/date-validator.mjs.map +1 -1
- package/esm/seal/src/validators/discriminated-union-validator.mjs +1 -1
- package/esm/seal/src/validators/discriminated-union-validator.mjs.map +1 -1
- package/esm/seal/src/validators/lazy-validator.mjs.map +1 -1
- package/esm/seal/src/validators/methods/required-methods.mjs.map +1 -1
- package/esm/seal/src/validators/numeric-validator.mjs +1 -1
- package/esm/seal/src/validators/object-validator.mjs +3 -3
- package/esm/seal/src/validators/object-validator.mjs.map +1 -1
- package/esm/seal/src/validators/record-validator.mjs +1 -1
- package/esm/seal/src/validators/record-validator.mjs.map +1 -1
- package/esm/seal/src/validators/scalar-validator.mjs.map +1 -1
- package/esm/seal/src/validators/union-validator.mjs.map +1 -1
- package/llms-full.txt +4 -0
- package/package.json +9 -6
- package/skills/notifications-basics/SKILL.md +4 -0
- package/cjs/channel_api-CH3DxhRU.cjs.map +0 -1
- package/cjs/chunk-fl3r8ClO.cjs +0 -41
- package/cjs/rabbitmq-driver-CJtyxjUQ.cjs +0 -3
- package/cjs/src-Cus6pYPC.cjs.map +0 -1
- package/esm/node_modules/@mongez/reinforcements/esm/Random/_internal.mjs +0 -6
- package/esm/node_modules/@mongez/reinforcements/esm/Random/_internal.mjs.map +0 -1
- package/esm/node_modules/@mongez/reinforcements/esm/mixed/clone/clone.mjs.map +0 -1
- package/esm/node_modules/@mongez/reinforcements/esm/number/round.mjs.map +0 -1
- package/esm/node_modules/@mongez/reinforcements/esm/object/except.mjs.map +0 -1
- package/esm/node_modules/@mongez/reinforcements/esm/object/get.mjs.map +0 -1
- package/esm/node_modules/@mongez/reinforcements/esm/object/omit.mjs.map +0 -1
- package/esm/node_modules/@mongez/reinforcements/esm/object/unset.mjs.map +0 -1
- package/esm/node_modules/@mongez/reinforcements/esm/string/capitalize.mjs.map +0 -1
- package/esm/node_modules/@mongez/reinforcements/esm/string/ltrim.mjs.map +0 -1
- package/esm/node_modules/@mongez/reinforcements/esm/string/readMoreChars.mjs.map +0 -1
- package/esm/node_modules/@mongez/reinforcements/esm/string/rtrim.mjs.map +0 -1
- package/esm/node_modules/@mongez/reinforcements/esm/string/toCamelCase.mjs.map +0 -1
- package/esm/node_modules/@mongez/reinforcements/esm/string/toKebabCase.mjs.map +0 -1
- package/esm/node_modules/@mongez/reinforcements/esm/string/toSnakeCase.mjs.map +0 -1
- package/esm/node_modules/@mongez/reinforcements/esm/string/toStudlyCase.mjs.map +0 -1
- package/esm/node_modules/@mongez/reinforcements/esm/string/trim.mjs.map +0 -1
- package/esm/node_modules/@mongez/reinforcements/esm/string/ucfirst.mjs.map +0 -1
- package/esm/node_modules/@mongez/reinforcements/esm/string/words.mjs.map +0 -1
- package/esm/node_modules/@mongez/reinforcements/esm/utils/escapeRegex.mjs.map +0 -1
- package/esm/node_modules/@mongez/reinforcements/esm/utils/lazy.mjs.map +0 -1
- package/esm/node_modules/@mongez/reinforcements/esm/utils/tap.mjs.map +0 -1
- package/esm/node_modules/@mongez/supportive-is/esm/index.mjs.map +0 -1
- package/esm/node_modules/amqplib/channel_api.mjs.map +0 -1
- package/esm/node_modules/amqplib/lib/api_args.mjs.map +0 -1
- package/esm/node_modules/amqplib/lib/bitset.mjs.map +0 -1
- package/esm/node_modules/amqplib/lib/channel.mjs.map +0 -1
- package/esm/node_modules/amqplib/lib/channel_model.mjs.map +0 -1
- package/esm/node_modules/amqplib/lib/codec.mjs.map +0 -1
- package/esm/node_modules/amqplib/lib/connect.mjs.map +0 -1
- package/esm/node_modules/amqplib/lib/connection.mjs.map +0 -1
- package/esm/node_modules/amqplib/lib/credentials.mjs.map +0 -1
- package/esm/node_modules/amqplib/lib/defs.mjs.map +0 -1
- package/esm/node_modules/amqplib/lib/error.mjs.map +0 -1
- package/esm/node_modules/amqplib/lib/format.mjs.map +0 -1
- package/esm/node_modules/amqplib/lib/frame.mjs.map +0 -1
- package/esm/node_modules/amqplib/lib/heartbeat.mjs.map +0 -1
- package/esm/node_modules/amqplib/lib/mux.mjs.map +0 -1
- package/esm/node_modules/amqplib/package.mjs.map +0 -1
- package/esm/node_modules/buffer-more-ints/buffer-more-ints.mjs.map +0 -1
- package/esm/node_modules/dayjs/dayjs.min.mjs.map +0 -1
- package/esm/node_modules/querystringify/index.mjs.map +0 -1
- package/esm/node_modules/requires-port/index.mjs.map +0 -1
- package/esm/node_modules/url-parse/index.mjs.map +0 -1
- /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/bool.mjs +0 -0
- /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/color.mjs +0 -0
- /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/date.mjs +0 -0
- /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/float.mjs +0 -0
- /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/id.mjs +0 -0
- /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/int.mjs +0 -0
- /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/nanoid.mjs +0 -0
- /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/pick.mjs +0 -0
- /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/random.mjs +0 -0
- /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/sample.mjs +0 -0
- /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/string.mjs +0 -0
- /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/token.mjs +0 -0
- /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/uuid.mjs +0 -0
- /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/weighted.mjs +0 -0
- /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/async/retry.mjs +0 -0
- /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/index.mjs +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"src-Dy5nwVcs.cjs","names":["WHITESPACE_RUN","capitalize","defaultRequiredRule","capitalize","validateFunction","EventEmitter","EventEmitter"],"sources":["../../../../../../herald/src/message-managers/prepare-consumer-subscription.ts","../../../../../../seal/src/standard-schema/json-schema.ts","../../../../../../node_modules/.pnpm/@mongez+reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/object/get.mjs","../../../../../../node_modules/.pnpm/@mongez+reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/mixed/clone/clone.mjs","../../../../../../node_modules/.pnpm/@mongez+reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/number/round.mjs","../../../../../../node_modules/.pnpm/@mongez+reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/object/unset.mjs","../../../../../../node_modules/.pnpm/@mongez+reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/object/omit.mjs","../../../../../../node_modules/.pnpm/@mongez+reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/object/except.mjs","../../../../../../node_modules/.pnpm/@mongez+reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/Random/_internal.mjs","../../../../../../node_modules/.pnpm/@mongez+reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/ucfirst.mjs","../../../../../../node_modules/.pnpm/@mongez+reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/capitalize.mjs","../../../../../../node_modules/.pnpm/@mongez+reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/utils/escapeRegex.mjs","../../../../../../node_modules/.pnpm/@mongez+reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/trim.mjs","../../../../../../node_modules/.pnpm/@mongez+reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/ltrim.mjs","../../../../../../node_modules/.pnpm/@mongez+reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/readMoreChars.mjs","../../../../../../node_modules/.pnpm/@mongez+reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/rtrim.mjs","../../../../../../node_modules/.pnpm/@mongez+reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/words.mjs","../../../../../../node_modules/.pnpm/@mongez+reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/toCamelCase.mjs","../../../../../../node_modules/.pnpm/@mongez+reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/toSnakeCase.mjs","../../../../../../node_modules/.pnpm/@mongez+reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/toKebabCase.mjs","../../../../../../node_modules/.pnpm/@mongez+reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/toStudlyCase.mjs","../../../../../../node_modules/.pnpm/@mongez+reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/utils/lazy.mjs","../../../../../../node_modules/.pnpm/@mongez+reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/utils/tap.mjs","../../../../../../seal/src/config.ts","../../../../../../seal/src/factory/validate.ts","../../../../../../seal/src/helpers/date-helpers.ts","../../../../../../seal/src/helpers/get-field-value.ts","../../../../../../seal/src/helpers/path-helpers.ts","../../../../../../seal/src/helpers/validation-helpers.ts","../../../../../../node_modules/.pnpm/@mongez+supportive-is@2.1.4/node_modules/@mongez/supportive-is/esm/index.mjs","../../../../../../seal/src/helpers/is-empty-value.ts","../../../../../../seal/src/rules/core/required.ts","../../../../../../seal/src/standard-schema/map-result.ts","../../../../../../seal/src/validators/base-validator.ts","../../../../../../seal/src/validators/any-validator.ts","../../../../../../seal/src/mutators/array-mutators.ts","../../../../../../node_modules/.pnpm/dayjs@1.11.23/node_modules/dayjs/dayjs.min.js","../../../../../../seal/src/mutators/date-mutators.ts","../../../../../../seal/src/mutators/number-mutators.ts","../../../../../../seal/src/mutators/object-mutators.ts","../../../../../../seal/src/mutators/scalar-mutators.ts","../../../../../../seal/src/mutators/string-mutators.ts","../../../../../../seal/src/rules/core/equal.ts","../../../../../../seal/src/rules/core/forbidden.ts","../../../../../../seal/src/rules/core/union.ts","../../../../../../seal/src/rules/core/when.ts","../../../../../../seal/src/rules/string/alpha.ts","../../../../../../seal/src/rules/string/credit-card.ts","../../../../../../seal/src/rules/string/email.ts","../../../../../../seal/src/rules/string/id-formats.ts","../../../../../../seal/src/rules/string/ip.ts","../../../../../../seal/src/rules/string/pattern.ts","../../../../../../seal/src/rules/string/string-comparison.ts","../../../../../../seal/src/rules/string/strong-password-rule.ts","../../../../../../seal/src/rules/string/url.ts","../../../../../../seal/src/rules/string/without-whitespace.ts","../../../../../../seal/src/rules/number/number-rules.ts","../../../../../../seal/src/rules/length/length-rules.ts","../../../../../../seal/src/rules/array/array-rules.ts","../../../../../../seal/src/types/date-types.ts","../../../../../../seal/src/rules/date/date.ts","../../../../../../seal/src/rules/date/date-comparison-rules.ts","../../../../../../seal/src/rules/date/date-day-rules.ts","../../../../../../seal/src/rules/date/date-field-comparison-rules.ts","../../../../../../seal/src/rules/date/date-period-rules.ts","../../../../../../seal/src/rules/date/date-relative-rules.ts","../../../../../../seal/src/rules/date/date-special-rules.ts","../../../../../../seal/src/rules/color/color-rules.ts","../../../../../../seal/src/rules/conditional/required-if-rules.ts","../../../../../../seal/src/rules/conditional/required-unless-rules.ts","../../../../../../seal/src/rules/conditional/required-when-rule.ts","../../../../../../seal/src/rules/conditional/required-with-rules.ts","../../../../../../seal/src/rules/conditional/required-without-rules.ts","../../../../../../seal/src/rules/conditional/present-if-rules.ts","../../../../../../seal/src/rules/conditional/present-unless-rules.ts","../../../../../../seal/src/rules/conditional/present-with-rules.ts","../../../../../../seal/src/rules/conditional/present-without-rules.ts","../../../../../../seal/src/rules/conditional/forbidden-if-rules.ts","../../../../../../seal/src/rules/common/enum.ts","../../../../../../seal/src/rules/common/equals-field-rules.ts","../../../../../../seal/src/rules/common/instanceof.ts","../../../../../../seal/src/rules/common/literal.ts","../../../../../../seal/src/rules/common/type-rules.ts","../../../../../../seal/src/rules/common/unknown-key.ts","../../../../../../seal/src/validators/array-validator.ts","../../../../../../seal/src/validators/methods/equality-conditional-methods.ts","../../../../../../seal/src/validators/methods/forbidden-methods.ts","../../../../../../seal/src/validators/methods/present-methods.ts","../../../../../../seal/src/validators/methods/required-methods.ts","../../../../../../seal/src/validators/primitive-validator.ts","../../../../../../seal/src/rules/scalar/accepted-rule.ts","../../../../../../seal/src/rules/scalar/declined-rule.ts","../../../../../../seal/src/validators/boolean-validator.ts","../../../../../../seal/src/validators/computed-validator.ts","../../../../../../seal/src/validators/date-validator.ts","../../../../../../seal/src/validators/literal-validator.ts","../../../../../../seal/src/validators/discriminated-union-validator.ts","../../../../../../seal/src/validators/number-validator.ts","../../../../../../seal/src/validators/float-validator.ts","../../../../../../seal/src/validators/instanceof-validator.ts","../../../../../../seal/src/validators/int-validator.ts","../../../../../../seal/src/validators/lazy-validator.ts","../../../../../../seal/src/validators/managed-validator.ts","../../../../../../seal/src/validators/numeric-validator.ts","../../../../../../seal/src/validators/object-validator.ts","../../../../../../seal/src/validators/record-validator.ts","../../../../../../seal/src/validators/scalar-validator.ts","../../../../../../seal/src/validators/string-validator.ts","../../../../../../seal/src/validators/tuple-validator.ts","../../../../../../seal/src/validators/union-validator.ts","../../../../../../seal/src/factory/validators.ts","../../../../../../herald/src/drivers/rabbitmq/rabbitmq-channel.ts","../../../../../../herald/src/drivers/rabbitmq/rabbitmq-driver.ts","../../../../../../herald/src/communicators/broker.ts","../../../../../../herald/src/communicators/broker-registry.ts","../../../../../../herald/src/utils/connect-to-broker.ts","../../../../../../herald/src/decorators/consumable.ts","../../../../../../herald/src/message-managers/event-consumer.ts","../../../../../../herald/src/message-managers/event-message.ts","../../../../../../herald/src/use-case-broadcast.ts"],"sourcesContent":["import type { MessageHandler } from \"./../types\";\r\nimport { type EventConsumerClass } from \"./types\";\r\n\r\nexport function prepareConsumerSubscription(\r\n Consumer: EventConsumerClass,\r\n onError?: (error: unknown, consumerName: string) => void,\r\n) {\r\n const callback: MessageHandler<any> = async (message, ctx) => {\r\n const envelope = message.payload;\r\n let eventPayload = envelope.payload;\r\n\r\n if (envelope.version) {\r\n if (!Consumer.isAcceptedVersion(Number(envelope.version))) {\r\n ctx.ack(); // Acknowledge but don't process\r\n return;\r\n }\r\n }\r\n\r\n const consumer = new Consumer();\r\n\r\n if (consumer.schema) {\r\n const result = await consumer.validate(eventPayload);\r\n if (!result || result.isValid === false) {\r\n ctx.nack();\r\n return;\r\n }\r\n\r\n eventPayload = result.data;\r\n }\r\n try {\r\n await consumer.handle(eventPayload, {\r\n payload: eventPayload,\r\n eventName: Consumer.eventName,\r\n messageId: message.metadata.messageId!,\r\n occurredAt: envelope.occurredAt ? new Date(envelope.occurredAt) : undefined,\r\n metadata: envelope.metadata,\r\n version: envelope.version,\r\n message,\r\n });\r\n ctx.ack(); // Auto-ack on success?\r\n } catch (error) {\r\n // Bounded retry instead of an unconditional requeue: a message that\r\n // reliably throws (bad payload, a handler bug, a downstream outage)\r\n // would otherwise be nack+requeued forever, pinning the consumer in a\r\n // hot loop. `ctx.retry()` caps redelivery and dead-letters/drops (with\r\n // a loud log) once the cap is hit.\r\n await ctx.retry();\r\n if (onError) {\r\n onError(error, Consumer.eventName);\r\n }\r\n }\r\n };\r\n\r\n return callback;\r\n}\r\n","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","//#region ../reinforcements/src/object/get.ts\nfunction get(object, path, defaultValue) {\n\tif (object === null || object === void 0) return defaultValue;\n\tif (path === \"\") return defaultValue;\n\tconst segments = path.split(\".\");\n\tlet current = object;\n\tfor (const key of segments) {\n\t\tif (current === null || current === void 0) return defaultValue;\n\t\tif (typeof current !== \"object\") return defaultValue;\n\t\tif (!Object.prototype.hasOwnProperty.call(current, key)) return defaultValue;\n\t\tcurrent = current[key];\n\t}\n\treturn current === void 0 ? defaultValue : current;\n}\n\n//#endregion\nexport { get as default };\n//# sourceMappingURL=get.mjs.map","//#region ../reinforcements/src/mixed/clone/clone.ts\n/**\n* Deep-clone a value. Supports plain objects, arrays, `Date`, `RegExp`,\n* `Map`, `Set`, `Error`, and typed arrays. Handles circular references\n* via an internal `WeakMap`.\n*\n* Non-plain class instances are returned by reference — cloning custom\n* constructors requires the class's own copy logic, so this function\n* stops at that boundary rather than silently producing a half-clone.\n*\n* @example\n* const original = { user: { name: \"Ada\" }, tags: [\"x\"] };\n* const copy = clone(original);\n*\n* copy.user.name = \"Bob\";\n* original.user.name; // \"Ada\"\n*/\nfunction clone(value) {\n\tif (value === null || typeof value !== \"object\") return value;\n\treturn cloneDeep(value, /* @__PURE__ */ new WeakMap());\n}\nfunction cloneDeep(value, seen) {\n\tif (value === null || typeof value !== \"object\") return value;\n\tif (seen.has(value)) return seen.get(value);\n\tif (value instanceof Date) return new Date(value.getTime());\n\tif (value instanceof RegExp) return cloneRegExp(value);\n\tif (value instanceof Error) return cloneError(value, seen);\n\tif (Array.isArray(value)) return cloneArray(value, seen);\n\tif (value instanceof Map) return cloneMap(value, seen);\n\tif (value instanceof Set) return cloneSet(value, seen);\n\tif (ArrayBuffer.isView(value) && !(value instanceof DataView)) return cloneTypedArray(value);\n\tif (value instanceof ArrayBuffer) return value.slice(0);\n\treturn clonePlainObject(value, seen);\n}\nfunction cloneRegExp(value) {\n\tconst copy = new RegExp(value.source, value.flags);\n\tcopy.lastIndex = value.lastIndex;\n\treturn copy;\n}\nfunction cloneError(value, seen) {\n\tconst Ctor = value.constructor;\n\tconst copy = new Ctor(value.message);\n\tcopy.stack = value.stack;\n\tcopy.name = value.name;\n\tseen.set(value, copy);\n\tfor (const key of Object.keys(value)) copy[key] = cloneDeep(value[key], seen);\n\treturn copy;\n}\nfunction cloneArray(value, seen) {\n\tconst copy = [];\n\tseen.set(value, copy);\n\tfor (const item of value) copy.push(cloneDeep(item, seen));\n\treturn copy;\n}\nfunction cloneMap(value, seen) {\n\tconst copy = /* @__PURE__ */ new Map();\n\tseen.set(value, copy);\n\tfor (const [key, val] of value) copy.set(cloneDeep(key, seen), cloneDeep(val, seen));\n\treturn copy;\n}\nfunction cloneSet(value, seen) {\n\tconst copy = /* @__PURE__ */ new Set();\n\tseen.set(value, copy);\n\tfor (const item of value) copy.add(cloneDeep(item, seen));\n\treturn copy;\n}\nfunction cloneTypedArray(value) {\n\tconst Ctor = value.constructor;\n\treturn new Ctor(value.buffer.slice(0));\n}\nfunction clonePlainObject(value, seen) {\n\tconst proto = Object.getPrototypeOf(value);\n\tif (!(proto === Object.prototype || proto === null)) return value;\n\tconst copy = Object.create(proto);\n\tseen.set(value, copy);\n\tfor (const key of Object.keys(value)) copy[key] = cloneDeep(value[key], seen);\n\treturn copy;\n}\n\n//#endregion\nexport { clone as default };\n//# sourceMappingURL=clone.mjs.map","//#region ../reinforcements/src/number/round.ts\n/**\n* Round `value` to the given number of decimal places (banker's-style\n* `Math.round`).\n*\n* @example\n* round(1.235, 2); // 1.24\n* round(1.5); // 2\n*/\nfunction round(value, precision = 2) {\n\tconst multiplier = Math.pow(10, precision || 0);\n\treturn Math.round(value * multiplier) / multiplier;\n}\n\n//#endregion\nexport { round as default };\n//# sourceMappingURL=round.mjs.map","import get from \"./get.mjs\";\n\n//#region ../reinforcements/src/object/unset.ts\n/**\n* Remove one or more dot-notation paths from `object`. Mutates and\n* returns the input.\n*\n* @example\n* unset({ a: 1, b: 2 }, [\"a\"]); // { b: 2 }\n* unset({ a: { b: 1, c: 2 } }, [\"a.b\"]); // { a: { c: 2 } }\n*/\nfunction unset(object, keys) {\n\tif (!object || typeof object !== \"object\" || Array.isArray(object)) return object;\n\tfor (const key of keys) deletePath(object, key);\n\treturn object;\n}\nfunction deletePath(object, path) {\n\tconst segments = path.split(\".\");\n\tif (segments.length === 1) {\n\t\tdelete object[path];\n\t\treturn;\n\t}\n\tconst lastKey = segments.pop();\n\tconst parent = get(object, segments.join(\".\"));\n\tif (parent && typeof parent === \"object\") delete parent[lastKey];\n}\n\n//#endregion\nexport { unset as default };\n//# sourceMappingURL=unset.mjs.map","import unset from \"./unset.mjs\";\n\n//#region ../reinforcements/src/object/omit.ts\nfunction omit(object, keysOrPredicate) {\n\tif (!object || typeof object !== \"object\" || Array.isArray(object)) return object;\n\tif (typeof keysOrPredicate === \"function\") return omitByPredicate(object, keysOrPredicate);\n\treturn unset({ ...object }, keysOrPredicate);\n}\nfunction omitByPredicate(object, predicate) {\n\tconst result = {};\n\tfor (const key of Object.keys(object)) if (!predicate(object[key], key)) result[key] = object[key];\n\treturn result;\n}\n\n//#endregion\nexport { omit as default };\n//# sourceMappingURL=omit.mjs.map","import omit from \"./omit.mjs\";\n\n//#region ../reinforcements/src/object/except.ts\n/**\n* @deprecated Use {@link omit} instead. Will be removed in a future major release.\n*/\nfunction except(object, keys) {\n\treturn omit(object, keys);\n}\n\n//#endregion\nexport { except as default };\n//# sourceMappingURL=except.mjs.map","//#region ../reinforcements/src/Random/_internal.ts\nconst ALPHANUMERIC = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\nconst URL_SAFE = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-\";\nconst cryptoRef = typeof globalThis !== \"undefined\" && globalThis.crypto ? globalThis.crypto : {};\nconst BYTE_VALUES = 256;\n/** Thrown by every security-shaped generator when no CSPRNG exists. */\nconst NO_CSPRNG_ERROR = \"No CSPRNG available: crypto.getRandomValues is required\";\n/**\n* Return the runtime CSPRNG, throwing when there is none. Tokens, ids\n* and uuids must never silently degrade to the seedable `next()` — a\n* predictable token is worse than a loud failure.\n*/\nfunction requireCsprng() {\n\tif (typeof cryptoRef.getRandomValues !== \"function\") throw new Error(NO_CSPRNG_ERROR);\n\treturn cryptoRef.getRandomValues.bind(cryptoRef);\n}\n/** Cryptographically secure random bytes. Throws without a CSPRNG. */\nfunction cryptoBytes(size) {\n\treturn requireCsprng()(new Uint8Array(size));\n}\n/**\n* Build a `length`-character string out of `charset` using CSPRNG\n* bytes. Bytes above the largest multiple of the charset size are\n* rejected and redrawn so every character stays equally likely — a\n* plain `byte % charset.length` would bias the leading characters.\n*\n* Throws when no CSPRNG is available, whatever the requested length.\n*/\nfunction cryptoStringOf(charset, length) {\n\tconst getRandomValues = requireCsprng();\n\tconst size = charset.length;\n\tconst limit = Math.floor(BYTE_VALUES / size) * size;\n\tlet text = \"\";\n\twhile (text.length < length) {\n\t\tconst bytes = getRandomValues(new Uint8Array(length - text.length));\n\t\tfor (let i = 0; i < bytes.length && text.length < length; i++) {\n\t\t\tif (bytes[i] >= limit) continue;\n\t\t\ttext += charset.charAt(bytes[i] % size);\n\t\t}\n\t}\n\treturn text;\n}\nlet rngState;\nfunction setSeed(seed) {\n\trngState = seed;\n}\n/**\n* Return the next pseudo-random value in `[0, 1)`. Uses `Math.random` by\n* default; switches to a seeded mulberry32 PRNG when `setSeed` is called\n* with a numeric seed.\n*/\nfunction next() {\n\tif (rngState === void 0) return Math.random();\n\trngState |= 0;\n\trngState = rngState + 1831565813 | 0;\n\tlet t = rngState;\n\tt = Math.imul(t ^ t >>> 15, t | 1);\n\tt ^= t + Math.imul(t ^ t >>> 7, t | 61);\n\treturn ((t ^ t >>> 14) >>> 0) / 4294967296;\n}\n\n//#endregion\nexport { ALPHANUMERIC, URL_SAFE, cryptoBytes, cryptoRef, cryptoStringOf, next, setSeed };\n//# sourceMappingURL=_internal.mjs.map","//#region ../reinforcements/src/string/ucfirst.ts\n/**\n* Uppercase the first character of `string`.\n*\n* @example\n* ucfirst(\"hello\"); // \"Hello\"\n*/\nfunction ucfirst(string) {\n\tif (!string) return \"\";\n\treturn string.charAt(0).toUpperCase() + string.slice(1);\n}\n\n//#endregion\nexport { ucfirst as default };\n//# sourceMappingURL=ucfirst.mjs.map","import ucfirst from \"./ucfirst.mjs\";\n\n//#region ../reinforcements/src/string/capitalize.ts\nconst WHITESPACE_RUN = /\\s+/;\nconst WHITESPACE_GROUP = /(\\s+)/;\n/**\n* Capitalize the first letter of each whitespace-separated word.\n*\n* @example\n* capitalize(\"hello world\"); // \"Hello World\"\n*/\nfunction capitalize(string) {\n\tif (!string) return \"\";\n\treturn string.split(WHITESPACE_GROUP).map((part) => WHITESPACE_RUN.test(part) ? part : ucfirst(part)).join(\"\");\n}\n\n//#endregion\nexport { capitalize as default };\n//# sourceMappingURL=capitalize.mjs.map","//#region ../reinforcements/src/utils/escapeRegex.ts\n/**\n* Escape the regex of the given string\n*/\nfunction escapeRegex(string) {\n\treturn string.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\n//#endregion\nexport { escapeRegex as default };\n//# sourceMappingURL=escapeRegex.mjs.map","import escapeRegex from \"../utils/escapeRegex.mjs\";\n\n//#region ../reinforcements/src/string/trim.ts\n/**\n* Remove the given needle from the start and the end of string\n*\n* @param string $needle\n* @return string\n*/\nfunction trim(string, needle = \" \") {\n\tif (!string) return \"\";\n\tif (needle === \" \") return string.replace(/^\\s+|\\s+$/g, \"\");\n\tneedle = escapeRegex(needle);\n\tconst pattern = \"^\" + needle + \"+|\" + needle + \"+$\", regex = new RegExp(pattern, \"g\");\n\treturn string.replace(regex, \"\");\n}\n\n//#endregion\nexport { trim as default };\n//# sourceMappingURL=trim.mjs.map","import escapeRegex from \"../utils/escapeRegex.mjs\";\n\n//#region ../reinforcements/src/string/ltrim.ts\n/**\n* Remove the given needle from the start of string\n*\n* @param string needle\n* @return string\n*/\nfunction ltrim(string, needle = \" \") {\n\tif (!string) return \"\";\n\tconst pattern = \"^\" + escapeRegex(needle) + \"+\", regex = new RegExp(pattern, \"g\");\n\treturn string.replace(regex, \"\");\n}\n\n//#endregion\nexport { ltrim as default };\n//# sourceMappingURL=ltrim.mjs.map","//#region ../reinforcements/src/string/readMoreChars.ts\n/**\n* Cut string for the given length and append ... if string is larger than the given length\n*\n*/\nfunction readMoreChars(string, length, readMoreDots = \"...\") {\n\tif (!string) return \"\";\n\tif (string.length <= length) return string;\n\treturn string.substring(0, length) + readMoreDots;\n}\n\n//#endregion\nexport { readMoreChars as default };\n//# sourceMappingURL=readMoreChars.mjs.map","import escapeRegex from \"../utils/escapeRegex.mjs\";\n\n//#region ../reinforcements/src/string/rtrim.ts\n/**\n* Remove the given needle from the start of string\n*\n* @param string needle\n* @return string\n*/\nfunction rtrim(string, needle = \" \") {\n\tif (!string) return \"\";\n\tconst pattern = escapeRegex(needle) + \"+$\", regex = new RegExp(pattern, \"g\");\n\treturn string.replace(regex, \"\");\n}\n\n//#endregion\nexport { rtrim as default };\n//# sourceMappingURL=rtrim.mjs.map","//#region ../reinforcements/src/string/words.ts\nconst SEPARATOR_PATTERN = /[-_./\\\\\\s]+/g;\nconst ACRONYM_BOUNDARY = /([A-Z]+)([A-Z][a-z])/g;\nconst CAMEL_BOUNDARY = /([a-z\\d])([A-Z])/g;\nconst WHITESPACE_RUN = /\\s+/;\n/**\n* Split a string into its semantic word tokens. Handles camelCase,\n* PascalCase, snake_case, kebab-case, dot.case, slash/separated and\n* whitespace, and correctly preserves acronym runs.\n*\n* @example\n* words(\"XMLHttpRequest\"); // [\"XML\", \"Http\", \"Request\"]\n* words(\"hello_world\"); // [\"hello\", \"world\"]\n* words(\"AIAgent\"); // [\"AI\", \"Agent\"]\n*/\nfunction words(input) {\n\tif (!input) return [];\n\tconst normalised = input.replace(SEPARATOR_PATTERN, \" \").replace(ACRONYM_BOUNDARY, \"$1 $2\").replace(CAMEL_BOUNDARY, \"$1 $2\").trim();\n\tif (!normalised) return [];\n\treturn normalised.split(WHITESPACE_RUN).filter(Boolean);\n}\n\n//#endregion\nexport { words as default };\n//# sourceMappingURL=words.mjs.map","import words from \"./words.mjs\";\n\n//#region ../reinforcements/src/string/toCamelCase.ts\n/**\n* Convert a string to camelCase.\n*\n* @example\n* toCamelCase(\"hello-world\"); // \"helloWorld\"\n* toCamelCase(\"XMLHttpRequest\"); // \"xmlHttpRequest\"\n*/\nfunction toCamelCase(string) {\n\tif (!string) return \"\";\n\treturn words(string).map(toSegment).join(\"\");\n}\nfunction toSegment(word, index) {\n\tif (index === 0) return word.toLowerCase();\n\treturn word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();\n}\n\n//#endregion\nexport { toCamelCase as default };\n//# sourceMappingURL=toCamelCase.mjs.map","import words from \"./words.mjs\";\n\n//#region ../reinforcements/src/string/toSnakeCase.ts\n/**\n* Convert a string to snake_case (or any underscore-style with a\n* custom separator).\n*\n* @example\n* toSnakeCase(\"HelloWorld\"); // \"hello_world\"\n* toSnakeCase(\"AIAgent\"); // \"ai_agent\"\n*/\nfunction toSnakeCase(string, separator = \"_\", lowerAll = true) {\n\tif (!string) return \"\";\n\tconst tokens = words(string);\n\tif (!lowerAll) return tokens.join(separator);\n\treturn tokens.map((word) => word.toLowerCase()).join(separator);\n}\n\n//#endregion\nexport { toSnakeCase as default };\n//# sourceMappingURL=toSnakeCase.mjs.map","import toSnakeCase from \"./toSnakeCase.mjs\";\n\n//#region ../reinforcements/src/string/toKebabCase.ts\n/**\n* Convert a string to kebab-case.\n*\n* @example\n* toKebabCase(\"HelloWorld\"); // \"hello-world\"\n* toKebabCase(\"AIAgent\"); // \"ai-agent\"\n*/\nfunction toKebabCase(string, lowerAll = true) {\n\treturn toSnakeCase(string, \"-\", lowerAll);\n}\n\n//#endregion\nexport { toKebabCase as default };\n//# sourceMappingURL=toKebabCase.mjs.map","import words from \"./words.mjs\";\n\n//#region ../reinforcements/src/string/toStudlyCase.ts\n/**\n* Convert a string to StudlyCase (PascalCase).\n*\n* @example\n* toStudlyCase(\"hello-world\"); // \"HelloWorld\"\n* toStudlyCase(\"ai_agent\"); // \"AiAgent\"\n*/\nfunction toStudlyCase(string) {\n\tif (!string) return \"\";\n\treturn words(string).map(capitalize).join(\"\");\n}\nfunction capitalize(word) {\n\treturn word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();\n}\n\n//#endregion\nexport { toStudlyCase as default };\n//# sourceMappingURL=toStudlyCase.mjs.map","//#region ../reinforcements/src/utils/lazy.ts\nconst LAZY = Symbol(\"lazy\");\n/**\n* Wrap a value-producing function as a lazy reference. The producer\n* isn't invoked until `resolve()` is called; subsequent calls return the\n* same cached value.\n*\n* Useful for deferring expensive computations and for breaking circular\n* module dependencies — JavaScript closures capture variable bindings,\n* not values, so a `lazy(() => x)` callsite remains valid even when `x`\n* isn't yet defined at the moment the wrapper is created, as long as\n* it's defined by the time `.resolve()` runs.\n*\n* @example\n* const greeting = lazy(() => expensiveComputation());\n*\n* greeting.resolve(); // computes, caches, returns\n* greeting.resolve(); // returns cached value, no recomputation\n*/\nfunction lazy(producer) {\n\tlet isResolved = false;\n\tlet value;\n\treturn {\n\t\t[LAZY]: true,\n\t\tresolve() {\n\t\t\tif (!isResolved) {\n\t\t\t\tvalue = producer();\n\t\t\t\tisResolved = true;\n\t\t\t}\n\t\t\treturn value;\n\t\t},\n\t\treset() {\n\t\t\tisResolved = false;\n\t\t\tvalue = void 0;\n\t\t},\n\t\tisResolved() {\n\t\t\treturn isResolved;\n\t\t},\n\t\tpeek() {\n\t\t\treturn isResolved ? value : void 0;\n\t\t}\n\t};\n}\n/**\n* Async variant of {@link lazy}: the producer returns a `Promise<T>`\n* which is cached after first invocation.\n*\n* @example\n* const user = lazy.async(() => fetchUser());\n*\n* await user.resolve(); // fetches\n* await user.resolve(); // returns same promise, no refetch\n*/\nlazy.async = function lazyAsync(producer) {\n\tlet started = false;\n\tlet promise;\n\treturn {\n\t\t[LAZY]: true,\n\t\tresolve() {\n\t\t\tif (!started) {\n\t\t\t\tpromise = producer();\n\t\t\t\tstarted = true;\n\t\t\t}\n\t\t\treturn promise;\n\t\t},\n\t\treset() {\n\t\t\tstarted = false;\n\t\t\tpromise = void 0;\n\t\t},\n\t\tisResolved() {\n\t\t\treturn started;\n\t\t},\n\t\tpeek() {\n\t\t\treturn started ? promise : void 0;\n\t\t}\n\t};\n};\n/**\n* Build a pre-resolved lazy reference. Useful for tests and for API\n* symmetry where a `Lazy<T>` is expected.\n*\n* @example\n* const ref = lazy.from(42);\n*\n* ref.resolve(); // 42\n* ref.isResolved(); // true\n*/\nlazy.from = function lazyFrom(value) {\n\treturn {\n\t\t[LAZY]: true,\n\t\tresolve: () => value,\n\t\treset() {},\n\t\tisResolved: () => true,\n\t\tpeek: () => value\n\t};\n};\n/**\n* Type guard that returns `true` when `value` is a `Lazy<T>` or\n* `LazyAsync<T>` produced by `lazy()` / `lazy.async()`.\n*\n* @example\n* if (isLazy(value)) {\n* value.resolve();\n* }\n*/\nfunction isLazy(value) {\n\treturn value?.[LAZY] === true;\n}\n\n//#endregion\nexport { lazy as default, isLazy };\n//# sourceMappingURL=lazy.mjs.map","//#region ../reinforcements/src/utils/tap.ts\n/**\n* Run `sideEffect` against `value`, then return `value` unchanged.\n* Useful for inserting logging / instrumentation into a pipeline.\n*\n* @example\n* pipe(2, n => n + 1, tap.with(console.log), n => n * 10);\n* // logs 3, returns 30\n*/\nfunction tap(value, sideEffect) {\n\tsideEffect(value);\n\treturn value;\n}\n/**\n* Curried form: `tap.with(fn)` returns a pipeline-friendly\n* `(value) => value` that runs the side effect.\n*/\ntap.with = function tapWith(sideEffect) {\n\treturn (value) => {\n\t\tsideEffect(value);\n\t\treturn value;\n\t};\n};\n\n//#endregion\nexport { tap as default };\n//# sourceMappingURL=tap.mjs.map","/**\r\n * Seal Configuration\r\n *\r\n * Global configuration for the Seal validation library\r\n */\r\n\r\nimport type { AttributeTranslation, RuleTranslation } from \"./types\";\r\n\r\nexport type TranslateRuleCallback = (\r\n ruleTranslation: RuleTranslation,\r\n) => string;\r\n\r\nexport type TranslateAttributeCallback = (\r\n attributeTranslation: AttributeTranslation,\r\n) => string;\r\n\r\nexport type SealConfig = {\r\n /**\r\n * Translation function for error messages\r\n * Default: returns the key with attributes replaced\r\n */\r\n translateRule?: TranslateRuleCallback;\r\n /**\r\n * Translation function for attribute messages\r\n */\r\n translateAttribute?: TranslateAttributeCallback;\r\n\r\n /**\r\n * Default to first error only in validation\r\n * Default: true\r\n */\r\n firstErrorOnly?: boolean;\r\n};\r\n\r\n/**\r\n * Global Seal configuration\r\n */\r\nconst config: SealConfig = {\r\n firstErrorOnly: true,\r\n};\r\n\r\n/**\r\n * Configure Seal globally\r\n *\r\n * @example\r\n * ```ts\r\n * import { configureSeal } from \"@warlock.js/seal\";\r\n * import { trans } from \"@mongez/localization\";\r\n *\r\n * configureSeal({\r\n * translateRule: (ruleTranslation) => trans(`validation.${ruleTranslation.rule.name}`, ruleTranslation.attributes),\r\n * translateAttribute: (attributeTranslation) => trans(`validation.attributes.${attributeTranslation.rule.name}.${attributeTranslation.attribute}`, attributeTranslation.context.allValues),\r\n * });\r\n * ```\r\n */\r\nexport function configureSeal(options: Partial<SealConfig>): void {\r\n Object.assign(config, options);\r\n}\r\n\r\n/**\r\n * Get current Seal configuration\r\n */\r\nexport function getSealConfig(): SealConfig {\r\n return config;\r\n}\r\n\r\n/**\r\n * Reset configuration to defaults\r\n */\r\nexport function resetSealConfig(): void {\r\n delete config.translateRule;\r\n delete config.translateAttribute;\r\n\r\n config.firstErrorOnly = true;\r\n}\r\n","import { getSealConfig } from \"../config\";\r\nimport type { SchemaContext, ValidationResult } from \"../types\";\r\nimport type { BaseValidator } from \"../validators\";\r\nimport { type ValidateOptions } from \"./validators\";\r\n\r\n/**\r\n * Validate data against a schema\r\n */\r\nexport const validate = async <T extends BaseValidator>(\r\n schema: T,\r\n data: any, // Temporarily use any - will fix type inference\r\n { context: extendedContext, ...configurations }: ValidateOptions = getSealConfig() || {},\r\n): Promise<ValidationResult> => {\r\n const context: SchemaContext = {\r\n allValues: data,\r\n parent: null,\r\n value: data,\r\n key: \"\",\r\n path: \"\",\r\n context: extendedContext,\r\n rootContext: extendedContext,\r\n translateRule(ruleTranslation) {\r\n return configurations.translateRule?.(ruleTranslation) ?? \"\";\r\n },\r\n translateAttribute(attributeTranslation) {\r\n return configurations.translateAttribute?.(attributeTranslation) ?? \"\";\r\n },\r\n configurations,\r\n };\r\n\r\n const result = await schema.validate(data, context);\r\n\r\n // A failed validation never hands back the input it just rejected.\r\n //\r\n // `object` used to return the raw input on failure while `discriminatedUnion`\r\n // returned `undefined` — the same call shape with two different contracts.\r\n // The object behaviour was the dangerous one: validating an outbound DTO\r\n // specifically to keep internal fields out of a response, then doing the\r\n // natural `const { data } = await v.validate(dto, record); reply.send(data)`,\r\n // shipped every field the schema existed to exclude. A guard that returns the\r\n // unsafe value on failure reads as safe and isn't.\r\n if (!result.isValid) {\r\n return { ...result, data: undefined };\r\n }\r\n\r\n return result;\r\n};\r\n","/**\r\n * Detect if value is a date value or field name\r\n *\r\n * Date values:\r\n * - Date instance\r\n * - Number (timestamp)\r\n * - String with date separators (- or /)\r\n *\r\n * Field names:\r\n * - Strings without - or /\r\n *\r\n * @param value - Value to check\r\n * @returns true if it's a date value, false if it's a field name\r\n */\r\nexport function isDateValue(value: any): boolean {\r\n if (value instanceof Date) return true;\r\n\r\n const date = new Date(value);\r\n\r\n return !isNaN(date.getTime());\r\n}\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport type { ContextualSchemaRule, SchemaContext } from \"../types\";\r\n\r\n/**\r\n * Get field value based on scope from rule options\r\n *\r\n * This utility extracts a field value from either the global context or sibling context\r\n * based on the `scope` option in the rule's context.\r\n *\r\n * @param rule - The contextual schema rule containing options with:\r\n * - `field` (or custom fieldKey): The field name to extract\r\n * - `scope` (optional): Either \"global\" (default) or \"sibling\"\r\n * @param context - The schema validation context containing allValues and parent\r\n * @param fieldKey - The key in rule.context.options that contains the field name (defaults to \"field\")\r\n *\r\n * @returns The value of the specified field from the appropriate source\r\n *\r\n * @example\r\n * // In a validation rule with scope support:\r\n * async validate(value: any, context) {\r\n * const otherFieldValue = getFieldValue(this, context);\r\n * // Extracts from context.allValues if scope is \"global\"\r\n * // Extracts from context.parent if scope is \"sibling\"\r\n * }\r\n *\r\n * @example\r\n * // Using a custom field key:\r\n * async validate(value: any, context) {\r\n * const compareValue = getFieldValue(this, context, \"compareField\");\r\n * // Looks for rule.context.options.compareField instead of .field\r\n * }\r\n *\r\n * @remarks\r\n * - **Global scope** (`scope: \"global\"`): Searches the entire input data (context.allValues)\r\n * - **Sibling scope** (`scope: \"sibling\"`): Searches only within the parent object (context.parent)\r\n * - Uses `@mongez/reinforcements.get()` to support nested paths (e.g., \"user.email\")\r\n */\r\nexport function getFieldValue(\r\n rule: ContextualSchemaRule,\r\n context: SchemaContext,\r\n fieldKey = \"field\",\r\n) {\r\n const field = rule.context.options[fieldKey];\r\n const scope = rule.context.options.scope || \"global\";\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n return get(source, field);\r\n}\r\n","/**\r\n * Set the key path for nested validation\r\n */\r\nexport const setKeyPath = (path: string, key: string): string => {\r\n if (!path) return key;\r\n return `${path}.${key}`;\r\n};\r\n","import { getSealConfig } from \"../config\";\nimport type { ContextualSchemaRule, RuleResult, RuleTranslation, SchemaContext } from \"../types\";\n\nexport const VALID_RULE: RuleResult = {\n isValid: true,\n};\n/**\n * Resolve a single attribute value through the full translation priority chain:\n * 1. attributesList[key] — developer direct text override (highest priority)\n * 2. translatedAttributes[key] — developer explicit translation key\n * 3. translator(rawValue) — auto-translate the raw value (fallback)\n *\n * Use this in rule bodies when you need per-item translation\n * (e.g. translating each enum value before joining them).\n *\n * @example\n * // Translate each enum value individually then join\n * const enumList = enumValues\n * .map(v => resolveTranslation(String(v), String(v), this, context))\n * .join(\", \");\n * this.context.translationParams.enumList = enumList;\n */\nexport const resolveTranslation = ({\n key,\n rawValue,\n rule,\n context,\n}: {\n key: string;\n rawValue: any;\n rule: ContextualSchemaRule;\n context: SchemaContext;\n}): string => {\n const translator = getSealConfig().translateAttribute;\n\n // 1. Direct text override wins\n const direct = rule.context.attributesList?.[key];\n if (direct && typeof direct === \"string\") return direct;\n\n if (!translator) return String(rawValue ?? key);\n\n // 2. Explicit translation key\n const transKey = rule.context.translatedAttributes?.[key];\n if (transKey) return translator({ attribute: transKey, context, rule });\n\n // 3. Auto-translate the raw value (fallback)\n return translator({ attribute: String(rawValue ?? key), context, rule });\n};\n\n// Internal alias — invalidRule uses the same function without re-importing config\nconst resolveAttribute = resolveTranslation;\n\nexport const invalidRule = (rule: ContextualSchemaRule, context: SchemaContext): RuleResult => {\n // `input` is always translatable — rules may add more (e.g., field references in sameAs)\n // Rule-defined translatableParams override the default input if the key matches\n const translatableWithInput: Record<string, string> = {\n // Fall back to \"schema\" when validating at the root level (no key)\n input: context.key || \"schema\",\n ...rule.context.translatableParams,\n };\n\n // Resolve all translatable params through the full priority chain\n const resolvedParams = Object.fromEntries(\n Object.entries(translatableWithInput).map(([key, rawValue]) => [\n key,\n resolveAttribute({ key, rawValue, rule, context }),\n ]),\n );\n\n const attributes: RuleTranslation[\"attributes\"] = {\n path: context.path,\n key: context.key,\n value: context.value,\n // Raw placeholders (:enumList, :min, :max, etc.) — no translation\n ...rule.context.translationParams,\n // Translated placeholders (:input, :field, etc.) — override raws if key collides\n ...resolvedParams,\n // Satisfy TypeScript's required field (always present via resolvedParams)\n input: resolvedParams.input,\n };\n\n const rawError =\n rule.context.errorMessage ||\n rule.errorMessage ||\n context.translateRule?.({ rule, context, attributes }) ||\n rule.defaultErrorMessage!;\n\n // Fallback interpolation: replace :placeholder patterns from attributes\n // This kicks in when translateRule is absent or returns \"\" (not configured)\n const error = rawError.replace(/:([a-zA-Z_]+)/g, (match, key) =>\n key in attributes ? String(attributes[key as keyof typeof attributes]) : match,\n );\n\n return {\n isValid: false,\n error,\n input: attributes.input, // use resolved input, not raw context.key (may be \"\")\n path: context.path,\n };\n};\n","//#region ../supportive-is/src/index.ts\n/**\n* Determine whether the given value is a number whatever if its data type is String or Number\n*/\nfunction isNumeric(value) {\n\treturn /^[+-]?\\d+(\\.\\d+)?([Ee][+-]?\\d+)?$/.test(String(value));\n}\n/**\n* Check if the given value is int\n*/\nconst isInt = (value) => typeof value === \"number\" && Number.isInteger(value);\n/**\n* Check if the given value is float\n*/\nconst isFloat = (value) => typeof value === \"number\" && Number.isFinite(value) && /^-?\\d+\\.\\d+$/.test(String(value));\n/**\n* Check if the given value is a regex\n*/\nconst isRegex = (value) => Boolean(value) && value.constructor?.name === \"RegExp\";\n/**\n* Check if the given value is an object\n*/\nconst isObject = (value) => Boolean(value) && typeof value === \"object\";\n/**\n* Check if the given value is a plain object\n*/\nconst isPlainObject = (value) => {\n\tif (!value || typeof value !== \"object\") return false;\n\tif (Object.getPrototypeOf(value) === null) return true;\n\treturn value.constructor?.name === \"Object\";\n};\n/**\n* Check if the given value is validId\n*/\nconst isValidId = (value) => Boolean(value && /^[A-Za-z][\\w\\-:.]*$/.test(String(value)));\n/**\n* Check if the given value is a form element\n*/\nconst isFormElement = (value) => typeof HTMLFormElement === \"undefined\" ? false : value instanceof HTMLFormElement;\n/**\n* Check if the given value is a form data\n*/\nconst isFormData = (value) => value instanceof FormData;\n/**\n* Check if the given value is iterable\n*/\nconst isIterable = (value) => value !== null && value !== void 0 && typeof value[Symbol.iterator] === \"function\";\n/**\n* Check if the given value is a scalar value\n*/\nconst isScalar = (value) => [\n\t\"string\",\n\t\"boolean\",\n\t\"number\",\n\t\"symbol\",\n\t\"bigint\"\n].includes(typeof value);\n/**\n* Check if the given value is a string\n*/\nconst isString = (value) => typeof value === \"string\";\n/**\n* Check if the given value is a pr value\n*/\nconst isPrimitive = (value) => [\n\t\"string\",\n\t\"boolean\",\n\t\"number\",\n\t\"bigint\"\n].includes(typeof value);\n/**\n* Check if the given value is a promise\n*/\nconst isPromise = (value) => Boolean(value) && value instanceof Promise;\n/**\n* Check if the given value is a date\n*/\nconst isDate = (value) => Boolean(value) && typeof value === \"object\" && value instanceof Date;\n/**\n* Check if the given value is a generator\n*/\nconst isGenerator = (value) => Boolean(value) && typeof value === \"object\" && typeof value.next === \"function\" && typeof value[Symbol.iterator] === \"function\" && value[Symbol.iterator]() === value;\n/**\n* Check if the given value is empty\n* Zero does not considered empty\n* Empty object is considered empty\n* Empty array is considered empty\n*/\nconst isEmpty = (value) => {\n\tif ([\n\t\t0,\n\t\ttrue,\n\t\tfalse\n\t].includes(value)) return false;\n\tif ([\n\t\t\"\",\n\t\tnull,\n\t\tvoid 0\n\t].includes(value)) return true;\n\tif (typeof value === \"number\" && Number.isNaN(value)) return false;\n\tif (value instanceof Date) return false;\n\tif (value instanceof Map || value instanceof Set) return value.size === 0;\n\tif (typeof value === \"object\" && !Array.isArray(value) && typeof value[Symbol.iterator] !== \"function\") return Object.keys(value).length === 0;\n\tif (isIterable(value)) return value.length === 0;\n\tif (isNumeric(value)) return false;\n\treturn true;\n};\n/**\n* Check if the given value is a valid json\n*/\nconst isJson = (value) => {\n\tif (!value || typeof value !== \"string\") return false;\n\tif (![\"[\", \"{\"].includes(value?.[0])) return false;\n\ttry {\n\t\tJSON.parse(value);\n\t\treturn true;\n\t} catch (e) {\n\t\treturn false;\n\t}\n};\n/**\n* Check if the given value is valid url\n*/\nconst isUrl = (value) => {\n\tif (!value || typeof value !== \"string\") return false;\n\ttry {\n\t\tconst url = new URL(value);\n\t\tif (![\"http:\", \"https:\"].includes(url.protocol)) return false;\n\t\tconst hostname = url.hostname;\n\t\tif (!hostname.includes(\".\")) return false;\n\t\tif (hostname.split(\".\").some((label) => label.length === 0)) return false;\n\t\treturn true;\n\t} catch (e) {\n\t\treturn false;\n\t}\n};\n/**\n* Check if the given value is a valid email\n*/\nconst isEmail = (value) => typeof value === \"string\" && /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/.test(value);\n/**\n* Check if current user is opening from mobile\n*/\nconst isMobile = {\n\t/**\n\t* Determine whether the current visitor is opening from an Android device\n\t*/\n\tandroid: () => navigator.userAgent.match(/Android/i) !== null,\n\t/**\n\t* Determine whether the current visitor is opening from an ios device\n\t*/\n\tios: () => navigator.userAgent.match(/iPhone|iPad|iPod/i) !== null,\n\t/**\n\t* Determine whether the current visitor is opening from an Iphone\n\t*/\n\tiphone: () => navigator.userAgent.match(/iPhone/i) !== null,\n\t/**\n\t* Determine whether the current visitor is opening from an ipad\n\t*/\n\tipad: () => navigator.userAgent.match(/iPad/i) !== null,\n\t/**\n\t* Determine whether the current visitor is opening from an ipod\n\t*/\n\tipod: () => navigator.userAgent.match(/iPod/i) !== null,\n\t/**\n\t* Determine whether the current visitor is opening from an windows mobile\n\t*/\n\twindows: () => navigator.userAgent.match(/IEMobile/i) !== null,\n\t/**\n\t* Determine whether the current visitor is opening from mobile whatever its type\n\t*/\n\tany: () => isMobile.android() || isMobile.ios() || isMobile.windows()\n};\n/**\n* Determine if current user is opening from macOS\n*/\nconst isMac = () => navigator.userAgent.match(/mac/i) !== null;\n/**\n* Check if current browser is the given name\n*/\nconst isBrowser = (browser) => {\n\treturn {\n\t\tchrome: isChrome(),\n\t\tfirefox: isFirefox(),\n\t\topera: isOpera(),\n\t\tedge: isEdge(),\n\t\tie: isIE(),\n\t\tsafari: isSafari()\n\t}[browser.toLowerCase()] === true;\n};\n/**\n* Check if current browser is chrome browser\n*/\nconst isChrome = () => !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);\n/**\n* Check if current browser is firefox\n*/\nconst isFirefox = () => typeof window.InstallTrigger !== \"undefined\";\n/**\n* Check if current browser is safari\n*/\nconst isSafari = () => {\n\tif (typeof navigator === \"undefined\") return false;\n\tconst ua = navigator.userAgent || \"\";\n\treturn /Safari/i.test(ua) && !/Chrome|Chromium|Edg|OPR|Android/i.test(ua);\n};\n/**\n* Check if current browser is opera\n*/\nconst isOpera = () => {\n\tif (typeof window === \"undefined\") return false;\n\tconst w = window;\n\treturn !!w.opr && !!w.opr.addons || !!w.opera || typeof navigator !== \"undefined\" && navigator.userAgent.indexOf(\" OPR/\") >= 0;\n};\n/**\n* Check if current browser is internet explorer\n*/\nconst isIE = () => !!document.documentMode;\n/**\n* Check if current browser is edge\n*/\nconst isEdge = () => {\n\treturn !!!document.documentMode && !!window.StyleMedia;\n};\n/**\n* Determine whether the current visitor is opening from desktop\n*/\nconst isDesktop = () => !isMobile.any();\n/**\n* A simple lightweight library to validate values against certain types of data\n* For full documentation on github\n* Repo: https://github.com/hassanzohdy/supportive-is\n*\n* First released 01/12/2017\n* Licensed under MIT (http://opensource.org/licenses/MIT)\n*/\nconst Is = {\n\t/**\n\t* Determine whether the given value is a number whatever if its data type is String or Number\n\t*/\n\tnumeric: isNumeric,\n\t/**\n\t* Determine whether the given value is an integer and its data type is number\n\t* As Number.isInteger considers 1.0 to be valid integer, regex will be used instead\n\t*/\n\tint: isInt,\n\t/**\n\t* Determine whether the given value is a float number and its data type is number\n\t*/\n\tfloat: isFloat,\n\t/**\n\t* Determine whether the given value is a regular expression\n\t*/\n\tregex: isRegex,\n\t/**\n\t* Determine whether the given value is an object\n\t*/\n\tobject: isObject,\n\t/**\n\t* Determine whether the given value is a plain object\n\t*/\n\tplainObject: isPlainObject,\n\t/**\n\t* Determine whether the given value is an array\n\t*/\n\tarray: Array.isArray,\n\t/**\n\t* Determine whether the given value is valid html attribute `id`\n\t*/\n\tvalidHtmlId: isValidId,\n\t/**\n\t* determine if the given value is an instance of form element\n\t*/\n\tformElement: isFormElement,\n\t/**\n\t* @alias formElement\n\t*/\n\tform: isFormElement,\n\t/**\n\t* determine if the given value is an instance of form data\n\t*/\n\tformData: isFormData,\n\t/**\n\t* Determine whether the given value is iterable\n\t*/\n\titerable: isIterable,\n\t/**\n\t* Determine whether the given value is a scalar\n\t* Scalar types are strings, booleans, integers and\n\t*/\n\tscalar: isScalar,\n\t/**\n\t* Determine if the given value is a primitive value\n\t*/\n\tprimitive: isPrimitive,\n\t/**\n\t* Determine whether the given value is a promise\n\t*/\n\tpromise: isPromise,\n\t/**\n\t* Determine whether the given value is a date\n\t*/\n\tdate: isDate,\n\t/**\n\t* Determine whether the given value is a generator\n\t*/\n\tgenerator: isGenerator,\n\t/**\n\t* Determine whether the given value if an empty\n\t* This can be validated against any type of values\n\t* undefined or nullable values will be considered empty\n\t* Objects that doesn't have any properties will be considered empty\n\t* Arrays and Strings will be empty based on its length\n\t* The 0 'Zero\" number will not be considered empty\n\t*/\n\tempty: isEmpty,\n\t/**\n\t* Determine whether the given value is a valid json string\n\t*/\n\tjson: isJson,\n\t/**\n\t* Determine whether the given value is a valid url\n\t*/\n\turl: isUrl,\n\t/**\n\t* Determine whether the given value is a valid email\n\t*/\n\temail: isEmail,\n\t/**\n\t* Determine the current visitor is opening from mobile\n\t* Please Note this method depends on the user agent\n\t*/\n\tmobile: isMobile,\n\t/**\n\t* Determine if current user is opening from macOS\n\t*/\n\tmac: isMac,\n\t/**\n\t* Determine whether the current visitor is opening from desktop\n\t*/\n\tdesktop: isDesktop,\n\t/**\n\t* Check if the current browser is the given name\n\t* To detect browser version as well, pass the version number as the second argument\n\t*/\n\tbrowser: isBrowser,\n\tchrome: isChrome,\n\tfirefox: isFirefox,\n\tsafari: isSafari,\n\topera: isOpera,\n\tie: isIE,\n\tedge: isEdge\n};\n\n//#endregion\nexport { Is, Is as default, isBrowser, isChrome, isDate, isDesktop, isEdge, isEmail, isEmpty, isFirefox, isFloat, isFormData, isFormElement, isGenerator, isIE, isInt, isIterable, isJson, isMac, isMobile, isNumeric, isObject, isOpera, isPlainObject, isPrimitive, isPromise, isRegex, isSafari, isScalar, isString, isUrl, isValidId };\n//# sourceMappingURL=index.mjs.map","import { isEmpty, isObject } from \"@mongez/supportive-is\";\n\nexport function isEmptyValue(value: any) {\n return isEmpty(value) && !isObject(value);\n}\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Required rule - value must be present and not empty\r\n */\r\nexport const requiredRule: SchemaRule = {\r\n name: \"required\",\r\n defaultErrorMessage: \"The :input is required\",\r\n requiresValue: false,\r\n sortOrder: -2,\r\n async validate(value: any, context) {\r\n if (isEmptyValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present rule - key must exist in the data, but value can be anything\r\n * (empty string, null are all valid as long as the key exists)\r\n */\r\nexport const presentRule: SchemaRule = {\r\n name: \"present\",\r\n defaultErrorMessage: \"The :input field is required\",\r\n requiresValue: false,\r\n sortOrder: -2,\r\n async validate(value: any, context) {\r\n if (value === undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import type { ValidationResult } from \"../types\";\nimport type { StandardSchemaV1 } from \"./types\";\n\n/**\n * Maps a Seal ValidationResult to a Standard Schema result shape.\n *\n * Seal error paths are dot-notation strings (e.g. \"address.city\").\n * Standard Schema expects an array of path segments: [{ key: \"address\" }, { key: \"city\" }].\n *\n * @example\n * ```ts\n * const result = await validator.validate(value, context);\n * return mapToStandardResult(result);\n * // Success → { value: <data> }\n * // Failure → { issues: [{ message: \"...\", path: [{ key: \"...\" }] }] }\n * ```\n */\nexport function mapToStandardResult(\n result: ValidationResult,\n): StandardSchemaV1.Result<unknown> {\n if (result.isValid) {\n return { value: result.data };\n }\n\n return {\n issues: result.errors.map(e => ({\n message: e.error,\n path: e.input\n ? e.input.split(\".\").map(key => ({ key }))\n : undefined,\n })),\n };\n}\n","import { clone } from \"@mongez/reinforcements\";\nimport { validate } from \"../factory/validate\";\nimport { VALID_RULE, invalidRule } from \"../helpers\";\nimport { isEmptyValue } from \"../helpers/is-empty-value\";\nimport { requiredRule as defaultRequiredRule } from \"../rules/core/required\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport { mapToStandardResult } from \"../standard-schema/map-result\";\nimport type { StandardJSONSchemaV1, StandardSchemaV1 } from \"../standard-schema/types\";\nimport type {\n ContextualSchemaRule,\n ContextualizedMutator,\n ContextualizedTransformer,\n Mutator,\n SchemaContext,\n SchemaRule,\n SchemaRuleOptions,\n SimpleTransformerCallback,\n TransformerCallback,\n ValidationAttributesList,\n ValidationResult,\n} from \"../types\";\n\n/**\n * Base validator class - foundation for all validators\n */\nexport class BaseValidator<TInput = unknown, TOutput = TInput> {\n public rules: ContextualSchemaRule[] = [];\n public mutators: ContextualizedMutator[] = [];\n protected defaultValue: any | (() => any);\n protected description?: string;\n protected shouldOmit = false;\n protected isNullable = false;\n protected isMutable = false;\n\n /**\n * Catch state — when `hasCatch` is true and validation fails, `catchValue`\n * (or its callback result) substitutes for the failed value, and the public\n * result reports `isValid: true` with no errors.\n *\n * See `.catch()` for semantics and the v1 scope (leaf-only).\n */\n protected catchValue:\n | any\n | ((errors: ValidationResult[\"errors\"], originalInput: any) => any | Promise<any>);\n protected hasCatch = false;\n\n /**\n * Whether the field is optional.\n * - false (default): field is required unless a requiredRule governs the condition.\n * - true: field can be absent or empty — set by calling .optional().\n *\n * Also used as a TypeScript literal brand via the optional() return type.\n */\n public isOptional = false;\n\n /**\n * The single required-condition rule for this field.\n * - null: field uses strict default (always required when not optional).\n * - set: the rule governs when the field is required (e.g., requiredIf).\n *\n * Stored separately from rules[] and prepended at validate() time.\n */\n public requiredRule: ContextualSchemaRule | null = this.createRule(defaultRequiredRule);\n\n /**\n * Pipeline to transform the mutated/original data before returning it\n */\n protected dataTransformers: ContextualizedTransformer[] = [];\n\n /**\n * Attributes text to be replaced on translations\n * If the value is an object, it will be used as the attributes list for the rule\n * If the value is a string, it will be used as the attributes list for the rule\n */\n protected attributesText: ValidationAttributesList = {};\n\n /**\n * Attributed that will be always using the attribute translator\n */\n protected translatedAttributes: Record<string, string> = {};\n\n /**\n * Mark the validator as mutable\n */\n public get mutable() {\n this.isMutable = true;\n return this;\n }\n\n /**\n * Mark the validator as immutable\n */\n public get immutable() {\n this.isMutable = false;\n return this;\n }\n\n /**\n * Get the instance to apply changes to.\n * By default (immutable), returns a clone so the original is unchanged.\n * When `.mutable` is set, returns `this` to mutate in place.\n */\n protected get instance(): this {\n return this.isMutable ? this : this.clone();\n }\n\n /**\n * Get the default value\n * Supports lazy evaluation via callbacks\n */\n public getDefaultValue(): any {\n return typeof this.defaultValue === \"function\" ? this.defaultValue() : this.defaultValue;\n }\n\n /**\n * Allow null as a valid value.\n *\n * Brands the return type with `{ isNullable: true }` so `Infer<>` widens\n * the inferred output to include `| null`.\n */\n public nullable(): this & { isNullable: true } {\n const instance = this.instance;\n instance.isNullable = true;\n return instance as this & { isNullable: true };\n }\n\n /**\n * Explicitly disallow null values after calling nullable.\n *\n * Brands the return type with `{ isNullable: false }` to cancel any prior\n * `.nullable()` at the type level.\n */\n public notNullable(): this & { isNullable: false } {\n const instance = this.instance;\n instance.isNullable = false;\n return instance as this & { isNullable: false };\n }\n\n /**\n * Add transformer with optional options\n *\n * @param transform - The transformer callback function\n * @param options - Optional options to pass to the transformer\n *\n * @example\n * ```ts\n * // Without options\n * v.date().addTransformer(data => data.toISOString())\n *\n * // With options\n * v.date().addTransformer(\n * (data, { options }) => dayjs(data).format(options.format),\n * { format: 'YYYY-MM-DD' }\n * )\n * ```\n */\n public addTransformer(transform: TransformerCallback, options: any = {}) {\n const instance = this.instance;\n instance.addMutableTransformer(transform, options);\n\n return instance;\n }\n\n /**\n * Add transformer with optional options\n *\n * @param transform - The transformer callback function\n * @param options - Optional options to pass to the transformer\n *\n * @example\n * ```ts\n * // Without options\n * v.date().addTransformer(data => data.toISOString())\n *\n * // With options\n * v.date().addTransformer(\n * (data, { options }) => dayjs(data).format(options.format),\n * { format: 'YYYY-MM-DD' }\n * )\n * ```\n */\n public addMutableTransformer(transform: TransformerCallback, options: any = {}) {\n this.dataTransformers.push({\n transform,\n options,\n });\n }\n\n /**\n * Transform the output value - simple one-time transformation\n *\n * @param callback - Simple callback receiving data and context\n *\n * @example\n * ```ts\n * // Simple transformation\n * v.string().outputAs(data => data.toUpperCase())\n *\n * // With context\n * v.string().outputAs((data, context) => {\n * console.log(`Transforming ${context.path}`);\n * return data.toLowerCase();\n * })\n * ```\n */\n public outputAs(callback: SimpleTransformerCallback) {\n return this.addTransformer((data, { context }) => callback(data, context));\n }\n\n /**\n * Transform output to JSON string\n *\n * Works with any validator type (string, number, date, object, array, etc.)\n *\n * @param indent - Optional indentation for pretty printing (default: 0 for compact)\n *\n * @example\n * ```ts\n * // Compact JSON\n * v.object({ name: v.string() }).toJSON()\n * // Output: '{\"name\":\"John\"}'\n *\n * // Pretty-printed JSON\n * v.array(v.object({...})).toJSON(2)\n * // Output:\n * // [\n * // {\n * // \"name\": \"John\"\n * // }\n * // ]\n *\n * // Works with any type\n * v.string().toJSON() // '\"hello\"'\n * v.number().toJSON() // '42'\n * v.date().toJSON() // '\"2024-10-26T00:00:00.000Z\"'\n * ```\n *\n * @category Transformer\n */\n public toJSON(indent?: number) {\n return this.addTransformer((data, { options }) => JSON.stringify(data, null, options.indent), {\n indent: indent ?? 0,\n });\n }\n\n /**\n * Start data transformation pipeline\n * Context is passed at runtime, not stored\n */\n public async startTransformationPipeline(data: any, context: SchemaContext) {\n for (const transformer of this.dataTransformers) {\n data = await transformer.transform(data, {\n options: transformer.options,\n context,\n });\n }\n\n return data;\n }\n\n /**\n * Set attributes text to be replaced on translations\n * If the value is an object, it will be used as the attributes list for the rule\n * If the value is a string, it will be used as the attributes list for the rule\n *\n * @example\n * v.string().attributes({\n * name: \"Name\",\n * email: \"Email\",\n * });\n * // Example 2: Add custom attributes for matches\n * v.string().matches(\"confirmPassword\").attributes({\n * matches: {\n * confirmPassword: \"Confirm Password\",\n * },\n * });\n */\n public attributes(attributes: Record<string, string | Record<string, string>>) {\n const instance = this.instance;\n for (const key in attributes) {\n instance.attributesText[key] = attributes[key];\n }\n\n return instance;\n }\n\n /**\n * Define a lazy getter property for each attribute in the given object and use the config attribute translator\n */\n public transAttributes(attributes: Record<string, string>) {\n const instance = this.instance;\n for (const key in attributes) {\n instance.translatedAttributes[key] = attributes[key];\n }\n\n return instance;\n }\n\n /**\n * Add description to the validator\n */\n public describe(description: string) {\n const instance = this.instance;\n instance.description = description;\n return instance;\n }\n\n /**\n * Check if this validator can handle the given value's type\n * Override this in specific validators to enable type-based routing in union validators\n *\n * Default: returns true (validator will attempt to validate any type)\n *\n * @param value - The value to check\n * @returns True if this validator can handle this type\n *\n * @example\n * ```ts\n * // StringValidator\n * public matchesType(value: any): boolean {\n * return typeof value === 'string';\n * }\n *\n * // Custom FileValidator\n * public matchesType(value: any): boolean {\n * return value instanceof UploadedFile;\n * }\n * ```\n */\n public matchesType(_value: any): boolean {\n return true; // Default: permissive, attempt to validate any type\n }\n\n /**\n * Create a copy of this validator with the same configuration\n * Copies all rules, mutators, transformers, default values, and settings\n *\n * @returns A new validator instance with copied configuration\n *\n * @example\n * ```ts\n * // Create reusable validator templates\n * const baseString = v.string().required().trim().min(3);\n * const emailField = baseString.clone().email();\n * const usernameField = baseString.clone().alphanumeric().max(20);\n *\n * // Works with all validators\n * const positiveInt = v.int().positive().required();\n * const ageField = positiveInt.clone().min(18).max(120);\n * ```\n */\n public clone(): this {\n // Create a new instance using Object.create to preserve the prototype chain\n const Constructor = this.constructor as new (...args: any[]) => this;\n const cloned = Object.create(Constructor.prototype);\n\n // Copy all BaseValidator properties\n cloned.rules = [...this.rules];\n cloned.mutators = [...this.mutators];\n cloned.dataTransformers = [...this.dataTransformers];\n cloned.defaultValue = this.defaultValue;\n cloned.shouldOmit = this.shouldOmit;\n cloned.description = this.description;\n cloned.attributesText = { ...this.attributesText };\n cloned.isNullable = this.isNullable;\n cloned.isOptional = this.isOptional;\n cloned.requiredRule = this.requiredRule; // same reference is fine — rule is treated as immutable\n cloned.catchValue = this.catchValue;\n cloned.hasCatch = this.hasCatch;\n\n return cloned;\n }\n\n /**\n * @deprecated This method is no longer needed and does nothing.\n * Empty values are now automatically skipped for validation rules by default.\n * Only presence validators (required, present, etc.) will check empty values.\n * You can safely remove this call from your code.\n */\n public ignoreEmptyValue(_ignoreEmptyValue = true) {\n // No-op for backward compatibility\n return this;\n }\n\n /**\n * Omit this field from the validated data output\n *\n * Field will still be validated but not included in the final result.\n * Useful for confirmation fields, captcha, terms acceptance, etc.\n *\n * @example\n * ```ts\n * v.object({\n * password: v.string().required(),\n * confirmPassword: v.string().required().sameAs(\"password\").omit(),\n * acceptTerms: v.boolean().required().omit(),\n * });\n * // Output: { password: \"...\" }\n * // confirmPassword and acceptTerms validated but omitted\n * ```\n */\n public omit() {\n const instance = this.instance;\n instance.shouldOmit = true;\n return instance;\n }\n\n /**\n * @alias omit\n */\n public exclude() {\n return this.omit();\n }\n\n /**\n * Check if this field should be omitted from the output\n */\n public isOmitted(): boolean {\n return this.shouldOmit;\n }\n\n /**\n * Add rule to the validator\n */\n public addRule<T extends SchemaRuleOptions = SchemaRuleOptions>(\n rule: SchemaRule<T>,\n errorMessage?: string,\n options: T = {} as T,\n ): this {\n const instance = this.instance;\n instance.addMutableRule(rule, errorMessage, options);\n return instance;\n }\n\n /**\n * Set the required-condition rule for this field.\n *\n * Unlike addRule(), this does NOT push to rules[]. The rule is stored in the\n * dedicated `requiredRule` slot and is prepended to the validation pipeline\n * at runtime. Only one required rule can be active per field — this replaces\n * any previously set required rule.\n *\n * Also marks the field as not optional (isOptional = false).\n *\n * @example\n * ```ts\n * // Used internally by required(), requiredIf(), requiredWith(), etc.\n * BaseValidator.prototype.required = function(msg) {\n * return this.setRequiredRule(requiredRule, msg);\n * };\n * ```\n */\n public setRequiredRule<T extends SchemaRuleOptions = SchemaRuleOptions>(\n rule: SchemaRule<T>,\n errorMessage?: string,\n options: T = {} as T,\n ): this {\n const instance = this.instance;\n instance.isOptional = false;\n instance.requiredRule = instance.createRule(rule, errorMessage, options);\n return instance;\n }\n\n /**\n * Add mutable rule\n */\n public addMutableRule<T extends SchemaRuleOptions = SchemaRuleOptions>(\n rule: SchemaRule<T>,\n errorMessage?: string,\n options: T = {} as T,\n ): ContextualSchemaRule<T> {\n const newRule: ContextualSchemaRule<T> = this.createRule(rule, errorMessage, options);\n\n this.rules.push(newRule);\n\n return newRule;\n }\n\n /**\n * Create new rule\n */\n protected createRule<T extends SchemaRuleOptions = SchemaRuleOptions>(\n rule: SchemaRule<T>,\n errorMessage?: string,\n options: T = {} as T,\n ): ContextualSchemaRule<T> {\n const newRule: ContextualSchemaRule<T> = {\n ...(clone(rule) as ContextualSchemaRule<T>),\n context: {\n errorMessage,\n options,\n attributesList: this.attributesText,\n translatedAttributes: this.translatedAttributes,\n translationParams: {},\n translatableParams: {},\n },\n };\n\n if (errorMessage) {\n newRule.errorMessage = errorMessage;\n }\n\n if (rule.sortOrder === undefined) {\n newRule.sortOrder = this.rules.length + 1;\n }\n\n return newRule;\n }\n\n /**\n * Use a custom or pre-built validation rule\n *\n * @param rule - The validation rule to apply\n * @param options - Rule options including errorMessage and any rule-specific options\n *\n * @example\n * ```ts\n * import { hexColorRule } from \"@warlock.js/seal\";\n *\n * v.string().useRule(hexColorRule, { errorMessage: \"Invalid color\" });\n * ```\n *\n * @example\n * ```ts\n * // With rule options\n * v.string().useRule(myCustomRule, {\n * customOption: true,\n * errorMessage: \"Custom validation failed\"\n * });\n * ```\n */\n public useRule<T extends SchemaRuleOptions = SchemaRuleOptions>(\n rule: SchemaRule<T>,\n options?: T & { errorMessage?: string },\n ) {\n const { errorMessage, ...ruleOptions } = options || ({} as any);\n return this.addRule(rule, errorMessage, ruleOptions);\n }\n\n /**\n * Define custom rule\n */\n public refine(\n callback: (\n value: any,\n context: SchemaContext,\n ) => Promise<string | undefined> | string | undefined,\n ) {\n return this.addRule({\n name: \"custom\",\n async validate(value, context) {\n const result = await callback(value, context);\n if (result) {\n this.context.errorMessage = result;\n return invalidRule(this, context);\n }\n return VALID_RULE;\n },\n });\n }\n\n /**\n * Add mutator to the validator\n */\n public addMutator(mutator: Mutator, options: any = {}) {\n const instance = this.instance;\n instance.addMutableMutator(mutator, options);\n return instance;\n }\n\n /**\n * Add mutable mutator\n */\n public addMutableMutator(mutator: Mutator, options: any = {}) {\n this.mutators.push({\n mutate: mutator,\n context: {\n options,\n ctx: {} as any,\n },\n });\n }\n\n /**\n * Set default value for the field. The default is used when the input is\n * absent (`undefined`); it then flows through the rule pipeline.\n *\n * Brands the return type with `{ hasDefault: true }` so `Infer<>` treats\n * the field as guaranteed-present even when chained with `.optional()`.\n */\n public default(value: any): this & { hasDefault: true } {\n const instance = this.instance;\n instance.defaultValue = value;\n return instance as this & { hasDefault: true };\n }\n\n /**\n * Fallback to a value when validation fails.\n *\n * Complementary to `.default()`: `.default(x)` fires when input is **absent**,\n * `.catch(y)` fires when input is **present but invalid**. Combine them when\n * you want both behaviours: `.optional().default(x).catch(y)`.\n *\n * The fallback can be a value or a callback `(errors, originalInput) => fallback`.\n * The callback variant is the only side-channel for the swallowed errors —\n * use it to log/alert before the fallback substitutes.\n *\n * Brands the return type with `{ hasCatch: true }` so `Infer<>` treats the\n * field as guaranteed-present (the catch ensures a value will always exist).\n *\n * **Scope (v1).** Catch is honoured for **leaf validators** (string, number,\n * boolean, date, …) and for fields inside containers. It is a **no-op on\n * container validators themselves** (`v.object`, `v.array`, `v.record`,\n * `v.tuple`, `v.discriminatedUnion`) — those use their own iteration logic\n * that bypasses the catch hook in `BaseValidator.validate()`.\n *\n * @example\n * ```ts\n * v.int().min(0).catch(3) // bad number → 3\n * v.string().in([\"us\", \"eu\"]).catch(\"us\") // unknown enum → \"us\"\n * v.string().catch((errors, input) => {\n * console.warn(`bad user value: ${JSON.stringify(input)}`, errors);\n * return \"anonymous\";\n * })\n * ```\n */\n public catch(\n fallback:\n | any\n | ((errors: ValidationResult[\"errors\"], originalInput: any) => any | Promise<any>),\n ): this & { hasCatch: true } {\n const instance = this.instance;\n\n instance.catchValue = fallback;\n instance.hasCatch = true;\n\n return instance as this & { hasCatch: true };\n }\n\n /**\n * Mutate the data\n */\n public async mutate(data: any, context: SchemaContext) {\n let mutatedData = data;\n\n for (const mutator of this.mutators) {\n mutator.context.ctx = context;\n mutatedData = await mutator.mutate(mutatedData, mutator.context);\n }\n\n return mutatedData;\n }\n\n /**\n * Set the label for the validator that will be matching the :input attribute\n */\n public label(label: string) {\n const instance = this.instance;\n instance.attributesText.input = label;\n return instance;\n }\n\n /**\n * Validate the data\n */\n public async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\n if (data === null && this.isNullable) {\n return { isValid: true, errors: [], data: null };\n }\n\n const valueForRules = data ?? this.getDefaultValue();\n const mutatedData = await this.mutate(valueForRules, context);\n\n const errors: ValidationResult[\"errors\"] = [];\n let isValid = true;\n const isFirstErrorOnly = context.configurations?.firstErrorOnly ?? true;\n\n const isEmpty = isEmptyValue(valueForRules);\n\n // D8 fix (design/core-defects-found.md): for an optional field, only a\n // truly ABSENT value (`valueForRules === undefined` — the key was\n // missing, or was `null`/`undefined` and got coalesced above) may skip\n // the value rules. A PRESENT-but-empty value (e.g. `\"\"` from `?page=`)\n // must still run them, so `v.int().optional()` given `\"\"` fails instead\n // of silently handing back a string that `Infer.Output`'s\n // `number | undefined` forbids. Non-optional fields are unaffected —\n // their `requiredRule` (not nulled out by `.optional()`) already rejects\n // `\"\"` before these rules matter.\n const skipEmptyRules = this.isOptional ? valueForRules === undefined : isEmpty;\n\n // Prepend the required-condition rule if set, so it always runs first.\n // requiredRule has requiresValue = false so it runs even on empty values.\n const rulesToRun = this.requiredRule ? [this.requiredRule, ...this.rules] : this.rules;\n\n for (const rule of rulesToRun) {\n if ((rule.requiresValue ?? true) && skipEmptyRules) continue;\n\n this.setRuleAttributesList(rule);\n\n const result = await rule.validate(mutatedData, context);\n\n if (result.isValid === false) {\n isValid = false;\n errors.push({\n type: rule.name,\n error: result.error,\n input: result.path ?? context.path,\n });\n\n if (isFirstErrorOnly) {\n break;\n }\n }\n }\n\n const result: ValidationResult = {\n isValid,\n errors,\n data:\n mutatedData !== undefined\n ? await this.startTransformationPipeline(mutatedData, context)\n : undefined,\n };\n\n // Catch fallback — only on the leaf path. Container validators override\n // validate() and don't run this hook on their own outcome, so catching\n // a whole object/array/record is a no-op in v1.\n if (result.isValid === false && this.hasCatch) {\n const fallback =\n typeof this.catchValue === \"function\"\n ? await this.catchValue(result.errors, data)\n : this.catchValue;\n\n return { isValid: true, errors: [], data: fallback };\n }\n\n return result;\n }\n\n /**\n * Set rule attributes list\n */\n protected setRuleAttributesList(rule: ContextualSchemaRule) {\n rule.context.attributesList =\n typeof this.attributesText[rule.name] === \"object\"\n ? (this.attributesText[rule.name] as ValidationAttributesList)\n : this.attributesText;\n }\n\n /**\n * Standard Schema V1 compliance.\n *\n * Allows this validator to be used with any Standard Schema-aware library\n * (OpenAI structured outputs, LangGraph, TanStack Form, Conform, Valibot adapters, etc.)\n * without extra adapters.\n *\n * Delegates to the `validate()` factory so all `configureSeal()` options\n * (translations, firstErrorOnly) are picked up automatically at call time.\n *\n * Includes Standard JSON Schema support via `jsonSchema.input()` / `jsonSchema.output()`.\n *\n * ## How Standard Schema libraries consume this\n *\n * You pass the **schema object itself** to the library — they internally read\n * `schema[\"~standard\"]`. Do NOT pass `schema[\"~standard\"]` directly.\n *\n * @example\n * ```ts\n * const schema = v.object({ name: v.string().required() });\n *\n * // TanStack Form — pass schema, library reads [\"~standard\"] internally\n * const form = useForm({ validators: { onChange: schema } });\n *\n * // Conform (Remix) — same pattern\n * const [form] = useForm({ onValidate({ formData }) {\n * return parseWithStandardSchema(formData, { schema });\n * }});\n *\n * // Direct validation (lower level — most apps don't need this)\n * const result = await schema[\"~standard\"].validate({ name: \"Hasan\" });\n * // → { value: { name: \"Hasan\" } } on success\n * // → { issues: [{ message: \"...\", path: [{ key: \"name\" }] }] } on failure\n *\n * // JSON Schema for OpenAI / LangChain tool calling\n * const parameters = schema[\"~standard\"].jsonSchema.input({ target: \"openai-strict\" });\n * // → { type: \"object\", properties: {...}, required: [...], additionalProperties: false }\n * ```\n *\n * @note Cross-field rules (sameAs, requiredIf, requiredWith) rely on sibling values\n * available in the full validation context. When called on a standalone scalar validator,\n * sibling data is absent and those rules will not evaluate correctly.\n * Always call on the parent ObjectValidator for full-payload validation.\n */\n get [\"~standard\"](): StandardJSONSchemaV1.Props<TInput, TOutput> {\n return {\n version: 1,\n vendor: \"seal\",\n types: undefined as unknown as StandardSchemaV1.Types<TInput, TOutput>,\n validate: async (value: unknown) => {\n const result = await validate(this, value);\n return mapToStandardResult(result) as StandardSchemaV1.Result<TOutput>;\n },\n jsonSchema: {\n input: (options) => this.toJsonSchema(options.target),\n output: (options) => this.toJsonSchema(options.target),\n },\n };\n }\n\n /**\n * Generate a JSON Schema representation of this validator.\n *\n * Supports targets: `\"draft-2020-12\"` (default), `\"draft-07\"`, `\"openapi-3.0\"`.\n *\n * Subclasses override this to describe their specific constraints.\n * The base implementation returns `{}` (permissive — accepts anything),\n * which is correct for validators with no representable JSON Schema constraints.\n *\n * @note Rules that cannot be expressed in JSON Schema are silently omitted:\n * - Cross-field rules: sameAs, requiredIf, requiredWith, requiredWithout\n * - Custom callbacks: refine()\n * - Framework-specific runtime rules (core/cascade plugins)\n * These rules still run normally at validation time — only absent from JSON Schema.\n *\n * @example\n * ```ts\n * v.string().min(3).max(50).toJsonSchema(\"draft-2020-12\")\n * // → { type: \"string\", minLength: 3, maxLength: 50 }\n *\n * v.object({ name: v.string().required(), age: v.int().optional() })\n * .toJsonSchema(\"draft-07\")\n * // → { type: \"object\", properties: { name: { type: \"string\" }, age: { type: \"integer\" } }, required: [\"name\"] }\n * ```\n */\n public toJsonSchema(_target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n return {};\n }\n}\n","import type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\nimport { applyNullable } from \"../standard-schema/json-schema\";\r\nimport { BaseValidator } from \"./base-validator\";\r\n\r\n/**\r\n * Any validator - accepts any value\r\n */\r\nexport class AnyValidator extends BaseValidator {\r\n /**\r\n * Any validator means any value, so we disable the default required requirement.\r\n */\r\n public override requiredRule = null;\r\n\r\n /**\r\n * Set is optional to be true\r\n */\r\n public override isOptional = true;\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Any validator accepts anything. In JSON Schema, an empty object `{}`\r\n * is the permissive schema that accepts any valid JSON value.\r\n *\r\n * @example\r\n * ```ts\r\n * v.any().toJsonSchema(\"draft-2020-12\")\r\n * // → {}\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const schema: JsonSchemaResult = {};\r\n if (this.isNullable) applyNullable(schema, target);\r\n return schema;\r\n }\r\n}\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { isEmptyValue } from \"../helpers/is-empty-value\";\r\nimport type { Mutator } from \"../types\";\r\n\r\n/** Reverse array order */\r\nexport const flipArrayMutator: Mutator = async (value) => {\r\n return value.reverse();\r\n};\r\n\r\n/** Reverse array order (alias) */\r\nexport const reverseArrayMutator: Mutator = async (value) => {\r\n return value.reverse();\r\n};\r\n\r\n/** Sort array */\r\nexport const sortArrayMutator: Mutator = async (value, context) => {\r\n if (!Array.isArray(value)) return value;\r\n\r\n const sortDirection = context?.options.direction ?? \"asc\";\r\n const sortByKey = context?.options.key ?? null;\r\n\r\n return value.sort((a: any, b: any) => {\r\n if (sortByKey) {\r\n const aValue = get(a, sortByKey);\r\n const bValue = get(b, sortByKey);\r\n\r\n if (sortDirection === \"asc\") {\r\n return aValue - bValue;\r\n }\r\n return bValue - aValue;\r\n }\r\n\r\n if (sortDirection === \"asc\") {\r\n return a - b;\r\n }\r\n return b - a;\r\n });\r\n};\r\n\r\n/** Make array have only unique values */\r\nexport const uniqueArrayMutator: Mutator = async (value) => {\r\n return [...new Set(value)];\r\n};\r\n\r\n/** Remove empty elements from array */\r\nexport const removeEmptyArrayElementsMutator: Mutator = async (value) => {\r\n return value.filter((item: any) => !isEmptyValue(item));\r\n};\r\n","!function(t,e){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=e():\"function\"==typeof define&&define.amd?define(e):(t=\"undefined\"!=typeof globalThis?globalThis:t||self).dayjs=e()}(this,(function(){\"use strict\";var t=1e3,e=6e4,n=36e5,r=\"millisecond\",i=\"second\",s=\"minute\",u=\"hour\",a=\"day\",o=\"week\",c=\"month\",f=\"quarter\",h=\"year\",d=\"date\",l=\"Invalid Date\",$=/^(\\d{4})[-/]?(\\d{1,2})?[-/]?(\\d{0,2})[Tt\\s]*(\\d{1,2})?:?(\\d{1,2})?:?(\\d{1,2})?[.:]?(\\d+)?$/,y=/\\[([^\\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:\"en\",weekdays:\"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday\".split(\"_\"),months:\"January_February_March_April_May_June_July_August_September_October_November_December\".split(\"_\"),ordinal:function(t){var e=[\"th\",\"st\",\"nd\",\"rd\"],n=t%100;return\"[\"+t+(e[(n-20)%10]||e[n]||e[0])+\"]\"}},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:\"\"+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?\"+\":\"-\")+m(r,2,\"0\")+\":\"+m(i,2,\"0\")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return+(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||\"\").toLowerCase().replace(/s$/,\"\")},u:function(t){return void 0===t}},g=\"en\",D={};D[g]=M;var p=\"$isDayjsObject\",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if(\"string\"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split(\"-\");if(!i&&u.length>1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n=\"object\"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if(\"string\"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||\"0\").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return b},m.isValid=function(){return!(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate(\"s\"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v=\"set\"+(this.$u?\"UTC\":\"\");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+\"Hours\",0);case u:return $(v+\"Minutes\",1);case s:return $(v+\"Seconds\",2);case i:return $(v+\"Milliseconds\",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f=\"set\"+(this.$u?\"UTC\":\"\"),l=(n={},n[a]=f+\"Date\",n[d]=f+\"Date\",n[c]=f+\"Month\",n[h]=f+\"FullYear\",n[u]=f+\"Hours\",n[s]=f+\"Minutes\",n[i]=f+\"Seconds\",n[r]=f+\"Milliseconds\",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||\"YYYY-MM-DDTHH:mm:ssZ\",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,\"0\")},$=f||function(t,e,n){var r=t<12?\"AM\":\"PM\";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case\"YY\":return String(e.$y).slice(-2);case\"YYYY\":return b.s(e.$y,4,\"0\");case\"M\":return a+1;case\"MM\":return b.s(a+1,2,\"0\");case\"MMM\":return h(n.monthsShort,a,c,3);case\"MMMM\":return h(c,a);case\"D\":return e.$D;case\"DD\":return b.s(e.$D,2,\"0\");case\"d\":return String(e.$W);case\"dd\":return h(n.weekdaysMin,e.$W,o,2);case\"ddd\":return h(n.weekdaysShort,e.$W,o,3);case\"dddd\":return o[e.$W];case\"H\":return String(s);case\"HH\":return b.s(s,2,\"0\");case\"h\":return d(1);case\"hh\":return d(2);case\"a\":return $(s,u,!0);case\"A\":return $(s,u,!1);case\"m\":return String(u);case\"mm\":return b.s(u,2,\"0\");case\"s\":return String(e.$s);case\"ss\":return b.s(e.$s,2,\"0\");case\"SSS\":return b.s(e.$ms,3,\"0\");case\"Z\":return i}return null}(t)||i.replace(\":\",\"\")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),Y=_.prototype;return O.prototype=Y,[[\"$ms\",r],[\"$s\",i],[\"$m\",s],[\"$H\",u],[\"$W\",a],[\"$M\",c],[\"$y\",h],[\"$D\",d]].forEach((function(t){Y[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));","import dayjs from \"dayjs\";\r\nimport type { Mutator } from \"../types\";\r\n\r\n/**\r\n * Convert value to Date object\r\n * Returns Invalid Date if value cannot be converted\r\n */\r\nexport const dateMutator: Mutator = async (value) => {\r\n // Handle null/undefined\r\n if (!value) {\r\n return;\r\n }\r\n\r\n // Already a Date object\r\n if (value instanceof Date) {\r\n return value;\r\n }\r\n\r\n // Try to convert to Date\r\n const date = new Date(value);\r\n\r\n // Return the date (valid or Invalid Date)\r\n // dateRule will validate and fail if invalid\r\n return date;\r\n};\r\n\r\n/** Convert date to ISO string format */\r\nexport const toISOStringMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n return date.toISOString();\r\n};\r\n\r\n/** Convert date to Unix timestamp (milliseconds) */\r\nexport const toTimestampMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n return date.getTime();\r\n};\r\n\r\n/** Convert date to start of day (00:00:00) */\r\nexport const toStartOfDayMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n date.setHours(0, 0, 0, 0);\r\n return date;\r\n};\r\n\r\n/** Convert date to end of day (23:59:59.999) */\r\nexport const toEndOfDayMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n date.setHours(23, 59, 59, 999);\r\n return date;\r\n};\r\n\r\n/** Add or subtract days from date */\r\nexport const addDaysMutator: Mutator = async (value, context) => {\r\n const date = new Date(value);\r\n const days = context?.options.days ?? 0;\r\n date.setDate(date.getDate() + days);\r\n return date;\r\n};\r\n\r\n/** Add or subtract months from date */\r\nexport const addMonthsMutator: Mutator = async (value, context) => {\r\n const date = new Date(value);\r\n const months = context?.options.months ?? 0;\r\n date.setMonth(date.getMonth() + months);\r\n return date;\r\n};\r\n\r\n/** Add or subtract years from date */\r\nexport const addYearsMutator: Mutator = async (value, context) => {\r\n const date = new Date(value);\r\n const years = context?.options.years ?? 0;\r\n date.setFullYear(date.getFullYear() + years);\r\n return date;\r\n};\r\n\r\n/** Add or subtract hours from date */\r\nexport const addHoursMutator: Mutator = async (value, context) => {\r\n const date = new Date(value);\r\n const hours = context?.options.hours ?? 0;\r\n date.setHours(date.getHours() + hours);\r\n return date;\r\n};\r\n\r\n/** Convert date to UTC */\r\nexport const toUTCMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n return new Date(date.toUTCString());\r\n};\r\n\r\n/** Convert date to specific format using dayjs */\r\nexport const toFormatMutator: Mutator = async (value, context) => {\r\n const format = context?.options.format ?? \"YYYY-MM-DD\";\r\n return dayjs(value).format(format);\r\n};\r\n\r\n/** Convert to date only (remove time) */\r\nexport const toDateOnlyMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n return date.toISOString().split(\"T\")[0];\r\n};\r\n\r\n/** Convert to time only (HH:MM:SS) */\r\nexport const toTimeOnlyMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n return date.toTimeString().split(\" \")[0];\r\n};\r\n\r\n/** Set to start of month */\r\nexport const toStartOfMonthMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n date.setDate(1);\r\n date.setHours(0, 0, 0, 0);\r\n return date;\r\n};\r\n\r\n/** Set to end of month */\r\nexport const toEndOfMonthMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n date.setMonth(date.getMonth() + 1);\r\n date.setDate(0);\r\n date.setHours(23, 59, 59, 999);\r\n return date;\r\n};\r\n\r\n/** Set to start of year */\r\nexport const toStartOfYearMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n date.setMonth(0);\r\n date.setDate(1);\r\n date.setHours(0, 0, 0, 0);\r\n return date;\r\n};\r\n\r\n/** Set to end of year */\r\nexport const toEndOfYearMutator: Mutator = async (value) => {\r\n const date = new Date(value);\r\n date.setMonth(11);\r\n date.setDate(31);\r\n date.setHours(23, 59, 59, 999);\r\n return date;\r\n};\r\n","import { round } from \"@mongez/reinforcements\";\r\nimport { isNumeric } from \"@mongez/supportive-is\";\r\nimport type { Mutator } from \"../types\";\r\n\r\n/** Convert value to number */\r\nexport const numberMutator: Mutator = async (value) => {\r\n if (!value) return value;\r\n return Number(value);\r\n};\r\n\r\n/** Round number to specified decimals */\r\nexport const roundNumberMutator: Mutator = async (value, context) => {\r\n return round(value, context?.options?.decimals ?? 2);\r\n};\r\n\r\n/** Convert to boolean */\r\nexport const booleanMutator: Mutator = async (value) => {\r\n if (value === \"true\") return true;\r\n if (value === \"false\") return false;\r\n return Boolean(value);\r\n};\r\n\r\nexport const numericMutator: Mutator = async (value) => {\r\n if (!isNumeric(value)) return value;\r\n return Number(value);\r\n};\r\n\r\n/** Absolute value mutator */\r\nexport const absMutator: Mutator = async (value) => {\r\n return Math.abs(Number(value));\r\n};\r\n\r\n/** Ceil mutator */\r\nexport const ceilMutator: Mutator = async (value) => {\r\n return Math.ceil(Number(value));\r\n};\r\n\r\n/** Floor mutator */\r\nexport const floorMutator: Mutator = async (value) => {\r\n return Math.floor(Number(value));\r\n};\r\n\r\n/**\r\n * Round mutator\r\n * Supports decimal precision via options.decimals\r\n */\r\nexport const roundMutator: Mutator = async (value, context) => {\r\n const decimals = context?.options?.decimals ?? 0;\r\n // If decimals is 0, use standard Math.round for integers\r\n if (decimals === 0) {\r\n return Math.round(Number(value));\r\n }\r\n // Otherwise use reinforcements round helper for precision\r\n return round(Number(value), decimals);\r\n};\r\n\r\n/**\r\n * To fixed mutator — rounds to a fixed number of decimal places, as a number.\r\n *\r\n * `Number.prototype.toFixed` returns a *string*, which the number validator's\r\n * own type rule then rejected: `v.number().toFixed(2)` could never produce a\r\n * valid result. Coercing back to a number keeps the method usable where it\r\n * lives. For the fixed-point string form, format at the edge instead of asking\r\n * a number schema to output a string.\r\n */\r\nexport const toFixedMutator: Mutator = async (value, context) => {\r\n const decimals = context?.options?.decimals ?? 2;\r\n return Number(Number(value).toFixed(decimals));\r\n};\r\n","import { trim } from \"@mongez/reinforcements\";\r\nimport { isPlainObject } from \"@mongez/supportive-is\";\r\nimport type { Mutator } from \"../types\";\r\n\r\n/** Strip unknown keys from object */\r\nexport const stripUnknownMutator: Mutator = async (value, context) => {\r\n const allowedKeys = [\r\n ...(context?.ctx.schema ? Object.keys(context.ctx.schema) : []),\r\n ...(context?.options.allowedKeys ?? []),\r\n ];\r\n\r\n const result: Record<string, any> = {};\r\n\r\n for (const key in value) {\r\n if (allowedKeys.includes(key)) {\r\n result[key] = value[key];\r\n }\r\n }\r\n\r\n return result;\r\n};\r\n\r\n/** Trim all string values in object */\r\nexport const objectTrimMutator: Mutator = async (value, context) => {\r\n if (!isPlainObject(value)) return value;\r\n\r\n const result: Record<string, any> = {};\r\n const recursive = context?.options.recursive ?? false;\r\n\r\n for (const key in value) {\r\n const item = value[key];\r\n\r\n if (recursive) {\r\n if (Array.isArray(item)) {\r\n result[key] = await Promise.all(\r\n item.map(async (i: any) =>\r\n typeof i === \"string\" ? trim(i) : await objectTrimMutator(i, context),\r\n ),\r\n );\r\n } else if (isPlainObject(item)) {\r\n result[key] = await objectTrimMutator(item, context);\r\n } else {\r\n result[key] = typeof item === \"string\" ? trim(item) : item;\r\n }\r\n } else {\r\n result[key] = typeof item === \"string\" ? trim(item) : item;\r\n }\r\n }\r\n\r\n return result;\r\n};\r\n\r\n/** Parse JSON string */\r\nexport const jsonMutator: Mutator = async (value) => {\r\n try {\r\n return JSON.parse(value);\r\n } catch {\r\n return value;\r\n }\r\n};\r\n","import type { Mutator } from \"../types\";\r\n\r\nexport const stringMutator: Mutator = async (value) => {\r\n if ([undefined, null].includes(value)) {\r\n return value;\r\n }\r\n\r\n return String(value);\r\n};\r\n","import {\r\n capitalize,\r\n ltrim,\r\n readMoreChars,\r\n rtrim,\r\n toCamelCase,\r\n toKebabCase,\r\n toSnakeCase,\r\n toStudlyCase,\r\n trim,\r\n} from \"@mongez/reinforcements\";\r\nimport type { Mutator } from \"../types\";\r\n\r\n/** Convert string to lowercase */\r\nexport const lowercaseMutator: Mutator = async (value) => {\r\n return value?.toString().toLowerCase();\r\n};\r\n\r\n/** Convert string to uppercase */\r\nexport const uppercaseMutator: Mutator = async (value) => {\r\n return value?.toString().toUpperCase();\r\n};\r\n\r\n/** Capitalize only the first letter of the string */\r\nexport const capitalizeMutator: Mutator = async (value) => {\r\n const str = value?.toString();\r\n return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();\r\n};\r\n\r\n/** Capitalize the first letter of each word (Title Case) */\r\nexport const titleCaseMutator: Mutator = async (value) => {\r\n return capitalize(value?.toString());\r\n};\r\n\r\n/** Convert value to string */\r\nexport const stringifyMutator: Mutator = async (value) => {\r\n if (!value && value !== 0) return \"\";\r\n // only convert numbers, boolean and strings\r\n\r\n // Handle strings (pass through)\r\n if (typeof value === \"string\") return value;\r\n\r\n // Handle scalar types (number, boolean)\r\n if (typeof value === \"number\" || typeof value === \"boolean\") {\r\n return String(value);\r\n }\r\n};\r\n\r\n/** Trim whitespace */\r\nexport const trimMutator: Mutator = async (value, context) => {\r\n return trim(value?.toString(), context?.options?.needle ?? \" \");\r\n};\r\n\r\n/**\r\n * Strip HTML tags with a naive `<...>` regex.\r\n *\r\n * This is a **tag stripper, not an XSS sanitizer**: it is not a parser, so\r\n * malformed/nested markup, attribute payloads, or content re-introduced\r\n * later in a pipeline can defeat it. Do not rely on this alone to make\r\n * untrusted rich text safe to render — use a real parser-based sanitizer\r\n * (e.g. DOMPurify / sanitize-html) for that.\r\n */\r\nexport const stripTagsMutator: Mutator = async (value) => {\r\n return value?.toString().replace(/<[^>]*>?/gm, \"\");\r\n};\r\n\r\n/**\r\n * @deprecated Renamed to {@link stripTagsMutator} — the old name implied\r\n * XSS safety this tag-stripping regex does not provide. Kept as an alias\r\n * for backward compatibility; switch to `stripTagsMutator`.\r\n */\r\nexport const safeHtmlMutator: Mutator = stripTagsMutator;\r\n\r\n/** HTML escape */\r\nexport const htmlEscapeMutator: Mutator = async (value) => {\r\n return value\r\n ?.toString()\r\n .replace(/&/g, \"&\")\r\n .replace(/</g, \"<\")\r\n .replace(/>/g, \">\")\r\n .replace(/\"/g, \""\")\r\n .replace(/'/g, \"'\");\r\n};\r\n\r\n/** Remove special characters */\r\nexport const removeSpecialCharactersMutator: Mutator = async (value) => {\r\n return value?.toString().replace(/[^a-zA-Z0-9]/g, \"\");\r\n};\r\n\r\n/** URL decode */\r\nexport const urlDecodeMutator: Mutator = async (value) => {\r\n return decodeURIComponent(value);\r\n};\r\n\r\n/** URL encode */\r\nexport const urlEncodeMutator: Mutator = async (value) => {\r\n return encodeURIComponent(value);\r\n};\r\n\r\n/** Convert to camelCase */\r\nexport const camelCaseMutator: Mutator = async (value) => {\r\n return toCamelCase(value?.toString());\r\n};\r\n\r\n/** Convert to PascalCase */\r\nexport const pascalCaseMutator: Mutator = async (value) => {\r\n return toStudlyCase(value?.toString());\r\n};\r\n\r\n/** Convert to snake_case */\r\nexport const snakeCaseMutator: Mutator = async (value) => {\r\n return toSnakeCase(value?.toString());\r\n};\r\n\r\n/** Convert to kebab-case */\r\nexport const kebabCaseMutator: Mutator = async (value) => {\r\n return toKebabCase(value?.toString());\r\n};\r\n\r\n/** Convert to URL-friendly slug */\r\nexport const slugMutator: Mutator = async (value) => {\r\n return value\r\n ?.toString()\r\n .toLowerCase()\r\n .trim()\r\n .replace(/[^\\w\\s-]/g, \"\")\r\n .replace(/[\\s_]+/g, \"-\")\r\n .replace(/--+/g, \"-\")\r\n .replace(/^-+|-+$/g, \"\");\r\n};\r\n\r\n/** Trim from the left/start */\r\nexport const ltrimMutator: Mutator = async (value, context) => {\r\n return ltrim(value?.toString(), context?.options?.needle ?? \" \");\r\n};\r\n\r\n/** Trim from the right/end */\r\nexport const rtrimMutator: Mutator = async (value, context) => {\r\n return rtrim(value?.toString(), context?.options?.needle ?? \" \");\r\n};\r\n\r\n/** Base64 encode */\r\nexport const base64EncodeMutator: Mutator = async (value) => {\r\n return Buffer.from(value?.toString()).toString(\"base64\");\r\n};\r\n\r\n/** Base64 decode */\r\nexport const base64DecodeMutator: Mutator = async (value) => {\r\n return Buffer.from(value?.toString(), \"base64\").toString(\"utf-8\");\r\n};\r\n\r\n/** Replace substring or pattern */\r\nexport const replaceMutator: Mutator = async (value, context) => {\r\n const { search, replace } = context?.options;\r\n if (!search) return value?.toString();\r\n return value?.toString().replace(search, replace ?? \"\");\r\n};\r\n\r\n/** Replace all occurrences of substring or pattern */\r\nexport const replaceAllMutator: Mutator = async (value, context) => {\r\n const { search, replace } = context?.options;\r\n if (!search) return value?.toString();\r\n const searchValue = typeof search === \"string\" ? new RegExp(search, \"g\") : search;\r\n return value?.toString().replace(searchValue, replace ?? \"\");\r\n};\r\n\r\n/** Append/suffix text to the end */\r\nexport const appendMutator: Mutator = async (value, context) => {\r\n const suffix = context?.options?.suffix ?? \"\";\r\n return value?.toString() + suffix;\r\n};\r\n\r\n/** Prepend/prefix text to the beginning */\r\nexport const prependMutator: Mutator = async (value, context) => {\r\n const prefix = context?.options?.prefix ?? \"\";\r\n return prefix + value?.toString();\r\n};\r\n\r\n/** Reverse the string */\r\nexport const reverseMutator: Mutator = async (value) => {\r\n return value?.toString().split(\"\").reverse().join(\"\");\r\n};\r\n\r\n/** Truncate to a maximum length */\r\nexport const truncateMutator: Mutator = async (value, context) => {\r\n const str = value?.toString();\r\n const maxLength = context?.options?.maxLength ?? 100;\r\n const suffix = context?.options?.suffix ?? \"...\";\r\n return readMoreChars(str, maxLength, suffix);\r\n};\r\n\r\n/** Trim multiple whitespace into single space */\r\nexport const trimMultipleWhitespaceMutator: Mutator = async (value) => {\r\n return value?.toString().replace(/\\s+/g, \" \");\r\n};\r\n\r\n/** Pad string from the start to reach target length */\r\nexport const padStartMutator: Mutator = async (value, context) => {\r\n const length = context?.options?.length ?? 0;\r\n const char = context?.options?.char ?? \" \";\r\n return value?.toString().padStart(length, char);\r\n};\r\n\r\n/** Pad string from the end to reach target length */\r\nexport const padEndMutator: Mutator = async (value, context) => {\r\n const length = context?.options?.length ?? 0;\r\n const char = context?.options?.char ?? \" \";\r\n return value?.toString().padEnd(length, char);\r\n};\r\n\r\n/** Repeat string N times */\r\nexport const repeatMutator: Mutator = async (value, context) => {\r\n const count = context?.options?.count ?? 1;\r\n return value?.toString()?.repeat(count);\r\n};\r\n\r\n/** Mask part of string */\r\nexport const maskMutator: Mutator = async (value, context) => {\r\n const str = value?.toString();\r\n const maskChar = context?.options?.char ?? \"*\";\r\n const start = context?.options?.start ?? 0;\r\n const end = context?.options?.end ?? str?.length;\r\n const visibleStart = str?.substring(0, start);\r\n const visibleEnd = str?.substring(end);\r\n const maskedLength = end - start;\r\n return visibleStart + maskChar.repeat(maskedLength) + visibleEnd;\r\n};\r\n\r\n/** Unescape HTML entities */\r\nexport const unescapeHtmlMutator: Mutator = async (value) => {\r\n return value\r\n ?.toString()\r\n .replace(/&/g, \"&\")\r\n .replace(/</g, \"<\")\r\n .replace(/>/g, \">\")\r\n .replace(/"/g, '\"')\r\n .replace(/'/g, \"'\");\r\n};\r\n\r\n/** Keep only alphabetic characters */\r\nexport const alphaOnlyMutator: Mutator = async (value) => {\r\n return value.toString().replace(/[^a-zA-Z]/g, \"\");\r\n};\r\n\r\n/** Keep only alphanumeric characters */\r\nexport const alphanumericOnlyMutator: Mutator = async (value) => {\r\n return value.toString().replace(/[^a-zA-Z0-9]/g, \"\");\r\n};\r\n\r\n/** Remove all numeric characters */\r\nexport const removeNumbersMutator: Mutator = async (value) => {\r\n return value.toString().replace(/[0-9]/g, \"\");\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Equal rule - value must be equal to a specific value\r\n */\r\nexport const equalRule: SchemaRule<{ value: any }> = {\r\n name: \"equal\",\r\n defaultErrorMessage: \"The :input must be equal to :value\",\r\n async validate(value: any, context) {\r\n if (value !== this.context.options.value) {\r\n this.context.translatableParams.value = this.context.options.value;\r\n return invalidRule(this, context);\r\n }\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Forbidden rule - value must not be present\r\n */\r\nexport const forbiddenRule: SchemaRule = {\r\n name: \"forbidden\",\r\n defaultErrorMessage: \"The :input is forbidden\",\r\n async validate(value: any, context) {\r\n if (!isEmptyValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport type { BaseValidator } from \"../../validators/base-validator\";\r\n\r\n/**\r\n * Union rule - value must match at least one of the provided validators\r\n */\r\nexport const unionRule: SchemaRule<{ validators: BaseValidator[] }> = {\r\n name: \"union\",\r\n defaultErrorMessage: \"Value must match one of the allowed types\",\r\n async validate(value: any, context) {\r\n const validators = this.context.options.validators;\r\n const firstErrorOnly = context.configurations?.firstErrorOnly ?? true;\r\n const allErrors: string[] = [];\r\n\r\n // Try each validator\r\n for (const validator of validators) {\r\n // Skip if type doesn't match (optimization)\r\n if (!validator.matchesType(value)) {\r\n continue;\r\n }\r\n\r\n // Type matches - validate\r\n const result = await validator.validate(value, context);\r\n\r\n if (result.isValid) {\r\n // Success! Validator matched and validated\r\n return VALID_RULE;\r\n }\r\n\r\n // Failed - collect error message\r\n const errorMsg = result.errors?.[0]?.error || \"Validation failed\";\r\n allErrors.push(errorMsg);\r\n\r\n // If firstErrorOnly, stop after first failed validator\r\n if (firstErrorOnly) {\r\n break;\r\n }\r\n }\r\n\r\n // All failed or no validator matched the type\r\n if (allErrors.length > 0) {\r\n // At least one validator matched type but failed validation\r\n this.context.errorMessage = firstErrorOnly\r\n ? allErrors[0]\r\n : allErrors.join(\"; \");\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule, WhenRuleOptions } from \"../../types\";\r\n\r\n/**\r\n * When rule - conditional validation based on another field value\r\n */\r\nexport const whenRule: SchemaRule<WhenRuleOptions> = {\r\n name: \"when\",\r\n description: \"Apply conditional validation based on another field value\",\r\n async validate(value: any, context) {\r\n const fieldToCheck = this.context.options.field;\r\n const conditions = this.context.options.is;\r\n const otherwise = this.context.options.otherwise;\r\n const scope = this.context.options.scope || \"global\";\r\n\r\n const fieldValue =\r\n scope === \"global\"\r\n ? get(context.allValues, fieldToCheck)\r\n : get(context.parent, fieldToCheck);\r\n\r\n // Convert field value to string for key lookup\r\n // This handles boolean, number, and string field values\r\n const fieldValueKey = String(fieldValue);\r\n\r\n if (conditions[fieldValueKey]) {\r\n const result = await conditions[fieldValueKey].validate(value, context);\r\n if (result.isValid) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Safe error access\r\n this.context.errorMessage =\r\n result.errors?.[0]?.error || \"Validation failed\";\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (otherwise) {\r\n const result = await otherwise.validate(value, context);\r\n\r\n if (result.isValid) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Safe error access\r\n this.context.errorMessage =\r\n result.errors?.[0]?.error || \"Validation failed\";\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Alpha rule - allows only alphabetic characters\r\n */\r\nexport const alphaRule: SchemaRule = {\r\n name: \"alpha\",\r\n defaultErrorMessage: \"The :input must contain only alphabetic characters\",\r\n async validate(value: any, context) {\r\n if (/^[a-zA-Z]+$/.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * AlphaNumeric rule - allows only alphanumeric characters\r\n */\r\nexport const alphaNumericRule: SchemaRule = {\r\n name: \"alphaNumeric\",\r\n defaultErrorMessage: \"The :input must contain only alphanumeric characters\",\r\n async validate(value: any, context) {\r\n if (/^[a-zA-Z0-9]+$/.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Numeric string rule - allows only numeric characters\r\n */\r\nexport const isNumericRule: SchemaRule = {\r\n name: \"numeric\",\r\n defaultErrorMessage: \"The :input must contain only numeric characters\",\r\n async validate(value: any, context) {\r\n if (/^[0-9]+$/.test(String(value))) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Credit card rule - validates credit card number\r\n */\r\nexport const isCreditCardRule: SchemaRule = {\r\n name: \"creditCard\",\r\n defaultErrorMessage: \"The :input must be a valid credit card number\",\r\n async validate(value: any, context) {\r\n // Luhn algorithm for credit card validation\r\n const cardNumber = String(value).replace(/\\s/g, \"\");\r\n\r\n if (!/^\\d+$/.test(cardNumber)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n let sum = 0;\r\n let isEven = false;\r\n\r\n for (let i = cardNumber.length - 1; i >= 0; i--) {\r\n let digit = parseInt(cardNumber[i], 10);\r\n\r\n if (isEven) {\r\n digit *= 2;\r\n if (digit > 9) {\r\n digit -= 9;\r\n }\r\n }\r\n\r\n sum += digit;\r\n isEven = !isEven;\r\n }\r\n\r\n if (sum % 10 === 0) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { isEmail } from \"@mongez/supportive-is\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Email rule - validates email format\r\n */\r\nexport const emailRule: SchemaRule = {\r\n name: \"email\",\r\n defaultErrorMessage: \"The :input must be a valid email address\",\r\n async validate(value: any, context) {\r\n if (isEmail(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Modern ID format validators — UUID, CUID, ULID, nanoid.\n *\n * Each rule asserts the value is a string in the canonical format for its\n * identifier scheme. Rules are intentionally strict (variant nibbles checked\n * for UUID, character classes enforced for ULID's Crockford base32, etc.)\n * so \"looks-like-but-not-valid\" inputs are rejected.\n */\n\nconst UUID_ANY = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nconst UUID_BY_VERSION: Record<1 | 3 | 4 | 5 | 6 | 7, RegExp> = {\n 1: /^[0-9a-f]{8}-[0-9a-f]{4}-1[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 3: /^[0-9a-f]{8}-[0-9a-f]{4}-3[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 4: /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 5: /^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 6: /^[0-9a-f]{8}-[0-9a-f]{4}-6[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n 7: /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n};\n\nexport type UUIDVersion = 1 | 3 | 4 | 5 | 6 | 7;\n\n/**\n * UUID rule — value must be a valid UUID. Optionally restrict to a specific version.\n *\n * @example\n * v.string().uuid() // any RFC 4122 UUID\n * v.string().uuid(4) // only v4 (random)\n * v.string().uuid(7) // only v7 (timestamp-ordered)\n */\nexport const uuidRule: SchemaRule<{ version?: UUIDVersion }> = {\n name: \"uuid\",\n defaultErrorMessage: \"The :input must be a valid UUID\",\n async validate(value, context) {\n if (typeof value !== \"string\") return invalidRule(this, context);\n\n const version = this.context.options.version;\n\n const pattern = version ? UUID_BY_VERSION[version] : UUID_ANY;\n if (pattern.test(value)) return VALID_RULE;\n\n if (version !== undefined) {\n this.context.translationParams.version = version;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * CUID rule — value must be a valid CUID.\n *\n * Defaults to CUID2 (24 chars, lowercase, starts with letter — see\n * https://github.com/paralleldrive/cuid2). Pass `{ version: 1 }` for legacy\n * CUID1 format (starts with \"c\", ≥25 chars).\n *\n * @example\n * v.string().cuid() // CUID2\n * v.string().cuid({ version: 1 }) // legacy CUID1\n */\nexport const cuidRule: SchemaRule<{ version?: 1 | 2 }> = {\n name: \"cuid\",\n defaultErrorMessage: \"The :input must be a valid CUID\",\n async validate(value, context) {\n if (typeof value !== \"string\") return invalidRule(this, context);\n const version = this.context.options.version ?? 2;\n const pattern = version === 1 ? /^c[a-z0-9]{24,}$/ : /^[a-z][a-z0-9]{23}$/;\n if (pattern.test(value)) return VALID_RULE;\n this.context.translationParams.version = version;\n return invalidRule(this, context);\n },\n};\n\n/**\n * ULID rule — value must be a valid ULID (26 chars, Crockford base32).\n *\n * Crockford base32 excludes the letters I, L, O, U to avoid ambiguity.\n *\n * @example\n * v.string().ulid()\n */\nexport const ulidRule: SchemaRule = {\n name: \"ulid\",\n defaultErrorMessage: \"The :input must be a valid ULID\",\n async validate(value, context) {\n if (typeof value !== \"string\") return invalidRule(this, context);\n if (/^[0-9A-HJKMNP-TV-Z]{26}$/.test(value)) return VALID_RULE;\n return invalidRule(this, context);\n },\n};\n\n/**\n * nanoid rule — value must be a valid nanoid string.\n *\n * Default length is 21 (standard nanoid). URL-safe alphabet:\n * A–Z, a–z, 0–9, `_`, `-`.\n *\n * @example\n * v.string().nanoid() // 21 chars (default)\n * v.string().nanoid(10) // 10 chars\n */\nexport const nanoidRule: SchemaRule<{ length?: number }> = {\n name: \"nanoid\",\n defaultErrorMessage: \"The :input must be a valid nanoid\",\n async validate(value, context) {\n if (typeof value !== \"string\") return invalidRule(this, context);\n const length = this.context.options.length ?? 21;\n const pattern = new RegExp(`^[A-Za-z0-9_-]{${length}}$`);\n if (pattern.test(value)) return VALID_RULE;\n this.context.translationParams.length = length;\n return invalidRule(this, context);\n },\n};\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Pure, dependency-free re-implementation of Node's `net.isIP`/`isIPv4`/`isIPv6`.\n * Mirrors the exact regex Node uses internally (lib/internal/net.js) so that\n * behavior stays identical while remaining runnable in the browser (no `net` import).\n */\nconst v4Seg = \"(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\";\nconst v4Str = `(${v4Seg}[.]){3}${v4Seg}`;\nconst IPv4Reg = new RegExp(`^${v4Str}$`);\n\nconst v6Seg = \"(?:[0-9a-fA-F]{1,4})\";\nconst IPv6Reg = new RegExp(\n \"^(\" +\n `(?:${v6Seg}:){7}(?:${v6Seg}|:)|` +\n `(?:${v6Seg}:){6}(?:${v4Str}|:${v6Seg}|:)|` +\n `(?:${v6Seg}:){5}(?::${v4Str}|(:${v6Seg}){1,2}|:)|` +\n `(?:${v6Seg}:){4}(?:(:${v6Seg}){0,1}:${v4Str}|(:${v6Seg}){1,3}|:)|` +\n `(?:${v6Seg}:){3}(?:(:${v6Seg}){0,2}:${v4Str}|(:${v6Seg}){1,4}|:)|` +\n `(?:${v6Seg}:){2}(?:(:${v6Seg}){0,3}:${v4Str}|(:${v6Seg}){1,5}|:)|` +\n `(?:${v6Seg}:){1}(?:(:${v6Seg}){0,4}:${v4Str}|(:${v6Seg}){1,6}|:)|` +\n `(?::((?::${v6Seg}){0,5}:${v4Str}|(?::${v6Seg}){1,7}|:))` +\n \")(%[0-9a-zA-Z-.:]{1,})?$\",\n);\n\nexport function isIPv4(value: string): boolean {\n return IPv4Reg.test(value);\n}\n\nexport function isIPv6(value: string): boolean {\n return IPv6Reg.test(value);\n}\n\n/**\n * Returns 4 or 6 when `value` is a valid IPv4/IPv6 address, otherwise 0.\n * Signature mirrors Node's `net.isIP` for drop-in behavior parity.\n */\nexport function isIP(value: string): 0 | 4 | 6 {\n if (isIPv4(value)) return 4;\n if (isIPv6(value)) return 6;\n return 0;\n}\n\n/**\n * IP rule - validates IP address (v4 or v6)\n */\nexport const ipRule: SchemaRule = {\n name: \"ip\",\n defaultErrorMessage: \"The :input must be a valid IP address\",\n async validate(value: any, context) {\n if (isIP(value)) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * IPv4 rule - validates IPv4 address\n */\nexport const ip4Rule: SchemaRule = {\n name: \"ip4\",\n defaultErrorMessage: \"The :input must be a valid IPv4 address\",\n async validate(value: any, context) {\n if (isIP(value) === 4) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * IPv6 rule - validates IPv6 address\n */\nexport const ip6Rule: SchemaRule = {\n name: \"ip6\",\n defaultErrorMessage: \"The :input must be a valid IPv6 address\",\n async validate(value: any, context) {\n if (isIP(value) === 6) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Pattern rule - validates against regex pattern\r\n */\r\nexport const patternRule: SchemaRule<{ pattern: RegExp }> = {\r\n name: \"pattern\",\r\n defaultErrorMessage: \"The :input does not match the required pattern\",\r\n async validate(value: any, context) {\r\n if (this.context.options.pattern.test(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.pattern = this.context.options.pattern.toString();\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Starts with rule\r\n */\r\nexport const startsWithRule: SchemaRule<{ value: string }> = {\r\n name: \"startsWith\",\r\n defaultErrorMessage: \"The :input must start with :value\",\r\n async validate(value: any, context) {\r\n if (String(value).startsWith(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Ends with rule\r\n */\r\nexport const endsWithRule: SchemaRule<{ value: string }> = {\r\n name: \"endsWith\",\r\n defaultErrorMessage: \"The :input must end with :value\",\r\n async validate(value: any, context) {\r\n if (String(value).endsWith(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Contains rule\r\n */\r\nexport const containsRule: SchemaRule<{ value: string }> = {\r\n name: \"contains\",\r\n defaultErrorMessage: \"The :input must contain :value\",\r\n async validate(value: any, context) {\r\n if (String(value).includes(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Not contains rule\r\n */\r\nexport const notContainsRule: SchemaRule<{ value: string }> = {\r\n name: \"notContains\",\r\n defaultErrorMessage: \"The :input must not contain :value\",\r\n async validate(value: any, context) {\r\n if (!String(value).includes(this.context.options.value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Strong Password rule - validates password strength\r\n * Requirements:\r\n * - At least 8 characters\r\n * - At least 1 uppercase letter\r\n * - At least 1 lowercase letter\r\n * - At least 1 number\r\n * - At least 1 special character\r\n */\r\nexport const strongPasswordRule: SchemaRule<{ minLength?: number }> = {\r\n name: \"strongPassword\",\r\n defaultErrorMessage:\r\n \"The :input must be at least 8 characters and contain at least one uppercase letter, one lowercase letter, one number, and one special character\",\r\n async validate(value: any, context) {\r\n const password = String(value);\r\n const minLength = this.context.options.minLength ?? 8;\r\n\r\n // Check minimum length\r\n if (password.length < minLength) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Check for at least one uppercase letter\r\n if (!/[A-Z]/.test(password)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Check for at least one lowercase letter\r\n if (!/[a-z]/.test(password)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Check for at least one number\r\n if (!/[0-9]/.test(password)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Check for at least one special character\r\n if (!/[!@#$%^&*()_+\\-=[\\]{};':\"\\\\|,.<>/?]/.test(password)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * URL rule - validates URL format\r\n */\r\nexport const urlRule: SchemaRule = {\r\n name: \"url\",\r\n defaultErrorMessage: \"The :input must be a valid URL\",\r\n async validate(value: any, context) {\r\n try {\r\n new URL(value);\r\n return VALID_RULE;\r\n } catch {\r\n return invalidRule(this, context);\r\n }\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Without whitespace rule - value must not contain whitespace\r\n */\r\nexport const withoutWhitespaceRule: SchemaRule = {\r\n name: \"withoutWhitespace\",\r\n defaultErrorMessage: \"The :input must not contain whitespace\",\r\n async validate(value: any, context) {\r\n if (!/\\s/.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Min rule - value must be equal or greater than minimum\r\n * Supports field names with sibling scope\r\n */\r\nexport const minRule: SchemaRule<{\r\n min: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"min\",\r\n defaultErrorMessage: \"The :input must be at least :min\",\r\n async validate(value: any, context) {\r\n const { min, scope = \"global\" } = this.context.options;\r\n let compareMin: number;\r\n\r\n if (typeof min === \"number\") {\r\n compareMin = min;\r\n this.context.translationParams.min = min;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, min);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.min = min;\r\n\r\n compareMin = Number(fieldValue);\r\n\r\n if (isNaN(compareMin)) {\r\n return VALID_RULE;\r\n }\r\n }\r\n\r\n if (value >= compareMin) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max rule - value must be equal or less than maximum\r\n * Supports field names with sibling scope\r\n */\r\nexport const maxRule: SchemaRule<{\r\n max: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"max\",\r\n defaultErrorMessage: \"The :input must equal to or less than :max\",\r\n async validate(value: any, context) {\r\n const { max, scope = \"global\" } = this.context.options;\r\n let compareMax: number;\r\n\r\n if (typeof max === \"number\") {\r\n compareMax = max;\r\n this.context.translationParams.max = max;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, max);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.max = max;\r\n\r\n compareMax = Number(fieldValue);\r\n\r\n if (isNaN(compareMax)) {\r\n return VALID_RULE;\r\n }\r\n }\r\n\r\n if (value <= compareMax) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Greater than rule - value must be strictly greater than minimum\r\n * Supports field names with sibling scope\r\n */\r\nexport const greaterThanRule: SchemaRule<{\r\n value: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"greaterThan\",\r\n defaultErrorMessage: \"The :input must be greater than :value\",\r\n async validate(value: any, context) {\r\n const { value: compareValue, scope = \"global\" } = this.context.options;\r\n let compareNumber: number;\r\n\r\n if (typeof compareValue === \"number\") {\r\n compareNumber = compareValue;\r\n this.context.translationParams.value = compareValue;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, compareValue);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = compareValue;\r\n\r\n compareNumber = Number(fieldValue);\r\n\r\n if (isNaN(compareNumber)) {\r\n return VALID_RULE;\r\n }\r\n }\r\n\r\n if (value > compareNumber) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Less than rule - value must be strictly less than maximum\r\n * Supports field names with sibling scope\r\n */\r\nexport const lessThanRule: SchemaRule<{\r\n value: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"lessThan\",\r\n defaultErrorMessage: \"The :input must be less than :value\",\r\n async validate(value: any, context) {\r\n const { value: compareValue, scope = \"global\" } = this.context.options;\r\n let compareNumber: number;\r\n\r\n if (typeof compareValue === \"number\") {\r\n compareNumber = compareValue;\r\n this.context.translationParams.value = compareValue;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, compareValue);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.value = compareValue;\r\n\r\n compareNumber = Number(fieldValue);\r\n\r\n if (isNaN(compareNumber)) {\r\n return VALID_RULE;\r\n }\r\n }\r\n\r\n if (value < compareNumber) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Positive rule - value must be greater than 0\r\n */\r\nexport const positiveRule: SchemaRule = {\r\n name: \"positive\",\r\n defaultErrorMessage: \"The :input must be a positive number\",\r\n async validate(value: any, context) {\r\n if (value > 0) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Negative rule - value must be less than 0\r\n */\r\nexport const negativeRule: SchemaRule = {\r\n name: \"negative\",\r\n defaultErrorMessage: \"The :input must be a negative number\",\r\n async validate(value: any, context) {\r\n if (value < 0) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Odd rule - value must be an odd number\r\n */\r\nexport const oddRule: SchemaRule = {\r\n name: \"odd\",\r\n defaultErrorMessage: \"The :input must be an odd number\",\r\n async validate(value: any, context) {\r\n if (value % 2 !== 0) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Even rule - value must be an even number\r\n */\r\nexport const evenRule: SchemaRule = {\r\n name: \"even\",\r\n defaultErrorMessage: \"The :input must be an even number\",\r\n async validate(value: any, context) {\r\n if (value % 2 === 0) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Modulo rule - value must be divisible by given number\r\n */\r\nexport const moduloRule: SchemaRule<{ value: number }> = {\r\n name: \"modulo\",\r\n defaultErrorMessage: \"The :input must be divisible by :value\",\r\n async validate(value: any, context) {\r\n if (value % this.context.options.value === 0) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.value = this.context.options.value;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between rule - value must be between the given two numbers (Inclusive)\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenNumbersRule: SchemaRule<{\r\n min: number | string;\r\n max: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenNumbers\",\r\n defaultErrorMessage: \"The :input must be between :min and :max\",\r\n async validate(value: any, context) {\r\n const { min, max, scope = \"global\" } = this.context.options;\r\n\r\n // Extract min value\r\n let compareMin: number;\r\n if (typeof min === \"number\") {\r\n compareMin = min;\r\n this.context.translationParams.min = min;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, min);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.min = min;\r\n\r\n compareMin = Number(fieldValue);\r\n if (isNaN(compareMin)) {\r\n return VALID_RULE;\r\n }\r\n }\r\n\r\n // Extract max value\r\n let compareMax: number;\r\n if (typeof max === \"number\") {\r\n compareMax = max;\r\n this.context.translationParams.max = max;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, max);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.max = max;\r\n\r\n compareMax = Number(fieldValue);\r\n if (isNaN(compareMax)) {\r\n return VALID_RULE;\r\n }\r\n }\r\n\r\n if (value >= compareMin && value <= compareMax) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Min length rule - validates minimum length\r\n * Works for any value with a length property (strings, arrays, etc.)\r\n */\r\nexport const minLengthRule: SchemaRule<{ minLength: number }> = {\r\n name: \"minLength\",\r\n defaultErrorMessage: \"The :input must be at least :minLength characters long\",\r\n async validate(value: any, context) {\r\n const length = typeof value?.length === \"number\" ? value.length : String(value || \"\").length;\r\n\r\n if (length >= this.context.options.minLength) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minLength = this.context.options.minLength;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max length rule - validates maximum length\r\n * Works for any value with a length property (strings, arrays, etc.)\r\n */\r\nexport const maxLengthRule: SchemaRule<{ maxLength: number }> = {\r\n name: \"maxLength\",\r\n defaultErrorMessage: \"The :input must not exceed :maxLength characters\",\r\n async validate(value: any, context) {\r\n const length = typeof value?.length === \"number\" ? value.length : String(value || \"\").length;\r\n\r\n if (length <= this.context.options.maxLength) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.maxLength = this.context.options.maxLength;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between length rule - validates length is between min and max (inclusive)\r\n * Works for any value with a length property (strings, arrays, etc.)\r\n */\r\nexport const betweenLengthRule: SchemaRule<{\r\n minLength: number;\r\n maxLength: number;\r\n}> = {\r\n name: \"betweenLength\",\r\n defaultErrorMessage: \"The :input must be between :minLength and :maxLength characters long\",\r\n async validate(value: any, context) {\r\n const length = typeof value?.length === \"number\" ? value.length : String(value || \"\").length;\r\n\r\n if (length >= this.context.options.minLength && length <= this.context.options.maxLength) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minLength = this.context.options.minLength;\r\n this.context.translationParams.maxLength = this.context.options.maxLength;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Length rule - validates exact length\r\n * Works for any value with a length property (strings, arrays, etc.)\r\n */\r\nexport const lengthRule: SchemaRule<{ length: number }> = {\r\n name: \"length\",\r\n defaultErrorMessage: \"The :input must be exactly :length characters long\",\r\n async validate(value: any, context) {\r\n const length = typeof value?.length === \"number\" ? value.length : String(value || \"\").length;\r\n\r\n if (length === this.context.options.length) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.length = this.context.options.length;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min words rule - validates minimum word count\r\n */\r\nexport const minWordsRule: SchemaRule<{ minWords: number }> = {\r\n name: \"minWords\",\r\n defaultErrorMessage: \"The :input must be at least :minWords words\",\r\n async validate(value: any, context) {\r\n if (String(value || \"\").split(\" \").length >= this.context.options.minWords) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minWords = this.context.options.minWords;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max words rule - validates maximum word count\r\n */\r\nexport const maxWordsRule: SchemaRule<{ maxWords: number }> = {\r\n name: \"maxWords\",\r\n defaultErrorMessage: \"The :input must be at most :maxWords words\",\r\n async validate(value: any, context) {\r\n if (String(value || \"\").split(\" \").length <= this.context.options.maxWords) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.maxWords = this.context.options.maxWords;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Words rule - validates exact word count\r\n */\r\nexport const wordsRule: SchemaRule<{ words: number }> = {\r\n name: \"words\",\r\n defaultErrorMessage: \"The :input must be exactly :words words\",\r\n async validate(value: any, context) {\r\n if (String(value || \"\").split(\" \").length === this.context.options.words) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.words = this.context.options.words;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Unique array rule - array must contain unique values\r\n */\r\nexport const uniqueArrayRule: SchemaRule = {\r\n name: \"uniqueArray\",\r\n description: \"The array must contain unique values\",\r\n defaultErrorMessage: \"The :input must contain unique values\",\r\n async validate(value: any, context) {\r\n const uniqueValues = new Set(value);\r\n\r\n if (uniqueValues.size === value.length) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Sorted array rule - array must be sorted\r\n */\r\nexport const sortedArrayRule: SchemaRule<{\r\n direction?: \"asc\" | \"desc\";\r\n}> = {\r\n name: \"sortedArray\",\r\n description: \"The array must be sorted\",\r\n defaultErrorMessage: \"The :input must be sorted\",\r\n async validate(value: any[], context) {\r\n if (!Array.isArray(value) || value.length <= 1) {\r\n return VALID_RULE;\r\n }\r\n\r\n const direction = this.context.options.direction ?? \"asc\";\r\n this.context.translatableParams.direction = direction;\r\n\r\n for (let i = 0; i < value.length - 1; i++) {\r\n const current = value[i];\r\n const next = value[i + 1];\r\n\r\n if (direction === \"asc\") {\r\n if (current > next) {\r\n return invalidRule(this, context);\r\n }\r\n } else {\r\n if (current < next) {\r\n return invalidRule(this, context);\r\n }\r\n }\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","/**\r\n * Week day names for validation\r\n */\r\nexport type WeekDay =\r\n | \"sunday\"\r\n | \"monday\"\r\n | \"tuesday\"\r\n | \"wednesday\"\r\n | \"thursday\"\r\n | \"friday\"\r\n | \"saturday\";\r\n\r\n/**\r\n * Week day numbers mapping\r\n */\r\nexport const WEEK_DAYS: Record<WeekDay, number> = {\r\n sunday: 0,\r\n monday: 1,\r\n tuesday: 2,\r\n wednesday: 3,\r\n thursday: 4,\r\n friday: 5,\r\n saturday: 6,\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isDateValue } from \"../../helpers/date-helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport type { WeekDay } from \"../../types/date-types\";\r\nimport { WEEK_DAYS } from \"../../types/date-types\";\r\n\r\n/**\r\n * Date rule - validates date format\r\n */\r\nexport const dateRule: SchemaRule = {\r\n name: \"date\",\r\n defaultErrorMessage: \"The :input must be a valid date\",\r\n async validate(value: any, context) {\r\n if (value instanceof Date && !isNaN(value.getTime())) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min date rule - date must be >= given date or field\r\n * Smart detection: date value or field name\r\n */\r\nexport const minDateRule: SchemaRule<{\r\n dateOrField: Date | string | number;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minDate\",\r\n description: \"The field must be at least the given date or field\",\r\n defaultErrorMessage: \"The :input must be at least :dateOrField\",\r\n async validate(value: Date, context) {\r\n const { dateOrField, scope = \"global\" } = this.context.options;\r\n let compareDate: Date;\r\n\r\n if (isDateValue(dateOrField)) {\r\n // Value comparison\r\n compareDate = new Date(dateOrField);\r\n } else {\r\n // Field comparison\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dateOrField as string);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n compareDate = new Date(fieldValue);\r\n }\r\n\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate >= compareDate) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max date rule - date must be <= given date or field\r\n * Smart detection: date value or field name\r\n */\r\nexport const maxDateRule: SchemaRule<{\r\n dateOrField: Date | string | number;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxDate\",\r\n defaultErrorMessage: \"The :input must be at most :dateOrField\",\r\n async validate(value: Date, context) {\r\n const { dateOrField, scope = \"global\" } = this.context.options;\r\n let compareDate: Date;\r\n\r\n if (isDateValue(dateOrField)) {\r\n // Value comparison\r\n compareDate = new Date(dateOrField);\r\n } else {\r\n // Field comparison\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dateOrField as string);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n compareDate = new Date(fieldValue);\r\n }\r\n\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate <= compareDate) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * From today rule - date must be today or in the future\r\n */\r\nexport const fromTodayRule: SchemaRule = {\r\n name: \"fromToday\",\r\n defaultErrorMessage: \"The :input must be today or in the future\",\r\n async validate(value: Date, context) {\r\n const today = new Date();\r\n today.setHours(0, 0, 0, 0);\r\n const inputDate = new Date(value);\r\n inputDate.setHours(0, 0, 0, 0);\r\n\r\n if (inputDate >= today) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Before today rule - date must be before today\r\n */\r\nexport const beforeTodayRule: SchemaRule = {\r\n name: \"beforeToday\",\r\n defaultErrorMessage: \"The :input must be before today\",\r\n async validate(value: Date, context) {\r\n const today = new Date();\r\n today.setHours(0, 0, 0, 0);\r\n const inputDate = new Date(value);\r\n inputDate.setHours(0, 0, 0, 0);\r\n\r\n if (inputDate < today) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * From hour rule - time must be from specific hour onwards\r\n */\r\nexport const fromHourRule: SchemaRule<{ hour: number }> = {\r\n name: \"fromHour\",\r\n defaultErrorMessage: \"The :input must be from :hour:00 onwards\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const hour = inputDate.getHours();\r\n\r\n if (hour >= this.context.options.hour) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.hour = this.context.options.hour;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Before hour rule - time must be before specific hour\r\n */\r\nexport const beforeHourRule: SchemaRule<{ hour: number }> = {\r\n name: \"beforeHour\",\r\n defaultErrorMessage: \"The :input must be before :hour:00\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const hour = inputDate.getHours();\r\n\r\n if (hour < this.context.options.hour) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.hour = this.context.options.hour;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between hours rule - time must be between start and end hours\r\n */\r\nexport const betweenHoursRule: SchemaRule<{\r\n startHour: number;\r\n endHour: number;\r\n}> = {\r\n name: \"betweenHours\",\r\n defaultErrorMessage: \"The :input must be between :startHour:00 and :endHour:00\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const hour = inputDate.getHours();\r\n const { startHour, endHour } = this.context.options;\r\n\r\n if (hour >= startHour && hour <= endHour) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startHour = startHour;\r\n this.context.translationParams.endHour = endHour;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * From minute rule - time must be from specific minute onwards\r\n */\r\nexport const fromMinuteRule: SchemaRule<{ minute: number }> = {\r\n name: \"fromMinute\",\r\n defaultErrorMessage: \"The :input must be from minute :minute onwards\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const minute = inputDate.getMinutes();\r\n\r\n if (minute >= this.context.options.minute) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minute = this.context.options.minute;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Before minute rule - time must be before specific minute\r\n */\r\nexport const beforeMinuteRule: SchemaRule<{ minute: number }> = {\r\n name: \"beforeMinute\",\r\n defaultErrorMessage: \"The :input must be before minute :minute\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const minute = inputDate.getMinutes();\r\n\r\n if (minute < this.context.options.minute) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minute = this.context.options.minute;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between minutes rule - time must be between start and end minutes\r\n */\r\nexport const betweenMinutesRule: SchemaRule<{\r\n startMinute: number;\r\n endMinute: number;\r\n}> = {\r\n name: \"betweenMinutes\",\r\n defaultErrorMessage: \"The :input must be between minute :startMinute and :endMinute\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const minute = inputDate.getMinutes();\r\n const { startMinute, endMinute } = this.context.options;\r\n\r\n if (minute >= startMinute && minute <= endMinute) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startMinute = startMinute;\r\n this.context.translationParams.endMinute = endMinute;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Age rule - calculate age from date\r\n */\r\nexport const ageRule: SchemaRule<{ years: number }> = {\r\n name: \"age\",\r\n defaultErrorMessage: \"The :input must be exactly :years years old\",\r\n async validate(value: Date, context) {\r\n const birthDate = new Date(value);\r\n const today = new Date();\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n if (age === this.context.options.years) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.years = this.context.options.years;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min age rule - minimum age requirement\r\n */\r\nexport const minAgeRule: SchemaRule<{ years: number }> = {\r\n name: \"minAge\",\r\n defaultErrorMessage: \"The :input must be at least :years years old\",\r\n async validate(value: Date, context) {\r\n const birthDate = new Date(value);\r\n const today = new Date();\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n if (age >= this.context.options.years) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.years = this.context.options.years;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max age rule - maximum age requirement\r\n */\r\nexport const maxAgeRule: SchemaRule<{ years: number }> = {\r\n name: \"maxAge\",\r\n defaultErrorMessage: \"The :input must be at most :years years old\",\r\n async validate(value: Date, context) {\r\n const birthDate = new Date(value);\r\n const today = new Date();\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n if (age <= this.context.options.years) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.years = this.context.options.years;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Week day rule - date must be specific weekday\r\n */\r\nexport const weekDayRule: SchemaRule<{ day: WeekDay }> = {\r\n name: \"weekDay\",\r\n defaultErrorMessage: \"The :input must be a :day\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n const expectedDay = WEEK_DAYS[this.context.options.day];\r\n\r\n if (dayOfWeek === expectedDay) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.day = this.context.options.day;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Between dates rule - date must be between start and end dates\r\n */\r\nexport const betweenDatesRule: SchemaRule<{\r\n startDate: Date;\r\n endDate: Date;\r\n}> = {\r\n name: \"betweenDates\",\r\n defaultErrorMessage: \"The :input must be between :startDate and :endDate\",\r\n async validate(value: Date, context) {\r\n const { startDate, endDate } = this.context.options;\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate >= startDate && inputDate <= endDate) {\r\n this.context.translationParams.startDate = startDate.toISOString();\r\n this.context.translationParams.endDate = endDate.toISOString();\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Today rule - date must be exactly today\r\n */\r\nexport const todayRule: SchemaRule = {\r\n name: \"today\",\r\n defaultErrorMessage: \"The :input must be today\",\r\n async validate(value: Date, context) {\r\n const today = new Date();\r\n today.setHours(0, 0, 0, 0);\r\n const inputDate = new Date(value);\r\n inputDate.setHours(0, 0, 0, 0);\r\n\r\n if (inputDate.getTime() === today.getTime()) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Past rule - date must be in the past\r\n */\r\nexport const pastRule: SchemaRule = {\r\n name: \"past\",\r\n defaultErrorMessage: \"The :input must be in the past\",\r\n async validate(value: Date, context) {\r\n const now = new Date();\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate < now) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Future rule - date must be in the future\r\n */\r\nexport const futureRule: SchemaRule = {\r\n name: \"future\",\r\n defaultErrorMessage: \"The :input must be in the future\",\r\n async validate(value: Date, context) {\r\n const now = new Date();\r\n\r\n if (value > now) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * After today rule - date must be after today (not including today)\r\n */\r\nexport const afterTodayRule: SchemaRule = {\r\n name: \"afterToday\",\r\n defaultErrorMessage: \"The :input must be after today\",\r\n async validate(value: Date, context) {\r\n const today = new Date();\r\n today.setHours(0, 0, 0, 0);\r\n const inputDate = new Date(value);\r\n inputDate.setHours(0, 0, 0, 0);\r\n\r\n if (inputDate > today) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport type { WeekDay } from \"../../types/date-types\";\r\nimport { WEEK_DAYS } from \"../../types/date-types\";\r\n\r\n/**\r\n * Weekend rule - date must be Saturday or Sunday\r\n */\r\nexport const weekendRule: SchemaRule = {\r\n name: \"weekend\",\r\n defaultErrorMessage: \"The :input must be a weekend (Saturday or Sunday)\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n\r\n // 0 = Sunday, 6 = Saturday\r\n if (dayOfWeek === 0 || dayOfWeek === 6) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Weekday rule - date must be Monday through Friday\r\n */\r\nexport const weekdayRule: SchemaRule = {\r\n name: \"weekday\",\r\n defaultErrorMessage: \"The :input must be a weekday (Monday-Friday)\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n\r\n // 1-5 = Monday-Friday\r\n if (dayOfWeek >= 1 && dayOfWeek <= 5) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Weekdays rule - date must be one of specified weekdays\r\n */\r\nexport const weekdaysRule: SchemaRule<{ days: WeekDay[] }> = {\r\n name: \"weekdays\",\r\n defaultErrorMessage: \"The :input must be one of: :days\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n const { days } = this.context.options;\r\n\r\n const allowedDays = days.map((day) => WEEK_DAYS[day]);\r\n\r\n if (allowedDays.includes(dayOfWeek)) {\r\n return VALID_RULE;\r\n }\r\n\r\n days.forEach((day) => {\r\n this.context.translatableParams[day] = day;\r\n });\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Business day rule - date must be Monday-Friday (no weekends)\r\n */\r\nexport const businessDayRule: SchemaRule = {\r\n name: \"businessDay\",\r\n defaultErrorMessage: \"The :input must be a business day\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n\r\n // 1-5 = Monday-Friday\r\n if (dayOfWeek >= 1 && dayOfWeek <= 5) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isDateValue } from \"../../helpers/date-helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Before field rule - date must be < given date or field\r\n * Smart detection: date value or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const beforeFieldRule: SchemaRule<{\r\n dateOrField: Date | string | number;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"beforeField\",\r\n description: \"The date must be before the given date or field\",\r\n defaultErrorMessage: \"The :input must be before :dateOrField\",\r\n async validate(value: Date, context) {\r\n const { dateOrField, scope = \"global\" } = this.context.options;\r\n let compareDate: Date;\r\n\r\n if (isDateValue(dateOrField)) {\r\n // Value comparison\r\n compareDate = new Date(dateOrField);\r\n } else {\r\n // Field comparison\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dateOrField as string);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n compareDate = new Date(fieldValue);\r\n }\r\n\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate < compareDate) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * After field rule - date must be > given date or field\r\n * Smart detection: date value or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const afterFieldRule: SchemaRule<{\r\n dateOrField: Date | string | number;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"afterField\",\r\n description: \"The date must be after the given date or field\",\r\n defaultErrorMessage: \"The :input must be after :dateOrField\",\r\n async validate(value: Date, context) {\r\n const { dateOrField, scope = \"global\" } = this.context.options;\r\n let compareDate: Date;\r\n\r\n if (isDateValue(dateOrField)) {\r\n // Value comparison\r\n compareDate = new Date(dateOrField);\r\n this.context.translationParams.dateOrField = compareDate.toISOString();\r\n } else {\r\n // Field comparison\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dateOrField as string);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n compareDate = new Date(fieldValue);\r\n this.context.translatableParams.dateOrField = fieldValue;\r\n }\r\n\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate > compareDate) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Same as field rule - date must be the same as another field's date\r\n * Supports both global and sibling scope\r\n */\r\nexport const sameAsFieldDateRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"sameAsFieldDate\",\r\n description: \"The date must be the same as another field's date\",\r\n defaultErrorMessage: \"The :input must be the same as :field\",\r\n async validate(value: Date, context) {\r\n const { field, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, field);\r\n\r\n // Both fields must exist to be considered \"the same\"\r\n if (fieldValue === undefined || value === undefined) {\r\n this.context.translatableParams.field = fieldValue;\r\n return invalidRule(this, context);\r\n }\r\n\r\n const inputDate = new Date(value);\r\n inputDate.setHours(0, 0, 0, 0);\r\n const compareDate = new Date(fieldValue);\r\n compareDate.setHours(0, 0, 0, 0);\r\n\r\n if (inputDate.getTime() === compareDate.getTime()) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.field = fieldValue;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\nconst MONTHS = {\r\n 1: \"january\",\r\n 2: \"february\",\r\n 3: \"march\",\r\n 4: \"april\",\r\n 5: \"may\",\r\n 6: \"june\",\r\n 7: \"july\",\r\n 8: \"august\",\r\n 9: \"september\",\r\n 10: \"october\",\r\n 11: \"november\",\r\n 12: \"december\",\r\n};\r\n\r\nexport type Month = keyof typeof MONTHS;\r\n\r\n/**\r\n * Month rule - date must be in specific month (1-12)\r\n */\r\nexport const monthRule: SchemaRule<{ month: Month }> = {\r\n name: \"month\",\r\n defaultErrorMessage: \"The :input must be in month :month\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const month = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n if (month === this.context.options.month) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.month =\r\n MONTHS[this.context.options.month as keyof typeof MONTHS];\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Year rule - date must be in specific year\r\n */\r\nexport const yearRule: SchemaRule<{ year: number }> = {\r\n name: \"year\",\r\n defaultErrorMessage: \"The :input must be in year :year\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const year = inputDate.getFullYear();\r\n\r\n if (year === this.context.options.year) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.year = this.context.options.year;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between years rule - date must be between start and end years\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenYearsRule: SchemaRule<{\r\n startYear: number | string;\r\n endYear: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenYears\",\r\n defaultErrorMessage: \"The :input must be between :startYear and :endYear\",\r\n async validate(value: Date, context) {\r\n const { startYear, endYear, scope = \"global\" } = this.context.options;\r\n const inputDate = new Date(value);\r\n const inputYear = inputDate.getFullYear();\r\n\r\n // Extract start year\r\n let compareStartYear: number;\r\n if (typeof startYear === \"number\") {\r\n compareStartYear = startYear;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, startYear);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareStartYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareStartYear = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareStartYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n // Extract end year\r\n let compareEndYear: number;\r\n if (typeof endYear === \"number\") {\r\n compareEndYear = endYear;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, endYear);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareEndYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareEndYear = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareEndYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n if (inputYear >= compareStartYear && inputYear <= compareEndYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startYear = compareStartYear;\r\n this.context.translationParams.endYear = compareEndYear;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between months rule - date must be between start and end months (1-12)\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenMonthsRule: SchemaRule<{\r\n startMonth: Month | string;\r\n endMonth: Month | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenMonths\",\r\n defaultErrorMessage: \"The :input must be between month :startMonth and :endMonth\",\r\n async validate(value: Date, context) {\r\n const { startMonth, endMonth, scope = \"global\" } = this.context.options;\r\n const inputDate = new Date(value);\r\n const inputMonth = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n // Extract start month\r\n let compareStartMonth: number;\r\n if (typeof startMonth === \"number\") {\r\n compareStartMonth = startMonth;\r\n this.context.translatableParams.startMonth = MONTHS[compareStartMonth as keyof typeof MONTHS];\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, startMonth);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.startMonth = startMonth;\r\n\r\n if (fieldValue instanceof Date) {\r\n compareStartMonth = fieldValue.getMonth() + 1;\r\n } else if (typeof fieldValue === \"number\") {\r\n compareStartMonth = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareStartMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n // Extract end month\r\n let compareEndMonth: number;\r\n if (typeof endMonth === \"number\") {\r\n compareEndMonth = endMonth;\r\n this.context.translatableParams.endMonth = MONTHS[compareEndMonth as keyof typeof MONTHS];\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, endMonth);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.endMonth = endMonth;\r\n\r\n if (fieldValue instanceof Date) {\r\n compareEndMonth = fieldValue.getMonth() + 1;\r\n } else if (typeof fieldValue === \"number\") {\r\n compareEndMonth = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareEndMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n if (inputMonth >= compareStartMonth && inputMonth <= compareEndMonth) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between days rule - date must be between start and end days (1-31)\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenDaysRule: SchemaRule<{\r\n startDay: number | string;\r\n endDay: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenDays\",\r\n defaultErrorMessage: \"The :input must be between day :startDay and :endDay\",\r\n async validate(value: Date, context) {\r\n const { startDay, endDay, scope = \"global\" } = this.context.options;\r\n const inputDate = new Date(value);\r\n const inputDay = inputDate.getDate();\r\n\r\n // Extract start day\r\n let compareStartDay: number;\r\n if (typeof startDay === \"number\") {\r\n compareStartDay = startDay;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, startDay);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareStartDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareStartDay = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareStartDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n // Extract end day\r\n let compareEndDay: number;\r\n if (typeof endDay === \"number\") {\r\n compareEndDay = endDay;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, endDay);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareEndDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareEndDay = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareEndDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n if (inputDay >= compareStartDay && inputDay <= compareEndDay) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startDay = compareStartDay;\r\n this.context.translationParams.endDay = compareEndDay;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Quarter rule - date must be in specific quarter (1-4)\r\n */\r\nexport const quarterRule: SchemaRule<{ quarter: 1 | 2 | 3 | 4 }> = {\r\n name: \"quarter\",\r\n defaultErrorMessage: \"The :input must be in quarter :quarter\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const month = inputDate.getMonth() + 1;\r\n const quarter = Math.ceil(month / 3);\r\n\r\n if (quarter === this.context.options.quarter) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.quarter = this.context.options.quarter;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between times rule - time must be between start and end times (HH:MM format)\r\n */\r\nexport const betweenTimesRule: SchemaRule<{\r\n startTime: string;\r\n endTime: string;\r\n}> = {\r\n name: \"betweenTimes\",\r\n defaultErrorMessage: \"The :input must be between :startTime and :endTime\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const inputHour = inputDate.getHours();\r\n const inputMinute = inputDate.getMinutes();\r\n const inputTimeInMinutes = inputHour * 60 + inputMinute;\r\n\r\n const { startTime, endTime } = this.context.options;\r\n\r\n // Parse start time\r\n const [startHour, startMinute] = startTime.split(\":\").map(Number);\r\n const startTimeInMinutes = startHour * 60 + startMinute;\r\n\r\n // Parse end time\r\n const [endHour, endMinute] = endTime.split(\":\").map(Number);\r\n const endTimeInMinutes = endHour * 60 + endMinute;\r\n\r\n if (inputTimeInMinutes >= startTimeInMinutes && inputTimeInMinutes <= endTimeInMinutes) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startTime = startTime;\r\n this.context.translationParams.endTime = endTime;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min year rule - year must be >= given year or field\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const minYearRule: SchemaRule<{\r\n yearOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minYear\",\r\n description: \"The date year must be at least the given year or field\",\r\n defaultErrorMessage: \"The :input year must be higher than :yearOrField\",\r\n async validate(value: Date, context) {\r\n const { yearOrField, scope = \"global\" } = this.context.options;\r\n let compareYear: number;\r\n\r\n if (typeof yearOrField === \"number\") {\r\n compareYear = yearOrField;\r\n this.context.translationParams.yearOrField = yearOrField;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, yearOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.yearOrField = yearOrField;\r\n\r\n // If field contains a date, extract the year\r\n if (fieldValue instanceof Date) {\r\n compareYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareYear = fieldValue;\r\n } else {\r\n // Try to parse as date and extract year\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputYear = inputDate.getFullYear();\r\n\r\n if (inputYear >= compareYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max year rule - year must be <= given year or field\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const maxYearRule: SchemaRule<{\r\n yearOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxYear\",\r\n description: \"The date year must be at most the given year or field\",\r\n defaultErrorMessage: \"The :input year must be at most :yearOrField\",\r\n async validate(value: Date, context) {\r\n const { yearOrField, scope = \"global\" } = this.context.options;\r\n let compareYear: number;\r\n\r\n if (typeof yearOrField === \"number\") {\r\n compareYear = yearOrField;\r\n this.context.translationParams.yearOrField = compareYear;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, yearOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.yearOrField = yearOrField;\r\n\r\n // If field contains a date, extract the year\r\n if (fieldValue instanceof Date) {\r\n compareYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareYear = fieldValue;\r\n } else {\r\n // Try to parse as date and extract year\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputYear = inputDate.getFullYear();\r\n\r\n if (inputYear <= compareYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min month rule - month must be >= given month or field (1-12)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const minMonthRule: SchemaRule<{\r\n monthOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minMonth\",\r\n description: \"The date month must be at least the given month or field\",\r\n defaultErrorMessage: \"The :input month must be at least :monthOrField\",\r\n async validate(value: Date, context) {\r\n const { monthOrField, scope = \"global\" } = this.context.options;\r\n let compareMonth: number;\r\n\r\n if (typeof monthOrField === \"number\") {\r\n compareMonth = monthOrField;\r\n this.context.translationParams.monthOrField = compareMonth;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, monthOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.monthOrField = monthOrField;\r\n\r\n // If field contains a date, extract the month\r\n if (fieldValue instanceof Date) {\r\n compareMonth = fieldValue.getMonth() + 1; // getMonth() returns 0-11\r\n } else if (typeof fieldValue === \"number\") {\r\n compareMonth = fieldValue;\r\n } else {\r\n // Try to parse as date and extract month\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputMonth = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n if (inputMonth >= compareMonth) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max month rule - month must be <= given month or field (1-12)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const maxMonthRule: SchemaRule<{\r\n monthOrField: Month | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxMonth\",\r\n description: \"The date month must be at most the given month or field\",\r\n defaultErrorMessage: \"The :input month must be at most :monthOrField\",\r\n async validate(value: Date, context) {\r\n const { monthOrField, scope = \"global\" } = this.context.options;\r\n let compareMonth: number;\r\n\r\n if (typeof monthOrField === \"number\") {\r\n compareMonth = monthOrField;\r\n this.context.translatableParams.monthOrField = MONTHS[monthOrField];\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, monthOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.monthOrField = monthOrField;\r\n\r\n // If field contains a date, extract the month\r\n if (fieldValue instanceof Date) {\r\n compareMonth = fieldValue.getMonth() + 1; // getMonth() returns 0-11\r\n } else if (typeof fieldValue === \"number\") {\r\n compareMonth = fieldValue;\r\n } else {\r\n // Try to parse as date and extract month\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputMonth = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n if (inputMonth <= compareMonth) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min day rule - day must be >= given day or field (1-31)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const minDayRule: SchemaRule<{\r\n dayOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minDay\",\r\n description: \"The date day must be at least the given day or field\",\r\n defaultErrorMessage: \"The :input day must be higher than :dayOrField\",\r\n async validate(value: Date, context) {\r\n const { dayOrField, scope = \"global\" } = this.context.options;\r\n let compareDay: number;\r\n\r\n if (typeof dayOrField === \"number\") {\r\n compareDay = dayOrField;\r\n this.context.translationParams.dayOrField = dayOrField;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dayOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.dayOrField = dayOrField;\r\n\r\n // If field contains a date, extract the day\r\n if (fieldValue instanceof Date) {\r\n compareDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareDay = fieldValue;\r\n } else {\r\n // Try to parse as date and extract day\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputDay = inputDate.getDate();\r\n\r\n if (inputDay >= compareDay) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max day rule - day must be <= given day or field (1-31)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const maxDayRule: SchemaRule<{\r\n dayOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxDay\",\r\n description: \"The date day must be at most the given day or field\",\r\n defaultErrorMessage: \"The :input day must be at most :dayOrField\",\r\n async validate(value: Date, context) {\r\n const { dayOrField, scope = \"global\" } = this.context.options;\r\n let compareDay: number;\r\n\r\n if (typeof dayOrField === \"number\") {\r\n compareDay = dayOrField;\r\n this.context.translationParams.dayOrField = dayOrField;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dayOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.dayOrField = dayOrField;\r\n\r\n // If field contains a date, extract the day\r\n if (fieldValue instanceof Date) {\r\n compareDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareDay = fieldValue;\r\n } else {\r\n // Try to parse as date and extract day\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputDay = inputDate.getDate();\r\n\r\n if (inputDay <= compareDay) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Within days rule - date must be within X days from now (past or future)\r\n */\r\nexport const withinDaysRule: SchemaRule<{ days: number }> = {\r\n name: \"withinDays\",\r\n defaultErrorMessage: \"The :input must be within :days days from now\",\r\n async validate(value: Date, context) {\r\n const now = new Date();\r\n const inputDate = new Date(value);\r\n const diffTime = Math.abs(inputDate.getTime() - now.getTime());\r\n const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));\r\n\r\n if (diffDays <= this.context.options.days) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.days = this.context.options.days;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Within past days rule - date must be within X days in the past\r\n */\r\nexport const withinPastDaysRule: SchemaRule<{ days: number }> = {\r\n name: \"withinPastDays\",\r\n defaultErrorMessage: \"The :input must be within the past :days days\",\r\n async validate(value: Date, context) {\r\n const now = new Date();\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate > now) {\r\n return invalidRule(this, context); // Must be in past\r\n }\r\n\r\n const diffTime = now.getTime() - inputDate.getTime();\r\n const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));\r\n\r\n if (diffDays <= this.context.options.days) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.days = this.context.options.days;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Within future days rule - date must be within X days in the future\r\n */\r\nexport const withinFutureDaysRule: SchemaRule<{ days: number }> = {\r\n name: \"withinFutureDays\",\r\n defaultErrorMessage: \"The :input must be within the next :days days\",\r\n async validate(value: Date, context) {\r\n const now = new Date();\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate < now) {\r\n return invalidRule(this, context); // Must be in future\r\n }\r\n\r\n const diffTime = inputDate.getTime() - now.getTime();\r\n const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));\r\n\r\n if (diffDays <= this.context.options.days) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.days = this.context.options.days;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Birthday rule - valid birthday (not in future, reasonable age)\r\n */\r\nexport const birthdayRule: SchemaRule<{ minAge?: number; maxAge?: number }> = {\r\n name: \"birthday\",\r\n defaultErrorMessage: \"The :input must be a valid birthday\",\r\n async validate(birthDate: Date, context) {\r\n const today = new Date();\r\n\r\n // Must not be in the future\r\n if (birthDate > today) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Calculate age\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n // Check minimum age (default: 0)\r\n const minAge = this.context.options.minAge ?? 0;\r\n if (age < minAge) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Check maximum age (default: 150)\r\n const maxAge = this.context.options.maxAge ?? 150;\r\n if (age > maxAge) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Between age rule - age must be between min and max years\r\n */\r\nexport const betweenAgeRule: SchemaRule<{ minAge: number; maxAge: number }> = {\r\n name: \"betweenAge\",\r\n defaultErrorMessage: \"Age must be between :minAge and :maxAge years\",\r\n async validate(value: Date, context) {\r\n const birthDate = new Date(value);\r\n const today = new Date();\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n const { minAge, maxAge } = this.context.options;\r\n\r\n if (age >= minAge && age <= maxAge) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minAge = minAge;\r\n this.context.translationParams.maxAge = maxAge;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Leap year rule - date must be in a leap year\r\n */\r\nexport const leapYearRule: SchemaRule = {\r\n name: \"leapYear\",\r\n defaultErrorMessage: \"The :input must be in a leap year\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const year = inputDate.getFullYear();\r\n\r\n // Leap year logic: divisible by 4, except century years unless divisible by 400\r\n const isLeapYear = (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\r\n\r\n if (isLeapYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Color validation regex patterns\r\n */\r\nconst colorValidationRegex = {\r\n hex: /^#([0-9a-f]{3}){1,2}$/i,\r\n rgb: /^rgb\\((\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d{1,3})\\)$/,\r\n rgba: /^rgba\\((\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d{1,3}),\\s*(0?\\.\\d+|1)\\)$/,\r\n hsl: /^hsl\\((\\d{1,3}),\\s*(\\d{1,3})%?,\\s*(\\d{1,3})%?\\)$/,\r\n};\r\n\r\n/**\r\n * Generic color rule - validates any color format\r\n */\r\nexport const colorRule: SchemaRule = {\r\n name: \"color\",\r\n defaultErrorMessage: \"The :input must be a valid color\",\r\n async validate(value: any, context) {\r\n const isValidColor =\r\n colorValidationRegex.hex.test(value) ||\r\n colorValidationRegex.rgb.test(value) ||\r\n colorValidationRegex.rgba.test(value) ||\r\n colorValidationRegex.hsl.test(value);\r\n\r\n if (isValidColor) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Hex color rule\r\n */\r\nexport const hexColorRule: SchemaRule = {\r\n name: \"hexColor\",\r\n defaultErrorMessage: \"The :input must be a valid hex color\",\r\n async validate(value: any, context) {\r\n if (colorValidationRegex.hex.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * RGB color rule\r\n */\r\nexport const rgbColorRule: SchemaRule = {\r\n name: \"rgbColor\",\r\n defaultErrorMessage: \"The :input must be a valid RGB color\",\r\n async validate(value: any, context) {\r\n if (colorValidationRegex.rgb.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * RGBA color rule\r\n */\r\nexport const rgbaColorRule: SchemaRule = {\r\n name: \"rgbaColor\",\r\n defaultErrorMessage: \"The :input must be a valid RGBA color\",\r\n async validate(value: any, context) {\r\n if (colorValidationRegex.rgba.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * HSL color rule\r\n */\r\nexport const hslColorRule: SchemaRule = {\r\n name: \"hslColor\",\r\n defaultErrorMessage: \"The :input must be a valid HSL color\",\r\n async validate(value: any, context) {\r\n if (colorValidationRegex.hsl.test(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Light color rule\r\n */\r\nexport const lightColorRule: SchemaRule = {\r\n name: \"lightColor\",\r\n defaultErrorMessage: \"The :input must be a light color\",\r\n async validate(value: any, context) {\r\n if (!colorValidationRegex.hex.test(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n const hex = value.replace(\"#\", \"\");\r\n const r = parseInt(hex.substring(0, 2), 16);\r\n const g = parseInt(hex.substring(2, 4), 16);\r\n const b = parseInt(hex.substring(4, 6), 16);\r\n const brightness = (r * 299 + g * 587 + b * 114) / 1000;\r\n\r\n if (brightness > 155) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Dark color rule\r\n */\r\nexport const darkColorRule: SchemaRule = {\r\n name: \"darkColor\",\r\n defaultErrorMessage: \"The :input must be a dark color\",\r\n async validate(value: any, context) {\r\n if (!colorValidationRegex.hex.test(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n const hex = value.replace(\"#\", \"\");\r\n const r = parseInt(hex.substring(0, 2), 16);\r\n const g = parseInt(hex.substring(2, 4), 16);\r\n const b = parseInt(hex.substring(4, 6), 16);\r\n const brightness = (r * 299 + g * 587 + b * 114) / 1000;\r\n\r\n if (brightness <= 155) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Required if rule - field is required if another field equals a specific value\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfRule: SchemaRule<{\r\n field: string;\r\n value: any;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIf\",\r\n description: \"The field is required if another field equals a specific value\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { value: expectedValue } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field equals the expected value\r\n if (isEmptyValue(value) && fieldValue === expectedValue) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if empty rule - field is required if another field is empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfEmptyRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfEmpty\",\r\n description: \"The field is required if :field is empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field is empty\r\n if (isEmptyValue(value) && isEmptyValue(fieldValue)) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if not empty rule - field is required if another field is not empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfNotEmptyRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfNotEmpty\",\r\n description: \"The field is required if :field is not empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field is not empty\r\n if (isEmptyValue(value) && !isEmptyValue(fieldValue)) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if in rule - field is required if another field's value is in the given array\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfInRule: SchemaRule<{\r\n field: string;\r\n values: any[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfIn\",\r\n description: \"The field is required if :field value is in the given array\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { values } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field's value is in the array\r\n if (isEmptyValue(value) && values.includes(fieldValue)) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translationParams.values = this.context.options.values.join(\", \");\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if not in rule - field is required if another field's value is NOT in the given array\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfNotInRule: SchemaRule<{\r\n field: string;\r\n values: any[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfNotIn\",\r\n description: \"The field is required if another field's value is NOT in the given array\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { values } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field's value is NOT in the array\r\n if (isEmptyValue(value) && !values.includes(fieldValue)) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translationParams.values = this.context.options.values.join(\", \");\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Get multiple field values based on scope\r\n */\r\nfunction getFieldsValues(\r\n rule: SchemaRule<{ fields: string[]; scope?: \"global\" | \"sibling\" }>,\r\n context: any,\r\n): any[] {\r\n const { fields, scope = \"global\" } = (rule as any).context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n return fields.map((field: string) => get(source, field));\r\n}\r\n\r\n/**\r\n * Required if all empty rule - field is required if ALL specified fields are empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfAllEmptyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfAllEmpty\",\r\n description: \"The field is required if all :fields are empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValues = getFieldsValues(this, context);\r\n\r\n // Field is required if ALL other fields are empty\r\n const allEmpty = fieldValues.every((v) => isEmptyValue(v));\r\n if (isEmptyValue(value) && allEmpty) {\r\n this.context.options.fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if any empty rule - field is required if ANY of the specified fields is empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfAnyEmptyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfAnyEmpty\",\r\n description: \"The field is required if any of the :fields is empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValues = getFieldsValues(this, context);\r\n\r\n // Field is required if ANY other field is empty\r\n const anyEmpty = fieldValues.some((v) => isEmptyValue(v));\r\n if (isEmptyValue(value) && anyEmpty) {\r\n this.context.options.fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if all not empty rule - field is required if ALL specified fields are NOT empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfAllNotEmptyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfAllNotEmpty\",\r\n description: \"The field is required if all :fields are not empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValues = getFieldsValues(this, context);\r\n\r\n // Field is required if ALL other fields are NOT empty\r\n const allNotEmpty = fieldValues.every((v) => !isEmptyValue(v));\r\n if (isEmptyValue(value) && allNotEmpty) {\r\n this.context.options.fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if any not empty rule - field is required if ANY of the specified fields is NOT empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfAnyNotEmptyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfAnyNotEmpty\",\r\n description: \"The field is required if any of the :fields is not empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValues = getFieldsValues(this, context);\r\n\r\n // Field is required if ANY other field is NOT empty\r\n const anyNotEmpty = fieldValues.some((v) => !isEmptyValue(v));\r\n if (isEmptyValue(value) && anyNotEmpty) {\r\n this.context.options.fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport { isEmptyValue } from \"./../../helpers/is-empty-value\";\r\n\r\n/**\r\n * Required unless rule - field is required unless another field equals a specific value\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredUnlessRule: SchemaRule<{\r\n field: string;\r\n value: any;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredUnless\",\r\n description: \"The field is required unless another field equals a specific value\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { value: expectedValue } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required unless the other field equals the expected value\r\n if (isEmptyValue(value) && fieldValue !== expectedValue) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translationParams.value = this.context.options.value;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\nimport type { SchemaContext, SchemaRule } from \"../../types\";\n\n/**\n * Required when callback returns true.\n *\n * The callback receives only the SchemaContext (not the value),\n * because \"required\" is about surrounding conditions, not the field itself.\n *\n * @example\n * ```ts\n * v.string().requiredWhen((context) => {\n * return context.allData.notificationMethod === 'email';\n * })\n * ```\n */\nexport const requiredWhenRule: SchemaRule<{\n callback: (context: SchemaContext) => boolean | Promise<boolean>;\n}> = {\n name: \"requiredWhen\",\n defaultErrorMessage: \"The :input is required\",\n requiresValue: false,\n sortOrder: -2,\n async validate(value, context) {\n const shouldBeRequired = await this.context.options.callback?.(context);\n\n if (shouldBeRequired && isEmptyValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n","import { get } from \"@mongez/reinforcements\";\r\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Required with rule - field is required if another field is present\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWith\",\r\n description: \"The field is required if another field is present\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field is present\r\n if (isEmptyValue(value) && fieldValue !== undefined) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required with all rule - field is required if all specified fields are present\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithAllRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWithAll\",\r\n description: \"The field is required if all specified fields are present\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if all fields are present\r\n const allPresent = fields.every((field) => get(source, field) !== undefined);\r\n\r\n // Field is required if all other fields are present\r\n if (isEmptyValue(value) && allPresent) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required with any rule - field is required if any of the specified fields is present\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithAnyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWithAny\",\r\n description: \"The field is required if any of the specified fields is present\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if any field is present\r\n const anyPresent = fields.some((field) => get(source, field) !== undefined);\r\n\r\n // Field is required if any other field is present\r\n if (isEmptyValue(value) && anyPresent) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport { isEmptyValue } from \"./../../helpers/is-empty-value\";\r\n\r\n/**\r\n * Required without rule - field is required if another field is missing\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithoutRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWithout\",\r\n description: \"The field is required if another field is missing\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field is missing\r\n if (isEmptyValue(value) && fieldValue === undefined) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required without all rule - field is required if all specified fields are missing\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithoutAllRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWithoutAll\",\r\n description: \"The field is required if all specified fields are missing\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if all fields are missing\r\n const allMissing = fields.every((field) => get(source, field) === undefined);\r\n\r\n // Field is required if all other fields are missing\r\n if (isEmptyValue(value) && allMissing) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required without any rule - field is required if any of the specified fields is missing\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithoutAnyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWithoutAny\",\r\n description: \"The field is required if any of the specified fields is missing\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if any field is missing\r\n const anyMissing = fields.some((field) => get(source, field) === undefined);\r\n\r\n // Field is required if any other field is missing\r\n if (isEmptyValue(value) && anyMissing) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport { isEmptyValue } from \"./../../helpers/is-empty-value\";\r\n\r\n/**\r\n * Present if rule - field must be present if another field equals a specific value\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentIfRule: SchemaRule<{\r\n field: string;\r\n value: any;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentIf\",\r\n description: \"The field must be present if another field equals a specific value\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { value: expectedValue } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field must be present if the other field equals the expected value\r\n if (value === undefined && fieldValue === expectedValue) {\r\n this.context.translationParams.value = expectedValue;\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present if empty rule - field must be present if another field is empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentIfEmptyRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentIfEmpty\",\r\n description: \"The field must be present if another field is empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field must be present if the other field is empty\r\n if (value === undefined && isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present if not empty rule - field must be present if another field is not empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentIfNotEmptyRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentIfNotEmpty\",\r\n description: \"The field must be present if another field is not empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field must be present if the other field is not empty\r\n if (value === undefined && !isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present if in rule - field must be present if another field's value is in the given array\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentIfInRule: SchemaRule<{\r\n field: string;\r\n values: any[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentIfIn\",\r\n description: \"The field must be present if another field's value is in the given array\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { values } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field must be present if the other field's value is in the array\r\n if (value === undefined && values.includes(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present if not in rule - field must be present if another field's value is NOT in the given array\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentIfNotInRule: SchemaRule<{\r\n field: string;\r\n values: any[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentIfNotIn\",\r\n description: \"The field must be present if another field's value is NOT in the given array\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { values } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field must be present if the other field's value is NOT in the array\r\n if (value === undefined && !values.includes(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Present unless rule - field must be present unless another field equals a specific value\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentUnlessRule: SchemaRule<{\r\n field: string;\r\n value: any;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentUnless\",\r\n description: \"The field must be present unless another field equals a specific value\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { value: expectedValue } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field must be present unless the other field equals the expected value\r\n if (value === undefined && fieldValue !== expectedValue) {\r\n this.context.translationParams.value = expectedValue;\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Present with rule - field must be present if another field is present\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentWithRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentWith\",\r\n description: \"The field must be present if another field is present\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // The field must be present if the other field is present\r\n if (value === undefined && fieldValue !== undefined) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present with all rule - field must be present if all specified fields are present\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentWithAllRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentWithAll\",\r\n description: \"The field must be present if all specified fields are present\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if all fields are present\r\n const allPresent = fields.every((field) => get(source, field) !== undefined);\r\n\r\n // Field must be present if all other fields are present\r\n if (value === undefined && allPresent) {\r\n fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present with any rule - field must be present if any of the specified fields is present\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentWithAnyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentWithAny\",\r\n description: \"The field must be present if any of the specified fields is present\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if any field is present\r\n const anyPresent = fields.some((field) => get(source, field) !== undefined);\r\n\r\n // Field must be present if any other field is present\r\n if (value === undefined && anyPresent) {\r\n fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { get } from \"@mongez/reinforcements\";\r\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Present without rule - field must be present if another field is missing\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentWithoutRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentWithout\",\r\n description: \"The field must be present if another field is missing\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field must be present if the other field is missing\r\n if (value === undefined && fieldValue === undefined) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present without all rule - field must be present if all specified fields are missing\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentWithoutAllRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentWithoutAll\",\r\n description: \"The field must be present if all specified fields are missing\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if all fields are missing\r\n const allMissing = fields.every((field) => get(source, field) === undefined);\r\n\r\n // Field must be present if all other fields are missing\r\n if (value === undefined && allMissing) {\r\n fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present without any rule - field must be present if any of the specified fields is missing\r\n * Supports both global and sibling scope\r\n */\r\nexport const presentWithoutAnyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"presentWithoutAny\",\r\n description: \"The field must be present if any of the specified fields is missing\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input field must be present\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if any field is missing\r\n const anyMissing = fields.some((field) => get(source, field) === undefined);\r\n\r\n // Field must be present if any other field is missing\r\n if (value === undefined && anyMissing) {\r\n fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Forbidden if rule - field is forbidden if another field equals a specific value\r\n * Supports both global and sibling scope\r\n */\r\nexport const forbiddenIfRule: SchemaRule<{\r\n field: string;\r\n value: any;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"forbiddenIf\",\r\n description: \"The field is forbidden if another field equals a specific value\",\r\n sortOrder: -2,\r\n defaultErrorMessage: \"The :input is forbidden\",\r\n async validate(value: any, context) {\r\n const { value: expectedValue } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is forbidden if it has a value and the other field equals the expected value\r\n if (!isEmptyValue(value) && fieldValue === expectedValue) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translationParams.value = expectedValue;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Forbidden if not rule - field is forbidden if another field does NOT equal a specific value\r\n * Supports both global and sibling scope\r\n */\r\nexport const forbiddenIfNotRule: SchemaRule<{\r\n field: string;\r\n value: any;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"forbiddenIfNot\",\r\n description: \"The field is forbidden if another field does NOT equal a specific value\",\r\n sortOrder: -2,\r\n defaultErrorMessage: \"The :input is forbidden\",\r\n async validate(value: any, context) {\r\n const { value: expectedValue } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is forbidden if it has a value and the other field does NOT equal the expected value\r\n if (!isEmptyValue(value) && fieldValue !== expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Forbidden if empty rule - field is forbidden if another field is empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const forbiddenIfEmptyRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"forbiddenIfEmpty\",\r\n description: \"The field is forbidden if another field is empty\",\r\n sortOrder: -2,\r\n defaultErrorMessage: \"The :input is forbidden\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is forbidden if it has a value and the other field is empty\r\n if (!isEmptyValue(value) && isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Forbidden if not empty rule - field is forbidden if another field is not empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const forbiddenIfNotEmptyRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"forbiddenIfNotEmpty\",\r\n description: \"The field is forbidden if another field is not empty\",\r\n sortOrder: -2,\r\n defaultErrorMessage: \"The :input is forbidden\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is forbidden if it has a value and the other field is not empty\r\n if (!isEmptyValue(value) && !isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Forbidden if in rule - field is forbidden if another field's value is in the given array\r\n * Supports both global and sibling scope\r\n */\r\nexport const forbiddenIfInRule: SchemaRule<{\r\n field: string;\r\n values: any[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"forbiddenIfIn\",\r\n description: \"The field is forbidden if another field's value is in the given array\",\r\n sortOrder: -2,\r\n defaultErrorMessage: \"The :input is forbidden\",\r\n async validate(value: any, context) {\r\n const { values } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is forbidden if it has a value and the other field's value is in the array\r\n if (!isEmptyValue(value) && values.includes(fieldValue)) {\r\n this.context.translationParams.values = values.join(\", \");\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Forbidden if not in rule - field is forbidden if another field's value is NOT in the given array\r\n * Supports both global and sibling scope\r\n */\r\nexport const forbiddenIfNotInRule: SchemaRule<{\r\n field: string;\r\n values: any[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"forbiddenIfNotIn\",\r\n description: \"The field is forbidden if another field's value is NOT in the given array\",\r\n sortOrder: -2,\r\n defaultErrorMessage: \"The :input is forbidden\",\r\n async validate(value: any, context) {\r\n const { values } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is forbidden if it has a value and the other field's value is NOT in the array\r\n if (!isEmptyValue(value) && !values.includes(fieldValue)) {\r\n this.context.translationParams.values = values.join(\", \");\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { invalidRule, resolveTranslation, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Enum rule - value must be one of the enum values\r\n */\r\nexport const enumRule: SchemaRule<{ enum: any }> = {\r\n name: \"enum\",\r\n defaultErrorMessage: \"The :input must be one of the following values: :enum\",\r\n async validate(value: any, context) {\r\n const enumValues = this.context.options.enum;\r\n\r\n if (enumValues.includes(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Translate each enum value individually, then join into a display string\r\n this.context.translationParams.enum = enumValues\r\n .map((v: any) =>\r\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\r\n )\r\n .join(\", \");\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * In rule - value must be in the given array\r\n */\r\nexport const inRule: SchemaRule<{ values: any[] }> = {\r\n name: \"in\",\r\n defaultErrorMessage: \"The :input must be one of the following values: :values\",\r\n async validate(value: any, context) {\r\n if (this.context.options.values.includes(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Translate each value individually, then join\r\n this.context.translationParams.values = this.context.options.values\r\n .map((v: any) =>\r\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\r\n )\r\n .join(\", \");\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Allowed values rule - value must be one of allowed values\r\n */\r\nexport const allowedValuesRule: SchemaRule<{ allowedValues: any[] }> = {\r\n name: \"allowedValues\",\r\n defaultErrorMessage: \"The :input must be one of the allowed values\",\r\n async validate(value: any, context) {\r\n if (this.context.options.allowedValues.includes(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Translate each value individually, then join\r\n this.context.translationParams.allowedValues = this.context.options.allowedValues\r\n .map((v: any) =>\r\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\r\n )\r\n .join(\", \");\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Not allowed values rule - value must not be in forbidden list\r\n */\r\nexport const notAllowedValuesRule: SchemaRule<{ notAllowedValues: any[] }> = {\r\n name: \"notAllowedValues\",\r\n defaultErrorMessage: \"The :input contains a forbidden value\",\r\n async validate(value: any, context) {\r\n if (!this.context.options.notAllowedValues.includes(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Translate each value individually, then join\r\n this.context.translationParams.notAllowedValues = this.context.options.notAllowedValues\r\n .map((v: any) =>\r\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\r\n )\r\n .join(\", \");\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Equals field rule - value must equal another field's value\r\n * Supports both global and sibling scope\r\n */\r\nexport const equalsFieldRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"equalsField\",\r\n description: \"The value must equal another field's value\",\r\n sortOrder: -1,\r\n requiresValue: true,\r\n defaultErrorMessage: \"The :input must match the :field field\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Value must equal the other field's value\r\n if (value !== fieldValue) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Not equals field rule - value must NOT equal another field's value\r\n * Supports both global and sibling scope\r\n */\r\nexport const notEqualsFieldRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"notEqualsField\",\r\n description: \"The value must NOT equal another field's value\",\r\n sortOrder: -1,\r\n requiresValue: true,\r\n defaultErrorMessage: \"The :input must not match the :field field\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Value must NOT equal the other field's value\r\n if (value === fieldValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * InstanceOf rule - value must be an instance of the given constructor.\n *\n * Uses the `instanceof` operator at runtime. Useful for class instances\n * not representable in JSON Schema (File, Buffer, custom domain classes).\n */\nexport const instanceofRule: SchemaRule<{ ctor: new (...args: any[]) => any; name: string }> = {\n name: \"instanceof\",\n defaultErrorMessage: \"The :input must be an instance of :name\",\n async validate(value: any, context) {\n if (value instanceof this.context.options.ctor) {\n return VALID_RULE;\n }\n\n this.context.translationParams.name = this.context.options.name;\n\n return invalidRule(this, context);\n },\n};\n","import { invalidRule, resolveTranslation, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Literal rule - value must be strictly equal to one of the literal values.\n *\n * Uses === (referential / strict equality), so distinguishes 1 from \"1\",\n * true from \"true\", etc. Mirrors `v.string().oneOf([...])` but at the\n * literal type level (TypeScript narrows to the union of literals).\n */\nexport const literalRule: SchemaRule<{ values: readonly (string | number | boolean)[] }> = {\n name: \"literal\",\n // Runs even on \"empty\" values. A literal set is an exact-match whitelist, so\n // there is no value it cannot safely be asked about — and `\"\"` is one of the\n // values callers most want to pin (`alt=\"\"` for a decorative image). Left at\n // the default, the empty string would skip this check entirely, which made\n // `v.literal(\"\").optional()` accept `\"\"`, `null` AND a missing key alike.\n requiresValue: false,\n defaultErrorMessage: \"The :input must be one of the following values: :values\",\n async validate(value: any, context) {\n // Absence is the required/present rule's question, not this one. Without\n // this, `requiresValue: false` above would make the literal check fire on a\n // missing key and defeat `.optional()`, which works by removing that rule.\n if (value === undefined) {\n return VALID_RULE;\n }\n\n if (this.context.options.values.includes(value)) {\n return VALID_RULE;\n }\n\n this.context.translationParams.values = this.context.options.values\n .map(v =>\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\n )\n .join(\", \");\n\n return invalidRule(this, context);\n },\n};\n","import { isObject, isPlainObject } from \"@mongez/supportive-is\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * String rule - validates string type\r\n */\r\nexport const stringRule: SchemaRule = {\r\n name: \"string\",\r\n defaultErrorMessage: \"The :input must be a string\",\r\n async validate(value: any, context) {\r\n if (typeof value === \"string\") {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Number rule - validates number type\r\n */\r\nexport const numberRule: SchemaRule = {\r\n name: \"number\",\r\n defaultErrorMessage: \"The :input must be a number\",\r\n async validate(value: any, context) {\r\n if (typeof value === \"number\") {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Boolean rule - validates boolean type\r\n */\r\nexport const booleanRule: SchemaRule = {\r\n name: \"boolean\",\r\n defaultErrorMessage: \"The :input must be a boolean\",\r\n async validate(value: any, context) {\r\n if (typeof value === \"boolean\") {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Int rule - validates integer type\r\n */\r\nexport const intRule: SchemaRule = {\r\n name: \"int\",\r\n defaultErrorMessage: \"The :input must be an integer\",\r\n async validate(value: any, context) {\r\n if (Number.isInteger(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Float rule - validates float type\r\n */\r\nexport const floatRule: SchemaRule = {\r\n name: \"float\",\r\n defaultErrorMessage: \"The :input must be a float\",\r\n async validate(value: any, context) {\r\n if (Number.isFinite(value) && !Number.isInteger(value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Scalar rule - validates scalar value (string, number, or boolean)\r\n */\r\nexport const scalarRule: SchemaRule = {\r\n name: \"scalar\",\r\n defaultErrorMessage: \"The :input must be a scalar value\",\r\n async validate(value: any, context) {\r\n if ([\"string\", \"number\", \"boolean\"].includes(typeof value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Object rule - validates object type\r\n */\r\nexport const objectRule: SchemaRule = {\r\n name: \"object\",\r\n defaultErrorMessage: \"The :input must be an object\",\r\n async validate(value: any, context) {\r\n if (!!isObject(value) && value !== null) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Object rule - validates object type\r\n */\r\nexport const plainObjectRule: SchemaRule = {\r\n name: \"plainObject\",\r\n defaultErrorMessage: \"The :input must be an object\",\r\n async validate(value: any, context) {\r\n if (!!isPlainObject(value) && value !== null) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Array rule - validates array type\r\n */\r\nexport const arrayRule: SchemaRule = {\r\n name: \"array\",\r\n defaultErrorMessage: \"The :input must be an array\",\r\n async validate(value: any, context) {\r\n if (Array.isArray(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n","import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { Schema, SchemaRule } from \"../../types\";\n\n/**\n * Unknown key rule - validates that object doesn't have unknown keys\n */\nexport const unknownKeyRule: SchemaRule<{\n schema: Schema;\n allowedKeys: string[];\n}> = {\n name: \"unknownKeys\",\n defaultErrorMessage: \"The :input contains unknown keys: :unknownKeys\",\n async validate(value: any, context) {\n const schema = this.context.options.schema;\n const allowedKeys = [...Object.keys(schema), ...(this.context.options.allowedKeys || [])];\n\n const unknownKeys = Object.keys(value).filter((key) => !allowedKeys.includes(key));\n\n if (unknownKeys.length > 0) {\n this.context.translationParams.unknownKeys = unknownKeys.join(\", \");\n\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n","import { setKeyPath } from \"../helpers\";\r\nimport { flipArrayMutator, sortArrayMutator, uniqueArrayMutator } from \"../mutators\";\r\nimport {\r\n arrayRule,\r\n betweenLengthRule,\r\n lengthRule,\r\n maxLengthRule,\r\n minLengthRule,\r\n sortedArrayRule,\r\n uniqueArrayRule,\r\n} from \"../rules\";\r\nimport type { SchemaContext, ValidationResult } from \"../types\";\r\nimport { BaseValidator } from \"./base-validator\";\r\nimport { applyNullable, getRuleOptions } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Array validator class\r\n */\r\nexport class ArrayValidator extends BaseValidator {\r\n public constructor(\r\n public validator: BaseValidator,\r\n errorMessage?: string,\r\n ) {\r\n super();\r\n this.addMutableRule(arrayRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is an array type\r\n */\r\n public matchesType(value: any): boolean {\r\n return Array.isArray(value);\r\n }\r\n\r\n /**\r\n * Clone the validator\r\n */\r\n public override clone(): this {\r\n const cloned = super.clone();\r\n\r\n cloned.validator = this.validator.clone();\r\n\r\n return cloned;\r\n }\r\n\r\n /** Reverse array order */\r\n public flip() {\r\n return this.addMutator(flipArrayMutator);\r\n }\r\n\r\n /** Reverse array order (alias) */\r\n public reverse() {\r\n return this.addMutator(flipArrayMutator);\r\n }\r\n\r\n /** Make it has only unique values */\r\n public onlyUnique() {\r\n return this.addMutator(uniqueArrayMutator);\r\n }\r\n\r\n /** Sort array */\r\n public sort(direction: \"asc\" | \"desc\" = \"asc\", key?: string) {\r\n return this.addMutator(sortArrayMutator, { direction, key });\r\n }\r\n\r\n /** Array length must be greater than the given length */\r\n public minLength(length: number, errorMessage?: string) {\r\n return this.addRule(minLengthRule, errorMessage, { minLength: length });\r\n }\r\n\r\n /** Array length must be less than the given length */\r\n public maxLength(length: number, errorMessage?: string) {\r\n return this.addRule(maxLengthRule, errorMessage, { maxLength: length });\r\n }\r\n\r\n /** Array length must be of the given length */\r\n public length(length: number, errorMessage?: string) {\r\n return this.addRule(lengthRule, errorMessage, { length });\r\n }\r\n\r\n /**\r\n * Array length must be between min and max (inclusive)\r\n *\r\n * @param min - Minimum length (inclusive)\r\n * @param max - Maximum length (inclusive)\r\n *\r\n * @example\r\n * ```ts\r\n * v.array(v.string()).between(1, 10) // Array must have 1 to 10 items\r\n * v.array(v.number()).lengthBetween(5, 20) // Same using alias\r\n * ```\r\n *\r\n * @category Validation Rule\r\n */\r\n public between(min: number, max: number, errorMessage?: string) {\r\n return this.addRule(betweenLengthRule, errorMessage, {\r\n minLength: min,\r\n maxLength: max,\r\n });\r\n }\r\n\r\n /**\r\n * Alias for between() - array length between min and max\r\n */\r\n public lengthBetween(min: number, max: number, errorMessage?: string) {\r\n return this.between(min, max, errorMessage);\r\n }\r\n\r\n /** Array must have unique values */\r\n public unique(errorMessage?: string) {\r\n return this.addRule(uniqueArrayRule, errorMessage);\r\n }\r\n\r\n /** Array must be sorted */\r\n public sorted(direction: \"asc\" | \"desc\" = \"asc\", errorMessage?: string) {\r\n return this.addRule(sortedArrayRule, errorMessage, { direction });\r\n }\r\n\r\n /** Mutate the data */\r\n public mutate(data: any, context: SchemaContext) {\r\n if (!Array.isArray(data)) return data;\r\n return super.mutate([...data], context);\r\n }\r\n\r\n /** Validate array\r\n *\r\n * Absent input (and absent without `.default()`) propagates as `data: undefined`\r\n * so the parent ObjectValidator can omit the key. Without this, optional array\r\n * fields would silently materialise as `[]` in the validated output.\r\n */\r\n public async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\r\n // Apply default when absent, then mutate. Mirrors BaseValidator's\r\n // `valueForRules = data ?? this.getDefaultValue()` so `.default([...])`\r\n // works on arrays too.\r\n const valueForRules = data ?? this.getDefaultValue();\r\n const mutatedData = await this.mutate(valueForRules, context);\r\n\r\n const result = await super.validate(data, context);\r\n\r\n if (result.isValid === false) return result;\r\n\r\n // Nothing to iterate for absent (no default) or null (nullable) inputs —\r\n // propagate so the parent ObjectValidator can omit the key.\r\n if (mutatedData === undefined || mutatedData === null) return result;\r\n\r\n // Defensive: type rule (arrayRule) should have failed for non-arrays.\r\n if (!Array.isArray(mutatedData)) return result;\r\n\r\n const errors: ValidationResult[\"errors\"] = [];\r\n\r\n // Validate all items in parallel (consistent with ObjectValidator)\r\n const validationPromises = mutatedData.map(async (value: any, index: number) => {\r\n const childContext: SchemaContext = {\r\n ...context,\r\n parent: mutatedData,\r\n value,\r\n key: index.toString(),\r\n path: setKeyPath(context.path, index.toString()),\r\n };\r\n\r\n const childResult = await this.validator.validate(value, childContext);\r\n\r\n // Update mutated data with validated result\r\n mutatedData[index] = childResult.data;\r\n\r\n // Collect errors from this element\r\n if (childResult.isValid === false) {\r\n errors.push(...childResult.errors);\r\n }\r\n });\r\n\r\n await Promise.all(validationPromises);\r\n\r\n return {\r\n isValid: errors.length === 0,\r\n errors,\r\n data: await this.startTransformationPipeline(mutatedData, context),\r\n };\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Recursively generates JSON Schema for the array items.\r\n *\r\n * @example\r\n * ```ts\r\n * v.array(v.string().min(1)).minLength(1).toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"array\", items: { type: \"string\", minLength: 1 }, minItems: 1 }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const schema: JsonSchemaResult = {\r\n type: \"array\",\r\n items: this.validator.toJsonSchema(target),\r\n };\r\n\r\n const minOpts = getRuleOptions(this.rules, \"minLength\");\r\n if (minOpts?.minLength !== undefined) schema.minItems = minOpts.minLength;\r\n\r\n const maxOpts = getRuleOptions(this.rules, \"maxLength\");\r\n if (maxOpts?.maxLength !== undefined) schema.maxItems = maxOpts.maxLength;\r\n\r\n const betweenOpts = getRuleOptions(this.rules, \"betweenLength\");\r\n if (betweenOpts) {\r\n if (betweenOpts.minLength !== undefined) schema.minItems = betweenOpts.minLength;\r\n if (betweenOpts.maxLength !== undefined) schema.maxItems = betweenOpts.maxLength;\r\n }\r\n\r\n const lengthOpts = getRuleOptions(this.rules, \"length\");\r\n if (lengthOpts?.length !== undefined) {\r\n schema.minItems = lengthOpts.length;\r\n schema.maxItems = lengthOpts.length;\r\n }\r\n\r\n if (this.isNullable) applyNullable(schema, target);\r\n\r\n return schema;\r\n }\r\n}\r\n","import { equalsFieldRule, notEqualsFieldRule } from \"../../rules\";\r\nimport { equalRule } from \"../../rules/core/equal\";\r\nimport { whenRule } from \"../../rules/core/when\";\r\nimport type { WhenRuleOptions } from \"../../types\";\r\nimport { BaseValidator } from \"../base-validator\";\r\n\r\n/**\r\n * Marker re-exported by the validators barrel so the dts bundler keeps this\r\n * module (and its `declare module` augmentation) in the bundled `.d.ts`.\r\n */\r\nexport const equalityConditionalMethodsApplied = true;\r\n\r\ndeclare module \"../base-validator\" {\r\n interface BaseValidator {\r\n /**\r\n * Value must be equal to the given value\r\n */\r\n equal(value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value must be the same as another field's value\r\n */\r\n sameAs(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value must be the same as another sibling field's value\r\n */\r\n sameAsSibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value must be different from another field's value\r\n */\r\n differentFrom(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value must be different from another sibling field's value\r\n */\r\n differentFromSibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Apply different validation rules based on another field's value (global scope)\r\n *\r\n * Use this when you need to apply completely different validators\r\n * based on another field's value (not just required/optional).\r\n *\r\n * @param field - Field name to check (can be nested with dot notation)\r\n * @param options - Validation options per field value\r\n *\r\n * @example\r\n * ```ts\r\n * // Different allowed values based on user type\r\n * v.object({\r\n * userType: v.string().in(['admin', 'user']),\r\n * role: v.string().when('userType', {\r\n * is: {\r\n * admin: v.string().in(['super', 'moderator']),\r\n * user: v.string().in(['member', 'guest'])\r\n * },\r\n * otherwise: v.string().optional()\r\n * })\r\n * })\r\n *\r\n * // Different validation rules based on type\r\n * v.object({\r\n * contactType: v.string().in(['email', 'phone']),\r\n * contact: v.string().when('contactType', {\r\n * is: {\r\n * email: v.string().email(),\r\n * phone: v.string().pattern(/^\\d{10}$/)\r\n * }\r\n * })\r\n * })\r\n * ```\r\n * @category Conditional Validation\r\n */\r\n when(field: string, options: Omit<WhenRuleOptions, \"field\" | \"scope\">): this;\r\n\r\n /**\r\n * Apply different validation rules based on sibling field's value\r\n *\r\n * Use this for nested objects where you need to check a field\r\n * within the same parent object.\r\n *\r\n * @param siblingField - Sibling field name to check\r\n * @param options - Validation options per field value\r\n *\r\n * @example\r\n * ```ts\r\n * // Array of users with role-based permissions\r\n * v.array(v.object({\r\n * userType: v.string().in(['admin', 'user']),\r\n * permissions: v.string().whenSibling('userType', {\r\n * is: {\r\n * admin: v.string().in(['read', 'write', 'delete']),\r\n * user: v.string().in(['read'])\r\n * }\r\n * })\r\n * }))\r\n * ```\r\n * @category Conditional Validation\r\n */\r\n whenSibling(siblingField: string, options: Omit<WhenRuleOptions, \"field\" | \"scope\">): this;\r\n }\r\n}\r\n\r\n/**\r\n * Value must be equal to the given value\r\n */\r\nBaseValidator.prototype.equal = function (value: any, errorMessage?: string) {\r\n return this.addRule(equalRule, errorMessage, { value });\r\n};\r\n\r\n/**\r\n * Value must be the same as another field's value\r\n */\r\nBaseValidator.prototype.sameAs = function (field: string, errorMessage?: string) {\r\n return this.addRule(equalsFieldRule, errorMessage, {\r\n field,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value must be the same as another sibling field's value\r\n */\r\nBaseValidator.prototype.sameAsSibling = function (field: string, errorMessage?: string) {\r\n return this.addRule(equalsFieldRule, errorMessage, {\r\n field,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value must be different from another field's value\r\n */\r\nBaseValidator.prototype.differentFrom = function (field: string, errorMessage?: string) {\r\n return this.addRule(notEqualsFieldRule, errorMessage, {\r\n field,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value must be different from another sibling field's value\r\n */\r\nBaseValidator.prototype.differentFromSibling = function (field: string, errorMessage?: string) {\r\n return this.addRule(notEqualsFieldRule, errorMessage, {\r\n field,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Apply different validation rules based on another field's value (global scope)\r\n *\r\n * Use this when you need to apply completely different validators\r\n * based on another field's value (not just required/optional).\r\n *\r\n * @param field - Field name to check (can be nested with dot notation)\r\n * @param options - Validation options per field value\r\n *\r\n * @example\r\n * ```ts\r\n * // Different allowed values based on user type\r\n * v.object({\r\n * userType: v.string().in(['admin', 'user']),\r\n * role: v.string().when('userType', {\r\n * is: {\r\n * admin: v.string().in(['super', 'moderator']),\r\n * user: v.string().in(['member', 'guest'])\r\n * },\r\n * otherwise: v.string().optional()\r\n * })\r\n * })\r\n *\r\n * // Different validation rules based on type\r\n * v.object({\r\n * contactType: v.string().in(['email', 'phone']),\r\n * contact: v.string().when('contactType', {\r\n * is: {\r\n * email: v.string().email(),\r\n * phone: v.string().pattern(/^\\d{10}$/)\r\n * }\r\n * })\r\n * })\r\n * ```\r\n * @category Conditional Validation\r\n */\r\nBaseValidator.prototype.when = function (\r\n field: string,\r\n options: Omit<WhenRuleOptions, \"field\" | \"scope\">,\r\n) {\r\n return this.addRule(whenRule, undefined, {\r\n field,\r\n is: options.is,\r\n otherwise: options.otherwise,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Apply different validation rules based on sibling field's value\r\n *\r\n * Use this for nested objects where you need to check a field\r\n * within the same parent object.\r\n *\r\n * @param siblingField - Sibling field name to check\r\n * @param options - Validation options per field value\r\n *\r\n * @example\r\n * ```ts\r\n * // Array of users with role-based permissions\r\n * v.array(v.object({\r\n * userType: v.string().in(['admin', 'user']),\r\n * permissions: v.string().whenSibling('userType', {\r\n * is: {\r\n * admin: v.string().in(['read', 'write', 'delete']),\r\n * user: v.string().in(['read'])\r\n * }\r\n * })\r\n * }))\r\n * ```\r\n * @category Conditional Validation\r\n */\r\nBaseValidator.prototype.whenSibling = function (\r\n siblingField: string,\r\n options: Omit<WhenRuleOptions, \"field\" | \"scope\">,\r\n) {\r\n return this.addRule(whenRule, undefined, {\r\n field: siblingField,\r\n is: options.is,\r\n otherwise: options.otherwise,\r\n scope: \"sibling\",\r\n });\r\n};\r\n","import {\r\n forbiddenIfEmptyRule,\r\n forbiddenIfInRule,\r\n forbiddenIfNotEmptyRule,\r\n forbiddenIfNotInRule,\r\n forbiddenIfNotRule,\r\n forbiddenIfRule,\r\n} from \"../../rules/conditional/forbidden-if-rules\";\r\nimport { forbiddenRule } from \"../../rules/core/forbidden\";\r\nimport { BaseValidator } from \"../base-validator\";\r\n\r\n/**\r\n * Marker re-exported by the validators barrel so the dts bundler keeps this\r\n * module (and its `declare module` augmentation) in the bundled `.d.ts`.\r\n */\r\nexport const forbiddenMethodsApplied = true;\r\n\r\ndeclare module \"../base-validator\" {\r\n interface BaseValidator {\r\n /**\r\n * Value is forbidden to be present\r\n */\r\n forbidden(errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field equals a specific value (global scope)\r\n */\r\n forbiddenIf(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field equals a specific value (sibling scope)\r\n */\r\n forbiddenIfSibling(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field does NOT equal a specific value (global scope)\r\n */\r\n forbiddenIfNot(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field does NOT equal a specific value (sibling scope)\r\n */\r\n forbiddenIfNotSibling(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field is empty (global scope)\r\n */\r\n forbiddenIfEmpty(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field is empty (sibling scope)\r\n */\r\n forbiddenIfEmptySibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field is not empty (global scope)\r\n */\r\n forbiddenIfNotEmpty(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field is not empty (sibling scope)\r\n */\r\n forbiddenIfNotEmptySibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field's value is in the given array (global scope)\r\n */\r\n forbiddenIfIn(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field's value is in the given array (sibling scope)\r\n */\r\n forbiddenIfInSibling(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field's value is NOT in the given array (global scope)\r\n */\r\n forbiddenIfNotIn(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field's value is NOT in the given array (sibling scope)\r\n */\r\n forbiddenIfNotInSibling(field: string, values: any[], errorMessage?: string): this;\r\n }\r\n}\r\n\r\n/**\r\n * Value is forbidden to be present\r\n */\r\nBaseValidator.prototype.forbidden = function (errorMessage?: string) {\r\n return this.addRule(forbiddenRule, errorMessage);\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field equals a specific value (global scope)\r\n */\r\nBaseValidator.prototype.forbiddenIf = function (field: string, value: any, errorMessage?: string) {\r\n return this.addRule(forbiddenIfRule, errorMessage, {\r\n field,\r\n value,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field equals a specific value (sibling scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfSibling = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfRule, errorMessage, {\r\n field,\r\n value,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field does NOT equal a specific value (global scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfNot = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfNotRule, errorMessage, {\r\n field,\r\n value,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field does NOT equal a specific value (sibling scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfNotSibling = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfNotRule, errorMessage, {\r\n field,\r\n value,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field is empty (global scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfEmpty = function (field: string, errorMessage?: string) {\r\n return this.addRule(forbiddenIfEmptyRule, errorMessage, {\r\n field,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field is empty (sibling scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfEmptySibling = function (field: string, errorMessage?: string) {\r\n return this.addRule(forbiddenIfEmptyRule, errorMessage, {\r\n field,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field is not empty (global scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfNotEmpty = function (field: string, errorMessage?: string) {\r\n return this.addRule(forbiddenIfNotEmptyRule, errorMessage, {\r\n field,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field is not empty (sibling scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfNotEmptySibling = function (\r\n field: string,\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfNotEmptyRule, errorMessage, {\r\n field,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field's value is in the given array (global scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfIn = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field's value is in the given array (sibling scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfInSibling = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field's value is NOT in the given array (global scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfNotIn = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfNotInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field's value is NOT in the given array (sibling scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfNotInSibling = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfNotInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"sibling\",\r\n });\r\n};\r\n","import {\r\n presentIfEmptyRule,\r\n presentIfInRule,\r\n presentIfNotEmptyRule,\r\n presentIfNotInRule,\r\n presentIfRule,\r\n} from \"../../rules/conditional/present-if-rules\";\r\nimport { presentUnlessRule } from \"../../rules/conditional/present-unless-rules\";\r\nimport {\r\n presentWithAllRule,\r\n presentWithAnyRule,\r\n presentWithRule,\r\n} from \"../../rules/conditional/present-with-rules\";\r\nimport {\r\n presentWithoutAllRule,\r\n presentWithoutAnyRule,\r\n presentWithoutRule,\r\n} from \"../../rules/conditional/present-without-rules\";\r\nimport { BaseValidator } from \"../base-validator\";\r\n\r\n/**\r\n * Marker re-exported by the validators barrel so the dts bundler keeps this\r\n * module (and its `declare module` augmentation) in the bundled `.d.ts`.\r\n */\r\nexport const presentMethodsApplied = true;\r\n\r\ndeclare module \"../base-validator\" {\r\n interface BaseValidator {\r\n /**\r\n * Field must be present if another field exists\r\n */\r\n presentWith(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another sibling field exists\r\n */\r\n presentWithSibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another field is missing\r\n */\r\n presentWithout(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another sibling field is missing\r\n */\r\n presentWithoutSibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another field equals a specific value\r\n */\r\n presentIf(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another sibling field equals a specific value\r\n */\r\n presentIfSibling(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present unless another field equals a specific value\r\n */\r\n presentUnless(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present unless another sibling field equals a specific value\r\n */\r\n presentUnlessSibling(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another field is empty\r\n */\r\n presentIfEmpty(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another sibling field is empty\r\n */\r\n presentIfEmptySibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another field is not empty\r\n */\r\n presentIfNotEmpty(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another sibling field is not empty\r\n */\r\n presentIfNotEmptySibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another field's value is in the given array\r\n */\r\n presentIfIn(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another sibling field's value is in the given array\r\n */\r\n presentIfInSibling(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another field's value is NOT in the given array\r\n */\r\n presentIfNotIn(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if another sibling field's value is NOT in the given array\r\n */\r\n presentIfNotInSibling(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if all specified fields exist\r\n */\r\n presentWithAll(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if all specified sibling fields exist\r\n */\r\n presentWithAllSiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if all specified fields are missing\r\n */\r\n presentWithoutAll(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if all specified sibling fields are missing\r\n */\r\n presentWithoutAllSiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if any of the specified fields exists\r\n */\r\n presentWithAny(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if any of the specified sibling fields exists\r\n */\r\n presentWithAnySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if any of the specified fields is missing\r\n */\r\n presentWithoutAny(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Field must be present if any of the specified sibling fields is missing\r\n */\r\n presentWithoutAnySiblings(fields: string[], errorMessage?: string): this;\r\n }\r\n}\r\n\r\n// ==================== PRESENT: BASED ON FIELD PRESENCE ====================\r\n\r\n/**\r\n * Field must be present if another field exists\r\n */\r\nBaseValidator.prototype.presentWith = function (field: string, errorMessage?: string) {\r\n return this.addRule(presentWithRule, errorMessage, {\r\n field,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if another sibling field exists\r\n */\r\nBaseValidator.prototype.presentWithSibling = function (field: string, errorMessage?: string) {\r\n return this.addRule(presentWithRule, errorMessage, {\r\n field,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if another field is missing\r\n */\r\nBaseValidator.prototype.presentWithout = function (field: string, errorMessage?: string) {\r\n return this.addRule(presentWithoutRule, errorMessage, {\r\n field,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if another sibling field is missing\r\n */\r\nBaseValidator.prototype.presentWithoutSibling = function (field: string, errorMessage?: string) {\r\n return this.addRule(presentWithoutRule, errorMessage, {\r\n field,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n// ==================== PRESENT: BASED ON FIELD VALUE ====================\r\n\r\n/**\r\n * Field must be present if another field equals a specific value\r\n */\r\nBaseValidator.prototype.presentIf = function (field: string, value: any, errorMessage?: string) {\r\n return this.addRule(presentIfRule, errorMessage, {\r\n field,\r\n value,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if another sibling field equals a specific value\r\n */\r\nBaseValidator.prototype.presentIfSibling = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(presentIfRule, errorMessage, {\r\n field,\r\n value,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present unless another field equals a specific value\r\n */\r\nBaseValidator.prototype.presentUnless = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(presentUnlessRule, errorMessage, {\r\n field,\r\n value,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present unless another sibling field equals a specific value\r\n */\r\nBaseValidator.prototype.presentUnlessSibling = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(presentUnlessRule, errorMessage, {\r\n field,\r\n value,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n// ==================== PRESENT: BASED ON FIELD EMPTY STATE ====================\r\n\r\n/**\r\n * Field must be present if another field is empty\r\n */\r\nBaseValidator.prototype.presentIfEmpty = function (field: string, errorMessage?: string) {\r\n return this.addRule(presentIfEmptyRule, errorMessage, {\r\n field,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if another sibling field is empty\r\n */\r\nBaseValidator.prototype.presentIfEmptySibling = function (field: string, errorMessage?: string) {\r\n return this.addRule(presentIfEmptyRule, errorMessage, {\r\n field,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if another field is not empty\r\n */\r\nBaseValidator.prototype.presentIfNotEmpty = function (field: string, errorMessage?: string) {\r\n return this.addRule(presentIfNotEmptyRule, errorMessage, {\r\n field,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if another sibling field is not empty\r\n */\r\nBaseValidator.prototype.presentIfNotEmptySibling = function (field: string, errorMessage?: string) {\r\n return this.addRule(presentIfNotEmptyRule, errorMessage, {\r\n field,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if another field's value is in the given array\r\n */\r\nBaseValidator.prototype.presentIfIn = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(presentIfInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if another sibling field's value is in the given array\r\n */\r\nBaseValidator.prototype.presentIfInSibling = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(presentIfInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if another field's value is NOT in the given array\r\n */\r\nBaseValidator.prototype.presentIfNotIn = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(presentIfNotInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if another sibling field's value is NOT in the given array\r\n */\r\nBaseValidator.prototype.presentIfNotInSibling = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(presentIfNotInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n// ==================== PRESENT: BASED ON MULTIPLE FIELDS (ALL) ====================\r\n\r\n/**\r\n * Field must be present if all specified fields exist\r\n */\r\nBaseValidator.prototype.presentWithAll = function (fields: string[], errorMessage?: string) {\r\n return this.addRule(presentWithAllRule, errorMessage, {\r\n fields,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if all specified sibling fields exist\r\n */\r\nBaseValidator.prototype.presentWithAllSiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(presentWithAllRule, errorMessage, {\r\n fields,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if all specified fields are missing\r\n */\r\nBaseValidator.prototype.presentWithoutAll = function (fields: string[], errorMessage?: string) {\r\n return this.addRule(presentWithoutAllRule, errorMessage, {\r\n fields,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if all specified sibling fields are missing\r\n */\r\nBaseValidator.prototype.presentWithoutAllSiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(presentWithoutAllRule, errorMessage, {\r\n fields,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n// ==================== PRESENT: BASED ON MULTIPLE FIELDS (ANY) ====================\r\n\r\n/**\r\n * Field must be present if any of the specified fields exists\r\n */\r\nBaseValidator.prototype.presentWithAny = function (fields: string[], errorMessage?: string) {\r\n return this.addRule(presentWithAnyRule, errorMessage, {\r\n fields,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if any of the specified sibling fields exists\r\n */\r\nBaseValidator.prototype.presentWithAnySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(presentWithAnyRule, errorMessage, {\r\n fields,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if any of the specified fields is missing\r\n */\r\nBaseValidator.prototype.presentWithoutAny = function (fields: string[], errorMessage?: string) {\r\n return this.addRule(presentWithoutAnyRule, errorMessage, {\r\n fields,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Field must be present if any of the specified sibling fields is missing\r\n */\r\nBaseValidator.prototype.presentWithoutAnySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(presentWithoutAnyRule, errorMessage, {\r\n fields,\r\n scope: \"sibling\",\r\n });\r\n};\r\n","import {\r\n requiredIfAllEmptyRule,\r\n requiredIfAllNotEmptyRule,\r\n requiredIfAnyEmptyRule,\r\n requiredIfAnyNotEmptyRule,\r\n requiredIfEmptyRule,\r\n requiredIfInRule,\r\n requiredIfNotEmptyRule,\r\n requiredIfNotInRule,\r\n requiredIfRule,\r\n} from \"../../rules/conditional/required-if-rules\";\r\nimport { requiredUnlessRule } from \"../../rules/conditional/required-unless-rules\";\r\nimport { requiredWhenRule } from \"../../rules/conditional/required-when-rule\";\r\nimport {\r\n requiredWithAllRule,\r\n requiredWithAnyRule,\r\n requiredWithRule,\r\n} from \"../../rules/conditional/required-with-rules\";\r\nimport {\r\n requiredWithoutAllRule,\r\n requiredWithoutAnyRule,\r\n requiredWithoutRule,\r\n} from \"../../rules/conditional/required-without-rules\";\r\nimport { presentRule, requiredRule } from \"../../rules/core/required\";\r\nimport type { SchemaContext } from \"../../types\";\r\nimport { BaseValidator } from \"../base-validator\";\r\n\r\n/**\r\n * Marker re-exported by the validators barrel so the dts bundler keeps this\r\n * module (and its `declare module` augmentation) in the bundled `.d.ts`.\r\n * Without a real export, side-effect-only augmentation modules get tree-shaken\r\n * out of the published types, dropping every chainable rule method.\r\n */\r\nexport const requiredMethodsApplied = true;\r\n\r\ndeclare module \"../base-validator\" {\r\n interface BaseValidator {\r\n /**\r\n * This value must be present and has a value\r\n */\r\n required(errorMessage?: string): this;\r\n\r\n /**\r\n * Value must be present but not necessarily has a value\r\n */\r\n present(errorMessage?: string): this;\r\n\r\n /**\r\n * Mark the field as optional, so pass it if it has no value or has a value\r\n * Because this is the default behavior, this method is just syntactic sugar\r\n */\r\n optional(): this & { isOptional: true };\r\n\r\n /**\r\n * Sugar for `.optional().nullable()` — the field may be absent OR null.\r\n *\r\n * Brands the return type with both `{ isOptional: true }` and `{ isNullable: true }`\r\n * so `Infer<>` produces `{ field?: T | null }`.\r\n *\r\n * @example\r\n * v.string().nullish()\r\n * // type: string | null | undefined\r\n * // absent → key omitted\r\n * // null → null\r\n * // \"x\" → \"x\"\r\n */\r\n nullish(): this & { isOptional: true; isNullable: true };\r\n\r\n /**\r\n * Value is required if another field exists\r\n */\r\n requiredWith(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field exists\r\n */\r\n requiredWithSibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field is missing\r\n */\r\n requiredWithout(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field is missing\r\n */\r\n requiredWithoutSibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field equals a specific value\r\n */\r\n requiredIf(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field equals a specific value\r\n */\r\n requiredIfSibling(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required unless another field equals a specific value\r\n */\r\n requiredUnless(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required unless another sibling field equals a specific value\r\n */\r\n requiredUnlessSibling(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field is empty\r\n */\r\n requiredIfEmpty(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field is empty\r\n */\r\n requiredIfEmptySibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field is not empty\r\n */\r\n requiredIfNotEmpty(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field is not empty\r\n */\r\n requiredIfNotEmptySibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ALL specified fields are empty\r\n */\r\n requiredIfAllEmpty(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ALL specified sibling fields are empty\r\n */\r\n requiredIfAllEmptySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ANY of the specified fields is empty\r\n */\r\n requiredIfAnyEmpty(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ANY of the specified sibling fields is empty\r\n */\r\n requiredIfAnyEmptySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ALL specified fields are NOT empty\r\n */\r\n requiredIfAllNotEmpty(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ALL specified sibling fields are NOT empty\r\n */\r\n requiredIfAllNotEmptySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ANY of the specified fields is NOT empty\r\n */\r\n requiredIfAnyNotEmpty(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ANY of the specified sibling fields is NOT empty\r\n */\r\n requiredIfAnyNotEmptySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field's value is in the given array\r\n */\r\n requiredIfIn(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field's value is in the given array\r\n */\r\n requiredIfInSibling(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field's value is NOT in the given array\r\n */\r\n requiredIfNotIn(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field's value is NOT in the given array\r\n */\r\n requiredIfNotInSibling(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if all specified fields exist\r\n */\r\n requiredWithAll(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if all specified sibling fields exist\r\n */\r\n requiredWithAllSiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if all specified fields are missing\r\n */\r\n requiredWithoutAll(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if all specified sibling fields are missing\r\n */\r\n requiredWithoutAllSiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if any of the specified fields exists\r\n */\r\n requiredWithAny(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if any of the specified sibling fields exists\r\n */\r\n requiredWithAnySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if any of the specified fields is missing\r\n */\r\n requiredWithoutAny(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if any of the specified sibling fields is missing\r\n */\r\n requiredWithoutAnySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Make this field required based on a custom callback.\r\n *\r\n * The callback receives only the `SchemaContext` (not the value),\r\n * because \"required\" is about surrounding conditions, not the field itself.\r\n * Return `true` if the field should be required.\r\n *\r\n * @param callback - Receives SchemaContext, returns boolean\r\n * @param errorMessage - Optional custom error message\r\n *\r\n * @example\r\n * ```ts\r\n * // Required when email notification is enabled\r\n * v.string().requiredWhen((context) => {\r\n * return context.allData.notificationMethod === 'email';\r\n * })\r\n *\r\n * // Required based on multiple conditions\r\n * v.string().requiredWhen((context) => {\r\n * const { role, department } = context.allData;\r\n * return role === 'manager' && department === 'finance';\r\n * })\r\n * ```\r\n */\r\n requiredWhen(\r\n callback: (context: SchemaContext) => boolean | Promise<boolean>,\r\n errorMessage?: string,\r\n ): this;\r\n }\r\n}\r\n\r\n// ==================== UNCONDITIONAL STATES ====================\r\n\r\n/**\r\n * This value must be present and has a value\r\n */\r\nBaseValidator.prototype.required = function (errorMessage?: string) {\r\n return this.setRequiredRule(requiredRule, errorMessage);\r\n};\r\n\r\n/**\r\n * Value must be present but not necessarily has a value\r\n */\r\nBaseValidator.prototype.present = function (errorMessage?: string) {\r\n return this.setRequiredRule(presentRule, errorMessage);\r\n};\r\n\r\n/**\r\n * Mark the field as optional — it may be absent or empty without validation errors.\r\n * Clears any previously set required rule.\r\n *\r\n * The return type is branded with `{ isOptional: true }` so schema inference\r\n * can mark this key as optional in the inferred TypeScript type.\r\n */\r\nBaseValidator.prototype.optional = function (): BaseValidator & { isOptional: true } {\r\n const instance = this.instance;\r\n instance.isOptional = true;\r\n instance.requiredRule = null;\r\n return instance as BaseValidator & { isOptional: true };\r\n};\r\n\r\n/**\r\n * Sugar — equivalent to `.optional().nullable()`.\r\n */\r\nBaseValidator.prototype.nullish = function (): BaseValidator & {\r\n isOptional: true;\r\n isNullable: true;\r\n} {\r\n const instance = this.optional().nullable();\r\n return instance as BaseValidator & { isOptional: true; isNullable: true };\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON FIELD PRESENCE ====================\r\n\r\n/**\r\n * Value is required if another field exists\r\n */\r\nBaseValidator.prototype.requiredWith = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithRule, errorMessage, { field, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field exists\r\n */\r\nBaseValidator.prototype.requiredWithSibling = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithRule, errorMessage, { field, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if another field is missing\r\n */\r\nBaseValidator.prototype.requiredWithout = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithoutRule, errorMessage, { field, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field is missing\r\n */\r\nBaseValidator.prototype.requiredWithoutSibling = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithoutRule, errorMessage, { field, scope: \"sibling\" });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON FIELD VALUE ====================\r\n\r\n/**\r\n * Value is required if another field equals a specific value\r\n */\r\nBaseValidator.prototype.requiredIf = function (field: string, value: any, errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfRule, errorMessage, { field, value, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field equals a specific value\r\n */\r\nBaseValidator.prototype.requiredIfSibling = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfRule, errorMessage, { field, value, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required unless another field equals a specific value\r\n */\r\nBaseValidator.prototype.requiredUnless = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredUnlessRule, errorMessage, { field, value, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required unless another sibling field equals a specific value\r\n */\r\nBaseValidator.prototype.requiredUnlessSibling = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredUnlessRule, errorMessage, { field, value, scope: \"sibling\" });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON FIELD EMPTY STATE ====================\r\n\r\n/**\r\n * Value is required if another field is empty\r\n */\r\nBaseValidator.prototype.requiredIfEmpty = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfEmptyRule, errorMessage, { field, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field is empty\r\n */\r\nBaseValidator.prototype.requiredIfEmptySibling = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfEmptyRule, errorMessage, { field, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if another field is not empty\r\n */\r\nBaseValidator.prototype.requiredIfNotEmpty = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfNotEmptyRule, errorMessage, { field, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field is not empty\r\n */\r\nBaseValidator.prototype.requiredIfNotEmptySibling = function (\r\n field: string,\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfNotEmptyRule, errorMessage, { field, scope: \"sibling\" });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON MULTIPLE FIELDS EMPTY STATE ====================\r\n\r\n/**\r\n * Value is required if ALL specified fields are empty\r\n */\r\nBaseValidator.prototype.requiredIfAllEmpty = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfAllEmptyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if ALL specified sibling fields are empty\r\n */\r\nBaseValidator.prototype.requiredIfAllEmptySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfAllEmptyRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if ANY of the specified fields is empty\r\n */\r\nBaseValidator.prototype.requiredIfAnyEmpty = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfAnyEmptyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if ANY of the specified sibling fields is empty\r\n */\r\nBaseValidator.prototype.requiredIfAnyEmptySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfAnyEmptyRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if ALL specified fields are NOT empty\r\n */\r\nBaseValidator.prototype.requiredIfAllNotEmpty = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfAllNotEmptyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if ALL specified sibling fields are NOT empty\r\n */\r\nBaseValidator.prototype.requiredIfAllNotEmptySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfAllNotEmptyRule, errorMessage, {\r\n fields,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is required if ANY of the specified fields is NOT empty\r\n */\r\nBaseValidator.prototype.requiredIfAnyNotEmpty = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfAnyNotEmptyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if ANY of the specified sibling fields is NOT empty\r\n */\r\nBaseValidator.prototype.requiredIfAnyNotEmptySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfAnyNotEmptyRule, errorMessage, {\r\n fields,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is required if another field's value is in the given array\r\n */\r\nBaseValidator.prototype.requiredIfIn = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfInRule, errorMessage, { field, values, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field's value is in the given array\r\n */\r\nBaseValidator.prototype.requiredIfInSibling = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfInRule, errorMessage, { field, values, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if another field's value is NOT in the given array\r\n */\r\nBaseValidator.prototype.requiredIfNotIn = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfNotInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field's value is NOT in the given array\r\n */\r\nBaseValidator.prototype.requiredIfNotInSibling = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfNotInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON MULTIPLE FIELDS (ALL) ====================\r\n\r\n/**\r\n * Value is required if all specified fields exist\r\n */\r\nBaseValidator.prototype.requiredWithAll = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithAllRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if all specified sibling fields exist\r\n */\r\nBaseValidator.prototype.requiredWithAllSiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredWithAllRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if all specified fields are missing\r\n */\r\nBaseValidator.prototype.requiredWithoutAll = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithoutAllRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if all specified sibling fields are missing\r\n */\r\nBaseValidator.prototype.requiredWithoutAllSiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredWithoutAllRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON MULTIPLE FIELDS (ANY) ====================\r\n\r\n/**\r\n * Value is required if any of the specified fields exists\r\n */\r\nBaseValidator.prototype.requiredWithAny = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithAnyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if any of the specified sibling fields exists\r\n */\r\nBaseValidator.prototype.requiredWithAnySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredWithAnyRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if any of the specified fields is missing\r\n */\r\nBaseValidator.prototype.requiredWithoutAny = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithoutAnyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if any of the specified sibling fields is missing\r\n */\r\nBaseValidator.prototype.requiredWithoutAnySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredWithoutAnyRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON CUSTOM CALLBACK ====================\r\n\r\n/**\r\n * Make this field required based on a custom callback.\r\n * Callback receives only SchemaContext — the framework handles empty-value checking.\r\n */\r\nBaseValidator.prototype.requiredWhen = function (\r\n callback: (context: SchemaContext) => boolean | Promise<boolean>,\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredWhenRule, errorMessage, { callback });\r\n};\r\n","import { allowedValuesRule, enumRule, inRule, notAllowedValuesRule } from \"../rules\";\nimport { BaseValidator } from \"./base-validator\";\n\n/**\n * Abstract base validator for primitive-typed fields (string, number, boolean).\n *\n * Provides value-membership rules that are meaningful for any single primitive value\n * but not for complex structures (object, array).\n *\n * Do NOT expose this on the `v` factory — it is an inheritance-only base class.\n *\n * Hierarchy:\n * BaseValidator\n * └── PrimitiveValidator ← enum, in, oneOf, allowsOnly, forbids, notIn\n * ├── StringValidator\n * ├── NumberValidator\n * │ └── FloatValidator\n * ├── BooleanValidator\n * └── ScalarValidator (extends PrimitiveValidator, adds asNumber/asString/accepted/declined)\n *\n * @example\n * class MyValidator extends PrimitiveValidator {\n * // inherits: in(), forbids(), enum(), oneOf(), allowsOnly(), notIn()\n * }\n */\nexport abstract class PrimitiveValidator extends BaseValidator {\n /**\n * Value must be one of the enum's values\n *\n * @example\n * v.string().enum(Direction) // Direction is a TS enum\n */\n public enum(values: any, errorMessage?: string) {\n return this.addRule(enumRule, errorMessage, { enum: Object.values(values) });\n }\n\n /**\n * Value must be one of the given values\n *\n * @example\n * v.string().in([\"admin\", \"user\", \"guest\"])\n * v.number().in([1, 2, 3])\n */\n public in(values: any[], errorMessage?: string) {\n return this.addRule(inRule, errorMessage, { values });\n }\n\n /**\n * Alias for `in()`\n *\n * @example\n * v.string().oneOf([\"active\", \"inactive\"])\n */\n public oneOf(values: any[], errorMessage?: string) {\n return this.in(values, errorMessage);\n }\n\n /**\n * Value must be one of the allowed values (stricter variant)\n *\n * @example\n * v.string().allowsOnly([\"yes\", \"no\"])\n */\n public allowsOnly(values: any[], errorMessage?: string) {\n return this.addRule(allowedValuesRule, errorMessage, { allowedValues: values });\n }\n\n /**\n * Value must NOT be one of the given values\n *\n * @example\n * v.string().forbids([\"banned\", \"blacklisted\"])\n * v.number().forbids([0, -1])\n */\n public forbids(values: any[], errorMessage?: string) {\n return this.addRule(notAllowedValuesRule, errorMessage, { notAllowedValues: values });\n }\n\n /**\n * Alias for `forbids()`\n *\n * @example\n * v.string().notIn([\"OK\", \"NOT OK\"])\n */\n public notIn(values: any[], errorMessage?: string) {\n return this.forbids(values, errorMessage);\n }\n}\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\nconst isAcceptedValue = (value: any) => {\r\n return [\"1\", \"true\", \"yes\", \"y\", \"on\", 1, true, \"Yes\", \"Y\", \"On\"].includes(value);\r\n};\r\n\r\n/**\r\n * Validate value as accepted if it equals:\r\n * 1 | \"1\" | true | \"true\" | \"yes\" | \"y\" | \"on\"\r\n */\r\nexport const acceptedRule: SchemaRule = {\r\n name: \"accepted\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n description:\r\n \"The value must be accepted if it equals: 1 | '1' | true | 'true' | 'yes' | 'y' | 'on' | 1 | true | 'Yes' | 'Y' | 'On'\",\r\n async validate(value: any, context) {\r\n if (isAcceptedValue(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Accepted value if another field's value equals to a specific value\r\n */\r\nexport const acceptedIfRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"acceptedIf\",\r\n description: \"The field must be accepted if :field's value equals to :value\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n if (fieldValue !== expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is not equal to the given value\r\n */\r\nexport const acceptedUnlessRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"acceptedUnless\",\r\n description: \"The field must be accepted if :field's value is not equal to :value\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n if (fieldValue === expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is required\r\n */\r\nexport const acceptedIfRequiredRule: SchemaRule<{ field: string }> = {\r\n name: \"acceptedIfRequired\",\r\n description: \"The field must be accepted if :field is required\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is present\r\n */\r\nexport const acceptedIfPresentRule: SchemaRule<{ field: string }> = {\r\n name: \"acceptedIfPresent\",\r\n description: \"The field must be accepted if :field is present\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue === undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Accepted if another field is missing\r\n */\r\nexport const acceptedWithoutRule: SchemaRule<{ field: string }> = {\r\n name: \"acceptedWithout\",\r\n description: \"The field must be accepted if :field is missing\",\r\n defaultErrorMessage: \"The :input must be accepted\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue !== undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isAcceptedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\nconst isDeclinedValue = (value: any) => {\r\n return [\"0\", \"false\", \"no\", \"n\", \"off\", 0, false, \"No\", \"N\", \"Off\"].includes(value);\r\n};\r\n\r\n/**\r\n * Validate value as declined if it equals:\r\n * 0 | \"0\" | false | \"false\" | \"no\" | \"n\" | \"off\" | 0 | false | \"No\" | \"N\" | \"Off\"\r\n */\r\nexport const declinedRule: SchemaRule = {\r\n name: \"declined\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n description:\r\n \"The value must be declined if it equals: 0 | '0' | false | 'false' | 'no' | 'n' | 'off' | 0 | false | 'No' | 'N' | 'Off'\",\r\n async validate(value: any, context) {\r\n if (isDeclinedValue(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Declined value if another field's value equals to a specific value\r\n */\r\nexport const declinedIfRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"declinedIf\",\r\n description: \"The field must be declined if :field's value equals to :value\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n\r\n if (fieldValue !== expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is not equal to the given value\r\n */\r\nexport const declinedUnlessRule: SchemaRule<{ field: string; value: any }> = {\r\n name: \"declinedUnless\",\r\n description: \"The field must be declined if :field's value is not equal to :value\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n const { value: expectedValue } = this.context.options;\r\n\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translatableParams.value = this.context.options.value;\r\n if (fieldValue === expectedValue) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is required\r\n */\r\nexport const declinedIfRequiredRule: SchemaRule<{ field: string }> = {\r\n name: \"declinedIfRequired\",\r\n description: \"The field must be declined if :field is required\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (isEmptyValue(fieldValue)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is present\r\n */\r\nexport const declinedIfPresentRule: SchemaRule<{ field: string }> = {\r\n name: \"declinedIfPresent\",\r\n description: \"The field must be declined if :field is present\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue === undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Declined if another field is missing\r\n */\r\nexport const declinedWithoutRule: SchemaRule<{ field: string }> = {\r\n name: \"declinedWithout\",\r\n description: \"The field must be declined if :field is missing\",\r\n defaultErrorMessage: \"The :input must be declined\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n this.context.translatableParams.field = this.context.options.field;\r\n\r\n if (fieldValue !== undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (!isDeclinedValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n","import {\n acceptedIfPresentRule,\n acceptedIfRequiredRule,\n acceptedIfRule,\n acceptedRule,\n acceptedUnlessRule,\n acceptedWithoutRule,\n declinedIfPresentRule,\n declinedIfRequiredRule,\n declinedIfRule,\n declinedRule,\n declinedUnlessRule,\n declinedWithoutRule,\n} from \"../rules/scalar\";\nimport { booleanRule } from \"../rules\";\nimport { PrimitiveValidator } from \"./primitive-validator\";\nimport { applyNullable } from \"../standard-schema/json-schema\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\n\n/**\n * Boolean validator class\n *\n * Extends PrimitiveValidator — inherits enum/in/oneOf/allowsOnly/forbids/notIn.\n * Defines accepted/declined directly as real methods (not ScalarValidator field copies)\n * so they survive cloning correctly.\n */\nexport class BooleanValidator extends PrimitiveValidator {\n public constructor(errorMessage?: string) {\n super();\n this.addMutableRule(booleanRule, errorMessage);\n }\n\n /**\n * Check if value is a boolean type\n */\n public matchesType(value: any): boolean {\n return typeof value === \"boolean\";\n }\n\n // ==================== Accepted ====================\n\n /** Value must be accepted (true, \"yes\", 1, \"on\", etc.) */\n public accepted(errorMessage?: string) {\n return this.addRule(acceptedRule, errorMessage);\n }\n\n /** Value must be accepted if another field equals a value */\n public acceptedIf(field: string, value: any, errorMessage?: string) {\n return this.addRule(acceptedIfRule, errorMessage, { field, value });\n }\n\n /** Value must be accepted unless another field equals a value */\n public acceptedUnless(field: string, value: any, errorMessage?: string) {\n return this.addRule(acceptedUnlessRule, errorMessage, { field, value });\n }\n\n /** Value must be accepted if another field is required */\n public acceptedIfRequired(field: string, errorMessage?: string) {\n return this.addRule(acceptedIfRequiredRule, errorMessage, { field });\n }\n\n /** Value must be accepted if another field is present */\n public acceptedIfPresent(field: string, errorMessage?: string) {\n return this.addRule(acceptedIfPresentRule, errorMessage, { field });\n }\n\n /** Value must be accepted if another field is missing */\n public acceptedWithout(field: string, errorMessage?: string) {\n return this.addRule(acceptedWithoutRule, errorMessage, { field });\n }\n\n // ==================== Declined ====================\n\n /** Value must be declined (false, \"no\", 0, \"off\", etc.) */\n public declined(errorMessage?: string) {\n return this.addRule(declinedRule, errorMessage);\n }\n\n /** Value must be declined if another field equals a value */\n public declinedIf(field: string, value: any, errorMessage?: string) {\n return this.addRule(declinedIfRule, errorMessage, { field, value });\n }\n\n /** Value must be declined unless another field equals a value */\n public declinedUnless(field: string, value: any, errorMessage?: string) {\n return this.addRule(declinedUnlessRule, errorMessage, { field, value });\n }\n\n /** Value must be declined if another field is required */\n public declinedIfRequired(field: string, errorMessage?: string) {\n return this.addRule(declinedIfRequiredRule, errorMessage, { field });\n }\n\n /** Value must be declined if another field is present */\n public declinedIfPresent(field: string, errorMessage?: string) {\n return this.addRule(declinedIfPresentRule, errorMessage, { field });\n }\n\n /** Value must be declined if another field is missing */\n public declinedWithout(field: string, errorMessage?: string) {\n return this.addRule(declinedWithoutRule, errorMessage, { field });\n }\n\n // ==================== Strict boolean checks ====================\n\n /**\n * Value must be strictly true (not \"yes\", \"on\", 1, etc.)\n * @alias accepted - strict version\n */\n public mustBeTrue(errorMessage?: string) {\n return this.equal(true, errorMessage);\n }\n\n /**\n * Value must be strictly false (not \"no\", \"off\", 0, etc.)\n * @alias declined - strict version\n */\n public mustBeFalse(errorMessage?: string) {\n return this.equal(false, errorMessage);\n }\n\n /**\n * @inheritdoc\n *\n * @note accepted/declined rules and all cross-field boolean rules\n * are not representable in JSON Schema and are silently omitted.\n *\n * @example\n * ```ts\n * v.boolean().toJsonSchema(\"draft-2020-12\")\n * // → { type: \"boolean\" }\n *\n * v.boolean().nullable().toJsonSchema(\"openapi-3.0\")\n * // → { type: \"boolean\", nullable: true }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const schema: JsonSchemaResult = { type: \"boolean\" };\n if (this.isNullable) applyNullable(schema, target);\n return schema;\n }\n}\n","import type { SchemaContext, ValidationResult } from \"../types\";\nimport { BaseValidator } from \"./base-validator\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\n\n/**\n * Callback function for computed fields\n * Receives validated & mutated data and full schema context\n */\nexport type ComputedCallback<TResult = any> = (\n data: any,\n context: SchemaContext,\n) => TResult | Promise<TResult>;\n\n/**\n * Computed field validator\n *\n * Computes a value based on other validated fields in the schema.\n * The computed value is persisted and can optionally be validated.\n *\n * @example\n * ```ts\n * // Basic computed field\n * const schema = v.object({\n * title: v.string().required(),\n * slug: v.computed(data => slugify(data.title)),\n * });\n *\n * // With result validation\n * const schema = v.object({\n * title: v.string().required(),\n * slug: v.computed(\n * data => slugify(data.title),\n * v.string().minLength(3)\n * ),\n * });\n *\n * // Async computation\n * const schema = v.object({\n * image: v.string().url(),\n * thumbnail: v.computed(async data => {\n * return await generateThumbnail(data.image);\n * }),\n * });\n * ```\n */\nexport class ComputedValidator<TResult = any> extends BaseValidator {\n /**\n * Create a new computed field validator\n *\n * @param callback - Function to compute the value from validated data\n * @param resultValidator - Optional validator to validate the computed result\n */\n public constructor(\n protected callback: ComputedCallback<TResult>,\n protected resultValidator?: BaseValidator,\n ) {\n super();\n }\n\n /**\n * Execute the callback and optionally validate the result\n */\n public async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\n try {\n // Execute the callback with validated data\n const result = await this.callback(data, context);\n\n // Optionally validate the computed result\n if (this.resultValidator) {\n const validation = await this.resultValidator.validate(result, context);\n\n if (!validation.isValid) {\n return {\n isValid: false,\n errors: validation.errors,\n data: undefined,\n };\n }\n\n return {\n isValid: true,\n errors: [],\n data: validation.data,\n };\n }\n\n // No validation - return computed result directly\n return {\n isValid: true,\n errors: [],\n data: result,\n };\n } catch (error) {\n // Handle callback execution errors\n return {\n isValid: false,\n errors: [\n {\n type: \"computed\",\n error: error instanceof Error ? error.message : \"Computed field callback failed\",\n input: context.path,\n },\n ],\n data: undefined,\n };\n }\n }\n\n /**\n * Clone this validator with all its configuration\n * Critical for ObjectValidator.clone(), extend(), merge(), etc.\n */\n public override clone(): this {\n const cloned = super.clone();\n\n // Copy ComputedValidator-specific properties\n cloned.callback = this.callback; // Functions are safe to copy by reference\n cloned.resultValidator = this.resultValidator?.clone(); // Deep clone validator\n\n return cloned;\n }\n\n /**\n * Computed fields don't have a specific type to match\n */\n public matchesType(value: any): boolean {\n return true; // Computed fields accept any input (they generate their own value)\n }\n\n /**\n * @inheritdoc\n *\n * Computed fields are server-side runtime values — they have no input schema\n * and cannot be represented in JSON Schema. Calling this method is always a\n * programming error.\n *\n * @throws Error Always throws — computed/managed fields have no JSON Schema representation.\n */\n public override toJsonSchema(_target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n throw new Error(\n `[Seal] toJsonSchema() is not supported on ComputedValidator / ManagedValidator. ` +\n `Computed fields are runtime-only and have no input JSON Schema representation. ` +\n `ObjectValidator.toJsonSchema() automatically skips computed fields — ` +\n `do not call toJsonSchema() on a computed validator directly.`,\n );\n }\n}\n","import dayjs from \"dayjs\";\r\nimport {\r\n addDaysMutator,\r\n addHoursMutator,\r\n addMonthsMutator,\r\n addYearsMutator,\r\n dateMutator,\r\n toEndOfDayMutator,\r\n toEndOfMonthMutator,\r\n toEndOfYearMutator,\r\n toStartOfDayMutator,\r\n toStartOfMonthMutator,\r\n toStartOfYearMutator,\r\n toUTCMutator,\r\n} from \"../mutators\";\r\nimport {\r\n afterFieldRule,\r\n afterTodayRule,\r\n ageRule,\r\n beforeFieldRule,\r\n beforeHourRule,\r\n beforeMinuteRule,\r\n beforeTodayRule,\r\n betweenAgeRule,\r\n betweenDatesRule,\r\n betweenDaysRule,\r\n betweenHoursRule,\r\n betweenMinutesRule,\r\n betweenMonthsRule,\r\n betweenTimesRule,\r\n betweenYearsRule,\r\n birthdayRule,\r\n businessDayRule,\r\n dateRule,\r\n fromHourRule,\r\n fromMinuteRule,\r\n fromTodayRule,\r\n futureRule,\r\n leapYearRule,\r\n maxAgeRule,\r\n maxDateRule,\r\n maxDayRule,\r\n maxMonthRule,\r\n maxYearRule,\r\n minAgeRule,\r\n minDateRule,\r\n minDayRule,\r\n minMonthRule,\r\n minYearRule,\r\n type Month,\r\n monthRule,\r\n pastRule,\r\n quarterRule,\r\n sameAsFieldDateRule,\r\n todayRule,\r\n weekDayRule,\r\n weekdaysRule,\r\n weekendRule,\r\n withinDaysRule,\r\n withinFutureDaysRule,\r\n withinPastDaysRule,\r\n yearRule,\r\n} from \"../rules\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\nimport { applyNullable, getRuleOptions } from \"../standard-schema/json-schema\";\r\nimport type { WeekDay } from \"../types/date-types\";\r\nimport { isDateValue } from \"./../helpers/date-helpers\";\r\nimport { BaseValidator } from \"./base-validator\";\r\n\r\n/**\r\n * Date validator class\r\n */\r\nexport class DateValidator extends BaseValidator {\r\n public constructor(errorMessage?: string) {\r\n super();\r\n this.addMutableMutator(dateMutator); // Normalize to Date object first\r\n this.addMutableRule(dateRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is a Date type\r\n */\r\n public matchesType(value: any): boolean {\r\n return isDateValue(value);\r\n }\r\n\r\n // ==================== Output Transformers ====================\r\n // These transform the Date after validation into different formats\r\n\r\n /**\r\n * Convert date to ISO string format\r\n * @category transformer\r\n */\r\n public toISOString() {\r\n return this.addTransformer((data) => (data instanceof Date ? data.toISOString() : data));\r\n }\r\n\r\n /** Convert date to Unix timestamp (milliseconds) */\r\n public toTimestamp() {\r\n return this.addTransformer((data) => (data instanceof Date ? data.getTime() : data));\r\n }\r\n\r\n // ==================== String Format Transformers ====================\r\n // These convert Date to formatted strings after validation\r\n\r\n /** Convert date to specific format using dayjs */\r\n public toFormat(format: string) {\r\n return this.addTransformer(\r\n (data, { options }) => (data instanceof Date ? dayjs(data).format(options.format) : data),\r\n { format },\r\n );\r\n }\r\n\r\n /** Convert to date only (remove time, returns YYYY-MM-DD) */\r\n public toDateOnly() {\r\n return this.addTransformer(\r\n (data) => (data instanceof Date ? dayjs(data).format(\"YYYY-MM-DD\") : data),\r\n { __jsonSchemaFormat: \"date\" },\r\n );\r\n }\r\n\r\n /** Convert to time only (returns HH:MM:SS) */\r\n public toTimeOnly() {\r\n return this.addTransformer(\r\n (data) => (data instanceof Date ? dayjs(data).format(\"HH:mm:ss\") : data),\r\n { __jsonSchemaFormat: \"time\" },\r\n );\r\n }\r\n\r\n // ==================== Date Mutators ====================\r\n // These modify the Date object before validation\r\n\r\n /**\r\n * Convert date to start of day (00:00:00)\r\n * @category mutator\r\n */\r\n public toStartOfDay() {\r\n return this.addMutator(toStartOfDayMutator);\r\n }\r\n\r\n /** Convert date to end of day (23:59:59.999) */\r\n public toEndOfDay() {\r\n return this.addMutator(toEndOfDayMutator);\r\n }\r\n\r\n /** Add or subtract days from date */\r\n public addDays(days: number) {\r\n return this.addMutator(addDaysMutator, { days });\r\n }\r\n\r\n /** Add or subtract months from date */\r\n public addMonths(months: number) {\r\n return this.addMutator(addMonthsMutator, { months });\r\n }\r\n\r\n /** Add or subtract years from date */\r\n public addYears(years: number) {\r\n return this.addMutator(addYearsMutator, { years });\r\n }\r\n\r\n /** Add or subtract hours from date */\r\n public addHours(hours: number) {\r\n return this.addMutator(addHoursMutator, { hours });\r\n }\r\n\r\n /** Convert date to UTC */\r\n public toUTC() {\r\n return this.addMutator(toUTCMutator);\r\n }\r\n\r\n // ==================== Date Range Mutators ====================\r\n\r\n /** Set to start of month */\r\n public toStartOfMonth() {\r\n return this.addMutator(toStartOfMonthMutator);\r\n }\r\n\r\n /** Set to end of month */\r\n public toEndOfMonth() {\r\n return this.addMutator(toEndOfMonthMutator);\r\n }\r\n\r\n /** Set to start of year */\r\n public toStartOfYear() {\r\n return this.addMutator(toStartOfYearMutator);\r\n }\r\n\r\n /** Set to end of year */\r\n public toEndOfYear() {\r\n return this.addMutator(toEndOfYearMutator);\r\n }\r\n\r\n // ==================== Date Comparison ====================\r\n\r\n /**\r\n * Date must be greater than or equal to the given date or field (inclusive)\r\n *\r\n * Smart detection:\r\n * - Date instance, timestamp, or date string (with - or /) → value comparison\r\n * - Plain string → field comparison\r\n *\r\n * @param dateOrField - Date, timestamp, date string, or field name\r\n *\r\n * @example\r\n * ```ts\r\n * // Value comparison\r\n * v.date().min('2024-01-01')\r\n * v.date().min(new Date())\r\n * v.date().min(1698278400000)\r\n *\r\n * // Field comparison\r\n * v.date().min('startsAt')\r\n * ```\r\n *\r\n * @category Validation Rule\r\n */\r\n public min(dateOrField: Date | string | number, errorMessage?: string): this {\r\n return this.addRule(minDateRule, errorMessage, {\r\n dateOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be less than or equal to the given date or field (inclusive)\r\n *\r\n * Smart detection:\r\n * - Date instance, timestamp, or date string (with - or /) → value comparison\r\n * - Plain string → field comparison\r\n *\r\n * @category Validation Rule\r\n */\r\n public max(dateOrField: Date | string | number, errorMessage?: string): this {\r\n return this.addRule(maxDateRule, errorMessage, {\r\n dateOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be strictly less than the given date or field (exclusive)\r\n *\r\n * Smart detection:\r\n * - Date instance, timestamp, or date string (with - or /) → value comparison\r\n * - Plain string → field comparison\r\n *\r\n * @category Validation Rule\r\n */\r\n public before(dateOrField: Date | string | number, errorMessage?: string): this {\r\n return this.addRule(beforeFieldRule, errorMessage, {\r\n dateOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be strictly greater than the given date or field (exclusive)\r\n *\r\n * Smart detection:\r\n * - Date instance, timestamp, or date string (with - or /) → value comparison\r\n * - Plain string → field comparison\r\n *\r\n * @category Validation Rule\r\n */\r\n public after(dateOrField: Date | string | number, errorMessage?: string): this {\r\n return this.addRule(afterFieldRule, errorMessage, {\r\n dateOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /** Date must be between start and end dates */\r\n public between(startDate: Date, endDate: Date, errorMessage?: string) {\r\n return this.addRule(betweenDatesRule, errorMessage, { startDate, endDate });\r\n }\r\n\r\n /** Date must be exactly today */\r\n public today(errorMessage?: string) {\r\n return this.addRule(todayRule, errorMessage);\r\n }\r\n\r\n /** Date must be today or in the future */\r\n public fromToday(errorMessage?: string) {\r\n return this.addRule(fromTodayRule, errorMessage);\r\n }\r\n\r\n /** Date must be before today */\r\n public beforeToday(errorMessage?: string) {\r\n return this.addRule(beforeTodayRule, errorMessage);\r\n }\r\n\r\n /** Date must be after today (not including today) */\r\n public afterToday(errorMessage?: string) {\r\n return this.addRule(afterTodayRule, errorMessage);\r\n }\r\n\r\n /** Date must be in the past */\r\n public past(errorMessage?: string) {\r\n return this.addRule(pastRule, errorMessage);\r\n }\r\n\r\n /** Date must be in the future */\r\n public future(errorMessage?: string) {\r\n return this.addRule(futureRule, errorMessage);\r\n }\r\n\r\n // ==================== Sibling Field Comparison ====================\r\n // Explicit sibling scope methods\r\n\r\n /**\r\n * Date must be >= sibling field value (inclusive)\r\n * @category Validation Rule\r\n */\r\n public minSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(minDateRule, errorMessage, {\r\n dateOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be <= sibling field value (inclusive)\r\n * @category Validation Rule\r\n */\r\n public maxSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(maxDateRule, errorMessage, {\r\n dateOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be < sibling field value (exclusive)\r\n * @category Validation Rule\r\n */\r\n public beforeSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(beforeFieldRule, errorMessage, {\r\n dateOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be > sibling field value (exclusive)\r\n * @category Validation Rule\r\n */\r\n public afterSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(afterFieldRule, errorMessage, {\r\n dateOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /** Date must be the same as another field's date */\r\n public sameAsField(field: string, errorMessage?: string) {\r\n return this.addRule(sameAsFieldDateRule, errorMessage, {\r\n field,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /** Date must be the same as another sibling field's date */\r\n public sameAsFieldSibling(field: string, errorMessage?: string) {\r\n return this.addRule(sameAsFieldDateRule, errorMessage, {\r\n field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n // ==================== Time Validation ====================\r\n\r\n /** Time must be from specific hour onwards (0-23) */\r\n public fromHour(hour: number, errorMessage?: string) {\r\n return this.addRule(fromHourRule, errorMessage, { hour });\r\n }\r\n\r\n /** Time must be before specific hour (0-23) */\r\n public beforeHour(hour: number, errorMessage?: string) {\r\n return this.addRule(beforeHourRule, errorMessage, { hour });\r\n }\r\n\r\n /** Time must be between start and end hours (0-23) */\r\n public betweenHours(startHour: number, endHour: number, errorMessage?: string) {\r\n return this.addRule(betweenHoursRule, errorMessage, { startHour, endHour });\r\n }\r\n\r\n /** Time must be from specific minute onwards (0-59) */\r\n public fromMinute(minute: number, errorMessage?: string) {\r\n return this.addRule(fromMinuteRule, errorMessage, { minute });\r\n }\r\n\r\n /** Time must be before specific minute (0-59) */\r\n public beforeMinute(minute: number, errorMessage?: string) {\r\n return this.addRule(beforeMinuteRule, errorMessage, { minute });\r\n }\r\n\r\n /** Time must be between start and end minutes (0-59) */\r\n public betweenMinutes(startMinute: number, endMinute: number, errorMessage?: string) {\r\n return this.addRule(betweenMinutesRule, errorMessage, {\r\n startMinute,\r\n endMinute,\r\n });\r\n }\r\n\r\n /** Time must be between start and end times (HH:MM format) */\r\n public betweenTimes(startTime: string, endTime: string, errorMessage?: string) {\r\n return this.addRule(betweenTimesRule, errorMessage, { startTime, endTime });\r\n }\r\n\r\n // ==================== Age Validation ====================\r\n\r\n /** Age must be exactly the given years */\r\n public age(years: number, errorMessage?: string) {\r\n return this.addRule(ageRule, errorMessage, { years });\r\n }\r\n\r\n /** Minimum age requirement */\r\n public minAge(years: number, errorMessage?: string) {\r\n return this.addRule(minAgeRule, errorMessage, { years });\r\n }\r\n\r\n /** Maximum age requirement */\r\n public maxAge(years: number, errorMessage?: string) {\r\n return this.addRule(maxAgeRule, errorMessage, { years });\r\n }\r\n\r\n /** Age must be between min and max years */\r\n public betweenAge(minAge: number, maxAge: number, errorMessage?: string) {\r\n return this.addRule(betweenAgeRule, errorMessage, { minAge, maxAge });\r\n }\r\n\r\n // ==================== Day Validation ====================\r\n\r\n /** Date must be specific weekday */\r\n public weekDay(day: WeekDay, errorMessage?: string) {\r\n return this.addRule(weekDayRule, errorMessage, { day });\r\n }\r\n\r\n /** Date must be one of specified weekdays */\r\n public weekdays(days: WeekDay[], errorMessage?: string) {\r\n return this.addRule(weekdaysRule, errorMessage, { days });\r\n }\r\n\r\n /** Date must be a weekend (Saturday or Sunday) */\r\n public weekend(errorMessage?: string) {\r\n return this.addRule(weekendRule, errorMessage);\r\n }\r\n\r\n /** Date must be a business day (Monday-Friday) */\r\n public businessDay(errorMessage?: string) {\r\n return this.addRule(businessDayRule, errorMessage);\r\n }\r\n\r\n /** Date must match specific format */\r\n public format(format: string, errorMessage?: string) {\r\n return this.addRule(dateRule, errorMessage, { format });\r\n }\r\n\r\n // ==================== Relative Date Validation ====================\r\n\r\n /** Date must be within X days from now (past or future) */\r\n public withinDays(days: number, errorMessage?: string) {\r\n return this.addRule(withinDaysRule, errorMessage, { days });\r\n }\r\n\r\n /** Date must be within X days in the past */\r\n public withinPastDays(days: number, errorMessage?: string) {\r\n return this.addRule(withinPastDaysRule, errorMessage, { days });\r\n }\r\n\r\n /** Date must be within X days in the future */\r\n public withinFutureDays(days: number, errorMessage?: string) {\r\n return this.addRule(withinFutureDaysRule, errorMessage, { days });\r\n }\r\n\r\n // ==================== Period Validation ====================\r\n\r\n /** Date must be in specific month (1-12) */\r\n public month(month: Month, errorMessage?: string) {\r\n return this.addRule(monthRule, errorMessage, { month });\r\n }\r\n\r\n /** Date must be in specific year */\r\n public year(year: number, errorMessage?: string) {\r\n return this.addRule(yearRule, errorMessage, { year });\r\n }\r\n\r\n /**\r\n * Date must be between start and end years\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public betweenYears(startYear: number | string, endYear: number | string, errorMessage?: string) {\r\n return this.addRule(betweenYearsRule, errorMessage, {\r\n startYear,\r\n endYear,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be between start and end months (1-12)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public betweenMonths(\r\n startMonth: Month | string,\r\n endMonth: Month | string,\r\n errorMessage?: string,\r\n ) {\r\n return this.addRule(betweenMonthsRule, errorMessage, {\r\n startMonth,\r\n endMonth,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be between start and end days (1-31)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public betweenDays(startDay: number | string, endDay: number | string, errorMessage?: string) {\r\n return this.addRule(betweenDaysRule, errorMessage, {\r\n startDay,\r\n endDay,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be between sibling field years\r\n * @category Validation Rule\r\n */\r\n public betweenYearsSibling(startYearField: string, endYearField: string, errorMessage?: string) {\r\n return this.addRule(betweenYearsRule, errorMessage, {\r\n startYear: startYearField,\r\n endYear: endYearField,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be between sibling field months\r\n * @category Validation Rule\r\n */\r\n public betweenMonthsSibling(\r\n startMonthField: string,\r\n endMonthField: string,\r\n errorMessage?: string,\r\n ) {\r\n return this.addRule(betweenMonthsRule, errorMessage, {\r\n startMonth: startMonthField,\r\n endMonth: endMonthField,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Date must be between sibling field days\r\n * @category Validation Rule\r\n */\r\n public betweenDaysSibling(startDayField: string, endDayField: string, errorMessage?: string) {\r\n return this.addRule(betweenDaysRule, errorMessage, {\r\n startDay: startDayField,\r\n endDay: endDayField,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Year must be >= given year or field\r\n * Smart detection: number or field name\r\n *\r\n * @example\r\n * ```ts\r\n * // Value comparison\r\n * v.date().minYear(2024)\r\n *\r\n * // Field comparison\r\n * v.date().minYear('startYear')\r\n * ```\r\n *\r\n * @category Validation Rule\r\n */\r\n public minYear(yearOrField: number | string, errorMessage?: string): this {\r\n return this.addRule(minYearRule, errorMessage, {\r\n yearOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Year must be <= given year or field\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public maxYear(yearOrField: number | string, errorMessage?: string): this {\r\n return this.addRule(maxYearRule, errorMessage, {\r\n yearOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Month must be >= given month or field (1-12)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public minMonth(monthOrField: number | string, errorMessage?: string): this {\r\n return this.addRule(minMonthRule, errorMessage, {\r\n monthOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Month must be <= given month or field (1-12)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public maxMonth(monthOrField: Month | string, errorMessage?: string): this {\r\n return this.addRule(maxMonthRule, errorMessage, {\r\n monthOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Day must be >= given day or field (1-31)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public minDay(dayOrField: number | string, errorMessage?: string): this {\r\n return this.addRule(minDayRule, errorMessage, {\r\n dayOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Day must be <= given day or field (1-31)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public maxDay(dayOrField: number | string, errorMessage?: string): this {\r\n return this.addRule(maxDayRule, errorMessage, {\r\n dayOrField,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Year must be >= sibling field year\r\n * @category Validation Rule\r\n */\r\n public minYearSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(minYearRule, errorMessage, {\r\n yearOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Year must be <= sibling field year\r\n * @category Validation Rule\r\n */\r\n public maxYearSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(maxYearRule, errorMessage, {\r\n yearOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Month must be >= sibling field month\r\n * @category Validation Rule\r\n */\r\n public minMonthSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(minMonthRule, errorMessage, {\r\n monthOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Month must be <= sibling field month\r\n * @category Validation Rule\r\n */\r\n public maxMonthSibling(field: string, errorMessage?: string): this {\r\n return this.addRule(maxMonthRule, errorMessage, {\r\n monthOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Day must be >= sibling field day\r\n * @category Validation Rule\r\n */\r\n public minDaySibling(field: string, errorMessage?: string): this {\r\n return this.addRule(minDayRule, errorMessage, {\r\n dayOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Day must be <= sibling field day\r\n * @category Validation Rule\r\n */\r\n public maxDaySibling(field: string, errorMessage?: string): this {\r\n return this.addRule(maxDayRule, errorMessage, {\r\n dayOrField: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /** Date must be in specific quarter (1-4) */\r\n public quarter(quarter: 1 | 2 | 3 | 4, errorMessage?: string) {\r\n return this.addRule(quarterRule, errorMessage, { quarter });\r\n }\r\n\r\n // ==================== Special Validation ====================\r\n\r\n /** Valid birthday (not in future, reasonable age) */\r\n public birthday(minAge?: number, maxAge?: number, errorMessage?: string) {\r\n return this.addRule(birthdayRule, errorMessage, { minAge, maxAge });\r\n }\r\n\r\n /** Date must be in a leap year */\r\n public leapYear(errorMessage?: string) {\r\n return this.addRule(leapYearRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Set default value as current time of exeuction\r\n */\r\n public defaultNow() {\r\n return this.default(() => new Date());\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Maps DateValidator to JSON Schema format keywords.\r\n * Default is `date-time`. If `.toDateOnly()` or `.toTimeOnly()` are used,\r\n * falls back to `date` or `time` formats respectively.\r\n *\r\n * @example\r\n * ```ts\r\n * v.date().toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"string\", format: \"date-time\" }\r\n *\r\n * v.date().toDateOnly().toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"string\", format: \"date\" }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const schema: JsonSchemaResult = { type: \"string\", format: \"date-time\" };\r\n\r\n // Check if an explicit format rule was applied via v.date().format()\r\n const dateOpts = getRuleOptions(this.rules, \"date\");\r\n if (dateOpts?.format === \"YYYY-MM-DD\") {\r\n schema.format = \"date\";\r\n } else if (dateOpts?.format === \"HH:mm:ss\") {\r\n schema.format = \"time\";\r\n }\r\n\r\n // Transformer-based detection (marker-driven; minifier-safe).\r\n // toDateOnly/toTimeOnly tag their options bag with __jsonSchemaFormat.\r\n // toFormat() exposes the user-supplied format string in options.format.\r\n if (schema.format === \"date-time\") {\r\n for (const t of this.dataTransformers) {\r\n const hint = t.options?.__jsonSchemaFormat;\r\n if (hint === \"date\" || hint === \"time\") {\r\n schema.format = hint;\r\n break;\r\n }\r\n\r\n const userFormat = t.options?.format;\r\n\r\n if (userFormat === \"YYYY-MM-DD\") {\r\n schema.format = \"date\";\r\n break;\r\n }\r\n\r\n if (userFormat === \"HH:mm:ss\") {\r\n schema.format = \"time\";\r\n break;\r\n }\r\n }\r\n }\r\n\r\n if (this.isNullable) applyNullable(schema, target);\r\n\r\n return schema;\r\n }\r\n}\r\n","import { isEmptyValue } from \"../helpers/is-empty-value\";\nimport { literalRule } from \"../rules/common/literal\";\nimport { presentRule } from \"../rules/core/required\";\nimport { applyNullable } from \"../standard-schema/json-schema\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport { BaseValidator } from \"./base-validator\";\n\n/**\n * Literal validator class\n *\n * Accepts a fixed tuple of primitive literal values (string, number, boolean).\n * The TypeScript type narrows to the union of those literals — `v.literal(\"a\", \"b\")`\n * infers as `\"a\" | \"b\"`, not `string`. Use for discriminator fields, enum-like\n * unions of constants, and any case where `oneOf([...])` would lose literal types.\n *\n * @example\n * v.literal(\"items\") // type: \"items\"\n * v.literal(\"draft\", \"published\") // type: \"draft\" | \"published\"\n * v.literal(1, 2, 3) // type: 1 | 2 | 3\n * v.literal(true) // type: true\n */\nexport class LiteralValidator<\n T extends readonly (string | number | boolean)[] = readonly (string | number | boolean)[],\n> extends BaseValidator {\n public values: T;\n\n public constructor(values: T, errorMessage?: string) {\n super();\n this.values = values;\n this.addMutableRule(literalRule, errorMessage, { values });\n\n // `\"\"` is a value, not an absence. Every validator is required by default,\n // and `required` rejects anything `isEmptyValue` calls empty — including the\n // empty string — so `v.literal(\"\")` could never pass. When the author has\n // explicitly listed an empty value as acceptable, swap `required` for\n // `present`: the key must still exist, but judging the value is the literal\n // set's job, and it is already the stricter statement of intent.\n //\n // Dropping the rule entirely instead would make a missing key valid, which\n // is the opposite mistake — `alt=\"\"` and no `alt` at all are different\n // things to a screen reader, and to anything else reading the schema.\n if (values.some(value => isEmptyValue(value))) {\n this.requiredRule = this.createRule(presentRule);\n }\n }\n\n /**\n * Check if value is one of the configured literals\n */\n public matchesType(value: any): boolean {\n return (this.values as readonly any[]).includes(value);\n }\n\n /**\n * Clone the validator, preserving the literal `values` set.\n *\n * The base `clone()` only copies `BaseValidator` fields, so without this\n * override a cloned literal loses its public `values` array — which breaks\n * any consumer that reads it (e.g. `discriminatedUnion` branch routing).\n */\n public override clone(): this {\n const cloned = super.clone();\n cloned.values = this.values;\n return cloned;\n }\n\n /**\n * @inheritdoc\n *\n * Single literal → `{ const: <value> }`. Multiple → `{ enum: [...] }`.\n *\n * @example\n * ```ts\n * v.literal(\"items\").toJsonSchema()\n * // → { const: \"items\" }\n *\n * v.literal(\"draft\", \"published\").toJsonSchema()\n * // → { enum: [\"draft\", \"published\"] }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const schema: JsonSchemaResult =\n this.values.length === 1 ? { const: this.values[0] } : { enum: [...this.values] };\n if (this.isNullable) applyNullable(schema, target);\n return schema;\n }\n}\n","import { isPlainObject } from \"@mongez/supportive-is\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport { applyNullable, wrapNullableStrict } from \"../standard-schema/json-schema\";\nimport type { SchemaContext, ValidationResult } from \"../types\";\nimport { BaseValidator } from \"./base-validator\";\nimport { LiteralValidator } from \"./literal-validator\";\nimport { ObjectValidator } from \"./object-validator\";\n\n/**\n * Discriminated union validator — routes payloads by a shared discriminator field.\n *\n * Plain `v.union()` falls back to `matchesType()` to pick a branch, which is\n * coarse for object-vs-object unions (every branch matches \"is plain object\").\n * Discriminated union reads a known field's value and routes directly to the\n * matching branch, producing precise errors instead of confused mash from the\n * wrong branch.\n *\n * **Construction-time validation.** Every branch must:\n * - Be an `ObjectValidator`\n * - Declare the discriminator field\n * - Type the discriminator as `v.literal(...)` (single or multi-literal both work)\n * - Not collide with another branch's literal values\n *\n * Misconfigurations throw eagerly so tests catch them at schema-build time.\n *\n * @example\n * ```ts\n * const email = v.object({ type: v.literal(\"email\"), email: v.string().email() });\n * const sms = v.object({ type: v.literal(\"sms\"), phone: v.string() });\n * const push = v.object({ type: v.literal(\"push\"), deviceId: v.string() });\n *\n * const notif = v.discriminatedUnion(\"type\", [email, sms, push]);\n *\n * await validate(notif, { type: \"sms\", phone: \"555-1234\" });\n * // → routes to sms branch only; errors (if any) come from sms\n * ```\n *\n * @see `domains/seal/plans/2026-05-12-discriminated-union.md`\n */\nexport class DiscriminatedUnionValidator<\n K extends string = string,\n Branches extends ReadonlyArray<ObjectValidator<any>> = ReadonlyArray<ObjectValidator<any>>,\n> extends BaseValidator {\n /** Map from discriminator literal value → matching branch validator. */\n private branches: Map<string | number | boolean, ObjectValidator<any>>;\n\n public constructor(\n public discriminator: K,\n public validators: Branches,\n ) {\n super();\n\n this.branches = DiscriminatedUnionValidator.buildBranchMap(discriminator, validators);\n }\n\n /**\n * Walk every branch, pull out the discriminator's literal values, and build\n * the lookup map. Throws on misconfiguration (missing discriminator,\n * non-literal discriminator, duplicate literal value).\n */\n private static buildBranchMap(\n discriminator: string,\n validators: ReadonlyArray<ObjectValidator<any>>,\n ): Map<string | number | boolean, ObjectValidator<any>> {\n const map = new Map<string | number | boolean, ObjectValidator<any>>();\n\n for (const branch of validators) {\n const discriminatorValidator = branch.schema?.[discriminator];\n\n if (!discriminatorValidator) {\n throw new Error(\n `[Seal] discriminatedUnion: branch missing discriminator field \"${discriminator}\"`,\n );\n }\n\n if (!(discriminatorValidator instanceof LiteralValidator)) {\n throw new Error(\n `[Seal] discriminatedUnion: discriminator \"${discriminator}\" must be v.literal(...) on every branch`,\n );\n }\n\n for (const value of discriminatorValidator.values) {\n if (map.has(value)) {\n throw new Error(\n `[Seal] discriminatedUnion: duplicate discriminator value \"${String(value)}\"`,\n );\n }\n map.set(value, branch);\n }\n }\n\n return map;\n }\n\n public override matchesType(value: any): boolean {\n return isPlainObject(value);\n }\n\n public override async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\n if (data === null && this.isNullable) {\n return { isValid: true, errors: [], data: null };\n }\n\n if (!isPlainObject(data)) {\n return {\n isValid: false,\n errors: [\n {\n type: \"discriminatedUnion\",\n error: `Expected object with discriminator field \"${this.discriminator}\"`,\n input: context.key || context.path || \"value\",\n },\n ],\n data: undefined,\n };\n }\n\n const discriminatorValue = data[this.discriminator];\n const branch = this.branches.get(discriminatorValue);\n\n if (!branch) {\n const allowed = [...this.branches.keys()].map((k) => String(k)).join(\", \");\n return {\n isValid: false,\n errors: [\n {\n type: \"discriminatedUnion\",\n error: `Field \"${this.discriminator}\" must be one of: ${allowed}`,\n input: this.discriminator,\n },\n ],\n data: undefined,\n };\n }\n\n return branch.validate(data, context);\n }\n\n public override clone(): this {\n const cloned = super.clone() as any;\n cloned.discriminator = this.discriminator;\n cloned.validators = this.validators.map((v: ObjectValidator<any>) => v.clone());\n cloned.branches = DiscriminatedUnionValidator.buildBranchMap(\n cloned.discriminator,\n cloned.validators,\n );\n return cloned;\n }\n\n /**\n * Emit `oneOf` of branch schemas. Each branch's own `toJsonSchema()` handles\n * its `properties.{discriminator}.const` and the surrounding required/optional\n * structure — we just enumerate.\n *\n * For `openai-strict`: the per-branch ObjectValidator already inflates\n * `required` to include every field; `oneOf` is OpenAI-accepted as long as\n * each branch passes strict rules independently.\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const oneOf = this.validators.map((v) => v.toJsonSchema(target));\n const schema: JsonSchemaResult = { oneOf };\n\n if (this.isNullable) {\n if (target === \"openai-strict\") {\n return wrapNullableStrict(schema);\n }\n applyNullable(schema, target);\n }\n\n return schema;\n }\n}\n","import { absMutator, ceilMutator, floorMutator, roundMutator, toFixedMutator } from \"../mutators\";\r\nimport {\r\n betweenNumbersRule,\r\n evenRule,\r\n greaterThanRule,\r\n lengthRule,\r\n lessThanRule,\r\n maxLengthRule,\r\n maxRule,\r\n minLengthRule,\r\n minRule,\r\n moduloRule,\r\n negativeRule,\r\n numberRule,\r\n oddRule,\r\n positiveRule,\r\n} from \"../rules\";\r\nimport { PrimitiveValidator } from \"./primitive-validator\";\r\nimport { applyNullable, getRuleOptions } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Number validator class - base for Int and Float validators\r\n */\r\nexport class NumberValidator extends PrimitiveValidator {\r\n public constructor(errorMessage?: string) {\r\n super();\r\n this.addMutableRule(numberRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is a number type\r\n */\r\n public matchesType(value: any): boolean {\r\n return typeof value === \"number\" && !isNaN(value);\r\n }\r\n\r\n /**\r\n * Value must be equal or higher than the given number or field\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public min(min: number | string, errorMessage?: string) {\r\n return this.addRule(minRule, errorMessage, { min, scope: \"global\" });\r\n }\r\n\r\n /**\r\n * Value must be equal or less than the given number or field\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public max(max: number | string, errorMessage?: string) {\r\n return this.addRule(maxRule, errorMessage, { max, scope: \"global\" });\r\n }\r\n\r\n /**\r\n * Value must be >= sibling field value\r\n * @category Validation Rule\r\n */\r\n public minSibling(field: string, errorMessage?: string) {\r\n return this.addRule(minRule, errorMessage, { min: field, scope: \"sibling\" });\r\n }\r\n\r\n /**\r\n * Value must be <= sibling field value\r\n * @category Validation Rule\r\n */\r\n public maxSibling(field: string, errorMessage?: string) {\r\n return this.addRule(maxRule, errorMessage, { max: field, scope: \"sibling\" });\r\n }\r\n\r\n /**\r\n * Value must be strictly greater than the given number or field (>)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public greaterThan(value: number | string, errorMessage?: string) {\r\n return this.addRule(greaterThanRule, errorMessage, {\r\n value,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Value must be strictly less than the given number or field (<)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public lessThan(value: number | string, errorMessage?: string) {\r\n return this.addRule(lessThanRule, errorMessage, {\r\n value,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Alias for greaterThan() - shorter syntax\r\n * @category Validation Rule\r\n */\r\n public gt(value: number | string, errorMessage?: string) {\r\n return this.greaterThan(value, errorMessage);\r\n }\r\n\r\n /**\r\n * Alias for lessThan() - shorter syntax\r\n * @category Validation Rule\r\n */\r\n public lt(value: number | string, errorMessage?: string) {\r\n return this.lessThan(value, errorMessage);\r\n }\r\n\r\n /**\r\n * Value must be > sibling field value\r\n * @category Validation Rule\r\n */\r\n public greaterThanSibling(field: string, errorMessage?: string) {\r\n return this.addRule(greaterThanRule, errorMessage, {\r\n value: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Alias for greaterThanSibling() - shorter syntax\r\n * @category Validation Rule\r\n */\r\n public gtSibling(field: string, errorMessage?: string) {\r\n return this.greaterThanSibling(field, errorMessage);\r\n }\r\n\r\n /**\r\n * Value must be < sibling field value\r\n * @category Validation Rule\r\n */\r\n public lessThanSibling(field: string, errorMessage?: string) {\r\n return this.addRule(lessThanRule, errorMessage, {\r\n value: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Alias for lessThanSibling() - shorter syntax\r\n * @category Validation Rule\r\n */\r\n public ltSibling(field: string, errorMessage?: string) {\r\n return this.lessThanSibling(field, errorMessage);\r\n }\r\n\r\n /** Value must be a modulo of the given number */\r\n public modulo(value: number, errorMessage?: string) {\r\n return this.addRule(moduloRule, errorMessage, { value });\r\n }\r\n\r\n /**\r\n * Alias for modulo() - Value must be divisible by the given number\r\n */\r\n public divisibleBy(value: number, errorMessage?: string) {\r\n return this.modulo(value, errorMessage);\r\n }\r\n\r\n /**\r\n * Alias for modulo() - Value must be a multiple of the given number\r\n */\r\n public multipleOf(value: number, errorMessage?: string) {\r\n return this.modulo(value, errorMessage);\r\n }\r\n\r\n /**\r\n * Alias for modulo() - Value must be a multiple of the given number\r\n */\r\n public modulusOf(value: number, errorMessage?: string) {\r\n return this.modulo(value, errorMessage);\r\n }\r\n\r\n /** Accept only numbers higher than 0 */\r\n public positive(errorMessage?: string) {\r\n return this.addRule(positiveRule, errorMessage);\r\n }\r\n\r\n /** Accept only negative numbers */\r\n public negative(errorMessage?: string) {\r\n return this.addRule(negativeRule, errorMessage);\r\n }\r\n\r\n /** Accept only odd numbers */\r\n public odd(errorMessage?: string) {\r\n return this.addRule(oddRule, errorMessage);\r\n }\r\n\r\n /** Accept only even numbers */\r\n public even(errorMessage?: string) {\r\n return this.addRule(evenRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Accept only numbers between the given two numbers or fields (Inclusive)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public between(min: number | string, max: number | string, errorMessage?: string) {\r\n return this.addRule(betweenNumbersRule, errorMessage, {\r\n min,\r\n max,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Value must be between sibling field values\r\n * @category Validation Rule\r\n */\r\n public betweenSibling(minField: string, maxField: string, errorMessage?: string) {\r\n return this.addRule(betweenNumbersRule, errorMessage, {\r\n min: minField,\r\n max: maxField,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n // Enum and value membership methods are inherited from PrimitiveValidator.\r\n\r\n /**\r\n * Value (as a string) must be exactly this many characters.\r\n * Useful for fixed-format numeric codes (e.g. 4-digit PIN).\r\n */\r\n public length(length: number, errorMessage?: string) {\r\n return this.addRule(lengthRule, errorMessage, { length });\r\n }\r\n\r\n /** Value (as string representation) length must be ≥ min */\r\n public minLength(length: number, errorMessage?: string) {\r\n return this.addRule(minLengthRule, errorMessage, { minLength: length });\r\n }\r\n\r\n /** Value (as string representation) length must be ≤ max */\r\n public maxLength(length: number, errorMessage?: string) {\r\n return this.addRule(maxLengthRule, errorMessage, { maxLength: length });\r\n }\r\n\r\n // Mutators\r\n\r\n /**\r\n * Convert value to its absolute value\r\n */\r\n public abs() {\r\n return this.addMutator(absMutator);\r\n }\r\n\r\n /**\r\n * Round value up to the nearest integer\r\n */\r\n public ceil() {\r\n return this.addMutator(ceilMutator);\r\n }\r\n\r\n /**\r\n * Round value down to the nearest integer\r\n */\r\n public floor() {\r\n return this.addMutator(floorMutator);\r\n }\r\n\r\n /**\r\n * Round value to the nearest integer or specified decimals\r\n */\r\n public round(decimals = 0) {\r\n return this.addMutator(roundMutator, { decimals });\r\n }\r\n\r\n /**\r\n * Round to a fixed number of decimal places, keeping the value a **number**.\r\n *\r\n * `v.number().toFixed(2)` on `3.14159` yields `3.14`, not `\"3.14\"` — a number\r\n * schema has to output a number, or its own type rule rejects the result.\r\n * Format to a fixed-point *string* at the presentation edge instead.\r\n *\r\n * @example\r\n * v.number().toFixed(2) // 3.14159 → 3.14\r\n */\r\n public toFixed(decimals = 2) {\r\n return this.addMutator(toFixedMutator, { decimals });\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Returns `{ type: \"number\" }` with numeric constraint keywords.\r\n * IntValidator overrides `type` to `\"integer\"`.\r\n *\r\n * @note Sibling-scoped rules (minSibling, maxSibling, etc.) are not representable\r\n * in JSON Schema and are silently omitted.\r\n *\r\n * @example\r\n * ```ts\r\n * v.number().min(0).max(100).toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"number\", minimum: 0, maximum: 100 }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n return this.buildNumberJsonSchema(\"number\", target);\r\n }\r\n\r\n /**\r\n * Shared logic for number/integer JSON Schema generation.\r\n * Called by NumberValidator.toJsonSchema() (→ type: \"number\")\r\n * and IntValidator.toJsonSchema() (→ type: \"integer\").\r\n */\r\n protected buildNumberJsonSchema(\r\n type: \"number\" | \"integer\",\r\n target: JsonSchemaTarget,\r\n ): JsonSchemaResult {\r\n const schema: JsonSchemaResult = { type };\r\n\r\n // minimum (inclusive)\r\n const minOpts = getRuleOptions(this.rules, \"min\");\r\n if (minOpts?.min !== undefined && typeof minOpts.min === \"number\") {\r\n schema.minimum = minOpts.min;\r\n }\r\n\r\n // maximum (inclusive)\r\n const maxOpts = getRuleOptions(this.rules, \"max\");\r\n if (maxOpts?.max !== undefined && typeof maxOpts.max === \"number\") {\r\n schema.maximum = maxOpts.max;\r\n }\r\n\r\n // between (inclusive range)\r\n const betweenOpts = getRuleOptions(this.rules, \"betweenNumbers\");\r\n if (betweenOpts) {\r\n if (typeof betweenOpts.min === \"number\") schema.minimum = betweenOpts.min;\r\n if (typeof betweenOpts.max === \"number\") schema.maximum = betweenOpts.max;\r\n }\r\n\r\n // greaterThan (>) → exclusiveMinimum\r\n const gtOpts = getRuleOptions(this.rules, \"greaterThan\");\r\n if (gtOpts?.value !== undefined && typeof gtOpts.value === \"number\") {\r\n if (target === \"draft-07\") {\r\n schema.minimum = gtOpts.value;\r\n schema.exclusiveMinimum = true;\r\n } else {\r\n schema.exclusiveMinimum = gtOpts.value;\r\n }\r\n }\r\n\r\n // lessThan (<) → exclusiveMaximum\r\n const ltOpts = getRuleOptions(this.rules, \"lessThan\");\r\n if (ltOpts?.value !== undefined && typeof ltOpts.value === \"number\") {\r\n if (target === \"draft-07\") {\r\n schema.maximum = ltOpts.value;\r\n schema.exclusiveMaximum = true;\r\n } else {\r\n schema.exclusiveMaximum = ltOpts.value;\r\n }\r\n }\r\n\r\n // multipleOf / modulo\r\n const moduloOpts = getRuleOptions(this.rules, \"modulo\");\r\n if (moduloOpts?.value !== undefined && typeof moduloOpts.value === \"number\") {\r\n schema.multipleOf = moduloOpts.value;\r\n }\r\n\r\n // enum (from PrimitiveValidator.in / .enum)\r\n const inOpts = getRuleOptions(this.rules, \"in\");\r\n if (inOpts?.values && Array.isArray(inOpts.values)) {\r\n schema.enum = inOpts.values;\r\n }\r\n\r\n if (this.isNullable) applyNullable(schema, target);\r\n\r\n return schema;\r\n }\r\n}\r\n","import { floatRule } from \"../rules\";\r\nimport { NumberValidator } from \"./number-validator\";\r\n\r\n/**\r\n * Float validator class\r\n */\r\nexport class FloatValidator extends NumberValidator {\r\n public constructor(errorMessage?: string) {\r\n super();\r\n this.addMutableRule(floatRule, errorMessage);\r\n }\r\n}\r\n","import { instanceofRule } from \"../rules/common/instanceof\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport { BaseValidator } from \"./base-validator\";\n\n/**\n * InstanceOf validator class\n *\n * Validates that the value is an instance of the given constructor (`value instanceof Ctor`).\n * Useful for File uploads, Buffer/Uint8Array payloads, and custom domain classes —\n * anywhere a runtime class identity is the right contract.\n *\n * Note: `Date` is already covered by `v.date()` with richer date-specific rules;\n * reach for `v.instanceof(Date)` only when you specifically want raw `instanceof`\n * semantics with no normalization.\n *\n * @example\n * v.instanceof(File) // type: File\n * v.instanceof(Buffer) // type: Buffer\n * v.instanceof(MyClass) // type: MyClass\n */\nexport class InstanceOfValidator<T = unknown> extends BaseValidator {\n public ctor: new (...args: any[]) => T;\n\n public constructor(ctor: new (...args: any[]) => T, errorMessage?: string) {\n super();\n this.ctor = ctor;\n this.addMutableRule(instanceofRule, errorMessage, { ctor, name: ctor.name || \"instance\" });\n }\n\n /**\n * Check if value is an instance of the configured constructor\n */\n public matchesType(value: any): boolean {\n return value instanceof this.ctor;\n }\n\n /**\n * Clone the validator, preserving the target constructor.\n *\n * The base `clone()` only copies `BaseValidator` fields, so without this\n * override a cloned `instanceof` validator loses its `ctor` reference and\n * `matchesType()` would throw on the next call.\n */\n public override clone(): this {\n const cloned = super.clone();\n cloned.ctor = this.ctor;\n return cloned;\n }\n\n /**\n * @inheritdoc\n *\n * Class instances are not representable in JSON Schema — returns an empty\n * schema (permissive). Consumers serializing to OpenAPI should attach an\n * appropriate format manually if needed (e.g. `{ type: \"string\", format: \"binary\" }`\n * for `File`).\n */\n public override toJsonSchema(_target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n return {};\n }\n}\n","import { intRule } from \"../rules\";\r\nimport { NumberValidator } from \"./number-validator\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Integer validator class\r\n */\r\nexport class IntValidator extends NumberValidator {\r\n public constructor(errorMessage?: string) {\r\n super();\r\n this.addMutableRule(intRule, errorMessage);\r\n }\r\n\r\n /**\r\n * @inheritdoc — returns `{ type: \"integer\" }` instead of `{ type: \"number\" }`\r\n *\r\n * @example\r\n * ```ts\r\n * v.int().min(1).max(100).toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"integer\", minimum: 1, maximum: 100 }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n return this.buildNumberJsonSchema(\"integer\", target);\r\n }\r\n}\r\n","import type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport type { SchemaContext, ValidationResult } from \"../types\";\nimport { BaseValidator } from \"./base-validator\";\n\n/**\n * Lazy validator — defers resolution of the inner validator until validate-time.\n *\n * Solves the chicken-and-egg of self-referencing schemas. JavaScript evaluates\n * an object literal before the `const` binding completes, so this can't work:\n *\n * ```ts\n * const categorySchema = v.object({\n * name: v.string(),\n * children: v.array(categorySchema), // ❌ ReferenceError\n * });\n * ```\n *\n * Wrap the recursive reference in `v.lazy(() => …)` — the thunk isn't invoked\n * during construction, only when `validate()` is called:\n *\n * ```ts\n * type Category = { name: string; children: Category[] };\n *\n * const categorySchema: ObjectValidator<...> = v.object({\n * name: v.string(),\n * children: v.array(v.lazy(() => categorySchema)),\n * });\n *\n * type T = Infer<typeof categorySchema>;\n * // { name: string; children: T[] } ← recursive type\n * ```\n *\n * The thunk is memoized — it's invoked once on the first validate (or\n * `matchesType` / `toJsonSchema`) call and the result is cached. The thunk is\n * expected to return a stable validator; calling it on every validate would be\n * wasteful and could mask bugs where the user accidentally returns a fresh\n * validator each time.\n *\n * **JSON Schema caveat.** v1 uses simple resolve-and-delegate — recursive\n * schemas will infinite-loop in `toJsonSchema()`. If you need JSON Schema for\n * a recursive shape, generate it manually with `$defs` + `$ref` until v2 lands.\n *\n * @see `domains/seal/plans/2026-05-12-lazy-validator.md`\n */\nexport class LazyValidator<T extends BaseValidator = BaseValidator> extends BaseValidator {\n private resolvedValidator: T | undefined;\n\n public constructor(private thunk: () => T) {\n super();\n // Lazy itself defers required handling to the inner validator —\n // mark the wrapper as optional so the required check doesn't fire here.\n this.requiredRule = null;\n this.isOptional = true;\n }\n\n /**\n * Resolve the inner validator. Memoizes the result so subsequent calls\n * don't re-execute the thunk.\n */\n private resolve(): T {\n if (this.resolvedValidator === undefined) {\n this.resolvedValidator = this.thunk();\n }\n\n return this.resolvedValidator;\n }\n\n public override async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\n return this.resolve().validate(data, context);\n }\n\n public override matchesType(value: any): boolean {\n return this.resolve().matchesType(value);\n }\n\n public override clone(): this {\n const cloned = super.clone();\n // Share the thunk reference; reset the memo so the clone resolves\n // independently on its first call (in case the thunk closure resolves\n // differently in a different context — unlikely but cheap insurance).\n cloned.thunk = this.thunk;\n cloned.resolvedValidator = undefined;\n\n return cloned;\n }\n\n /**\n * JSON Schema generation — simple resolve-and-delegate.\n *\n * **Recursive schemas will infinite-loop.** Until v2 adds `$ref` + `$defs`\n * generation, callers needing JSON Schema for recursive shapes must build\n * the schema manually.\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n return this.resolve().toJsonSchema(target);\n }\n}\n","import type { SchemaContext } from \"../types\";\nimport type { BaseValidator } from \"./base-validator\";\nimport { ComputedValidator, type ComputedCallback } from \"./computed-validator\";\n\n/**\n * Callback function for managed fields\n * Receives only schema context (no data dependency)\n */\nexport type ManagedCallback<TResult = any> = (context: SchemaContext) => TResult | Promise<TResult>;\n\n/**\n * Managed field validator\n *\n * The callback is optional - if not provided, the framework can inject the value.\n * @example\n * ```ts\n * // With callback (framework executes it)\n * const schema = v.object({\n * name: v.string(),\n * createdAt: v.managed(() => new Date()),\n * updatedAt: v.managed(() => new Date()),\n * });\n *\n * // Without callback (framework injects value)\n * const schema = v.object({\n * name: v.string(),\n * id: v.managed(() => 1),\n * });\n * ```\n */\nexport class ManagedValidator<TResult = any> extends ComputedValidator<TResult> {\n /**\n * Create a new managed field validator\n *\n * @param callback - Optional function to generate the value\n * @param resultValidator - Optional validator to validate the generated result\n */\n constructor(callback: ManagedCallback<TResult>, resultValidator?: BaseValidator) {\n // Convert ManagedCallback to ComputedCallback\n // Managed callbacks don't receive data, only context\n const computedCallback: ComputedCallback<TResult> = (_data, context) => callback(context);\n\n super(computedCallback, resultValidator);\n }\n}\n","import { isNumeric } from \"@mongez/supportive-is\";\r\nimport { numericMutator } from \"../mutators/number-mutators\";\r\nimport { NumberValidator } from \"./number-validator\";\r\n\r\n/**\r\n * Numeric validator class - base for Int and Float validators either as number or string\r\n */\r\nexport class NumericValidator extends NumberValidator {\r\n /**\r\n * Constructor\r\n */\r\n public constructor(errorMessage?: string) {\r\n super(errorMessage);\r\n this.addMutableMutator(numericMutator);\r\n }\r\n\r\n /**\r\n * Check if value is a numeric type\r\n */\r\n public matchesType(value: any): boolean {\r\n return isNumeric(value);\r\n }\r\n}\r\n","import { except } from \"@mongez/reinforcements\";\nimport { isPlainObject } from \"@mongez/supportive-is\";\nimport { setKeyPath } from \"../helpers\";\nimport { objectTrimMutator, stripUnknownMutator } from \"../mutators\";\nimport { objectRule, unknownKeyRule } from \"../rules\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport { applyNullable, wrapNullableStrict } from \"../standard-schema/json-schema\";\nimport type { Schema, SchemaContext, ValidationResult } from \"../types\";\nimport type {\n InferInputObjectShape,\n InferOutputObjectShape,\n} from \"../types/inference-types\";\nimport { BaseValidator } from \"./base-validator\";\nimport { ComputedValidator } from \"./computed-validator\";\n\n/**\n * Object validator class with generic schema type for proper type inference.\n *\n * Threads two distinct inferred shapes into `BaseValidator`'s `TInput`/`TOutput`:\n *\n * - `TInput` = `InferInputObjectShape<TSchema>` — what `~standard.validate()`\n * accepts (caller's pre-validation payload; defaults/catches make\n * keys optional)\n * - `TOutput` = `InferOutputObjectShape<TSchema>` — what `~standard.validate()`\n * returns on success (post-default, post-catch shape; guaranteed\n * keys are required)\n *\n * Both helpers are used directly (not the full `Infer.*` walker) to avoid a\n * recursive class-base evaluation that would otherwise occur when the\n * brand-aware widening tries to inspect the class type.\n */\nexport class ObjectValidator<TSchema extends Schema = Schema> extends BaseValidator<\n InferInputObjectShape<TSchema>,\n InferOutputObjectShape<TSchema>\n> {\n protected shouldAllowUnknown = false;\n protected allowedKeys: string[] = [];\n protected hasUnknownKeyRule = false;\n\n public constructor(\n public schema: TSchema,\n errorMessage?: string,\n ) {\n super();\n this.addMutableRule(objectRule, errorMessage);\n }\n\n /**\n * Check if value is an object type (plain object, not array or date)\n */\n public matchesType(value: any): boolean {\n return isPlainObject(value);\n }\n\n /** Strip unknown keys from the data */\n public stripUnknown() {\n const validator = this.instance;\n return validator.addMutator(stripUnknownMutator, {\n get allowedKeys() {\n return validator.allowedKeys;\n },\n });\n }\n\n /** Add list of allowed keys that could be in the data but not necessarily validated */\n public allow(...keys: string[]) {\n const validator = this.instance;\n validator.allowedKeys.push(...keys);\n return validator;\n }\n\n /** Trim values of the object properties */\n public trim(recursive = true) {\n const validator = this.instance;\n return validator.addMutator(objectTrimMutator, { recursive });\n }\n\n /** Whether to allow unknown properties\n * Please note it will allow only unknown direct children keys, not nested children keys\n */\n public allowUnknown(allow = true) {\n const validator = this.instance;\n validator.shouldAllowUnknown = allow;\n return validator;\n }\n\n /**\n * Create a copy of this object validator with the same configuration\n * Copies schema, rules, mutators, transformers, and object-specific settings\n *\n * @returns A new ObjectValidator instance with copied configuration\n *\n * @example\n * ```ts\n * const baseUser = v.object({ name: v.string() }).allowUnknown();\n * const userCopy = baseUser.clone();\n * // userCopy has the same schema and allowUnknown setting\n * ```\n */\n public override clone(keys?: string[]): this {\n // Get cloned instance with all BaseValidator properties\n const cloned = super.clone();\n\n // Clone schema with deep copy of validators\n const newSchema = {} as TSchema;\n for (const key in this.schema) {\n if (keys && !keys.includes(key)) continue;\n (newSchema as any)[key] = this.schema[key].clone();\n }\n\n cloned.schema = newSchema;\n\n // Add ObjectValidator-specific properties\n cloned.shouldAllowUnknown = this.shouldAllowUnknown;\n cloned.allowedKeys = [...this.allowedKeys];\n // NOTE: hasUnknownKeyRule is intentionally NOT copied.\n // Each clone must add its own unknownKeyRule on first validate()\n // so it holds references to its own schema/allowedKeys, not the original's.\n\n return cloned;\n }\n\n /**\n * Extend this schema with additional fields\n * Clones the current validator and adds new fields to the schema\n * **Keeps original configuration** (allowUnknown, stripUnknown, etc.)\n *\n * If an ObjectValidator is provided, only its schema is used - its configuration is ignored.\n * This is useful for creating reusable field collections that can be added to different schemas.\n *\n * @param schemaOrValidator - Plain schema object or ObjectValidator to extend with\n * @returns A new ObjectValidator with merged schema and original configuration\n *\n * @example\n * ```ts\n * // Extend with plain schema\n * const baseUser = v.object({\n * name: v.string().required(),\n * email: v.string().email().required()\n * }).allowUnknown();\n *\n * const adminUser = baseUser.extend({\n * role: v.string().in(['admin', 'superadmin']).required()\n * });\n * // adminUser has: name, email, role\n * // adminUser keeps: allowUnknown() from base ✅\n *\n * // Extend with ObjectValidator (only schema is used)\n * const auditFields = v.object({\n * createdAt: v.date().required(),\n * updatedAt: v.date().required()\n * }).stripUnknown(); // This config is ignored!\n *\n * const fullUser = baseUser.extend(auditFields);\n * // fullUser has: name, email, createdAt, updatedAt\n * // fullUser keeps: allowUnknown() from base (NOT stripUnknown from auditFields) ✅\n *\n * // Chain multiple extends\n * const complexSchema = baseUser\n * .extend(auditFields)\n * .extend({ metadata: v.object({}) });\n * ```\n */\n public extend<TExtension extends Schema>(\n schemaOrValidator: TExtension | ObjectValidator<TExtension>,\n ): ObjectValidator<TSchema & TExtension> {\n // Clone current validator to preserve original\n const extended = this.clone() as any;\n\n // Extract schema from parameter\n const schemaToAdd =\n schemaOrValidator instanceof ObjectValidator ? schemaOrValidator.schema : schemaOrValidator;\n\n // Merge schemas with cloned validators (later fields override earlier ones)\n for (const key in schemaToAdd) {\n extended.schema[key] = schemaToAdd[key].clone();\n }\n\n return extended as ObjectValidator<TSchema & TExtension>;\n }\n\n /**\n * Merge with another ObjectValidator\n * Clones current validator, merges schemas, and **overrides configuration** with other validator's config\n *\n * Unlike extend(), merge() combines both schemas AND configurations.\n * The other validator's configuration (allowUnknown, stripUnknown, etc.) takes precedence.\n *\n * @param validator - Another ObjectValidator to merge with\n * @returns A new ObjectValidator with merged schema and configuration\n *\n * @example\n * ```ts\n * const baseUser = v.object({\n * name: v.string().required()\n * }).allowUnknown();\n *\n * const timestamps = v.object({\n * createdAt: v.date().required(),\n * updatedAt: v.date().required()\n * }).stripUnknown();\n *\n * const merged = baseUser.merge(timestamps);\n * // merged has: name, createdAt, updatedAt\n * // merged config: stripUnknown() from timestamps (overrides allowUnknown) ✅\n *\n * // Chain multiple merges\n * const full = baseUser.merge(timestamps).merge(softDeleteSchema);\n * ```\n */\n public merge<TMerge extends Schema>(\n validator: ObjectValidator<TMerge>,\n ): ObjectValidator<TSchema & TMerge> {\n // Clone current validator\n const merged = this.clone() as any;\n\n // Merge schemas with cloned validators (later fields override earlier ones)\n for (const key in validator.schema) {\n merged.schema[key] = validator.schema[key].clone();\n }\n\n // Override configuration with other validator's config\n merged.shouldAllowUnknown = validator.shouldAllowUnknown;\n merged.allowedKeys = [...merged.allowedKeys, ...validator.allowedKeys];\n\n // Append rules, mutators, transformers from other validator\n merged.rules.push(...validator.rules);\n merged.mutators.push(...validator.mutators);\n merged.dataTransformers.push(...validator.dataTransformers);\n\n // Merge attributes text (later wins)\n merged.attributesText = {\n ...merged.attributesText,\n ...validator.attributesText,\n };\n\n merged.translatedAttributes = {\n ...merged.translatedAttributes,\n ...validator.translatedAttributes,\n };\n\n return merged as ObjectValidator<TSchema & TMerge>;\n }\n\n /**\n * Create a new schema with only the specified fields\n * Clones the current validator and keeps only the selected fields\n * **Preserves all configuration** (allowUnknown, stripUnknown, etc.)\n *\n * @param keys - Field names to keep in the schema\n * @returns A new ObjectValidator with only the picked fields\n *\n * @example\n * ```ts\n * const fullUser = v.object({\n * id: v.int().required(),\n * name: v.string().required(),\n * email: v.string().email().required(),\n * password: v.string().required(),\n * role: v.string()\n * }).allowUnknown();\n *\n * // For login - only need email and password\n * const loginSchema = fullUser.pick('email', 'password');\n * // loginSchema has: { email, password }\n * // loginSchema keeps: allowUnknown() ✅\n *\n * // For public profile\n * const publicSchema = fullUser.pick('id', 'name', 'role');\n * // publicSchema has: { id, name, role }\n * ```\n */\n public pick<K extends keyof TSchema>(...keys: K[]): ObjectValidator<Pick<TSchema, K>> {\n // Clone current validator\n const picked = this.clone() as any;\n\n // Create new schema with only picked keys\n const newSchema = {} as Pick<TSchema, K>;\n for (const key of keys) {\n if (key in picked.schema) {\n (newSchema as any)[key] = picked.schema[key];\n }\n }\n\n picked.schema = newSchema;\n\n return picked as ObjectValidator<Pick<TSchema, K>>;\n }\n\n /**\n * Mark all or the given schema fields as optional\n */\n public partial<K extends keyof TSchema>(...keys: K[]) {\n const validationSchema = this.clone();\n\n if (keys.length === 0) {\n keys = Object.keys(validationSchema.schema) as K[];\n }\n\n for (const key of keys) {\n validationSchema.schema[key] = validationSchema.schema[key].optional();\n }\n\n return validationSchema;\n }\n\n /**\n * Make the all or the given fields as required\n */\n public requiredFields<K extends keyof TSchema>(...keys: K[]) {\n const validationSchema = this.clone();\n\n if (keys.length === 0) {\n keys = Object.keys(validationSchema.schema) as K[];\n }\n\n for (const key of keys) {\n validationSchema.schema[key] = validationSchema.schema[key].required();\n }\n\n return validationSchema;\n }\n\n /**\n * Create a new schema excluding the specified fields\n * Clones the current validator and removes the specified fields\n * **Preserves all configuration** (allowUnknown, stripUnknown, etc.)\n *\n * @param keys - Field names to exclude from the schema\n * @returns A new ObjectValidator without the excluded fields\n *\n * @example\n * ```ts\n * const fullUser = v.object({\n * id: v.int().required(),\n * name: v.string().required(),\n * email: v.string().email().required(),\n * password: v.string().required(),\n * role: v.string()\n * }).allowUnknown();\n *\n * // For updates - exclude id\n * const updateSchema = fullUser.without('id');\n * // updateSchema has: { name, email, password, role }\n * // updateSchema keeps: allowUnknown() ✅\n *\n * // For public API - exclude sensitive fields\n * const publicSchema = fullUser.without('password', 'role');\n * // publicSchema has: { id, name, email }\n *\n * // Combine with other methods\n * const patchSchema = fullUser.without('id', 'password');\n * // patchSchema has: { name, email, role }\n * ```\n */\n public without<K extends keyof TSchema>(...keys: K[]): ObjectValidator<Omit<TSchema, K>> {\n // Clone current validator\n const filtered = this.clone() as any;\n\n // Create new schema excluding specified keys\n const newSchema = {} as Omit<TSchema, K>;\n for (const key in filtered.schema) {\n if (!keys.includes(key as any)) {\n (newSchema as any)[key] = filtered.schema[key];\n }\n }\n\n filtered.schema = newSchema;\n\n return filtered as ObjectValidator<Omit<TSchema, K>>;\n }\n\n /** Mutate the data */\n public mutate(data: any, context: SchemaContext) {\n if (!isPlainObject(data)) return data;\n return super.mutate({ ...data }, context);\n }\n\n /** Validate the data */\n public async validate(\n data: any,\n context: SchemaContext = { path: \"\" } as SchemaContext,\n ): Promise<ValidationResult> {\n context.schema = this.schema;\n const mutatedData = await this.mutate(data, context);\n\n // Check for unknown properties\n if (this.shouldAllowUnknown === false && !this.hasUnknownKeyRule) {\n this.hasUnknownKeyRule = true;\n const rule = this.addMutableRule(unknownKeyRule, undefined, {\n allowedKeys: this.allowedKeys,\n schema: this.schema,\n });\n\n this.setRuleAttributesList(rule);\n }\n\n const result = await super.validate(mutatedData, context);\n\n if (result.isValid === false) return result;\n if (data === undefined) return result;\n\n // ═══════════════════════════════════════════════════════════\n // PHASE 1: Validate user input fields (skip computed/managed)\n // ═══════════════════════════════════════════════════════════\n const errors: ValidationResult[\"errors\"] = [];\n const validatedData: any = {};\n\n const userInputKeys = Object.keys(this.schema).filter(\n (key) => !this.isComputedValidator(this.schema[key]),\n );\n\n const validationPromises = userInputKeys.map(async (key) => {\n const validator = this.schema[key];\n const value =\n mutatedData?.[key] !== undefined ? mutatedData[key] : validator.getDefaultValue();\n\n const childContext: SchemaContext = {\n ...context,\n parent: mutatedData,\n value,\n key,\n path: setKeyPath(context.path, key),\n };\n\n const childResult = await validator.validate(value, childContext);\n\n // Only include in validated data if not omitted\n if (childResult.data !== undefined && !validator.isOmitted()) {\n validatedData[key] = childResult.data;\n }\n\n if (childResult.isValid === false) {\n errors.push(...childResult.errors);\n }\n });\n\n await Promise.all(validationPromises);\n\n // If Phase 1 failed, return early\n if (errors.length > 0) {\n return {\n isValid: false,\n errors,\n data: undefined,\n };\n }\n\n // ═══════════════════════════════════════════════════════════\n // PHASE 2: Execute computed/managed fields with validated data\n // ═══════════════════════════════════════════════════════════\n const computedFields = this.getComputedFields();\n\n const computedPromises = Object.keys(computedFields).map(async (key) => {\n const validator = computedFields[key];\n\n const childContext: SchemaContext = {\n ...context,\n parent: validatedData,\n value: undefined, // Computed fields don't have input value\n };\n\n // Execute computed callback with validated data\n const childResult = await validator.validate(validatedData, childContext);\n\n // Only include in final data if not omitted\n if (childResult.data !== undefined && !validator.isOmitted()) {\n validatedData[key] = childResult.data;\n }\n\n if (childResult.isValid === false) {\n errors.push(...childResult.errors);\n }\n });\n\n await Promise.all(computedPromises);\n\n // If Phase 2 failed, return early\n if (errors.length > 0) {\n return {\n isValid: false,\n errors,\n data: undefined,\n };\n }\n\n // Remove undefined values\n const cleanedData = removeUndefinedValues(validatedData);\n\n const transformedData = await this.startTransformationPipeline(cleanedData, context);\n\n const output =\n this.shouldAllowUnknown === false\n ? transformedData\n : {\n ...transformedData,\n ...except(mutatedData, Object.keys(this.schema)),\n };\n\n return {\n isValid: true,\n errors: [],\n data: output,\n };\n }\n\n /**\n * Check if a validator is a computed or managed field\n * ManagedValidator extends ComputedValidator, so instanceof catches both\n */\n private isComputedValidator(validator: BaseValidator): boolean {\n return validator instanceof ComputedValidator;\n }\n\n /**\n * Get all computed/managed fields from the schema\n */\n private getComputedFields(): Record<string, ComputedValidator> {\n const computed: Record<string, any> = {};\n\n for (const [key, validator] of Object.entries(this.schema)) {\n if (validator instanceof ComputedValidator) {\n computed[key] = validator;\n }\n }\n\n return computed;\n }\n\n /**\n * @inheritdoc\n *\n * Recursively generates JSON Schema for all input fields in the schema.\n * Computed/managed fields are skipped — they have no input representation.\n *\n * **Standard targets** (`draft-2020-12`, `draft-07`, `openapi-3.0`):\n * - Fields marked `.optional()` are excluded from `required`.\n *\n * **`openai-strict` target** (OpenAI Structured Outputs):\n * - ALL fields appear in `required` — OpenAI rejects schemas with optional fields.\n * - Optional fields are instead expressed as nullable types:\n * `{ type: [\"string\", \"null\"] }` so the model can output `null` for them.\n * - Recursively applies `openai-strict` to all nested objects.\n *\n * @example\n * ```ts\n * v.object({\n * name: v.string().required(),\n * age: v.int().optional(),\n * }).toJsonSchema(\"draft-2020-12\")\n * // → { type: \"object\",\n * // properties: { name: { type: \"string\" }, age: { type: \"integer\" } },\n * // required: [\"name\"], additionalProperties: false }\n *\n * v.object({\n * name: v.string().required(),\n * age: v.int().optional(),\n * }).toJsonSchema(\"openai-strict\")\n * // → { type: \"object\",\n * // properties: { name: { type: \"string\" }, age: { type: [\"integer\", \"null\"] } },\n * // required: [\"name\", \"age\"], ← all fields\n * // additionalProperties: false }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const properties: Record<string, JsonSchemaResult> = {};\n const required: string[] = [];\n const isOpenAIStrict = target === \"openai-strict\";\n\n for (const [key, validator] of Object.entries(this.schema)) {\n // Skip computed/managed — runtime-only, no input schema\n if (validator instanceof ComputedValidator) continue;\n\n let fieldSchema = validator.toJsonSchema(target);\n\n if (isOpenAIStrict) {\n // OpenAI strict: every field must be in required.\n // Optional fields are expressed as nullable rather than absent.\n if (validator.isOptional) {\n fieldSchema = wrapNullableStrict(fieldSchema);\n }\n required.push(key);\n } else {\n // Standard JSON Schema: only non-optional fields go in required\n if (!validator.isOptional) {\n required.push(key);\n }\n }\n\n properties[key] = fieldSchema;\n }\n\n const schema: JsonSchemaResult = { type: \"object\", properties };\n\n if (required.length > 0) schema.required = required;\n if (!this.shouldAllowUnknown) schema.additionalProperties = false;\n if (this.isNullable) applyNullable(schema, target);\n\n return schema;\n }\n}\n\n/** Recursively remove undefined values from an object */\nfunction removeUndefinedValues(obj: any, visited = new WeakMap<object, any>()): any {\n // Handle primitives and null\n if (obj === null) {\n return obj;\n }\n\n // Handle arrays\n if (Array.isArray(obj)) {\n return obj.map((item) => removeUndefinedValues(item, visited));\n }\n\n // Skip non-plain objects (class instances, Dates, Buffers, etc.)\n if (!isPlainObject(obj)) {\n return obj;\n }\n\n // Handle circular references - return already processed result\n if (visited.has(obj)) {\n return visited.get(obj);\n }\n\n // Process plain objects\n const result: any = {};\n visited.set(obj, result); // Mark as processing BEFORE recursion\n\n for (const [key, value] of Object.entries(obj)) {\n if (value !== undefined) {\n result[key] = removeUndefinedValues(value, visited);\n }\n }\n\n return result;\n}\n","import { isPlainObject } from \"@mongez/supportive-is\";\r\nimport { setKeyPath } from \"../helpers\";\r\nimport { objectRule, plainObjectRule } from \"../rules\";\r\nimport type { SchemaContext, ValidationResult } from \"../types\";\r\nimport { BaseValidator } from \"./base-validator\";\r\nimport { applyNullable } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Record validator class - validates objects with dynamic keys and consistent value types\r\n *\r\n * @example\r\n * ```ts\r\n * // Translations object\r\n * v.record(v.string())\r\n * // Valid: { en: \"Hello\", ar: \"مرحبا\", fr: \"Bonjour\" }\r\n *\r\n * // User preferences\r\n * v.record(v.union([v.string(), v.number(), v.boolean()]))\r\n * // Valid: { theme: \"dark\", fontSize: 16, notifications: true }\r\n * ```\r\n */\r\nexport class RecordValidator extends BaseValidator {\r\n public constructor(\r\n public valueValidator: BaseValidator,\r\n errorMessage?: string,\r\n ) {\r\n super();\r\n this.addMutableRule(objectRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Validate it as plain object\r\n */\r\n public plainObject(errorMessage?: string) {\r\n return this.addRule(plainObjectRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is a plain object type\r\n */\r\n public matchesType(value: any): boolean {\r\n return isPlainObject(value);\r\n }\r\n\r\n /**\r\n * Clone the validator\r\n */\r\n public override clone(): this {\r\n const cloned = super.clone();\r\n cloned.valueValidator = this.valueValidator.clone();\r\n return cloned;\r\n }\r\n\r\n /**\r\n * Validate record - iterate all keys and validate each value\r\n *\r\n * Absent input (and absent without `.default()`) propagates as `data: undefined`\r\n * so the parent ObjectValidator can omit the key. Without this, optional record\r\n * fields would silently materialise as `{}` in the validated output.\r\n */\r\n public async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\r\n // Apply default when absent, then mutate. Mirrors BaseValidator's\r\n // `valueForRules = data ?? this.getDefaultValue()` so `.default({...})`\r\n // works on records too.\r\n const valueForRules = data ?? this.getDefaultValue();\r\n const mutatedData = await this.mutate(valueForRules, context);\r\n\r\n const result = await super.validate(data, context);\r\n\r\n if (result.isValid === false) return result;\r\n\r\n // Nothing to iterate for absent (no default) or null (nullable) inputs —\r\n // propagate so the parent ObjectValidator can omit the key.\r\n if (mutatedData === undefined || mutatedData === null) return result;\r\n\r\n // Defensive: type rule (objectRule) should have failed for non-objects.\r\n if (!isPlainObject(mutatedData)) return result;\r\n\r\n const errors: ValidationResult[\"errors\"] = [];\r\n const keys = Object.keys(mutatedData);\r\n\r\n // Validate all values in parallel\r\n const validationPromises = keys.map(async (key) => {\r\n const childContext: SchemaContext = {\r\n ...context,\r\n parent: mutatedData,\r\n value: mutatedData[key],\r\n key,\r\n path: setKeyPath(context.path, key),\r\n };\r\n\r\n const childResult = await this.valueValidator.validate(mutatedData[key], childContext);\r\n\r\n // Update mutated data with validated result\r\n mutatedData[key] = childResult.data;\r\n\r\n // Collect errors from this value\r\n if (childResult.isValid === false) {\r\n errors.push(...childResult.errors);\r\n }\r\n });\r\n\r\n await Promise.all(validationPromises);\r\n\r\n return {\r\n isValid: errors.length === 0,\r\n errors,\r\n data: await this.startTransformationPipeline(mutatedData, context),\r\n };\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Generates `{ type: \"object\", additionalProperties: <valueSchema> }` —\r\n * the standard JSON Schema for a dictionary/map with homogeneous values.\r\n *\r\n * @example\r\n * ```ts\r\n * v.record(v.string()).toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"object\", additionalProperties: { type: \"string\" } }\r\n *\r\n * v.record(v.union([v.string(), v.number()])).toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"object\", additionalProperties: { oneOf: [{ type: \"string\" }, { type: \"number\" }] } }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const schema: JsonSchemaResult = {\r\n type: \"object\",\r\n additionalProperties: this.valueValidator.toJsonSchema(target),\r\n };\r\n\r\n if (this.isNullable) applyNullable(schema, target);\r\n\r\n return schema;\r\n }\r\n}\r\n","import { invalidRule, VALID_RULE } from \"../helpers\";\r\nimport { numberMutator, stringMutator } from \"../mutators\";\r\nimport {\r\n acceptedIfPresentRule,\r\n acceptedIfRequiredRule,\r\n acceptedIfRule,\r\n acceptedRule,\r\n acceptedUnlessRule,\r\n acceptedWithoutRule,\r\n declinedIfPresentRule,\r\n declinedIfRequiredRule,\r\n declinedIfRule,\r\n declinedRule,\r\n declinedUnlessRule,\r\n declinedWithoutRule,\r\n} from \"../rules/scalar\";\r\nimport { PrimitiveValidator } from \"./primitive-validator\";\r\nimport { getRuleOptions } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Scalar validator class\r\n *\r\n * Core validator for scalar values (string, number, boolean).\r\n * Extends PrimitiveValidator (inherits enum/in/oneOf/allowsOnly/forbids/notIn)\r\n * and additionally provides type-coercion mutators and accepted/declined rules.\r\n *\r\n * Database methods (unique, exists, etc.) are injected by the framework\r\n */\r\nexport class ScalarValidator extends PrimitiveValidator {\r\n public constructor(errorMessage?: string) {\r\n super();\r\n this.addMutableRule(\r\n {\r\n name: \"scalar\",\r\n defaultErrorMessage: \"The :input must be a scalar value\",\r\n async validate(value, context) {\r\n if ([\"string\", \"number\", \"boolean\"].includes(typeof value)) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n },\r\n errorMessage,\r\n );\r\n }\r\n\r\n /**\r\n * Add matches type\r\n */\r\n public matchesType(value: any) {\r\n return typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\";\r\n }\r\n\r\n /**\r\n * Mutate the scalar value to be number\r\n */\r\n public asNumber() {\r\n return this.addMutator(numberMutator);\r\n }\r\n\r\n /**\r\n * Mutate the scalar value to be string\r\n */\r\n public asString() {\r\n return this.addMutator(stringMutator);\r\n }\r\n\r\n /**\r\n * Accepted value\r\n * The value will be valid if it equals 1 | \"1\" | true | \"true\" | \"yes\" | \"y\" | \"on\"\r\n */\r\n public accepted(errorMessage?: string) {\r\n return this.addRule(acceptedRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Accepted value if another field's value equals to a specific value\r\n */\r\n public acceptedIf(field: string, value: any, errorMessage?: string) {\r\n return this.addRule(acceptedIfRule, errorMessage, { field, value });\r\n }\r\n\r\n /**\r\n * Accepted value if another field's value is not equal to the given value\r\n */\r\n public acceptedUnless(field: string, value: any, errorMessage?: string) {\r\n return this.addRule(acceptedUnlessRule, errorMessage, { field, value });\r\n }\r\n\r\n /**\r\n * Accepted value if another field is required\r\n */\r\n public acceptedIfRequired(field: string, errorMessage?: string) {\r\n return this.addRule(acceptedIfRequiredRule, errorMessage, { field });\r\n }\r\n\r\n /**\r\n * Accepted value if another field is present\r\n */\r\n public acceptedIfPresent(field: string, errorMessage?: string) {\r\n return this.addRule(acceptedIfPresentRule, errorMessage, { field });\r\n }\r\n\r\n /**\r\n * Accepted value if another field is missing\r\n */\r\n public acceptedWithout(field: string, errorMessage?: string) {\r\n return this.addRule(acceptedWithoutRule, errorMessage, { field });\r\n }\r\n\r\n /**\r\n * Declined value\r\n * The value will be valid if it equals 0 | \"0\" | false | \"false\" | \"no\" | \"n\" | \"off\"\r\n */\r\n public declined(errorMessage?: string) {\r\n return this.addRule(declinedRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Declined value if another field's value equals to a specific value\r\n */\r\n public declinedIf(field: string, value: any, errorMessage?: string) {\r\n return this.addRule(declinedIfRule, errorMessage, { field, value });\r\n }\r\n\r\n /**\r\n * Declined value if another field's value is not equal to the given value\r\n */\r\n public declinedUnless(field: string, value: any, errorMessage?: string) {\r\n return this.addRule(declinedUnlessRule, errorMessage, { field, value });\r\n }\r\n\r\n /**\r\n * Declined value if another field is required\r\n */\r\n public declinedIfRequired(field: string, errorMessage?: string) {\r\n return this.addRule(declinedIfRequiredRule, errorMessage, { field });\r\n }\r\n\r\n /**\r\n * Declined value if another field is present\r\n */\r\n public declinedIfPresent(field: string, errorMessage?: string) {\r\n return this.addRule(declinedIfPresentRule, errorMessage, { field });\r\n }\r\n\r\n /**\r\n * Declined value if another field is missing\r\n */\r\n public declinedWithout(field: string, errorMessage?: string) {\r\n return this.addRule(declinedWithoutRule, errorMessage, { field });\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * A scalar accepts string | number | boolean. If `.in()` / `.enum()` is used,\r\n * output collapses to a simple `enum` list instead.\r\n *\r\n * @example\r\n * ```ts\r\n * v.scalar().toJsonSchema(\"draft-2020-12\")\r\n * // → { oneOf: [{ type: \"string\" }, { type: \"number\" }, { type: \"boolean\" }] }\r\n *\r\n * v.scalar().in([\"active\", \"inactive\"]).toJsonSchema(\"draft-2020-12\")\r\n * // → { enum: [\"active\", \"inactive\"] }\r\n * ```\r\n */\r\n public override toJsonSchema(_target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n // If a value set is constrained, collapse to enum\r\n const inOpts = getRuleOptions(this.rules, \"in\");\r\n if (inOpts?.values && Array.isArray(inOpts.values)) {\r\n return { enum: inOpts.values };\r\n }\r\n\r\n const enumOpts = getRuleOptions(this.rules, \"enum\");\r\n if (enumOpts?.enum && Array.isArray(enumOpts.enum)) {\r\n return { enum: enumOpts.enum };\r\n }\r\n\r\n return {\r\n oneOf: [\r\n { type: \"string\" },\r\n { type: \"number\" },\r\n { type: \"boolean\" },\r\n ],\r\n };\r\n }\r\n}\n","import {\r\n alphaOnlyMutator,\r\n alphanumericOnlyMutator,\r\n appendMutator,\r\n base64DecodeMutator,\r\n base64EncodeMutator,\r\n camelCaseMutator,\r\n capitalizeMutator,\r\n htmlEscapeMutator,\r\n kebabCaseMutator,\r\n lowercaseMutator,\r\n ltrimMutator,\r\n maskMutator,\r\n padEndMutator,\r\n padStartMutator,\r\n pascalCaseMutator,\r\n prependMutator,\r\n removeNumbersMutator,\r\n removeSpecialCharactersMutator,\r\n repeatMutator,\r\n replaceAllMutator,\r\n replaceMutator,\r\n reverseMutator,\r\n rtrimMutator,\r\n slugMutator,\r\n snakeCaseMutator,\r\n stringifyMutator,\r\n stripTagsMutator,\r\n titleCaseMutator,\r\n trimMultipleWhitespaceMutator,\r\n trimMutator,\r\n truncateMutator,\r\n unescapeHtmlMutator,\r\n uppercaseMutator,\r\n urlDecodeMutator,\r\n urlEncodeMutator,\r\n} from \"../mutators\";\r\nimport {\r\n alphaNumericRule,\r\n alphaRule,\r\n betweenLengthRule,\r\n colorRule,\r\n containsRule,\r\n cuidRule,\r\n darkColorRule,\r\n emailRule,\r\n endsWithRule,\r\n hexColorRule,\r\n hslColorRule,\r\n ip4Rule,\r\n ip6Rule,\r\n ipRule,\r\n isCreditCardRule,\r\n isNumericRule,\r\n lengthRule,\r\n lightColorRule,\r\n maxLengthRule,\r\n maxWordsRule,\r\n minLengthRule,\r\n minWordsRule,\r\n nanoidRule,\r\n notContainsRule,\r\n patternRule,\r\n rgbColorRule,\r\n rgbaColorRule,\r\n startsWithRule,\r\n stringRule,\r\n strongPasswordRule,\r\n ulidRule,\r\n urlRule,\r\n uuidRule,\r\n withoutWhitespaceRule,\r\n wordsRule,\r\n type UUIDVersion,\r\n} from \"../rules\";\r\nimport { PrimitiveValidator } from \"./primitive-validator\";\r\nimport { applyNullable, getRuleOptions } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * String validator class\r\n */\r\nexport class StringValidator extends PrimitiveValidator {\r\n public constructor(errorMessage?: string) {\r\n super();\r\n this.addMutableRule(stringRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is a string type\r\n */\r\n public matchesType(value: any): boolean {\r\n return typeof value === \"string\";\r\n }\r\n\r\n // ==================== Mutators ====================\r\n\r\n /**\r\n * Stringify the value if not a string\r\n */\r\n public toString() {\r\n return this.addMutator(stringifyMutator);\r\n }\r\n\r\n /** Convert string to uppercase */\r\n public uppercase() {\r\n return this.addMutator(uppercaseMutator);\r\n }\r\n\r\n /** Convert string to lowercase */\r\n public lowercase() {\r\n return this.addMutator(lowercaseMutator);\r\n }\r\n\r\n /** Capitalize only the first letter of the string */\r\n public capitalize() {\r\n return this.addMutator(capitalizeMutator);\r\n }\r\n\r\n /** Capitalize the first letter of each word (Title Case) */\r\n public titleCase() {\r\n return this.addMutator(titleCaseMutator);\r\n }\r\n\r\n /** Convert to camelCase */\r\n public camelCase() {\r\n return this.addMutator(camelCaseMutator);\r\n }\r\n\r\n /** Convert to PascalCase */\r\n public pascalCase() {\r\n return this.addMutator(pascalCaseMutator);\r\n }\r\n\r\n /** Convert to snake_case */\r\n public snakeCase() {\r\n return this.addMutator(snakeCaseMutator);\r\n }\r\n\r\n /** Convert to kebab-case */\r\n public kebabCase() {\r\n return this.addMutator(kebabCaseMutator);\r\n }\r\n\r\n /**\r\n * Trim the given needle from the string\r\n * If no needle is provided, the default is a single space\r\n */\r\n public trim(needle?: string) {\r\n return this.addMutator(trimMutator, { needle });\r\n }\r\n\r\n /** Trim from the left/start */\r\n public ltrim(needle?: string) {\r\n return this.addMutator(ltrimMutator, { needle });\r\n }\r\n\r\n /** Trim from the right/end */\r\n public rtrim(needle?: string) {\r\n return this.addMutator(rtrimMutator, { needle });\r\n }\r\n\r\n /** Trim multiple whitespace into single space */\r\n public trimMultipleWhitespace() {\r\n return this.addMutator(trimMultipleWhitespaceMutator);\r\n }\r\n\r\n /** Pad string from the start to reach target length */\r\n public padStart(length: number, char = \" \") {\r\n return this.addMutator(padStartMutator, { length, char });\r\n }\r\n\r\n /** Pad string from the end to reach target length */\r\n public padEnd(length: number, char = \" \") {\r\n return this.addMutator(padEndMutator, { length, char });\r\n }\r\n\r\n /**\r\n * Strip HTML tags with a naive `<...>` regex.\r\n *\r\n * This is a **tag stripper, not an XSS sanitizer**: it is not a parser,\r\n * so malformed/nested markup or content re-introduced later in a\r\n * pipeline can defeat it. Do not rely on this alone to make untrusted\r\n * rich text safe to render — use a real parser-based sanitizer (e.g.\r\n * DOMPurify / sanitize-html) for that.\r\n */\r\n public stripTags() {\r\n return this.addMutator(stripTagsMutator);\r\n }\r\n\r\n /**\r\n * @deprecated Renamed to {@link StringValidator.stripTags} — the old\r\n * name implied XSS safety this tag-stripping regex does not provide.\r\n * Kept as an alias for backward compatibility; switch to `.stripTags()`.\r\n */\r\n public safeHtml() {\r\n return this.stripTags();\r\n }\r\n\r\n /** HTML escape special characters */\r\n public htmlEscape() {\r\n return this.addMutator(htmlEscapeMutator);\r\n }\r\n\r\n /** Unescape HTML entities */\r\n public unescapeHtml() {\r\n return this.addMutator(unescapeHtmlMutator);\r\n }\r\n\r\n /**\r\n * Remove special characters\r\n * This will remove all characters that are not alphanumeric or whitespace\r\n */\r\n public removeSpecialCharacters() {\r\n return this.addMutator(removeSpecialCharactersMutator);\r\n }\r\n\r\n /** Convert to only alphabetic characters */\r\n public toAlpha() {\r\n return this.addMutator(alphaOnlyMutator);\r\n }\r\n\r\n /** Convert to only alphanumeric characters */\r\n public toAlphanumeric() {\r\n return this.addMutator(alphanumericOnlyMutator);\r\n }\r\n\r\n /** Remove all numeric characters */\r\n public removeNumbers() {\r\n return this.addMutator(removeNumbersMutator);\r\n }\r\n\r\n /** URL decode */\r\n public urlDecode() {\r\n return this.addMutator(urlDecodeMutator);\r\n }\r\n\r\n /** URL encode */\r\n public urlEncode() {\r\n return this.addMutator(urlEncodeMutator);\r\n }\r\n\r\n /** Convert to URL-friendly slug */\r\n public slug() {\r\n return this.addMutator(slugMutator);\r\n }\r\n\r\n /** Base64 encode */\r\n public base64Encode() {\r\n return this.addMutator(base64EncodeMutator);\r\n }\r\n\r\n /** Base64 decode */\r\n public base64Decode() {\r\n return this.addMutator(base64DecodeMutator);\r\n }\r\n\r\n /** Replace substring or pattern */\r\n public replace(search: string | RegExp, replace: string) {\r\n return this.addMutator(replaceMutator, { search, replace });\r\n }\r\n\r\n /** Replace all occurrences of substring or pattern */\r\n public replaceAll(search: string | RegExp, replace: string) {\r\n return this.addMutator(replaceAllMutator, { search, replace });\r\n }\r\n\r\n /** Append/suffix text to the end */\r\n public append(suffix: string) {\r\n return this.addMutator(appendMutator, { suffix });\r\n }\r\n\r\n /** Prepend/prefix text to the beginning */\r\n public prepend(prefix: string) {\r\n return this.addMutator(prependMutator, { prefix });\r\n }\r\n\r\n /** Reverse the string */\r\n public reverse() {\r\n return this.addMutator(reverseMutator);\r\n }\r\n\r\n /** Truncate to a maximum length */\r\n public truncate(maxLength: number, suffix = \"...\") {\r\n return this.addMutator(truncateMutator, { maxLength, suffix });\r\n }\r\n\r\n /** Repeat string N times */\r\n public repeat(count: number) {\r\n return this.addMutator(repeatMutator, { count });\r\n }\r\n\r\n /** Mask part of string */\r\n public mask(start: number, end?: number, char = \"*\") {\r\n return this.addMutator(maskMutator, { start, end, char });\r\n }\r\n\r\n // ==================== Validation Rules ====================\r\n\r\n /** Value must be a valid email */\r\n public email(errorMessage?: string) {\r\n return this.addRule(emailRule, errorMessage);\r\n }\r\n\r\n /** Value must be a valid URL */\r\n public url(errorMessage?: string) {\r\n return this.addRule(urlRule, errorMessage);\r\n }\r\n\r\n /** Value can not have whitespace */\r\n public withoutWhitespace(errorMessage?: string) {\r\n return this.addRule(withoutWhitespaceRule, errorMessage);\r\n }\r\n\r\n /** Value must match the given pattern */\r\n public pattern(pattern: RegExp, errorMessage?: string) {\r\n return this.addRule(patternRule, errorMessage, { pattern });\r\n }\r\n\r\n /**\r\n * Value must be a strong password\r\n * Requirements:\r\n * - At least 8 characters\r\n * - At least 1 uppercase letter\r\n * - At least 1 lowercase letter\r\n * - At least 1 number\r\n * - At least 1 special character\r\n */\r\n public strongPassword(minLength?: number, errorMessage?: string) {\r\n return this.addRule(strongPasswordRule, errorMessage, { minLength });\r\n }\r\n\r\n /** Value must be exactly the given number of words */\r\n public words(words: number, errorMessage?: string) {\r\n return this.addRule(wordsRule, errorMessage, { words });\r\n }\r\n\r\n /** Value must be at least the given number of words */\r\n public minWords(words: number, errorMessage?: string) {\r\n return this.addRule(minWordsRule, errorMessage, { minWords: words });\r\n }\r\n\r\n /** Value must be at most the given number of words */\r\n public maxWords(words: number, errorMessage?: string) {\r\n return this.addRule(maxWordsRule, errorMessage, { maxWords: words });\r\n }\r\n\r\n /** Value length must be greater than the given length */\r\n public minLength(length: number, errorMessage?: string) {\r\n return this.addRule(minLengthRule, errorMessage, { minLength: length });\r\n }\r\n\r\n /** @alias minLength */\r\n public min(min: number, errorMessage?: string) {\r\n return this.minLength(min, errorMessage);\r\n }\r\n\r\n /** Value length must be less than the given length */\r\n public maxLength(length: number, errorMessage?: string) {\r\n return this.addRule(maxLengthRule, errorMessage, { maxLength: length });\r\n }\r\n\r\n /** @alias maxLength */\r\n public max(max: number, errorMessage?: string) {\r\n return this.maxLength(max, errorMessage);\r\n }\r\n\r\n /** Value must be of the given length */\r\n public length(length: number, errorMessage?: string) {\r\n return this.addRule(lengthRule, errorMessage, { length });\r\n }\r\n\r\n /**\r\n * String length must be between min and max (inclusive)\r\n *\r\n * @param min - Minimum length (inclusive)\r\n * @param max - Maximum length (inclusive)\r\n *\r\n * @example\r\n * ```ts\r\n * v.string().between(5, 10) // Length: 5 to 10 characters\r\n * v.string().lengthBetween(8, 20) // Same using alias\r\n * ```\r\n *\r\n * @category Validation Rule\r\n */\r\n public lengthBetween(min: number, max: number, errorMessage?: string) {\r\n return this.addRule(betweenLengthRule, errorMessage, {\r\n minLength: min,\r\n maxLength: max,\r\n });\r\n }\r\n\r\n /** Allow only alphabetic characters */\r\n public alpha(errorMessage?: string) {\r\n return this.addRule(alphaRule, errorMessage);\r\n }\r\n\r\n /** Allow only alphanumeric characters */\r\n public alphanumeric(errorMessage?: string) {\r\n return this.addRule(alphaNumericRule, errorMessage);\r\n }\r\n\r\n /** Allow only numeric characters */\r\n public numeric(errorMessage?: string) {\r\n return this.addRule(isNumericRule, errorMessage);\r\n }\r\n\r\n /** Value must starts with the given string */\r\n public startsWith(value: string, errorMessage?: string) {\r\n return this.addRule(startsWithRule, errorMessage, { value });\r\n }\r\n\r\n /** Value must ends with the given string */\r\n public endsWith(value: string, errorMessage?: string) {\r\n return this.addRule(endsWithRule, errorMessage, { value });\r\n }\r\n\r\n /** Value must contain the given string */\r\n public contains(value: string, errorMessage?: string) {\r\n return this.addRule(containsRule, errorMessage, { value });\r\n }\r\n\r\n /** Value must not contain the given string */\r\n public notContains(value: string, errorMessage?: string) {\r\n return this.addRule(notContainsRule, errorMessage, { value });\r\n }\r\n\r\n /** Value must be a valid IP address */\r\n public ip(errorMessage?: string) {\r\n return this.addRule(ipRule, errorMessage);\r\n }\r\n\r\n /** Value must be a valid IPv4 address */\r\n public ip4(errorMessage?: string) {\r\n return this.addRule(ip4Rule, errorMessage);\r\n }\r\n\r\n /** Value must be a valid IPv6 address */\r\n public ip6(errorMessage?: string) {\r\n return this.addRule(ip6Rule, errorMessage);\r\n }\r\n\r\n /** Check if the string matches a credit card number */\r\n public creditCard(errorMessage?: string) {\r\n return this.addRule(isCreditCardRule, errorMessage);\r\n }\r\n\r\n /** Determine if the value is a valid color */\r\n public color(errorMessage?: string) {\r\n return this.addRule(colorRule, errorMessage);\r\n }\r\n\r\n /** Determine if the value is a valid hex color */\r\n public hexColor(errorMessage?: string) {\r\n return this.addRule(hexColorRule, errorMessage);\r\n }\r\n\r\n /** Determine if the value is a valid HSL color */\r\n public hslColor(errorMessage?: string) {\r\n return this.addRule(hslColorRule, errorMessage);\r\n }\r\n\r\n /** Determine if the value is a valid RGB color */\r\n public rgbColor(errorMessage?: string) {\r\n return this.addRule(rgbColorRule, errorMessage);\r\n }\r\n\r\n /** Determine if the value is a valid RGBA color */\r\n public rgbaColor(errorMessage?: string) {\r\n return this.addRule(rgbaColorRule, errorMessage);\r\n }\r\n\r\n /** Determine if the value is a valid light color */\r\n public lightColor(errorMessage?: string) {\r\n return this.addRule(lightColorRule, errorMessage);\r\n }\r\n\r\n /** Determine if the value is a valid dark color */\r\n public darkColor(errorMessage?: string) {\r\n return this.addRule(darkColorRule, errorMessage);\r\n }\r\n\r\n // ==================== ID Format Rules ====================\r\n\r\n /**\r\n * Value must be a valid UUID. Optionally restrict to a specific version.\r\n *\r\n * @example\r\n * v.string().uuid() // any RFC 4122 UUID\r\n * v.string().uuid(4) // only v4 (random)\r\n * v.string().uuid(7) // only v7 (timestamp-ordered)\r\n */\r\n public uuid(version?: UUIDVersion, errorMessage?: string) {\r\n return this.addRule(uuidRule, errorMessage, { version });\r\n }\r\n\r\n /**\r\n * Value must be a valid CUID. Defaults to CUID2; pass `{ version: 1 }` for legacy.\r\n *\r\n * @example\r\n * v.string().cuid() // CUID2\r\n * v.string().cuid({ version: 1 }) // legacy CUID1\r\n */\r\n public cuid(options?: { version?: 1 | 2; errorMessage?: string }) {\r\n const { errorMessage, version } = options ?? {};\r\n return this.addRule(cuidRule, errorMessage, { version });\r\n }\r\n\r\n /** Value must be a valid ULID (26 chars, Crockford base32). */\r\n public ulid(errorMessage?: string) {\r\n return this.addRule(ulidRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Value must be a valid nanoid string. Default length is 21.\r\n *\r\n * @example\r\n * v.string().nanoid() // 21 chars (default)\r\n * v.string().nanoid(10) // 10 chars\r\n */\r\n public nanoid(length?: number, errorMessage?: string) {\r\n return this.addRule(nanoidRule, errorMessage, { length });\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Maps String-specific rule options to JSON Schema keywords.\r\n * Non-representable rules (cross-field, refine, color rules, etc.) are silently omitted.\r\n *\r\n * @example\r\n * ```ts\r\n * v.string().min(2).max(100).email().toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"string\", minLength: 2, maxLength: 100, format: \"email\" }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const schema: JsonSchemaResult = { type: \"string\" };\r\n\r\n // minLength / min\r\n const minOpts = getRuleOptions(this.rules, \"minLength\");\r\n if (minOpts?.minLength !== undefined) schema.minLength = minOpts.minLength;\r\n\r\n // maxLength / max\r\n const maxOpts = getRuleOptions(this.rules, \"maxLength\");\r\n if (maxOpts?.maxLength !== undefined) schema.maxLength = maxOpts.maxLength;\r\n\r\n // betweenLength covers both min and max in one rule\r\n const betweenOpts = getRuleOptions(this.rules, \"betweenLength\");\r\n if (betweenOpts) {\r\n if (betweenOpts.minLength !== undefined) schema.minLength = betweenOpts.minLength;\r\n if (betweenOpts.maxLength !== undefined) schema.maxLength = betweenOpts.maxLength;\r\n }\r\n\r\n // exact length\r\n const lengthOpts = getRuleOptions(this.rules, \"length\");\r\n if (lengthOpts?.length !== undefined) {\r\n schema.minLength = lengthOpts.length;\r\n schema.maxLength = lengthOpts.length;\r\n }\r\n\r\n // pattern (regex)\r\n const patternOpts = getRuleOptions(this.rules, \"pattern\");\r\n if (patternOpts?.pattern instanceof RegExp) {\r\n schema.pattern = patternOpts.pattern.source;\r\n }\r\n\r\n // format hints\r\n if (getRuleOptions(this.rules, \"email\") !== undefined ||\r\n this.rules.some(r => r.name === \"email\")) {\r\n schema.format = \"email\";\r\n } else if (this.rules.some(r => r.name === \"url\")) {\r\n schema.format = \"uri\";\r\n } else if (this.rules.some(r => r.name === \"ip\")) {\r\n schema.format = \"ipv4\";\r\n } else if (this.rules.some(r => r.name === \"ip4\")) {\r\n schema.format = \"ipv4\";\r\n } else if (this.rules.some(r => r.name === \"ip6\")) {\r\n schema.format = \"ipv6\";\r\n } else if (this.rules.some(r => r.name === \"uuid\")) {\r\n schema.format = \"uuid\";\r\n } else if (this.rules.some(r => r.name === \"hexColor\")) {\r\n schema.format = \"color\";\r\n }\r\n\r\n // CUID / ULID / nanoid don't have widely-supported format keywords —\r\n // fall back to pattern so JSON Schema validators still enforce shape.\r\n if (!schema.format) {\r\n const cuidOpts = getRuleOptions(this.rules, \"cuid\");\r\n if (cuidOpts) {\r\n schema.pattern = cuidOpts.version === 1 ? \"^c[a-z0-9]{24,}$\" : \"^[a-z][a-z0-9]{23}$\";\r\n }\r\n if (this.rules.some(r => r.name === \"ulid\")) {\r\n schema.pattern = \"^[0-9A-HJKMNP-TV-Z]{26}$\";\r\n }\r\n const nanoidOpts = getRuleOptions(this.rules, \"nanoid\");\r\n if (nanoidOpts) {\r\n const len = (nanoidOpts.length as number | undefined) ?? 21;\r\n schema.pattern = `^[A-Za-z0-9_-]{${len}}$`;\r\n }\r\n }\r\n\r\n // enum (from PrimitiveValidator.in / .enum)\r\n const inOpts = getRuleOptions(this.rules, \"in\");\r\n if (inOpts?.values && Array.isArray(inOpts.values)) {\r\n schema.enum = inOpts.values;\r\n }\r\n\r\n if (this.isNullable) applyNullable(schema, target);\r\n\r\n return schema;\r\n }\r\n}\r\n","import { setKeyPath } from \"../helpers\";\r\nimport { arrayRule } from \"../rules\";\r\nimport type { SchemaContext, ValidationResult } from \"../types\";\r\nimport { BaseValidator } from \"./base-validator\";\r\nimport { applyNullable } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Tuple validator class - validates fixed-length arrays with position-specific types\r\n *\r\n * @example\r\n * ```ts\r\n * // RGB color tuple\r\n * v.tuple([v.number(), v.number(), v.number()])\r\n * // Valid: [255, 128, 0]\r\n * // Invalid: [255, 128] (too short)\r\n *\r\n * // Mixed types\r\n * v.tuple([v.string(), v.int(), v.boolean()])\r\n * // Valid: [\"John\", 25, true]\r\n * ```\r\n */\r\nexport class TupleValidator extends BaseValidator {\r\n public constructor(\r\n public validators: BaseValidator[],\r\n errorMessage?: string,\r\n ) {\r\n super();\r\n this.addMutableRule(arrayRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is an array type\r\n */\r\n public matchesType(value: any): boolean {\r\n return Array.isArray(value);\r\n }\r\n\r\n /**\r\n * Clone the validator\r\n */\r\n public override clone(): this {\r\n const cloned = super.clone();\r\n cloned.validators = this.validators.map((v) => v.clone());\r\n return cloned;\r\n }\r\n\r\n /**\r\n * Validate tuple - check length then validate each position\r\n *\r\n * Absent input (and absent without `.default()`) propagates as `data: undefined`\r\n * so the parent ObjectValidator can omit the key. Without this, optional tuple\r\n * fields would silently materialise as `[]` in the validated output and then\r\n * fail the length check.\r\n */\r\n public async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\r\n // Apply default when absent, then mutate. Mirrors BaseValidator's\r\n // `valueForRules = data ?? this.getDefaultValue()` so `.default([...])`\r\n // works on tuples too.\r\n const valueForRules = data ?? this.getDefaultValue();\r\n const mutatedData = await this.mutate(valueForRules, context);\r\n\r\n const result = await super.validate(data, context);\r\n\r\n if (result.isValid === false) return result;\r\n\r\n // Nothing to iterate for absent (no default) or null (nullable) inputs —\r\n // propagate so the parent ObjectValidator can omit the key.\r\n if (mutatedData === undefined || mutatedData === null) return result;\r\n\r\n // Defensive: type rule (arrayRule) should have failed for non-arrays.\r\n if (!Array.isArray(mutatedData)) return result;\r\n\r\n const errors: ValidationResult[\"errors\"] = [];\r\n\r\n // Tuple-specific: length validation\r\n if (mutatedData.length !== this.validators.length) {\r\n errors.push({\r\n type: \"tuple\",\r\n input: context.key || \"value\",\r\n error: `Expected exactly ${this.validators.length} items, but got ${mutatedData.length}`,\r\n });\r\n return { isValid: false, errors, data: mutatedData };\r\n }\r\n\r\n // Validate each position with its specific validator in parallel\r\n const validationPromises = this.validators.map(async (validator, index) => {\r\n const childContext: SchemaContext = {\r\n ...context,\r\n parent: mutatedData,\r\n value: mutatedData[index],\r\n key: index.toString(),\r\n path: setKeyPath(context.path, index.toString()),\r\n };\r\n\r\n const childResult = await validator.validate(mutatedData[index], childContext);\r\n\r\n // Update mutated data with validated result\r\n mutatedData[index] = childResult.data;\r\n\r\n // Collect errors from this element\r\n if (childResult.isValid === false) {\r\n errors.push(...childResult.errors);\r\n }\r\n });\r\n\r\n await Promise.all(validationPromises);\r\n\r\n return {\r\n isValid: errors.length === 0,\r\n errors,\r\n data: await this.startTransformationPipeline(mutatedData, context),\r\n };\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Tuple keyword diverges between targets:\r\n * - `draft-2020-12` → `prefixItems` + `items: false` (exact length enforced)\r\n * - `draft-07` → `items` as array + `additionalItems: false`\r\n * - `openapi-3.0` → same as draft-07 (OpenAPI 3.0 is based on draft-07)\r\n *\r\n * @example\r\n * ```ts\r\n * v.tuple([v.string(), v.int(), v.boolean()]).toJsonSchema(\"draft-2020-12\")\r\n * // → {\r\n * // type: \"array\",\r\n * // prefixItems: [{ type: \"string\" }, { type: \"integer\" }, { type: \"boolean\" }],\r\n * // items: false,\r\n * // minItems: 3,\r\n * // maxItems: 3\r\n * // }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const itemSchemas = this.validators.map(v => v.toJsonSchema(target));\r\n const length = this.validators.length;\r\n\r\n const schema: JsonSchemaResult = {\r\n type: \"array\",\r\n minItems: length,\r\n maxItems: length,\r\n };\r\n\r\n if (target === \"draft-2020-12\") {\r\n // prefixItems is the draft-2020-12 keyword for positional tuple items\r\n schema.prefixItems = itemSchemas;\r\n schema.items = false; // no additional items beyond the tuple\r\n } else {\r\n // draft-07 and openapi-3.0: items as array + additionalItems: false\r\n schema.items = itemSchemas;\r\n schema.additionalItems = false;\r\n }\r\n\r\n if (this.isNullable) applyNullable(schema, target);\r\n\r\n return schema;\r\n }\r\n}\r\n","import { unionRule } from \"../rules\";\r\nimport { BaseValidator } from \"./base-validator\";\r\nimport { getRuleOptions } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Union validator class - validates value against multiple validator types\r\n *\r\n * Tries each validator in order until one passes. If a validator's matchesType()\r\n * returns false, it's skipped for optimization. First validator that both matches\r\n * the type and passes validation wins.\r\n *\r\n * @example\r\n * ```ts\r\n * // Accept email or username\r\n * const identifier = v.union([\r\n * v.string().email(),\r\n * v.string().alphanumeric().min(3).max(20)\r\n * ]);\r\n *\r\n * // Accept different types\r\n * const customValue = v.union([\r\n * v.string().required(),\r\n * v.number().required(),\r\n * v.boolean().required(),\r\n * v.file().required()\r\n * ]);\r\n * ```\r\n */\r\nexport class UnionValidator extends BaseValidator {\r\n /**\r\n * Set the validators to try for union validation\r\n *\r\n * @param validators - Array of validators to try\r\n * @param errorMessage - Optional custom error message if all validators fail\r\n * @returns This validator for chaining\r\n *\r\n * @example\r\n * ```ts\r\n * new UnionValidator()\r\n * .union([v.string(), v.number()], 'Must be string or number');\r\n * ```\r\n */\r\n public union(validators: BaseValidator[], errorMessage?: string) {\r\n return this.addRule(unionRule, errorMessage, { validators });\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Generates `{ oneOf: [...] }` by mapping each sub-validator to its JSON Schema.\r\n *\r\n * @example\r\n * ```ts\r\n * v.union([v.string(), v.number()]).toJsonSchema(\"draft-2020-12\")\r\n * // → { oneOf: [{ type: \"string\" }, { type: \"number\" }] }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const opts = getRuleOptions(this.rules, \"union\");\r\n const validators = (opts?.validators ?? []) as BaseValidator[];\r\n\r\n return {\r\n oneOf: validators.map(v => v.toJsonSchema(target)),\r\n };\r\n }\r\n}\r\n","import { type SealConfig } from \"../config\";\nimport type { StandardSchemaV1 } from \"../standard-schema/types\";\nimport type { Schema, SchemaContext, ValidationResult } from \"../types\";\nimport type { Infer } from \"../types/inference-types\";\nimport { AnyValidator } from \"../validators/any-validator\";\nimport { ArrayValidator } from \"../validators/array-validator\";\nimport type { BaseValidator } from \"../validators/base-validator\";\nimport { BooleanValidator } from \"../validators/boolean-validator\";\nimport { ComputedValidator } from \"../validators/computed-validator\";\nimport { DateValidator } from \"../validators/date-validator\";\nimport { DiscriminatedUnionValidator } from \"../validators/discriminated-union-validator\";\nimport { FloatValidator } from \"../validators/float-validator\";\nimport { InstanceOfValidator } from \"../validators/instanceof-validator\";\nimport { IntValidator } from \"../validators/int-validator\";\nimport { LazyValidator } from \"../validators/lazy-validator\";\nimport { LiteralValidator } from \"../validators/literal-validator\";\nimport { ManagedValidator } from \"../validators/managed-validator\";\nimport { NumberValidator } from \"../validators/number-validator\";\nimport { NumericValidator } from \"../validators/numeric-validator\";\nimport { ObjectValidator } from \"../validators/object-validator\";\nimport { RecordValidator } from \"../validators/record-validator\";\nimport { ScalarValidator } from \"../validators/scalar-validator\";\nimport { StringValidator } from \"../validators/string-validator\";\nimport { TupleValidator } from \"../validators/tuple-validator\";\nimport { UnionValidator } from \"../validators/union-validator\";\n// BaseValidator prototype augmentations — side-effect imports so the `v`\n// factory always exposes the chain methods (.required, .requiredIf, .sameAs,\n// .present, .forbidden, .when, …) regardless of which entry path loaded it.\n// The package barrel (src/index.ts) loads these via the validators barrel, but\n// importing the factory leaf directly would otherwise yield a half-built `v`.\nimport \"../validators/methods/equality-conditional-methods\";\nimport \"../validators/methods/forbidden-methods\";\nimport \"../validators/methods/present-methods\";\nimport \"../validators/methods/required-methods\";\nimport { validate as validateFunction } from \"./validate\";\n\n/**\n * Seal factory object - creates instances of validators\n *\n * Use 'v' to create validation schemas (seals) for your data\n */\nexport const v: ValidatorV = {\n /** Create an object validator */\n object: <T extends Schema>(schema: T, errorMessage?: string) =>\n new ObjectValidator<T>(schema, errorMessage) as ObjectValidator<T> &\n StandardSchemaV1<Infer<ObjectValidator<T>>>,\n\n /** Create an any validator */\n any: () => new AnyValidator() as AnyValidator & StandardSchemaV1<any>,\n\n /** Create an array validator */\n array: <T extends BaseValidator>(validator: T, errorMessage?: string) =>\n new ArrayValidator(validator, errorMessage) as ArrayValidator & {\n validator: T;\n } & StandardSchemaV1<Array<Infer<T>>>,\n\n /** Create a record validator - object with dynamic keys and consistent value types */\n record: <T extends BaseValidator>(validator?: T, errorMessage?: string) =>\n new RecordValidator(validator || v.any(), errorMessage) as RecordValidator & {\n valueValidator: T;\n } & StandardSchemaV1<Record<string, Infer<T>>>,\n\n /** Create a tuple validator - fixed-length array with position-specific types */\n tuple: <T extends BaseValidator[]>(validators: T, errorMessage?: string) =>\n new TupleValidator(validators, errorMessage) as TupleValidator & {\n validators: T;\n } & StandardSchemaV1<{ [K in keyof T]: Infer<T[K]> }>,\n\n /** Create a date validator */\n date: (errorMessage?: string) =>\n new DateValidator(errorMessage) as DateValidator & StandardSchemaV1<Date>,\n\n /**\n * Create a literal validator — narrows to the union of given literal values\n *\n * @example\n * v.literal(\"items\") // type: \"items\"\n * v.literal(\"draft\", \"published\") // type: \"draft\" | \"published\"\n * v.literal(1, 2, 3) // type: 1 | 2 | 3\n */\n literal: <T extends readonly [string | number | boolean, ...(string | number | boolean)[]]>(\n ...values: T\n ) =>\n new LiteralValidator<T>(values) as LiteralValidator<T> & StandardSchemaV1<T[number]>,\n\n /**\n * Create an instanceof validator — value must be `instanceof` the constructor\n *\n * @example\n * v.instanceof(File) // type: File\n * v.instanceof(Buffer) // type: Buffer\n * v.instanceof(MyClass) // type: MyClass\n */\n instanceof: <T>(ctor: new (...args: any[]) => T, errorMessage?: string) =>\n new InstanceOfValidator<T>(ctor, errorMessage) as InstanceOfValidator<T> &\n StandardSchemaV1<T>,\n\n /**\n * Create a lazy validator — defers resolution of the inner validator until\n * validate-time. Use for recursive or forward-referenced schemas.\n *\n * @example\n * type Category = { name: string; children: Category[] };\n *\n * const category: ObjectValidator<...> = v.object({\n * name: v.string(),\n * children: v.array(v.lazy(() => category)),\n * });\n */\n lazy: <T extends BaseValidator>(thunk: () => T) =>\n new LazyValidator(thunk) as LazyValidator<T> & StandardSchemaV1<Infer<T>>,\n\n /** Create a string validator */\n string: (errorMessage?: string) =>\n new StringValidator(errorMessage) as StringValidator & StandardSchemaV1<string>,\n\n /** Create an email validator */\n email: (emailErrorMessage?: string, errorMessage?: string) =>\n new StringValidator(errorMessage).email(emailErrorMessage) as StringValidator &\n StandardSchemaV1<string>,\n\n /**\n * Create an enum validator — preserves the literal union of accepted\n * values in the inferred Standard Schema output.\n *\n * Two input shapes:\n * - Tuple of literals: `v.enum([\"draft\", \"published\"])` →\n * `StandardSchemaV1<\"draft\" | \"published\">`\n * - TypeScript enum object: `v.enum(Status)` →\n * `StandardSchemaV1<Status[keyof Status]>`\n *\n * Implementation is loosely typed; the public `ValidatorV.enum`\n * surface declares the precise overloads.\n */\n enum: ((values: any, errorMessage?: string) =>\n Array.isArray(values)\n ? new StringValidator().oneOf(values, errorMessage)\n : new ScalarValidator().enum(values, errorMessage)) as ValidatorV[\"enum\"],\n\n /** Create a number validator */\n number: (errorMessage?: string) =>\n new NumberValidator(errorMessage) as NumberValidator & StandardSchemaV1<number>,\n\n /** Create a numeric validator */\n numeric: (errorMessage?: string) =>\n new NumericValidator(errorMessage) as NumericValidator & StandardSchemaV1<number>,\n\n /** Create an integer validator */\n int: (errorMessage?: string) =>\n new IntValidator(errorMessage) as IntValidator & StandardSchemaV1<number>,\n\n /** Create a float validator */\n float: (errorMessage?: string) =>\n new FloatValidator(errorMessage) as FloatValidator & StandardSchemaV1<number>,\n\n /** Create a boolean validator */\n boolean: (errorMessage?: string) =>\n new BooleanValidator(errorMessage) as BooleanValidator & StandardSchemaV1<boolean>,\n\n /** Create a scalar validator */\n scalar: (errorMessage?: string) =>\n new ScalarValidator(errorMessage) as ScalarValidator &\n StandardSchemaV1<string | number | boolean>,\n\n /** Create a union validator - validates against multiple types */\n union: <T extends BaseValidator[]>(validators: T, errorMessage?: string) =>\n new UnionValidator().union(validators, errorMessage) as UnionValidator &\n StandardSchemaV1<Infer<T[number]>>,\n\n /**\n * Create a discriminated union — routes payloads by a shared literal\n * discriminator field. Each branch must be a `v.object(...)` with the\n * discriminator typed as `v.literal(...)`.\n *\n * @example\n * const email = v.object({ type: v.literal(\"email\"), email: v.string().email() });\n * const sms = v.object({ type: v.literal(\"sms\"), phone: v.string() });\n * const notif = v.discriminatedUnion(\"type\", [email, sms]);\n * // type T = Infer<typeof notif>;\n * // → { type: \"email\", email: string } | { type: \"sms\", phone: string }\n */\n discriminatedUnion: <\n K extends string,\n Branches extends ReadonlyArray<ObjectValidator<any>>,\n >(\n discriminator: K,\n validators: Branches,\n ) =>\n new DiscriminatedUnionValidator(discriminator, validators) as DiscriminatedUnionValidator<\n K,\n Branches\n > &\n StandardSchemaV1<Infer<Branches[number]>>,\n\n /** Create a computed field validator - derives value from other validated fields */\n computed: <TResult = any>(\n callback: (data: any, context: SchemaContext) => TResult | Promise<TResult>,\n resultValidator?: BaseValidator,\n ) =>\n new ComputedValidator<TResult>(callback, resultValidator) as ComputedValidator<TResult> &\n StandardSchemaV1<TResult>,\n\n /** Create a managed field validator - framework-injected value */\n managed: <TResult = any>(\n callback: (context: SchemaContext) => TResult | Promise<TResult>,\n resultValidator?: BaseValidator,\n ) =>\n new ManagedValidator<TResult>(callback, resultValidator) as ManagedValidator<TResult> &\n StandardSchemaV1<TResult>,\n\n /** Validate data against a schema */\n validate: validateFunction,\n} as unknown as ValidatorV;\n\nexport type ValidateOptions = {\n context?: Record<string, any>;\n} & SealConfig;\n\nexport interface ValidatorV {\n object: <T extends Schema>(\n schema: T,\n errorMessage?: string,\n ) => ObjectValidator<T> & StandardSchemaV1<Infer<ObjectValidator<T>>>;\n any: () => AnyValidator & StandardSchemaV1<any>;\n array: <T extends BaseValidator>(\n validator: T,\n errorMessage?: string,\n ) => ArrayValidator & {\n validator: T;\n } & StandardSchemaV1<Array<Infer<T>>>;\n record: <T extends BaseValidator>(\n validator?: T,\n errorMessage?: string,\n ) => RecordValidator & {\n valueValidator: T;\n } & StandardSchemaV1<Record<string, Infer<T>>>;\n tuple: <T extends BaseValidator[]>(\n validators: T,\n errorMessage?: string,\n ) => TupleValidator & {\n validators: T;\n } & StandardSchemaV1<{ [K in keyof T]: Infer<T[K]> }>;\n date: (errorMessage?: string) => DateValidator & StandardSchemaV1<Date>;\n literal: <T extends readonly [string | number | boolean, ...(string | number | boolean)[]]>(\n ...values: T\n ) => LiteralValidator<T> & StandardSchemaV1<T[number]>;\n instanceof: <T>(\n ctor: new (...args: any[]) => T,\n errorMessage?: string,\n ) => InstanceOfValidator<T> & StandardSchemaV1<T>;\n lazy: <T extends BaseValidator>(\n thunk: () => T,\n ) => LazyValidator<T> & StandardSchemaV1<Infer<T>>;\n string: (errorMessage?: string) => StringValidator & StandardSchemaV1<string>;\n email: (errorMessage?: string) => StringValidator & StandardSchemaV1<string>;\n enum: {\n <const T extends readonly (string | number | boolean)[]>(\n values: T,\n errorMessage?: string,\n ): ScalarValidator & StandardSchemaV1<T[number]>;\n <const T extends Record<string, string | number>>(\n values: T,\n errorMessage?: string,\n ): ScalarValidator & StandardSchemaV1<T[keyof T]>;\n };\n number: (errorMessage?: string) => NumberValidator & StandardSchemaV1<number>;\n numeric: (errorMessage?: string) => NumericValidator & StandardSchemaV1<number>;\n int: (errorMessage?: string) => IntValidator & StandardSchemaV1<number>;\n float: (errorMessage?: string) => FloatValidator & StandardSchemaV1<number>;\n boolean: (errorMessage?: string) => BooleanValidator & StandardSchemaV1<boolean>;\n scalar: (\n errorMessage?: string,\n ) => ScalarValidator & StandardSchemaV1<string | number | boolean>;\n union: <T extends BaseValidator[]>(\n validators: T,\n errorMessage?: string,\n ) => UnionValidator & StandardSchemaV1<Infer<T[number]>>;\n discriminatedUnion: <\n K extends string,\n Branches extends ReadonlyArray<ObjectValidator<any>>,\n >(\n discriminator: K,\n validators: Branches,\n ) => DiscriminatedUnionValidator<K, Branches> & StandardSchemaV1<Infer<Branches[number]>>;\n computed: <TResult = any>(\n callback: (data: any, context: SchemaContext) => TResult | Promise<TResult>,\n resultValidator?: BaseValidator,\n ) => ComputedValidator<TResult> & StandardSchemaV1<TResult>;\n managed: <TResult = any>(\n callback?: (context: SchemaContext) => TResult | Promise<TResult>,\n resultValidator?: BaseValidator,\n ) => ManagedValidator<TResult> & StandardSchemaV1<TResult>;\n validate: <T extends BaseValidator>(\n schema: T,\n data: any,\n options?: ValidateOptions,\n ) => Promise<ValidationResult>;\n}\n","import { log } from \"@warlock.js/logger\";\r\nimport { v } from \"@warlock.js/seal\";\r\nimport { randomUUID } from \"node:crypto\";\r\nimport type { ChannelContract } from \"../../contracts\";\r\nimport type {\r\n ChannelOptions,\r\n ChannelStats,\r\n Message,\r\n MessageContext,\r\n MessageHandler,\r\n MessageMetadata,\r\n PublishOptions,\r\n RequestOptions,\r\n ResponseHandler,\r\n SubscribeOptions,\r\n Subscription,\r\n} from \"../../types\";\r\n\r\n/**\r\n * RabbitMQ Channel Implementation\r\n *\r\n * Wraps a RabbitMQ queue/exchange with a unified API.\r\n *\r\n * @template TPayload - The typed payload\r\n */\r\nexport class RabbitMQChannel<TPayload = unknown> implements ChannelContract<TPayload> {\r\n public readonly name: string;\r\n public readonly options: ChannelOptions<TPayload>;\r\n\r\n private readonly amqpChannel: any;\r\n private readonly subscriptions = new Map<string, RabbitMQSubscription>();\r\n private asserted = false;\r\n\r\n /**\r\n * Create a new RabbitMQ channel\r\n */\r\n public constructor(name: string, amqpChannel: any, options?: ChannelOptions<TPayload>) {\r\n this.name = name;\r\n this.amqpChannel = amqpChannel;\r\n this.options = options ?? {};\r\n }\r\n\r\n /**\r\n * Assert the queue exists\r\n */\r\n public async assert(): Promise<void> {\r\n if (this.asserted) return;\r\n\r\n const queueOptions = {\r\n durable: this.options.durable ?? true,\r\n autoDelete: this.options.autoDelete ?? false,\r\n exclusive: this.options.exclusive ?? false,\r\n messageTtl: this.options.messageTtl,\r\n maxLength: this.options.maxLength,\r\n deadLetterExchange: this.options.deadLetter?.channel ? \"\" : undefined,\r\n deadLetterRoutingKey: this.options.deadLetter?.channel,\r\n };\r\n\r\n await this.amqpChannel.assertQueue(this.name, queueOptions);\r\n this.asserted = true;\r\n }\r\n\r\n /**\r\n * Publish a message\r\n */\r\n public async publish(payload: TPayload, options?: PublishOptions): Promise<void> {\r\n await this.assert();\r\n\r\n // Validate with schema if provided\r\n if (this.options.schema) {\r\n const context = {\r\n allValues: payload,\r\n value: payload,\r\n };\r\n const result = await v.validate(this.options.schema, payload, { context });\r\n if (!result.isValid) {\r\n throw new Error(`Message validation failed: ${JSON.stringify(result.errors)}`);\r\n }\r\n payload = result.data as TPayload;\r\n }\r\n\r\n const messageId = randomUUID();\r\n const timestamp = new Date();\r\n\r\n const messageContent = JSON.stringify({\r\n payload,\r\n metadata: {\r\n messageId,\r\n timestamp: timestamp.toISOString(),\r\n correlationId: options?.correlationId,\r\n headers: options?.headers,\r\n },\r\n });\r\n\r\n const publishOptions: any = {\r\n persistent: options?.persistent ?? true,\r\n messageId,\r\n timestamp: timestamp.getTime(),\r\n correlationId: options?.correlationId,\r\n expiration: options?.expiration?.toString(),\r\n priority: options?.priority,\r\n headers: options?.headers,\r\n };\r\n\r\n // Handle delayed messages (requires rabbitmq-delayed-message-exchange plugin)\r\n if (options?.delay) {\r\n publishOptions.headers = {\r\n ...publishOptions.headers,\r\n \"x-delay\": options.delay,\r\n };\r\n }\r\n\r\n this.amqpChannel.sendToQueue(this.name, Buffer.from(messageContent), publishOptions);\r\n }\r\n\r\n /**\r\n * Publish multiple messages\r\n */\r\n public async publishBatch(messages: TPayload[], options?: PublishOptions): Promise<void> {\r\n for (const payload of messages) {\r\n await this.publish(payload, options);\r\n }\r\n }\r\n\r\n /**\r\n * Subscribe to messages\r\n *\r\n * Smart auto-ack behavior (when autoAck is not true):\r\n * - If handler completes successfully without explicit ack/nack/reject → auto-ack\r\n * - If handler throws an error → auto-nack (with retry if configured)\r\n * - If handler explicitly calls ack/nack/reject → respects that call\r\n */\r\n public async subscribe(\r\n handler: MessageHandler<TPayload>,\r\n options?: SubscribeOptions,\r\n ): Promise<Subscription> {\r\n await this.assert();\r\n\r\n // Use consumerId from options if provided, otherwise generate a random one\r\n const subscriptionId = options?.consumerId ?? randomUUID();\r\n\r\n // Set prefetch if specified\r\n if (options?.prefetch) {\r\n await this.amqpChannel.prefetch(options.prefetch);\r\n }\r\n\r\n // If autoAck is true, RabbitMQ handles ack immediately (fire-and-forget)\r\n const isFireAndForget = options?.autoAck === true;\r\n\r\n const consumerOptions = {\r\n noAck: isFireAndForget,\r\n exclusive: options?.exclusive ?? false,\r\n consumerTag: options?.group ?? subscriptionId,\r\n };\r\n\r\n const { consumerTag } = await this.amqpChannel.consume(\r\n this.name,\r\n async (msg: any) => {\r\n if (!msg) return;\r\n\r\n // Track if acknowledgment was handled explicitly\r\n let ackHandled = isFireAndForget;\r\n\r\n // Populated once the message is successfully parsed, so the catch\r\n // block below can dead-letter with the full envelope. Stays\r\n // `undefined` when `JSON.parse` itself is what threw.\r\n let parsedMessage: Message<TPayload> | undefined;\r\n\r\n try {\r\n const content = JSON.parse(msg.content.toString());\r\n let payload = content.payload as TPayload;\r\n\r\n // Validate with schema if provided\r\n if (this.options.schema) {\r\n const context = {\r\n allValues: payload,\r\n value: payload,\r\n };\r\n const result = await v.validate(this.options.schema, payload, { context });\r\n if (!result.isValid) {\r\n // Reject invalid messages\r\n this.amqpChannel.nack(msg, false, false);\r\n return;\r\n }\r\n payload = result.data as TPayload;\r\n }\r\n\r\n const metadata: MessageMetadata = {\r\n messageId: msg.properties.messageId || content.metadata?.messageId || randomUUID(),\r\n timestamp: new Date(msg.properties.timestamp || content.metadata?.timestamp),\r\n correlationId: msg.properties.correlationId || content.metadata?.correlationId,\r\n replyTo: msg.properties.replyTo,\r\n priority: msg.properties.priority,\r\n headers: msg.properties.headers,\r\n retryCount: msg.properties.headers?.[\"x-retry-count\"] || 0,\r\n originalChannel: this.name,\r\n };\r\n\r\n const message: Message<TPayload> = {\r\n metadata,\r\n payload,\r\n raw: msg,\r\n };\r\n\r\n parsedMessage = message;\r\n\r\n const context: MessageContext = {\r\n ack: async () => {\r\n if (!ackHandled) {\r\n ackHandled = true;\r\n this.amqpChannel.ack(msg);\r\n }\r\n },\r\n nack: async (requeue = true) => {\r\n if (!ackHandled) {\r\n ackHandled = true;\r\n this.amqpChannel.nack(msg, false, requeue);\r\n }\r\n },\r\n reject: async () => {\r\n if (!ackHandled) {\r\n ackHandled = true;\r\n this.amqpChannel.reject(msg, false);\r\n }\r\n },\r\n reply: async <T>(replyPayload: T) => {\r\n if (msg.properties.replyTo) {\r\n const replyContent = JSON.stringify({\r\n payload: replyPayload,\r\n metadata: {\r\n messageId: randomUUID(),\r\n timestamp: new Date().toISOString(),\r\n correlationId: msg.properties.correlationId,\r\n },\r\n });\r\n\r\n this.amqpChannel.sendToQueue(msg.properties.replyTo, Buffer.from(replyContent), {\r\n correlationId: msg.properties.correlationId,\r\n });\r\n }\r\n },\r\n retry: async (delay?: number) => {\r\n if (ackHandled) return;\r\n ackHandled = true;\r\n\r\n await this.retryOrGiveUp(msg, metadata.retryCount || 0, options, message, delay);\r\n },\r\n };\r\n\r\n // Execute handler\r\n await handler(message, context);\r\n\r\n // Smart auto-ack: if handler succeeded and didn't explicitly handle ack\r\n if (!ackHandled) {\r\n this.amqpChannel.ack(msg);\r\n }\r\n } catch (error) {\r\n // Smart auto-nack: if handler threw and didn't explicitly handle ack\r\n if (ackHandled) return;\r\n\r\n if (options?.retry) {\r\n // A bare `nack(msg, false, true)` redelivers the ORIGINAL message\r\n // untouched — amqplib/RabbitMQ do not add an `x-retry-count`\r\n // header on requeue, so a plain requeue here never advances the\r\n // counter and `maxRetries`/`deadLetter` are silently never\r\n // reached. Route through the same bounded-retry path `ctx.retry()`\r\n // uses, so the counter increments (and the cap/dead-letter fires)\r\n // on this automatic path too.\r\n const currentRetryCount = msg.properties.headers?.[\"x-retry-count\"] || 0;\r\n await this.retryOrGiveUp(msg, currentRetryCount, options, parsedMessage);\r\n } else {\r\n // No retry configured - reject without requeue (already bounded:\r\n // a single attempt, no requeue loop possible).\r\n this.amqpChannel.nack(msg, false, false);\r\n }\r\n }\r\n },\r\n consumerOptions,\r\n );\r\n\r\n const subscription = new RabbitMQSubscription(\r\n subscriptionId,\r\n this.name,\r\n consumerTag,\r\n this.amqpChannel,\r\n );\r\n\r\n this.subscriptions.set(subscriptionId, subscription);\r\n\r\n return subscription;\r\n }\r\n\r\n /**\r\n * Unsubscribe by consumer ID\r\n */\r\n public async unsubscribeById(consumerId: string): Promise<void> {\r\n const subscription = this.subscriptions.get(consumerId);\r\n if (subscription) {\r\n await subscription.unsubscribe();\r\n this.subscriptions.delete(consumerId);\r\n }\r\n }\r\n\r\n /**\r\n * Stop consuming messages on this channel.\r\n * Cancels all active subscriptions gracefully.\r\n */\r\n public async stopConsuming(): Promise<void> {\r\n const cancellations = Array.from(this.subscriptions.values()).map(sub =>\r\n sub.unsubscribe(),\r\n );\r\n await Promise.all(cancellations);\r\n }\r\n\r\n /**\r\n * Send message to dead-letter queue\r\n */\r\n private async sendToDeadLetter(\r\n message: Message<TPayload>,\r\n deadLetterChannel: string,\r\n ): Promise<void> {\r\n const content = JSON.stringify({\r\n payload: message.payload,\r\n metadata: {\r\n ...message.metadata,\r\n originalChannel: this.name,\r\n },\r\n });\r\n\r\n this.amqpChannel.sendToQueue(deadLetterChannel, Buffer.from(content), { persistent: true });\r\n }\r\n\r\n /**\r\n * Dead-letter a message whose body couldn't be parsed into a {@link Message}\r\n * (e.g. `JSON.parse` itself threw before an envelope existed). Forwards the\r\n * raw AMQP bytes/properties as-is rather than re-deriving a payload, so a\r\n * malformed message isn't lost.\r\n */\r\n private sendToDeadLetterRaw(msg: any, deadLetterChannel: string): void {\r\n this.amqpChannel.sendToQueue(deadLetterChannel, msg.content, {\r\n ...msg.properties,\r\n persistent: true,\r\n });\r\n }\r\n\r\n /**\r\n * Bounded retry shared by the explicit `ctx.retry()` call and the automatic\r\n * catch when a handler throws without calling it itself — so both paths\r\n * honor the same cap instead of the automatic path silently requeueing\r\n * forever (see `subscribe()`'s catch block).\r\n *\r\n * Under the cap: republishes with an incremented `x-retry-count` header —\r\n * NOT a plain `nack(msg, false, true)`, which redelivers the original\r\n * message untouched and never advances the counter.\r\n *\r\n * At/over the cap: dead-letters if configured, otherwise drops the message\r\n * with a loud `log.error` (never a silent drop) so an operator can see a\r\n * poison message was discarded instead of it vanishing without a trace.\r\n */\r\n private async retryOrGiveUp(\r\n msg: any,\r\n currentRetryCount: number,\r\n options: SubscribeOptions | undefined,\r\n parsedMessage: Message<TPayload> | undefined,\r\n delay?: number,\r\n ): Promise<void> {\r\n const retryCount = currentRetryCount + 1;\r\n const maxRetries = options?.retry?.maxRetries ?? 3;\r\n\r\n if (retryCount > maxRetries) {\r\n if (options?.deadLetter) {\r\n if (parsedMessage) {\r\n await this.sendToDeadLetter(parsedMessage, options.deadLetter.channel);\r\n } else {\r\n this.sendToDeadLetterRaw(msg, options.deadLetter.channel);\r\n }\r\n } else {\r\n log.error(\r\n \"herald\",\r\n \"poison-message\",\r\n `Dropping message on channel \"${this.name}\" after ${retryCount - 1} failed ` +\r\n `${retryCount - 1 === 1 ? \"retry\" : \"retries\"} (maxRetries: ${maxRetries}) with no ` +\r\n `dead-letter channel configured.`,\r\n { channel: this.name, retryCount: retryCount - 1, maxRetries },\r\n );\r\n this.amqpChannel.reject(msg, false);\r\n return;\r\n }\r\n\r\n this.amqpChannel.ack(msg);\r\n return;\r\n }\r\n\r\n const headers: Record<string, unknown> = {\r\n ...msg.properties.headers,\r\n \"x-retry-count\": retryCount,\r\n };\r\n\r\n if (delay) {\r\n headers[\"x-delay\"] = delay;\r\n }\r\n\r\n this.amqpChannel.sendToQueue(this.name, msg.content, { ...msg.properties, headers });\r\n\r\n this.amqpChannel.ack(msg);\r\n }\r\n\r\n /**\r\n * Request-response pattern\r\n */\r\n public async request<TResponse = unknown>(\r\n payload: TPayload,\r\n options?: RequestOptions,\r\n ): Promise<TResponse> {\r\n await this.assert();\r\n\r\n const correlationId = randomUUID();\r\n const timeout = options?.timeout ?? 30000;\r\n\r\n // Create exclusive reply queue\r\n const { queue: replyQueue } = await this.amqpChannel.assertQueue(\"\", {\r\n exclusive: true,\r\n autoDelete: true,\r\n });\r\n\r\n return new Promise<TResponse>((resolve, reject) => {\r\n const timeoutId = setTimeout(() => {\r\n reject(new Error(`Request timeout after ${timeout}ms`));\r\n }, timeout);\r\n\r\n // Consume reply\r\n this.amqpChannel.consume(\r\n replyQueue,\r\n (msg: any) => {\r\n if (msg?.properties.correlationId === correlationId) {\r\n clearTimeout(timeoutId);\r\n const content = JSON.parse(msg.content.toString());\r\n resolve(content.payload as TResponse);\r\n }\r\n },\r\n { noAck: true },\r\n );\r\n\r\n // Send request\r\n const messageContent = JSON.stringify({\r\n payload,\r\n metadata: {\r\n messageId: randomUUID(),\r\n timestamp: new Date().toISOString(),\r\n correlationId,\r\n },\r\n });\r\n\r\n this.amqpChannel.sendToQueue(this.name, Buffer.from(messageContent), {\r\n correlationId,\r\n replyTo: replyQueue,\r\n expiration: timeout.toString(),\r\n ...options,\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * Register response handler for RPC\r\n */\r\n public async respond<TResponse = unknown>(\r\n handler: ResponseHandler<TPayload, TResponse>,\r\n ): Promise<Subscription> {\r\n return this.subscribe(async (message, ctx) => {\r\n const response = await handler(message, ctx);\r\n await ctx.reply(response);\r\n await ctx.ack();\r\n });\r\n }\r\n\r\n /**\r\n * Get queue statistics\r\n */\r\n public async stats(): Promise<ChannelStats> {\r\n await this.assert();\r\n\r\n const queueInfo = await this.amqpChannel.checkQueue(this.name);\r\n\r\n return {\r\n name: this.name,\r\n messageCount: queueInfo.messageCount,\r\n consumerCount: queueInfo.consumerCount,\r\n };\r\n }\r\n\r\n /**\r\n * Purge all messages\r\n */\r\n public async purge(): Promise<number> {\r\n await this.assert();\r\n\r\n const result = await this.amqpChannel.purgeQueue(this.name);\r\n return result.messageCount;\r\n }\r\n\r\n /**\r\n * Check if queue exists\r\n */\r\n public async exists(): Promise<boolean> {\r\n try {\r\n await this.amqpChannel.checkQueue(this.name);\r\n return true;\r\n } catch {\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * Delete the queue\r\n */\r\n public async delete(): Promise<void> {\r\n // Cancel all subscriptions\r\n for (const subscription of this.subscriptions.values()) {\r\n await subscription.unsubscribe();\r\n }\r\n this.subscriptions.clear();\r\n\r\n try {\r\n await this.amqpChannel.deleteQueue(this.name);\r\n } catch {\r\n // Ignore if queue doesn't exist\r\n }\r\n\r\n this.asserted = false;\r\n }\r\n}\r\n\r\n/**\r\n * RabbitMQ Subscription Implementation\r\n */\r\nclass RabbitMQSubscription implements Subscription {\r\n public readonly id: string;\r\n public readonly channel: string;\r\n public readonly consumerTag: string;\r\n\r\n private readonly amqpChannel: any;\r\n private _isActive = true;\r\n\r\n public constructor(id: string, channel: string, consumerTag: string, amqpChannel: any) {\r\n this.id = id;\r\n this.channel = channel;\r\n this.consumerTag = consumerTag;\r\n this.amqpChannel = amqpChannel;\r\n }\r\n\r\n public async unsubscribe(): Promise<void> {\r\n if (!this._isActive) return;\r\n\r\n await this.amqpChannel.cancel(this.consumerTag);\r\n this._isActive = false;\r\n }\r\n\r\n public async pause(): Promise<void> {\r\n // RabbitMQ doesn't have native pause, cancel consumer\r\n await this.amqpChannel.cancel(this.consumerTag);\r\n }\r\n\r\n public async resume(): Promise<void> {\r\n // Would need to re-subscribe - not directly supported\r\n throw new Error(\"Resume is not supported for RabbitMQ. Please create a new subscription.\");\r\n }\r\n\r\n public isActive(): boolean {\r\n return this._isActive;\r\n }\r\n}\r\n","import { EventEmitter } from \"node:events\";\r\nimport type { BrokerDriverContract, ChannelContract } from \"../../contracts\";\r\nimport { EventMessage } from \"../../message-managers/event-message\";\r\nimport { type EventConsumerClass } from \"../../message-managers/types\";\r\nimport type {\r\n BrokerDriverType,\r\n BrokerEvent,\r\n BrokerEventListener,\r\n ChannelOptions,\r\n HealthCheckResult,\r\n RabbitMQConnectionOptions,\r\n} from \"../../types\";\r\nimport { prepareConsumerSubscription } from \"./../../message-managers/prepare-consumer-subscription\";\r\nimport { RabbitMQChannel } from \"./rabbitmq-channel\";\r\n\r\n// ============================================================\r\n// Lazy-loaded amqplib Module\r\n// ============================================================\r\n\r\n/**\r\n * Shape of the lazily-imported amqplib module\r\n */\r\ntype AmqplibModule = typeof import(\"amqplib\");\r\n\r\n/**\r\n * The single amqplib load, shared by every caller.\r\n *\r\n * Memoized as a promise rather than as a resolved value so the loader stays\r\n * idempotent: without it, two callers arriving before the first `import()`\r\n * settles would each start their own load and the last writer would win, so a\r\n * caller could end up observing a module instance it never awaited.\r\n *\r\n * Resolves to `undefined` when amqplib is not installed.\r\n */\r\nlet amqplibModulePromise: Promise<AmqplibModule | undefined> | undefined;\r\n\r\n/**\r\n * Installation instructions for amqplib\r\n */\r\nconst AMQPLIB_INSTALL_INSTRUCTIONS = `\r\nRabbitMQ driver requires the amqplib package.\r\nInstall it with:\r\n\r\n npx warlock add herald --driver=rabbitmq\r\n\r\nOr manually:\r\n\r\n npm install amqplib\r\n pnpm add amqplib\r\n yarn add amqplib\r\n`.trim();\r\n\r\n/**\r\n * Strip `user:password@` credentials from any `amqp(s)://` URL embedded in a\r\n * string. The connection URL carries plaintext broker credentials, and\r\n * amqplib/Node's URL parser commonly echoes the offending URL verbatim in a\r\n * malformed-URL error (e.g. an unencoded `@`/`:` in the password) — applied\r\n * to every error `connect()` surfaces so a credential never reaches whatever\r\n * the host app does with a thrown connection error (console.error,\r\n * structured logging, an error tracker).\r\n */\r\nfunction redactAmqpCredentials(message: string): string {\r\n return message.replace(/(amqps?:\\/\\/)[^/@\\s]+@/gi, \"$1****:****@\");\r\n}\r\n\r\n/**\r\n * Load amqplib, reusing the single shared load for every caller.\r\n *\r\n * @returns The amqplib module, or `undefined` when it is not installed.\r\n */\r\nfunction loadAmqplibModule(): Promise<AmqplibModule | undefined> {\r\n if (!amqplibModulePromise) {\r\n amqplibModulePromise = import(\"amqplib\").catch(() => undefined);\r\n }\r\n\r\n return amqplibModulePromise;\r\n}\r\n\r\n// ============================================================\r\n// RabbitMQ Driver\r\n// ============================================================\r\n\r\n/**\r\n * RabbitMQ Driver\r\n *\r\n * Implementation of BrokerDriverContract for RabbitMQ/AMQP.\r\n *\r\n * **Important:** This driver requires the `amqplib` package to be installed.\r\n * Install it with: `npx warlock add herald --driver=rabbitmq` or `npm install amqplib`\r\n *\r\n * @example\r\n * ```typescript\r\n * const driver = new RabbitMQDriver({\r\n * driver: \"rabbitmq\",\r\n * host: \"localhost\",\r\n * port: 5672,\r\n * username: \"guest\",\r\n * password: \"guest\",\r\n * });\r\n *\r\n * await driver.connect();\r\n * const channel = driver.channel(\"user.created\");\r\n * ```\r\n */\r\nexport class RabbitMQDriver implements BrokerDriverContract {\r\n public readonly name = \"rabbitmq\" as const;\r\n\r\n public readonly consumers: EventConsumerClass[] = [];\r\n\r\n private readonly options: RabbitMQConnectionOptions;\r\n private readonly events = new EventEmitter();\r\n private readonly channels = new Map<string, ChannelContract<any>>();\r\n\r\n private connection: any = null;\r\n private amqpChannel: any = null;\r\n private _isConnected = false;\r\n\r\n /**\r\n * Create a new RabbitMQ driver\r\n *\r\n * @param options - RabbitMQ connection options\r\n */\r\n public constructor(options: RabbitMQConnectionOptions) {\r\n this.options = options;\r\n }\r\n\r\n /**\r\n * Whether connected to RabbitMQ\r\n */\r\n public get isConnected(): boolean {\r\n return this._isConnected;\r\n }\r\n\r\n /**\r\n * Subscribe the given consumer class to the driver\r\n *\r\n * @param consumer - Consumer class to subscribe\r\n *\r\n * @example\r\n * ```typescript\r\n * driver.subscribe(UserUpdatedConsumer);\r\n * ```\r\n */\r\n public subscribe(Consumer: EventConsumerClass) {\r\n if (this.isConnected) {\r\n this.channel(Consumer.eventName).subscribe(\r\n prepareConsumerSubscription(Consumer, (error, eventName) => {\r\n this.events.emit(\"error\", error, eventName);\r\n }),\r\n {\r\n consumerId: Consumer.consumerId,\r\n },\r\n );\r\n } else {\r\n this.consumers.push(Consumer);\r\n }\r\n\r\n return () => {\r\n this.unsubscribe(Consumer);\r\n };\r\n }\r\n\r\n /**\r\n * Unsubscribe the given consumer\r\n */\r\n public unsubscribe(Consumer: EventConsumerClass): void {\r\n if (this.isConnected) {\r\n this.channel(Consumer.eventName).unsubscribeById(Consumer.consumerId);\r\n }\r\n const index = this.consumers.indexOf(Consumer);\r\n if (index > -1) {\r\n this.consumers.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Publish the given event message.\r\n * Auto-creates the channel if it hasn't been accessed before.\r\n */\r\n public publish<TPayload = Record<string, any>>(event: EventMessage<TPayload>): void {\r\n this.channel(event.eventName).publish(event.serialize());\r\n }\r\n\r\n /**\r\n * Connect to RabbitMQ\r\n */\r\n public async connect(): Promise<void> {\r\n const amqplib = await loadAmqplibModule();\r\n\r\n if (!amqplib) {\r\n throw new Error(`amqplib is not installed.\\n\\n${AMQPLIB_INSTALL_INSTRUCTIONS}`);\r\n }\r\n\r\n try {\r\n // Build connection URL\r\n const url = this.buildConnectionUrl();\r\n\r\n // Build connection options merging our options with native client options\r\n const connectOptions = {\r\n heartbeat: this.options.heartbeat ?? 60,\r\n timeout: this.options.connectionTimeout,\r\n // Merge native amqplib client options\r\n ...this.options.clientOptions,\r\n };\r\n\r\n // Connect using cached module\r\n this.connection = await amqplib.connect(url, connectOptions);\r\n\r\n // Create channel\r\n this.amqpChannel = await this.connection.createChannel();\r\n\r\n // Set prefetch if specified\r\n if (this.options.prefetch) {\r\n await this.amqpChannel.prefetch(this.options.prefetch);\r\n }\r\n\r\n this._isConnected = true;\r\n this.events.emit(\"connected\");\r\n\r\n for (const consumer of this.consumers) {\r\n this.subscribe(consumer);\r\n }\r\n\r\n this.consumers.length = 0;\r\n\r\n // Handle connection close\r\n this.connection.on(\"close\", () => {\r\n this._isConnected = false;\r\n this.events.emit(\"disconnected\");\r\n\r\n if (this.options.reconnect !== false) {\r\n this.handleReconnect();\r\n }\r\n });\r\n\r\n // Handle errors\r\n this.connection.on(\"error\", (error: Error) => {\r\n this.events.emit(\"error\", error);\r\n });\r\n } catch (error) {\r\n this._isConnected = false;\r\n const message = error instanceof Error ? error.message : String(error);\r\n throw new Error(`Failed to connect to RabbitMQ: ${redactAmqpCredentials(message)}`);\r\n }\r\n }\r\n\r\n /**\r\n * Build connection URL from options\r\n */\r\n private buildConnectionUrl(): string {\r\n if (this.options.uri) {\r\n return this.options.uri;\r\n }\r\n\r\n const protocol = \"amqp\";\r\n const host = this.options.host ?? \"localhost\";\r\n const port = this.options.port ?? 5672;\r\n const vhost = this.options.vhost ?? \"/\";\r\n // URI-encoded so a credential containing a reserved URL character\r\n // (`@`, `:`, `/`, whitespace — common in generated secrets) can't produce\r\n // a malformed URL whose parser error echoes the raw credential back.\r\n const username = encodeURIComponent(this.options.username ?? \"guest\");\r\n const password = encodeURIComponent(this.options.password ?? \"guest\");\r\n\r\n const encodedVhost = encodeURIComponent(vhost);\r\n\r\n return `${protocol}://${username}:${password}@${host}:${port}/${encodedVhost}`;\r\n }\r\n\r\n /**\r\n * Handle reconnection\r\n */\r\n private async handleReconnect(): Promise<void> {\r\n const delay = this.options.reconnectDelay ?? 5000;\r\n let attempt = 0;\r\n\r\n const tryReconnect = async () => {\r\n attempt++;\r\n this.events.emit(\"reconnecting\", attempt);\r\n\r\n try {\r\n await this.connect();\r\n } catch {\r\n setTimeout(tryReconnect, delay);\r\n }\r\n };\r\n\r\n setTimeout(tryReconnect, delay);\r\n }\r\n\r\n /**\r\n * Disconnect from RabbitMQ\r\n */\r\n public async disconnect(): Promise<void> {\r\n if (this.amqpChannel) {\r\n try {\r\n await this.amqpChannel.close();\r\n } catch {\r\n // Ignore close errors\r\n }\r\n this.amqpChannel = null;\r\n }\r\n\r\n if (this.connection) {\r\n try {\r\n await this.connection.close();\r\n } catch {\r\n // Ignore close errors\r\n }\r\n this.connection = null;\r\n }\r\n\r\n this._isConnected = false;\r\n this.events.emit(\"disconnected\");\r\n }\r\n\r\n /**\r\n * Register event listener\r\n */\r\n public on(event: BrokerEvent, listener: BrokerEventListener): void {\r\n this.events.on(event, listener as any);\r\n }\r\n\r\n /**\r\n * Remove event listener\r\n */\r\n public off(event: BrokerEvent, listener: BrokerEventListener): void {\r\n this.events.off(event, listener as any);\r\n }\r\n\r\n /**\r\n * Get or create a channel\r\n */\r\n public channel<TPayload = unknown>(\r\n name: string,\r\n options?: ChannelOptions<TPayload>,\r\n ): ChannelContract<TPayload> {\r\n // Check cache\r\n const existing = this.channels.get(name);\r\n if (existing) {\r\n return existing as ChannelContract<TPayload>;\r\n }\r\n\r\n // Create new channel\r\n const channel = new RabbitMQChannel<TPayload>(name, this.amqpChannel, options);\r\n\r\n this.channels.set(name, channel);\r\n return channel;\r\n }\r\n\r\n /**\r\n * Start consuming messages\r\n */\r\n public async startConsuming(): Promise<void> {\r\n // Channels start consuming when subscribe() is called\r\n // This method is for batch start if needed\r\n }\r\n\r\n /**\r\n * Stop consuming messages from all subscribed channels.\r\n * Gracefully cancels all active consumers.\r\n */\r\n public async stopConsuming(): Promise<void> {\r\n const stops = Array.from(this.channels.values()).map(channel =>\r\n (channel as RabbitMQChannel<any>).stopConsuming(),\r\n );\r\n await Promise.all(stops);\r\n }\r\n\r\n /**\r\n * Health check\r\n */\r\n public async healthCheck(): Promise<HealthCheckResult> {\r\n if (!this._isConnected || !this.connection) {\r\n return {\r\n healthy: false,\r\n error: \"Not connected to RabbitMQ\",\r\n };\r\n }\r\n\r\n const start = Date.now();\r\n\r\n try {\r\n // Simple check - verify channel is open\r\n await this.amqpChannel.checkQueue(\"amq.rabbitmq.reply-to\").catch(() => {\r\n // Queue might not exist, but if we get here, connection is alive\r\n });\r\n\r\n return {\r\n healthy: true,\r\n latency: Date.now() - start,\r\n };\r\n } catch (error) {\r\n return {\r\n healthy: false,\r\n error: error instanceof Error ? error.message : String(error),\r\n latency: Date.now() - start,\r\n };\r\n }\r\n }\r\n\r\n /**\r\n * Get all channel names\r\n */\r\n public getChannelNames(): string[] {\r\n return Array.from(this.channels.keys());\r\n }\r\n\r\n /**\r\n * Close a specific channel\r\n */\r\n public async closeChannel(name: string): Promise<void> {\r\n const channel = this.channels.get(name);\r\n if (channel) {\r\n await channel.delete();\r\n this.channels.delete(name);\r\n }\r\n }\r\n\r\n /**\r\n * Get the raw AMQP channel (for advanced use)\r\n */\r\n public getRawChannel(): any {\r\n return this.amqpChannel;\r\n }\r\n\r\n /**\r\n * Get the raw connection (for advanced use)\r\n */\r\n public getRawConnection(): any {\r\n return this.connection;\r\n }\r\n}\r\n","import type { BrokerDriverContract } from \"../contracts\";\r\nimport type { ChannelContract } from \"../contracts/channel.contract\";\r\nimport { EventMessage } from \"../message-managers/event-message\";\r\nimport { type EventConsumerClass } from \"../message-managers/types\";\r\nimport type { ChannelOptions } from \"../types\";\r\n\r\n/**\r\n * Options for creating a Broker\r\n */\r\nexport interface BrokerOptions {\r\n /** Unique name for this broker */\r\n name: string;\r\n /** The underlying driver */\r\n driver: BrokerDriverContract;\r\n /** Whether this is the default broker */\r\n isDefault?: boolean;\r\n}\r\n\r\n/**\r\n * Broker - wrapper around a driver with metadata\r\n *\r\n * Similar to DataSource in @warlock.js/cascade\r\n *\r\n * @example\r\n * ```typescript\r\n * const broker = new Broker({\r\n * name: \"default\",\r\n * driver: rabbitMQDriver,\r\n * isDefault: true,\r\n * });\r\n *\r\n * // Get a channel\r\n * const channel = broker.channel(\"user.created\");\r\n * ```\r\n */\r\nexport class Broker {\r\n /** Unique name identifying this broker */\r\n public readonly name: string;\r\n\r\n /** The underlying driver */\r\n public readonly driver: BrokerDriverContract;\r\n\r\n /** Whether this is the default broker */\r\n public readonly isDefault: boolean;\r\n\r\n /**\r\n * Create a new Broker\r\n *\r\n * @param options - Broker configuration\r\n */\r\n public constructor(options: BrokerOptions) {\r\n this.name = options.name;\r\n this.driver = options.driver;\r\n this.isDefault = Boolean(options.isDefault);\r\n }\r\n\r\n /**\r\n * Subscribe the given consumer\r\n */\r\n public subscribe(consumer: EventConsumerClass<any>) {\r\n return this.driver.subscribe(consumer);\r\n }\r\n\r\n /**\r\n * Publish the given event message\r\n */\r\n public publish<TPayload = Record<string, any>>(event: EventMessage<TPayload>) {\r\n this.driver.publish(event);\r\n }\r\n\r\n /**\r\n * Get or create a channel\r\n *\r\n * @param name - Channel name\r\n * @param options - Channel options\r\n * @returns Channel instance\r\n *\r\n * @example\r\n * ```typescript\r\n * // Simple channel\r\n * const channel = broker.channel(\"notifications\");\r\n *\r\n * // Typed channel with schema\r\n * const orderChannel = broker.channel<OrderPayload>(\"orders\", {\r\n * schema: OrderSchema,\r\n * durable: true,\r\n * });\r\n * ```\r\n */\r\n public channel<TPayload = unknown>(\r\n name: string,\r\n options?: ChannelOptions<TPayload>,\r\n ): ChannelContract<TPayload> {\r\n return this.driver.channel<TPayload>(name, options);\r\n }\r\n\r\n /**\r\n * Check if the broker is connected\r\n */\r\n public get isConnected(): boolean {\r\n return this.driver.isConnected;\r\n }\r\n\r\n /**\r\n * Connect the underlying driver\r\n */\r\n public async connect(): Promise<void> {\r\n await this.driver.connect();\r\n }\r\n\r\n /**\r\n * Disconnect the underlying driver\r\n */\r\n public async disconnect(): Promise<void> {\r\n await this.driver.disconnect();\r\n }\r\n\r\n /**\r\n * Start consuming messages\r\n */\r\n public async startConsuming(): Promise<void> {\r\n await this.driver.startConsuming();\r\n }\r\n\r\n /**\r\n * Stop consuming messages\r\n */\r\n public async stopConsuming(): Promise<void> {\r\n await this.driver.stopConsuming();\r\n }\r\n\r\n /**\r\n * Health check\r\n */\r\n public async healthCheck() {\r\n return this.driver.healthCheck();\r\n }\r\n}\r\n","import { EventEmitter } from \"node:events\";\r\nimport type { BrokerRegistryEvent, BrokerRegistryListener } from \"../types\";\r\nimport { Broker, type BrokerOptions } from \"./broker\";\r\n\r\n/**\r\n * Error thrown when a broker is not found\r\n */\r\nexport class MissingBrokerError extends Error {\r\n public readonly brokerName?: string;\r\n\r\n public constructor(message: string, brokerName?: string) {\r\n super(message);\r\n this.name = \"MissingBrokerError\";\r\n this.brokerName = brokerName;\r\n }\r\n}\r\n\r\n/**\r\n * Broker Registry\r\n *\r\n * Maintains registry of named brokers.\r\n * Similar to DataSourceRegistry in @warlock.js/cascade\r\n *\r\n * @example\r\n * ```typescript\r\n * // Register a broker\r\n * brokerRegistry.register({\r\n * name: \"default\",\r\n * driver: rabbitMQDriver,\r\n * isDefault: true,\r\n * });\r\n *\r\n * // Get the default broker\r\n * const comm = brokerRegistry.get();\r\n *\r\n * // Get a specific broker by name\r\n * const analytics = brokerRegistry.get(\"analytics\");\r\n *\r\n * // Listen for events\r\n * brokerRegistry.on(\"connected\", (comm) => {\r\n * console.log(`${comm.name} connected`);\r\n * });\r\n * ```\r\n */\r\nclass BrokerRegistry {\r\n private readonly sources = new Map<string, Broker>();\r\n private defaultSource?: Broker;\r\n private readonly events = new EventEmitter();\r\n\r\n /**\r\n * Register a new broker\r\n *\r\n * Sets up event forwarding from the driver to the registry.\r\n *\r\n * @param options - Broker configuration\r\n * @returns The registered broker instance\r\n *\r\n * @example\r\n * ```typescript\r\n * const broker = brokerRegistry.register({\r\n * name: \"primary\",\r\n * driver: myDriver,\r\n * isDefault: true,\r\n * });\r\n * ```\r\n */\r\n public register(options: BrokerOptions): Broker {\r\n const broker = new Broker(options);\r\n this.sources.set(broker.name, broker);\r\n\r\n const isNewDefault = broker.isDefault || !this.defaultSource;\r\n\r\n if (isNewDefault) {\r\n this.defaultSource = broker;\r\n }\r\n\r\n // Emit registration events\r\n this.events.emit(\"registered\", broker);\r\n\r\n if (isNewDefault) {\r\n this.events.emit(\"default-registered\", broker);\r\n }\r\n\r\n // Forward driver events to registry\r\n broker.driver.on(\"connected\", () => {\r\n this.events.emit(\"connected\", broker);\r\n });\r\n\r\n broker.driver.on(\"disconnected\", () => {\r\n this.events.emit(\"disconnected\", broker);\r\n });\r\n\r\n return broker;\r\n }\r\n\r\n /**\r\n * Clear all registered brokers\r\n */\r\n public clear(): void {\r\n this.defaultSource = undefined;\r\n this.sources.clear();\r\n }\r\n\r\n /**\r\n * Listen for registry events\r\n *\r\n * @param event - Event to listen for\r\n * @param listener - Callback function\r\n *\r\n * @example\r\n * ```typescript\r\n * brokerRegistry.on(\"registered\", (comm) => {\r\n * console.log(`Broker \"${comm.name}\" registered`);\r\n * });\r\n *\r\n * brokerRegistry.on(\"connected\", (comm) => {\r\n * console.log(`Broker \"${comm.name}\" connected`);\r\n * });\r\n * ```\r\n */\r\n public on(event: BrokerRegistryEvent, listener: BrokerRegistryListener): void {\r\n this.events.on(event, listener);\r\n }\r\n\r\n /**\r\n * Listen for a registry event once\r\n *\r\n * @param event - Event to listen for\r\n * @param listener - Callback function\r\n */\r\n public once(event: BrokerRegistryEvent, listener: BrokerRegistryListener): void {\r\n this.events.once(event, listener);\r\n }\r\n\r\n /**\r\n * Remove an event listener\r\n *\r\n * @param event - Event to stop listening for\r\n * @param listener - Callback to remove\r\n */\r\n public off(event: BrokerRegistryEvent, listener: BrokerRegistryListener): void {\r\n this.events.off(event, listener);\r\n }\r\n\r\n /**\r\n * Get a broker by name or the default one\r\n *\r\n * @param name - Optional broker name\r\n * @returns Broker instance\r\n * @throws MissingBrokerError if not found\r\n *\r\n * @example\r\n * ```typescript\r\n * // Get default broker\r\n * const comm = brokerRegistry.get();\r\n *\r\n * // Get specific broker\r\n * const analytics = brokerRegistry.get(\"analytics\");\r\n * ```\r\n */\r\n public get(name?: string): Broker {\r\n if (name !== undefined) {\r\n const source = this.sources.get(name);\r\n if (!source) {\r\n throw new MissingBrokerError(`Broker \"${name}\" is not registered.`, name);\r\n }\r\n return source;\r\n }\r\n\r\n if (!this.defaultSource) {\r\n throw new MissingBrokerError(\"No default broker registered.\");\r\n }\r\n\r\n return this.defaultSource;\r\n }\r\n\r\n /**\r\n * Check if a broker exists\r\n *\r\n * @param name - Broker name to check\r\n * @returns True if exists\r\n */\r\n public has(name: string): boolean {\r\n return this.sources.has(name);\r\n }\r\n\r\n /**\r\n * Check if any brokers are registered\r\n */\r\n public hasAny(): boolean {\r\n return this.sources.size > 0;\r\n }\r\n\r\n /**\r\n * Get all registered brokers\r\n *\r\n * @returns Array of all brokers\r\n *\r\n * @example\r\n * ```typescript\r\n * // Disconnect all brokers\r\n * for (const comm of brokerRegistry.getAll()) {\r\n * await comm.disconnect();\r\n * }\r\n * ```\r\n */\r\n public getAll(): Broker[] {\r\n return Array.from(this.sources.values());\r\n }\r\n\r\n /**\r\n * Get all broker names\r\n *\r\n * @returns Array of broker names\r\n */\r\n public getNames(): string[] {\r\n return Array.from(this.sources.keys());\r\n }\r\n\r\n /**\r\n * Get the default broker (if any)\r\n *\r\n * @returns Default broker or undefined\r\n */\r\n public getDefault(): Broker | undefined {\r\n return this.defaultSource;\r\n }\r\n}\r\n\r\n/**\r\n * Global broker registry instance\r\n */\r\nexport const brokerRegistry = new BrokerRegistry();\r\n","import { Broker, brokerRegistry } from \"../communicators\";\r\nimport type { BrokerDriverContract, ChannelContract } from \"../contracts\";\r\nimport { type EventConsumerClass, EventMessage } from \"../message-managers\";\r\nimport type { ChannelOptions, ConnectionOptions, RabbitMQConnectionOptions } from \"../types\";\r\n\r\n/**\r\n * Connect to a message broker and register it.\r\n *\r\n * This is a high-level utility function that simplifies connection setup\r\n * for most projects. It handles driver instantiation, connection,\r\n * broker creation, and automatic registration.\r\n *\r\n * **Supported Drivers:**\r\n * - `rabbitmq` (default) - RabbitMQ/AMQP driver\r\n * - `kafka` - Apache Kafka driver (coming soon)\r\n *\r\n * @param options - Connection configuration options\r\n * @returns A connected and registered Broker instance\r\n * @throws {Error} If connection fails or driver is not implemented\r\n *\r\n * @example\r\n * ```typescript\r\n * // RabbitMQ connection\r\n * const broker = await connectToBroker({\r\n * driver: \"rabbitmq\",\r\n * host: \"localhost\",\r\n * port: 5672,\r\n * username: \"guest\",\r\n * password: \"guest\",\r\n * });\r\n *\r\n * // Use the broker\r\n * await broker.channel(\"user.created\").publish({ userId: 1 });\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Multiple brokers\r\n * await connectToBroker({\r\n * driver: \"rabbitmq\",\r\n * name: \"notifications\",\r\n * isDefault: true,\r\n * host: process.env.RABBITMQ_HOST,\r\n * });\r\n *\r\n * await connectToBroker({\r\n * driver: \"rabbitmq\",\r\n * name: \"analytics\",\r\n * host: process.env.ANALYTICS_RABBITMQ_HOST,\r\n * });\r\n *\r\n * // Use default broker\r\n * herald().channel(\"notifications\").publish({ ... });\r\n *\r\n * // Use specific broker\r\n * herald(\"analytics\").channel(\"events\").publish({ ... });\r\n * ```\r\n */\r\nexport async function connectToBroker(options: ConnectionOptions): Promise<Broker> {\r\n // Default values\r\n const driverType = options.driver ?? \"rabbitmq\";\r\n const brokerName = options.name ?? \"default\";\r\n const isDefault = options.isDefault ?? true;\r\n\r\n // Create driver based on type\r\n let driver: BrokerDriverContract;\r\n\r\n switch (driverType) {\r\n case \"rabbitmq\": {\r\n const rabbitOptions = options as RabbitMQConnectionOptions;\r\n // Dynamic import to avoid requiring amqplib if not used\r\n const { RabbitMQDriver } = await import(\"../drivers/rabbitmq/rabbitmq-driver\");\r\n driver = new RabbitMQDriver(rabbitOptions);\r\n break;\r\n }\r\n\r\n case \"kafka\": {\r\n // const kafkaOptions = options as KafkaConnectionOptions;\r\n // Dynamic import to avoid requiring kafkajs if not used\r\n throw new Error(\r\n \"Kafka driver is not yet implemented. Coming soon! For now, please use RabbitMQ.\",\r\n );\r\n }\r\n\r\n default:\r\n throw new Error(`Unknown driver: \"${driverType}\". Supported drivers: rabbitmq, kafka`);\r\n }\r\n\r\n // Create broker\r\n const broker = brokerRegistry.register({\r\n name: brokerName,\r\n driver,\r\n isDefault,\r\n });\r\n\r\n // Connect to the message broker\r\n try {\r\n await driver.connect();\r\n } catch (error) {\r\n throw new Error(\r\n `Failed to connect to ${driverType}: ${error instanceof Error ? error.message : String(error)}`,\r\n );\r\n }\r\n\r\n return broker;\r\n}\r\n\r\n/**\r\n * Get a broker by name or the default one.\r\n *\r\n * This is the main entry point for using brokers in your application.\r\n * Named after the package — `herald()` carries your messages!\r\n *\r\n * @param name - Optional broker name (uses default if not provided)\r\n * @returns Broker instance\r\n * @throws MissingBrokerError if broker not found\r\n *\r\n * @example\r\n * // Get default broker\r\n * const channel = herald().channel(\"user.created\");\r\n * await channel.publish({ userId: 1 });\r\n *\r\n * // Get specific broker\r\n * const analyticsChannel = herald(\"analytics\").channel(\"events\");\r\n * await analyticsChannel.publish({ event: \"page_view\" });\r\n *\r\n * // Subscribe to messages\r\n * herald()\r\n * .channel<UserPayload>(\"user.created\")\r\n * .subscribe(async (message, ctx) => {\r\n * console.log(\"User created:\", message.payload);\r\n * await ctx.ack();\r\n * });\r\n * ```\r\n */\r\nexport function herald(name?: string): Broker {\r\n return brokerRegistry.get(name);\r\n}\r\n\r\n/**\r\n * Get channel instance for the given name from default broker.\r\n *\r\n * Shorthand for `herald().channel(name, options)`.\r\n *\r\n * @param name - Channel name\r\n * @param options - Optional channel options\r\n * @returns Channel instance\r\n * @throws MissingBrokerError if broker not found\r\n *\r\n * @example\r\n * ```typescript\r\n * const channel = heraldChannel(\"user.created\");\r\n * await channel.publish({ userId: 1 });\r\n * ```\r\n */\r\nexport function heraldChannel<TPayload = unknown>(\r\n name: string,\r\n options?: ChannelOptions<TPayload>,\r\n): ChannelContract<TPayload> {\r\n return herald().channel<TPayload>(name, options);\r\n}\r\n\r\n/**\r\n * Publish an EventMessage to the default broker.\r\n *\r\n * @param event - Event message to publish\r\n * @returns Promise that resolves when the event is published\r\n * @throws Error if the broker is not connected\r\n *\r\n * @example\r\n * ```typescript\r\n * await publishEvent(new UserUpdatedEvent({ id: 1, name: \"John Doe\" }));\r\n * ```\r\n */\r\nexport async function publishEvent<TPayload = Record<string, any>>(event: EventMessage<TPayload>) {\r\n return herald().publish(event);\r\n}\r\n\r\n/**\r\n * Subscribe an EventConsumer class to the default broker.\r\n *\r\n * @param Consumer - Event consumer class\r\n * @returns Unsubscribe function\r\n * @throws MissingBrokerError if broker not found\r\n *\r\n * @example\r\n * ```typescript\r\n * await subscribeConsumer(UserUpdatedConsumer);\r\n * ```\r\n */\r\nexport async function subscribeConsumer<TPayload = Record<string, any>>(\r\n Consumer: EventConsumerClass<TPayload>,\r\n) {\r\n return herald().subscribe(Consumer);\r\n}\r\n","import { brokerRegistry } from \"../communicators\";\nimport { type EventConsumerClass } from \"../message-managers/types\";\n\nexport type ConsumableOptions = {\n broker?: string;\n};\n\nexport const pendingSubscribers = new Set<{\n Consumer: EventConsumerClass;\n options?: ConsumableOptions;\n}>();\n\n/**\n * Register the consumer to the broker\n */\nexport function Consumable(options?: ConsumableOptions) {\n return function (target: EventConsumerClass) {\n const brokerName = options?.broker;\n\n try {\n const currentBroker = brokerRegistry.get(brokerName);\n\n // if broker is connected, subscribe the consumer\n if (currentBroker?.isConnected) {\n currentBroker.subscribe(target);\n } else {\n pendingSubscribers.add({ Consumer: target, options });\n }\n } catch {\n // mostly it will be an error that broker is not registered yet\n // then add it to the pending subscribers\n pendingSubscribers.add({ Consumer: target, options });\n }\n };\n}\n\n// Register pending consumers on broker's connection is done\nbrokerRegistry.on(\"connected\", (broker) => {\n for (const { Consumer, options } of pendingSubscribers) {\n if (options?.broker && broker.name !== options.broker) {\n continue;\n }\n\n broker.subscribe(Consumer);\n }\n});\n","/**\n * This class is used to be part of the Herald Event Consumer Manager.\n * It should be used to consume events from Either RabbitMQ or Kafka through Herald\n *\n * It's highly recommended using it instead of declaring manual channel namd and subscribing to event\n */\nimport { v, type ValidationResult, type ObjectValidator } from \"@warlock.js/seal\";\nimport { randomUUID } from \"crypto\";\nimport { Consumable } from \"../decorators\";\nimport { type ConsumedEventMessage, type EventConsumerClass } from \"./types\";\n\nexport abstract class EventConsumer<Payload = Record<string, any>> {\n /**\n * Event name\n */\n public static eventName: string;\n\n private static _consumerId?: string;\n\n public static get consumerId(): string {\n if (!this._consumerId) {\n this._consumerId = randomUUID();\n }\n return this._consumerId;\n }\n\n public get eventName() {\n return (this.constructor as typeof EventConsumer).eventName;\n }\n\n /**\n * Min version accepted to be consumed by this class\n */\n public static minVersion?: number;\n\n /**\n * Max version accepted to be consumed by this class\n */\n public static maxVersion?: number;\n\n /**\n * Payload validation to auto reject the received event before accessing it in the handle method\n */\n public schema?: ObjectValidator;\n\n /**\n * The method that will be called when the event is received\n */\n public abstract handle(payload: Payload, event: ConsumedEventMessage): Promise<void>;\n\n /**\n * Determine whether this is accepted version to be used by this consumer\n */\n public static isAcceptedVersion(version: number): boolean {\n if (this.minVersion && version < this.minVersion) return false;\n if (this.maxVersion && version > this.maxVersion) return false;\n\n return true;\n }\n\n /**\n * Validate the given data\n */\n public async validate(data: Payload): Promise<ValidationResult | void> {\n if (!this.schema) return;\n\n return await v.validate(this.schema, data);\n }\n}\n\n/**\n * Define Consumer options\n */\ntype ConsumerOptions<Payload> = {\n /**\n * Payload validation to auto reject the received event before accessing it in the handle method\n */\n schema?: ObjectValidator;\n /**\n * Handle data\n */\n handle: (payload: Payload, event: ConsumedEventMessage) => Promise<void>;\n /**\n * Validate the payload before executing `handle`\n */\n validate?: (payload: Payload) => Promise<ValidationResult | boolean>;\n};\n\n/**\n * A shorthand to define an event consumer without declaring an entire class\n */\nexport function defineConsumer<Payload = Record<string, any>>(\n eventName: string,\n options: ConsumerOptions<Payload>,\n): EventConsumerClass {\n const Class = class AnnouncedConsumer extends EventConsumer<Payload> {\n public static eventName = eventName;\n public schema = options.schema;\n\n public async handle(payload: Payload, event: ConsumedEventMessage) {\n if (options.validate) {\n const result = await options.validate(payload);\n if (!result || !(result as ValidationResult).isValid) return;\n }\n\n return options.handle(payload, event);\n }\n };\n\n Consumable()(Class as EventConsumerClass);\n\n return Class as EventConsumerClass;\n}\n","/**\n * This class is used to be part of the Herald Event Message Manager.\n * It should be used to trigger events to Either RabbitMQ or Kafka through Herald\n *\n * It's highly recommended using it instead of declaring manual channel namd and publishing data\n */\nimport { type GenericObject } from \"@mongez/reinforcements\";\nimport { type ObjectValidator } from \"@warlock.js/seal\";\nimport { randomUUID } from \"crypto\";\n\nexport abstract class EventMessage<TPayload = Record<string, any>> {\n /**\n * Event Name\n */\n public abstract eventName: string;\n\n /**\n * Event version\n */\n public version?: number;\n\n /**\n * Additional metadata (if any)\n */\n public metadata?: Record<string, any>;\n\n /**\n * Event Message id\n */\n public messageId?: string;\n\n /**\n * Schema of payload that will be used to determine whether this event should be published\n */\n public schema?: ObjectValidator;\n\n /**\n * Data that will be sent with the event (Payload)\n */\n public toJSON(): TPayload {\n if (!this.data) {\n throw new Error(`no Data is defined for Event: ${this.eventName}`);\n }\n\n return this.data as TPayload;\n }\n\n public constructor(protected data?: TPayload) {}\n\n /**\n * Serialize the event to be ready for publishing.\n * Delegates payload resolution to toJSON() — override toJSON() to customize.\n *\n * @throws Error if toJSON() throws (e.g. no data provided)\n */\n public serialize() {\n const payload = this.toJSON();\n\n return {\n payload,\n metadata: this.metadata,\n messageId: this.messageId ?? randomUUID(),\n eventName: this.eventName,\n version: this.version,\n occurredAt: new Date(),\n __through: \"EventMessage\",\n };\n }\n}\n\ntype EventOptions<T> = {\n /**\n * Shapen the data that will be used\n */\n toJSON?: (data: T) => GenericObject;\n /**\n * Validation schema\n */\n schema?: ObjectValidator;\n};\n\n/**\n * Represents an EventMessage class constructor.\n *\n * @template TIncoming - The type of data accepted by the constructor\n * @template TOutgoing - The type of data returned by toJSON() (defaults to TIncoming)\n */\ntype EventMessageClass<TIncoming = Record<string, any>, TOutgoing = TIncoming> = new (\n data?: TIncoming,\n) => EventMessage<TOutgoing>;\n\n/**\n * A shorthand to define an event without declaring an entire class.\n *\n * This factory function creates an EventMessage subclass that transforms\n * input data (IncomingData) into a different output format (OutgoingData).\n *\n * @template IncomingData - The type of data passed to the constructor\n * @template OutgoingData - The type of data returned by toJSON()\n *\n * @example\n * ```typescript\n * const UserCreatedEvent = defineEvent<User, { id: number; name: string }>(\n * \"user.created\",\n * { toJSON: (user) => user.only([\"id\", \"name\"]) }\n * );\n *\n * publishEvent(new UserCreatedEvent(user));\n * ```\n */\nexport function defineEvent<IncomingData = unknown, OutgoingData = unknown>(\n eventName: string,\n options: EventOptions<IncomingData> = {},\n): EventMessageClass<IncomingData, OutgoingData> {\n // We need to use `any` here to bridge the IncomingData -> OutgoingData transformation\n // The class accepts IncomingData in constructor but outputs OutgoingData via toJSON()\n return class AnnouncedEvent extends EventMessage<OutgoingData> {\n public eventName = eventName;\n public schema = options.schema;\n\n public constructor(data?: IncomingData) {\n super(data as any);\n }\n\n public toJSON(): OutgoingData {\n if (!options.toJSON) return this.data as OutgoingData;\n\n return options.toJSON(this.data as IncomingData) as OutgoingData;\n }\n };\n}\n","import { herald } from \"./utils/connect-to-broker\";\n\n/**\n * Minimal mirror of `@warlock.js/core`'s `UseCaseBroadcastEvent`.\n *\n * Kept local on purpose: this adapter is **structurally typed** so `@warlock.js/herald`\n * takes no dependency on `@warlock.js/core`. The shape only needs the fields the\n * adapter reads (`event` for the channel, `payload` for the body).\n */\nexport type UseCaseBroadcastEvent = {\n useCase: string;\n event: string;\n id: string;\n at: Date;\n payload: unknown;\n};\n\n/**\n * Channel adapter that publishes use-case broadcast events onto a herald broker.\n *\n * Register it in the use-cases config so successful use cases fan out to the bus:\n *\n * @example\n * // src/config/use-cases.ts\n * import { heraldBroadcast } from \"@warlock.js/herald\";\n *\n * export default {\n * broadcast: {\n * enabled: true,\n * channels: [heraldBroadcast({ broker: \"default\" })],\n * },\n * } satisfies UseCaseConfigurations;\n *\n * @param options - Optional broker name (defaults to the default broker)\n */\nexport function heraldBroadcast(options?: { broker?: string }) {\n return {\n async broadcast(event: UseCaseBroadcastEvent): Promise<void> {\n await herald(options?.broker).channel(event.event).publish(event.payload);\n },\n };\n}\n"],"x_google_ignoreList":[2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,29,36],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAAgB,4BACd,UACA,SACA;CACA,MAAM,WAAgC,OAAO,SAAS,QAAQ;EAC5D,MAAM,WAAW,QAAQ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