@warlock.js/notifications 4.16.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 +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,32 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
|
|
3
|
+
//#region \0rolldown/runtime.js
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
14
|
+
key = keys[i];
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
16
|
+
__defProp(to, key, {
|
|
17
|
+
get: ((k) => from[k]).bind(null, key),
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: true
|
|
28
|
+
}) : target, mod));
|
|
29
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { __commonJSMin, __require, __toESM };
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { Broker } from "./broker.mjs";
|
|
2
|
+
import { EventEmitter } from "node:events";
|
|
3
|
+
|
|
4
|
+
//#region ../herald/src/communicators/broker-registry.ts
|
|
5
|
+
/**
|
|
6
|
+
* Error thrown when a broker is not found
|
|
7
|
+
*/
|
|
8
|
+
var MissingBrokerError = class extends Error {
|
|
9
|
+
brokerName;
|
|
10
|
+
constructor(message, brokerName) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = "MissingBrokerError";
|
|
13
|
+
this.brokerName = brokerName;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Broker Registry
|
|
18
|
+
*
|
|
19
|
+
* Maintains registry of named brokers.
|
|
20
|
+
* Similar to DataSourceRegistry in @warlock.js/cascade
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* // Register a broker
|
|
25
|
+
* brokerRegistry.register({
|
|
26
|
+
* name: "default",
|
|
27
|
+
* driver: rabbitMQDriver,
|
|
28
|
+
* isDefault: true,
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* // Get the default broker
|
|
32
|
+
* const comm = brokerRegistry.get();
|
|
33
|
+
*
|
|
34
|
+
* // Get a specific broker by name
|
|
35
|
+
* const analytics = brokerRegistry.get("analytics");
|
|
36
|
+
*
|
|
37
|
+
* // Listen for events
|
|
38
|
+
* brokerRegistry.on("connected", (comm) => {
|
|
39
|
+
* console.log(`${comm.name} connected`);
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
var BrokerRegistry = class {
|
|
44
|
+
sources = /* @__PURE__ */ new Map();
|
|
45
|
+
defaultSource;
|
|
46
|
+
events = new EventEmitter();
|
|
47
|
+
/**
|
|
48
|
+
* Register a new broker
|
|
49
|
+
*
|
|
50
|
+
* Sets up event forwarding from the driver to the registry.
|
|
51
|
+
*
|
|
52
|
+
* @param options - Broker configuration
|
|
53
|
+
* @returns The registered broker instance
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* const broker = brokerRegistry.register({
|
|
58
|
+
* name: "primary",
|
|
59
|
+
* driver: myDriver,
|
|
60
|
+
* isDefault: true,
|
|
61
|
+
* });
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
register(options) {
|
|
65
|
+
const broker = new Broker(options);
|
|
66
|
+
this.sources.set(broker.name, broker);
|
|
67
|
+
const isNewDefault = broker.isDefault || !this.defaultSource;
|
|
68
|
+
if (isNewDefault) this.defaultSource = broker;
|
|
69
|
+
this.events.emit("registered", broker);
|
|
70
|
+
if (isNewDefault) this.events.emit("default-registered", broker);
|
|
71
|
+
broker.driver.on("connected", () => {
|
|
72
|
+
this.events.emit("connected", broker);
|
|
73
|
+
});
|
|
74
|
+
broker.driver.on("disconnected", () => {
|
|
75
|
+
this.events.emit("disconnected", broker);
|
|
76
|
+
});
|
|
77
|
+
return broker;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Clear all registered brokers
|
|
81
|
+
*/
|
|
82
|
+
clear() {
|
|
83
|
+
this.defaultSource = void 0;
|
|
84
|
+
this.sources.clear();
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Listen for registry events
|
|
88
|
+
*
|
|
89
|
+
* @param event - Event to listen for
|
|
90
|
+
* @param listener - Callback function
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* brokerRegistry.on("registered", (comm) => {
|
|
95
|
+
* console.log(`Broker "${comm.name}" registered`);
|
|
96
|
+
* });
|
|
97
|
+
*
|
|
98
|
+
* brokerRegistry.on("connected", (comm) => {
|
|
99
|
+
* console.log(`Broker "${comm.name}" connected`);
|
|
100
|
+
* });
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
on(event, listener) {
|
|
104
|
+
this.events.on(event, listener);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Listen for a registry event once
|
|
108
|
+
*
|
|
109
|
+
* @param event - Event to listen for
|
|
110
|
+
* @param listener - Callback function
|
|
111
|
+
*/
|
|
112
|
+
once(event, listener) {
|
|
113
|
+
this.events.once(event, listener);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Remove an event listener
|
|
117
|
+
*
|
|
118
|
+
* @param event - Event to stop listening for
|
|
119
|
+
* @param listener - Callback to remove
|
|
120
|
+
*/
|
|
121
|
+
off(event, listener) {
|
|
122
|
+
this.events.off(event, listener);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Get a broker by name or the default one
|
|
126
|
+
*
|
|
127
|
+
* @param name - Optional broker name
|
|
128
|
+
* @returns Broker instance
|
|
129
|
+
* @throws MissingBrokerError if not found
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```typescript
|
|
133
|
+
* // Get default broker
|
|
134
|
+
* const comm = brokerRegistry.get();
|
|
135
|
+
*
|
|
136
|
+
* // Get specific broker
|
|
137
|
+
* const analytics = brokerRegistry.get("analytics");
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
get(name) {
|
|
141
|
+
if (name !== void 0) {
|
|
142
|
+
const source = this.sources.get(name);
|
|
143
|
+
if (!source) throw new MissingBrokerError(`Broker "${name}" is not registered.`, name);
|
|
144
|
+
return source;
|
|
145
|
+
}
|
|
146
|
+
if (!this.defaultSource) throw new MissingBrokerError("No default broker registered.");
|
|
147
|
+
return this.defaultSource;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Check if a broker exists
|
|
151
|
+
*
|
|
152
|
+
* @param name - Broker name to check
|
|
153
|
+
* @returns True if exists
|
|
154
|
+
*/
|
|
155
|
+
has(name) {
|
|
156
|
+
return this.sources.has(name);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Check if any brokers are registered
|
|
160
|
+
*/
|
|
161
|
+
hasAny() {
|
|
162
|
+
return this.sources.size > 0;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Get all registered brokers
|
|
166
|
+
*
|
|
167
|
+
* @returns Array of all brokers
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* // Disconnect all brokers
|
|
172
|
+
* for (const comm of brokerRegistry.getAll()) {
|
|
173
|
+
* await comm.disconnect();
|
|
174
|
+
* }
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
getAll() {
|
|
178
|
+
return Array.from(this.sources.values());
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Get all broker names
|
|
182
|
+
*
|
|
183
|
+
* @returns Array of broker names
|
|
184
|
+
*/
|
|
185
|
+
getNames() {
|
|
186
|
+
return Array.from(this.sources.keys());
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Get the default broker (if any)
|
|
190
|
+
*
|
|
191
|
+
* @returns Default broker or undefined
|
|
192
|
+
*/
|
|
193
|
+
getDefault() {
|
|
194
|
+
return this.defaultSource;
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Global broker registry instance
|
|
199
|
+
*/
|
|
200
|
+
const brokerRegistry = new BrokerRegistry();
|
|
201
|
+
|
|
202
|
+
//#endregion
|
|
203
|
+
export { MissingBrokerError, brokerRegistry };
|
|
204
|
+
//# sourceMappingURL=broker-registry.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broker-registry.mjs","names":[],"sources":["../../../../../../../../../herald/src/communicators/broker-registry.ts"],"sourcesContent":["import { EventEmitter } from \"node:events\";\r\nimport type { BrokerRegistryEvent, BrokerRegistryListener } from \"../types\";\r\nimport { Broker, type BrokerOptions } from \"./broker\";\r\n\r\n/**\r\n * Error thrown when a broker is not found\r\n */\r\nexport class MissingBrokerError extends Error {\r\n public readonly brokerName?: string;\r\n\r\n public constructor(message: string, brokerName?: string) {\r\n super(message);\r\n this.name = \"MissingBrokerError\";\r\n this.brokerName = brokerName;\r\n }\r\n}\r\n\r\n/**\r\n * Broker Registry\r\n *\r\n * Maintains registry of named brokers.\r\n * Similar to DataSourceRegistry in @warlock.js/cascade\r\n *\r\n * @example\r\n * ```typescript\r\n * // Register a broker\r\n * brokerRegistry.register({\r\n * name: \"default\",\r\n * driver: rabbitMQDriver,\r\n * isDefault: true,\r\n * });\r\n *\r\n * // Get the default broker\r\n * const comm = brokerRegistry.get();\r\n *\r\n * // Get a specific broker by name\r\n * const analytics = brokerRegistry.get(\"analytics\");\r\n *\r\n * // Listen for events\r\n * brokerRegistry.on(\"connected\", (comm) => {\r\n * console.log(`${comm.name} connected`);\r\n * });\r\n * ```\r\n */\r\nclass BrokerRegistry {\r\n private readonly sources = new Map<string, Broker>();\r\n private defaultSource?: Broker;\r\n private readonly events = new EventEmitter();\r\n\r\n /**\r\n * Register a new broker\r\n *\r\n * Sets up event forwarding from the driver to the registry.\r\n *\r\n * @param options - Broker configuration\r\n * @returns The registered broker instance\r\n *\r\n * @example\r\n * ```typescript\r\n * const broker = brokerRegistry.register({\r\n * name: \"primary\",\r\n * driver: myDriver,\r\n * isDefault: true,\r\n * });\r\n * ```\r\n */\r\n public register(options: BrokerOptions): Broker {\r\n const broker = new Broker(options);\r\n this.sources.set(broker.name, broker);\r\n\r\n const isNewDefault = broker.isDefault || !this.defaultSource;\r\n\r\n if (isNewDefault) {\r\n this.defaultSource = broker;\r\n }\r\n\r\n // Emit registration events\r\n this.events.emit(\"registered\", broker);\r\n\r\n if (isNewDefault) {\r\n this.events.emit(\"default-registered\", broker);\r\n }\r\n\r\n // Forward driver events to registry\r\n broker.driver.on(\"connected\", () => {\r\n this.events.emit(\"connected\", broker);\r\n });\r\n\r\n broker.driver.on(\"disconnected\", () => {\r\n this.events.emit(\"disconnected\", broker);\r\n });\r\n\r\n return broker;\r\n }\r\n\r\n /**\r\n * Clear all registered brokers\r\n */\r\n public clear(): void {\r\n this.defaultSource = undefined;\r\n this.sources.clear();\r\n }\r\n\r\n /**\r\n * Listen for registry events\r\n *\r\n * @param event - Event to listen for\r\n * @param listener - Callback function\r\n *\r\n * @example\r\n * ```typescript\r\n * brokerRegistry.on(\"registered\", (comm) => {\r\n * console.log(`Broker \"${comm.name}\" registered`);\r\n * });\r\n *\r\n * brokerRegistry.on(\"connected\", (comm) => {\r\n * console.log(`Broker \"${comm.name}\" connected`);\r\n * });\r\n * ```\r\n */\r\n public on(event: BrokerRegistryEvent, listener: BrokerRegistryListener): void {\r\n this.events.on(event, listener);\r\n }\r\n\r\n /**\r\n * Listen for a registry event once\r\n *\r\n * @param event - Event to listen for\r\n * @param listener - Callback function\r\n */\r\n public once(event: BrokerRegistryEvent, listener: BrokerRegistryListener): void {\r\n this.events.once(event, listener);\r\n }\r\n\r\n /**\r\n * Remove an event listener\r\n *\r\n * @param event - Event to stop listening for\r\n * @param listener - Callback to remove\r\n */\r\n public off(event: BrokerRegistryEvent, listener: BrokerRegistryListener): void {\r\n this.events.off(event, listener);\r\n }\r\n\r\n /**\r\n * Get a broker by name or the default one\r\n *\r\n * @param name - Optional broker name\r\n * @returns Broker instance\r\n * @throws MissingBrokerError if not found\r\n *\r\n * @example\r\n * ```typescript\r\n * // Get default broker\r\n * const comm = brokerRegistry.get();\r\n *\r\n * // Get specific broker\r\n * const analytics = brokerRegistry.get(\"analytics\");\r\n * ```\r\n */\r\n public get(name?: string): Broker {\r\n if (name !== undefined) {\r\n const source = this.sources.get(name);\r\n if (!source) {\r\n throw new MissingBrokerError(`Broker \"${name}\" is not registered.`, name);\r\n }\r\n return source;\r\n }\r\n\r\n if (!this.defaultSource) {\r\n throw new MissingBrokerError(\"No default broker registered.\");\r\n }\r\n\r\n return this.defaultSource;\r\n }\r\n\r\n /**\r\n * Check if a broker exists\r\n *\r\n * @param name - Broker name to check\r\n * @returns True if exists\r\n */\r\n public has(name: string): boolean {\r\n return this.sources.has(name);\r\n }\r\n\r\n /**\r\n * Check if any brokers are registered\r\n */\r\n public hasAny(): boolean {\r\n return this.sources.size > 0;\r\n }\r\n\r\n /**\r\n * Get all registered brokers\r\n *\r\n * @returns Array of all brokers\r\n *\r\n * @example\r\n * ```typescript\r\n * // Disconnect all brokers\r\n * for (const comm of brokerRegistry.getAll()) {\r\n * await comm.disconnect();\r\n * }\r\n * ```\r\n */\r\n public getAll(): Broker[] {\r\n return Array.from(this.sources.values());\r\n }\r\n\r\n /**\r\n * Get all broker names\r\n *\r\n * @returns Array of broker names\r\n */\r\n public getNames(): string[] {\r\n return Array.from(this.sources.keys());\r\n }\r\n\r\n /**\r\n * Get the default broker (if any)\r\n *\r\n * @returns Default broker or undefined\r\n */\r\n public getDefault(): Broker | undefined {\r\n return this.defaultSource;\r\n }\r\n}\r\n\r\n/**\r\n * Global broker registry instance\r\n */\r\nexport const brokerRegistry = new BrokerRegistry();\r\n"],"mappings":";;;;;;;AAOA,IAAa,qBAAb,cAAwC,MAAM;CAC5C,AAAgB;CAEhB,AAAO,YAAY,SAAiB,YAAqB;EACvD,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,aAAa;CACpB;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,IAAM,iBAAN,MAAqB;CACnB,AAAiB,0BAAU,IAAI,IAAoB;CACnD,AAAQ;CACR,AAAiB,SAAS,IAAI,aAAa;;;;;;;;;;;;;;;;;;CAmB3C,AAAO,SAAS,SAAgC;EAC9C,MAAM,SAAS,IAAI,OAAO,OAAO;EACjC,KAAK,QAAQ,IAAI,OAAO,MAAM,MAAM;EAEpC,MAAM,eAAe,OAAO,aAAa,CAAC,KAAK;EAE/C,IAAI,cACF,KAAK,gBAAgB;EAIvB,KAAK,OAAO,KAAK,cAAc,MAAM;EAErC,IAAI,cACF,KAAK,OAAO,KAAK,sBAAsB,MAAM;EAI/C,OAAO,OAAO,GAAG,mBAAmB;GAClC,KAAK,OAAO,KAAK,aAAa,MAAM;EACtC,CAAC;EAED,OAAO,OAAO,GAAG,sBAAsB;GACrC,KAAK,OAAO,KAAK,gBAAgB,MAAM;EACzC,CAAC;EAED,OAAO;CACT;;;;CAKA,AAAO,QAAc;EACnB,KAAK,gBAAgB;EACrB,KAAK,QAAQ,MAAM;CACrB;;;;;;;;;;;;;;;;;;CAmBA,AAAO,GAAG,OAA4B,UAAwC;EAC5E,KAAK,OAAO,GAAG,OAAO,QAAQ;CAChC;;;;;;;CAQA,AAAO,KAAK,OAA4B,UAAwC;EAC9E,KAAK,OAAO,KAAK,OAAO,QAAQ;CAClC;;;;;;;CAQA,AAAO,IAAI,OAA4B,UAAwC;EAC7E,KAAK,OAAO,IAAI,OAAO,QAAQ;CACjC;;;;;;;;;;;;;;;;;CAkBA,AAAO,IAAI,MAAuB;EAChC,IAAI,SAAS,QAAW;GACtB,MAAM,SAAS,KAAK,QAAQ,IAAI,IAAI;GACpC,IAAI,CAAC,QACH,MAAM,IAAI,mBAAmB,WAAW,KAAK,uBAAuB,IAAI;GAE1E,OAAO;EACT;EAEA,IAAI,CAAC,KAAK,eACR,MAAM,IAAI,mBAAmB,+BAA+B;EAG9D,OAAO,KAAK;CACd;;;;;;;CAQA,AAAO,IAAI,MAAuB;EAChC,OAAO,KAAK,QAAQ,IAAI,IAAI;CAC9B;;;;CAKA,AAAO,SAAkB;EACvB,OAAO,KAAK,QAAQ,OAAO;CAC7B;;;;;;;;;;;;;;CAeA,AAAO,SAAmB;EACxB,OAAO,MAAM,KAAK,KAAK,QAAQ,OAAO,CAAC;CACzC;;;;;;CAOA,AAAO,WAAqB;EAC1B,OAAO,MAAM,KAAK,KAAK,QAAQ,KAAK,CAAC;CACvC;;;;;;CAOA,AAAO,aAAiC;EACtC,OAAO,KAAK;CACd;AACF;;;;AAKA,MAAa,iBAAiB,IAAI,eAAe"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
//#region ../herald/src/communicators/broker.ts
|
|
2
|
+
/**
|
|
3
|
+
* Broker - wrapper around a driver with metadata
|
|
4
|
+
*
|
|
5
|
+
* Similar to DataSource in @warlock.js/cascade
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const broker = new Broker({
|
|
10
|
+
* name: "default",
|
|
11
|
+
* driver: rabbitMQDriver,
|
|
12
|
+
* isDefault: true,
|
|
13
|
+
* });
|
|
14
|
+
*
|
|
15
|
+
* // Get a channel
|
|
16
|
+
* const channel = broker.channel("user.created");
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
var Broker = class {
|
|
20
|
+
/** Unique name identifying this broker */
|
|
21
|
+
name;
|
|
22
|
+
/** The underlying driver */
|
|
23
|
+
driver;
|
|
24
|
+
/** Whether this is the default broker */
|
|
25
|
+
isDefault;
|
|
26
|
+
/**
|
|
27
|
+
* Create a new Broker
|
|
28
|
+
*
|
|
29
|
+
* @param options - Broker configuration
|
|
30
|
+
*/
|
|
31
|
+
constructor(options) {
|
|
32
|
+
this.name = options.name;
|
|
33
|
+
this.driver = options.driver;
|
|
34
|
+
this.isDefault = Boolean(options.isDefault);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Subscribe the given consumer
|
|
38
|
+
*/
|
|
39
|
+
subscribe(consumer) {
|
|
40
|
+
return this.driver.subscribe(consumer);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Publish the given event message
|
|
44
|
+
*/
|
|
45
|
+
publish(event) {
|
|
46
|
+
this.driver.publish(event);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get or create a channel
|
|
50
|
+
*
|
|
51
|
+
* @param name - Channel name
|
|
52
|
+
* @param options - Channel options
|
|
53
|
+
* @returns Channel instance
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* // Simple channel
|
|
58
|
+
* const channel = broker.channel("notifications");
|
|
59
|
+
*
|
|
60
|
+
* // Typed channel with schema
|
|
61
|
+
* const orderChannel = broker.channel<OrderPayload>("orders", {
|
|
62
|
+
* schema: OrderSchema,
|
|
63
|
+
* durable: true,
|
|
64
|
+
* });
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
channel(name, options) {
|
|
68
|
+
return this.driver.channel(name, options);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Check if the broker is connected
|
|
72
|
+
*/
|
|
73
|
+
get isConnected() {
|
|
74
|
+
return this.driver.isConnected;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Connect the underlying driver
|
|
78
|
+
*/
|
|
79
|
+
async connect() {
|
|
80
|
+
await this.driver.connect();
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Disconnect the underlying driver
|
|
84
|
+
*/
|
|
85
|
+
async disconnect() {
|
|
86
|
+
await this.driver.disconnect();
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Start consuming messages
|
|
90
|
+
*/
|
|
91
|
+
async startConsuming() {
|
|
92
|
+
await this.driver.startConsuming();
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Stop consuming messages
|
|
96
|
+
*/
|
|
97
|
+
async stopConsuming() {
|
|
98
|
+
await this.driver.stopConsuming();
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Health check
|
|
102
|
+
*/
|
|
103
|
+
async healthCheck() {
|
|
104
|
+
return this.driver.healthCheck();
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
//#endregion
|
|
109
|
+
export { Broker };
|
|
110
|
+
//# sourceMappingURL=broker.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broker.mjs","names":[],"sources":["../../../../../../../../../herald/src/communicators/broker.ts"],"sourcesContent":["import type { BrokerDriverContract } from \"../contracts\";\r\nimport type { ChannelContract } from \"../contracts/channel.contract\";\r\nimport { EventMessage } from \"../message-managers/event-message\";\r\nimport { EventConsumerClass } from \"../message-managers/types\";\r\nimport type { ChannelOptions } from \"../types\";\r\n\r\n/**\r\n * Options for creating a Broker\r\n */\r\nexport interface BrokerOptions {\r\n /** Unique name for this broker */\r\n name: string;\r\n /** The underlying driver */\r\n driver: BrokerDriverContract;\r\n /** Whether this is the default broker */\r\n isDefault?: boolean;\r\n}\r\n\r\n/**\r\n * Broker - wrapper around a driver with metadata\r\n *\r\n * Similar to DataSource in @warlock.js/cascade\r\n *\r\n * @example\r\n * ```typescript\r\n * const broker = new Broker({\r\n * name: \"default\",\r\n * driver: rabbitMQDriver,\r\n * isDefault: true,\r\n * });\r\n *\r\n * // Get a channel\r\n * const channel = broker.channel(\"user.created\");\r\n * ```\r\n */\r\nexport class Broker {\r\n /** Unique name identifying this broker */\r\n public readonly name: string;\r\n\r\n /** The underlying driver */\r\n public readonly driver: BrokerDriverContract;\r\n\r\n /** Whether this is the default broker */\r\n public readonly isDefault: boolean;\r\n\r\n /**\r\n * Create a new Broker\r\n *\r\n * @param options - Broker configuration\r\n */\r\n public constructor(options: BrokerOptions) {\r\n this.name = options.name;\r\n this.driver = options.driver;\r\n this.isDefault = Boolean(options.isDefault);\r\n }\r\n\r\n /**\r\n * Subscribe the given consumer\r\n */\r\n public subscribe(consumer: EventConsumerClass<any>) {\r\n return this.driver.subscribe(consumer);\r\n }\r\n\r\n /**\r\n * Publish the given event message\r\n */\r\n public publish<TPayload = Record<string, any>>(event: EventMessage<TPayload>) {\r\n this.driver.publish(event);\r\n }\r\n\r\n /**\r\n * Get or create a channel\r\n *\r\n * @param name - Channel name\r\n * @param options - Channel options\r\n * @returns Channel instance\r\n *\r\n * @example\r\n * ```typescript\r\n * // Simple channel\r\n * const channel = broker.channel(\"notifications\");\r\n *\r\n * // Typed channel with schema\r\n * const orderChannel = broker.channel<OrderPayload>(\"orders\", {\r\n * schema: OrderSchema,\r\n * durable: true,\r\n * });\r\n * ```\r\n */\r\n public channel<TPayload = unknown>(\r\n name: string,\r\n options?: ChannelOptions<TPayload>,\r\n ): ChannelContract<TPayload> {\r\n return this.driver.channel<TPayload>(name, options);\r\n }\r\n\r\n /**\r\n * Check if the broker is connected\r\n */\r\n public get isConnected(): boolean {\r\n return this.driver.isConnected;\r\n }\r\n\r\n /**\r\n * Connect the underlying driver\r\n */\r\n public async connect(): Promise<void> {\r\n await this.driver.connect();\r\n }\r\n\r\n /**\r\n * Disconnect the underlying driver\r\n */\r\n public async disconnect(): Promise<void> {\r\n await this.driver.disconnect();\r\n }\r\n\r\n /**\r\n * Start consuming messages\r\n */\r\n public async startConsuming(): Promise<void> {\r\n await this.driver.startConsuming();\r\n }\r\n\r\n /**\r\n * Stop consuming messages\r\n */\r\n public async stopConsuming(): Promise<void> {\r\n await this.driver.stopConsuming();\r\n }\r\n\r\n /**\r\n * Health check\r\n */\r\n public async healthCheck() {\r\n return this.driver.healthCheck();\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmCA,IAAa,SAAb,MAAoB;;CAElB,AAAgB;;CAGhB,AAAgB;;CAGhB,AAAgB;;;;;;CAOhB,AAAO,YAAY,SAAwB;EACzC,KAAK,OAAO,QAAQ;EACpB,KAAK,SAAS,QAAQ;EACtB,KAAK,YAAY,QAAQ,QAAQ,SAAS;CAC5C;;;;CAKA,AAAO,UAAU,UAAmC;EAClD,OAAO,KAAK,OAAO,UAAU,QAAQ;CACvC;;;;CAKA,AAAO,QAAwC,OAA+B;EAC5E,KAAK,OAAO,QAAQ,KAAK;CAC3B;;;;;;;;;;;;;;;;;;;;CAqBA,AAAO,QACL,MACA,SAC2B;EAC3B,OAAO,KAAK,OAAO,QAAkB,MAAM,OAAO;CACpD;;;;CAKA,IAAW,cAAuB;EAChC,OAAO,KAAK,OAAO;CACrB;;;;CAKA,MAAa,UAAyB;EACpC,MAAM,KAAK,OAAO,QAAQ;CAC5B;;;;CAKA,MAAa,aAA4B;EACvC,MAAM,KAAK,OAAO,WAAW;CAC/B;;;;CAKA,MAAa,iBAAgC;EAC3C,MAAM,KAAK,OAAO,eAAe;CACnC;;;;CAKA,MAAa,gBAA+B;EAC1C,MAAM,KAAK,OAAO,cAAc;CAClC;;;;CAKA,MAAa,cAAc;EACzB,OAAO,KAAK,OAAO,YAAY;CACjC;AACF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { brokerRegistry } from "../communicators/broker-registry.mjs";
|
|
2
|
+
import "../communicators/index.mjs";
|
|
3
|
+
|
|
4
|
+
//#region ../herald/src/decorators/consumable.ts
|
|
5
|
+
const pendingSubscribers = /* @__PURE__ */ new Set();
|
|
6
|
+
/**
|
|
7
|
+
* Register the consumer to the broker
|
|
8
|
+
*/
|
|
9
|
+
function Consumable(options) {
|
|
10
|
+
return function(target) {
|
|
11
|
+
const brokerName = options?.broker;
|
|
12
|
+
try {
|
|
13
|
+
const currentBroker = brokerRegistry.get(brokerName);
|
|
14
|
+
if (currentBroker?.isConnected) currentBroker.subscribe(target);
|
|
15
|
+
else pendingSubscribers.add({
|
|
16
|
+
Consumer: target,
|
|
17
|
+
options
|
|
18
|
+
});
|
|
19
|
+
} catch {
|
|
20
|
+
pendingSubscribers.add({
|
|
21
|
+
Consumer: target,
|
|
22
|
+
options
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
brokerRegistry.on("connected", (broker) => {
|
|
28
|
+
for (const { Consumer, options } of pendingSubscribers) {
|
|
29
|
+
if (options?.broker && broker.name !== options.broker) continue;
|
|
30
|
+
broker.subscribe(Consumer);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { Consumable, pendingSubscribers };
|
|
36
|
+
//# sourceMappingURL=consumable.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consumable.mjs","names":[],"sources":["../../../../../../../../../herald/src/decorators/consumable.ts"],"sourcesContent":["import { brokerRegistry } from \"../communicators\";\nimport { type EventConsumerClass } from \"../message-managers/types\";\n\nexport type ConsumableOptions = {\n broker?: string;\n};\n\nexport const pendingSubscribers = new Set<{\n Consumer: EventConsumerClass;\n options?: ConsumableOptions;\n}>();\n\n/**\n * Register the consumer to the broker\n */\nexport function Consumable(options?: ConsumableOptions) {\n return function (target: EventConsumerClass) {\n const brokerName = options?.broker;\n\n try {\n const currentBroker = brokerRegistry.get(brokerName);\n\n // if broker is connected, subscribe the consumer\n if (currentBroker?.isConnected) {\n currentBroker.subscribe(target);\n } else {\n pendingSubscribers.add({ Consumer: target, options });\n }\n } catch {\n // mostly it will be an error that broker is not registered yet\n // then add it to the pending subscribers\n pendingSubscribers.add({ Consumer: target, options });\n }\n };\n}\n\n// Register pending consumers on broker's connection is done\nbrokerRegistry.on(\"connected\", (broker) => {\n for (const { Consumer, options } of pendingSubscribers) {\n if (options?.broker && broker.name !== options.broker) {\n continue;\n }\n\n broker.subscribe(Consumer);\n }\n});\n"],"mappings":";;;;AAOA,MAAa,qCAAqB,IAAI,IAGnC;;;;AAKH,SAAgB,WAAW,SAA6B;CACtD,OAAO,SAAU,QAA4B;EAC3C,MAAM,aAAa,SAAS;EAE5B,IAAI;GACF,MAAM,gBAAgB,eAAe,IAAI,UAAU;GAGnD,IAAI,eAAe,aACjB,cAAc,UAAU,MAAM;QAE9B,mBAAmB,IAAI;IAAE,UAAU;IAAQ;GAAQ,CAAC;EAExD,QAAQ;GAGN,mBAAmB,IAAI;IAAE,UAAU;IAAQ;GAAQ,CAAC;EACtD;CACF;AACF;AAGA,eAAe,GAAG,cAAc,WAAW;CACzC,KAAK,MAAM,EAAE,UAAU,aAAa,oBAAoB;EACtD,IAAI,SAAS,UAAU,OAAO,SAAS,QAAQ,QAC7C;EAGF,OAAO,UAAU,QAAQ;CAC3B;AACF,CAAC"}
|