@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,639 @@
|
|
|
1
|
+
import { __toESM } from "../../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { applyNullable, getRuleOptions } from "../standard-schema/json-schema.mjs";
|
|
3
|
+
import { isDateValue } from "../helpers/date-helpers.mjs";
|
|
4
|
+
import { BaseValidator } from "./base-validator.mjs";
|
|
5
|
+
import { require_dayjs_min } from "../../../node_modules/dayjs/dayjs.min.mjs";
|
|
6
|
+
import { addDaysMutator, addHoursMutator, addMonthsMutator, addYearsMutator, dateMutator, toEndOfDayMutator, toEndOfMonthMutator, toEndOfYearMutator, toStartOfDayMutator, toStartOfMonthMutator, toStartOfYearMutator, toUTCMutator } from "../mutators/date-mutators.mjs";
|
|
7
|
+
import "../mutators/index.mjs";
|
|
8
|
+
import { ageRule, beforeHourRule, beforeMinuteRule, beforeTodayRule, betweenHoursRule, betweenMinutesRule, dateRule, fromHourRule, fromMinuteRule, fromTodayRule, maxAgeRule, maxDateRule, minAgeRule, minDateRule, weekDayRule } from "../rules/date/date.mjs";
|
|
9
|
+
import { afterTodayRule, betweenDatesRule, futureRule, pastRule, todayRule } from "../rules/date/date-comparison-rules.mjs";
|
|
10
|
+
import { businessDayRule, weekdaysRule, weekendRule } from "../rules/date/date-day-rules.mjs";
|
|
11
|
+
import { afterFieldRule, beforeFieldRule, sameAsFieldDateRule } from "../rules/date/date-field-comparison-rules.mjs";
|
|
12
|
+
import { betweenDaysRule, betweenMonthsRule, betweenTimesRule, betweenYearsRule, maxDayRule, maxMonthRule, maxYearRule, minDayRule, minMonthRule, minYearRule, monthRule, quarterRule, yearRule } from "../rules/date/date-period-rules.mjs";
|
|
13
|
+
import { withinDaysRule, withinFutureDaysRule, withinPastDaysRule } from "../rules/date/date-relative-rules.mjs";
|
|
14
|
+
import { betweenAgeRule, birthdayRule, leapYearRule } from "../rules/date/date-special-rules.mjs";
|
|
15
|
+
import "../rules/index.mjs";
|
|
16
|
+
|
|
17
|
+
//#region ../seal/src/validators/date-validator.ts
|
|
18
|
+
var import_dayjs_min = /* @__PURE__ */ __toESM(require_dayjs_min(), 1);
|
|
19
|
+
/**
|
|
20
|
+
* Date validator class
|
|
21
|
+
*/
|
|
22
|
+
var DateValidator = class extends BaseValidator {
|
|
23
|
+
constructor(errorMessage) {
|
|
24
|
+
super();
|
|
25
|
+
this.addMutableMutator(dateMutator);
|
|
26
|
+
this.addMutableRule(dateRule, errorMessage);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Check if value is a Date type
|
|
30
|
+
*/
|
|
31
|
+
matchesType(value) {
|
|
32
|
+
return isDateValue(value);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Convert date to ISO string format
|
|
36
|
+
* @category transformer
|
|
37
|
+
*/
|
|
38
|
+
toISOString() {
|
|
39
|
+
return this.addTransformer((data) => data instanceof Date ? data.toISOString() : data);
|
|
40
|
+
}
|
|
41
|
+
/** Convert date to Unix timestamp (milliseconds) */
|
|
42
|
+
toTimestamp() {
|
|
43
|
+
return this.addTransformer((data) => data instanceof Date ? data.getTime() : data);
|
|
44
|
+
}
|
|
45
|
+
/** Convert date to specific format using dayjs */
|
|
46
|
+
toFormat(format) {
|
|
47
|
+
return this.addTransformer((data, { options }) => data instanceof Date ? (0, import_dayjs_min.default)(data).format(options.format) : data, { format });
|
|
48
|
+
}
|
|
49
|
+
/** Convert to date only (remove time, returns YYYY-MM-DD) */
|
|
50
|
+
toDateOnly() {
|
|
51
|
+
return this.addTransformer((data) => data instanceof Date ? (0, import_dayjs_min.default)(data).format("YYYY-MM-DD") : data, { __jsonSchemaFormat: "date" });
|
|
52
|
+
}
|
|
53
|
+
/** Convert to time only (returns HH:MM:SS) */
|
|
54
|
+
toTimeOnly() {
|
|
55
|
+
return this.addTransformer((data) => data instanceof Date ? (0, import_dayjs_min.default)(data).format("HH:mm:ss") : data, { __jsonSchemaFormat: "time" });
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Convert date to start of day (00:00:00)
|
|
59
|
+
* @category mutator
|
|
60
|
+
*/
|
|
61
|
+
toStartOfDay() {
|
|
62
|
+
return this.addMutator(toStartOfDayMutator);
|
|
63
|
+
}
|
|
64
|
+
/** Convert date to end of day (23:59:59.999) */
|
|
65
|
+
toEndOfDay() {
|
|
66
|
+
return this.addMutator(toEndOfDayMutator);
|
|
67
|
+
}
|
|
68
|
+
/** Add or subtract days from date */
|
|
69
|
+
addDays(days) {
|
|
70
|
+
return this.addMutator(addDaysMutator, { days });
|
|
71
|
+
}
|
|
72
|
+
/** Add or subtract months from date */
|
|
73
|
+
addMonths(months) {
|
|
74
|
+
return this.addMutator(addMonthsMutator, { months });
|
|
75
|
+
}
|
|
76
|
+
/** Add or subtract years from date */
|
|
77
|
+
addYears(years) {
|
|
78
|
+
return this.addMutator(addYearsMutator, { years });
|
|
79
|
+
}
|
|
80
|
+
/** Add or subtract hours from date */
|
|
81
|
+
addHours(hours) {
|
|
82
|
+
return this.addMutator(addHoursMutator, { hours });
|
|
83
|
+
}
|
|
84
|
+
/** Convert date to UTC */
|
|
85
|
+
toUTC() {
|
|
86
|
+
return this.addMutator(toUTCMutator);
|
|
87
|
+
}
|
|
88
|
+
/** Set to start of month */
|
|
89
|
+
toStartOfMonth() {
|
|
90
|
+
return this.addMutator(toStartOfMonthMutator);
|
|
91
|
+
}
|
|
92
|
+
/** Set to end of month */
|
|
93
|
+
toEndOfMonth() {
|
|
94
|
+
return this.addMutator(toEndOfMonthMutator);
|
|
95
|
+
}
|
|
96
|
+
/** Set to start of year */
|
|
97
|
+
toStartOfYear() {
|
|
98
|
+
return this.addMutator(toStartOfYearMutator);
|
|
99
|
+
}
|
|
100
|
+
/** Set to end of year */
|
|
101
|
+
toEndOfYear() {
|
|
102
|
+
return this.addMutator(toEndOfYearMutator);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Date must be greater than or equal to the given date or field (inclusive)
|
|
106
|
+
*
|
|
107
|
+
* Smart detection:
|
|
108
|
+
* - Date instance, timestamp, or date string (with - or /) → value comparison
|
|
109
|
+
* - Plain string → field comparison
|
|
110
|
+
*
|
|
111
|
+
* @param dateOrField - Date, timestamp, date string, or field name
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* // Value comparison
|
|
116
|
+
* v.date().min('2024-01-01')
|
|
117
|
+
* v.date().min(new Date())
|
|
118
|
+
* v.date().min(1698278400000)
|
|
119
|
+
*
|
|
120
|
+
* // Field comparison
|
|
121
|
+
* v.date().min('startsAt')
|
|
122
|
+
* ```
|
|
123
|
+
*
|
|
124
|
+
* @category Validation Rule
|
|
125
|
+
*/
|
|
126
|
+
min(dateOrField, errorMessage) {
|
|
127
|
+
return this.addRule(minDateRule, errorMessage, {
|
|
128
|
+
dateOrField,
|
|
129
|
+
scope: "global"
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Date must be less than or equal to the given date or field (inclusive)
|
|
134
|
+
*
|
|
135
|
+
* Smart detection:
|
|
136
|
+
* - Date instance, timestamp, or date string (with - or /) → value comparison
|
|
137
|
+
* - Plain string → field comparison
|
|
138
|
+
*
|
|
139
|
+
* @category Validation Rule
|
|
140
|
+
*/
|
|
141
|
+
max(dateOrField, errorMessage) {
|
|
142
|
+
return this.addRule(maxDateRule, errorMessage, {
|
|
143
|
+
dateOrField,
|
|
144
|
+
scope: "global"
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Date must be strictly less than the given date or field (exclusive)
|
|
149
|
+
*
|
|
150
|
+
* Smart detection:
|
|
151
|
+
* - Date instance, timestamp, or date string (with - or /) → value comparison
|
|
152
|
+
* - Plain string → field comparison
|
|
153
|
+
*
|
|
154
|
+
* @category Validation Rule
|
|
155
|
+
*/
|
|
156
|
+
before(dateOrField, errorMessage) {
|
|
157
|
+
return this.addRule(beforeFieldRule, errorMessage, {
|
|
158
|
+
dateOrField,
|
|
159
|
+
scope: "global"
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Date must be strictly greater than the given date or field (exclusive)
|
|
164
|
+
*
|
|
165
|
+
* Smart detection:
|
|
166
|
+
* - Date instance, timestamp, or date string (with - or /) → value comparison
|
|
167
|
+
* - Plain string → field comparison
|
|
168
|
+
*
|
|
169
|
+
* @category Validation Rule
|
|
170
|
+
*/
|
|
171
|
+
after(dateOrField, errorMessage) {
|
|
172
|
+
return this.addRule(afterFieldRule, errorMessage, {
|
|
173
|
+
dateOrField,
|
|
174
|
+
scope: "global"
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
/** Date must be between start and end dates */
|
|
178
|
+
between(startDate, endDate, errorMessage) {
|
|
179
|
+
return this.addRule(betweenDatesRule, errorMessage, {
|
|
180
|
+
startDate,
|
|
181
|
+
endDate
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
/** Date must be exactly today */
|
|
185
|
+
today(errorMessage) {
|
|
186
|
+
return this.addRule(todayRule, errorMessage);
|
|
187
|
+
}
|
|
188
|
+
/** Date must be today or in the future */
|
|
189
|
+
fromToday(errorMessage) {
|
|
190
|
+
return this.addRule(fromTodayRule, errorMessage);
|
|
191
|
+
}
|
|
192
|
+
/** Date must be before today */
|
|
193
|
+
beforeToday(errorMessage) {
|
|
194
|
+
return this.addRule(beforeTodayRule, errorMessage);
|
|
195
|
+
}
|
|
196
|
+
/** Date must be after today (not including today) */
|
|
197
|
+
afterToday(errorMessage) {
|
|
198
|
+
return this.addRule(afterTodayRule, errorMessage);
|
|
199
|
+
}
|
|
200
|
+
/** Date must be in the past */
|
|
201
|
+
past(errorMessage) {
|
|
202
|
+
return this.addRule(pastRule, errorMessage);
|
|
203
|
+
}
|
|
204
|
+
/** Date must be in the future */
|
|
205
|
+
future(errorMessage) {
|
|
206
|
+
return this.addRule(futureRule, errorMessage);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Date must be >= sibling field value (inclusive)
|
|
210
|
+
* @category Validation Rule
|
|
211
|
+
*/
|
|
212
|
+
minSibling(field, errorMessage) {
|
|
213
|
+
return this.addRule(minDateRule, errorMessage, {
|
|
214
|
+
dateOrField: field,
|
|
215
|
+
scope: "sibling"
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Date must be <= sibling field value (inclusive)
|
|
220
|
+
* @category Validation Rule
|
|
221
|
+
*/
|
|
222
|
+
maxSibling(field, errorMessage) {
|
|
223
|
+
return this.addRule(maxDateRule, errorMessage, {
|
|
224
|
+
dateOrField: field,
|
|
225
|
+
scope: "sibling"
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Date must be < sibling field value (exclusive)
|
|
230
|
+
* @category Validation Rule
|
|
231
|
+
*/
|
|
232
|
+
beforeSibling(field, errorMessage) {
|
|
233
|
+
return this.addRule(beforeFieldRule, errorMessage, {
|
|
234
|
+
dateOrField: field,
|
|
235
|
+
scope: "sibling"
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Date must be > sibling field value (exclusive)
|
|
240
|
+
* @category Validation Rule
|
|
241
|
+
*/
|
|
242
|
+
afterSibling(field, errorMessage) {
|
|
243
|
+
return this.addRule(afterFieldRule, errorMessage, {
|
|
244
|
+
dateOrField: field,
|
|
245
|
+
scope: "sibling"
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
/** Date must be the same as another field's date */
|
|
249
|
+
sameAsField(field, errorMessage) {
|
|
250
|
+
return this.addRule(sameAsFieldDateRule, errorMessage, {
|
|
251
|
+
field,
|
|
252
|
+
scope: "global"
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
/** Date must be the same as another sibling field's date */
|
|
256
|
+
sameAsFieldSibling(field, errorMessage) {
|
|
257
|
+
return this.addRule(sameAsFieldDateRule, errorMessage, {
|
|
258
|
+
field,
|
|
259
|
+
scope: "sibling"
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
/** Time must be from specific hour onwards (0-23) */
|
|
263
|
+
fromHour(hour, errorMessage) {
|
|
264
|
+
return this.addRule(fromHourRule, errorMessage, { hour });
|
|
265
|
+
}
|
|
266
|
+
/** Time must be before specific hour (0-23) */
|
|
267
|
+
beforeHour(hour, errorMessage) {
|
|
268
|
+
return this.addRule(beforeHourRule, errorMessage, { hour });
|
|
269
|
+
}
|
|
270
|
+
/** Time must be between start and end hours (0-23) */
|
|
271
|
+
betweenHours(startHour, endHour, errorMessage) {
|
|
272
|
+
return this.addRule(betweenHoursRule, errorMessage, {
|
|
273
|
+
startHour,
|
|
274
|
+
endHour
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
/** Time must be from specific minute onwards (0-59) */
|
|
278
|
+
fromMinute(minute, errorMessage) {
|
|
279
|
+
return this.addRule(fromMinuteRule, errorMessage, { minute });
|
|
280
|
+
}
|
|
281
|
+
/** Time must be before specific minute (0-59) */
|
|
282
|
+
beforeMinute(minute, errorMessage) {
|
|
283
|
+
return this.addRule(beforeMinuteRule, errorMessage, { minute });
|
|
284
|
+
}
|
|
285
|
+
/** Time must be between start and end minutes (0-59) */
|
|
286
|
+
betweenMinutes(startMinute, endMinute, errorMessage) {
|
|
287
|
+
return this.addRule(betweenMinutesRule, errorMessage, {
|
|
288
|
+
startMinute,
|
|
289
|
+
endMinute
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
/** Time must be between start and end times (HH:MM format) */
|
|
293
|
+
betweenTimes(startTime, endTime, errorMessage) {
|
|
294
|
+
return this.addRule(betweenTimesRule, errorMessage, {
|
|
295
|
+
startTime,
|
|
296
|
+
endTime
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
/** Age must be exactly the given years */
|
|
300
|
+
age(years, errorMessage) {
|
|
301
|
+
return this.addRule(ageRule, errorMessage, { years });
|
|
302
|
+
}
|
|
303
|
+
/** Minimum age requirement */
|
|
304
|
+
minAge(years, errorMessage) {
|
|
305
|
+
return this.addRule(minAgeRule, errorMessage, { years });
|
|
306
|
+
}
|
|
307
|
+
/** Maximum age requirement */
|
|
308
|
+
maxAge(years, errorMessage) {
|
|
309
|
+
return this.addRule(maxAgeRule, errorMessage, { years });
|
|
310
|
+
}
|
|
311
|
+
/** Age must be between min and max years */
|
|
312
|
+
betweenAge(minAge, maxAge, errorMessage) {
|
|
313
|
+
return this.addRule(betweenAgeRule, errorMessage, {
|
|
314
|
+
minAge,
|
|
315
|
+
maxAge
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
/** Date must be specific weekday */
|
|
319
|
+
weekDay(day, errorMessage) {
|
|
320
|
+
return this.addRule(weekDayRule, errorMessage, { day });
|
|
321
|
+
}
|
|
322
|
+
/** Date must be one of specified weekdays */
|
|
323
|
+
weekdays(days, errorMessage) {
|
|
324
|
+
return this.addRule(weekdaysRule, errorMessage, { days });
|
|
325
|
+
}
|
|
326
|
+
/** Date must be a weekend (Saturday or Sunday) */
|
|
327
|
+
weekend(errorMessage) {
|
|
328
|
+
return this.addRule(weekendRule, errorMessage);
|
|
329
|
+
}
|
|
330
|
+
/** Date must be a business day (Monday-Friday) */
|
|
331
|
+
businessDay(errorMessage) {
|
|
332
|
+
return this.addRule(businessDayRule, errorMessage);
|
|
333
|
+
}
|
|
334
|
+
/** Date must match specific format */
|
|
335
|
+
format(format, errorMessage) {
|
|
336
|
+
return this.addRule(dateRule, errorMessage, { format });
|
|
337
|
+
}
|
|
338
|
+
/** Date must be within X days from now (past or future) */
|
|
339
|
+
withinDays(days, errorMessage) {
|
|
340
|
+
return this.addRule(withinDaysRule, errorMessage, { days });
|
|
341
|
+
}
|
|
342
|
+
/** Date must be within X days in the past */
|
|
343
|
+
withinPastDays(days, errorMessage) {
|
|
344
|
+
return this.addRule(withinPastDaysRule, errorMessage, { days });
|
|
345
|
+
}
|
|
346
|
+
/** Date must be within X days in the future */
|
|
347
|
+
withinFutureDays(days, errorMessage) {
|
|
348
|
+
return this.addRule(withinFutureDaysRule, errorMessage, { days });
|
|
349
|
+
}
|
|
350
|
+
/** Date must be in specific month (1-12) */
|
|
351
|
+
month(month, errorMessage) {
|
|
352
|
+
return this.addRule(monthRule, errorMessage, { month });
|
|
353
|
+
}
|
|
354
|
+
/** Date must be in specific year */
|
|
355
|
+
year(year, errorMessage) {
|
|
356
|
+
return this.addRule(yearRule, errorMessage, { year });
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Date must be between start and end years
|
|
360
|
+
* Smart detection: number or field name
|
|
361
|
+
*
|
|
362
|
+
* @category Validation Rule
|
|
363
|
+
*/
|
|
364
|
+
betweenYears(startYear, endYear, errorMessage) {
|
|
365
|
+
return this.addRule(betweenYearsRule, errorMessage, {
|
|
366
|
+
startYear,
|
|
367
|
+
endYear,
|
|
368
|
+
scope: "global"
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Date must be between start and end months (1-12)
|
|
373
|
+
* Smart detection: number or field name
|
|
374
|
+
*
|
|
375
|
+
* @category Validation Rule
|
|
376
|
+
*/
|
|
377
|
+
betweenMonths(startMonth, endMonth, errorMessage) {
|
|
378
|
+
return this.addRule(betweenMonthsRule, errorMessage, {
|
|
379
|
+
startMonth,
|
|
380
|
+
endMonth,
|
|
381
|
+
scope: "global"
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Date must be between start and end days (1-31)
|
|
386
|
+
* Smart detection: number or field name
|
|
387
|
+
*
|
|
388
|
+
* @category Validation Rule
|
|
389
|
+
*/
|
|
390
|
+
betweenDays(startDay, endDay, errorMessage) {
|
|
391
|
+
return this.addRule(betweenDaysRule, errorMessage, {
|
|
392
|
+
startDay,
|
|
393
|
+
endDay,
|
|
394
|
+
scope: "global"
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Date must be between sibling field years
|
|
399
|
+
* @category Validation Rule
|
|
400
|
+
*/
|
|
401
|
+
betweenYearsSibling(startYearField, endYearField, errorMessage) {
|
|
402
|
+
return this.addRule(betweenYearsRule, errorMessage, {
|
|
403
|
+
startYear: startYearField,
|
|
404
|
+
endYear: endYearField,
|
|
405
|
+
scope: "sibling"
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Date must be between sibling field months
|
|
410
|
+
* @category Validation Rule
|
|
411
|
+
*/
|
|
412
|
+
betweenMonthsSibling(startMonthField, endMonthField, errorMessage) {
|
|
413
|
+
return this.addRule(betweenMonthsRule, errorMessage, {
|
|
414
|
+
startMonth: startMonthField,
|
|
415
|
+
endMonth: endMonthField,
|
|
416
|
+
scope: "sibling"
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Date must be between sibling field days
|
|
421
|
+
* @category Validation Rule
|
|
422
|
+
*/
|
|
423
|
+
betweenDaysSibling(startDayField, endDayField, errorMessage) {
|
|
424
|
+
return this.addRule(betweenDaysRule, errorMessage, {
|
|
425
|
+
startDay: startDayField,
|
|
426
|
+
endDay: endDayField,
|
|
427
|
+
scope: "sibling"
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Year must be >= given year or field
|
|
432
|
+
* Smart detection: number or field name
|
|
433
|
+
*
|
|
434
|
+
* @example
|
|
435
|
+
* ```ts
|
|
436
|
+
* // Value comparison
|
|
437
|
+
* v.date().minYear(2024)
|
|
438
|
+
*
|
|
439
|
+
* // Field comparison
|
|
440
|
+
* v.date().minYear('startYear')
|
|
441
|
+
* ```
|
|
442
|
+
*
|
|
443
|
+
* @category Validation Rule
|
|
444
|
+
*/
|
|
445
|
+
minYear(yearOrField, errorMessage) {
|
|
446
|
+
return this.addRule(minYearRule, errorMessage, {
|
|
447
|
+
yearOrField,
|
|
448
|
+
scope: "global"
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Year must be <= given year or field
|
|
453
|
+
* Smart detection: number or field name
|
|
454
|
+
*
|
|
455
|
+
* @category Validation Rule
|
|
456
|
+
*/
|
|
457
|
+
maxYear(yearOrField, errorMessage) {
|
|
458
|
+
return this.addRule(maxYearRule, errorMessage, {
|
|
459
|
+
yearOrField,
|
|
460
|
+
scope: "global"
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Month must be >= given month or field (1-12)
|
|
465
|
+
* Smart detection: number or field name
|
|
466
|
+
*
|
|
467
|
+
* @category Validation Rule
|
|
468
|
+
*/
|
|
469
|
+
minMonth(monthOrField, errorMessage) {
|
|
470
|
+
return this.addRule(minMonthRule, errorMessage, {
|
|
471
|
+
monthOrField,
|
|
472
|
+
scope: "global"
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Month must be <= given month or field (1-12)
|
|
477
|
+
* Smart detection: number or field name
|
|
478
|
+
*
|
|
479
|
+
* @category Validation Rule
|
|
480
|
+
*/
|
|
481
|
+
maxMonth(monthOrField, errorMessage) {
|
|
482
|
+
return this.addRule(maxMonthRule, errorMessage, {
|
|
483
|
+
monthOrField,
|
|
484
|
+
scope: "global"
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Day must be >= given day or field (1-31)
|
|
489
|
+
* Smart detection: number or field name
|
|
490
|
+
*
|
|
491
|
+
* @category Validation Rule
|
|
492
|
+
*/
|
|
493
|
+
minDay(dayOrField, errorMessage) {
|
|
494
|
+
return this.addRule(minDayRule, errorMessage, {
|
|
495
|
+
dayOrField,
|
|
496
|
+
scope: "global"
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Day must be <= given day or field (1-31)
|
|
501
|
+
* Smart detection: number or field name
|
|
502
|
+
*
|
|
503
|
+
* @category Validation Rule
|
|
504
|
+
*/
|
|
505
|
+
maxDay(dayOrField, errorMessage) {
|
|
506
|
+
return this.addRule(maxDayRule, errorMessage, {
|
|
507
|
+
dayOrField,
|
|
508
|
+
scope: "global"
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Year must be >= sibling field year
|
|
513
|
+
* @category Validation Rule
|
|
514
|
+
*/
|
|
515
|
+
minYearSibling(field, errorMessage) {
|
|
516
|
+
return this.addRule(minYearRule, errorMessage, {
|
|
517
|
+
yearOrField: field,
|
|
518
|
+
scope: "sibling"
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Year must be <= sibling field year
|
|
523
|
+
* @category Validation Rule
|
|
524
|
+
*/
|
|
525
|
+
maxYearSibling(field, errorMessage) {
|
|
526
|
+
return this.addRule(maxYearRule, errorMessage, {
|
|
527
|
+
yearOrField: field,
|
|
528
|
+
scope: "sibling"
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Month must be >= sibling field month
|
|
533
|
+
* @category Validation Rule
|
|
534
|
+
*/
|
|
535
|
+
minMonthSibling(field, errorMessage) {
|
|
536
|
+
return this.addRule(minMonthRule, errorMessage, {
|
|
537
|
+
monthOrField: field,
|
|
538
|
+
scope: "sibling"
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Month must be <= sibling field month
|
|
543
|
+
* @category Validation Rule
|
|
544
|
+
*/
|
|
545
|
+
maxMonthSibling(field, errorMessage) {
|
|
546
|
+
return this.addRule(maxMonthRule, errorMessage, {
|
|
547
|
+
monthOrField: field,
|
|
548
|
+
scope: "sibling"
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Day must be >= sibling field day
|
|
553
|
+
* @category Validation Rule
|
|
554
|
+
*/
|
|
555
|
+
minDaySibling(field, errorMessage) {
|
|
556
|
+
return this.addRule(minDayRule, errorMessage, {
|
|
557
|
+
dayOrField: field,
|
|
558
|
+
scope: "sibling"
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Day must be <= sibling field day
|
|
563
|
+
* @category Validation Rule
|
|
564
|
+
*/
|
|
565
|
+
maxDaySibling(field, errorMessage) {
|
|
566
|
+
return this.addRule(maxDayRule, errorMessage, {
|
|
567
|
+
dayOrField: field,
|
|
568
|
+
scope: "sibling"
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
/** Date must be in specific quarter (1-4) */
|
|
572
|
+
quarter(quarter, errorMessage) {
|
|
573
|
+
return this.addRule(quarterRule, errorMessage, { quarter });
|
|
574
|
+
}
|
|
575
|
+
/** Valid birthday (not in future, reasonable age) */
|
|
576
|
+
birthday(minAge, maxAge, errorMessage) {
|
|
577
|
+
return this.addRule(birthdayRule, errorMessage, {
|
|
578
|
+
minAge,
|
|
579
|
+
maxAge
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
/** Date must be in a leap year */
|
|
583
|
+
leapYear(errorMessage) {
|
|
584
|
+
return this.addRule(leapYearRule, errorMessage);
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* Set default value as current time of exeuction
|
|
588
|
+
*/
|
|
589
|
+
defaultNow() {
|
|
590
|
+
return this.default(() => /* @__PURE__ */ new Date());
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* @inheritdoc
|
|
594
|
+
*
|
|
595
|
+
* Maps DateValidator to JSON Schema format keywords.
|
|
596
|
+
* Default is `date-time`. If `.toDateOnly()` or `.toTimeOnly()` are used,
|
|
597
|
+
* falls back to `date` or `time` formats respectively.
|
|
598
|
+
*
|
|
599
|
+
* @example
|
|
600
|
+
* ```ts
|
|
601
|
+
* v.date().toJsonSchema("draft-2020-12")
|
|
602
|
+
* // → { type: "string", format: "date-time" }
|
|
603
|
+
*
|
|
604
|
+
* v.date().toDateOnly().toJsonSchema("draft-2020-12")
|
|
605
|
+
* // → { type: "string", format: "date" }
|
|
606
|
+
* ```
|
|
607
|
+
*/
|
|
608
|
+
toJsonSchema(target = "draft-2020-12") {
|
|
609
|
+
const schema = {
|
|
610
|
+
type: "string",
|
|
611
|
+
format: "date-time"
|
|
612
|
+
};
|
|
613
|
+
const dateOpts = getRuleOptions(this.rules, "date");
|
|
614
|
+
if (dateOpts?.format === "YYYY-MM-DD") schema.format = "date";
|
|
615
|
+
else if (dateOpts?.format === "HH:mm:ss") schema.format = "time";
|
|
616
|
+
if (schema.format === "date-time") for (const t of this.dataTransformers) {
|
|
617
|
+
const hint = t.options?.__jsonSchemaFormat;
|
|
618
|
+
if (hint === "date" || hint === "time") {
|
|
619
|
+
schema.format = hint;
|
|
620
|
+
break;
|
|
621
|
+
}
|
|
622
|
+
const userFormat = t.options?.format;
|
|
623
|
+
if (userFormat === "YYYY-MM-DD") {
|
|
624
|
+
schema.format = "date";
|
|
625
|
+
break;
|
|
626
|
+
}
|
|
627
|
+
if (userFormat === "HH:mm:ss") {
|
|
628
|
+
schema.format = "time";
|
|
629
|
+
break;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
if (this.isNullable) applyNullable(schema, target);
|
|
633
|
+
return schema;
|
|
634
|
+
}
|
|
635
|
+
};
|
|
636
|
+
|
|
637
|
+
//#endregion
|
|
638
|
+
export { DateValidator };
|
|
639
|
+
//# sourceMappingURL=date-validator.mjs.map
|