commandkit 1.0.0-dev.20250611155146 → 1.0.0-dev.20250612020833

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.
Files changed (93) hide show
  1. package/dist/{CommandKit-g7NqIdUD.d.ts → CommandKit-BWzWBBGf.d.ts} +16 -1
  2. package/dist/{CommandKit-BqZBlSaB.js → CommandKit-BwxIJqBr.js} +10 -3
  3. package/dist/{CommandKit-BqZBlSaB.js.map → CommandKit-BwxIJqBr.js.map} +1 -1
  4. package/dist/CommandKit.d.ts +1 -1
  5. package/dist/CommandKit.js +1 -1
  6. package/dist/{EventWorkerContext-BcXmutAi.d.ts → EventWorkerContext-DdzSorsU.d.ts} +2 -2
  7. package/dist/analytics/analytics-engine.d.ts +1 -1
  8. package/dist/analytics/analytics-engine.js +1 -1
  9. package/dist/analytics/analytics-provider.d.ts +1 -1
  10. package/dist/analytics/utils.js +1 -1
  11. package/dist/app/commands/AppCommandRunner.d.ts +1 -1
  12. package/dist/app/commands/AppCommandRunner.js +1 -1
  13. package/dist/app/commands/Context.d.ts +1 -1
  14. package/dist/app/commands/Context.js +1 -1
  15. package/dist/app/events/EventWorkerContext.d.ts +2 -2
  16. package/dist/app/handlers/AppCommandHandler.d.ts +1 -1
  17. package/dist/app/handlers/AppCommandHandler.js +1 -1
  18. package/dist/app/handlers/AppEventsHandler.d.ts +1 -1
  19. package/dist/app/handlers/AppEventsHandler.js +1 -1
  20. package/dist/app/index.d.ts +1 -1
  21. package/dist/app/index.js +1 -1
  22. package/dist/app/register/CommandRegistrar.d.ts +1 -1
  23. package/dist/app/register/CommandRegistrar.js +1 -1
  24. package/dist/{build-B-Ae1hqg.js → build-m0yxcs2c.js} +2 -2
  25. package/dist/{build-B-Ae1hqg.js.map → build-m0yxcs2c.js.map} +1 -1
  26. package/dist/cli/build.d.ts +1 -1
  27. package/dist/cli/build.js +2 -2
  28. package/dist/cli/common.d.ts +3 -3
  29. package/dist/cli/development.js +2 -2
  30. package/dist/cli/information.js +1 -1
  31. package/dist/cli/init.js +2 -2
  32. package/dist/cli/production.js +2 -2
  33. package/dist/components/index.js +1 -1
  34. package/dist/components/v1/button/Button.js +1 -1
  35. package/dist/components/v1/button/ButtonKit.js +1 -1
  36. package/dist/components/v1/modal/Modal.js +1 -1
  37. package/dist/components/v1/modal/ModalKit.js +1 -1
  38. package/dist/components/v1/select-menu/ChannelSelectMenuKit.js +1 -1
  39. package/dist/components/v1/select-menu/MentionableSelectMenuKit.js +1 -1
  40. package/dist/components/v1/select-menu/RoleSelectMenuKit.js +1 -1
  41. package/dist/components/v1/select-menu/SelectMenu.js +1 -1
  42. package/dist/components/v1/select-menu/StringSelectMenuKit.js +1 -1
  43. package/dist/components/v1/select-menu/UserSelectMenuKit.js +1 -1
  44. package/dist/config/config.d.ts +4 -4
  45. package/dist/config/config.js +1 -1
  46. package/dist/config/default.d.ts +3 -3
  47. package/dist/config/default.js +1 -1
  48. package/dist/config/loader.d.ts +3 -3
  49. package/dist/config/loader.js +1 -1
  50. package/dist/config/types.d.ts +2 -2
  51. package/dist/config/utils.d.ts +3 -3
  52. package/dist/{config-CGECBFwj.d.ts → config-BEl-UW2l.d.ts} +3 -3
  53. package/dist/context/async-context.d.ts +1 -1
  54. package/dist/context/async-context.js +1 -1
  55. package/dist/context/environment.d.ts +1 -1
  56. package/dist/context/environment.js +1 -1
  57. package/dist/events/CommandKitEventsChannel.d.ts +1 -1
  58. package/dist/{feature-flags-CvHcOB7L.js → feature-flags-DG5Ozd1p.js} +2 -2
  59. package/dist/{feature-flags-CvHcOB7L.js.map → feature-flags-DG5Ozd1p.js.map} +1 -1
  60. package/dist/flags/FlagProvider.d.ts +1 -1
  61. package/dist/flags/feature-flags.d.ts +1 -1
  62. package/dist/flags/feature-flags.js +2 -2
  63. package/dist/flags/store.d.ts +1 -1
  64. package/dist/index.d.ts +5 -5
  65. package/dist/index.js +4 -4
  66. package/dist/{init-BQgLOfl_.js → init-8cDqgA8y.js} +2 -2
  67. package/dist/{init-BQgLOfl_.js.map → init-8cDqgA8y.js.map} +1 -1
  68. package/dist/logger/DefaultLogger.js +1 -1
  69. package/dist/logger/Logger.js +1 -1
  70. package/dist/plugins/CompilerPlugin.d.ts +1 -1
  71. package/dist/plugins/PluginCommon.d.ts +1 -1
  72. package/dist/plugins/RuntimePlugin.d.ts +1 -1
  73. package/dist/plugins/index.d.ts +1 -1
  74. package/dist/plugins/index.js +1 -1
  75. package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +1 -1
  76. package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +1 -1
  77. package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +1 -1
  78. package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +1 -1
  79. package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +1 -1
  80. package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +1 -1
  81. package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +1 -1
  82. package/dist/plugins/plugin-runtime/runtime.d.ts +1 -1
  83. package/dist/plugins/types.d.ts +1 -1
  84. package/dist/{types-uBjT82V4.d.ts → types-C8GYFCIt.d.ts} +2 -2
  85. package/dist/types.d.ts +1 -1
  86. package/dist/utils/dev-hooks.d.ts +1 -1
  87. package/dist/utils/dev-hooks.js +1 -1
  88. package/dist/utils/utilities.js +1 -1
  89. package/dist/{utils-Bz_BoOnV.d.ts → utils-BjK-2R7h.d.ts} +2 -2
  90. package/dist/{version-AMyvJ7I3.js → version-gm8LnvMg.js} +2 -2
  91. package/dist/{version-AMyvJ7I3.js.map → version-gm8LnvMg.js.map} +1 -1
  92. package/dist/version.js +1 -1
  93. package/package.json +2 -2
