@warlock.js/notifications 4.16.0 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/cjs/channel_api-CH3DxhRU.cjs +7463 -0
- package/cjs/channel_api-CH3DxhRU.cjs.map +1 -0
- package/cjs/chunk-fl3r8ClO.cjs +41 -0
- package/cjs/index.cjs +1 -1
- package/cjs/index.cjs.map +1 -1
- package/cjs/rabbitmq-driver-CJtyxjUQ.cjs +3 -0
- package/cjs/src-Cus6pYPC.cjs +10981 -0
- package/cjs/src-Cus6pYPC.cjs.map +1 -0
- package/esm/_virtual/_rolldown/runtime.mjs +32 -0
- package/esm/herald/src/communicators/broker-registry.mjs +204 -0
- package/esm/herald/src/communicators/broker-registry.mjs.map +1 -0
- package/esm/herald/src/communicators/broker.mjs +110 -0
- package/esm/herald/src/communicators/broker.mjs.map +1 -0
- package/esm/herald/src/communicators/index.mjs +4 -0
- package/esm/herald/src/decorators/consumable.mjs +36 -0
- package/esm/herald/src/decorators/consumable.mjs.map +1 -0
- package/esm/herald/src/decorators/index.mjs +3 -0
- package/esm/herald/src/drivers/index.mjs +5 -0
- package/esm/herald/src/drivers/rabbitmq/index.mjs +4 -0
- package/esm/herald/src/drivers/rabbitmq/rabbitmq-channel.mjs +403 -0
- package/esm/herald/src/drivers/rabbitmq/rabbitmq-channel.mjs.map +1 -0
- package/esm/herald/src/drivers/rabbitmq/rabbitmq-driver.mjs +303 -0
- package/esm/herald/src/drivers/rabbitmq/rabbitmq-driver.mjs.map +1 -0
- package/esm/herald/src/index.mjs +16 -0
- package/esm/herald/src/message-managers/event-consumer.mjs +76 -0
- package/esm/herald/src/message-managers/event-consumer.mjs.map +1 -0
- package/esm/herald/src/message-managers/event-message.mjs +85 -0
- package/esm/herald/src/message-managers/event-message.mjs.map +1 -0
- package/esm/herald/src/message-managers/index.mjs +4 -0
- package/esm/herald/src/message-managers/prepare-consumer-subscription.mjs +42 -0
- package/esm/herald/src/message-managers/prepare-consumer-subscription.mjs.map +1 -0
- package/esm/herald/src/use-case-broadcast.mjs +30 -0
- package/esm/herald/src/use-case-broadcast.mjs.map +1 -0
- package/esm/herald/src/utils/connect-to-broker.mjs +168 -0
- package/esm/herald/src/utils/connect-to-broker.mjs.map +1 -0
- package/esm/herald/src/utils/index.mjs +3 -0
- package/esm/in-app/in-app.d.mts +3 -3
- package/esm/in-app/in-app.d.mts.map +1 -1
- package/esm/node_modules/@mongez/reinforcements/esm/Random/_internal.mjs +6 -0
- package/esm/node_modules/@mongez/reinforcements/esm/Random/_internal.mjs.map +1 -0
- package/esm/node_modules/@mongez/reinforcements/esm/Random/bool.mjs +3 -0
- package/esm/node_modules/@mongez/reinforcements/esm/Random/color.mjs +3 -0
- package/esm/node_modules/@mongez/reinforcements/esm/Random/date.mjs +3 -0
- package/esm/node_modules/@mongez/reinforcements/esm/Random/float.mjs +3 -0
- package/esm/node_modules/@mongez/reinforcements/esm/Random/id.mjs +3 -0
- package/esm/node_modules/@mongez/reinforcements/esm/Random/int.mjs +3 -0
- package/esm/node_modules/@mongez/reinforcements/esm/Random/nanoid.mjs +3 -0
- package/esm/node_modules/@mongez/reinforcements/esm/Random/pick.mjs +3 -0
- package/esm/node_modules/@mongez/reinforcements/esm/Random/random.mjs +16 -0
- package/esm/node_modules/@mongez/reinforcements/esm/Random/sample.mjs +3 -0
- package/esm/node_modules/@mongez/reinforcements/esm/Random/string.mjs +3 -0
- package/esm/node_modules/@mongez/reinforcements/esm/Random/token.mjs +3 -0
- package/esm/node_modules/@mongez/reinforcements/esm/Random/uuid.mjs +3 -0
- package/esm/node_modules/@mongez/reinforcements/esm/Random/weighted.mjs +3 -0
- package/esm/node_modules/@mongez/reinforcements/esm/async/retry.mjs +3 -0
- package/esm/node_modules/@mongez/reinforcements/esm/index.mjs +24 -0
- package/esm/node_modules/@mongez/reinforcements/esm/mixed/clone/clone.mjs +82 -0
- package/esm/node_modules/@mongez/reinforcements/esm/mixed/clone/clone.mjs.map +1 -0
- package/esm/node_modules/@mongez/reinforcements/esm/number/round.mjs +17 -0
- package/esm/node_modules/@mongez/reinforcements/esm/number/round.mjs.map +1 -0
- package/esm/node_modules/@mongez/reinforcements/esm/object/except.mjs +13 -0
- package/esm/node_modules/@mongez/reinforcements/esm/object/except.mjs.map +1 -0
- package/esm/node_modules/@mongez/reinforcements/esm/object/get.mjs +18 -0
- package/esm/node_modules/@mongez/reinforcements/esm/object/get.mjs.map +1 -0
- package/esm/node_modules/@mongez/reinforcements/esm/object/omit.mjs +17 -0
- package/esm/node_modules/@mongez/reinforcements/esm/object/omit.mjs.map +1 -0
- package/esm/node_modules/@mongez/reinforcements/esm/object/unset.mjs +30 -0
- package/esm/node_modules/@mongez/reinforcements/esm/object/unset.mjs.map +1 -0
- package/esm/node_modules/@mongez/reinforcements/esm/string/capitalize.mjs +19 -0
- package/esm/node_modules/@mongez/reinforcements/esm/string/capitalize.mjs.map +1 -0
- package/esm/node_modules/@mongez/reinforcements/esm/string/ltrim.mjs +18 -0
- package/esm/node_modules/@mongez/reinforcements/esm/string/ltrim.mjs.map +1 -0
- package/esm/node_modules/@mongez/reinforcements/esm/string/readMoreChars.mjs +14 -0
- package/esm/node_modules/@mongez/reinforcements/esm/string/readMoreChars.mjs.map +1 -0
- package/esm/node_modules/@mongez/reinforcements/esm/string/rtrim.mjs +18 -0
- package/esm/node_modules/@mongez/reinforcements/esm/string/rtrim.mjs.map +1 -0
- package/esm/node_modules/@mongez/reinforcements/esm/string/toCamelCase.mjs +22 -0
- package/esm/node_modules/@mongez/reinforcements/esm/string/toCamelCase.mjs.map +1 -0
- package/esm/node_modules/@mongez/reinforcements/esm/string/toKebabCase.mjs +17 -0
- package/esm/node_modules/@mongez/reinforcements/esm/string/toKebabCase.mjs.map +1 -0
- package/esm/node_modules/@mongez/reinforcements/esm/string/toSnakeCase.mjs +21 -0
- package/esm/node_modules/@mongez/reinforcements/esm/string/toSnakeCase.mjs.map +1 -0
- package/esm/node_modules/@mongez/reinforcements/esm/string/toStudlyCase.mjs +21 -0
- package/esm/node_modules/@mongez/reinforcements/esm/string/toStudlyCase.mjs.map +1 -0
- package/esm/node_modules/@mongez/reinforcements/esm/string/trim.mjs +20 -0
- package/esm/node_modules/@mongez/reinforcements/esm/string/trim.mjs.map +1 -0
- package/esm/node_modules/@mongez/reinforcements/esm/string/ucfirst.mjs +15 -0
- package/esm/node_modules/@mongez/reinforcements/esm/string/ucfirst.mjs.map +1 -0
- package/esm/node_modules/@mongez/reinforcements/esm/string/words.mjs +25 -0
- package/esm/node_modules/@mongez/reinforcements/esm/string/words.mjs.map +1 -0
- package/esm/node_modules/@mongez/reinforcements/esm/utils/escapeRegex.mjs +11 -0
- package/esm/node_modules/@mongez/reinforcements/esm/utils/escapeRegex.mjs.map +1 -0
- package/esm/node_modules/@mongez/reinforcements/esm/utils/lazy.mjs +100 -0
- package/esm/node_modules/@mongez/reinforcements/esm/utils/lazy.mjs.map +1 -0
- package/esm/node_modules/@mongez/reinforcements/esm/utils/tap.mjs +27 -0
- package/esm/node_modules/@mongez/reinforcements/esm/utils/tap.mjs.map +1 -0
- package/esm/node_modules/@mongez/supportive-is/esm/index.mjs +353 -0
- package/esm/node_modules/@mongez/supportive-is/esm/index.mjs.map +1 -0
- package/esm/node_modules/amqplib/channel_api.mjs +28 -0
- package/esm/node_modules/amqplib/channel_api.mjs.map +1 -0
- package/esm/node_modules/amqplib/lib/api_args.mjs +241 -0
- package/esm/node_modules/amqplib/lib/api_args.mjs.map +1 -0
- package/esm/node_modules/amqplib/lib/bitset.mjs +130 -0
- package/esm/node_modules/amqplib/lib/bitset.mjs.map +1 -0
- package/esm/node_modules/amqplib/lib/channel.mjs +302 -0
- package/esm/node_modules/amqplib/lib/channel.mjs.map +1 -0
- package/esm/node_modules/amqplib/lib/channel_model.mjs +206 -0
- package/esm/node_modules/amqplib/lib/channel_model.mjs.map +1 -0
- package/esm/node_modules/amqplib/lib/codec.mjs +273 -0
- package/esm/node_modules/amqplib/lib/codec.mjs.map +1 -0
- package/esm/node_modules/amqplib/lib/connect.mjs +143 -0
- package/esm/node_modules/amqplib/lib/connect.mjs.map +1 -0
- package/esm/node_modules/amqplib/lib/connection.mjs +416 -0
- package/esm/node_modules/amqplib/lib/connection.mjs.map +1 -0
- package/esm/node_modules/amqplib/lib/credentials.mjs +50 -0
- package/esm/node_modules/amqplib/lib/credentials.mjs.map +1 -0
- package/esm/node_modules/amqplib/lib/defs.mjs +4600 -0
- package/esm/node_modules/amqplib/lib/defs.mjs.map +1 -0
- package/esm/node_modules/amqplib/lib/error.mjs +29 -0
- package/esm/node_modules/amqplib/lib/error.mjs.map +1 -0
- package/esm/node_modules/amqplib/lib/format.mjs +28 -0
- package/esm/node_modules/amqplib/lib/format.mjs.map +1 -0
- package/esm/node_modules/amqplib/lib/frame.mjs +130 -0
- package/esm/node_modules/amqplib/lib/frame.mjs.map +1 -0
- package/esm/node_modules/amqplib/lib/heartbeat.mjs +40 -0
- package/esm/node_modules/amqplib/lib/heartbeat.mjs.map +1 -0
- package/esm/node_modules/amqplib/lib/mux.mjs +86 -0
- package/esm/node_modules/amqplib/lib/mux.mjs.map +1 -0
- package/esm/node_modules/amqplib/package.mjs +41 -0
- package/esm/node_modules/amqplib/package.mjs.map +1 -0
- package/esm/node_modules/buffer-more-ints/buffer-more-ints.mjs +360 -0
- package/esm/node_modules/buffer-more-ints/buffer-more-ints.mjs.map +1 -0
- package/esm/node_modules/dayjs/dayjs.min.mjs +305 -0
- package/esm/node_modules/dayjs/dayjs.min.mjs.map +1 -0
- package/esm/node_modules/querystringify/index.mjs +80 -0
- package/esm/node_modules/querystringify/index.mjs.map +1 -0
- package/esm/node_modules/requires-port/index.mjs +35 -0
- package/esm/node_modules/requires-port/index.mjs.map +1 -0
- package/esm/node_modules/url-parse/index.mjs +388 -0
- package/esm/node_modules/url-parse/index.mjs.map +1 -0
- package/esm/queue/load-herald.mjs +1 -1
- package/esm/seal/src/config.mjs +15 -0
- package/esm/seal/src/config.mjs.map +1 -0
- package/esm/seal/src/factory/index.mjs +4 -0
- package/esm/seal/src/factory/validate.mjs +34 -0
- package/esm/seal/src/factory/validate.mjs.map +1 -0
- package/esm/seal/src/factory/validators.mjs +132 -0
- package/esm/seal/src/factory/validators.mjs.map +1 -0
- package/esm/seal/src/helpers/date-helpers.mjs +24 -0
- package/esm/seal/src/helpers/date-helpers.mjs.map +1 -0
- package/esm/seal/src/helpers/get-field-value.mjs +46 -0
- package/esm/seal/src/helpers/get-field-value.mjs.map +1 -0
- package/esm/seal/src/helpers/index.mjs +6 -0
- package/esm/seal/src/helpers/is-empty-value.mjs +10 -0
- package/esm/seal/src/helpers/is-empty-value.mjs.map +1 -0
- package/esm/seal/src/helpers/path-helpers.mjs +12 -0
- package/esm/seal/src/helpers/path-helpers.mjs.map +1 -0
- package/esm/seal/src/helpers/validation-helpers.mjs +72 -0
- package/esm/seal/src/helpers/validation-helpers.mjs.map +1 -0
- package/esm/seal/src/index.mjs +87 -0
- package/esm/seal/src/mutators/array-mutators.mjs +32 -0
- package/esm/seal/src/mutators/array-mutators.mjs.map +1 -0
- package/esm/seal/src/mutators/date-mutators.mjs +94 -0
- package/esm/seal/src/mutators/date-mutators.mjs.map +1 -0
- package/esm/seal/src/mutators/index.mjs +8 -0
- package/esm/seal/src/mutators/number-mutators.mjs +52 -0
- package/esm/seal/src/mutators/number-mutators.mjs.map +1 -0
- package/esm/seal/src/mutators/object-mutators.mjs +30 -0
- package/esm/seal/src/mutators/object-mutators.mjs.map +1 -0
- package/esm/seal/src/mutators/scalar-mutators.mjs +9 -0
- package/esm/seal/src/mutators/scalar-mutators.mjs.map +1 -0
- package/esm/seal/src/mutators/string-mutators.mjs +186 -0
- package/esm/seal/src/mutators/string-mutators.mjs.map +1 -0
- package/esm/seal/src/rules/array/array-rules.mjs +41 -0
- package/esm/seal/src/rules/array/array-rules.mjs.map +1 -0
- package/esm/seal/src/rules/array/index.mjs +3 -0
- package/esm/seal/src/rules/color/color-rules.mjs +104 -0
- package/esm/seal/src/rules/color/color-rules.mjs.map +1 -0
- package/esm/seal/src/rules/color/index.mjs +3 -0
- package/esm/seal/src/rules/common/enum.mjs +77 -0
- package/esm/seal/src/rules/common/enum.mjs.map +1 -0
- package/esm/seal/src/rules/common/equals-field-rules.mjs +42 -0
- package/esm/seal/src/rules/common/equals-field-rules.mjs.map +1 -0
- package/esm/seal/src/rules/common/index.mjs +8 -0
- package/esm/seal/src/rules/common/instanceof.mjs +23 -0
- package/esm/seal/src/rules/common/instanceof.mjs.map +1 -0
- package/esm/seal/src/rules/common/literal.mjs +31 -0
- package/esm/seal/src/rules/common/literal.mjs.map +1 -0
- package/esm/seal/src/rules/common/type-rules.mjs +97 -0
- package/esm/seal/src/rules/common/type-rules.mjs.map +1 -0
- package/esm/seal/src/rules/common/unknown-key.mjs +25 -0
- package/esm/seal/src/rules/common/unknown-key.mjs.map +1 -0
- package/esm/seal/src/rules/conditional/forbidden-if-rules.mjs +116 -0
- package/esm/seal/src/rules/conditional/forbidden-if-rules.mjs.map +1 -0
- package/esm/seal/src/rules/conditional/index.mjs +12 -0
- package/esm/seal/src/rules/conditional/present-if-rules.mjs +97 -0
- package/esm/seal/src/rules/conditional/present-if-rules.mjs.map +1 -0
- package/esm/seal/src/rules/conditional/present-unless-rules.mjs +30 -0
- package/esm/seal/src/rules/conditional/present-unless-rules.mjs.map +1 -0
- package/esm/seal/src/rules/conditional/present-with-rules.mjs +76 -0
- package/esm/seal/src/rules/conditional/present-with-rules.mjs.map +1 -0
- package/esm/seal/src/rules/conditional/present-without-rules.mjs +76 -0
- package/esm/seal/src/rules/conditional/present-without-rules.mjs.map +1 -0
- package/esm/seal/src/rules/conditional/required-if-rules.mjs +204 -0
- package/esm/seal/src/rules/conditional/required-if-rules.mjs.map +1 -0
- package/esm/seal/src/rules/conditional/required-unless-rules.mjs +31 -0
- package/esm/seal/src/rules/conditional/required-unless-rules.mjs.map +1 -0
- package/esm/seal/src/rules/conditional/required-when-rule.mjs +32 -0
- package/esm/seal/src/rules/conditional/required-when-rule.mjs.map +1 -0
- package/esm/seal/src/rules/conditional/required-with-rules.mjs +67 -0
- package/esm/seal/src/rules/conditional/required-with-rules.mjs.map +1 -0
- package/esm/seal/src/rules/conditional/required-without-rules.mjs +67 -0
- package/esm/seal/src/rules/conditional/required-without-rules.mjs.map +1 -0
- package/esm/seal/src/rules/core/equal.mjs +22 -0
- package/esm/seal/src/rules/core/equal.mjs.map +1 -0
- package/esm/seal/src/rules/core/forbidden.mjs +20 -0
- package/esm/seal/src/rules/core/forbidden.mjs.map +1 -0
- package/esm/seal/src/rules/core/index.mjs +7 -0
- package/esm/seal/src/rules/core/required.mjs +36 -0
- package/esm/seal/src/rules/core/required.mjs.map +1 -0
- package/esm/seal/src/rules/core/union.mjs +30 -0
- package/esm/seal/src/rules/core/union.mjs.map +1 -0
- package/esm/seal/src/rules/core/when.mjs +37 -0
- package/esm/seal/src/rules/core/when.mjs.map +1 -0
- package/esm/seal/src/rules/date/date-comparison-rules.mjs +78 -0
- package/esm/seal/src/rules/date/date-comparison-rules.mjs.map +1 -0
- package/esm/seal/src/rules/date/date-day-rules.mjs +49 -0
- package/esm/seal/src/rules/date/date-day-rules.mjs.map +1 -0
- package/esm/seal/src/rules/date/date-field-comparison-rules.mjs +82 -0
- package/esm/seal/src/rules/date/date-field-comparison-rules.mjs.map +1 -0
- package/esm/seal/src/rules/date/date-period-rules.mjs +399 -0
- package/esm/seal/src/rules/date/date-period-rules.mjs.map +1 -0
- package/esm/seal/src/rules/date/date-relative-rules.mjs +55 -0
- package/esm/seal/src/rules/date/date-relative-rules.mjs.map +1 -0
- package/esm/seal/src/rules/date/date-special-rules.mjs +58 -0
- package/esm/seal/src/rules/date/date-special-rules.mjs.map +1 -0
- package/esm/seal/src/rules/date/date.mjs +235 -0
- package/esm/seal/src/rules/date/date.mjs.map +1 -0
- package/esm/seal/src/rules/date/index.mjs +9 -0
- package/esm/seal/src/rules/file/dimensions.mjs +3 -0
- package/esm/seal/src/rules/file/file-size.mjs +3 -0
- package/esm/seal/src/rules/file/index.mjs +4 -0
- package/esm/seal/src/rules/index.mjs +54 -0
- package/esm/seal/src/rules/length/index.mjs +3 -0
- package/esm/seal/src/rules/length/length-rules.mjs +98 -0
- package/esm/seal/src/rules/length/length-rules.mjs.map +1 -0
- package/esm/seal/src/rules/number/index.mjs +3 -0
- package/esm/seal/src/rules/number/number-rules.mjs +197 -0
- package/esm/seal/src/rules/number/number-rules.mjs.map +1 -0
- package/esm/seal/src/rules/scalar/accepted-rule.mjs +116 -0
- package/esm/seal/src/rules/scalar/accepted-rule.mjs.map +1 -0
- package/esm/seal/src/rules/scalar/declined-rule.mjs +116 -0
- package/esm/seal/src/rules/scalar/declined-rule.mjs.map +1 -0
- package/esm/seal/src/rules/scalar/index.mjs +4 -0
- package/esm/seal/src/rules/string/alpha.mjs +41 -0
- package/esm/seal/src/rules/string/alpha.mjs.map +1 -0
- package/esm/seal/src/rules/string/credit-card.mjs +32 -0
- package/esm/seal/src/rules/string/credit-card.mjs.map +1 -0
- package/esm/seal/src/rules/string/email.mjs +20 -0
- package/esm/seal/src/rules/string/email.mjs.map +1 -0
- package/esm/seal/src/rules/string/id-formats.mjs +104 -0
- package/esm/seal/src/rules/string/id-formats.mjs.map +1 -0
- package/esm/seal/src/rules/string/index.mjs +13 -0
- package/esm/seal/src/rules/string/ip.mjs +66 -0
- package/esm/seal/src/rules/string/ip.mjs.map +1 -0
- package/esm/seal/src/rules/string/matches.mjs +4 -0
- package/esm/seal/src/rules/string/pattern.mjs +20 -0
- package/esm/seal/src/rules/string/pattern.mjs.map +1 -0
- package/esm/seal/src/rules/string/string-comparison.mjs +56 -0
- package/esm/seal/src/rules/string/string-comparison.mjs.map +1 -0
- package/esm/seal/src/rules/string/strong-password-rule.mjs +31 -0
- package/esm/seal/src/rules/string/strong-password-rule.mjs.map +1 -0
- package/esm/seal/src/rules/string/url.mjs +23 -0
- package/esm/seal/src/rules/string/url.mjs.map +1 -0
- package/esm/seal/src/rules/string/without-whitespace.mjs +19 -0
- package/esm/seal/src/rules/string/without-whitespace.mjs.map +1 -0
- package/esm/seal/src/standard-schema/json-schema.mjs +81 -0
- package/esm/seal/src/standard-schema/json-schema.mjs.map +1 -0
- package/esm/seal/src/standard-schema/map-result.mjs +26 -0
- package/esm/seal/src/standard-schema/map-result.mjs.map +1 -0
- package/esm/seal/src/types/date-types.mjs +17 -0
- package/esm/seal/src/types/date-types.mjs.map +1 -0
- package/esm/seal/src/validators/any-validator.mjs +38 -0
- package/esm/seal/src/validators/any-validator.mjs.map +1 -0
- package/esm/seal/src/validators/array-validator.mjs +177 -0
- package/esm/seal/src/validators/array-validator.mjs.map +1 -0
- package/esm/seal/src/validators/base-validator.mjs +691 -0
- package/esm/seal/src/validators/base-validator.mjs.map +1 -0
- package/esm/seal/src/validators/boolean-validator.mjs +126 -0
- package/esm/seal/src/validators/boolean-validator.mjs.map +1 -0
- package/esm/seal/src/validators/computed-validator.mjs +118 -0
- package/esm/seal/src/validators/computed-validator.mjs.map +1 -0
- package/esm/seal/src/validators/date-validator.mjs +639 -0
- package/esm/seal/src/validators/date-validator.mjs.map +1 -0
- package/esm/seal/src/validators/discriminated-union-validator.mjs +129 -0
- package/esm/seal/src/validators/discriminated-union-validator.mjs.map +1 -0
- package/esm/seal/src/validators/float-validator.mjs +18 -0
- package/esm/seal/src/validators/float-validator.mjs.map +1 -0
- package/esm/seal/src/validators/index.mjs +28 -0
- package/esm/seal/src/validators/instanceof-validator.mjs +64 -0
- package/esm/seal/src/validators/instanceof-validator.mjs.map +1 -0
- package/esm/seal/src/validators/int-validator.mjs +30 -0
- package/esm/seal/src/validators/int-validator.mjs.map +1 -0
- package/esm/seal/src/validators/lazy-validator.mjs +87 -0
- package/esm/seal/src/validators/lazy-validator.mjs.map +1 -0
- package/esm/seal/src/validators/literal-validator.mjs +71 -0
- package/esm/seal/src/validators/literal-validator.mjs.map +1 -0
- package/esm/seal/src/validators/managed-validator.mjs +39 -0
- package/esm/seal/src/validators/managed-validator.mjs.map +1 -0
- package/esm/seal/src/validators/methods/equality-conditional-methods.mjs +129 -0
- package/esm/seal/src/validators/methods/equality-conditional-methods.mjs.map +1 -0
- package/esm/seal/src/validators/methods/forbidden-methods.mjs +131 -0
- package/esm/seal/src/validators/methods/forbidden-methods.mjs.map +1 -0
- package/esm/seal/src/validators/methods/present-methods.mjs +235 -0
- package/esm/seal/src/validators/methods/present-methods.mjs.map +1 -0
- package/esm/seal/src/validators/methods/required-methods.mjs +347 -0
- package/esm/seal/src/validators/methods/required-methods.mjs.map +1 -0
- package/esm/seal/src/validators/number-validator.mjs +310 -0
- package/esm/seal/src/validators/number-validator.mjs.map +1 -0
- package/esm/seal/src/validators/numeric-validator.mjs +27 -0
- package/esm/seal/src/validators/numeric-validator.mjs.map +1 -0
- package/esm/seal/src/validators/object-validator.mjs +442 -0
- package/esm/seal/src/validators/object-validator.mjs.map +1 -0
- package/esm/seal/src/validators/primitive-validator.mjs +89 -0
- package/esm/seal/src/validators/primitive-validator.mjs.map +1 -0
- package/esm/seal/src/validators/record-validator.mjs +112 -0
- package/esm/seal/src/validators/record-validator.mjs.map +1 -0
- package/esm/seal/src/validators/scalar-validator.mjs +172 -0
- package/esm/seal/src/validators/scalar-validator.mjs.map +1 -0
- package/esm/seal/src/validators/string-validator.mjs +459 -0
- package/esm/seal/src/validators/string-validator.mjs.map +1 -0
- package/esm/seal/src/validators/tuple-validator.mjs +134 -0
- package/esm/seal/src/validators/tuple-validator.mjs.map +1 -0
- package/esm/seal/src/validators/union-validator.mjs +66 -0
- package/esm/seal/src/validators/union-validator.mjs.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { BaseValidator } from "../base-validator.mjs";
|
|
2
|
+
import { equalRule } from "../../rules/core/equal.mjs";
|
|
3
|
+
import { whenRule } from "../../rules/core/when.mjs";
|
|
4
|
+
import { equalsFieldRule, notEqualsFieldRule } from "../../rules/common/equals-field-rules.mjs";
|
|
5
|
+
import "../../rules/index.mjs";
|
|
6
|
+
|
|
7
|
+
//#region ../seal/src/validators/methods/equality-conditional-methods.ts
|
|
8
|
+
/**
|
|
9
|
+
* Value must be equal to the given value
|
|
10
|
+
*/
|
|
11
|
+
BaseValidator.prototype.equal = function(value, errorMessage) {
|
|
12
|
+
return this.addRule(equalRule, errorMessage, { value });
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Value must be the same as another field's value
|
|
16
|
+
*/
|
|
17
|
+
BaseValidator.prototype.sameAs = function(field, errorMessage) {
|
|
18
|
+
return this.addRule(equalsFieldRule, errorMessage, {
|
|
19
|
+
field,
|
|
20
|
+
scope: "global"
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Value must be the same as another sibling field's value
|
|
25
|
+
*/
|
|
26
|
+
BaseValidator.prototype.sameAsSibling = function(field, errorMessage) {
|
|
27
|
+
return this.addRule(equalsFieldRule, errorMessage, {
|
|
28
|
+
field,
|
|
29
|
+
scope: "sibling"
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Value must be different from another field's value
|
|
34
|
+
*/
|
|
35
|
+
BaseValidator.prototype.differentFrom = function(field, errorMessage) {
|
|
36
|
+
return this.addRule(notEqualsFieldRule, errorMessage, {
|
|
37
|
+
field,
|
|
38
|
+
scope: "global"
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Value must be different from another sibling field's value
|
|
43
|
+
*/
|
|
44
|
+
BaseValidator.prototype.differentFromSibling = function(field, errorMessage) {
|
|
45
|
+
return this.addRule(notEqualsFieldRule, errorMessage, {
|
|
46
|
+
field,
|
|
47
|
+
scope: "sibling"
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Apply different validation rules based on another field's value (global scope)
|
|
52
|
+
*
|
|
53
|
+
* Use this when you need to apply completely different validators
|
|
54
|
+
* based on another field's value (not just required/optional).
|
|
55
|
+
*
|
|
56
|
+
* @param field - Field name to check (can be nested with dot notation)
|
|
57
|
+
* @param options - Validation options per field value
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* // Different allowed values based on user type
|
|
62
|
+
* v.object({
|
|
63
|
+
* userType: v.string().in(['admin', 'user']),
|
|
64
|
+
* role: v.string().when('userType', {
|
|
65
|
+
* is: {
|
|
66
|
+
* admin: v.string().in(['super', 'moderator']),
|
|
67
|
+
* user: v.string().in(['member', 'guest'])
|
|
68
|
+
* },
|
|
69
|
+
* otherwise: v.string().optional()
|
|
70
|
+
* })
|
|
71
|
+
* })
|
|
72
|
+
*
|
|
73
|
+
* // Different validation rules based on type
|
|
74
|
+
* v.object({
|
|
75
|
+
* contactType: v.string().in(['email', 'phone']),
|
|
76
|
+
* contact: v.string().when('contactType', {
|
|
77
|
+
* is: {
|
|
78
|
+
* email: v.string().email(),
|
|
79
|
+
* phone: v.string().pattern(/^\d{10}$/)
|
|
80
|
+
* }
|
|
81
|
+
* })
|
|
82
|
+
* })
|
|
83
|
+
* ```
|
|
84
|
+
* @category Conditional Validation
|
|
85
|
+
*/
|
|
86
|
+
BaseValidator.prototype.when = function(field, options) {
|
|
87
|
+
return this.addRule(whenRule, void 0, {
|
|
88
|
+
field,
|
|
89
|
+
is: options.is,
|
|
90
|
+
otherwise: options.otherwise,
|
|
91
|
+
scope: "global"
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Apply different validation rules based on sibling field's value
|
|
96
|
+
*
|
|
97
|
+
* Use this for nested objects where you need to check a field
|
|
98
|
+
* within the same parent object.
|
|
99
|
+
*
|
|
100
|
+
* @param siblingField - Sibling field name to check
|
|
101
|
+
* @param options - Validation options per field value
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* // Array of users with role-based permissions
|
|
106
|
+
* v.array(v.object({
|
|
107
|
+
* userType: v.string().in(['admin', 'user']),
|
|
108
|
+
* permissions: v.string().whenSibling('userType', {
|
|
109
|
+
* is: {
|
|
110
|
+
* admin: v.string().in(['read', 'write', 'delete']),
|
|
111
|
+
* user: v.string().in(['read'])
|
|
112
|
+
* }
|
|
113
|
+
* })
|
|
114
|
+
* }))
|
|
115
|
+
* ```
|
|
116
|
+
* @category Conditional Validation
|
|
117
|
+
*/
|
|
118
|
+
BaseValidator.prototype.whenSibling = function(siblingField, options) {
|
|
119
|
+
return this.addRule(whenRule, void 0, {
|
|
120
|
+
field: siblingField,
|
|
121
|
+
is: options.is,
|
|
122
|
+
otherwise: options.otherwise,
|
|
123
|
+
scope: "sibling"
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
//#endregion
|
|
128
|
+
export { };
|
|
129
|
+
//# sourceMappingURL=equality-conditional-methods.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"equality-conditional-methods.mjs","names":[],"sources":["../../../../../../../../../../seal/src/validators/methods/equality-conditional-methods.ts"],"sourcesContent":["import { equalsFieldRule, notEqualsFieldRule } from \"../../rules\";\r\nimport { equalRule } from \"../../rules/core/equal\";\r\nimport { whenRule } from \"../../rules/core/when\";\r\nimport type { WhenRuleOptions } from \"../../types\";\r\nimport { BaseValidator } from \"../base-validator\";\r\n\r\n/**\r\n * Marker re-exported by the validators barrel so the dts bundler keeps this\r\n * module (and its `declare module` augmentation) in the bundled `.d.ts`.\r\n */\r\nexport const equalityConditionalMethodsApplied = true;\r\n\r\ndeclare module \"../base-validator\" {\r\n interface BaseValidator {\r\n /**\r\n * Value must be equal to the given value\r\n */\r\n equal(value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value must be the same as another field's value\r\n */\r\n sameAs(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value must be the same as another sibling field's value\r\n */\r\n sameAsSibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value must be different from another field's value\r\n */\r\n differentFrom(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value must be different from another sibling field's value\r\n */\r\n differentFromSibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Apply different validation rules based on another field's value (global scope)\r\n *\r\n * Use this when you need to apply completely different validators\r\n * based on another field's value (not just required/optional).\r\n *\r\n * @param field - Field name to check (can be nested with dot notation)\r\n * @param options - Validation options per field value\r\n *\r\n * @example\r\n * ```ts\r\n * // Different allowed values based on user type\r\n * v.object({\r\n * userType: v.string().in(['admin', 'user']),\r\n * role: v.string().when('userType', {\r\n * is: {\r\n * admin: v.string().in(['super', 'moderator']),\r\n * user: v.string().in(['member', 'guest'])\r\n * },\r\n * otherwise: v.string().optional()\r\n * })\r\n * })\r\n *\r\n * // Different validation rules based on type\r\n * v.object({\r\n * contactType: v.string().in(['email', 'phone']),\r\n * contact: v.string().when('contactType', {\r\n * is: {\r\n * email: v.string().email(),\r\n * phone: v.string().pattern(/^\\d{10}$/)\r\n * }\r\n * })\r\n * })\r\n * ```\r\n * @category Conditional Validation\r\n */\r\n when(field: string, options: Omit<WhenRuleOptions, \"field\" | \"scope\">): this;\r\n\r\n /**\r\n * Apply different validation rules based on sibling field's value\r\n *\r\n * Use this for nested objects where you need to check a field\r\n * within the same parent object.\r\n *\r\n * @param siblingField - Sibling field name to check\r\n * @param options - Validation options per field value\r\n *\r\n * @example\r\n * ```ts\r\n * // Array of users with role-based permissions\r\n * v.array(v.object({\r\n * userType: v.string().in(['admin', 'user']),\r\n * permissions: v.string().whenSibling('userType', {\r\n * is: {\r\n * admin: v.string().in(['read', 'write', 'delete']),\r\n * user: v.string().in(['read'])\r\n * }\r\n * })\r\n * }))\r\n * ```\r\n * @category Conditional Validation\r\n */\r\n whenSibling(siblingField: string, options: Omit<WhenRuleOptions, \"field\" | \"scope\">): this;\r\n }\r\n}\r\n\r\n/**\r\n * Value must be equal to the given value\r\n */\r\nBaseValidator.prototype.equal = function (value: any, errorMessage?: string) {\r\n return this.addRule(equalRule, errorMessage, { value });\r\n};\r\n\r\n/**\r\n * Value must be the same as another field's value\r\n */\r\nBaseValidator.prototype.sameAs = function (field: string, errorMessage?: string) {\r\n return this.addRule(equalsFieldRule, errorMessage, {\r\n field,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value must be the same as another sibling field's value\r\n */\r\nBaseValidator.prototype.sameAsSibling = function (field: string, errorMessage?: string) {\r\n return this.addRule(equalsFieldRule, errorMessage, {\r\n field,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value must be different from another field's value\r\n */\r\nBaseValidator.prototype.differentFrom = function (field: string, errorMessage?: string) {\r\n return this.addRule(notEqualsFieldRule, errorMessage, {\r\n field,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value must be different from another sibling field's value\r\n */\r\nBaseValidator.prototype.differentFromSibling = function (field: string, errorMessage?: string) {\r\n return this.addRule(notEqualsFieldRule, errorMessage, {\r\n field,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Apply different validation rules based on another field's value (global scope)\r\n *\r\n * Use this when you need to apply completely different validators\r\n * based on another field's value (not just required/optional).\r\n *\r\n * @param field - Field name to check (can be nested with dot notation)\r\n * @param options - Validation options per field value\r\n *\r\n * @example\r\n * ```ts\r\n * // Different allowed values based on user type\r\n * v.object({\r\n * userType: v.string().in(['admin', 'user']),\r\n * role: v.string().when('userType', {\r\n * is: {\r\n * admin: v.string().in(['super', 'moderator']),\r\n * user: v.string().in(['member', 'guest'])\r\n * },\r\n * otherwise: v.string().optional()\r\n * })\r\n * })\r\n *\r\n * // Different validation rules based on type\r\n * v.object({\r\n * contactType: v.string().in(['email', 'phone']),\r\n * contact: v.string().when('contactType', {\r\n * is: {\r\n * email: v.string().email(),\r\n * phone: v.string().pattern(/^\\d{10}$/)\r\n * }\r\n * })\r\n * })\r\n * ```\r\n * @category Conditional Validation\r\n */\r\nBaseValidator.prototype.when = function (\r\n field: string,\r\n options: Omit<WhenRuleOptions, \"field\" | \"scope\">,\r\n) {\r\n return this.addRule(whenRule, undefined, {\r\n field,\r\n is: options.is,\r\n otherwise: options.otherwise,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Apply different validation rules based on sibling field's value\r\n *\r\n * Use this for nested objects where you need to check a field\r\n * within the same parent object.\r\n *\r\n * @param siblingField - Sibling field name to check\r\n * @param options - Validation options per field value\r\n *\r\n * @example\r\n * ```ts\r\n * // Array of users with role-based permissions\r\n * v.array(v.object({\r\n * userType: v.string().in(['admin', 'user']),\r\n * permissions: v.string().whenSibling('userType', {\r\n * is: {\r\n * admin: v.string().in(['read', 'write', 'delete']),\r\n * user: v.string().in(['read'])\r\n * }\r\n * })\r\n * }))\r\n * ```\r\n * @category Conditional Validation\r\n */\r\nBaseValidator.prototype.whenSibling = function (\r\n siblingField: string,\r\n options: Omit<WhenRuleOptions, \"field\" | \"scope\">,\r\n) {\r\n return this.addRule(whenRule, undefined, {\r\n field: siblingField,\r\n is: options.is,\r\n otherwise: options.otherwise,\r\n scope: \"sibling\",\r\n });\r\n};\r\n"],"mappings":";;;;;;;;;;AA4GA,cAAc,UAAU,QAAQ,SAAU,OAAY,cAAuB;CAC3E,OAAO,KAAK,QAAQ,WAAW,cAAc,EAAE,MAAM,CAAC;AACxD;;;;AAKA,cAAc,UAAU,SAAS,SAAU,OAAe,cAAuB;CAC/E,OAAO,KAAK,QAAQ,iBAAiB,cAAc;EACjD;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,gBAAgB,SAAU,OAAe,cAAuB;CACtF,OAAO,KAAK,QAAQ,iBAAiB,cAAc;EACjD;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,gBAAgB,SAAU,OAAe,cAAuB;CACtF,OAAO,KAAK,QAAQ,oBAAoB,cAAc;EACpD;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,uBAAuB,SAAU,OAAe,cAAuB;CAC7F,OAAO,KAAK,QAAQ,oBAAoB,cAAc;EACpD;EACA,OAAO;CACT,CAAC;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,cAAc,UAAU,OAAO,SAC7B,OACA,SACA;CACA,OAAO,KAAK,QAAQ,UAAU,QAAW;EACvC;EACA,IAAI,QAAQ;EACZ,WAAW,QAAQ;EACnB,OAAO;CACT,CAAC;AACH;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,cAAc,UAAU,cAAc,SACpC,cACA,SACA;CACA,OAAO,KAAK,QAAQ,UAAU,QAAW;EACvC,OAAO;EACP,IAAI,QAAQ;EACZ,WAAW,QAAQ;EACnB,OAAO;CACT,CAAC;AACH"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { BaseValidator } from "../base-validator.mjs";
|
|
2
|
+
import { forbiddenRule } from "../../rules/core/forbidden.mjs";
|
|
3
|
+
import { forbiddenIfEmptyRule, forbiddenIfInRule, forbiddenIfNotEmptyRule, forbiddenIfNotInRule, forbiddenIfNotRule, forbiddenIfRule } from "../../rules/conditional/forbidden-if-rules.mjs";
|
|
4
|
+
|
|
5
|
+
//#region ../seal/src/validators/methods/forbidden-methods.ts
|
|
6
|
+
/**
|
|
7
|
+
* Value is forbidden to be present
|
|
8
|
+
*/
|
|
9
|
+
BaseValidator.prototype.forbidden = function(errorMessage) {
|
|
10
|
+
return this.addRule(forbiddenRule, errorMessage);
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Value is forbidden if another field equals a specific value (global scope)
|
|
14
|
+
*/
|
|
15
|
+
BaseValidator.prototype.forbiddenIf = function(field, value, errorMessage) {
|
|
16
|
+
return this.addRule(forbiddenIfRule, errorMessage, {
|
|
17
|
+
field,
|
|
18
|
+
value,
|
|
19
|
+
scope: "global"
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Value is forbidden if another field equals a specific value (sibling scope)
|
|
24
|
+
*/
|
|
25
|
+
BaseValidator.prototype.forbiddenIfSibling = function(field, value, errorMessage) {
|
|
26
|
+
return this.addRule(forbiddenIfRule, errorMessage, {
|
|
27
|
+
field,
|
|
28
|
+
value,
|
|
29
|
+
scope: "sibling"
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Value is forbidden if another field does NOT equal a specific value (global scope)
|
|
34
|
+
*/
|
|
35
|
+
BaseValidator.prototype.forbiddenIfNot = function(field, value, errorMessage) {
|
|
36
|
+
return this.addRule(forbiddenIfNotRule, errorMessage, {
|
|
37
|
+
field,
|
|
38
|
+
value,
|
|
39
|
+
scope: "global"
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Value is forbidden if another field does NOT equal a specific value (sibling scope)
|
|
44
|
+
*/
|
|
45
|
+
BaseValidator.prototype.forbiddenIfNotSibling = function(field, value, errorMessage) {
|
|
46
|
+
return this.addRule(forbiddenIfNotRule, errorMessage, {
|
|
47
|
+
field,
|
|
48
|
+
value,
|
|
49
|
+
scope: "sibling"
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Value is forbidden if another field is empty (global scope)
|
|
54
|
+
*/
|
|
55
|
+
BaseValidator.prototype.forbiddenIfEmpty = function(field, errorMessage) {
|
|
56
|
+
return this.addRule(forbiddenIfEmptyRule, errorMessage, {
|
|
57
|
+
field,
|
|
58
|
+
scope: "global"
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Value is forbidden if another field is empty (sibling scope)
|
|
63
|
+
*/
|
|
64
|
+
BaseValidator.prototype.forbiddenIfEmptySibling = function(field, errorMessage) {
|
|
65
|
+
return this.addRule(forbiddenIfEmptyRule, errorMessage, {
|
|
66
|
+
field,
|
|
67
|
+
scope: "sibling"
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Value is forbidden if another field is not empty (global scope)
|
|
72
|
+
*/
|
|
73
|
+
BaseValidator.prototype.forbiddenIfNotEmpty = function(field, errorMessage) {
|
|
74
|
+
return this.addRule(forbiddenIfNotEmptyRule, errorMessage, {
|
|
75
|
+
field,
|
|
76
|
+
scope: "global"
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Value is forbidden if another field is not empty (sibling scope)
|
|
81
|
+
*/
|
|
82
|
+
BaseValidator.prototype.forbiddenIfNotEmptySibling = function(field, errorMessage) {
|
|
83
|
+
return this.addRule(forbiddenIfNotEmptyRule, errorMessage, {
|
|
84
|
+
field,
|
|
85
|
+
scope: "sibling"
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Value is forbidden if another field's value is in the given array (global scope)
|
|
90
|
+
*/
|
|
91
|
+
BaseValidator.prototype.forbiddenIfIn = function(field, values, errorMessage) {
|
|
92
|
+
return this.addRule(forbiddenIfInRule, errorMessage, {
|
|
93
|
+
field,
|
|
94
|
+
values,
|
|
95
|
+
scope: "global"
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Value is forbidden if another field's value is in the given array (sibling scope)
|
|
100
|
+
*/
|
|
101
|
+
BaseValidator.prototype.forbiddenIfInSibling = function(field, values, errorMessage) {
|
|
102
|
+
return this.addRule(forbiddenIfInRule, errorMessage, {
|
|
103
|
+
field,
|
|
104
|
+
values,
|
|
105
|
+
scope: "sibling"
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Value is forbidden if another field's value is NOT in the given array (global scope)
|
|
110
|
+
*/
|
|
111
|
+
BaseValidator.prototype.forbiddenIfNotIn = function(field, values, errorMessage) {
|
|
112
|
+
return this.addRule(forbiddenIfNotInRule, errorMessage, {
|
|
113
|
+
field,
|
|
114
|
+
values,
|
|
115
|
+
scope: "global"
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Value is forbidden if another field's value is NOT in the given array (sibling scope)
|
|
120
|
+
*/
|
|
121
|
+
BaseValidator.prototype.forbiddenIfNotInSibling = function(field, values, errorMessage) {
|
|
122
|
+
return this.addRule(forbiddenIfNotInRule, errorMessage, {
|
|
123
|
+
field,
|
|
124
|
+
values,
|
|
125
|
+
scope: "sibling"
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
//#endregion
|
|
130
|
+
export { };
|
|
131
|
+
//# sourceMappingURL=forbidden-methods.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forbidden-methods.mjs","names":[],"sources":["../../../../../../../../../../seal/src/validators/methods/forbidden-methods.ts"],"sourcesContent":["import {\r\n forbiddenIfEmptyRule,\r\n forbiddenIfInRule,\r\n forbiddenIfNotEmptyRule,\r\n forbiddenIfNotInRule,\r\n forbiddenIfNotRule,\r\n forbiddenIfRule,\r\n} from \"../../rules/conditional/forbidden-if-rules\";\r\nimport { forbiddenRule } from \"../../rules/core/forbidden\";\r\nimport { BaseValidator } from \"../base-validator\";\r\n\r\n/**\r\n * Marker re-exported by the validators barrel so the dts bundler keeps this\r\n * module (and its `declare module` augmentation) in the bundled `.d.ts`.\r\n */\r\nexport const forbiddenMethodsApplied = true;\r\n\r\ndeclare module \"../base-validator\" {\r\n interface BaseValidator {\r\n /**\r\n * Value is forbidden to be present\r\n */\r\n forbidden(errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field equals a specific value (global scope)\r\n */\r\n forbiddenIf(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field equals a specific value (sibling scope)\r\n */\r\n forbiddenIfSibling(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field does NOT equal a specific value (global scope)\r\n */\r\n forbiddenIfNot(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field does NOT equal a specific value (sibling scope)\r\n */\r\n forbiddenIfNotSibling(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field is empty (global scope)\r\n */\r\n forbiddenIfEmpty(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field is empty (sibling scope)\r\n */\r\n forbiddenIfEmptySibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field is not empty (global scope)\r\n */\r\n forbiddenIfNotEmpty(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field is not empty (sibling scope)\r\n */\r\n forbiddenIfNotEmptySibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field's value is in the given array (global scope)\r\n */\r\n forbiddenIfIn(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field's value is in the given array (sibling scope)\r\n */\r\n forbiddenIfInSibling(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field's value is NOT in the given array (global scope)\r\n */\r\n forbiddenIfNotIn(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is forbidden if another field's value is NOT in the given array (sibling scope)\r\n */\r\n forbiddenIfNotInSibling(field: string, values: any[], errorMessage?: string): this;\r\n }\r\n}\r\n\r\n/**\r\n * Value is forbidden to be present\r\n */\r\nBaseValidator.prototype.forbidden = function (errorMessage?: string) {\r\n return this.addRule(forbiddenRule, errorMessage);\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field equals a specific value (global scope)\r\n */\r\nBaseValidator.prototype.forbiddenIf = function (field: string, value: any, errorMessage?: string) {\r\n return this.addRule(forbiddenIfRule, errorMessage, {\r\n field,\r\n value,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field equals a specific value (sibling scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfSibling = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfRule, errorMessage, {\r\n field,\r\n value,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field does NOT equal a specific value (global scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfNot = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfNotRule, errorMessage, {\r\n field,\r\n value,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field does NOT equal a specific value (sibling scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfNotSibling = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfNotRule, errorMessage, {\r\n field,\r\n value,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field is empty (global scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfEmpty = function (field: string, errorMessage?: string) {\r\n return this.addRule(forbiddenIfEmptyRule, errorMessage, {\r\n field,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field is empty (sibling scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfEmptySibling = function (field: string, errorMessage?: string) {\r\n return this.addRule(forbiddenIfEmptyRule, errorMessage, {\r\n field,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field is not empty (global scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfNotEmpty = function (field: string, errorMessage?: string) {\r\n return this.addRule(forbiddenIfNotEmptyRule, errorMessage, {\r\n field,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field is not empty (sibling scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfNotEmptySibling = function (\r\n field: string,\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfNotEmptyRule, errorMessage, {\r\n field,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field's value is in the given array (global scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfIn = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field's value is in the given array (sibling scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfInSibling = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field's value is NOT in the given array (global scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfNotIn = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfNotInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is forbidden if another field's value is NOT in the given array (sibling scope)\r\n */\r\nBaseValidator.prototype.forbiddenIfNotInSibling = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.addRule(forbiddenIfNotInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"sibling\",\r\n });\r\n};\r\n"],"mappings":";;;;;;;;AAyFA,cAAc,UAAU,YAAY,SAAU,cAAuB;CACnE,OAAO,KAAK,QAAQ,eAAe,YAAY;AACjD;;;;AAKA,cAAc,UAAU,cAAc,SAAU,OAAe,OAAY,cAAuB;CAChG,OAAO,KAAK,QAAQ,iBAAiB,cAAc;EACjD;EACA;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,qBAAqB,SAC3C,OACA,OACA,cACA;CACA,OAAO,KAAK,QAAQ,iBAAiB,cAAc;EACjD;EACA;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,iBAAiB,SACvC,OACA,OACA,cACA;CACA,OAAO,KAAK,QAAQ,oBAAoB,cAAc;EACpD;EACA;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,wBAAwB,SAC9C,OACA,OACA,cACA;CACA,OAAO,KAAK,QAAQ,oBAAoB,cAAc;EACpD;EACA;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,mBAAmB,SAAU,OAAe,cAAuB;CACzF,OAAO,KAAK,QAAQ,sBAAsB,cAAc;EACtD;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,0BAA0B,SAAU,OAAe,cAAuB;CAChG,OAAO,KAAK,QAAQ,sBAAsB,cAAc;EACtD;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,sBAAsB,SAAU,OAAe,cAAuB;CAC5F,OAAO,KAAK,QAAQ,yBAAyB,cAAc;EACzD;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,6BAA6B,SACnD,OACA,cACA;CACA,OAAO,KAAK,QAAQ,yBAAyB,cAAc;EACzD;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,gBAAgB,SACtC,OACA,QACA,cACA;CACA,OAAO,KAAK,QAAQ,mBAAmB,cAAc;EACnD;EACA;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,uBAAuB,SAC7C,OACA,QACA,cACA;CACA,OAAO,KAAK,QAAQ,mBAAmB,cAAc;EACnD;EACA;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,mBAAmB,SACzC,OACA,QACA,cACA;CACA,OAAO,KAAK,QAAQ,sBAAsB,cAAc;EACtD;EACA;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,0BAA0B,SAChD,OACA,QACA,cACA;CACA,OAAO,KAAK,QAAQ,sBAAsB,cAAc;EACtD;EACA;EACA,OAAO;CACT,CAAC;AACH"}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { BaseValidator } from "../base-validator.mjs";
|
|
2
|
+
import { presentIfEmptyRule, presentIfInRule, presentIfNotEmptyRule, presentIfNotInRule, presentIfRule } from "../../rules/conditional/present-if-rules.mjs";
|
|
3
|
+
import { presentUnlessRule } from "../../rules/conditional/present-unless-rules.mjs";
|
|
4
|
+
import { presentWithAllRule, presentWithAnyRule, presentWithRule } from "../../rules/conditional/present-with-rules.mjs";
|
|
5
|
+
import { presentWithoutAllRule, presentWithoutAnyRule, presentWithoutRule } from "../../rules/conditional/present-without-rules.mjs";
|
|
6
|
+
|
|
7
|
+
//#region ../seal/src/validators/methods/present-methods.ts
|
|
8
|
+
/**
|
|
9
|
+
* Field must be present if another field exists
|
|
10
|
+
*/
|
|
11
|
+
BaseValidator.prototype.presentWith = function(field, errorMessage) {
|
|
12
|
+
return this.addRule(presentWithRule, errorMessage, {
|
|
13
|
+
field,
|
|
14
|
+
scope: "global"
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Field must be present if another sibling field exists
|
|
19
|
+
*/
|
|
20
|
+
BaseValidator.prototype.presentWithSibling = function(field, errorMessage) {
|
|
21
|
+
return this.addRule(presentWithRule, errorMessage, {
|
|
22
|
+
field,
|
|
23
|
+
scope: "sibling"
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Field must be present if another field is missing
|
|
28
|
+
*/
|
|
29
|
+
BaseValidator.prototype.presentWithout = function(field, errorMessage) {
|
|
30
|
+
return this.addRule(presentWithoutRule, errorMessage, {
|
|
31
|
+
field,
|
|
32
|
+
scope: "global"
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Field must be present if another sibling field is missing
|
|
37
|
+
*/
|
|
38
|
+
BaseValidator.prototype.presentWithoutSibling = function(field, errorMessage) {
|
|
39
|
+
return this.addRule(presentWithoutRule, errorMessage, {
|
|
40
|
+
field,
|
|
41
|
+
scope: "sibling"
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Field must be present if another field equals a specific value
|
|
46
|
+
*/
|
|
47
|
+
BaseValidator.prototype.presentIf = function(field, value, errorMessage) {
|
|
48
|
+
return this.addRule(presentIfRule, errorMessage, {
|
|
49
|
+
field,
|
|
50
|
+
value,
|
|
51
|
+
scope: "global"
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Field must be present if another sibling field equals a specific value
|
|
56
|
+
*/
|
|
57
|
+
BaseValidator.prototype.presentIfSibling = function(field, value, errorMessage) {
|
|
58
|
+
return this.addRule(presentIfRule, errorMessage, {
|
|
59
|
+
field,
|
|
60
|
+
value,
|
|
61
|
+
scope: "sibling"
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Field must be present unless another field equals a specific value
|
|
66
|
+
*/
|
|
67
|
+
BaseValidator.prototype.presentUnless = function(field, value, errorMessage) {
|
|
68
|
+
return this.addRule(presentUnlessRule, errorMessage, {
|
|
69
|
+
field,
|
|
70
|
+
value,
|
|
71
|
+
scope: "global"
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Field must be present unless another sibling field equals a specific value
|
|
76
|
+
*/
|
|
77
|
+
BaseValidator.prototype.presentUnlessSibling = function(field, value, errorMessage) {
|
|
78
|
+
return this.addRule(presentUnlessRule, errorMessage, {
|
|
79
|
+
field,
|
|
80
|
+
value,
|
|
81
|
+
scope: "sibling"
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Field must be present if another field is empty
|
|
86
|
+
*/
|
|
87
|
+
BaseValidator.prototype.presentIfEmpty = function(field, errorMessage) {
|
|
88
|
+
return this.addRule(presentIfEmptyRule, errorMessage, {
|
|
89
|
+
field,
|
|
90
|
+
scope: "global"
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Field must be present if another sibling field is empty
|
|
95
|
+
*/
|
|
96
|
+
BaseValidator.prototype.presentIfEmptySibling = function(field, errorMessage) {
|
|
97
|
+
return this.addRule(presentIfEmptyRule, errorMessage, {
|
|
98
|
+
field,
|
|
99
|
+
scope: "sibling"
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Field must be present if another field is not empty
|
|
104
|
+
*/
|
|
105
|
+
BaseValidator.prototype.presentIfNotEmpty = function(field, errorMessage) {
|
|
106
|
+
return this.addRule(presentIfNotEmptyRule, errorMessage, {
|
|
107
|
+
field,
|
|
108
|
+
scope: "global"
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Field must be present if another sibling field is not empty
|
|
113
|
+
*/
|
|
114
|
+
BaseValidator.prototype.presentIfNotEmptySibling = function(field, errorMessage) {
|
|
115
|
+
return this.addRule(presentIfNotEmptyRule, errorMessage, {
|
|
116
|
+
field,
|
|
117
|
+
scope: "sibling"
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Field must be present if another field's value is in the given array
|
|
122
|
+
*/
|
|
123
|
+
BaseValidator.prototype.presentIfIn = function(field, values, errorMessage) {
|
|
124
|
+
return this.addRule(presentIfInRule, errorMessage, {
|
|
125
|
+
field,
|
|
126
|
+
values,
|
|
127
|
+
scope: "global"
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Field must be present if another sibling field's value is in the given array
|
|
132
|
+
*/
|
|
133
|
+
BaseValidator.prototype.presentIfInSibling = function(field, values, errorMessage) {
|
|
134
|
+
return this.addRule(presentIfInRule, errorMessage, {
|
|
135
|
+
field,
|
|
136
|
+
values,
|
|
137
|
+
scope: "sibling"
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Field must be present if another field's value is NOT in the given array
|
|
142
|
+
*/
|
|
143
|
+
BaseValidator.prototype.presentIfNotIn = function(field, values, errorMessage) {
|
|
144
|
+
return this.addRule(presentIfNotInRule, errorMessage, {
|
|
145
|
+
field,
|
|
146
|
+
values,
|
|
147
|
+
scope: "global"
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Field must be present if another sibling field's value is NOT in the given array
|
|
152
|
+
*/
|
|
153
|
+
BaseValidator.prototype.presentIfNotInSibling = function(field, values, errorMessage) {
|
|
154
|
+
return this.addRule(presentIfNotInRule, errorMessage, {
|
|
155
|
+
field,
|
|
156
|
+
values,
|
|
157
|
+
scope: "sibling"
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* Field must be present if all specified fields exist
|
|
162
|
+
*/
|
|
163
|
+
BaseValidator.prototype.presentWithAll = function(fields, errorMessage) {
|
|
164
|
+
return this.addRule(presentWithAllRule, errorMessage, {
|
|
165
|
+
fields,
|
|
166
|
+
scope: "global"
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* Field must be present if all specified sibling fields exist
|
|
171
|
+
*/
|
|
172
|
+
BaseValidator.prototype.presentWithAllSiblings = function(fields, errorMessage) {
|
|
173
|
+
return this.addRule(presentWithAllRule, errorMessage, {
|
|
174
|
+
fields,
|
|
175
|
+
scope: "sibling"
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* Field must be present if all specified fields are missing
|
|
180
|
+
*/
|
|
181
|
+
BaseValidator.prototype.presentWithoutAll = function(fields, errorMessage) {
|
|
182
|
+
return this.addRule(presentWithoutAllRule, errorMessage, {
|
|
183
|
+
fields,
|
|
184
|
+
scope: "global"
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* Field must be present if all specified sibling fields are missing
|
|
189
|
+
*/
|
|
190
|
+
BaseValidator.prototype.presentWithoutAllSiblings = function(fields, errorMessage) {
|
|
191
|
+
return this.addRule(presentWithoutAllRule, errorMessage, {
|
|
192
|
+
fields,
|
|
193
|
+
scope: "sibling"
|
|
194
|
+
});
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* Field must be present if any of the specified fields exists
|
|
198
|
+
*/
|
|
199
|
+
BaseValidator.prototype.presentWithAny = function(fields, errorMessage) {
|
|
200
|
+
return this.addRule(presentWithAnyRule, errorMessage, {
|
|
201
|
+
fields,
|
|
202
|
+
scope: "global"
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* Field must be present if any of the specified sibling fields exists
|
|
207
|
+
*/
|
|
208
|
+
BaseValidator.prototype.presentWithAnySiblings = function(fields, errorMessage) {
|
|
209
|
+
return this.addRule(presentWithAnyRule, errorMessage, {
|
|
210
|
+
fields,
|
|
211
|
+
scope: "sibling"
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Field must be present if any of the specified fields is missing
|
|
216
|
+
*/
|
|
217
|
+
BaseValidator.prototype.presentWithoutAny = function(fields, errorMessage) {
|
|
218
|
+
return this.addRule(presentWithoutAnyRule, errorMessage, {
|
|
219
|
+
fields,
|
|
220
|
+
scope: "global"
|
|
221
|
+
});
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* Field must be present if any of the specified sibling fields is missing
|
|
225
|
+
*/
|
|
226
|
+
BaseValidator.prototype.presentWithoutAnySiblings = function(fields, errorMessage) {
|
|
227
|
+
return this.addRule(presentWithoutAnyRule, errorMessage, {
|
|
228
|
+
fields,
|
|
229
|
+
scope: "sibling"
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
//#endregion
|
|
234
|
+
export { };
|
|
235
|
+
//# sourceMappingURL=present-methods.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,mBAAmB,SACzC,OACA,OACA,cACA;CACA,OAAO,KAAK,QAAQ,eAAe,cAAc;EAC/C;EACA;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,gBAAgB,SACtC,OACA,OACA,cACA;CACA,OAAO,KAAK,QAAQ,mBAAmB,cAAc;EACnD;EACA;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,uBAAuB,SAC7C,OACA,OACA,cACA;CACA,OAAO,KAAK,QAAQ,mBAAmB,cAAc;EACnD;EACA;EACA,OAAO;CACT,CAAC;AACH;;;;AAOA,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;;;;AAKA,cAAc,UAAU,oBAAoB,SAAU,OAAe,cAAuB;CAC1F,OAAO,KAAK,QAAQ,uBAAuB,cAAc;EACvD;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,2BAA2B,SAAU,OAAe,cAAuB;CACjG,OAAO,KAAK,QAAQ,uBAAuB,cAAc;EACvD;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,cAAc,SACpC,OACA,QACA,cACA;CACA,OAAO,KAAK,QAAQ,iBAAiB,cAAc;EACjD;EACA;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,qBAAqB,SAC3C,OACA,QACA,cACA;CACA,OAAO,KAAK,QAAQ,iBAAiB,cAAc;EACjD;EACA;EACA,OAAO;CACT,CAAC;AACH;;;;AAKA,cAAc,UAAU,iBAAiB,SACvC,OACA,QACA,cACA;CACA,OAAO,KAAK,QAAQ,oBAAoB,cAAc;EACpD;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"}
|