@warlock.js/notifications 5.2.4 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/{src-DJA8APmy.cjs → esm-FB2hc0-o.cjs} +206 -298
- package/cjs/esm-FB2hc0-o.cjs.map +1 -0
- package/cjs/index.cjs +1 -1
- package/cjs/rabbitmq-driver-CIvkulXX.cjs +3 -0
- package/esm/index.d.mts +4 -0
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/communicators/broker-registry.d.mts +1 -0
- package/esm/{herald/src → node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm}/communicators/broker-registry.mjs +5 -5
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/communicators/broker-registry.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/communicators/broker.d.mts +1 -0
- package/esm/{herald/src → node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm}/communicators/broker.mjs +1 -7
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/communicators/broker.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/communicators/index.mjs +3 -0
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/contracts/broker-driver.contract.d.mts +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/contracts/channel.contract.d.mts +1 -0
- package/esm/{herald/src → node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm}/decorators/consumable.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/decorators/consumable.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/decorators/index.mjs +3 -0
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/drivers/index.mjs +5 -0
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/drivers/rabbitmq/index.mjs +4 -0
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/drivers/rabbitmq/rabbitmq-channel.d.mts +1 -0
- package/esm/{herald/src → node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm}/drivers/rabbitmq/rabbitmq-channel.mjs +6 -13
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/drivers/rabbitmq/rabbitmq-channel.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/drivers/rabbitmq/rabbitmq-driver.d.mts +1 -0
- package/esm/{herald/src → node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm}/drivers/rabbitmq/rabbitmq-driver.mjs +10 -11
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/drivers/rabbitmq/rabbitmq-driver.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/index.d.mts +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/message-managers/event-consumer.d.mts +1 -0
- package/esm/{herald/src → node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm}/message-managers/event-consumer.mjs +10 -22
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/message-managers/event-consumer.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/message-managers/event-message.d.mts +1 -0
- package/esm/{herald/src → node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm}/message-managers/event-message.mjs +3 -20
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/message-managers/event-message.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/message-managers/index.mjs +3 -0
- package/esm/{herald/src → node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm}/message-managers/prepare-consumer-subscription.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/message-managers/prepare-consumer-subscription.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/types/channel.types.d.mts +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/types/registry.types.d.mts +1 -0
- package/esm/{herald/src → node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm}/use-case-broadcast.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/use-case-broadcast.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/utils/connect-to-broker.d.mts +1 -0
- package/esm/{herald/src → node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm}/utils/connect-to-broker.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/utils/connect-to-broker.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm/utils/index.mjs +3 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/config.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/config.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/factory/index.mjs +3 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/factory/validate.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/factory/validate.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/factory/validators.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/factory/validators.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/helpers/date-helpers.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/helpers/date-helpers.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/helpers/get-field-value.mjs +3 -3
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/helpers/get-field-value.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/helpers/index.mjs +3 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/helpers/is-empty-value.mjs +10 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/helpers/is-empty-value.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/helpers/path-helpers.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/helpers/path-helpers.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/helpers/validation-helpers.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/helpers/validation-helpers.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/index.d.mts +10 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/index.mjs +7 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/mutators/array-mutators.mjs +3 -3
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/mutators/array-mutators.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/mutators/date-mutators.mjs +3 -3
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/mutators/date-mutators.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/mutators/index.mjs +7 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/mutators/number-mutators.mjs +4 -4
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/mutators/number-mutators.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/mutators/object-mutators.mjs +4 -4
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/mutators/object-mutators.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/mutators/scalar-mutators.mjs +9 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/mutators/scalar-mutators.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/mutators/string-mutators.mjs +11 -11
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/mutators/string-mutators.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/array/array-rules.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/array/array-rules.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/array/index.mjs +3 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/color/color-rules.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/color/color-rules.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/color/index.mjs +3 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/common/enum.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/common/enum.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/common/equals-field-rules.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/common/equals-field-rules.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/common/index.mjs +8 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/common/instanceof.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/common/instanceof.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/common/literal.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/common/literal.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/common/type-rules.mjs +2 -2
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/common/type-rules.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/common/unknown-key.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/common/unknown-key.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/conditional/forbidden-if-rules.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/conditional/forbidden-if-rules.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/conditional/index.mjs +12 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/conditional/present-if-rules.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/conditional/present-if-rules.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/conditional/present-unless-rules.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/conditional/present-unless-rules.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/conditional/present-with-rules.mjs +3 -3
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/conditional/present-with-rules.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/conditional/present-without-rules.mjs +3 -3
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/conditional/present-without-rules.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/conditional/required-if-rules.mjs +3 -3
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/conditional/required-if-rules.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/conditional/required-unless-rules.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/conditional/required-unless-rules.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/conditional/required-when-rule.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/conditional/required-when-rule.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/conditional/required-with-rules.mjs +3 -3
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/conditional/required-with-rules.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/conditional/required-without-rules.mjs +3 -3
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/conditional/required-without-rules.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/core/equal.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/core/equal.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/core/forbidden.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/core/forbidden.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/core/index.mjs +7 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/core/required.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/core/required.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/core/union.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/core/union.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/core/when.mjs +3 -3
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/core/when.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/date/date-comparison-rules.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/date/date-comparison-rules.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/date/date-day-rules.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/date/date-day-rules.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/date/date-field-comparison-rules.mjs +3 -3
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/date/date-field-comparison-rules.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/date/date-period-rules.mjs +3 -3
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/date/date-period-rules.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/date/date-relative-rules.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/date/date-relative-rules.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/date/date-special-rules.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/date/date-special-rules.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/date/date.mjs +3 -3
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/date/date.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/date/index.mjs +9 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/index.mjs +57 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/length/index.mjs +3 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/length/length-rules.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/length/length-rules.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/number/index.mjs +3 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/number/number-rules.mjs +3 -3
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/number/number-rules.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/scalar/accepted-rule.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/scalar/accepted-rule.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/scalar/declined-rule.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/scalar/declined-rule.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/scalar/index.mjs +4 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/string/alpha.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/string/alpha.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/string/credit-card.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/string/credit-card.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/string/email.mjs +2 -2
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/string/email.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/string/id-formats.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/string/id-formats.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/string/index.mjs +13 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/string/ip.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/string/ip.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/string/matches.mjs +4 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/string/pattern.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/string/pattern.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/string/string-comparison.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/string/string-comparison.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/string/strong-password-rule.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/string/strong-password-rule.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/string/url.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/string/url.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/string/without-whitespace.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/rules/string/without-whitespace.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/standard-schema/json-schema.d.mts +32 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/standard-schema/json-schema.d.mts.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/standard-schema/json-schema.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/standard-schema/json-schema.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/standard-schema/map-result.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/standard-schema/map-result.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/standard-schema/types.d.mts +97 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/standard-schema/types.d.mts.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/types/conditional-types.d.mts +16 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/types/conditional-types.d.mts.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/types/context-types.d.mts +42 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/types/context-types.d.mts.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/types/data-transformer-types.d.mts +30 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/types/data-transformer-types.d.mts.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/types/date-types.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/types/date-types.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/types/mutator-types.d.mts +28 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/types/mutator-types.d.mts.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/types/result-types.d.mts +17 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/types/result-types.d.mts.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/types/rule-types.d.mts +53 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/types/rule-types.d.mts.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/types/schema-types.d.mts +11 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/types/schema-types.d.mts.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/any-validator.mjs +6 -9
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/any-validator.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/array-validator.mjs +1 -2
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/array-validator.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/base-validator.d.mts +492 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/base-validator.d.mts.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/base-validator.mjs +16 -49
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/base-validator.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/boolean-validator.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/boolean-validator.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/computed-validator.mjs +1 -3
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/computed-validator.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/date-validator.mjs +3 -3
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/date-validator.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/discriminated-union-validator.mjs +2 -6
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/discriminated-union-validator.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/float-validator.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/float-validator.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/index.mjs +28 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/instanceof-validator.mjs +1 -2
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/instanceof-validator.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/int-validator.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/int-validator.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/lazy-validator.mjs +1 -3
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/lazy-validator.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/literal-validator.mjs +1 -2
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/literal-validator.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/managed-validator.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/managed-validator.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/methods/equality-conditional-methods.d.mts +91 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/methods/equality-conditional-methods.d.mts.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/methods/equality-conditional-methods.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/methods/equality-conditional-methods.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/methods/forbidden-methods.d.mts +59 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/methods/forbidden-methods.d.mts.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/methods/forbidden-methods.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/methods/forbidden-methods.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/methods/present-methods.d.mts +103 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/methods/present-methods.d.mts.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/methods/present-methods.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/methods/present-methods.mjs.map +1 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/methods/required-methods.d.mts +194 -0
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/methods/required-methods.d.mts.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/methods/required-methods.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/methods/required-methods.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/number-validator.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/number-validator.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/numeric-validator.mjs +2 -2
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/numeric-validator.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/object-validator.mjs +7 -8
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/object-validator.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/primitive-validator.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/primitive-validator.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/record-validator.mjs +2 -3
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/record-validator.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/scalar-validator.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/scalar-validator.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/string-validator.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/string-validator.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/tuple-validator.mjs +1 -2
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/tuple-validator.mjs.map +1 -0
- package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/validators/union-validator.mjs +1 -1
- package/esm/node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm/validators/union-validator.mjs.map +1 -0
- package/esm/queue/load-herald.d.mts.map +1 -1
- package/esm/queue/load-herald.mjs +1 -1
- package/package.json +6 -6
- package/cjs/rabbitmq-driver-BFvpezlq.cjs +0 -3
- package/cjs/src-DJA8APmy.cjs.map +0 -1
- package/esm/herald/src/communicators/broker-registry.mjs.map +0 -1
- package/esm/herald/src/communicators/broker.mjs.map +0 -1
- package/esm/herald/src/communicators/index.mjs +0 -4
- package/esm/herald/src/decorators/consumable.mjs.map +0 -1
- package/esm/herald/src/decorators/index.mjs +0 -3
- package/esm/herald/src/drivers/index.mjs +0 -5
- package/esm/herald/src/drivers/rabbitmq/index.mjs +0 -4
- package/esm/herald/src/drivers/rabbitmq/rabbitmq-channel.mjs.map +0 -1
- package/esm/herald/src/drivers/rabbitmq/rabbitmq-driver.mjs.map +0 -1
- package/esm/herald/src/message-managers/event-consumer.mjs.map +0 -1
- package/esm/herald/src/message-managers/event-message.mjs.map +0 -1
- package/esm/herald/src/message-managers/index.mjs +0 -4
- package/esm/herald/src/message-managers/prepare-consumer-subscription.mjs.map +0 -1
- package/esm/herald/src/use-case-broadcast.mjs.map +0 -1
- package/esm/herald/src/utils/connect-to-broker.mjs.map +0 -1
- package/esm/herald/src/utils/index.mjs +0 -3
- package/esm/seal/src/config.mjs.map +0 -1
- package/esm/seal/src/factory/index.mjs +0 -4
- package/esm/seal/src/factory/validate.mjs.map +0 -1
- package/esm/seal/src/factory/validators.mjs.map +0 -1
- package/esm/seal/src/helpers/date-helpers.mjs.map +0 -1
- package/esm/seal/src/helpers/get-field-value.mjs.map +0 -1
- package/esm/seal/src/helpers/index.mjs +0 -6
- package/esm/seal/src/helpers/is-empty-value.mjs +0 -10
- package/esm/seal/src/helpers/is-empty-value.mjs.map +0 -1
- package/esm/seal/src/helpers/path-helpers.mjs.map +0 -1
- package/esm/seal/src/helpers/validation-helpers.mjs.map +0 -1
- package/esm/seal/src/mutators/array-mutators.mjs.map +0 -1
- package/esm/seal/src/mutators/date-mutators.mjs.map +0 -1
- package/esm/seal/src/mutators/index.mjs +0 -8
- package/esm/seal/src/mutators/number-mutators.mjs.map +0 -1
- package/esm/seal/src/mutators/object-mutators.mjs.map +0 -1
- package/esm/seal/src/mutators/scalar-mutators.mjs +0 -9
- package/esm/seal/src/mutators/scalar-mutators.mjs.map +0 -1
- package/esm/seal/src/mutators/string-mutators.mjs.map +0 -1
- package/esm/seal/src/rules/array/array-rules.mjs.map +0 -1
- package/esm/seal/src/rules/array/index.mjs +0 -3
- package/esm/seal/src/rules/color/color-rules.mjs.map +0 -1
- package/esm/seal/src/rules/color/index.mjs +0 -3
- package/esm/seal/src/rules/common/enum.mjs.map +0 -1
- package/esm/seal/src/rules/common/equals-field-rules.mjs.map +0 -1
- package/esm/seal/src/rules/common/index.mjs +0 -8
- package/esm/seal/src/rules/common/instanceof.mjs.map +0 -1
- package/esm/seal/src/rules/common/literal.mjs.map +0 -1
- package/esm/seal/src/rules/common/type-rules.mjs.map +0 -1
- package/esm/seal/src/rules/common/unknown-key.mjs.map +0 -1
- package/esm/seal/src/rules/conditional/forbidden-if-rules.mjs.map +0 -1
- package/esm/seal/src/rules/conditional/index.mjs +0 -12
- package/esm/seal/src/rules/conditional/present-if-rules.mjs.map +0 -1
- package/esm/seal/src/rules/conditional/present-unless-rules.mjs.map +0 -1
- package/esm/seal/src/rules/conditional/present-with-rules.mjs.map +0 -1
- package/esm/seal/src/rules/conditional/present-without-rules.mjs.map +0 -1
- package/esm/seal/src/rules/conditional/required-if-rules.mjs.map +0 -1
- package/esm/seal/src/rules/conditional/required-unless-rules.mjs.map +0 -1
- package/esm/seal/src/rules/conditional/required-when-rule.mjs.map +0 -1
- package/esm/seal/src/rules/conditional/required-with-rules.mjs.map +0 -1
- package/esm/seal/src/rules/conditional/required-without-rules.mjs.map +0 -1
- package/esm/seal/src/rules/core/equal.mjs.map +0 -1
- package/esm/seal/src/rules/core/forbidden.mjs.map +0 -1
- package/esm/seal/src/rules/core/index.mjs +0 -7
- package/esm/seal/src/rules/core/required.mjs.map +0 -1
- package/esm/seal/src/rules/core/union.mjs.map +0 -1
- package/esm/seal/src/rules/core/when.mjs.map +0 -1
- package/esm/seal/src/rules/date/date-comparison-rules.mjs.map +0 -1
- package/esm/seal/src/rules/date/date-day-rules.mjs.map +0 -1
- package/esm/seal/src/rules/date/date-field-comparison-rules.mjs.map +0 -1
- package/esm/seal/src/rules/date/date-period-rules.mjs.map +0 -1
- package/esm/seal/src/rules/date/date-relative-rules.mjs.map +0 -1
- package/esm/seal/src/rules/date/date-special-rules.mjs.map +0 -1
- package/esm/seal/src/rules/date/date.mjs.map +0 -1
- package/esm/seal/src/rules/date/index.mjs +0 -9
- package/esm/seal/src/rules/index.mjs +0 -54
- package/esm/seal/src/rules/length/index.mjs +0 -3
- package/esm/seal/src/rules/length/length-rules.mjs.map +0 -1
- package/esm/seal/src/rules/number/index.mjs +0 -3
- package/esm/seal/src/rules/number/number-rules.mjs.map +0 -1
- package/esm/seal/src/rules/scalar/accepted-rule.mjs.map +0 -1
- package/esm/seal/src/rules/scalar/declined-rule.mjs.map +0 -1
- package/esm/seal/src/rules/scalar/index.mjs +0 -4
- package/esm/seal/src/rules/string/alpha.mjs.map +0 -1
- package/esm/seal/src/rules/string/credit-card.mjs.map +0 -1
- package/esm/seal/src/rules/string/email.mjs.map +0 -1
- package/esm/seal/src/rules/string/id-formats.mjs.map +0 -1
- package/esm/seal/src/rules/string/index.mjs +0 -13
- package/esm/seal/src/rules/string/ip.mjs.map +0 -1
- package/esm/seal/src/rules/string/matches.mjs +0 -4
- package/esm/seal/src/rules/string/pattern.mjs.map +0 -1
- package/esm/seal/src/rules/string/string-comparison.mjs.map +0 -1
- package/esm/seal/src/rules/string/strong-password-rule.mjs.map +0 -1
- package/esm/seal/src/rules/string/url.mjs.map +0 -1
- package/esm/seal/src/rules/string/without-whitespace.mjs.map +0 -1
- package/esm/seal/src/standard-schema/json-schema.mjs.map +0 -1
- package/esm/seal/src/standard-schema/map-result.mjs.map +0 -1
- package/esm/seal/src/types/date-types.mjs.map +0 -1
- package/esm/seal/src/validators/any-validator.mjs.map +0 -1
- package/esm/seal/src/validators/array-validator.mjs.map +0 -1
- package/esm/seal/src/validators/base-validator.mjs.map +0 -1
- package/esm/seal/src/validators/boolean-validator.mjs.map +0 -1
- package/esm/seal/src/validators/computed-validator.mjs.map +0 -1
- package/esm/seal/src/validators/date-validator.mjs.map +0 -1
- package/esm/seal/src/validators/discriminated-union-validator.mjs.map +0 -1
- package/esm/seal/src/validators/float-validator.mjs.map +0 -1
- package/esm/seal/src/validators/index.mjs +0 -28
- package/esm/seal/src/validators/instanceof-validator.mjs.map +0 -1
- package/esm/seal/src/validators/int-validator.mjs.map +0 -1
- package/esm/seal/src/validators/lazy-validator.mjs.map +0 -1
- package/esm/seal/src/validators/literal-validator.mjs.map +0 -1
- package/esm/seal/src/validators/managed-validator.mjs.map +0 -1
- package/esm/seal/src/validators/methods/equality-conditional-methods.mjs.map +0 -1
- package/esm/seal/src/validators/methods/forbidden-methods.mjs.map +0 -1
- package/esm/seal/src/validators/methods/present-methods.mjs.map +0 -1
- package/esm/seal/src/validators/methods/required-methods.mjs.map +0 -1
- package/esm/seal/src/validators/number-validator.mjs.map +0 -1
- package/esm/seal/src/validators/numeric-validator.mjs.map +0 -1
- package/esm/seal/src/validators/object-validator.mjs.map +0 -1
- package/esm/seal/src/validators/primitive-validator.mjs.map +0 -1
- package/esm/seal/src/validators/record-validator.mjs.map +0 -1
- package/esm/seal/src/validators/scalar-validator.mjs.map +0 -1
- package/esm/seal/src/validators/string-validator.mjs.map +0 -1
- package/esm/seal/src/validators/tuple-validator.mjs.map +0 -1
- package/esm/seal/src/validators/union-validator.mjs.map +0 -1
- /package/esm/{herald/src → node_modules/.pnpm/@warlock.js_herald@5.2.4_@s_301a5eb076404f4e7a51af7b45e7e429/node_modules/@warlock.js/herald/esm}/index.mjs +0 -0
- /package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/file/dimensions.mjs +0 -0
- /package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/file/file-size.mjs +0 -0
- /package/esm/{seal/src → node_modules/.pnpm/@warlock.js_seal@5.2.4/node_modules/@warlock.js/seal/esm}/rules/file/index.mjs +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"present-methods.mjs","names":[],"sources":["../../../../../../../../../../seal/src/validators/methods/present-methods.ts"],"sourcesContent":["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"],"mappings":";;;;;;;;;;AA2JA,cAAc,UAAU,cAAc,SAAU,OAAe,cAAuB;CACpF,OAAO,KAAK,QAAQ,iBAAiB,cAAc;EACjD;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,qBAAqB,SAAU,OAAe,cAAuB;CAC3F,OAAO,KAAK,QAAQ,iBAAiB,cAAc;EACjD;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,iBAAiB,SAAU,OAAe,cAAuB;CACvF,OAAO,KAAK,QAAQ,oBAAoB,cAAc;EACpD;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,wBAAwB,SAAU,OAAe,cAAuB;CAC9F,OAAO,KAAK,QAAQ,oBAAoB,cAAc;EACpD;EACA,OAAO;CACT,CAAC;AACH;;;;AAOA,cAAc,UAAU,YAAY,SAAU,OAAe,OAAY,cAAuB;CAC9F,OAAO,KAAK,QAAQ,eAAe,cAAc;EAC/C;EACA;EACA,O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D;EACA;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,wBAAwB,SAC9C,OACA,QACA,cACA;CACA,OAAO,KAAK,QAAQ,oBAAoB,cAAc;EACpD;EACA;EACA,OAAO;CACT,CAAC;AACH;;;;AAOA,cAAc,UAAU,iBAAiB,SAAU,QAAkB,cAAuB;CAC1F,OAAO,KAAK,QAAQ,oBAAoB,cAAc;EACpD;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,yBAAyB,SAC/C,QACA,cACA;CACA,OAAO,KAAK,QAAQ,oBAAoB,cAAc;EACpD;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,oBAAoB,SAAU,QAAkB,cAAuB;CAC7F,OAAO,KAAK,QAAQ,uBAAuB,cAAc;EACvD;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,4BAA4B,SAClD,QACA,cACA;CACA,OAAO,KAAK,QAAQ,uBAAuB,cAAc;EACvD;EACA,OAAO;CACT,CAAC;AACH;;;;AAOA,cAAc,UAAU,iBAAiB,SAAU,QAAkB,cAAuB;CAC1F,OAAO,KAAK,QAAQ,oBAAoB,cAAc;EACpD;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,yBAAyB,SAC/C,QACA,cACA;CACA,OAAO,KAAK,QAAQ,oBAAoB,cAAc;EACpD;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,oBAAoB,SAAU,QAAkB,cAAuB;CAC7F,OAAO,KAAK,QAAQ,uBAAuB,cAAc;EACvD;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,4BAA4B,SAClD,QACA,cACA;CACA,OAAO,KAAK,QAAQ,uBAAuB,cAAc;EACvD;EACA,OAAO;CACT,CAAC;AACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"required-methods.mjs","names":[],"sources":["../../../../../../../../../../seal/src/validators/methods/required-methods.ts"],"sourcesContent":["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};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;EAAQ,OAAO;CAAU,CAAC;AAC7F;;;;AAKA,cAAc,UAAU,qBAAqB,SAAU,QAAkB,cAAuB;CAC9F,OAAO,KAAK,gBAAgB,wBAAwB,cAAc;EAAE;EAAQ,OAAO;CAAS,CAAC;AAC/F;;;;AAKA,cAAc,UAAU,6BAA6B,SACnD,QACA,cACA;CACA,OAAO,KAAK,gBAAgB,wBAAwB,cAAc;EAAE;EAAQ,OAAO;CAAU,CAAC;AAChG;;;;AAOA,cAAc,UAAU,kBAAkB,SAAU,QAAkB,cAAuB;CAC3F,OAAO,KAAK,gBAAgB,qBAAqB,cAAc;EAAE;EAAQ,OAAO;CAAS,CAAC;AAC5F;;;;AAKA,cAAc,UAAU,0BAA0B,SAChD,QACA,cACA;CACA,OAAO,KAAK,gBAAgB,qBAAqB,cAAc;EAAE;EAAQ,OAAO;CAAU,CAAC;AAC7F;;;;AAKA,cAAc,UAAU,qBAAqB,SAAU,QAAkB,cAAuB;CAC9F,OAAO,KAAK,gBAAgB,wBAAwB,cAAc;EAAE;EAAQ,OAAO;CAAS,CAAC;AAC/F;;;;AAKA,cAAc,UAAU,6BAA6B,SACnD,QACA,cACA;CACA,OAAO,KAAK,gBAAgB,wBAAwB,cAAc;EAAE;EAAQ,OAAO;CAAU,CAAC;AAChG;;;;;AAQA,cAAc,UAAU,eAAe,SACrC,UACA,cACA;CACA,OAAO,KAAK,gBAAgB,kBAAkB,cAAc,EAAE,SAAS,CAAC;AAC1E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"number-validator.mjs","names":[],"sources":["../../../../../../../../../seal/src/validators/number-validator.ts"],"sourcesContent":["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"],"mappings":";;;;;;;;;;;;;AAwBA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AAmB;EAC5B,OACE,OAAO,mBAAmB,OAAO;EAKrC,MAAM,SAAS,eAAe,KAAK,OAAO,UAAU;EACpD,IAAI,QAAQ,UAAU,UAAa,OAAO,OAAO,UAAU,UACzD,IAAI,WAAW,YAAY;GACzB,OAAO,UAAU,OAAO;GACxB,OAAO,mBAAmB;EAC5B,OACE,OAAO,mBAAmB,OAAO;EAKrC,MAAM,aAAa,eAAe,KAAK,OAAO,QAAQ;EACtD,IAAI,YAAY,UAAU,UAAa,OAAO,WAAW,UAAU,UACjE,OAAO,aAAa,WAAW;EAIjC,MAAM,SAAS,eAAe,KAAK,OAAO,IAAI;EAC9C,IAAI,QAAQ,UAAU,MAAM,QAAQ,OAAO,MAAM,GAC/C,OAAO,OAAO,OAAO;EAGvB,IAAI,KAAK,YAAY,cAAc,QAAQ,MAAM;EAEjD,OAAO;CACT;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"numeric-validator.mjs","names":[],"sources":["../../../../../../../../../seal/src/validators/numeric-validator.ts"],"sourcesContent":["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"],"mappings":";;;;;;;;AAOA,IAAa,mBAAb,cAAsC,gBAAgB;;;;CAIpD,AAAO,YAAY,cAAuB;EACxC,MAAM,YAAY;EAClB,KAAK,kBAAkB,cAAc;CACvC;;;;CAKA,AAAO,YAAY,OAAqB;EACtC,OAAO,UAAU,KAAK;CACxB;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"object-validator.mjs","names":[],"sources":["../../../../../../../../../seal/src/validators/object-validator.ts"],"sourcesContent":["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"],"mappings":";;;;;;;;;;;;;;;;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OAAO,OAAO,sBAAsB,OAAO,OAAO;CAItD,OAAO;AACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"primitive-validator.mjs","names":[],"sources":["../../../../../../../../../seal/src/validators/primitive-validator.ts"],"sourcesContent":["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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAsB,qBAAtB,cAAiD,cAAc;;;;;;;CAO7D,AAAO,KAAK,QAAa,cAAuB;EAC9C,OAAO,KAAK,QAAQ,UAAU,cAAc,EAAE,MAAM,OAAO,OAAO,MAAM,EAAE,CAAC;CAC7E;;;;;;;;CASA,AAAO,GAAG,QAAe,cAAuB;EAC9C,OAAO,KAAK,QAAQ,QAAQ,cAAc,EAAE,OAAO,CAAC;CACtD;;;;;;;CAQA,AAAO,MAAM,QAAe,cAAuB;EACjD,OAAO,KAAK,GAAG,QAAQ,YAAY;CACrC;;;;;;;CAQA,AAAO,WAAW,QAAe,cAAuB;EACtD,OAAO,KAAK,QAAQ,mBAAmB,cAAc,EAAE,eAAe,OAAO,CAAC;CAChF;;;;;;;;CASA,AAAO,QAAQ,QAAe,cAAuB;EACnD,OAAO,KAAK,QAAQ,sBAAsB,cAAc,EAAE,kBAAkB,OAAO,CAAC;CACtF;;;;;;;CAQA,AAAO,MAAM,QAAe,cAAuB;EACjD,OAAO,KAAK,QAAQ,QAAQ,YAAY;CAC1C;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"record-validator.mjs","names":[],"sources":["../../../../../../../../../seal/src/validators/record-validator.ts"],"sourcesContent":["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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsBA,IAAa,kBAAb,cAAqC,cAAc;CAExC;CADT,AAAO,YACL,AAAO,gB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;EAC/D;EAEA,IAAI,KAAK,YAAY,cAAc,QAAQ,MAAM;EAEjD,OAAO;CACT;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scalar-validator.mjs","names":[],"sources":["../../../../../../../../../seal/src/validators/scalar-validator.ts"],"sourcesContent":["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"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6BA,IAAa,kBAAb,cAAqC,mBAAmB;CACtD,AAAO,YAAY,cAAuB;EACxC,MAAM;EACN,KAAK,eACH;GACE,MAAM;GACN,qBAAqB;GACrB,MAAM,SAAS,OAAO,SAA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AAC;CACxE;;;;CAKA,AAAO,mBAAmB,OAAe,cAAuB;EAC9D,OAAO,KAAK,QAAQ,wBAAwB,cAAc,EAAE,MAAM,CAAC;CACrE;;;;CAKA,AAAO,kBAAkB,OAAe,cAAuB;EAC7D,OAAO,KAAK,QAAQ,uBAAuB,cAAc,EAAE,MAAM,CAAC;CACpE;;;;CAKA,AAAO,gBAAgB,OAAe,cAAuB;EAC3D,OAAO,KAAK,QAAQ,qBAAqB,cAAc,EAAE,MAAM,CAAC;CAClE;;;;;;;;;;;;;;;;CAiBA,AAAgB,aAAa,UAA4B,iBAAmC;EAE1F,MAAM,SAAS,eAAe,KAAK,OAAO,IAAI;EAC9C,IAAI,QAAQ,UAAU,MAAM,QAAQ,OAAO,MAAM,GAC/C,OAAO,EAAE,MAAM,OAAO,OAAO;EAG/B,MAAM,WAAW,eAAe,KAAK,OAAO,MAAM;EAClD,IAAI,UAAU,QAAQ,MAAM,QAAQ,SAAS,IAAI,GAC/C,OAAO,EAAE,MAAM,SAAS,KAAK;EAG/B,OAAO,EACL,OAAO;GACL,EAAE,MAAM,SAAS;GACjB,EAAE,MAAM,SAAS;GACjB,EAAE,MAAM,UAAU;EACpB,EACF;CACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"string-validator.mjs","names":[],"sources":["../../../../../../../../../seal/src/validators/string-validator.ts"],"sourcesContent":["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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkFA,IAAa,kBAAb,cAAqC,mBAAmB;CACtD,AAAO,YAAY,cAAuB;EACxC,MAAM;EACN,KAAK,eAAe,YAAY,YAAY;CAC9C;;;;CAKA,AAAO,YAAY,OAAqB;EACtC,OAAO,OAAO,UAAU;CAC1B;;;;CAOA,AAAO,WAAW;EAChB,OAAO,KAAK,WAAW,gBAAgB;CACzC;;CAGA,AAAO,YAAY;EACjB,OAAO,KAAK,WAAW,gBAAgB;CACzC;;CAGA,AAAO,YAAY;EACjB,OAAO,KAAK,WAAW,gBAAgB;CACzC;;CAGA,AAAO,aAAa;EAClB,OAAO,KAAK,WAAW,iBAAiB;CAC1C;;CAGA,AAAO,YAAY;EACjB,OAAO,KAAK,WAAW,gBAAgB;CACzC;;CAGA,AAAO,YAAY;EACjB,OAAO,KAAK,WAAW,gBAAgB;CACzC;;CAGA,AAAO,aAAa;EAClB,OAAO,KAAK,WAAW,iBAAiB;CAC1C;;CAGA,AAAO,YAAY;EACjB,OAAO,KAAK,WAAW,gBAAgB;CACzC;;CAGA,AAAO,YAAY;EACjB,OAAO,KAAK,WAAW,gBAAgB;CACzC;;;;;CAMA,AAAO,KAAK,QAAiB;EAC3B,OAAO,KAAK,WAAW,aAAa,EAAE,OAAO,CAAC;CAChD;;CAGA,AAAO,MAAM,QAAiB;EAC5B,OAAO,KAAK,W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D,OAAO,SAAS;EAKlB,IAAI,CAAC,OAAO,QAAQ;GAClB,MAAM,WAAW,eAAe,KAAK,OAAO,MAAM;GAClD,IAAI,UACF,OAAO,UAAU,SAAS,YAAY,IAAI,qBAAqB;GAEjE,IAAI,KAAK,MAAM,MAAK,MAAK,EAAE,SAAS,MAAM,GACxC,OAAO,UAAU;GAEnB,MAAM,aAAa,eAAe,KAAK,OAAO,QAAQ;GACtD,IAAI,YAEF,OAAO,UAAU,kBADJ,WAAW,UAAiC,GAClB;EAE3C;EAGA,MAAM,SAAS,eAAe,KAAK,OAAO,IAAI;EAC9C,IAAI,QAAQ,UAAU,MAAM,QAAQ,OAAO,MAAM,GAC/C,OAAO,OAAO,OAAO;EAGvB,IAAI,KAAK,YAAY,cAAc,QAAQ,MAAM;EAEjD,OAAO;CACT;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tuple-validator.mjs","names":[],"sources":["../../../../../../../../../seal/src/validators/tuple-validator.ts"],"sourcesContent":["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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsBA,IAAa,iBAAb,cAAoC,cAAc;CAEvC;CADT,AAAO,YACL,AAAO,YACP,cACA;EACA,MAAM;EAHC;EAIP,KAAK,eAAe,WAAW,YAAY;CAC7C;;;;CAKA,AAAO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;;;;;;;;;;;;;;;CAsBA,AAAgB,aAAa,SAA2B,iBAAmC;EACzF,MAAM,cAAc,KAAK,WAAW,KAAI,MAAK,EAAE,aAAa,MAAM,CAAC;EACnE,MAAM,SAAS,KAAK,WAAW;EAE/B,MAAM,SAA2B;GAC/B,MAAM;GACN,UAAU;GACV,UAAU;EACZ;EAEA,IAAI,WAAW,iBAAiB;GAE9B,OAAO,cAAc;GACrB,OAAO,QAAQ;EACjB,OAAO;GAEL,OAAO,QAAQ;GACf,OAAO,kBAAkB;EAC3B;EAEA,IAAI,KAAK,YAAY,cAAc,QAAQ,MAAM;EAEjD,OAAO;CACT;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"union-validator.mjs","names":[],"sources":["../../../../../../../../../seal/src/validators/union-validator.ts"],"sourcesContent":["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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,IAAa,iBAAb,cAAoC,cAAc;;;;;;;;;;;;;;CAchD,AAAO,MAAM,YAA6B,cAAuB;EAC/D,OAAO,KAAK,QAAQ,WAAW,cAAc,EAAE,WAAW,CAAC;CAC7D;;;;;;;;;;;;CAaA,AAAgB,aAAa,SAA2B,iBAAmC;EAIzF,OAAO,EACL,QAJW,eAAe,KAAK,OAAO,OACjB,CAAC,EAAE,cAAc,CAAC,EAGtB,CAAC,KAAI,MAAK,EAAE,aAAa,MAAM,CAAC,EACnD;CACF;AACF"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|