@@ -587,8 +587,23 @@ declare class MiddlewareContext<T extends CommandExecutionMode = CommandExecutio
587
587
  }
588
588
  //#endregion
589
589
  //#region src/app/commands/AppCommandRunner.d.ts
590
+ /**
591
+ * Options for running a command in CommandKit.
592
+ */
590
593
  interface RunCommandOptions {
594
+ /**
595
+ * The handler to use for executing the command.
596
+ * If not provided, the execution mode will determine the handler.
597
+ * For example, 'chatInputCommand', 'message', etc.
598
+ */
591
599
  handler?: string;
600
+ /**
601
+ * Whether to throw an error if the command execution fails.
602
+ * If true, any error during execution will be thrown.
603
+ * Default is false, which means errors will be logged but not thrown.
604
+ * @default false
605
+ */
606
+ throwOnError?: boolean;
592
607
  }
593
608
  /**
594
609
  * Handles the execution of application commands for CommandKit.
@@ -2010,4 +2025,4 @@ declare class CommandKit extends EventEmitter {
2010
2025
  declare const commandkit: CommandKit;
2011
2026
  //#endregion
2012
2027
  export { AnalyticsEngine, AnalyticsEvent, AnalyticsProvider, AnyCommandExecute, AppCommand, AppCommandHandler, AppCommandNative, AppCommandRunner, AppEventsHandler, AppEventsHandlerLoadedData, AsyncFunction, AutocompleteCommand, AutocompleteCommandContext, AutocompleteCommandMiddlewareContext, BootstrapFunction, ChatInputCommand, ChatInputCommandContext, CommandBuilderLike, CommandContext, CommandContextOptions, CommandData, CommandExecutionMode, CommandFlagContext, CommandKit, CommandKitConfiguration, CommandKitEnvironment, CommandKitEnvironmentInternalData, CommandKitEnvironmentType, CommandKitEventDispatch, CommandKitEventsChannel, CommandKitHMREvent, CommandKitOptions, CommandKitPlugin, CommandKitPluginRuntime, CommandRegistrar, CommandTypeData, CommonDirectiveTransformer, CommonDirectiveTransformerOptions, CommonPluginRuntime, CompilerPlugin, CompilerPluginRuntime, Context, ContextParameters, CustomAppCommandProps, CustomEvaluationContext, CustomEvaluationFunction, DecideFunction, EvaluationContext, EventFlagContext, EventListener, FeatureFlag, FeatureFlagDefinition, FilterFunction, FlagConfiguration, FlagProvider, FlagRunner, FlagStore, GenericFunction, IdentifyEvent, IdentifyFunction, InteractionCommandContext, InteractionCommandMiddlewareContext, IpcMessageCommand, JsonFlagProvider, ListenerFunction, LoadedCommand, LoadedEvent, MaybeFalsey, MaybePromise, MessageCommand, MessageCommandContext, MessageCommandMiddlewareContext, MessageContextMenuCommand, MessageContextMenuCommandContext, MessageContextMenuCommandMiddlewareContext, MiddlewareContext, MiddlewareContextArgs, PluginCommon, PluginOptions, PluginTransformParameters, PluginType, PreRegisterCommandsEvent, PreparedAppCommandExecution, ResolvableCommand, RunCommand, RunCommandOptions, RuntimePlugin, SlashCommandMiddlewareContext, TemplateHandler, TransformedResult, UserContextMenuCommand, UserContextMenuCommandContext, UserContextMenuCommandMiddlewareContext, after, cancelAfter, commandkit, exitContext, flag, getCommandKit, getContext, isCommandWorkerContext, isCompilerPlugin, isPlugin, isRuntimePlugin, makeContextAwareFunction, onApplicationBootstrap, onBootstrap, provideContext, registerDevHooks, setFlagProvider, useEnvironment };
2013
- //# sourceMappingURL=CommandKit-g7NqIdUD.d.ts.map
2028
+ //# sourceMappingURL=CommandKit-BWzWBBGf.d.ts.map
@@ -2476,6 +2476,7 @@ var AppCommandRunner = class {
2476
2476
  */
