@warlock.js/notifications 4.15.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -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 +34 -4
- 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/base-notifications-repository.d.mts +15 -1
- package/esm/in-app/base-notifications-repository.d.mts.map +1 -1
- package/esm/in-app/base-notifications-repository.mjs +33 -3
- package/esm/in-app/base-notifications-repository.mjs.map +1 -1
- 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/llms-full.txt +5 -1
- package/package.json +5 -5
- package/skills/send-ad-hoc/SKILL.md +1 -1
- package/skills/use-in-app/SKILL.md +4 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { get } from "../../../../node_modules/@mongez/reinforcements/esm/object/get.mjs";
|
|
2
|
+
import "../../../../node_modules/@mongez/reinforcements/esm/index.mjs";
|
|
3
|
+
import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
|
|
4
|
+
import "../../helpers/index.mjs";
|
|
5
|
+
|
|
6
|
+
//#region ../seal/src/rules/core/when.ts
|
|
7
|
+
/**
|
|
8
|
+
* When rule - conditional validation based on another field value
|
|
9
|
+
*/
|
|
10
|
+
const whenRule = {
|
|
11
|
+
name: "when",
|
|
12
|
+
description: "Apply conditional validation based on another field value",
|
|
13
|
+
async validate(value, context) {
|
|
14
|
+
const fieldToCheck = this.context.options.field;
|
|
15
|
+
const conditions = this.context.options.is;
|
|
16
|
+
const otherwise = this.context.options.otherwise;
|
|
17
|
+
const fieldValue = (this.context.options.scope || "global") === "global" ? get(context.allValues, fieldToCheck) : get(context.parent, fieldToCheck);
|
|
18
|
+
const fieldValueKey = String(fieldValue);
|
|
19
|
+
if (conditions[fieldValueKey]) {
|
|
20
|
+
const result = await conditions[fieldValueKey].validate(value, context);
|
|
21
|
+
if (result.isValid) return VALID_RULE;
|
|
22
|
+
this.context.errorMessage = result.errors?.[0]?.error || "Validation failed";
|
|
23
|
+
return invalidRule(this, context);
|
|
24
|
+
}
|
|
25
|
+
if (otherwise) {
|
|
26
|
+
const result = await otherwise.validate(value, context);
|
|
27
|
+
if (result.isValid) return VALID_RULE;
|
|
28
|
+
this.context.errorMessage = result.errors?.[0]?.error || "Validation failed";
|
|
29
|
+
return invalidRule(this, context);
|
|
30
|
+
}
|
|
31
|
+
return VALID_RULE;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { whenRule };
|
|
37
|
+
//# sourceMappingURL=when.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"when.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/core/when.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule, WhenRuleOptions } from \"../../types\";\r\n\r\n/**\r\n * When rule - conditional validation based on another field value\r\n */\r\nexport const whenRule: SchemaRule<WhenRuleOptions> = {\r\n name: \"when\",\r\n description: \"Apply conditional validation based on another field value\",\r\n async validate(value: any, context) {\r\n const fieldToCheck = this.context.options.field;\r\n const conditions = this.context.options.is;\r\n const otherwise = this.context.options.otherwise;\r\n const scope = this.context.options.scope || \"global\";\r\n\r\n const fieldValue =\r\n scope === \"global\"\r\n ? get(context.allValues, fieldToCheck)\r\n : get(context.parent, fieldToCheck);\r\n\r\n // Convert field value to string for key lookup\r\n // This handles boolean, number, and string field values\r\n const fieldValueKey = String(fieldValue);\r\n\r\n if (conditions[fieldValueKey]) {\r\n const result = await conditions[fieldValueKey].validate(value, context);\r\n if (result.isValid) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Safe error access\r\n this.context.errorMessage =\r\n result.errors?.[0]?.error || \"Validation failed\";\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (otherwise) {\r\n const result = await otherwise.validate(value, context);\r\n\r\n if (result.isValid) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Safe error access\r\n this.context.errorMessage =\r\n result.errors?.[0]?.error || \"Validation failed\";\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n"],"mappings":";;;;;;;;;AAOA,MAAa,WAAwC;CACnD,MAAM;CACN,aAAa;CACb,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,eAAe,KAAK,QAAQ,QAAQ;EAC1C,MAAM,aAAa,KAAK,QAAQ,QAAQ;EACxC,MAAM,YAAY,KAAK,QAAQ,QAAQ;EAGvC,MAAM,cAFQ,KAAK,QAAQ,QAAQ,SAAS,cAGhC,WACN,IAAI,QAAQ,WAAW,YAAY,IACnC,IAAI,QAAQ,QAAQ,YAAY;EAItC,MAAM,gBAAgB,OAAO,UAAU;EAEvC,IAAI,WAAW,gBAAgB;GAC7B,MAAM,SAAS,MAAM,WAAW,cAAc,CAAC,SAAS,OAAO,OAAO;GACtE,IAAI,OAAO,SACT,OAAO;GAIT,KAAK,QAAQ,eACX,OAAO,SAAS,EAAE,EAAE,SAAS;GAC/B,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,IAAI,WAAW;GACb,MAAM,SAAS,MAAM,UAAU,SAAS,OAAO,OAAO;GAEtD,IAAI,OAAO,SACT,OAAO;GAIT,KAAK,QAAQ,eACX,OAAO,SAAS,EAAE,EAAE,SAAS;GAC/B,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
|
|
2
|
+
import "../../helpers/index.mjs";
|
|
3
|
+
|
|
4
|
+
//#region ../seal/src/rules/date/date-comparison-rules.ts
|
|
5
|
+
/**
|
|
6
|
+
* Between dates rule - date must be between start and end dates
|
|
7
|
+
*/
|
|
8
|
+
const betweenDatesRule = {
|
|
9
|
+
name: "betweenDates",
|
|
10
|
+
defaultErrorMessage: "The :input must be between :startDate and :endDate",
|
|
11
|
+
async validate(value, context) {
|
|
12
|
+
const { startDate, endDate } = this.context.options;
|
|
13
|
+
const inputDate = new Date(value);
|
|
14
|
+
if (inputDate >= startDate && inputDate <= endDate) {
|
|
15
|
+
this.context.translationParams.startDate = startDate.toISOString();
|
|
16
|
+
this.context.translationParams.endDate = endDate.toISOString();
|
|
17
|
+
return VALID_RULE;
|
|
18
|
+
}
|
|
19
|
+
return invalidRule(this, context);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Today rule - date must be exactly today
|
|
24
|
+
*/
|
|
25
|
+
const todayRule = {
|
|
26
|
+
name: "today",
|
|
27
|
+
defaultErrorMessage: "The :input must be today",
|
|
28
|
+
async validate(value, context) {
|
|
29
|
+
const today = /* @__PURE__ */ new Date();
|
|
30
|
+
today.setHours(0, 0, 0, 0);
|
|
31
|
+
const inputDate = new Date(value);
|
|
32
|
+
inputDate.setHours(0, 0, 0, 0);
|
|
33
|
+
if (inputDate.getTime() === today.getTime()) return VALID_RULE;
|
|
34
|
+
return invalidRule(this, context);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Past rule - date must be in the past
|
|
39
|
+
*/
|
|
40
|
+
const pastRule = {
|
|
41
|
+
name: "past",
|
|
42
|
+
defaultErrorMessage: "The :input must be in the past",
|
|
43
|
+
async validate(value, context) {
|
|
44
|
+
const now = /* @__PURE__ */ new Date();
|
|
45
|
+
if (new Date(value) < now) return VALID_RULE;
|
|
46
|
+
return invalidRule(this, context);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Future rule - date must be in the future
|
|
51
|
+
*/
|
|
52
|
+
const futureRule = {
|
|
53
|
+
name: "future",
|
|
54
|
+
defaultErrorMessage: "The :input must be in the future",
|
|
55
|
+
async validate(value, context) {
|
|
56
|
+
if (value > /* @__PURE__ */ new Date()) return VALID_RULE;
|
|
57
|
+
return invalidRule(this, context);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* After today rule - date must be after today (not including today)
|
|
62
|
+
*/
|
|
63
|
+
const afterTodayRule = {
|
|
64
|
+
name: "afterToday",
|
|
65
|
+
defaultErrorMessage: "The :input must be after today",
|
|
66
|
+
async validate(value, context) {
|
|
67
|
+
const today = /* @__PURE__ */ new Date();
|
|
68
|
+
today.setHours(0, 0, 0, 0);
|
|
69
|
+
const inputDate = new Date(value);
|
|
70
|
+
inputDate.setHours(0, 0, 0, 0);
|
|
71
|
+
if (inputDate > today) return VALID_RULE;
|
|
72
|
+
return invalidRule(this, context);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
export { afterTodayRule, betweenDatesRule, futureRule, pastRule, todayRule };
|
|
78
|
+
//# sourceMappingURL=date-comparison-rules.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-comparison-rules.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/date/date-comparison-rules.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Between dates rule - date must be between start and end dates\r\n */\r\nexport const betweenDatesRule: SchemaRule<{\r\n startDate: Date;\r\n endDate: Date;\r\n}> = {\r\n name: \"betweenDates\",\r\n defaultErrorMessage: \"The :input must be between :startDate and :endDate\",\r\n async validate(value: Date, context) {\r\n const { startDate, endDate } = this.context.options;\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate >= startDate && inputDate <= endDate) {\r\n this.context.translationParams.startDate = startDate.toISOString();\r\n this.context.translationParams.endDate = endDate.toISOString();\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Today rule - date must be exactly today\r\n */\r\nexport const todayRule: SchemaRule = {\r\n name: \"today\",\r\n defaultErrorMessage: \"The :input must be today\",\r\n async validate(value: Date, context) {\r\n const today = new Date();\r\n today.setHours(0, 0, 0, 0);\r\n const inputDate = new Date(value);\r\n inputDate.setHours(0, 0, 0, 0);\r\n\r\n if (inputDate.getTime() === today.getTime()) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Past rule - date must be in the past\r\n */\r\nexport const pastRule: SchemaRule = {\r\n name: \"past\",\r\n defaultErrorMessage: \"The :input must be in the past\",\r\n async validate(value: Date, context) {\r\n const now = new Date();\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate < now) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Future rule - date must be in the future\r\n */\r\nexport const futureRule: SchemaRule = {\r\n name: \"future\",\r\n defaultErrorMessage: \"The :input must be in the future\",\r\n async validate(value: Date, context) {\r\n const now = new Date();\r\n\r\n if (value > now) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * After today rule - date must be after today (not including today)\r\n */\r\nexport const afterTodayRule: SchemaRule = {\r\n name: \"afterToday\",\r\n defaultErrorMessage: \"The :input must be after today\",\r\n async validate(value: Date, context) {\r\n const today = new Date();\r\n today.setHours(0, 0, 0, 0);\r\n const inputDate = new Date(value);\r\n inputDate.setHours(0, 0, 0, 0);\r\n\r\n if (inputDate > today) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAMA,MAAa,mBAGR;CACH,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,EAAE,WAAW,YAAY,KAAK,QAAQ;EAC5C,MAAM,YAAY,IAAI,KAAK,KAAK;EAEhC,IAAI,aAAa,aAAa,aAAa,SAAS;GAClD,KAAK,QAAQ,kBAAkB,YAAY,UAAU,YAAY;GACjE,KAAK,QAAQ,kBAAkB,UAAU,QAAQ,YAAY;GAC7D,OAAO;EACT;EAEA,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,YAAwB;CACnC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,wBAAQ,IAAI,KAAK;EACvB,MAAM,SAAS,GAAG,GAAG,GAAG,CAAC;EACzB,MAAM,YAAY,IAAI,KAAK,KAAK;EAChC,UAAU,SAAS,GAAG,GAAG,GAAG,CAAC;EAE7B,IAAI,UAAU,QAAQ,MAAM,MAAM,QAAQ,GACxC,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,WAAuB;CAClC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,sBAAM,IAAI,KAAK;EAGrB,IAAI,IAFkB,KAAK,KAEf,IAAI,KACd,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,aAAyB;CACpC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAGnC,IAAI,wBAAQ,IAFI,KAEF,GACZ,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,iBAA6B;CACxC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,wBAAQ,IAAI,KAAK;EACvB,MAAM,SAAS,GAAG,GAAG,GAAG,CAAC;EACzB,MAAM,YAAY,IAAI,KAAK,KAAK;EAChC,UAAU,SAAS,GAAG,GAAG,GAAG,CAAC;EAE7B,IAAI,YAAY,OACd,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
|
|
2
|
+
import "../../helpers/index.mjs";
|
|
3
|
+
import { WEEK_DAYS } from "../../types/date-types.mjs";
|
|
4
|
+
|
|
5
|
+
//#region ../seal/src/rules/date/date-day-rules.ts
|
|
6
|
+
/**
|
|
7
|
+
* Weekend rule - date must be Saturday or Sunday
|
|
8
|
+
*/
|
|
9
|
+
const weekendRule = {
|
|
10
|
+
name: "weekend",
|
|
11
|
+
defaultErrorMessage: "The :input must be a weekend (Saturday or Sunday)",
|
|
12
|
+
async validate(value, context) {
|
|
13
|
+
const dayOfWeek = new Date(value).getDay();
|
|
14
|
+
if (dayOfWeek === 0 || dayOfWeek === 6) return VALID_RULE;
|
|
15
|
+
return invalidRule(this, context);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Weekdays rule - date must be one of specified weekdays
|
|
20
|
+
*/
|
|
21
|
+
const weekdaysRule = {
|
|
22
|
+
name: "weekdays",
|
|
23
|
+
defaultErrorMessage: "The :input must be one of: :days",
|
|
24
|
+
async validate(value, context) {
|
|
25
|
+
const dayOfWeek = new Date(value).getDay();
|
|
26
|
+
const { days } = this.context.options;
|
|
27
|
+
if (days.map((day) => WEEK_DAYS[day]).includes(dayOfWeek)) return VALID_RULE;
|
|
28
|
+
days.forEach((day) => {
|
|
29
|
+
this.context.translatableParams[day] = day;
|
|
30
|
+
});
|
|
31
|
+
return invalidRule(this, context);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Business day rule - date must be Monday-Friday (no weekends)
|
|
36
|
+
*/
|
|
37
|
+
const businessDayRule = {
|
|
38
|
+
name: "businessDay",
|
|
39
|
+
defaultErrorMessage: "The :input must be a business day",
|
|
40
|
+
async validate(value, context) {
|
|
41
|
+
const dayOfWeek = new Date(value).getDay();
|
|
42
|
+
if (dayOfWeek >= 1 && dayOfWeek <= 5) return VALID_RULE;
|
|
43
|
+
return invalidRule(this, context);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { businessDayRule, weekdaysRule, weekendRule };
|
|
49
|
+
//# sourceMappingURL=date-day-rules.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-day-rules.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/date/date-day-rules.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport type { WeekDay } from \"../../types/date-types\";\r\nimport { WEEK_DAYS } from \"../../types/date-types\";\r\n\r\n/**\r\n * Weekend rule - date must be Saturday or Sunday\r\n */\r\nexport const weekendRule: SchemaRule = {\r\n name: \"weekend\",\r\n defaultErrorMessage: \"The :input must be a weekend (Saturday or Sunday)\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n\r\n // 0 = Sunday, 6 = Saturday\r\n if (dayOfWeek === 0 || dayOfWeek === 6) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Weekday rule - date must be Monday through Friday\r\n */\r\nexport const weekdayRule: SchemaRule = {\r\n name: \"weekday\",\r\n defaultErrorMessage: \"The :input must be a weekday (Monday-Friday)\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n\r\n // 1-5 = Monday-Friday\r\n if (dayOfWeek >= 1 && dayOfWeek <= 5) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Weekdays rule - date must be one of specified weekdays\r\n */\r\nexport const weekdaysRule: SchemaRule<{ days: WeekDay[] }> = {\r\n name: \"weekdays\",\r\n defaultErrorMessage: \"The :input must be one of: :days\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n const { days } = this.context.options;\r\n\r\n const allowedDays = days.map((day) => WEEK_DAYS[day]);\r\n\r\n if (allowedDays.includes(dayOfWeek)) {\r\n return VALID_RULE;\r\n }\r\n\r\n days.forEach((day) => {\r\n this.context.translatableParams[day] = day;\r\n });\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Business day rule - date must be Monday-Friday (no weekends)\r\n */\r\nexport const businessDayRule: SchemaRule = {\r\n name: \"businessDay\",\r\n defaultErrorMessage: \"The :input must be a business day\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n\r\n // 1-5 = Monday-Friday\r\n if (dayOfWeek >= 1 && dayOfWeek <= 5) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;;AAQA,MAAa,cAA0B;CACrC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAEnC,MAAM,YAAY,IADI,KAAK,KACD,CAAC,CAAC,OAAO;EAGnC,IAAI,cAAc,KAAK,cAAc,GACnC,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAwBA,MAAa,eAAgD;CAC3D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAEnC,MAAM,YAAY,IADI,KAAK,KACD,CAAC,CAAC,OAAO;EACnC,MAAM,EAAE,SAAS,KAAK,QAAQ;EAI9B,IAFoB,KAAK,KAAK,QAAQ,UAAU,IAElC,CAAC,CAAC,SAAS,SAAS,GAChC,OAAO;EAGT,KAAK,SAAS,QAAQ;GACpB,KAAK,QAAQ,mBAAmB,OAAO;EACzC,CAAC;EAED,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,kBAA8B;CACzC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAEnC,MAAM,YAAY,IADI,KAAK,KACD,CAAC,CAAC,OAAO;EAGnC,IAAI,aAAa,KAAK,aAAa,GACjC,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { get } from "../../../../node_modules/@mongez/reinforcements/esm/object/get.mjs";
|
|
2
|
+
import "../../../../node_modules/@mongez/reinforcements/esm/index.mjs";
|
|
3
|
+
import { isDateValue } from "../../helpers/date-helpers.mjs";
|
|
4
|
+
import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
|
|
5
|
+
import "../../helpers/index.mjs";
|
|
6
|
+
|
|
7
|
+
//#region ../seal/src/rules/date/date-field-comparison-rules.ts
|
|
8
|
+
/**
|
|
9
|
+
* Before field rule - date must be < given date or field
|
|
10
|
+
* Smart detection: date value or field name
|
|
11
|
+
* Supports both global and sibling scope
|
|
12
|
+
*/
|
|
13
|
+
const beforeFieldRule = {
|
|
14
|
+
name: "beforeField",
|
|
15
|
+
description: "The date must be before the given date or field",
|
|
16
|
+
defaultErrorMessage: "The :input must be before :dateOrField",
|
|
17
|
+
async validate(value, context) {
|
|
18
|
+
const { dateOrField, scope = "global" } = this.context.options;
|
|
19
|
+
let compareDate;
|
|
20
|
+
if (isDateValue(dateOrField)) compareDate = new Date(dateOrField);
|
|
21
|
+
else {
|
|
22
|
+
const fieldValue = get(scope === "sibling" ? context.parent : context.allValues, dateOrField);
|
|
23
|
+
if (fieldValue === void 0) return VALID_RULE;
|
|
24
|
+
compareDate = new Date(fieldValue);
|
|
25
|
+
}
|
|
26
|
+
if (new Date(value) < compareDate) return VALID_RULE;
|
|
27
|
+
return invalidRule(this, context);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* After field rule - date must be > given date or field
|
|
32
|
+
* Smart detection: date value or field name
|
|
33
|
+
* Supports both global and sibling scope
|
|
34
|
+
*/
|
|
35
|
+
const afterFieldRule = {
|
|
36
|
+
name: "afterField",
|
|
37
|
+
description: "The date must be after the given date or field",
|
|
38
|
+
defaultErrorMessage: "The :input must be after :dateOrField",
|
|
39
|
+
async validate(value, context) {
|
|
40
|
+
const { dateOrField, scope = "global" } = this.context.options;
|
|
41
|
+
let compareDate;
|
|
42
|
+
if (isDateValue(dateOrField)) {
|
|
43
|
+
compareDate = new Date(dateOrField);
|
|
44
|
+
this.context.translationParams.dateOrField = compareDate.toISOString();
|
|
45
|
+
} else {
|
|
46
|
+
const fieldValue = get(scope === "sibling" ? context.parent : context.allValues, dateOrField);
|
|
47
|
+
if (fieldValue === void 0) return VALID_RULE;
|
|
48
|
+
compareDate = new Date(fieldValue);
|
|
49
|
+
this.context.translatableParams.dateOrField = fieldValue;
|
|
50
|
+
}
|
|
51
|
+
if (new Date(value) > compareDate) return VALID_RULE;
|
|
52
|
+
return invalidRule(this, context);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Same as field rule - date must be the same as another field's date
|
|
57
|
+
* Supports both global and sibling scope
|
|
58
|
+
*/
|
|
59
|
+
const sameAsFieldDateRule = {
|
|
60
|
+
name: "sameAsFieldDate",
|
|
61
|
+
description: "The date must be the same as another field's date",
|
|
62
|
+
defaultErrorMessage: "The :input must be the same as :field",
|
|
63
|
+
async validate(value, context) {
|
|
64
|
+
const { field, scope = "global" } = this.context.options;
|
|
65
|
+
const fieldValue = get(scope === "sibling" ? context.parent : context.allValues, field);
|
|
66
|
+
if (fieldValue === void 0 || value === void 0) {
|
|
67
|
+
this.context.translatableParams.field = fieldValue;
|
|
68
|
+
return invalidRule(this, context);
|
|
69
|
+
}
|
|
70
|
+
const inputDate = new Date(value);
|
|
71
|
+
inputDate.setHours(0, 0, 0, 0);
|
|
72
|
+
const compareDate = new Date(fieldValue);
|
|
73
|
+
compareDate.setHours(0, 0, 0, 0);
|
|
74
|
+
if (inputDate.getTime() === compareDate.getTime()) return VALID_RULE;
|
|
75
|
+
this.context.translatableParams.field = fieldValue;
|
|
76
|
+
return invalidRule(this, context);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
export { afterFieldRule, beforeFieldRule, sameAsFieldDateRule };
|
|
82
|
+
//# sourceMappingURL=date-field-comparison-rules.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-field-comparison-rules.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/date/date-field-comparison-rules.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isDateValue } from \"../../helpers/date-helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Before field rule - date must be < given date or field\r\n * Smart detection: date value or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const beforeFieldRule: SchemaRule<{\r\n dateOrField: Date | string | number;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"beforeField\",\r\n description: \"The date must be before the given date or field\",\r\n defaultErrorMessage: \"The :input must be before :dateOrField\",\r\n async validate(value: Date, context) {\r\n const { dateOrField, scope = \"global\" } = this.context.options;\r\n let compareDate: Date;\r\n\r\n if (isDateValue(dateOrField)) {\r\n // Value comparison\r\n compareDate = new Date(dateOrField);\r\n } else {\r\n // Field comparison\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dateOrField as string);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n compareDate = new Date(fieldValue);\r\n }\r\n\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate < compareDate) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * After field rule - date must be > given date or field\r\n * Smart detection: date value or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const afterFieldRule: SchemaRule<{\r\n dateOrField: Date | string | number;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"afterField\",\r\n description: \"The date must be after the given date or field\",\r\n defaultErrorMessage: \"The :input must be after :dateOrField\",\r\n async validate(value: Date, context) {\r\n const { dateOrField, scope = \"global\" } = this.context.options;\r\n let compareDate: Date;\r\n\r\n if (isDateValue(dateOrField)) {\r\n // Value comparison\r\n compareDate = new Date(dateOrField);\r\n this.context.translationParams.dateOrField = compareDate.toISOString();\r\n } else {\r\n // Field comparison\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dateOrField as string);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n compareDate = new Date(fieldValue);\r\n this.context.translatableParams.dateOrField = fieldValue;\r\n }\r\n\r\n const inputDate = new Date(value);\r\n\r\n if (inputDate > compareDate) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Same as field rule - date must be the same as another field's date\r\n * Supports both global and sibling scope\r\n */\r\nexport const sameAsFieldDateRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"sameAsFieldDate\",\r\n description: \"The date must be the same as another field's date\",\r\n defaultErrorMessage: \"The :input must be the same as :field\",\r\n async validate(value: Date, context) {\r\n const { field, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, field);\r\n\r\n // Both fields must exist to be considered \"the same\"\r\n if (fieldValue === undefined || value === undefined) {\r\n this.context.translatableParams.field = fieldValue;\r\n return invalidRule(this, context);\r\n }\r\n\r\n const inputDate = new Date(value);\r\n inputDate.setHours(0, 0, 0, 0);\r\n const compareDate = new Date(fieldValue);\r\n compareDate.setHours(0, 0, 0, 0);\r\n\r\n if (inputDate.getTime() === compareDate.getTime()) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.field = fieldValue;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;;;;;;AAUA,MAAa,kBAGR;CACH,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,EAAE,aAAa,QAAQ,aAAa,KAAK,QAAQ;EACvD,IAAI;EAEJ,IAAI,YAAY,WAAW,GAEzB,cAAc,IAAI,KAAK,WAAW;OAC7B;GAGL,MAAM,aAAa,IADJ,UAAU,YAAY,QAAQ,SAAS,QAAQ,WAC/B,WAAqB;GAEpD,IAAI,eAAe,QACjB,OAAO;GAGT,cAAc,IAAI,KAAK,UAAU;EACnC;EAIA,IAAI,IAFkB,KAAK,KAEf,IAAI,aACd,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;;AAOA,MAAa,iBAGR;CACH,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,EAAE,aAAa,QAAQ,aAAa,KAAK,QAAQ;EACvD,IAAI;EAEJ,IAAI,YAAY,WAAW,GAAG;GAE5B,cAAc,IAAI,KAAK,WAAW;GAClC,KAAK,QAAQ,kBAAkB,cAAc,YAAY,YAAY;EACvE,OAAO;GAGL,MAAM,aAAa,IADJ,UAAU,YAAY,QAAQ,SAAS,QAAQ,WAC/B,WAAqB;GAEpD,IAAI,eAAe,QACjB,OAAO;GAGT,cAAc,IAAI,KAAK,UAAU;GACjC,KAAK,QAAQ,mBAAmB,cAAc;EAChD;EAIA,IAAI,IAFkB,KAAK,KAEf,IAAI,aACd,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;AAMA,MAAa,sBAGR;CACH,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,EAAE,OAAO,QAAQ,aAAa,KAAK,QAAQ;EAEjD,MAAM,aAAa,IADJ,UAAU,YAAY,QAAQ,SAAS,QAAQ,WAC/B,KAAK;EAGpC,IAAI,eAAe,UAAa,UAAU,QAAW;GACnD,KAAK,QAAQ,mBAAmB,QAAQ;GACxC,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,MAAM,YAAY,IAAI,KAAK,KAAK;EAChC,UAAU,SAAS,GAAG,GAAG,GAAG,CAAC;EAC7B,MAAM,cAAc,IAAI,KAAK,UAAU;EACvC,YAAY,SAAS,GAAG,GAAG,GAAG,CAAC;EAE/B,IAAI,UAAU,QAAQ,MAAM,YAAY,QAAQ,GAC9C,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAAQ;EACxC,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
|