commandkit 1.2.0-dev.20251125125452 → 1.2.0-dev.20260115004503
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/{COPYING.md → LICENSE.md} +3 -3
- package/README.md +3 -3
- package/dist/{ActionRow-BtKd-ZRS.d.ts → ActionRow-B-CGmjDp.d.ts} +2 -3
- package/dist/{ActionRow-D6knpVd6.js → ActionRow-CSN_UKmM.js} +2 -2
- package/dist/{ActionRow-D6knpVd6.js.map → ActionRow-CSN_UKmM.js.map} +1 -1
- package/dist/{Button-DiXeKdXO.d.ts → Button-C-GPeFA3.d.ts} +5 -6
- package/dist/{ButtonKit-B_HCmb3D.d.ts → ButtonKit-DKu0VAe4.d.ts} +35 -36
- package/dist/{ChannelSelectMenuKit-DrsqXWiO.d.ts → ChannelSelectMenuKit-HQZ4hH5s.d.ts} +33 -34
- package/dist/{CommandKitEventsChannel-2l9Za-le.js → CommandKitEventsChannel-CnT5ymYe.js} +2 -2
- package/dist/{CommandKitEventsChannel-2l9Za-le.js.map → CommandKitEventsChannel-CnT5ymYe.js.map} +1 -1
- package/dist/{CommandsRouter-Bdkx7SZS.d.ts → CommandsRouter-C7dZEepB.d.ts} +48 -49
- package/dist/{CommandsRouter-NAgpWzTJ.js → CommandsRouter-C_HLsrGX.js} +2 -2
- package/dist/{CommandsRouter-NAgpWzTJ.js.map → CommandsRouter-C_HLsrGX.js.map} +1 -1
- package/dist/{CompilerPlugin-DbN5-ls3.js → CompilerPlugin-CUsGAfgl.js} +2 -2
- package/dist/{CompilerPlugin-DbN5-ls3.js.map → CompilerPlugin-CUsGAfgl.js.map} +1 -1
- package/dist/EventInterceptor-BWoEJMHZ.js.map +1 -1
- package/dist/{EventInterceptor-Dk5Fwu-7.d.ts → EventInterceptor-CZmWpS08.d.ts} +39 -39
- package/dist/{EventWorkerContext-yTm5vI3b.js → EventWorkerContext-Dfhgv329.js} +2 -2
- package/dist/{EventWorkerContext-yTm5vI3b.js.map → EventWorkerContext-Dfhgv329.js.map} +1 -1
- package/dist/{EventsRouter-bILsV3Lh.d.ts → EventsRouter-DZ37r54v.d.ts} +34 -34
- package/dist/{EventsRouter-D4_vBMhl.js → EventsRouter-DZYIha6m.js} +2 -2
- package/dist/{EventsRouter-D4_vBMhl.js.map → EventsRouter-DZYIha6m.js.map} +1 -1
- package/dist/{MentionableSelectMenuKit-DNan_JWk.d.ts → MentionableSelectMenuKit-7URDUM3-.d.ts} +33 -34
- package/dist/{MessageCommandParser-CD7ynlBO.js → MessageCommandParser-Bs9fimmd.js} +2 -2
- package/dist/{MessageCommandParser-CD7ynlBO.js.map → MessageCommandParser-Bs9fimmd.js.map} +1 -1
- package/dist/MessageCommandParser-q3dQcE5N.d.ts +194 -0
- package/dist/{Modal-Dd5plFpo.d.ts → Modal-CZT9MZsy.d.ts} +7 -8
- package/dist/{ModalKit-C8WkeoDl.d.ts → ModalKit-BWXI3Z26.d.ts} +32 -33
- package/dist/{PluginCommon-Bp5T3ubs.js → PluginCommon-BLxWww5u.js} +6 -6
- package/dist/{PluginCommon-Bp5T3ubs.js.map → PluginCommon-BLxWww5u.js.map} +1 -1
- package/dist/{RoleSelectMenuKit-FfGw3CSa.d.ts → RoleSelectMenuKit-BY-JJ18w.d.ts} +33 -34
- package/dist/{RuntimePlugin-Bq6z-Upz.js → RuntimePlugin-CtobluSU.js} +2 -2
- package/dist/{RuntimePlugin-Bq6z-Upz.js.map → RuntimePlugin-CtobluSU.js.map} +1 -1
- package/dist/{SelectMenu-DTWKY-JJ.d.ts → SelectMenu-q_b3Mjv9.d.ts} +8 -9
- package/dist/{StringSelectMenuKit-BMA0rjhA.d.ts → StringSelectMenuKit-lVhUMc3g.d.ts} +33 -34
- package/dist/{UserSelectMenuKit-CRpFbwA9.d.ts → UserSelectMenuKit-CCj4Fpkr.d.ts} +33 -34
- package/dist/analytics/analytics-engine.d.ts +1 -33
- package/dist/analytics/analytics-engine.js +21 -36
- package/dist/analytics/analytics-provider.d.ts +1 -33
- package/dist/analytics/constants.js +1 -1
- package/dist/analytics/utils.js +21 -36
- package/dist/{analytics-engine-DHmLGxFA.d.ts → analytics-engine-WQhXmx3H.d.ts} +840 -840
- package/dist/app/commands/AppCommandRunner.d.ts +1 -33
- package/dist/app/commands/AppCommandRunner.js +21 -36
- package/dist/app/commands/Context.d.ts +1 -33
- package/dist/app/commands/Context.js +21 -36
- package/dist/app/commands/MessageCommandParser.d.ts +1 -1
- package/dist/app/commands/MessageCommandParser.js +1 -2
- package/dist/app/commands/helpers.d.ts +1 -1
- package/dist/app/commands/helpers.js +1 -1
- package/dist/app/events/EventWorkerContext.d.ts +42 -35
- package/dist/app/events/EventWorkerContext.js +1 -1
- package/dist/app/handlers/AppCommandHandler.d.ts +1 -33
- package/dist/app/handlers/AppCommandHandler.js +21 -36
- package/dist/app/handlers/AppEventsHandler.d.ts +1 -33
- package/dist/app/handlers/AppEventsHandler.js +21 -36
- package/dist/app/index.d.ts +4 -33
- package/dist/app/index.js +21 -37
- package/dist/app/interrupt/signals.d.ts +1 -1
- package/dist/app/interrupt/signals.js +2 -3
- package/dist/app/middlewares/permissions.d.ts +1 -33
- package/dist/app/middlewares/permissions.js +21 -36
- package/dist/app/register/CommandRegistrar.d.ts +1 -33
- package/dist/app/register/CommandRegistrar.js +21 -36
- package/dist/app/router/CommandsRouter.d.ts +1 -1
- package/dist/app/router/CommandsRouter.js +1 -1
- package/dist/app/router/EventsRouter.d.ts +1 -1
- package/dist/app/router/EventsRouter.js +1 -1
- package/dist/app/router/index.d.ts +2 -3
- package/dist/app/router/index.js +2 -2
- package/dist/{chunk-nOFOJqeH.js → chunk-kSYXY2_d.js} +10 -6
- package/dist/cli/app-process.d.ts +0 -1
- package/dist/cli/app-process.js +61 -6
- package/dist/cli/app-process.js.map +1 -0
- package/dist/cli/build.d.ts +2 -33
- package/dist/cli/build.js +189 -42
- package/dist/cli/build.js.map +1 -0
- package/dist/cli/common.d.ts +1 -33
- package/dist/cli/common.js +3 -3
- package/dist/cli/development.d.ts +1 -2
- package/dist/cli/development.js +30 -44
- package/dist/cli/development.js.map +1 -1
- package/dist/cli/env.js +1 -1
- package/dist/cli/generators.js +4 -4
- package/dist/cli/generators.js.map +1 -1
- package/dist/cli/information.js +2 -2
- package/dist/cli/information.js.map +1 -1
- package/dist/cli/init.d.ts +0 -1
- package/dist/cli/init.js +27 -41
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/production.d.ts +0 -1
- package/dist/cli/production.js +33 -47
- package/dist/cli/production.js.map +1 -1
- package/dist/cli/type-checker.js +4 -4
- package/dist/cli/utils.d.ts +0 -1
- package/dist/cli/utils.js +17 -2
- package/dist/cli/utils.js.map +1 -0
- package/dist/{colors-CLmBiP9I.js → colors-Csc0X4QJ.js} +2 -2
- package/dist/{colors-CLmBiP9I.js.map → colors-Csc0X4QJ.js.map} +1 -1
- package/dist/{commandkit-B0wT0Mxx.js → commandkit-SIjTLD2R.js} +31 -31
- package/dist/{commandkit-B0wT0Mxx.js.map → commandkit-SIjTLD2R.js.map} +1 -1
- package/dist/commandkit.d.ts +1 -33
- package/dist/commandkit.js +21 -36
- package/dist/{common-B2-sF49Q.js → common-DSRs_mfw.js} +6 -6
- package/dist/{common-B2-sF49Q.js.map → common-DSRs_mfw.js.map} +1 -1
- package/dist/{common-DAxu7-kG.d.ts → common-DnwCYit8.d.ts} +2 -3
- package/dist/components/common/EventInterceptor.d.ts +1 -1
- package/dist/components/common/element.d.ts +1 -4
- package/dist/components/common/types.d.ts +1 -1
- package/dist/components/common/types.js +0 -1
- package/dist/components/display/common.d.ts +0 -1
- package/dist/components/display/container.d.ts +1 -1
- package/dist/components/display/container.js +1 -2
- package/dist/components/display/file.d.ts +1 -1
- package/dist/components/display/file.js +1 -1
- package/dist/components/display/index.d.ts +8 -9
- package/dist/components/display/index.js +8 -9
- package/dist/components/display/label.d.ts +1 -1
- package/dist/components/display/label.js +1 -2
- package/dist/components/display/media-gallery.d.ts +1 -1
- package/dist/components/display/media-gallery.js +1 -2
- package/dist/components/display/poll.d.ts +1 -1
- package/dist/components/display/poll.js +1 -1
- package/dist/components/display/section.d.ts +1 -1
- package/dist/components/display/section.js +1 -2
- package/dist/components/display/separator.d.ts +1 -1
- package/dist/components/display/separator.js +1 -1
- package/dist/components/display/text-display.d.ts +1 -1
- package/dist/components/display/text-display.js +1 -1
- package/dist/components/index.d.ts +22 -25
- package/dist/components/index.js +21 -35
- package/dist/components/interactive/action-row/ActionRow.d.ts +1 -5
- package/dist/components/interactive/action-row/ActionRow.js +1 -1
- package/dist/components/interactive/button/Button.d.ts +1 -6
- package/dist/components/interactive/button/Button.js +21 -36
- package/dist/components/interactive/button/ButtonKit.d.ts +1 -2
- package/dist/components/interactive/button/ButtonKit.js +21 -36
- package/dist/components/interactive/modal/Modal.d.ts +1 -6
- package/dist/components/interactive/modal/Modal.js +21 -36
- package/dist/components/interactive/modal/ModalKit.d.ts +1 -2
- package/dist/components/interactive/modal/ModalKit.js +21 -36
- package/dist/components/interactive/select-menu/ChannelSelectMenuKit.d.ts +1 -3
- package/dist/components/interactive/select-menu/ChannelSelectMenuKit.js +21 -36
- package/dist/components/interactive/select-menu/MentionableSelectMenuKit.d.ts +1 -3
- package/dist/components/interactive/select-menu/MentionableSelectMenuKit.js +21 -36
- package/dist/components/interactive/select-menu/RoleSelectMenuKit.d.ts +1 -3
- package/dist/components/interactive/select-menu/RoleSelectMenuKit.js +21 -36
- package/dist/components/interactive/select-menu/SelectMenu.d.ts +1 -9
- package/dist/components/interactive/select-menu/SelectMenu.js +21 -36
- package/dist/components/interactive/select-menu/StringSelectMenuKit.d.ts +1 -3
- package/dist/components/interactive/select-menu/StringSelectMenuKit.js +21 -36
- package/dist/components/interactive/select-menu/UserSelectMenuKit.d.ts +1 -3
- package/dist/components/interactive/select-menu/UserSelectMenuKit.js +21 -36
- package/dist/components/interactive/select-menu/common.d.ts +1 -2
- package/dist/components/interactive/select-menu/common.js +0 -1
- package/dist/config/config.d.ts +15 -35
- package/dist/config/config.js +21 -36
- package/dist/config/default.d.ts +1 -33
- package/dist/config/default.js +21 -36
- package/dist/config/loader.d.ts +1 -33
- package/dist/config/loader.js +21 -36
- package/dist/config/types.d.ts +1 -33
- package/dist/config/utils.d.ts +1 -33
- package/dist/constants-BFFK-hfP.js +27 -0
- package/dist/{constants-Dy6P2veX.js.map → constants-BFFK-hfP.js.map} +1 -1
- package/dist/{constants-CAMgxUyw.d.ts → constants-CuYW0K10.d.ts} +7 -7
- package/dist/{constants-BqrEmoih.js → constants-Cw8VjCVz.js} +2 -2
- package/dist/{constants-BqrEmoih.js.map → constants-Cw8VjCVz.js.map} +1 -1
- package/dist/{constants-D95ayHBM.d.ts → constants-EpKcj0dH.d.ts} +1 -1
- package/dist/{container-C319x4cG.js → container-DCPljKVH.js} +2 -2
- package/dist/{container-C319x4cG.js.map → container-DCPljKVH.js.map} +1 -1
- package/dist/{container-0C3ZMb_f.d.ts → container-DYcb7zGw.d.ts} +1 -2
- package/dist/context/async-context.d.ts +1 -33
- package/dist/context/async-context.js +21 -36
- package/dist/context/environment.d.ts +1 -33
- package/dist/context/environment.js +21 -36
- package/dist/element-DibzzA5L.js.map +1 -1
- package/dist/{element-CGY5MlNe.d.ts → element-wQo0heGj.d.ts} +3 -4
- package/dist/{env-CQJgOkQD.js → env-CmspDhHy.js} +1 -1
- package/dist/{env-CQJgOkQD.js.map → env-CmspDhHy.js.map} +1 -1
- package/dist/error-codes-Ds0bnPvT.js.map +1 -1
- package/dist/events/CommandKitEventsChannel.d.ts +1 -33
- package/dist/events/CommandKitEventsChannel.js +1 -1
- package/dist/{file-DgEXJx3x.js → file-Ca1kpEtE.js} +2 -2
- package/dist/{file-DgEXJx3x.js.map → file-Ca1kpEtE.js.map} +1 -1
- package/dist/{file-CfUTZjJh.d.ts → file-CrV4lSnl.d.ts} +1 -2
- package/dist/flags/FlagProvider.d.ts +1 -33
- package/dist/flags/feature-flags.d.ts +1 -33
- package/dist/flags/feature-flags.js +162 -40
- package/dist/flags/feature-flags.js.map +1 -0
- package/dist/flags/store.d.ts +1 -33
- package/dist/flags/store.js +1 -1
- package/dist/{helpers-t6PiYdMb.d.ts → helpers-AQPLVY35.d.ts} +1 -2
- package/dist/{helpers-0FUA42u8.js → helpers-Btx1FSZx.js} +2 -2
- package/dist/{helpers-0FUA42u8.js.map → helpers-Btx1FSZx.js.map} +1 -1
- package/dist/index.d.ts +40 -43
- package/dist/index.js +32 -40
- package/dist/index.js.map +1 -1
- package/dist/kv/constants.d.ts +1 -1
- package/dist/kv/constants.js +1 -1
- package/dist/kv/dotprops.js +25 -3
- package/dist/kv/dotprops.js.map +1 -0
- package/dist/kv/kv.d.ts +289 -290
- package/dist/kv/kv.js +14 -15
- package/dist/kv/kv.js.map +1 -1
- package/dist/kv/serde.d.ts +12 -3
- package/dist/kv/serde.js +86 -4
- package/dist/kv/serde.js.map +1 -0
- package/dist/{label-CQD5hBwB.d.ts → label-37kaNWMH.d.ts} +3 -4
- package/dist/{label-CCHbfQW8.js → label-B6vXvwLM.js} +3 -3
- package/dist/{label-CCHbfQW8.js.map → label-B6vXvwLM.js.map} +1 -1
- package/dist/logger/DefaultLogger.d.ts +66 -3
- package/dist/logger/DefaultLogger.js +21 -36
- package/dist/logger/ILogger.d.ts +64 -2
- package/dist/logger/ILogger.js +0 -1
- package/dist/logger/Logger.d.ts +36 -3
- package/dist/logger/Logger.js +21 -36
- package/dist/logger/NoopLogger.d.ts +36 -37
- package/dist/{media-gallery-DalbYf1v.d.ts → media-gallery-Ci3I4ElH.d.ts} +1 -2
- package/dist/{media-gallery-DdU7o9Cf.js → media-gallery-u3gjX7yD.js} +2 -2
- package/dist/{media-gallery-DdU7o9Cf.js.map → media-gallery-u3gjX7yD.js.map} +1 -1
- package/dist/plugins/CompilerPlugin.d.ts +1 -33
- package/dist/plugins/CompilerPlugin.js +1 -2
- package/dist/plugins/PluginCommon.d.ts +1 -33
- package/dist/plugins/PluginCommon.js +1 -1
- package/dist/plugins/RuntimePlugin.d.ts +1 -33
- package/dist/plugins/RuntimePlugin.js +1 -2
- package/dist/plugins/index.d.ts +1 -33
- package/dist/plugins/index.js +23 -36
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +1 -33
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +21 -36
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +1 -33
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js +21 -36
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +1 -33
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +21 -36
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +1 -33
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +21 -36
- package/dist/plugins/plugin-runtime/runtime.d.ts +1 -33
- package/dist/plugins/plugin-runtime/runtime.js +0 -1
- package/dist/plugins/types.d.ts +1 -33
- package/dist/plugins/types.js +0 -1
- package/dist/{poll-6lSMoohv.js → poll-CFe8yvoJ.js} +12 -12
- package/dist/{poll-6lSMoohv.js.map → poll-CFe8yvoJ.js.map} +1 -1
- package/dist/{poll-Bo-skHvn.d.ts → poll-Ddtapd6n.d.ts} +7 -8
- package/dist/{resolve-file-url-CJoD0FAn.js → resolve-file-url-CdHqwWs3.js} +2 -2
- package/dist/{resolve-file-url-CJoD0FAn.js.map → resolve-file-url-CdHqwWs3.js.map} +1 -1
- package/dist/{section-C4qfgzOQ.js → section-BC8LF-B2.js} +2 -2
- package/dist/{section-C4qfgzOQ.js.map → section-BC8LF-B2.js.map} +1 -1
- package/dist/{section-CszS2hd5.d.ts → section-DkUKULnB.d.ts} +1 -2
- package/dist/{separator-CsoRs1aX.js → separator-BUTiW7uz.js} +2 -2
- package/dist/{separator-CsoRs1aX.js.map → separator-BUTiW7uz.js.map} +1 -1
- package/dist/{separator-DfRlVHne.d.ts → separator-CbXsIFCa.d.ts} +1 -2
- package/dist/{signals-C2Ly0wDt.js → signals-B8z1wJ6W.js} +2 -2
- package/dist/{signals-C2Ly0wDt.js.map → signals-B8z1wJ6W.js.map} +1 -1
- package/dist/{signals-DeafthGG.d.ts → signals-BbTgTc0i.d.ts} +1 -1
- package/dist/{store-GrsErvli.js → store-D8r_hryO.js} +2 -2
- package/dist/{store-GrsErvli.js.map → store-D8r_hryO.js.map} +1 -1
- package/dist/{text-display-DvydvE0D.d.ts → text-display-D7j39VC-.d.ts} +1 -2
- package/dist/{text-display-C0oSz5y0.js → text-display-DANahMN3.js} +2 -2
- package/dist/{text-display-C0oSz5y0.js.map → text-display-DANahMN3.js.map} +1 -1
- package/dist/{type-checker-CEt5Inbw.js → type-checker-cVd3Hpnh.js} +4 -4
- package/dist/{type-checker-CEt5Inbw.js.map → type-checker-cVd3Hpnh.js.map} +1 -1
- package/dist/{types-CQwntdAo.d.ts → types-BywA9d2Z.d.ts} +1 -1
- package/dist/{types-package-BxIhhZgZ.js → types-package-CsTNfvv2.js} +2 -2
- package/dist/{types-package-BxIhhZgZ.js.map → types-package-CsTNfvv2.js.map} +1 -1
- package/dist/types.d.ts +1 -33
- package/dist/utils/colors.js +1 -1
- package/dist/utils/constants.d.ts +1 -1
- package/dist/utils/dev-hooks.d.ts +1 -33
- package/dist/utils/dev-hooks.js +21 -36
- package/dist/utils/error-codes.d.ts +54 -2
- package/dist/utils/resolve-file-url.d.ts +11 -2
- package/dist/utils/resolve-file-url.js +1 -1
- package/dist/utils/types-package.js +1 -1
- package/dist/utils/useful-stuff/async-queue.d.ts +21 -21
- package/dist/utils/useful-stuff/mutex.d.ts +62 -62
- package/dist/utils/useful-stuff/ratelimiter.d.ts +56 -56
- package/dist/utils/useful-stuff/ratelimiter.js.map +1 -1
- package/dist/utils/useful-stuff/semaphore.d.ts +82 -82
- package/dist/utils/utilities.d.ts +113 -2
- package/dist/utils/utilities.js +21 -36
- package/dist/utils/warning.d.ts +25 -2
- package/dist/utils-Br3eenD1.js.map +1 -1
- package/dist/version.d.ts +8 -2
- package/dist/version.js +12 -2
- package/dist/version.js.map +1 -0
- package/dist/warning-CszH8HeS.js.map +1 -1
- package/package.json +5 -5
- package/dist/DefaultLogger-CgCFHJ4J.d.ts +0 -67
- package/dist/EventWorkerContext-CNPnDdUZ.d.ts +0 -43
- package/dist/ILogger-B-vsuZ1C.d.ts +0 -64
- package/dist/ILogger-B0q7p7L1.js +0 -0
- package/dist/Logger-BmHeS1Qd.d.ts +0 -37
- package/dist/MessageCommandParser-JmJWga4L.d.ts +0 -195
- package/dist/app-CrjK9yWX.js +0 -0
- package/dist/app-process-DCkz7RlU.js +0 -65
- package/dist/app-process-DCkz7RlU.js.map +0 -1
- package/dist/build-CaoHQPvm.js +0 -169
- package/dist/build-CaoHQPvm.js.map +0 -1
- package/dist/config-2prRz7_7.d.ts +0 -16
- package/dist/constants-Dy6P2veX.js +0 -27
- package/dist/dotprops-Dp98nRuu.js +0 -36
- package/dist/dotprops-Dp98nRuu.js.map +0 -1
- package/dist/error-codes-BuWUNGpX.d.ts +0 -54
- package/dist/feature-flags-BRF8OH7U.js +0 -160
- package/dist/feature-flags-BRF8OH7U.js.map +0 -1
- package/dist/resolve-file-url-B63_4Wm3.d.ts +0 -11
- package/dist/serde-CqUxaQUh.js +0 -97
- package/dist/serde-CqUxaQUh.js.map +0 -1
- package/dist/serde-DR1JEtRZ.d.ts +0 -12
- package/dist/utilities-BV9Osg71.d.ts +0 -113
- package/dist/utils-DGovVwyA.js +0 -23
- package/dist/utils-DGovVwyA.js.map +0 -1
- package/dist/version-BKZNlkbA.d.ts +0 -8
- package/dist/version-DGfGT6Tx.js +0 -18
- package/dist/version-DGfGT6Tx.js.map +0 -1
- package/dist/warning-BucG024D.d.ts +0 -25
- /package/dist/{index-B5F3AfVc.d.ts → index-BJfko-dP.d.ts} +0 -0
- /package/dist/{index-BLwMeReG.d.ts → index-CCggO_hw.d.ts} +0 -0
- /package/dist/{index-h64gcVNJ.d.ts → index-CLjpoGi1.d.ts} +0 -0
|
@@ -13,23 +13,23 @@ declare const DEFAULT_MAX_REQUESTS = 10;
|
|
|
13
13
|
*/
|
|
14
14
|
interface RateLimitStorage {
|
|
15
15
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
* Retrieves the current request count for a given key
|
|
17
|
+
* @param key - The unique identifier for the rate limit entry
|
|
18
|
+
* @returns Promise resolving to the current request count
|
|
19
|
+
*/
|
|
20
20
|
get(key: string): Promise<number>;
|
|
21
21
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
* Sets the request count for a given key
|
|
23
|
+
* @param key - The unique identifier for the rate limit entry
|
|
24
|
+
* @param value - The request count to store
|
|
25
|
+
* @returns Promise that resolves when the value is stored
|
|
26
|
+
*/
|
|
27
27
|
set(key: string, value: number): Promise<void>;
|
|
28
28
|
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
* Deletes the rate limit entry for a given key
|
|
30
|
+
* @param key - The unique identifier for the rate limit entry
|
|
31
|
+
* @returns Promise that resolves when the entry is deleted
|
|
32
|
+
*/
|
|
33
33
|
delete(key: string): Promise<void>;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
@@ -50,23 +50,23 @@ interface RateLimitOptions {
|
|
|
50
50
|
declare class MemoryRateLimitStorage implements RateLimitStorage {
|
|
51
51
|
private readonly store;
|
|
52
52
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
* Retrieves the current request count for a given key
|
|
54
|
+
* @param key - The unique identifier for the rate limit entry
|
|
55
|
+
* @returns Promise resolving to the current request count or 0 if not found
|
|
56
|
+
*/
|
|
57
57
|
get(key: string): Promise<number>;
|
|
58
58
|
/**
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
* Sets the request count for a given key
|
|
60
|
+
* @param key - The unique identifier for the rate limit entry
|
|
61
|
+
* @param value - The request count to store
|
|
62
|
+
* @returns Promise that resolves immediately
|
|
63
|
+
*/
|
|
64
64
|
set(key: string, value: number): Promise<void>;
|
|
65
65
|
/**
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
* Deletes the rate limit entry for a given key
|
|
67
|
+
* @param key - The unique identifier for the rate limit entry
|
|
68
|
+
* @returns Promise that resolves immediately
|
|
69
|
+
*/
|
|
70
70
|
delete(key: string): Promise<void>;
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
@@ -81,50 +81,50 @@ declare class RateLimiter {
|
|
|
81
81
|
private readonly lastReset;
|
|
82
82
|
private readonly resetInterval;
|
|
83
83
|
/**
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
* Creates a new rate limiter instance
|
|
85
|
+
* @param maxRequests - Maximum number of requests allowed per interval (default: 10)
|
|
86
|
+
* @param interval - Time interval in milliseconds for the rate limit window (default: 60000)
|
|
87
|
+
* @param storage - Optional storage implementation (default: MemoryRateLimitStorage)
|
|
88
|
+
*/
|
|
89
89
|
constructor(maxRequests?: number, interval?: number, storage?: RateLimitStorage);
|
|
90
90
|
/**
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
* Sets the storage implementation for the rate limiter
|
|
92
|
+
* @param storage - The storage implementation to use
|
|
93
|
+
*/
|
|
94
94
|
setStorage(storage: RateLimitStorage): void;
|
|
95
95
|
/**
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
* Gets the storage implementation for the rate limiter
|
|
97
|
+
* @returns The storage implementation
|
|
98
|
+
*/
|
|
99
99
|
getStorage(): RateLimitStorage;
|
|
100
100
|
/**
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
* Checks if a request is allowed for the given key and increments the counter if allowed
|
|
102
|
+
* @param key - The unique identifier for the rate limit entry
|
|
103
|
+
* @returns Promise resolving to true if the request is allowed, false if rate limited
|
|
104
|
+
*/
|
|
105
105
|
limit(key: string): Promise<boolean>;
|
|
106
106
|
/**
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
* Gets the remaining requests allowed for a given key
|
|
108
|
+
* @param key - The unique identifier for the rate limit entry
|
|
109
|
+
* @returns Promise resolving to the number of remaining requests
|
|
110
|
+
*/
|
|
111
111
|
getRemaining(key: string): Promise<number>;
|
|
112
112
|
/**
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
* Gets the time until the rate limit resets for a given key
|
|
114
|
+
* @param key - The unique identifier for the rate limit entry
|
|
115
|
+
* @returns Promise resolving to the time in milliseconds until reset, or 0 if no limit is active
|
|
116
|
+
*/
|
|
117
117
|
getResetTime(key: string): Promise<number>;
|
|
118
118
|
/**
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
* Resets the rate limit for a given key
|
|
120
|
+
* @param key - The unique identifier for the rate limit entry
|
|
121
|
+
* @returns Promise that resolves when the reset is complete
|
|
122
|
+
*/
|
|
123
123
|
reset(key: string): Promise<void>;
|
|
124
124
|
/**
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
* Gets the current configuration of the rate limiter
|
|
126
|
+
* @returns Object containing the current maxRequests and interval values
|
|
127
|
+
*/
|
|
128
128
|
getConfig(): Omit<RateLimitOptions, 'storage'>;
|
|
129
129
|
}
|
|
130
130
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ratelimiter.js","names":[],"sources":["../../../src/utils/useful-stuff/ratelimiter.ts"],"sourcesContent":["/**\n * Default timeout interval for rate limiting in milliseconds\n */\nexport const DEFAULT_TIMEOUT = 60000;\n\n/**\n * Default maximum number of requests allowed per interval\n */\nexport const DEFAULT_MAX_REQUESTS = 10;\n\n/**\n * Interface for rate limit storage implementations.\n * Provides methods to store, retrieve, and delete rate limit data.\n */\nexport interface RateLimitStorage {\n /**\n * Retrieves the current request count for a given key\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise resolving to the current request count\n */\n get(key: string): Promise<number>;\n\n /**\n * Sets the request count for a given key\n * @param key - The unique identifier for the rate limit entry\n * @param value - The request count to store\n * @returns Promise that resolves when the value is stored\n */\n set(key: string, value: number): Promise<void>;\n\n /**\n * Deletes the rate limit entry for a given key\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise that resolves when the entry is deleted\n */\n delete(key: string): Promise<void>;\n}\n\n/**\n * Configuration options for rate limiting\n */\nexport interface RateLimitOptions {\n /** Maximum number of requests allowed per interval. Default: 10 */\n maxRequests?: number;\n /** Time interval in milliseconds for the rate limit window. Default: 60000 */\n interval?: number;\n /** Storage implementation for persisting rate limit data. Default: {@link MemoryRateLimitStorage} */\n storage?: RateLimitStorage;\n}\n\n/**\n * In-memory storage implementation for rate limiting.\n * Suitable for single-instance applications.\n */\nexport class MemoryRateLimitStorage implements RateLimitStorage {\n private readonly store = new Map<string, number>();\n\n /**\n * Retrieves the current request count for a given key\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise resolving to the current request count or 0 if not found\n */\n async get(key: string): Promise<number> {\n return this.store.get(key) || 0;\n }\n\n /**\n * Sets the request count for a given key\n * @param key - The unique identifier for the rate limit entry\n * @param value - The request count to store\n * @returns Promise that resolves immediately\n */\n async set(key: string, value: number): Promise<void> {\n this.store.set(key, value);\n }\n\n /**\n * Deletes the rate limit entry for a given key\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise that resolves immediately\n */\n async delete(key: string): Promise<void> {\n this.store.delete(key);\n }\n}\n\n/**\n * Rate limiter implementation that enforces request limits per key.\n * Supports configurable request limits and time intervals.\n */\nexport class RateLimiter {\n private readonly limits: Map<string, number> = new Map();\n private readonly lastReset: Map<string, number> = new Map();\n private readonly resetInterval: number;\n\n /**\n * Creates a new rate limiter instance\n * @param maxRequests - Maximum number of requests allowed per interval (default: 10)\n * @param interval - Time interval in milliseconds for the rate limit window (default: 60000)\n * @param storage - Optional storage implementation (default: MemoryRateLimitStorage)\n */\n public constructor(\n private readonly maxRequests: number = DEFAULT_MAX_REQUESTS,\n private readonly interval: number = DEFAULT_TIMEOUT,\n private storage: RateLimitStorage = new MemoryRateLimitStorage(),\n ) {\n this.resetInterval = interval;\n }\n\n /**\n * Sets the storage implementation for the rate limiter\n * @param storage - The storage implementation to use\n */\n public setStorage(storage: RateLimitStorage) {\n this.storage = storage;\n }\n\n /**\n * Gets the storage implementation for the rate limiter\n * @returns The storage implementation\n */\n public getStorage(): RateLimitStorage {\n return this.storage;\n }\n\n /**\n * Checks if a request is allowed for the given key and increments the counter if allowed\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise resolving to true if the request is allowed, false if rate limited\n */\n public async limit(key: string): Promise<boolean> {\n const now = Date.now();\n const lastReset = this.lastReset.get(key) || 0;\n const timeSinceReset = now - lastReset;\n\n // Reset counter if interval has passed\n if (timeSinceReset > this.resetInterval) {\n await this.storage.delete(key);\n this.lastReset.set(key, now);\n this.limits.set(key, 0);\n }\n\n // Get current count from storage\n const currentCount = await this.storage.get(key);\n\n // Check if limit exceeded\n if (currentCount >= this.maxRequests) {\n return false;\n }\n\n // Increment counter\n const newCount = currentCount + 1;\n await this.storage.set(key, newCount);\n this.limits.set(key, newCount);\n\n return true;\n }\n\n /**\n * Gets the remaining requests allowed for a given key\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise resolving to the number of remaining requests\n */\n public async getRemaining(key: string): Promise<number> {\n const currentCount = await this.storage.get(key);\n return Math.max(0, this.maxRequests - currentCount);\n }\n\n /**\n * Gets the time until the rate limit resets for a given key\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise resolving to the time in milliseconds until reset, or 0 if no limit is active\n */\n public async getResetTime(key: string): Promise<number> {\n const lastReset = this.lastReset.get(key) || 0;\n const now = Date.now();\n const timeSinceReset = now - lastReset;\n\n if (timeSinceReset >= this.resetInterval) {\n return 0;\n }\n\n return this.resetInterval - timeSinceReset;\n }\n\n /**\n * Resets the rate limit for a given key\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise that resolves when the reset is complete\n */\n public async reset(key: string): Promise<void> {\n await this.storage.delete(key);\n this.limits.delete(key);\n this.lastReset.delete(key);\n }\n\n /**\n * Gets the current configuration of the rate limiter\n * @returns Object containing the current maxRequests and interval values\n */\n public getConfig(): Omit<RateLimitOptions, 'storage'> {\n return {\n maxRequests: this.maxRequests,\n interval: this.interval,\n };\n }\n}\n\n/**\n * Default rate limiter instance for global use\n */\nexport const defaultRateLimiter = new RateLimiter();\n\n/**\n * Convenience function to check if a request is allowed for a given key.\n * Uses the default rate limiter instance.\n *\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise resolving to true if the request is allowed, false if rate limited\n *\n * @example\n * ```typescript\n * const allowed = await ratelimit('user:123');\n * // update the default rate limiter config\n * import { defaultRateLimiter } from 'commandkit/ratelimit';\n *\n * // update max allowed requests\n * defaultRateLimiter.setMaxRequests(10);\n *\n * // update the timeout interval\n * defaultRateLimiter.setInterval(30000);\n *\n * // update the storage implementation\n * defaultRateLimiter.setStorage(new RedisStorage());\n * ```\n */\nexport async function ratelimit(key: string): Promise<boolean> {\n return defaultRateLimiter.limit(key);\n}\n\n/**\n * Creates a new rate limiter instance with the specified configuration\n * @param options - Configuration options for the rate limiter\n * @returns New RateLimiter instance\n *\n * @example\n * ```typescript\n * const limiter = createRateLimiter({\n * maxRequests: 5,\n * interval: 30000,\n * storage: new CustomStorage()\n * });\n * ```\n */\nexport function createRateLimiter(options: RateLimitOptions): RateLimiter {\n return new RateLimiter(\n options.maxRequests,\n options.interval,\n options.storage,\n );\n}\n\n/**\n * Gets the remaining requests for a key using the default rate limiter\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise resolving to the number of remaining requests\n */\nexport async function getRemainingRequests(key: string): Promise<number> {\n return defaultRateLimiter.getRemaining(key);\n}\n\n/**\n * Gets the reset time for a key using the default rate limiter\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise resolving to the time in milliseconds until reset\n */\nexport async function getResetTime(key: string): Promise<number> {\n return defaultRateLimiter.getResetTime(key);\n}\n\n/**\n * Resets the rate limit for a key using the default rate limiter\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise that resolves when the reset is complete\n */\nexport async function resetRateLimit(key: string): Promise<void> {\n return defaultRateLimiter.reset(key);\n}\n"],"mappings":";;;;;AAGA,MAAa,kBAAkB;;;;AAK/B,MAAa,uBAAuB;;;;;AA8CpC,IAAa,yBAAb,MAAgE;CAC9D,AAAiB,wBAAQ,IAAI,KAAqB;;;;;;CAOlD,MAAM,IAAI,KAA8B;AACtC,SAAO,KAAK,MAAM,IAAI,IAAI,IAAI;;;;;;;;CAShC,MAAM,IAAI,KAAa,OAA8B;AACnD,OAAK,MAAM,IAAI,KAAK,MAAM;;;;;;;CAQ5B,MAAM,OAAO,KAA4B;AACvC,OAAK,MAAM,OAAO,IAAI;;;;;;;AAQ1B,IAAa,cAAb,MAAyB;CACvB,AAAiB,yBAA8B,IAAI,KAAK;CACxD,AAAiB,4BAAiC,IAAI,KAAK;CAC3D,AAAiB;;;;;;;CAQjB,AAAO,YACP,AAAiB,cAAsB,sBACvC,AAAiB,WAAmB,iBACpC,AAAQ,UAA4B,IAAI,wBAAwB,EAChE;EAHiB;EACA;EACT;AAEN,OAAK,gBAAgB;;;;;;CAOvB,AAAO,WAAW,SAA2B;AAC3C,OAAK,UAAU;;;;;;CAOjB,AAAO,aAA+B;AACpC,SAAO,KAAK;;;;;;;CAQd,MAAa,MAAM,KAA+B;EAChD,MAAM,MAAM,KAAK,KAAK;AAKtB,MAHuB,OADL,KAAK,UAAU,IAAI,IAAI,IAAI,KAIxB,KAAK,eAAe;AACvC,SAAM,KAAK,QAAQ,OAAO,IAAI;AAC9B,QAAK,UAAU,IAAI,KAAK,IAAI;AAC5B,QAAK,OAAO,IAAI,KAAK,EAAE;;EAIzB,MAAM,eAAe,MAAM,KAAK,QAAQ,IAAI,IAAI;AAGhD,MAAI,gBAAgB,KAAK,YACvB,QAAO;EAIT,MAAM,WAAW,eAAe;AAChC,QAAM,KAAK,QAAQ,IAAI,KAAK,SAAS;AACrC,OAAK,OAAO,IAAI,KAAK,SAAS;AAE9B,SAAO;;;;;;;CAQT,MAAa,aAAa,KAA8B;EACtD,MAAM,eAAe,MAAM,KAAK,QAAQ,IAAI,IAAI;AAChD,SAAO,KAAK,IAAI,GAAG,KAAK,cAAc,aAAa;;;;;;;CAQrD,MAAa,aAAa,KAA8B;EACtD,MAAM,YAAY,KAAK,UAAU,IAAI,IAAI,IAAI;EAE7C,MAAM,iBADM,KAAK,KAAK,GACO;AAE7B,MAAI,kBAAkB,KAAK,cACzB,QAAO;AAGT,SAAO,KAAK,gBAAgB;;;;;;;CAQ9B,MAAa,MAAM,KAA4B;AAC7C,QAAM,KAAK,QAAQ,OAAO,IAAI;AAC9B,OAAK,OAAO,OAAO,IAAI;AACvB,OAAK,UAAU,OAAO,IAAI;;;;;;CAO5B,AAAO,YAA+C;AACpD,SAAO;GACL,aAAa,KAAK;GAClB,UAAU,KAAK;GAChB;;;;;;AAOL,MAAa,qBAAqB,IAAI,aAAa;;;;;;;;;;;;;;;;;;;;;;;;AAyBnD,eAAsB,UAAU,KAA+B;AAC7D,QAAO,mBAAmB,MAAM,IAAI;;;;;;;;;;;;;;;;AAiBtC,SAAgB,kBAAkB,SAAwC;AACxE,QAAO,IAAI,YACT,QAAQ,aACR,QAAQ,UACR,QAAQ,QACT;;;;;;;AAQH,eAAsB,qBAAqB,KAA8B;AACvE,QAAO,mBAAmB,aAAa,IAAI;;;;;;;AAQ7C,eAAsB,aAAa,KAA8B;AAC/D,QAAO,mBAAmB,aAAa,IAAI;;;;;;;AAQ7C,eAAsB,eAAe,KAA4B;AAC/D,QAAO,mBAAmB,MAAM,IAAI"}
|
|
1
|
+
{"version":3,"file":"ratelimiter.js","names":[],"sources":["../../../src/utils/useful-stuff/ratelimiter.ts"],"sourcesContent":["/**\n * Default timeout interval for rate limiting in milliseconds\n */\nexport const DEFAULT_TIMEOUT = 60000;\n\n/**\n * Default maximum number of requests allowed per interval\n */\nexport const DEFAULT_MAX_REQUESTS = 10;\n\n/**\n * Interface for rate limit storage implementations.\n * Provides methods to store, retrieve, and delete rate limit data.\n */\nexport interface RateLimitStorage {\n /**\n * Retrieves the current request count for a given key\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise resolving to the current request count\n */\n get(key: string): Promise<number>;\n\n /**\n * Sets the request count for a given key\n * @param key - The unique identifier for the rate limit entry\n * @param value - The request count to store\n * @returns Promise that resolves when the value is stored\n */\n set(key: string, value: number): Promise<void>;\n\n /**\n * Deletes the rate limit entry for a given key\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise that resolves when the entry is deleted\n */\n delete(key: string): Promise<void>;\n}\n\n/**\n * Configuration options for rate limiting\n */\nexport interface RateLimitOptions {\n /** Maximum number of requests allowed per interval. Default: 10 */\n maxRequests?: number;\n /** Time interval in milliseconds for the rate limit window. Default: 60000 */\n interval?: number;\n /** Storage implementation for persisting rate limit data. Default: {@link MemoryRateLimitStorage} */\n storage?: RateLimitStorage;\n}\n\n/**\n * In-memory storage implementation for rate limiting.\n * Suitable for single-instance applications.\n */\nexport class MemoryRateLimitStorage implements RateLimitStorage {\n private readonly store = new Map<string, number>();\n\n /**\n * Retrieves the current request count for a given key\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise resolving to the current request count or 0 if not found\n */\n async get(key: string): Promise<number> {\n return this.store.get(key) || 0;\n }\n\n /**\n * Sets the request count for a given key\n * @param key - The unique identifier for the rate limit entry\n * @param value - The request count to store\n * @returns Promise that resolves immediately\n */\n async set(key: string, value: number): Promise<void> {\n this.store.set(key, value);\n }\n\n /**\n * Deletes the rate limit entry for a given key\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise that resolves immediately\n */\n async delete(key: string): Promise<void> {\n this.store.delete(key);\n }\n}\n\n/**\n * Rate limiter implementation that enforces request limits per key.\n * Supports configurable request limits and time intervals.\n */\nexport class RateLimiter {\n private readonly limits: Map<string, number> = new Map();\n private readonly lastReset: Map<string, number> = new Map();\n private readonly resetInterval: number;\n\n /**\n * Creates a new rate limiter instance\n * @param maxRequests - Maximum number of requests allowed per interval (default: 10)\n * @param interval - Time interval in milliseconds for the rate limit window (default: 60000)\n * @param storage - Optional storage implementation (default: MemoryRateLimitStorage)\n */\n public constructor(\n private readonly maxRequests: number = DEFAULT_MAX_REQUESTS,\n private readonly interval: number = DEFAULT_TIMEOUT,\n private storage: RateLimitStorage = new MemoryRateLimitStorage(),\n ) {\n this.resetInterval = interval;\n }\n\n /**\n * Sets the storage implementation for the rate limiter\n * @param storage - The storage implementation to use\n */\n public setStorage(storage: RateLimitStorage) {\n this.storage = storage;\n }\n\n /**\n * Gets the storage implementation for the rate limiter\n * @returns The storage implementation\n */\n public getStorage(): RateLimitStorage {\n return this.storage;\n }\n\n /**\n * Checks if a request is allowed for the given key and increments the counter if allowed\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise resolving to true if the request is allowed, false if rate limited\n */\n public async limit(key: string): Promise<boolean> {\n const now = Date.now();\n const lastReset = this.lastReset.get(key) || 0;\n const timeSinceReset = now - lastReset;\n\n // Reset counter if interval has passed\n if (timeSinceReset > this.resetInterval) {\n await this.storage.delete(key);\n this.lastReset.set(key, now);\n this.limits.set(key, 0);\n }\n\n // Get current count from storage\n const currentCount = await this.storage.get(key);\n\n // Check if limit exceeded\n if (currentCount >= this.maxRequests) {\n return false;\n }\n\n // Increment counter\n const newCount = currentCount + 1;\n await this.storage.set(key, newCount);\n this.limits.set(key, newCount);\n\n return true;\n }\n\n /**\n * Gets the remaining requests allowed for a given key\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise resolving to the number of remaining requests\n */\n public async getRemaining(key: string): Promise<number> {\n const currentCount = await this.storage.get(key);\n return Math.max(0, this.maxRequests - currentCount);\n }\n\n /**\n * Gets the time until the rate limit resets for a given key\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise resolving to the time in milliseconds until reset, or 0 if no limit is active\n */\n public async getResetTime(key: string): Promise<number> {\n const lastReset = this.lastReset.get(key) || 0;\n const now = Date.now();\n const timeSinceReset = now - lastReset;\n\n if (timeSinceReset >= this.resetInterval) {\n return 0;\n }\n\n return this.resetInterval - timeSinceReset;\n }\n\n /**\n * Resets the rate limit for a given key\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise that resolves when the reset is complete\n */\n public async reset(key: string): Promise<void> {\n await this.storage.delete(key);\n this.limits.delete(key);\n this.lastReset.delete(key);\n }\n\n /**\n * Gets the current configuration of the rate limiter\n * @returns Object containing the current maxRequests and interval values\n */\n public getConfig(): Omit<RateLimitOptions, 'storage'> {\n return {\n maxRequests: this.maxRequests,\n interval: this.interval,\n };\n }\n}\n\n/**\n * Default rate limiter instance for global use\n */\nexport const defaultRateLimiter = new RateLimiter();\n\n/**\n * Convenience function to check if a request is allowed for a given key.\n * Uses the default rate limiter instance.\n *\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise resolving to true if the request is allowed, false if rate limited\n *\n * @example\n * ```typescript\n * const allowed = await ratelimit('user:123');\n * // update the default rate limiter config\n * import { defaultRateLimiter } from 'commandkit/ratelimit';\n *\n * // update max allowed requests\n * defaultRateLimiter.setMaxRequests(10);\n *\n * // update the timeout interval\n * defaultRateLimiter.setInterval(30000);\n *\n * // update the storage implementation\n * defaultRateLimiter.setStorage(new RedisStorage());\n * ```\n */\nexport async function ratelimit(key: string): Promise<boolean> {\n return defaultRateLimiter.limit(key);\n}\n\n/**\n * Creates a new rate limiter instance with the specified configuration\n * @param options - Configuration options for the rate limiter\n * @returns New RateLimiter instance\n *\n * @example\n * ```typescript\n * const limiter = createRateLimiter({\n * maxRequests: 5,\n * interval: 30000,\n * storage: new CustomStorage()\n * });\n * ```\n */\nexport function createRateLimiter(options: RateLimitOptions): RateLimiter {\n return new RateLimiter(\n options.maxRequests,\n options.interval,\n options.storage,\n );\n}\n\n/**\n * Gets the remaining requests for a key using the default rate limiter\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise resolving to the number of remaining requests\n */\nexport async function getRemainingRequests(key: string): Promise<number> {\n return defaultRateLimiter.getRemaining(key);\n}\n\n/**\n * Gets the reset time for a key using the default rate limiter\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise resolving to the time in milliseconds until reset\n */\nexport async function getResetTime(key: string): Promise<number> {\n return defaultRateLimiter.getResetTime(key);\n}\n\n/**\n * Resets the rate limit for a key using the default rate limiter\n * @param key - The unique identifier for the rate limit entry\n * @returns Promise that resolves when the reset is complete\n */\nexport async function resetRateLimit(key: string): Promise<void> {\n return defaultRateLimiter.reset(key);\n}\n"],"mappings":";;;;;AAGA,MAAa,kBAAkB;;;;AAK/B,MAAa,uBAAuB;;;;;AA8CpC,IAAa,yBAAb,MAAgE;CAC9D,AAAiB,wBAAQ,IAAI,KAAqB;;;;;;CAOlD,MAAM,IAAI,KAA8B;AACtC,SAAO,KAAK,MAAM,IAAI,IAAI,IAAI;;;;;;;;CAShC,MAAM,IAAI,KAAa,OAA8B;AACnD,OAAK,MAAM,IAAI,KAAK,MAAM;;;;;;;CAQ5B,MAAM,OAAO,KAA4B;AACvC,OAAK,MAAM,OAAO,IAAI;;;;;;;AAQ1B,IAAa,cAAb,MAAyB;CACvB,AAAiB,yBAA8B,IAAI,KAAK;CACxD,AAAiB,4BAAiC,IAAI,KAAK;CAC3D,AAAiB;;;;;;;CAQjB,AAAO,YACP,AAAU,cAA6B,sBACvC,AAAU,WAA0B,iBACpC,AAAE,UAAkC,IAAE,wBAA0B,EAChE;EAHU;EACA;EACR;AAEA,OAAK,gBAAgB;;;;;;CAOvB,AAAO,WAAW,SAA2B;AAC3C,OAAK,UAAU;;;;;;CAOjB,AAAO,aAA+B;AACpC,SAAO,KAAK;;;;;;;CAQd,MAAa,MAAM,KAA+B;EAChD,MAAM,MAAM,KAAK,KAAK;AAKtB,MAHuB,OADL,KAAK,UAAU,IAAI,IAAI,IAAI,KAIxB,KAAK,eAAe;AACvC,SAAM,KAAK,QAAQ,OAAO,IAAI;AAC9B,QAAK,UAAU,IAAI,KAAK,IAAI;AAC5B,QAAK,OAAO,IAAI,KAAK,EAAE;;EAIzB,MAAM,eAAe,MAAM,KAAK,QAAQ,IAAI,IAAI;AAGhD,MAAI,gBAAgB,KAAK,YACvB,QAAO;EAIT,MAAM,WAAW,eAAe;AAChC,QAAM,KAAK,QAAQ,IAAI,KAAK,SAAS;AACrC,OAAK,OAAO,IAAI,KAAK,SAAS;AAE9B,SAAO;;;;;;;CAQT,MAAa,aAAa,KAA8B;EACtD,MAAM,eAAe,MAAM,KAAK,QAAQ,IAAI,IAAI;AAChD,SAAO,KAAK,IAAI,GAAG,KAAK,cAAc,aAAa;;;;;;;CAQrD,MAAa,aAAa,KAA8B;EACtD,MAAM,YAAY,KAAK,UAAU,IAAI,IAAI,IAAI;EAE7C,MAAM,iBADM,KAAK,KAAK,GACO;AAE7B,MAAI,kBAAkB,KAAK,cACzB,QAAO;AAGT,SAAO,KAAK,gBAAgB;;;;;;;CAQ9B,MAAa,MAAM,KAA4B;AAC7C,QAAM,KAAK,QAAQ,OAAO,IAAI;AAC9B,OAAK,OAAO,OAAO,IAAI;AACvB,OAAK,UAAU,OAAO,IAAI;;;;;;CAO5B,AAAO,YAA+C;AACpD,SAAO;GACL,aAAa,KAAK;GAClB,UAAU,KAAK;GAChB;;;;;;AAOL,MAAa,qBAAqB,IAAI,aAAa;;;;;;;;;;;;;;;;;;;;;;;;AAyBnD,eAAsB,UAAU,KAA+B;AAC7D,QAAO,mBAAmB,MAAM,IAAI;;;;;;;;;;;;;;;;AAiBtC,SAAgB,kBAAkB,SAAwC;AACxE,QAAO,IAAI,YACT,QAAQ,aACR,QAAQ,UACR,QAAQ,QACT;;;;;;;AAQH,eAAsB,qBAAqB,KAA8B;AACvE,QAAO,mBAAmB,aAAa,IAAI;;;;;;;AAQ7C,eAAsB,aAAa,KAA8B;AAC/D,QAAO,mBAAmB,aAAa,IAAI;;;;;;;AAQ7C,eAAsB,eAAe,KAA4B;AAC/D,QAAO,mBAAmB,MAAM,IAAI"}
|
|
@@ -9,30 +9,30 @@
|
|
|
9
9
|
*/
|
|
10
10
|
interface SemaphoreStorage {
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
* Attempts to acquire a permit for a given key
|
|
13
|
+
* @param key - The unique identifier for the semaphore
|
|
14
|
+
* @param timeout - Optional timeout in milliseconds for permit acquisition
|
|
15
|
+
* @param signal - Optional AbortSignal for cancelling the acquisition
|
|
16
|
+
* @returns Promise resolving to true if permit was acquired, false if timeout or no permits available
|
|
17
|
+
*/
|
|
18
18
|
acquire(key: string, timeout?: number, signal?: AbortSignal): Promise<boolean>;
|
|
19
19
|
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
* Releases a permit for a given key
|
|
21
|
+
* @param key - The unique identifier for the semaphore
|
|
22
|
+
* @returns Promise that resolves when the permit is released
|
|
23
|
+
*/
|
|
24
24
|
release(key: string): Promise<void>;
|
|
25
25
|
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
* Gets the number of available permits for a given key
|
|
27
|
+
* @param key - The unique identifier for the semaphore
|
|
28
|
+
* @returns Promise resolving to the number of available permits
|
|
29
|
+
*/
|
|
30
30
|
getAvailablePermits(key: string): Promise<number>;
|
|
31
31
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
* Gets the total number of permits for a given key
|
|
33
|
+
* @param key - The unique identifier for the semaphore
|
|
34
|
+
* @returns Promise resolving to the total number of permits
|
|
35
|
+
*/
|
|
36
36
|
getTotalPermits(key: string): Promise<number>;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
@@ -53,36 +53,36 @@ interface SemaphoreOptions {
|
|
|
53
53
|
declare class MemorySemaphoreStorage implements SemaphoreStorage {
|
|
54
54
|
private readonly semaphores;
|
|
55
55
|
/**
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
* Attempts to acquire a permit for a given key
|
|
57
|
+
* @param key - The unique identifier for the semaphore
|
|
58
|
+
* @param timeout - Optional timeout in milliseconds for permit acquisition
|
|
59
|
+
* @param signal - Optional AbortSignal for cancelling the acquisition
|
|
60
|
+
* @returns Promise resolving to true if permit was acquired, false if timeout or no permits available
|
|
61
|
+
*/
|
|
62
62
|
acquire(key: string, timeout?: number, signal?: AbortSignal): Promise<boolean>;
|
|
63
63
|
/**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
* Releases a permit for a given key
|
|
65
|
+
* @param key - The unique identifier for the semaphore
|
|
66
|
+
* @returns Promise that resolves when the permit is released
|
|
67
|
+
*/
|
|
68
68
|
release(key: string): Promise<void>;
|
|
69
69
|
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
* Gets the number of available permits for a given key
|
|
71
|
+
* @param key - The unique identifier for the semaphore
|
|
72
|
+
* @returns Promise resolving to the number of available permits
|
|
73
|
+
*/
|
|
74
74
|
getAvailablePermits(key: string): Promise<number>;
|
|
75
75
|
/**
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
* Gets the total number of permits for a given key
|
|
77
|
+
* @param key - The unique identifier for the semaphore
|
|
78
|
+
* @returns Promise resolving to the total number of permits
|
|
79
|
+
*/
|
|
80
80
|
getTotalPermits(key: string): Promise<number>;
|
|
81
81
|
/**
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
* Initializes a semaphore with the specified number of permits
|
|
83
|
+
* @param key - The unique identifier for the semaphore
|
|
84
|
+
* @param permits - The total number of permits to allocate
|
|
85
|
+
*/
|
|
86
86
|
initialize(key: string, permits: number): void;
|
|
87
87
|
private delay;
|
|
88
88
|
}
|
|
@@ -95,66 +95,66 @@ declare class Semaphore {
|
|
|
95
95
|
private readonly defaultPermits;
|
|
96
96
|
private readonly defaultTimeout;
|
|
97
97
|
/**
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
* Creates a new semaphore instance
|
|
99
|
+
* @param options - Configuration options for the semaphore
|
|
100
|
+
*/
|
|
101
101
|
constructor(options?: SemaphoreOptions);
|
|
102
102
|
/**
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
* Sets the storage implementation for the semaphore
|
|
104
|
+
* @param storage - The storage implementation to use
|
|
105
|
+
*/
|
|
106
106
|
setStorage(storage: SemaphoreStorage): void;
|
|
107
107
|
/**
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
* Gets the storage implementation for the semaphore
|
|
109
|
+
* @returns The storage implementation
|
|
110
|
+
*/
|
|
111
111
|
getStorage(): SemaphoreStorage;
|
|
112
112
|
/**
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
* Acquires a permit for the given key
|
|
114
|
+
* @param key - The unique identifier for the semaphore
|
|
115
|
+
* @param timeout - Optional timeout in milliseconds for permit acquisition
|
|
116
|
+
* @param signal - Optional AbortSignal for cancelling the acquisition
|
|
117
|
+
* @returns Promise resolving to true if permit was acquired, false if timeout
|
|
118
|
+
*/
|
|
119
119
|
acquire(key: string, timeout?: number, signal?: AbortSignal): Promise<boolean>;
|
|
120
120
|
/**
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
* Releases a permit for the given key
|
|
122
|
+
* @param key - The unique identifier for the semaphore
|
|
123
|
+
* @returns Promise that resolves when the permit is released
|
|
124
|
+
*/
|
|
125
125
|
release(key: string): Promise<void>;
|
|
126
126
|
/**
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
* Gets the number of available permits for the given key
|
|
128
|
+
* @param key - The unique identifier for the semaphore
|
|
129
|
+
* @returns Promise resolving to the number of available permits
|
|
130
|
+
*/
|
|
131
131
|
getAvailablePermits(key: string): Promise<number>;
|
|
132
132
|
/**
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
* Gets the total number of permits for the given key
|
|
134
|
+
* @param key - The unique identifier for the semaphore
|
|
135
|
+
* @returns Promise resolving to the total number of permits
|
|
136
|
+
*/
|
|
137
137
|
getTotalPermits(key: string): Promise<number>;
|
|
138
138
|
/**
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
* Gets the number of acquired permits for the given key
|
|
140
|
+
* @param key - The unique identifier for the semaphore
|
|
141
|
+
* @returns Promise resolving to the number of acquired permits
|
|
142
|
+
*/
|
|
143
143
|
getAcquiredPermits(key: string): Promise<number>;
|
|
144
144
|
/**
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
145
|
+
* Executes a function with a permit from the semaphore
|
|
146
|
+
* @param key - The unique identifier for the semaphore
|
|
147
|
+
* @param fn - The function to execute with a permit
|
|
148
|
+
* @param timeout - Optional timeout in milliseconds for permit acquisition
|
|
149
|
+
* @param signal - Optional AbortSignal for cancelling the permit acquisition
|
|
150
|
+
* @returns Promise resolving to the result of the function execution
|
|
151
|
+
* @throws Error if permit acquisition fails or function execution fails
|
|
152
|
+
*/
|
|
153
153
|
withPermit<T>(key: string, fn: () => Promise<T> | T, timeout?: number, signal?: AbortSignal): Promise<T>;
|
|
154
154
|
/**
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
* Gets the current configuration of the semaphore
|
|
156
|
+
* @returns Object containing the current permits and timeout values
|
|
157
|
+
*/
|
|
158
158
|
getConfig(): Omit<SemaphoreOptions, 'storage'>;
|
|
159
159
|
}
|
|
160
160
|
/**
|
|
@@ -1,2 +1,113 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/utils/utilities.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Returns the current working directory of the CommandKit application.
|
|
4
|
+
* This is typically the directory where the source code is located.
|
|
5
|
+
*/
|
|
6
|
+
declare function getCurrentDirectory(): string;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the possible source directories for the CommandKit application.
|
|
9
|
+
* This includes the `src`, `.commandkit`, and the distribution directory.
|
|
10
|
+
* @returns An array of possible source directories.
|
|
11
|
+
*/
|
|
12
|
+
declare function getSourceDirectories(): string[];
|
|
13
|
+
/**
|
|
14
|
+
* Returns the path to the app directory.
|
|
15
|
+
* @returns The path to the app directory or `null` if not found.
|
|
16
|
+
*/
|
|
17
|
+
declare function findAppDirectory(): string | null;
|
|
18
|
+
/**
|
|
19
|
+
* Debounces a function.
|
|
20
|
+
* @param fn The function to debounce.
|
|
21
|
+
* @param ms The debounce time in milliseconds.
|
|
22
|
+
* @returns The debounced function.
|
|
23
|
+
* @example
|
|
24
|
+
* const debouncedFn = debounce(() => {
|
|
25
|
+
* console.log('Debounced function called');
|
|
26
|
+
* }, 300);
|
|
27
|
+
*
|
|
28
|
+
* debouncedFn(); // Will only execute after 300ms of inactivity
|
|
29
|
+
* debouncedFn(); // Will reset the timer
|
|
30
|
+
* debouncedFn(); // Will reset the timer again
|
|
31
|
+
*/
|
|
32
|
+
declare function debounce<R, F extends (...args: any[]) => R>(fn: F, ms: number): F;
|
|
33
|
+
/**
|
|
34
|
+
* Defers the execution of a function.
|
|
35
|
+
* @param fn The function to defer.
|
|
36
|
+
* @param timeout The time in milliseconds to wait before executing the function. Defaults to 0.
|
|
37
|
+
* @example
|
|
38
|
+
* defer(() => {
|
|
39
|
+
* console.log('This will run after a delay');
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* console.log('This will run immediately');
|
|
43
|
+
*/
|
|
44
|
+
declare function defer<T>(fn: () => T, timeout?: number): void;
|
|
45
|
+
/**
|
|
46
|
+
* Serializes a value to JSON.
|
|
47
|
+
* @param value The value to serialize.
|
|
48
|
+
* @param defaultValue The default value to return if the value is not serializable.
|
|
49
|
+
* @returns The serialized value.
|
|
50
|
+
*/
|
|
51
|
+
declare function JsonSerialize<R = any>(value: any, defaultValue?: R): R;
|
|
52
|
+
/**
|
|
53
|
+
* Creates a function from the given function that runs only in development mode.
|
|
54
|
+
* @param fn The function to run in development mode.
|
|
55
|
+
* @returns The function that runs only in development mode.
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const devOnlyFn = devOnly(() => {
|
|
59
|
+
* console.log('This function runs only in development mode');
|
|
60
|
+
* });
|
|
61
|
+
* devOnlyFn(); // This will log the message only in development mode
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
declare function devOnly<T extends (...args: any[]) => any>(fn: T): T;
|
|
65
|
+
/**
|
|
66
|
+
* Creates a function from the given function that runs only in build mode.
|
|
67
|
+
* @param fn The function to run in build mode.
|
|
68
|
+
* @returns The function that runs only in build mode.
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* const buildOnlyFn = buildOnly(() => {
|
|
72
|
+
* console.log('This function runs only in build mode');
|
|
73
|
+
* });
|
|
74
|
+
* buildOnlyFn(); // This will log the message only in build mode
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
declare function buildOnly<T extends (...args: any[]) => any>(fn: T): T;
|
|
78
|
+
/**
|
|
79
|
+
* Creates a function from the given function that runs only outside of build mode.
|
|
80
|
+
* @param fn The function to run outside of build mode.
|
|
81
|
+
* @returns The function that runs only outside of build mode.
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* const noBuildOnlyFn = noBuildOnly(() => {
|
|
85
|
+
* console.log('This function runs only outside of build mode');
|
|
86
|
+
* });
|
|
87
|
+
* noBuildOnlyFn(); // This will log the message only outside of build mode
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
declare function noBuildOnly<T extends (...args: any[]) => any>(fn: T): T;
|
|
91
|
+
/**
|
|
92
|
+
* Represents a simple proxy object that mirrors a target object.
|
|
93
|
+
*/
|
|
94
|
+
interface SimpleProxy<T extends object> {
|
|
95
|
+
/**
|
|
96
|
+
* The proxied object that mirrors the target.
|
|
97
|
+
*/
|
|
98
|
+
proxy: T;
|
|
99
|
+
/**
|
|
100
|
+
* Sets a new target object for the proxy.
|
|
101
|
+
* @param newTarget The new target object to set.
|
|
102
|
+
*/
|
|
103
|
+
setTarget(newTarget: T): void;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Creates a simple proxy object that mirrors the target object.
|
|
107
|
+
* @param target The target object to proxy.
|
|
108
|
+
* @returns The proxied object.
|
|
109
|
+
*/
|
|
110
|
+
declare function createProxy<T extends object>(target: T): SimpleProxy<T>;
|
|
111
|
+
//#endregion
|
|
112
|
+
export { JsonSerialize, SimpleProxy, buildOnly, createProxy, debounce, defer, devOnly, findAppDirectory, getCurrentDirectory, getSourceDirectories, noBuildOnly };
|
|
113
|
+
//# sourceMappingURL=utilities.d.ts.map
|
package/dist/utils/utilities.js
CHANGED
|
@@ -1,42 +1,27 @@
|
|
|
1
|
-
require('../colors-
|
|
2
|
-
require('../ActionRow-
|
|
3
|
-
require('../
|
|
4
|
-
|
|
5
|
-
require('../
|
|
6
|
-
require('../
|
|
7
|
-
require('../
|
|
8
|
-
require('../
|
|
9
|
-
require('../
|
|
10
|
-
require('../
|
|
11
|
-
require('../
|
|
12
|
-
require('../separator-CsoRs1aX.js');
|
|
13
|
-
require('../text-display-C0oSz5y0.js');
|
|
14
|
-
require('../label-CCHbfQW8.js');
|
|
15
|
-
require('../poll-6lSMoohv.js');
|
|
1
|
+
require('../colors-Csc0X4QJ.js');
|
|
2
|
+
require('../ActionRow-CSN_UKmM.js');
|
|
3
|
+
const require_commandkit = require('../commandkit-SIjTLD2R.js');
|
|
4
|
+
require('../container-DCPljKVH.js');
|
|
5
|
+
require('../file-Ca1kpEtE.js');
|
|
6
|
+
require('../media-gallery-u3gjX7yD.js');
|
|
7
|
+
require('../section-BC8LF-B2.js');
|
|
8
|
+
require('../separator-BUTiW7uz.js');
|
|
9
|
+
require('../text-display-DANahMN3.js');
|
|
10
|
+
require('../label-B6vXvwLM.js');
|
|
11
|
+
require('../poll-CFe8yvoJ.js');
|
|
16
12
|
require('../display-WDb9wMCv.js');
|
|
17
|
-
require('../element-DibzzA5L.js');
|
|
18
|
-
require('../types-TC4g3w91.js');
|
|
19
|
-
require('../EventInterceptor-BWoEJMHZ.js');
|
|
20
13
|
require('../constants-CxkFFZ7p.js');
|
|
21
|
-
require('../
|
|
22
|
-
require('../
|
|
23
|
-
require('../
|
|
24
|
-
require('../
|
|
25
|
-
require('../
|
|
26
|
-
require('../
|
|
27
|
-
require('../
|
|
28
|
-
require('../
|
|
29
|
-
require('../constants-BqrEmoih.js');
|
|
30
|
-
require('../EventWorkerContext-yTm5vI3b.js');
|
|
31
|
-
require('../signals-C2Ly0wDt.js');
|
|
32
|
-
require('../helpers-0FUA42u8.js');
|
|
33
|
-
require('../MessageCommandParser-CD7ynlBO.js');
|
|
34
|
-
require('../CommandsRouter-NAgpWzTJ.js');
|
|
35
|
-
require('../EventsRouter-D4_vBMhl.js');
|
|
14
|
+
require('../types-package-CsTNfvv2.js');
|
|
15
|
+
require('../constants-Cw8VjCVz.js');
|
|
16
|
+
require('../EventWorkerContext-Dfhgv329.js');
|
|
17
|
+
require('../signals-B8z1wJ6W.js');
|
|
18
|
+
require('../helpers-Btx1FSZx.js');
|
|
19
|
+
require('../MessageCommandParser-Bs9fimmd.js');
|
|
20
|
+
require('../CommandsRouter-C_HLsrGX.js');
|
|
21
|
+
require('../EventsRouter-DZYIha6m.js');
|
|
36
22
|
require('../router-BvamdzoF.js');
|
|
37
|
-
require('../common-
|
|
38
|
-
require('../
|
|
39
|
-
require('../store-GrsErvli.js');
|
|
23
|
+
require('../common-DSRs_mfw.js');
|
|
24
|
+
require('../store-D8r_hryO.js');
|
|
40
25
|
|
|
41
26
|
exports.JsonSerialize = require_commandkit.JsonSerialize;
|
|
42
27
|
exports.buildOnly = require_commandkit.buildOnly;
|
package/dist/utils/warning.d.ts
CHANGED
|
@@ -1,2 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/utils/warning.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Emit a warning message to the console as a CommandKitWarning.
|
|
4
|
+
* @param message - The warning message to emit.
|
|
5
|
+
* @param code - The warning code (default is 'CommandKitWarning').
|
|
6
|
+
*/
|
|
7
|
+
declare function emitWarning(message: string, code?: string): void;
|
|
8
|
+
/**
|
|
9
|
+
* Emit a warning for unstable features in CommandKit.
|
|
10
|
+
* @param name - The name of the unstable feature.
|
|
11
|
+
* @example warnUnstable('MyUnstableFeature');
|
|
12
|
+
*/
|
|
13
|
+
declare function warnUnstable(name: string): void;
|
|
14
|
+
declare function warnDeprecated({
|
|
15
|
+
what,
|
|
16
|
+
message,
|
|
17
|
+
where
|
|
18
|
+
}: {
|
|
19
|
+
what: string;
|
|
20
|
+
where?: string;
|
|
21
|
+
message?: string;
|
|
22
|
+
}): void;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { emitWarning, warnDeprecated, warnUnstable };
|
|
25
|
+
//# sourceMappingURL=warning.d.ts.map
|