2477
2477
  async runCommand(prepared, source, options) {
2478
2478
  const { commandkit: commandkit$1 } = this.handler;
2479
+ const shouldThrowOnError = !!(options === null || options === void 0 ? void 0 : options.throwOnError);
2479
2480
  const executionMode = this.getExecutionMode(source);
2480
2481
  let runCommand = null;
2481
2482
  const env = new CommandKitEnvironment(commandkit$1);
@@ -2565,9 +2566,15 @@ var AppCommandRunner = class {
2565
2566
  if (!res) result = await executeCommand();
2566
2567
  } catch (e) {
2567
2568
  if (require_error_codes.isErrorType(e, require_error_codes.CommandKitErrorCodes.ExitMiddleware)) middlewaresCanceled = true;
2568
- if (!require_error_codes.isErrorType(e, [require_error_codes.CommandKitErrorCodes.ForwardedCommand, require_error_codes.CommandKitErrorCodes.ExitMiddleware])) Logger.error(e);
2569
+ if (!require_error_codes.isErrorType(e, [require_error_codes.CommandKitErrorCodes.ForwardedCommand, require_error_codes.CommandKitErrorCodes.ExitMiddleware])) {
2570
+ if (shouldThrowOnError) throw e;
2571
+ Logger.error(e);
2572
+ }
2569
2573
  }
2570
- }
2574
+ } else result = {
2575
+ error: true,
2576
+ message: "Command execution was cancelled by the middleware."
2577
+ };
2571
2578
  if (!middlewaresCanceled && prepared.middlewares.length) await provideContext(env, async () => {
2572
2579
  for (const middleware of prepared.middlewares) {
2573
2580
  if (!middleware.data.afterExecute) continue;
@@ -4124,4 +4131,4 @@ Object.defineProperty(exports, 'useEnvironment', {
4124
4131
  return useEnvironment;
4125
4132
  }
4126
4133
  });
4127
- //# sourceMappingURL=CommandKit-BqZBlSaB.js.map
4134
+ //# sourceMappingURL=CommandKit-BwxIJqBr.js.map