@context-action/core 0.5.0 β†’ 0.6.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/dist/index.cjs CHANGED
@@ -851,6 +851,15 @@ var ActionRegister = class {
851
851
  priority: config.priority,
852
852
  totalHandlers: pipeline.length
853
853
  });
854
+ console.log(`πŸ” [DEBUG] Action '${String(action)}' pipeline after registration:`, {
855
+ totalHandlers: pipeline.length,
856
+ handlers: pipeline.map((h) => ({
857
+ id: h.config.id,
858
+ priority: h.config.priority
859
+ })),
860
+ pipelineExists: this.pipelines.has(action),
861
+ canDispatch: this.hasHandlers(action)
862
+ });
854
863
  return () => {
855
864
  const index = pipeline.findIndex((reg) => reg.id === handlerId && reg === registration);
856
865
  if (index !== -1) {
@@ -888,12 +897,30 @@ var ActionRegister = class {
888
897
  * πŸ†• μ‹€μ œ λ””μŠ€νŒ¨μΉ˜ μž‘μ—… μˆ˜ν–‰ (νμ—μ„œ 호좜됨)
889
898
  */
890
899
  async _performDispatch(action, payload, options) {
900
+ console.log(`πŸš€ [DEBUG] Starting dispatch for action '${String(action)}':`, {
901
+ hasPayload: payload !== void 0,
902
+ payloadType: payload?.constructor?.name || typeof payload,
903
+ options: options ? Object.keys(options) : "none",
904
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
905
+ });
891
906
  if (payload instanceof Event && process.env.NODE_ENV === "development") console.warn(`Event object passed to action "${String(action)}"`, payload.type);
892
907
  const [effectiveSignal, autoAbortController, cleanup] = this.createAbortSignal(options);
893
908
  if (options?.autoAbort?.onControllerCreated && autoAbortController) options.autoAbort.onControllerCreated(autoAbortController);
894
- if (effectiveSignal?.aborted) return;
909
+ if (effectiveSignal?.aborted) {
910
+ console.log(`🚫 [DEBUG] Dispatch aborted before execution for '${String(action)}'`);
911
+ return;
912
+ }
895
913
  const pipeline = this.pipelines.get(action);
896
- if (!pipeline || pipeline.length === 0) return;
914
+ console.log(`πŸ” [DEBUG] Pipeline lookup for '${String(action)}':`, {
915
+ pipelineExists: Boolean(pipeline),
916
+ handlersCount: pipeline?.length || 0,
917
+ allRegisteredActions: Array.from(this.pipelines.keys()),
918
+ pipelineMap: Object.fromEntries(Array.from(this.pipelines.entries()).map(([k, v]) => [k, v.length]))
919
+ });
920
+ if (!pipeline || pipeline.length === 0) {
921
+ console.log(`⚠️ [DEBUG] No handlers found for action '${String(action)}', dispatch cancelled`);
922
+ return;
923
+ }
897
924
  const filteredHandlers = options?.filter ? this.filterHandlers(pipeline, options.filter) : pipeline;
898
925
  const actionKey = String(action);
899
926
  let throttleMs;
@@ -1087,6 +1114,12 @@ var ActionRegister = class {
1087
1114
  let executionError;
1088
1115
  const handlerResults = [];
1089
1116
  const errors = [];
1117
+ filteredHandlers.forEach((handler) => {
1118
+ handlerResults.push({
1119
+ id: handler.config.id,
1120
+ executed: false
1121
+ });
1122
+ });
1090
1123
  const abortHandler = effectiveSignal ? () => {
1091
1124
  context.aborted = true;
1092
1125
  context.abortReason = "Action dispatch aborted by signal";
@@ -1094,6 +1127,11 @@ var ActionRegister = class {
1094
1127
  if (effectiveSignal && abortHandler) effectiveSignal.addEventListener("abort", abortHandler);
1095
1128
  try {
1096
1129
  await this.executePipeline(context, autoAbortController, options?.autoAbort);
1130
+ const executedCount = Math.min(context.currentIndex + (context.aborted ? 0 : 1), filteredHandlers.length);
1131
+ for (let i = 0; i < executedCount; i++) {
1132
+ const handlerResult = handlerResults.find((hr) => hr.id === filteredHandlers[i].config.id);
1133
+ if (handlerResult) handlerResult.executed = true;
1134
+ }
1097
1135
  } catch (error) {
1098
1136
  executionError = error instanceof Error ? error : new Error(String(error));
1099
1137
  errors.push({
@@ -1101,11 +1139,15 @@ var ActionRegister = class {
1101
1139
  error: executionError,
1102
1140
  timestamp: Date.now()
1103
1141
  });
1142
+ const executedCount = Math.min(context.currentIndex + 1, filteredHandlers.length);
1143
+ for (let i = 0; i < executedCount; i++) {
1144
+ const handlerResult = handlerResults.find((hr) => hr.id === filteredHandlers[i].config.id);
1145
+ if (handlerResult) handlerResult.executed = true;
1146
+ }
1104
1147
  } finally {
1105
1148
  cleanup();
1106
1149
  }
1107
1150
  const endTime = Date.now();
1108
- !executionError && context.aborted;
1109
1151
  const processedResult = this.processResults(context, options?.result);
1110
1152
  const successResults = context.results.filter((result) => result !== void 0);
1111
1153
  const failedResults = errors.map((err) => ({
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/ActionRegister.ts","../src/action-guard.ts","../src/execution-modes.ts","../src/react-helpers.ts"],"sourcesContent":[],"mappings":";UAYiB,gBAAA;EAAA,CAAA,UAAA,EAAA,MAAgB,CAAA,EAAA,OAAA;AAwFjC;AAK0C,UALzB,kBAKyB,CAAA,IAAA,GAAA,EAAA,IAAA,IAAA,CAAA,CAAA;OAG1B,CAAA,MAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;eAOC,CAAA,QAAA,EAAA,CAAA,OAAA,EAVmB,CAUnB,EAAA,GAVyB,CAUzB,CAAA,EAAA,IAAA;YAGG,EAAA,EAVJ,CAUI;gBAGJ,CAAA,QAAA,EAAA,MAAA,CAAA,EAAA,IAAA;QAGwB,CAAA,MAAA,EATvB,CASuB,CAAA,EAAA,IAAA;WAAoB,CAAA,MAAA,EANxC,CAMwC,CAAA,EAAA,IAAA;YAAM,EAAA,EAHlD,CAGkD,EAAA;wCAA1B,oBAAoB,MAAM;AAoElE;AAAyB,KAAb,aAAa,CAAA,IAAA,GAAA,EAAA,IAAA,IAAA,CAAA,GAAA,CAAA,OAAA,EACd,CADc,EAAA,UAAA,EAEX,kBAFW,CAEQ,CAFR,EAEW,CAFX,CAAA,EAAA,GAGpB,CAHoB,GAGhB,OAHgB,CAGR,CAHQ,CAAA,GAAA,IAAA,GAGI,OAHJ,CAAA,IAAA,CAAA;AACd,UA+BM,aAAA,CA/BN;UACsB,CAAA,EAAA,MAAA;KAAG,EAAA,MAAA;UAAtB,CAAA,EAAA,OAAA;MAC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I6GlB,UJ7GkB,CI6GP,cJ7GO,CAAA,GAAA,CAAA,CAAA,iBAAA,CAAA,CAAA;;;AACnB,cI4IJ,gBAAA,SAAyB,KAAA,CJ5IrB;WAAR,MAAA,EAAA,MAAA;WAAoB,OAAA,CAAA,EAAA,GAAA;;EA6BZ,SAAA,SAAa,EAAA,MAAA;EAoCb,WAAA,CAAA,OAAA,EAAA,MAAmB,EAAA,MAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAAA,GAAA,EAAA,SAAA,CAAA,EAAA,MAAA,EAAA,aAAA,CAAA,EIsFhB,KJtFgB;EAAA,OAAA,eAAA,CAAA,aAAA,EIyGjB,KJzGiB,EAAA,MAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAAA,GAAA,EAAA,SAAA,CAAA,EAAA,MAAA,CAAA,EI6G/B,gBJ7G+B;;AAER,iBI4HZ,kBAAA,CJ5HY,KAAA,EAAA,GAAA,CAAA,EAAA,KAAA,II4H6B,gBJ5H7B"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/ActionRegister.ts","../src/action-guard.ts","../src/execution-modes.ts","../src/react-helpers.ts"],"sourcesContent":[],"mappings":";UAYiB,gBAAA;EAAA,CAAA,UAAA,EAAA,MAAgB,CAAA,EAAA,OAAA;AAwFjC;AAK0C,UALzB,kBAKyB,CAAA,IAAA,GAAA,EAAA,IAAA,IAAA,CAAA,CAAA;OAG1B,CAAA,MAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;eAOC,CAAA,QAAA,EAAA,CAAA,OAAA,EAVmB,CAUnB,EAAA,GAVyB,CAUzB,CAAA,EAAA,IAAA;YAGG,EAAA,EAVJ,CAUI;gBAGJ,CAAA,QAAA,EAAA,MAAA,CAAA,EAAA,IAAA;QAGwB,CAAA,MAAA,EATvB,CASuB,CAAA,EAAA,IAAA;WAAoB,CAAA,MAAA,EANxC,CAMwC,CAAA,EAAA,IAAA;YAAM,EAAA,EAHlD,CAGkD,EAAA;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,IAAA,CAAA;AAGwB,cIyI3B,aJzI2B,EAAA;iBAAoB,EAAA,EAAA,IAAA;kBAAM,EAAA,EAAA,IAAA;;EAoEtD,GAAA,CAAA,SAAA,EAAA,MAAa,EAAA,MAAA,EAAA,MAAA,EAAA,OAAA,EAAA,MAAA,EAAA,IAAA,CAAA,EAAA,GAAA,CAAA,EAAA,IAAA;EAAA,QAAA,CAAA,QAAA,EI4GJ,cJ5GI,CAAA,GAAA,CAAA,CAAA,EAAA;IACd,aAAA,EAAA,MAAA;IACsB,aAAA,EAAA,MAAA;IAAG,YAAA,EI6GlB,UJ7GkB,CI6GP,cJ7GO,CAAA,GAAA,CAAA,CAAA,iBAAA,CAAA,CAAA;;;AACnB,cI4IJ,gBAAA,SAAyB,KAAA,CJ5IrB;WAAR,MAAA,EAAA,MAAA;WAAoB,OAAA,CAAA,EAAA,GAAA;;EA6BZ,SAAA,SAAa,EAAA,MAAA;EAoCb,WAAA,CAAA,OAAA,EAAA,MAAmB,EAAA,MAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAAA,GAAA,EAAA,SAAA,CAAA,EAAA,MAAA,EAAA,aAAA,CAAA,EIsFhB,KJtFgB;EAAA,OAAA,eAAA,CAAA,aAAA,EIyGjB,KJzGiB,EAAA,MAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAAA,GAAA,EAAA,SAAA,CAAA,EAAA,MAAA,CAAA,EI6G/B,gBJ7G+B;;AAER,iBI4HZ,kBAAA,CJ5HY,KAAA,EAAA,GAAA,CAAA,EAAA,KAAA,II4H6B,gBJ5H7B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/ActionRegister.ts","../src/action-guard.ts","../src/execution-modes.ts","../src/react-helpers.ts"],"sourcesContent":[],"mappings":";UAYiB,gBAAA;EAAA,CAAA,UAAA,EAAA,MAAgB,CAAA,EAAA,OAAA;AAwFjC;AAK0C,UALzB,kBAKyB,CAAA,IAAA,GAAA,EAAA,I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EAAA,MAAA,CAAA,EI6G/B,gBJ7G+B;;AAER,iBI4HZ,kBAAA,CJ5HY,KAAA,EAAA,GAAA,CAAA,EAAA,KAAA,II4H6B,gBJ5H7B"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/ActionRegister.ts","../src/action-guard.ts","../src/execution-modes.ts","../src/react-helpers.ts"],"sourcesContent":[],"mappings":";UAYiB,gBAAA;EAAA,CAAA,UAAA,EAAA,MAAgB,CAAA,EAAA,OAAA;AAwFjC;AAK0C,UALzB,kBAKyB,CAAA,IAAA,GAAA,EAAA,IAAA,IAAA,CAAA,CAAA;OAG1B,CAAA,MAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;eAOC,CAAA,QAAA,EAAA,CAAA,OAAA,EAVmB,CAUnB,EAAA,GAVyB,CAUzB,CAAA,EAAA,IAAA;YAGG,EAAA,EAVJ,CAUI;gBAGJ,CAAA,QAAA,EAAA,MAAA,CAAA,EAAA,IAAA;QAGwB,CAAA,MAAA,EATvB,CASuB,CAAA,EAAA,IAAA;WAAoB,CAAA,MAAA,EANxC,CAMwC,CAAA,EAAA,IAAA;YAAM,EAAA,EAHlD,CAGkD,EAAA;wCAA1B,oBAAoB,MAAM;AAoElE;AAAyB,KAAb,aAAa,CAAA,IAAA,GAAA,EAAA,IAAA,IAAA,CAAA,GAAA,CAAA,OAAA,EACd,CADc,EAAA,UAAA,EAEX,kBAFW,CAEQ,CAFR,EAEW,CAFX,CAAA,EAAA,GAGpB,CAHoB,GAGhB,OAHgB,CAGR,CAHQ,CAAA,GAAA,IAAA,GAGI,OAHJ,CAAA,IAAA,CAAA;AACd,UA+BM,aAAA,CA/BN;UACsB,CAAA,EAAA,MAAA;KAAG,EAAA,MAAA;UAAtB,CAAA,EAAA,OAAA;MACT,CAAA,EAAA,OAAA;UAAY,CAAA,EAAA,MAAA;UAAR,CAAA,EAAA,MAAA;iBAAoB,CAAA,EAAA,OAAA;;AA6BZ,UAoCA,mBApCa,C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R,MAAA,EAAA,MAAA;WAAoB,OAAA,CAAA,EAAA,GAAA;;EA6BZ,SAAA,SAAa,EAAA,MAAA;EAoCb,WAAA,CAAA,OAAA,EAAA,MAAmB,EAAA,MAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAAA,GAAA,EAAA,SAAA,CAAA,EAAA,MAAA,EAAA,aAAA,CAAA,EIsFhB,KJtFgB;EAAA,OAAA,eAAA,CAAA,aAAA,EIyGjB,KJzGiB,EAAA,MAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAAA,GAAA,EAAA,SAAA,CAAA,EAAA,MAAA,CAAA,EI6G/B,gBJ7G+B;;AAER,iBI4HZ,kBAAA,CJ5HY,KAAA,EAAA,GAAA,CAAA,EAAA,KAAA,II4H6B,gBJ5H7B"}
package/dist/index.js CHANGED
@@ -850,6 +850,15 @@ var ActionRegister = class {
850
850
  priority: config.priority,
851
851
  totalHandlers: pipeline.length
852
852
  });
853
+ console.log(`πŸ” [DEBUG] Action '${String(action)}' pipeline after registration:`, {
854
+ totalHandlers: pipeline.length,
855
+ handlers: pipeline.map((h) => ({
856
+ id: h.config.id,
857
+ priority: h.config.priority
858
+ })),
859
+ pipelineExists: this.pipelines.has(action),
860
+ canDispatch: this.hasHandlers(action)
861
+ });
853
862
  return () => {
854
863
  const index = pipeline.findIndex((reg) => reg.id === handlerId && reg === registration);
855
864
  if (index !== -1) {
@@ -887,12 +896,30 @@ var ActionRegister = class {
887
896
  * πŸ†• μ‹€μ œ λ””μŠ€νŒ¨μΉ˜ μž‘μ—… μˆ˜ν–‰ (νμ—μ„œ 호좜됨)
888
897
  */
889
898
  async _performDispatch(action, payload, options) {
899
+ console.log(`πŸš€ [DEBUG] Starting dispatch for action '${String(action)}':`, {
900
+ hasPayload: payload !== void 0,
901
+ payloadType: payload?.constructor?.name || typeof payload,
902
+ options: options ? Object.keys(options) : "none",
903
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
904
+ });
890
905
  if (payload instanceof Event && process.env.NODE_ENV === "development") console.warn(`Event object passed to action "${String(action)}"`, payload.type);
891
906
  const [effectiveSignal, autoAbortController, cleanup] = this.createAbortSignal(options);
892
907
  if (options?.autoAbort?.onControllerCreated && autoAbortController) options.autoAbort.onControllerCreated(autoAbortController);
893
- if (effectiveSignal?.aborted) return;
908
+ if (effectiveSignal?.aborted) {
909
+ console.log(`🚫 [DEBUG] Dispatch aborted before execution for '${String(action)}'`);
910
+ return;
911
+ }
894
912
  const pipeline = this.pipelines.get(action);
895
- if (!pipeline || pipeline.length === 0) return;
913
+ console.log(`πŸ” [DEBUG] Pipeline lookup for '${String(action)}':`, {
914
+ pipelineExists: Boolean(pipeline),
915
+ handlersCount: pipeline?.length || 0,
916
+ allRegisteredActions: Array.from(this.pipelines.keys()),
917
+ pipelineMap: Object.fromEntries(Array.from(this.pipelines.entries()).map(([k, v]) => [k, v.length]))
918
+ });
919
+ if (!pipeline || pipeline.length === 0) {
920
+ console.log(`⚠️ [DEBUG] No handlers found for action '${String(action)}', dispatch cancelled`);
921
+ return;
922
+ }
896
923
  const filteredHandlers = options?.filter ? this.filterHandlers(pipeline, options.filter) : pipeline;
897
924
  const actionKey = String(action);
898
925
  let throttleMs;
@@ -1086,6 +1113,12 @@ var ActionRegister = class {
1086
1113
  let executionError;
1087
1114
  const handlerResults = [];
1088
1115
  const errors = [];
1116
+ filteredHandlers.forEach((handler) => {
1117
+ handlerResults.push({
1118
+ id: handler.config.id,
1119
+ executed: false
1120
+ });
1121
+ });
1089
1122
  const abortHandler = effectiveSignal ? () => {
1090
1123
  context.aborted = true;
1091
1124
  context.abortReason = "Action dispatch aborted by signal";
@@ -1093,6 +1126,11 @@ var ActionRegister = class {
1093
1126
  if (effectiveSignal && abortHandler) effectiveSignal.addEventListener("abort", abortHandler);
1094
1127
  try {
1095
1128
  await this.executePipeline(context, autoAbortController, options?.autoAbort);
1129
+ const executedCount = Math.min(context.currentIndex + (context.aborted ? 0 : 1), filteredHandlers.length);
1130
+ for (let i = 0; i < executedCount; i++) {
1131
+ const handlerResult = handlerResults.find((hr) => hr.id === filteredHandlers[i].config.id);
1132
+ if (handlerResult) handlerResult.executed = true;
1133
+ }
1096
1134
  } catch (error) {
1097
1135
  executionError = error instanceof Error ? error : new Error(String(error));
1098
1136
  errors.push({
@@ -1100,11 +1138,15 @@ var ActionRegister = class {
1100
1138
  error: executionError,
1101
1139
  timestamp: Date.now()
1102
1140
  });
1141
+ const executedCount = Math.min(context.currentIndex + 1, filteredHandlers.length);
1142
+ for (let i = 0; i < executedCount; i++) {
1143
+ const handlerResult = handlerResults.find((hr) => hr.id === filteredHandlers[i].config.id);
1144
+ if (handlerResult) handlerResult.executed = true;
1145
+ }
1103
1146
  } finally {
1104
1147
  cleanup();
1105
1148
  }
1106
1149
  const endTime = Date.now();
1107
- !executionError && context.aborted;
1108
1150
  const processedResult = this.processResults(context, options?.result);
1109
1151
  const successResults = context.results.filter((result) => result !== void 0);
1110
1152
  const failedResults = errors.map((err) => ({
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["nonBlockingPromises: Array<Promise<any>>","errors: Array<{ handlerId: string; error: Error; timestamp: number }>","error: any","handlerErrors: HandlerError[]","handlerResult: R | undefined","keysToDelete: string[]","name: string","queuedOperation: QueuedOperation<T>","signals: AbortSignal[]","cleanups: (() => void)[]","autoAbortController: AbortController | undefined","effectiveSignal: AbortSignal","registration: HandlerRegistration<T[K], R>","throttleMs: number | undefined","debounceMs: number | undefined","context: PipelineContext<T[K], any>","context: PipelineContext<T[K], R>","executionError: Error | undefined","handlerResults: Array<{\n id: string;\n executed: boolean;\n duration?: number;\n result?: R;\n error?: Error;\n metadata?: Record<string, any>;\n }>","errors: Array<{\n handlerId: string;\n error: Error;\n timestamp: number;\n }>","executionResult: ExecutionResult<R>","currentUnregister: UnregisterFunction | undefined"],"sources":["../src/execution-modes.ts","../src/action-guard.ts","../src/concurrency/OperationQueue.ts","../src/ActionRegister.ts","../src/react-helpers.ts"],"sourcesContent":["/**\n * @fileoverview Execution mode implementations for ActionRegister\n * \n * Provides three different execution strategies for action handler pipelines:\n * - Sequential: Execute handlers one after another in priority order\n * - Parallel: Execute all handlers simultaneously\n * - Race: First handler to complete wins, others are cancelled\n */\n\nimport type { \n HandlerRegistration, \n PipelineContext, \n PipelineController,\n HandlerError\n} from './types.js';\n\n/**\n * Create standardized error handling for handlers\n * \n * @param error - The error that occurred\n * @param registration - The handler registration that failed\n * @returns Standardized HandlerError object\n * \n * @internal\n */\nfunction handleExecutionError<T, R>(\n error: any,\n registration: HandlerRegistration<T, R>\n): HandlerError {\n const errorObj = error instanceof Error ? error : new Error(String(error));\n return {\n handlerId: registration.id,\n error: errorObj,\n timestamp: Date.now(),\n severity: registration.config.blocking ? 'blocking' : 'non-blocking'\n };\n}\n\n/**\n * Execute handlers in sequential mode (one after another)\n * \n * Executes action handlers one at a time in priority order (highest first).\n * Supports both blocking and non-blocking handlers, with proper abort and\n * termination handling. Handlers can modify payload for subsequent handlers\n * and jump to different priority levels.\n * \n * @template T - The payload type for the action\n * @template R - The result type for handlers\n * \n * @param context - Pipeline execution context containing handlers and state\n * @param createController - Factory function for creating pipeline controllers\n * \n * @throws {Error} When a blocking handler fails\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/dispatch-patterns\n * \n * @public\n */\nexport async function executeSequential<T, R = void>(\n context: PipelineContext<T, R>,\n createController: (registration: HandlerRegistration<T, R>, index: number) => PipelineController<T, R>\n): Promise<void> {\n\n let i = 0;\n const nonBlockingPromises: Array<Promise<any>> = [];\n const errors: Array<{ handlerId: string; error: Error; timestamp: number }> = [];\n \n while (i < context.handlers.length) {\n // Check for abort or termination\n if (context.aborted || context.terminated) {\n break;\n }\n\n const registration = context.handlers[i];\n context.currentIndex = i;\n const controller = createController(registration, i);\n\n try {\n // Check for abort before executing handler\n if (context.aborted) {\n break;\n }\n \n const result = registration.handler(context.payload, controller);\n\n if (registration.config.blocking) {\n // πŸ†• Blocking handlers: Wait for completion (sync or async)\n const handlerResult = result instanceof Promise ? await result : result;\n if (handlerResult !== undefined && !context.terminated) {\n context.results.push(handlerResult as R);\n }\n } else {\n // πŸ†• Non-blocking handlers: Handle differently for sync vs async\n if (result instanceof Promise) {\n // Non-blocking async: Track promise with error handling\n const promiseWithErrorHandling = result\n .then(asyncResult => {\n if (asyncResult !== undefined && !context.terminated) {\n context.results.push(asyncResult as R);\n }\n return asyncResult;\n })\n .catch(error => {\n // πŸ†• Non-blocking async handler error collection\n const handlerError = handleExecutionError(error, registration);\n errors.push({\n handlerId: handlerError.handlerId,\n error: handlerError.error,\n timestamp: handlerError.timestamp\n });\n return undefined; // Return undefined for failed non-blocking handlers\n });\n \n nonBlockingPromises.push(promiseWithErrorHandling);\n } else if (result !== undefined && !context.terminated) {\n // Non-blocking sync: Immediately collect result\n context.results.push(result as R);\n }\n }\n\n /** Check if pipeline was terminated by controller.return() */\n if (context.terminated) {\n break;\n }\n\n /** Handle jump to priority AFTER handler execution */\n if (context.jumpToPriority !== undefined) {\n const jumpIndex = context.handlers.findIndex(\n handler => handler.config.priority === context.jumpToPriority\n );\n \n if (jumpIndex !== -1) {\n i = jumpIndex;\n context.jumpToPriority = undefined;\n continue;\n } else {\n context.jumpToPriority = undefined;\n i++;\n }\n } else {\n i++;\n }\n\n } catch (error: any) {\n // πŸ†• Maintain backward compatibility: any sync error fails pipeline\n const handlerError = handleExecutionError(error, registration);\n \n // For backward compatibility: all synchronous errors fail the pipeline\n throw handlerError.error;\n }\n }\n \n // πŸ†• Wait for all non-blocking promises with error collection\n if (nonBlockingPromises.length > 0) {\n await Promise.allSettled(nonBlockingPromises);\n }\n\n // πŸ”§ Store collected errors in context for ExecutionResult with proper typing\n if (errors.length > 0) {\n // Convert to proper HandlerError format\n const handlerErrors: HandlerError[] = errors.map(err => ({\n handlerId: err.handlerId,\n error: err.error,\n timestamp: err.timestamp,\n severity: 'non-blocking' as const\n }));\n \n // Add to context with proper typing\n (context as PipelineContext<any, any> & { collectedErrors?: HandlerError[] }).collectedErrors = handlerErrors;\n }\n}\n\n/**\n * Execute handlers in parallel mode (all at once)\n * \n * Executes all qualifying action handlers simultaneously using Promise.allSettled.\n * Supports both blocking and non-blocking handlers. Blocking handlers can still\n * fail the entire pipeline if they throw errors.\n * \n * @template T - The payload type for the action\n * @template R - The result type for handlers\n * \n * @param context - Pipeline execution context containing handlers and state\n * @param createController - Factory function for creating pipeline controllers\n * \n * @throws {Error} When any blocking handler fails\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/dispatch-patterns#parallel-execution\n * \n * @public\n */\nexport async function executeParallel<T, R = void>(\n context: PipelineContext<T, R>,\n createController: (registration: HandlerRegistration<T, R>, index: number) => PipelineController<T, R>\n): Promise<void> {\n\n /** All handlers are runnable */\n const runnableHandlers = context.handlers;\n\n /** Create promises for all handlers */\n const handlerPromises = runnableHandlers.map(async (registration, _index) => {\n const controller = createController(registration, _index);\n \n try {\n const result = registration.handler(context.payload, controller);\n \n let handlerResult: R | undefined;\n if (result instanceof Promise) {\n const resolved = await result;\n handlerResult = resolved as R | undefined;\n } else {\n handlerResult = result as R | undefined;\n }\n \n /** Collect result if handler returned something and pipeline wasn't terminated */\n if (handlerResult !== undefined && !context.terminated) {\n context.results.push(handlerResult);\n }\n \n return { \n success: true, \n handlerId: registration.id, \n result: handlerResult,\n terminated: context.terminated \n };\n \n } catch (error: any) {\n // πŸ†• Consistent error object creation\n const handlerError = handleExecutionError(error, registration);\n \n if (handlerError.severity === 'blocking') {\n throw handlerError.error;\n }\n \n return { success: false, handlerId: registration.id, error: handlerError.error };\n }\n });\n\n /** Wait for all handlers to complete */\n const results = await Promise.allSettled(handlerPromises);\n \n /** Check for any rejected blocking handlers */\n const failures = results.filter((result, index) => {\n if (result.status === 'rejected') {\n const registration = runnableHandlers[index];\n return registration.config.blocking;\n }\n return false;\n });\n\n if (failures.length > 0) {\n const firstFailure = failures[0] as PromiseRejectedResult;\n throw firstFailure.reason;\n }\n\n /** Check if any handler terminated the pipeline */\n const terminatedResults = results.filter(result => \n result.status === 'fulfilled' && result.value.terminated\n );\n \n if (terminatedResults.length > 0) {\n context.terminated = true;\n // In parallel mode, we can't determine which handler's termination result to use,\n // so we use the first one that terminated\n const firstTerminated = terminatedResults[0] as PromiseFulfilledResult<any>;\n context.terminationResult = firstTerminated.value.result;\n }\n}\n\n/**\n * Execute handlers in race mode (first to complete wins)\n * \n * Executes all qualifying handlers simultaneously using Promise.race, where\n * the first handler to complete determines the pipeline result. Other handlers\n * are effectively cancelled. Useful for scenarios where you want the fastest\n * response from multiple equivalent handlers.\n * \n * @template T - The payload type for the action\n * @template R - The result type for handlers\n * \n * @param context - Pipeline execution context containing handlers and state\n * @param createController - Factory function for creating pipeline controllers\n * \n * @throws {Error} When the winning handler fails and is blocking\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/dispatch-patterns#race-execution\n * \n * @public\n */\nexport async function executeRace<T, R = void>(\n context: PipelineContext<T, R>,\n createController: (registration: HandlerRegistration<T, R>, index: number) => PipelineController<T, R>\n): Promise<void> {\n\n /** All handlers are runnable */\n const runnableHandlers = context.handlers;\n\n if (runnableHandlers.length === 0) {\n return;\n }\n\n /** Create promises for all handlers */\n const handlerPromises = runnableHandlers.map(async (registration, _index) => {\n const controller = createController(registration, _index);\n \n try {\n const result = registration.handler(context.payload, controller);\n \n let handlerResult: R | undefined;\n if (result instanceof Promise) {\n const resolved = await result;\n handlerResult = resolved as R | undefined;\n } else {\n handlerResult = result as R | undefined;\n }\n \n return { \n success: true, \n handlerId: registration.id, \n registration,\n result: handlerResult,\n terminated: context.terminated\n };\n \n } catch (error: any) {\n // πŸ†• Consistent error object creation\n const handlerError = handleExecutionError(error, registration);\n return { success: false, handlerId: registration.id, error: handlerError.error, registration };\n }\n });\n\n /** Race all handlers */\n const winner = await Promise.race(handlerPromises);\n\n /** If the winner failed and was blocking, throw the error */\n if (!winner.success && winner.registration?.config.blocking) {\n throw winner.error;\n }\n\n /** Collect result from the winning handler */\n if (winner.success && winner.result !== undefined) {\n context.results.push(winner.result);\n }\n\n /** Check if the winning handler terminated the pipeline */\n if (winner.success && winner.terminated) {\n context.terminated = true;\n context.terminationResult = winner.result;\n }\n}","/**\n * @fileoverview Action Guard system for debouncing, throttling and blocking\n * \n * Provides rate limiting and user experience optimization for actions through\n * debouncing (wait for pause) and throttling (limit frequency) mechanisms.\n * Used internally by ActionRegister to control action execution timing.\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/\n */\n\n\n/**\n * Action guard state tracking for debouncing and throttling\n * \n * Tracks timing and execution state for action execution control.\n * Maintains separate state for each action to enable independent\n * rate limiting per action type.\n * \n * @internal\n */\ninterface GuardState {\n /** Timestamp of last successful execution for throttling calculations */\n lastExecuted: number;\n \n /** Active debounce timer - cleared when new debounce requests arrive */\n debounceTimer?: NodeJS.Timeout;\n \n /** Active throttle timer - tracks when throttle period will end */\n throttleTimer?: NodeJS.Timeout;\n \n /** Flag indicating if action is currently in throttled state */\n isThrottled: boolean;\n \n /** Current debounce promise - reused for concurrent calls */\n debouncePromise?: Promise<boolean>;\n \n /** Resolve function for current debounce promise */\n debounceResolve?: (value: boolean) => void;\n}\n\n/**\n * Action Guard system for managing action execution timing\n * \n * Provides performance optimization and user experience enhancement through\n * debouncing and throttling mechanisms. Debouncing waits for a pause in calls\n * before executing, while throttling limits execution frequency.\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * \n * @example Manual Usage (Advanced)\n * ```typescript\n * const guard = new ActionGuard()\n * \n * // Manual debouncing\n * if (await guard.debounce('search', 300)) {\n * performSearch() // Only executes after 300ms pause\n * }\n * \n * // Manual throttling\n * if (guard.throttle('scroll', 100)) {\n * updateUI() // Max once per 100ms\n * }\n * ```\n * \n * @internal\n */\nexport class ActionGuard {\n private guards = new Map<string, GuardState>();\n private cleanupInterval?: NodeJS.Timeout;\n private readonly maxIdleTime: number = 60000; // 1 minute\n private readonly cleanupIntervalMs: number = 30000; // 30 seconds\n\n constructor(autoCleanup: boolean = true) {\n if (autoCleanup) {\n this.startAutoCleanup();\n }\n }\n\n /**\n * Start automatic cleanup of idle guard states\n * \n * @internal\n */\n private startAutoCleanup(): void {\n this.cleanupInterval = setInterval(() => {\n const now = Date.now();\n const keysToDelete: string[] = [];\n \n // Collect keys to delete (avoid modifying map during iteration)\n this.guards.forEach((state, key) => {\n const isIdle = now - state.lastExecuted > this.maxIdleTime;\n const hasActiveTimers = state.debounceTimer || state.throttleTimer;\n \n if (isIdle && !hasActiveTimers) {\n keysToDelete.push(key);\n }\n });\n \n // Batch delete idle guards\n if (keysToDelete.length > 0) {\n keysToDelete.forEach(key => this.guards.delete(key));\n // Optional debug logging for cleanup\n if (typeof process !== 'undefined' && process.env?.DEBUG_CONTEXT_ACTION) {\n console.debug(`[ActionGuard] Cleaned up ${keysToDelete.length} idle guards`);\n }\n }\n }, this.cleanupIntervalMs);\n }\n\n /**\n * Apply debouncing to an action\n * \n * Debouncing waits for a specified delay after the last call before allowing\n * execution. Each new call resets the timer. Useful for search inputs, resize\n * handlers, and other high-frequency user interactions.\n * \n * @param actionKey - Unique identifier for the action being debounced\n * @param debounceMs - Delay in milliseconds to wait after the last call\n * \n * @returns Promise resolving to true if execution should proceed, false if cancelled\n * \n * @example Search Input Debouncing\n * ```typescript\n * // Only search after user stops typing for 300ms\n * if (await guard.debounce('userSearch', 300)) {\n * performSearch(query)\n * }\n * ```\n * \n * @internal\n */\n async debounce(actionKey: string, debounceMs: number): Promise<boolean> {\n\n /** Get or create guard state for this action */\n let state = this.guards.get(actionKey);\n if (!state) {\n /** Initialize new guard state with default values */\n state = {\n lastExecuted: 0,\n isThrottled: false\n };\n this.guards.set(actionKey, state);\n }\n\n /** Clear any existing debounce timer to restart the delay period */\n if (state.debounceTimer) {\n clearTimeout(state.debounceTimer);\n // Resolve previous debounce with false if exists\n if (state.debounceResolve) {\n state.debounceResolve(false);\n state.debounceResolve = undefined;\n }\n }\n\n /** Create new debounce promise */\n return new Promise<boolean>((resolve) => {\n // Store new resolve function\n state!.debounceResolve = resolve;\n \n // Set new timer\n state!.debounceTimer = setTimeout(() => {\n /** Clean up timer and resolver references */\n state!.debounceTimer = undefined;\n state!.debounceResolve = undefined;\n /** Update last execution timestamp */\n state!.lastExecuted = Date.now();\n resolve(true);\n }, debounceMs);\n });\n }\n\n /**\n * Apply throttling to an action\n * \n * Throttling limits execution frequency by ensuring a minimum interval between\n * calls. Unlike debouncing, throttling executes immediately on the first call\n * and then blocks subsequent calls until the interval expires.\n * \n * @param actionKey - Unique identifier for the action being throttled\n * @param throttleMs - Minimum interval in milliseconds between executions\n * \n * @returns True if execution should proceed, false if currently throttled\n * \n * @example Scroll Handler Throttling\n * ```typescript\n * // Update scroll position max once per 100ms\n * if (guard.throttle('scrollUpdate', 100)) {\n * updateScrollPosition()\n * }\n * ```\n * \n * @internal\n */\n throttle(actionKey: string, throttleMs: number): boolean {\n\n /** Get or create guard state for this action */\n let state = this.guards.get(actionKey);\n if (!state) {\n /** Initialize new guard state with default values */\n state = {\n lastExecuted: 0,\n isThrottled: false\n };\n this.guards.set(actionKey, state);\n }\n\n const now = Date.now();\n const timeSinceLastExecution = now - state.lastExecuted;\n\n /** Check if enough time has passed since last execution */\n /** If throttle period has elapsed, allow immediate execution */\n if (timeSinceLastExecution >= throttleMs) {\n /** Update execution timestamp and clear throttled state */\n state.lastExecuted = now;\n state.isThrottled = false;\n \n \n return true;\n }\n\n /** If already in throttled state, don't create duplicate timers */\n /** This prevents timer accumulation and unnecessary processing */\n if (state.isThrottled) {\n return false;\n }\n\n /** Set throttle timer to automatically clear the throttled state */\n /** Calculate remaining time until throttle period expires */\n state.isThrottled = true;\n const remainingTime = throttleMs - timeSinceLastExecution;\n \n /** Create timer to reset throttled state when period expires */\n state.throttleTimer = setTimeout(() => {\n /** Clear throttled state and timer reference */\n state!.isThrottled = false;\n state!.throttleTimer = undefined;\n }, remainingTime);\n\n\n return false;\n }\n\n /**\n * Clear all guard state for a specific action\n * \n * Removes debounce and throttle timers for the specified action,\n * preventing memory leaks and allowing immediate re-execution.\n * \n * @param actionKey - Action identifier to clear guards for\n * \n * @internal\n */\n clearGuards(actionKey: string): void {\n \n const state = this.guards.get(actionKey);\n if (state) {\n /** Clear debounce timer if active to prevent memory leaks */\n if (state.debounceTimer) {\n clearTimeout(state.debounceTimer);\n // Cancel waiting debounce calls\n if (state.debounceResolve) {\n state.debounceResolve(false);\n state.debounceResolve = undefined;\n }\n state.debounceTimer = undefined;\n }\n /** Clear throttle timer if active to prevent memory leaks */\n if (state.throttleTimer) {\n clearTimeout(state.throttleTimer);\n state.throttleTimer = undefined;\n }\n /** Remove guard state from memory */\n this.guards.delete(actionKey);\n \n }\n }\n\n /**\n * Clear all guard states for all actions\n * \n * Removes all active debounce and throttle timers, useful for cleanup\n * when shutting down the action system or resetting state.\n * \n * @internal\n */\n clearAll(): void {\n \n /** Iterate through all guard states and clear their timers */\n /** This prevents memory leaks when clearing the entire guard system */\n this.guards.forEach((state) => {\n /** Clear any active debounce timers */\n if (state.debounceTimer) {\n clearTimeout(state.debounceTimer);\n // Cancel waiting debounce calls\n if (state.debounceResolve) {\n state.debounceResolve(false);\n }\n }\n /** Clear any active throttle timers */\n if (state.throttleTimer) {\n clearTimeout(state.throttleTimer);\n }\n });\n \n /** Remove all guard states from memory */\n this.guards.clear();\n }\n\n /**\n * Get current guard state for debugging purposes\n * \n * Returns the internal state for a specific action, including timer\n * information and execution timestamps.\n * \n * @param actionKey - Action identifier to inspect\n * @returns Guard state or undefined if no state exists\n * \n * @internal\n */\n getGuardState(actionKey: string): GuardState | undefined {\n return this.guards.get(actionKey);\n }\n\n /**\n * Get all active guard states for debugging purposes\n * \n * Returns a copy of all current guard states, useful for monitoring\n * and debugging rate limiting behavior across all actions.\n * \n * @returns Map of action keys to their guard states\n * \n * @internal\n */\n getAllGuardStates(): Map<string, GuardState> {\n return new Map(this.guards);\n }\n\n /**\n * πŸ†• Explicit destroy method for comprehensive cleanup\n * \n * Cleans up all timers, promises, and intervals to prevent memory leaks.\n * Should be called when ActionGuard is no longer needed.\n * \n * @internal\n */\n destroy(): void {\n // Stop auto cleanup interval\n if (this.cleanupInterval) {\n clearInterval(this.cleanupInterval);\n this.cleanupInterval = undefined;\n }\n \n // Clear all existing guards\n this.clearAll();\n }\n\n /**\n * πŸ†• Get statistics about active guards\n * \n * @returns Statistics about guard usage\n * \n * @internal\n */\n getStats(): { activeGuards: number; withTimers: number } {\n let withTimers = 0;\n this.guards.forEach(state => {\n if (state.debounceTimer || state.throttleTimer) {\n withTimers++;\n }\n });\n \n return {\n activeGuards: this.guards.size,\n withTimers\n };\n }\n}","/**\n * λ™μ‹œμ„± 문제 해결을 μœ„ν•œ μž‘μ—… 큐 μ‹œμŠ€ν…œ\n * \n * λͺ¨λ“  μƒνƒœ λ³€κ²½ μž‘μ—…μ„ μ§λ ¬ν™”ν•˜μ—¬ race condition을 λ°©μ§€ν•©λ‹ˆλ‹€.\n */\n\nexport interface QueuedOperation<T = any> {\n id: string;\n operation: () => T | Promise<T>;\n resolve: (value: T) => void;\n reject: (error: unknown) => void;\n priority?: number;\n timestamp: number;\n}\n\n/**\n * μž‘μ—… 큐 κ΄€λ¦¬μž\n * \n * 핡심 κΈ°λŠ₯:\n * 1. μž‘μ—… 직렬화 - λͺ¨λ“  μž‘μ—…μ„ μˆœμ„œλŒ€λ‘œ μ‹€ν–‰\n * 2. μš°μ„ μˆœμœ„ 지원 - μ€‘μš”ν•œ μž‘μ—… μš°μ„  처리\n * 3. μ—λŸ¬ 처리 - κ°œλ³„ μž‘μ—… μ‹€νŒ¨κ°€ 전체에 영ν–₯ μ£Όμ§€ μ•ŠμŒ\n * 4. λ©”λͺ¨λ¦¬ 관리 - μ™„λ£Œλœ μž‘μ—… μžλ™ 정리\n * 5. πŸ†• λ™μ‹œμ„± μ œμ–΄ - maxConcurrency둜 λ™μ‹œ μ‹€ν–‰ μ œν•œ\n */\nexport class OperationQueue {\n private queue: QueuedOperation[] = [];\n private processingPromise: Promise<void> | null = null;\n private operationCounter = 0;\n \n // πŸ†• Concurrency control\n private activeOperations = 0;\n private readonly maxConcurrency: number;\n private readonly runningOperations = new Set<Promise<any>>();\n \n constructor(\n private name: string = 'OperationQueue', \n maxConcurrency: number = 1\n ) {\n this.maxConcurrency = Math.max(1, maxConcurrency);\n }\n\n /**\n * μž‘μ—…μ„ 큐에 μΆ”κ°€ν•˜κ³  μ‹€ν–‰ κ²°κ³Όλ₯Ό λ°˜ν™˜\n * \n * @param operation μ‹€ν–‰ν•  μž‘μ—…\n * @param priority μš°μ„ μˆœμœ„ (λ†’μ„μˆ˜λ‘ λ¨Όμ € μ‹€ν–‰)\n * @returns Promise둜 λž˜ν•‘λœ μž‘μ—… κ²°κ³Ό\n */\n enqueue<T>(operation: () => T | Promise<T>, priority: number = 0): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n const queuedOperation: QueuedOperation<T> = {\n id: `${this.name}-${++this.operationCounter}`,\n operation,\n resolve,\n reject,\n priority,\n timestamp: Date.now()\n };\n\n // μš°μ„ μˆœμœ„μ— 따라 μ‚½μž… μœ„μΉ˜ κ²°μ •\n let insertIndex = this.queue.length;\n for (let i = 0; i < this.queue.length; i++) {\n if ((this.queue[i].priority || 0) < priority) {\n insertIndex = i;\n break;\n }\n }\n\n this.queue.splice(insertIndex, 0, queuedOperation);\n \n // 큐 처리 μ‹œμž‘ (이미 처리 쀑이면 λ¬΄μ‹œλ¨)\n this.processQueue();\n });\n }\n\n /**\n * πŸ†• 큐 처리 메인 둜직 - λ™μ‹œμ„± μ œμ–΄ 지원\n * \n * maxConcurrency에 따라 λ™μ‹œ μ‹€ν–‰ μž‘μ—… 수λ₯Ό μ œν•œν•˜μ—¬ λ™μ‹œμ„± 문제 λ°©μ§€\n */\n private async processQueue(): Promise<void> {\n if (this.processingPromise) {\n return this.processingPromise;\n }\n \n this.processingPromise = this._doProcess();\n try {\n await this.processingPromise;\n } finally {\n this.processingPromise = null;\n }\n }\n \n private async _doProcess(): Promise<void> {\n while (this.queue.length > 0 || this.runningOperations.size > 0) {\n // πŸ†• λ™μ‹œμ„± μ œμ–΄: maxConcurrency 만큼만 λ™μ‹œ μ‹€ν–‰\n while (this.queue.length > 0 && this.activeOperations < this.maxConcurrency) {\n const operation = this.queue.shift()!;\n this.activeOperations++;\n \n // πŸ†• 비동기 μž‘μ—… μ‹€ν–‰ 및 좔적\n const operationPromise = this.executeOperation(operation);\n this.runningOperations.add(operationPromise);\n \n // πŸ†• μž‘μ—… μ™„λ£Œ μ‹œ 정리\n operationPromise.finally(() => {\n this.activeOperations--;\n this.runningOperations.delete(operationPromise);\n });\n }\n \n // πŸ†• μ‹€ν–‰ 쀑인 μž‘μ—…μ΄ 있으면 ν•˜λ‚˜κ°€ μ™„λ£Œλ  λ•ŒκΉŒμ§€ λŒ€κΈ°\n if (this.runningOperations.size > 0) {\n await Promise.race(this.runningOperations);\n }\n }\n }\n \n /**\n * πŸ†• κ°œλ³„ μž‘μ—… μ‹€ν–‰ 둜직\n */\n private async executeOperation<T>(operation: QueuedOperation<T>): Promise<void> {\n try {\n // μž‘μ—… μ‹€ν–‰ (동기/비동기 λͺ¨λ‘ 지원)\n const result = await Promise.resolve(operation.operation());\n operation.resolve(result);\n } catch (error) {\n // κ°œλ³„ μž‘μ—… μ‹€νŒ¨λŠ” 전체 큐에 영ν–₯ μ£Όμ§€ μ•ŠμŒ\n operation.reject(error);\n }\n }\n\n /**\n * πŸ†• ν˜„μž¬ 큐 μƒνƒœ 쑰회 (λ””λ²„κΉ…μš©) - λ™μ‹œμ„± 정보 포함\n */\n getQueueInfo() {\n return {\n name: this.name,\n queueLength: this.queue.length,\n isProcessing: Boolean(this.processingPromise),\n activeOperations: this.activeOperations,\n maxConcurrency: this.maxConcurrency,\n runningOperationsCount: this.runningOperations.size,\n operations: this.queue.map(op => ({\n id: op.id,\n priority: op.priority,\n timestamp: op.timestamp\n }))\n };\n }\n \n /**\n * πŸ†• λ™μ‹œμ„± μ„€μ • 쑰회\n */\n getConcurrencyInfo() {\n return {\n maxConcurrency: this.maxConcurrency,\n activeOperations: this.activeOperations,\n availableSlots: this.maxConcurrency - this.activeOperations,\n queuedOperations: this.queue.length,\n efficiency: this.activeOperations / this.maxConcurrency\n };\n }\n\n /**\n * 큐 λΉ„μš°κΈ° (ν…ŒμŠ€νŠΈμš©)\n */\n clear(): void {\n // λŒ€κΈ° 쀑인 μž‘μ—…λ“€μ—κ²Œ μ·¨μ†Œ μ•Œλ¦Ό\n this.queue.forEach(operation => {\n operation.reject(new Error('Queue cleared'));\n });\n \n this.queue = [];\n this.processingPromise = null;\n }\n\n /**\n * 큐 크기 쑰회\n */\n get size(): number {\n return this.queue.length;\n }\n\n /**\n * 처리 쀑 μ—¬λΆ€ 쑰회 \n */\n get processing(): boolean {\n return Boolean(this.processingPromise);\n }\n}","\nimport {\n ActionPayloadMap,\n ActionHandler,\n HandlerConfig,\n HandlerRegistration,\n PipelineContext,\n PipelineController,\n ActionRegisterConfig,\n UnregisterFunction,\n ExecutionMode,\n ExecutionResult,\n ActionRegistryInfo,\n ActionHandlerStats,\n} from './types.js';\nimport { executeSequential, executeParallel, executeRace } from './execution-modes.js';\nimport { ActionGuard } from './action-guard.js';\nimport { OperationQueue } from './concurrency/OperationQueue.js';\n\n/**\n * Action Register for managing action handlers with priority-based execution\n * \n * Central action registration and dispatch system providing type-safe action pipeline management.\n * Supports sequential, parallel, and race execution modes with advanced handler filtering,\n * throttling, debouncing, and comprehensive result collection.\n * \n * @template TActionMap - Action payload mapping interface extending ActionPayloadMap\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/\n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/register-delegation\n * \n * @public\n */\nexport class ActionRegister<T extends ActionPayloadMap = ActionPayloadMap> {\n private pipelines = new Map<keyof T, Array<HandlerRegistration<any, any>>>();\n private readonly actionGuard: ActionGuard;\n private executionMode: ExecutionMode = 'sequential';\n private actionExecutionModes = new Map<keyof T, ExecutionMode>();\n public readonly name: string;\n private readonly registryConfig: ActionRegisterConfig['registry'];\n\n // πŸ†• Performance optimizations\n private readonly isDebugMode: boolean;\n private readonly maxHandlersPerAction: number;\n\n // πŸ†• λ™μ‹œμ„± 문제 해결을 μœ„ν•œ 큐 μ‹œμŠ€ν…œ (conditional)\n private dispatchQueue?: OperationQueue;\n\n // πŸ”§ Performance optimization: Filter cache\n private filterCache = new Map<string, HandlerRegistration<any, any>[]>();\n private filterCacheMaxSize = 100; // Prevent memory bloat\n\n constructor(config: ActionRegisterConfig = {}) {\n this.name = config.name || 'ActionRegister';\n this.registryConfig = config.registry;\n this.maxHandlersPerAction = config.registry?.maxHandlersPerAction ?? 1000;\n \n // πŸ†• Environment variable check cached (performance optimization)\n this.isDebugMode = Boolean(\n this.registryConfig?.debug && \n process.env.NODE_ENV === 'development'\n );\n \n // Guard creation with improved cleanup handling\n this.actionGuard = new ActionGuard(this.registryConfig?.autoCleanup !== false);\n \n // πŸ†• Conditional queue system initialization\n if (config.registry?.useConcurrencyQueue !== false) {\n this.dispatchQueue = new OperationQueue(`${this.name}-Dispatch`);\n }\n \n if (this.registryConfig?.defaultExecutionMode) {\n this.executionMode = this.registryConfig.defaultExecutionMode;\n }\n \n this.log('ActionRegister initialized', {\n defaultExecutionMode: this.executionMode,\n autoCleanup: this.registryConfig?.autoCleanup !== false,\n concurrencyQueue: Boolean(this.dispatchQueue),\n debugMode: this.isDebugMode\n });\n }\n\n /**\n * Register an action handler with optional configuration\n * \n * @param action - The action type to register handler for\n * @param handler - The handler function to execute\n * @param config - Optional handler configuration including priority, tags, etc.\n * \n * @returns Unregister function to remove this handler\n * \n * @throws {Error} When maximum handlers limit is reached\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * \n * @public\n */\n register<K extends keyof T, R = void>(\n action: K,\n handler: ActionHandler<T[K], R>,\n config: HandlerConfig = {}\n ): UnregisterFunction {\n // πŸ”„ μž„μ‹œλ‘œ κΈ°μ‘΄ κ΅¬ν˜„ μœ μ§€ν•˜λ˜ κ°œμ„ λœ 방식 적용\n // 동기적 APIλ₯Ό μœ μ§€ν•˜λ©΄μ„œ λ‚΄λΆ€μ μœΌλ‘œλ§Œ λ™μ‹œμ„± 보호\n \n // πŸ†• Optimized handler ID generation\n const handlerId = config.id || this.generateHandlerId(action);\n \n // πŸ†• Direct synchronous registration\n const unregisterFn = this._performRegistrationSync(action, handler, config, handlerId);\n \n return unregisterFn;\n }\n\n /**\n * πŸ†• Unified logging method with cached debug mode check\n */\n private log(message: string, data?: unknown, level: 'log' | 'warn' | 'error' = 'log') {\n if (this.isDebugMode) {\n const timestamp = new Date().toISOString();\n console[level](`🎯 [${timestamp}] [${this.name}] ${message}`, data || '');\n }\n }\n\n /**\n * πŸ†• Generate unique handler ID using crypto\n */\n private generateHandlerId<K extends keyof T>(action: K): string {\n // Use crypto.randomUUID() for guaranteed uniqueness\n const uuid = crypto.randomUUID();\n return `${String(action)}_${uuid.slice(0, 8)}`;\n }\n\n /**\n * πŸ”§ Create and merge AbortSignal instances with proper cleanup\n * \n * @param options Dispatch options containing signal and autoAbort configuration\n * @returns [effectiveSignal, autoAbortController, cleanupFunction]\n */\n private createAbortSignal(options?: import('./types.js').DispatchOptions): [\n AbortSignal | undefined, \n AbortController | undefined, \n () => void\n ] {\n const signals: AbortSignal[] = [];\n const cleanups: (() => void)[] = [];\n let autoAbortController: AbortController | undefined;\n\n // Add existing signal if provided\n if (options?.signal) {\n signals.push(options.signal);\n }\n\n // Create auto-abort controller if enabled\n if (options?.autoAbort?.enabled) {\n autoAbortController = new AbortController();\n signals.push(autoAbortController.signal);\n }\n\n // No signals to merge\n if (signals.length === 0) {\n return [undefined, autoAbortController, () => {}];\n }\n\n // Single signal - no merge needed\n if (signals.length === 1) {\n return [signals[0], autoAbortController, () => cleanups.forEach(c => c())];\n }\n\n // Multiple signals - use AbortSignal.any() if available, fallback to manual merge\n let effectiveSignal: AbortSignal;\n \n if (typeof AbortSignal.any === 'function') {\n // Modern browsers with AbortSignal.any()\n effectiveSignal = AbortSignal.any(signals);\n } else {\n // Fallback: Create controller and link all signals\n const mergedController = new AbortController();\n effectiveSignal = mergedController.signal;\n \n signals.forEach(signal => {\n if (signal.aborted) {\n mergedController.abort();\n } else {\n const abortHandler = () => mergedController.abort();\n signal.addEventListener('abort', abortHandler, { once: true });\n cleanups.push(() => signal.removeEventListener('abort', abortHandler));\n }\n });\n }\n\n const cleanup = () => {\n cleanups.forEach(c => {\n try {\n c();\n } catch (error) {\n this.log('Cleanup error during AbortSignal cleanup', error, 'warn');\n }\n });\n };\n\n return [effectiveSignal, autoAbortController, cleanup];\n }\n\n /**\n * πŸ†• Perform synchronous handler registration\n */\n private _performRegistrationSync<K extends keyof T, R = void>(\n action: K,\n handler: ActionHandler<T[K], R>,\n config: HandlerConfig,\n handlerId: string\n ): UnregisterFunction {\n // Create handler registration with defaults\n const registration: HandlerRegistration<T[K], R> = {\n handler,\n config: {\n priority: config.priority ?? 0,\n id: handlerId,\n blocking: config.blocking ?? false,\n once: config.once ?? false,\n debounce: config.debounce ?? undefined,\n throttle: config.throttle ?? undefined,\n replaceExisting: config.replaceExisting ?? false,\n } as Required<HandlerConfig>,\n id: handlerId,\n };\n \n // Initialize pipeline if it doesn't exist\n if (!this.pipelines.has(action)) {\n this.pipelines.set(action, []);\n }\n\n const pipeline = this.pipelines.get(action)!;\n \n // Check handler limit\n if (pipeline.length >= this.maxHandlersPerAction) {\n console.warn(`Handler limit (${this.maxHandlersPerAction}) reached for action \"${String(action)}\". Registration ignored.`);\n return () => {}; // No-op unregister\n }\n const existingIndex = pipeline.findIndex(reg => reg.id === handlerId);\n\n // πŸ†• Enhanced duplicate ID handling with replaceExisting support and cleanup\n if (existingIndex !== -1) {\n if (config.replaceExisting) {\n // πŸ”§ Memory leak fix: Clean up existing handler before replacement\n const oldRegistration = pipeline[existingIndex];\n \n // Call cleanup if available on the old handler\n if (oldRegistration && typeof (oldRegistration as any).cleanup === 'function') {\n try {\n (oldRegistration as any).cleanup();\n } catch (cleanupError) {\n this.log(`Cleanup error for replaced handler: ${String(action)}`, cleanupError, 'warn');\n }\n }\n \n // Replace existing handler\n pipeline[existingIndex] = registration;\n \n // Re-sort pipeline since priority might have changed\n pipeline.sort((a, b) => b.config.priority - a.config.priority);\n \n // πŸ”§ Invalidate filter cache when pipeline changes\n this.invalidateFilterCache();\n \n this.log(`Handler replaced: ${String(action)}`, {\n handlerId,\n priority: config.priority,\n totalHandlers: pipeline.length,\n oldHandlerCleaned: Boolean((oldRegistration as any).cleanup)\n });\n\n // Return unregister function for the replaced registration\n return () => {\n const index = pipeline.findIndex(reg => reg.id === handlerId && reg === registration);\n if (index !== -1) {\n pipeline.splice(index, 1);\n // πŸ”§ Invalidate filter cache when pipeline changes\n this.invalidateFilterCache();\n this.log(`Replaced handler unregistered: ${String(action)}`, { handlerId });\n }\n };\n } else {\n // Default mode: reject duplicate (backward compatibility)\n this.log(`Handler duplicate ignored: ${String(action)}`, {\n handlerId,\n note: 'Use replaceExisting:true to replace'\n }, 'warn');\n return () => {}; // No-op unregister\n }\n }\n \n // Add handler to pipeline\n pipeline.push(registration);\n \n // πŸ†• μ¦‰μ‹œ μ •λ ¬ (λ™μ‹œμ„± 보호)\n pipeline.sort((a, b) => b.config.priority - a.config.priority);\n \n // πŸ”§ Invalidate filter cache when pipeline changes\n this.invalidateFilterCache();\n \n this.log(`Handler registered: ${String(action)}`, {\n handlerId,\n priority: config.priority,\n totalHandlers: pipeline.length\n });\n\n // Return unregister function that removes this specific registration\n return () => {\n const index = pipeline.findIndex((reg) => reg.id === handlerId && reg === registration);\n if (index !== -1) {\n pipeline.splice(index, 1);\n // πŸ”§ Invalidate filter cache when pipeline changes\n this.invalidateFilterCache();\n this.log(`Handler unregistered: ${String(action)}`, {\n handlerId,\n remainingHandlers: pipeline.length\n });\n }\n };\n }\n\n\n /**\n * Dispatch an action with optional execution options\n * \n * @param action - The action type to dispatch\n * @param payload - The action payload data\n * @param options - Optional dispatch options (execution mode, filters, etc.)\n * \n * @returns Promise that resolves when all handlers complete\n * \n * @throws {Error} When action dispatching fails\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * \n * @public\n */\n async dispatch<K extends keyof T>(\n action: K,\n payload?: T[K],\n options?: import('./types.js').DispatchOptions\n ): Promise<void> {\n // πŸ†• Conditional queue usage for performance\n if (options?.immediate || !this.dispatchQueue) {\n // Bypass queue for immediate execution or when queues disabled\n return this._performDispatch(action, payload, options);\n } else {\n // Use queue for concurrency protection\n return this.dispatchQueue.enqueue(async () => {\n return this._performDispatch(action, payload, options);\n });\n }\n }\n\n /**\n * πŸ†• μ‹€μ œ λ””μŠ€νŒ¨μΉ˜ μž‘μ—… μˆ˜ν–‰ (νμ—μ„œ 호좜됨)\n */\n private async _performDispatch<K extends keyof T>(\n action: K,\n payload?: T[K],\n options?: import('./types.js').DispatchOptions\n ): Promise<void> {\n // Simple Event object detection for development\n if (payload instanceof Event && process.env.NODE_ENV === 'development') {\n console.warn(`Event object passed to action \"${String(action)}\"`, payload.type);\n }\n \n // πŸ”§ Improved AbortSignal handling with cleaner merge logic\n const [effectiveSignal, autoAbortController, cleanup] = this.createAbortSignal(options);\n \n if (options?.autoAbort?.onControllerCreated && autoAbortController) {\n options.autoAbort.onControllerCreated(autoAbortController);\n }\n \n // Check if dispatch is aborted before starting\n if (effectiveSignal?.aborted) {\n return;\n }\n \n const pipeline = this.pipelines.get(action);\n if (!pipeline || pipeline.length === 0) {\n return;\n }\n\n // πŸ†• Optimize filtering - only copy array if filtering is needed\n const filteredHandlers = options?.filter \n ? this.filterHandlers(pipeline, options.filter)\n : pipeline;\n\n // Apply ActionGuard controls - check both dispatch options and handler configs\n const actionKey = String(action);\n \n // Get throttle/debounce settings from dispatch options or handler configs\n let throttleMs: number | undefined;\n let debounceMs: number | undefined;\n \n // Priority: dispatch options > handler config\n if (options?.throttle !== undefined) {\n throttleMs = options.throttle;\n } else if (filteredHandlers.length > 0) {\n // Use throttle from the first handler that has it (handlers are sorted by priority)\n for (const handler of filteredHandlers) {\n if (handler.config.throttle !== undefined) {\n throttleMs = handler.config.throttle;\n break;\n }\n }\n }\n \n if (options?.debounce !== undefined) {\n debounceMs = options.debounce;\n } else if (filteredHandlers.length > 0) {\n // Use debounce from the first handler that has it (handlers are sorted by priority)\n for (const handler of filteredHandlers) {\n if (handler.config.debounce !== undefined) {\n debounceMs = handler.config.debounce;\n break;\n }\n }\n }\n \n // Apply debounce if specified\n if (debounceMs !== undefined) {\n const shouldProceed = await this.actionGuard.debounce(actionKey, debounceMs);\n if (!shouldProceed) {\n return; // Debounced - don't execute\n }\n }\n \n // Apply throttle if specified\n if (throttleMs !== undefined) {\n const shouldProceed = this.actionGuard.throttle(actionKey, throttleMs);\n if (!shouldProceed) {\n return; // Throttled - don't execute\n }\n }\n\n // Determine execution mode for this action (with option override)\n const currentExecutionMode = options?.executionMode || \n this.actionExecutionModes.get(action) || \n this.executionMode;\n\n // Create pipeline execution context\n const context: PipelineContext<T[K], any> = {\n action: String(action),\n payload: payload as T[K],\n handlers: filteredHandlers, // Use filtered handlers\n aborted: false,\n abortReason: undefined,\n currentIndex: 0,\n jumpToPriority: undefined,\n executionMode: currentExecutionMode,\n \n // New result collection fields\n results: [],\n terminated: false,\n terminationResult: undefined,\n };\n\n const _startTime = Date.now();\n let _executionSuccess = true;\n \n // Add abort listener if signal provided (use effectiveSignal for auto-abort)\n const abortHandler = effectiveSignal ? () => {\n context.aborted = true;\n context.abortReason = 'Action dispatch aborted by signal';\n } : undefined;\n \n if (effectiveSignal && abortHandler) {\n effectiveSignal.addEventListener('abort', abortHandler);\n }\n \n try {\n await this.executePipeline(context, autoAbortController, options?.autoAbort);\n this.log(`Pipeline execution succeeded for ${String(action)}`);\n } catch (error) {\n this.log(`Pipeline execution failed for ${String(action)}`, error, 'error');\n _executionSuccess = false;\n throw error;\n } finally {\n // πŸ”§ Use cleanup function from createAbortSignal\n cleanup();\n }\n }\n\n /**\n * Dispatch an action and return detailed execution results\n * \n * @param action - The action type to dispatch\n * @param payload - The action payload data\n * @param options - Optional dispatch options including result collection strategy\n * \n * @returns Promise resolving to comprehensive execution results\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * \n * @public\n */\n async dispatchWithResult<K extends keyof T, R = void>(\n action: K,\n payload?: T[K],\n options?: import('./types.js').DispatchOptions\n ): Promise<ExecutionResult<R>> {\n const _startTime = Date.now();\n \n // πŸ”§ Improved AbortSignal handling with cleaner merge logic (same as dispatch)\n const [effectiveSignal, autoAbortController, cleanup] = this.createAbortSignal(options);\n \n if (options?.autoAbort?.onControllerCreated && autoAbortController) {\n options.autoAbort.onControllerCreated(autoAbortController);\n }\n \n // Check if dispatch is aborted before starting\n if (effectiveSignal?.aborted) {\n return {\n success: false,\n aborted: true,\n abortReason: 'Action dispatch aborted by signal',\n terminated: false,\n result: undefined as any,\n successResults: [] as any,\n results: [],\n failedResults: [],\n execution: {\n duration: 0,\n handlersExecuted: 0,\n handlersSkipped: 0,\n handlersFailed: 0,\n startTime: _startTime,\n endTime: _startTime,\n },\n handlers: [],\n errors: [],\n };\n }\n \n const pipeline = this.pipelines.get(action);\n \n if (!pipeline || pipeline.length === 0) {\n return {\n success: true,\n aborted: false,\n terminated: false,\n result: undefined as any,\n successResults: [] as any,\n results: [],\n failedResults: [],\n execution: {\n duration: 0,\n handlersExecuted: 0,\n handlersSkipped: 0,\n handlersFailed: 0,\n startTime: _startTime,\n endTime: _startTime,\n },\n handlers: [],\n errors: [],\n };\n }\n\n // πŸ†• Optimize filtering - only copy array if filtering is needed\n const filteredHandlers = options?.filter \n ? this.filterHandlers(pipeline, options.filter)\n : pipeline;\n\n // Apply ActionGuard controls - check both dispatch options and handler configs\n const actionKey = String(action);\n \n // Get throttle/debounce settings from dispatch options or handler configs\n let throttleMs: number | undefined;\n let debounceMs: number | undefined;\n \n // Priority: dispatch options > handler config\n if (options?.throttle !== undefined) {\n throttleMs = options.throttle;\n } else if (filteredHandlers.length > 0) {\n // Use throttle from the first handler that has it (handlers are sorted by priority)\n for (const handler of filteredHandlers) {\n if (handler.config.throttle !== undefined) {\n throttleMs = handler.config.throttle;\n break;\n }\n }\n }\n \n if (options?.debounce !== undefined) {\n debounceMs = options.debounce;\n } else if (filteredHandlers.length > 0) {\n // Use debounce from the first handler that has it (handlers are sorted by priority)\n for (const handler of filteredHandlers) {\n if (handler.config.debounce !== undefined) {\n debounceMs = handler.config.debounce;\n break;\n }\n }\n }\n \n // Apply debounce if specified\n if (debounceMs !== undefined) {\n const shouldProceed = await this.actionGuard.debounce(actionKey, debounceMs);\n if (!shouldProceed) {\n return {\n success: false,\n aborted: true,\n abortReason: 'Debounced execution',\n terminated: false,\n result: undefined as any,\n successResults: [] as any,\n results: [],\n failedResults: [],\n execution: {\n duration: Date.now() - _startTime,\n handlersExecuted: 0,\n handlersSkipped: pipeline.length,\n handlersFailed: 0,\n startTime: _startTime,\n endTime: Date.now(),\n },\n handlers: [],\n errors: [],\n };\n }\n }\n \n // Apply throttle if specified\n if (throttleMs !== undefined) {\n const shouldProceed = this.actionGuard.throttle(actionKey, throttleMs);\n if (!shouldProceed) {\n return {\n success: false,\n aborted: true,\n abortReason: 'Throttled execution',\n terminated: false,\n result: undefined as any,\n successResults: [] as any,\n results: [],\n failedResults: [],\n execution: {\n duration: Date.now() - _startTime,\n handlersExecuted: 0,\n handlersSkipped: pipeline.length,\n handlersFailed: 0,\n startTime: _startTime,\n endTime: Date.now(),\n },\n handlers: [],\n errors: [],\n };\n }\n }\n\n // Determine execution mode for this action (with option override)\n const currentExecutionMode = options?.executionMode || \n this.actionExecutionModes.get(action) || \n this.executionMode;\n\n // Create pipeline execution context\n const context: PipelineContext<T[K], R> = {\n action: String(action),\n payload: payload as T[K],\n handlers: filteredHandlers,\n aborted: false,\n abortReason: undefined,\n currentIndex: 0,\n jumpToPriority: undefined,\n executionMode: currentExecutionMode,\n \n // Result collection fields\n results: [],\n terminated: false,\n terminationResult: undefined,\n };\n\n let executionError: Error | undefined;\n const handlerResults: Array<{\n id: string;\n executed: boolean;\n duration?: number;\n result?: R;\n error?: Error;\n metadata?: Record<string, any>;\n }> = [];\n\n const errors: Array<{\n handlerId: string;\n error: Error;\n timestamp: number;\n }> = [];\n\n // Add abort listener if signal provided (use effectiveSignal for auto-abort)\n const abortHandler = effectiveSignal ? () => {\n context.aborted = true;\n context.abortReason = 'Action dispatch aborted by signal';\n } : undefined;\n \n if (effectiveSignal && abortHandler) {\n effectiveSignal.addEventListener('abort', abortHandler);\n }\n \n try {\n await this.executePipeline(context, autoAbortController, options?.autoAbort);\n } catch (error) {\n executionError = error instanceof Error ? error : new Error(String(error));\n errors.push({\n handlerId: 'pipeline',\n error: executionError,\n timestamp: Date.now(),\n });\n } finally {\n // πŸ”§ Use cleanup function from createAbortSignal\n cleanup();\n }\n\n const endTime = Date.now();\n const _executionSuccess = !executionError && !context.aborted;\n \n // Process results based on options\n const processedResult = this.processResults(context, options?.result);\n\n // πŸ”§ Type safety: Separate successful results from failed ones\n const successResults = context.results.filter((result): result is R => result !== undefined);\n const failedResults = errors.map(err => ({\n handlerId: err.handlerId,\n error: err.error,\n expectedType: typeof processedResult\n }));\n\n // Build execution result with improved type safety\n const executionResult: ExecutionResult<R> = {\n success: !executionError && !context.aborted,\n aborted: context.aborted,\n abortReason: context.abortReason,\n terminated: context.terminated,\n result: processedResult,\n successResults: successResults,\n results: context.results,\n failedResults,\n execution: {\n duration: endTime - _startTime,\n handlersExecuted: context.currentIndex + (context.aborted ? 0 : 1),\n handlersSkipped: Math.max(0, filteredHandlers.length - (context.currentIndex + 1)),\n handlersFailed: errors.length,\n startTime: _startTime,\n endTime,\n },\n handlers: handlerResults as any, // Type assertion needed for handlers array\n errors: errors.map(err => ({\n handlerId: err.handlerId,\n error: err.error,\n timestamp: err.timestamp,\n severity: 'non-blocking' as const\n })),\n };\n\n /** Clean up one-time handlers after execution */\n this.cleanupOneTimeHandlers(action, context.handlers);\n\n return executionResult;\n }\n\n /**\n * πŸ”§ Generate cache key for filter options\n */\n private generateFilterCacheKey(filterOptions?: import('./types.js').DispatchOptions['filter']): string {\n if (!filterOptions) {\n return 'no-filter';\n }\n \n // Create deterministic cache key from filter options\n const key = [\n filterOptions.handlerIds?.sort().join(',') || 'none',\n filterOptions.excludeHandlerIds?.sort().join(',') || 'none',\n filterOptions.priority?.min?.toString() || 'none',\n filterOptions.priority?.max?.toString() || 'none',\n filterOptions.custom ? 'custom' : 'none'\n ].join('|');\n \n return key;\n }\n\n /**\n * πŸ”§ Clear filter cache when pipelines change\n */\n private invalidateFilterCache(): void {\n this.filterCache.clear();\n }\n\n private filterHandlers<_K extends keyof T>(\n handlers: HandlerRegistration<any, any>[],\n filterOptions?: import('./types.js').DispatchOptions['filter']\n ): HandlerRegistration<any, any>[] {\n if (!filterOptions) {\n return handlers;\n }\n\n // πŸ”§ Performance optimization: Use cache for filter results\n const cacheKey = this.generateFilterCacheKey(filterOptions);\n \n // Skip cache for custom filter functions (can't be cached safely)\n if (!filterOptions.custom) {\n const cached = this.filterCache.get(cacheKey);\n if (cached) {\n return cached;\n }\n }\n\n // πŸ†• Use filter method directly (already returns new array)\n const filtered = handlers.filter(registration => {\n const config = registration.config;\n\n // πŸ†• Short-circuit evaluation for performance\n if (filterOptions.handlerIds?.length && \n !filterOptions.handlerIds.includes(config.id)) {\n return false;\n }\n\n if (filterOptions.excludeHandlerIds?.length && \n filterOptions.excludeHandlerIds.includes(config.id)) {\n return false;\n }\n\n // πŸ†• Enhanced priority filtering\n if (filterOptions.priority) {\n if (filterOptions.priority.min !== undefined && \n config.priority < filterOptions.priority.min) {\n return false;\n }\n if (filterOptions.priority.max !== undefined && \n config.priority > filterOptions.priority.max) {\n return false;\n }\n }\n\n if (filterOptions.custom && !filterOptions.custom(config)) {\n return false;\n }\n\n return true;\n });\n\n // πŸ”§ Cache the result if no custom filter\n if (!filterOptions.custom) {\n // Prevent cache bloat\n if (this.filterCache.size >= this.filterCacheMaxSize) {\n // Remove oldest entries (simple LRU approximation)\n const firstKey = this.filterCache.keys().next().value;\n if (firstKey) {\n this.filterCache.delete(firstKey);\n }\n }\n \n this.filterCache.set(cacheKey, filtered);\n }\n\n return filtered;\n }\n\n private processResults<R>(\n context: PipelineContext<any, R>,\n resultOptions?: import('./types.js').DispatchOptions['result']\n ): R | undefined {\n if (!resultOptions || !resultOptions.collect) {\n return undefined;\n }\n\n const results = context.results;\n \n // Handle termination result\n if (context.terminated && context.terminationResult !== undefined) {\n return context.terminationResult;\n }\n\n // Apply maxResults limit\n const limitedResults = resultOptions.maxResults \n ? results.slice(0, resultOptions.maxResults)\n : results;\n\n if (limitedResults.length === 0) {\n return undefined;\n }\n\n // Process results based on strategy\n switch (resultOptions.strategy) {\n case 'first':\n return limitedResults[0];\n case 'last':\n return limitedResults[limitedResults.length - 1];\n case 'all':\n return limitedResults as unknown as R;\n case 'merge':\n if (resultOptions.merger) {\n return resultOptions.merger(limitedResults);\n }\n // Default merge: return last result\n return limitedResults[limitedResults.length - 1];\n case 'custom':\n if (resultOptions.merger) {\n return resultOptions.merger(limitedResults);\n }\n throw new Error('Custom result strategy requires a merger function');\n default:\n // Default: return all results\n return limitedResults as unknown as R;\n }\n }\n\n private async executePipeline<K extends keyof T>(\n context: PipelineContext<T[K], any>, \n autoAbortController?: AbortController,\n autoAbortOptions?: { allowHandlerAbort?: boolean }\n ): Promise<void> {\n const createController = (_registration: HandlerRegistration<T[K], any>, _index: number): PipelineController<T[K], any> => {\n return {\n abort: (reason?: string) => {\n context.aborted = true;\n context.abortReason = reason;\n \n // Auto-abort: Handler can trigger pipeline abort if enabled\n if (autoAbortController && autoAbortOptions?.allowHandlerAbort) {\n autoAbortController.abort(reason);\n }\n },\n modifyPayload: (modifier: (payload: T[K]) => T[K]) => {\n context.payload = modifier(context.payload);\n },\n getPayload: () => context.payload,\n jumpToPriority: (priority: number) => {\n context.jumpToPriority = priority;\n },\n return: (result: any) => {\n context.terminated = true;\n context.terminationResult = result;\n },\n setResult: (result: any) => {\n context.results.push(result);\n },\n getResults: () => {\n return [...context.results];\n },\n mergeResult: (merger: (previousResults: any[], currentResult: any) => any) => {\n const currentResult = context.results[context.results.length - 1];\n const previousResults = context.results.slice(0, -1);\n const mergedResult = merger(previousResults, currentResult);\n context.results[context.results.length - 1] = mergedResult;\n },\n };\n };\n\n switch (context.executionMode) {\n case 'sequential':\n await executeSequential<T[K], any>(context, createController);\n break;\n case 'parallel':\n await executeParallel<T[K], any>(context, createController);\n break;\n case 'race':\n await executeRace<T[K], any>(context, createController);\n break;\n default:\n throw new Error(`Unknown execution mode: ${context.executionMode}`);\n }\n\n this.cleanupOneTimeHandlers(context.action as K, context.handlers);\n }\n\n private cleanupOneTimeHandlers<K extends keyof T>(action: K, executedHandlers: HandlerRegistration<any, any>[]): void {\n const pipeline = this.pipelines.get(action);\n if (!pipeline) return;\n\n const oneTimeHandlers = executedHandlers.filter(reg => reg.config.once);\n if (oneTimeHandlers.length === 0) return;\n\n oneTimeHandlers.forEach(registration => {\n const index = pipeline.findIndex(reg => reg.id === registration.id);\n if (index !== -1) {\n pipeline.splice(index, 1);\n \n if (this.registryConfig?.debug && process.env.NODE_ENV === 'development') {\n console.log(`🎯 One-time handler removed: ${String(action)}`, {\n handlerId: registration.id,\n remainingHandlers: pipeline.length,\n registry: this.name\n });\n }\n }\n });\n }\n\n\n /**\n * Get the number of registered handlers for an action\n * \n * @param action - The action type to count handlers for\n * \n * @returns Number of registered handlers\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * \n * @public\n */\n getHandlerCount<K extends keyof T>(action: K): number {\n const pipeline = this.pipelines.get(action);\n return pipeline ? pipeline.length : 0;\n }\n\n /**\n * Check if an action has any registered handlers\n * \n * @param action - The action type to check\n * \n * @returns True if action has handlers, false otherwise\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * \n * @public\n */\n hasHandlers<K extends keyof T>(action: K): boolean {\n return this.getHandlerCount(action) > 0;\n }\n\n /**\n * Get all registered action types\n * \n * @returns Array of all registered action types\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * \n * @public\n */\n getRegisteredActions(): (keyof T)[] {\n return Array.from(this.pipelines.keys());\n }\n\n /**\n * Remove all handlers for a specific action\n * \n * @param action - The action type to clear handlers for\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * \n * @public\n */\n clearAction<K extends keyof T>(action: K): void {\n this.pipelines.delete(action);\n // πŸ”§ Invalidate filter cache when pipeline changes\n this.invalidateFilterCache();\n }\n\n /**\n * Remove all handlers for all actions\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * \n * @public\n */\n clearAll(): void {\n this.pipelines.clear();\n // πŸ”§ Invalidate filter cache when pipeline changes\n this.invalidateFilterCache();\n }\n\n /**\n * Get the name of this action register\n * \n * @returns The register name\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * \n * @public\n */\n getName(): string {\n return this.name;\n }\n\n /**\n * Get comprehensive registry information (similar to DeclarativeStoreRegistry pattern)\n * \n * @returns Registry information including actions, handlers, and execution modes\n */\n getRegistryInfo(): ActionRegistryInfo<T> {\n const totalHandlers = Array.from(this.pipelines.values()).reduce(\n (total, pipeline) => total + pipeline.length, \n 0\n );\n \n return {\n name: this.name,\n totalActions: this.pipelines.size,\n totalHandlers,\n registeredActions: Array.from(this.pipelines.keys()),\n actionExecutionModes: new Map(this.actionExecutionModes),\n defaultExecutionMode: this.executionMode,\n };\n }\n\n /**\n * Get detailed statistics for a specific action\n * \n * @param action Action name to get statistics for\n * @returns Detailed handler statistics\n */\n getActionStats<K extends keyof T>(action: K): ActionHandlerStats<T> | null {\n const pipeline = this.pipelines.get(action);\n if (!pipeline) {\n return null;\n }\n\n // Group handlers by priority\n const priorityMap = new Map<number, typeof pipeline>();\n pipeline.forEach(handler => {\n if (!priorityMap.has(handler.config.priority)) {\n priorityMap.set(handler.config.priority, []);\n }\n priorityMap.get(handler.config.priority)!.push(handler);\n });\n\n const handlersByPriority = Array.from(priorityMap.entries())\n .sort(([a], [b]) => b - a) // Sort by priority (highest first)\n .map(([priority, handlers]) => ({\n priority,\n handlers: handlers.map(h => ({\n id: h.config.id,\n }))\n }));\n\n // Execution statistics are no longer tracked\n const executionStats = undefined;\n\n return {\n action,\n handlerCount: pipeline.length,\n totalHandlers: pipeline.length,\n handlersByPriority,\n executionStats,\n };\n }\n\n /**\n * Get statistics for all registered actions\n * \n * @returns Array of statistics for all actions\n */\n getAllActionStats(): Array<ActionHandlerStats<T>> {\n return Array.from(this.pipelines.keys())\n .map(action => this.getActionStats(action))\n .filter((stats): stats is ActionHandlerStats<T> => stats !== null);\n }\n\n\n /**\n * Set execution mode for a specific action\n * \n * @param action Action name\n * @param mode Execution mode to set\n */\n setActionExecutionMode<K extends keyof T>(action: K, mode: ExecutionMode): void {\n this.actionExecutionModes.set(action, mode);\n \n if (this.registryConfig?.debug && process.env.NODE_ENV === 'development') {\n console.log(`🎯 Execution mode set for action '${String(action)}': ${mode}`);\n }\n }\n\n /**\n * Get execution mode for a specific action\n * \n * @param action Action name\n * @returns Execution mode for the action, or default if not set\n */\n getActionExecutionMode<K extends keyof T>(action: K): ExecutionMode {\n return this.actionExecutionModes.get(action) || this.executionMode;\n }\n\n /**\n * Remove execution mode override for a specific action\n * \n * @param action Action name\n */\n removeActionExecutionMode<K extends keyof T>(action: K): void {\n this.actionExecutionModes.delete(action);\n \n if (this.registryConfig?.debug && process.env.NODE_ENV === 'development') {\n console.log(`🎯 Execution mode reset for action '${String(action)}' to default: ${this.executionMode}`);\n }\n }\n\n\n /**\n * Get registry configuration (for debugging and inspection)\n * \n * @returns Current registry configuration\n */\n getRegistryConfig(): ActionRegisterConfig['registry'] {\n return this.registryConfig;\n }\n\n /**\n * Check if registry has debug mode enabled\n * \n * @returns Whether debug mode is enabled\n */\n isDebugEnabled(): boolean {\n return this.isDebugMode;\n }\n\n /**\n * πŸ†• Destroy method for comprehensive cleanup\n * \n * Cleans up all internal resources including pipelines, guards, queues, and statistics.\n * Should be called when the ActionRegister is no longer needed to prevent memory leaks.\n * \n * @public\n */\n destroy(): void {\n // Clean up all pipelines\n this.pipelines.clear();\n \n // Clean up guard system\n this.actionGuard.destroy();\n \n // Clean up queues if they exist\n this.dispatchQueue?.clear?.();\n \n this.actionExecutionModes.clear();\n \n // πŸ”§ Clean up performance caches\n this.filterCache.clear();\n \n this.log('ActionRegister destroyed');\n }\n}","/**\n * @fileoverview React integration helpers for ActionRegister\n * \n * Provides React-specific utilities and hooks for seamless integration\n * with React components and lifecycle management.\n * \n * Note: This file provides utilities for React integration but does not\n * have direct React dependencies. Import React types externally when used.\n */\n\nimport type { \n ActionPayloadMap, \n ActionHandler, \n HandlerConfig,\n UnregisterFunction\n} from './types.js';\nimport type { ActionRegister } from './ActionRegister.js';\n\n/**\n * πŸ”§ Create action handler registration configuration for React components\n * \n * Creates a configuration object that can be used with React's useEffect to properly\n * register and unregister action handlers with lifecycle management and cleanup.\n * This is NOT a hook - it's a factory function for React hook integration.\n * \n * @template T - ActionPayloadMap type\n * @template K - Action key type\n * \n * @param registry - ActionRegister instance\n * @param action - Action name to register handler for\n * @param handler - Handler function (should be memoized with useCallback)\n * @param config - Handler configuration\n * \n * @returns Configuration object with register/unregister functions\n * \n * @example Basic Usage with useEffect\n * ```tsx\n * import { useCallback, useEffect } from 'react';\n * import { createActionHandler } from '@context-action/core/react-helpers';\n * \n * function MyComponent() {\n * const registry = useActionRegister();\n * \n * const handleUserUpdate = useCallback(async (payload, controller) => {\n * // Handler logic here\n * }, []);\n * \n * useEffect(() => {\n * const { register, unregister } = createActionHandler(\n * registry,\n * 'updateUser',\n * handleUserUpdate,\n * { priority: 10 }\n * );\n * \n * const cleanup = register();\n * return () => {\n * cleanup();\n * unregister();\n * };\n * }, [registry, handleUserUpdate]);\n * }\n * ```\n * \n * @example With Automatic Cleanup\n * ```tsx\n * const [userId, setUserId] = useState('123');\n * \n * const handleUserUpdate = useCallback(async (payload, controller) => {\n * console.log('Updating user:', userId, payload);\n * }, [userId]);\n * \n * useEffect(() => {\n * const handlerManager = createActionHandler(\n * registry,\n * 'updateUser',\n * handleUserUpdate,\n * { priority: 10 }\n * );\n * \n * // Simplified registration with automatic cleanup\n * return handlerManager.registerWithCleanup();\n * }, [registry, handleUserUpdate, userId]);\n * ```\n * \n * @public\n */\nexport function createActionHandler<T extends ActionPayloadMap, K extends keyof T>(\n registry: ActionRegister<T>,\n action: K,\n handler: ActionHandler<T[K]>,\n config?: HandlerConfig\n): {\n register: () => UnregisterFunction;\n unregister: () => void;\n registerWithCleanup: () => () => void;\n config: Required<HandlerConfig>;\n} {\n const finalConfig = createReactHandlerConfig(String(action), undefined, config);\n let currentUnregister: UnregisterFunction | undefined;\n let isRegistered = false;\n \n return {\n /**\n * Register the handler and return cleanup function\n */\n register(): UnregisterFunction {\n if (isRegistered && currentUnregister) {\n // Clean up previous registration\n currentUnregister();\n }\n \n currentUnregister = registry.register(action, handler, finalConfig);\n isRegistered = true;\n \n return currentUnregister;\n },\n \n /**\n * Unregister the handler if currently registered\n */\n unregister(): void {\n if (isRegistered && currentUnregister) {\n currentUnregister();\n currentUnregister = undefined;\n isRegistered = false;\n }\n },\n \n /**\n * Register and return cleanup function (React useEffect pattern)\n */\n registerWithCleanup(): () => void {\n const unregisterFn = this.register();\n \n return () => {\n unregisterFn();\n this.unregister();\n };\n },\n \n config: finalConfig\n };\n}\n\n/**\n * πŸ†• React handler configuration factory\n * \n * Creates optimized handler configurations for React environments with\n * proper cleanup and unique ID generation.\n * \n * @template T - ActionPayloadMap type\n * @template K - Action key type\n * \n * @param action - Action name\n * @param componentId - Optional component identifier for debugging\n * @param config - Base handler configuration\n * \n * @returns Optimized configuration for React environments\n * \n * @example\n * ```tsx\n * function MyComponent({ userId }: { userId: string }) {\n * const registry = useActionRegister();\n * \n * useEffect(() => {\n * const config = createReactHandlerConfig('updateUser', 'MyComponent', {\n * priority: 10\n * });\n * \n * const unregister = registry.register('updateUser', handler, config);\n * return unregister;\n * }, [registry, handler]);\n * }\n * ```\n * \n * @public\n */\nexport function createReactHandlerConfig(\n action: string,\n componentId?: string,\n config: HandlerConfig = {}\n): Required<HandlerConfig> {\n const timestamp = Date.now();\n const random = Math.random().toString(36).substr(2, 5);\n \n return {\n priority: config.priority ?? 0,\n id: config.id || `${componentId || 'react'}_${action}_${timestamp}_${random}`,\n blocking: config.blocking ?? false,\n once: config.once ?? false,\n debounce: config.debounce ?? undefined,\n throttle: config.throttle ?? undefined,\n // πŸ†• React-optimized defaults\n replaceExisting: true, // Always replace in React (handles HMR/remounting)\n } as Required<HandlerConfig>;\n}\n\n/**\n * πŸ†• React action dispatcher factory\n * \n * Creates a dispatcher function optimized for React component usage\n * with proper error boundaries and async handling.\n * \n * @template T - ActionPayloadMap type\n * \n * @param registry - ActionRegister instance\n * @param errorHandler - Optional error handler for unhandled dispatch errors\n * \n * @returns Optimized dispatch function for React components\n * \n * @example\n * ```tsx\n * function MyComponent() {\n * const registry = useActionRegister();\n * \n * const dispatch = createReactDispatcher(registry, (error, action, payload) => {\n * console.error(`Failed to dispatch ${action}:`, error);\n * });\n * \n * const handleClick = useCallback(() => {\n * dispatch('userClick', { buttonId: 'submit' });\n * }, [dispatch]);\n * }\n * ```\n * \n * @public\n */\nexport function createReactDispatcher<T extends ActionPayloadMap>(\n registry: ActionRegister<T>,\n errorHandler?: (error: Error, action: keyof T, payload?: any) => void\n) {\n return async <K extends keyof T>(\n action: K,\n payload?: T[K],\n options?: Parameters<ActionRegister<T>['dispatch']>[2]\n ): Promise<void> => {\n try {\n await registry.dispatch(action, payload, {\n // πŸ†• React-optimized dispatch options\n immediate: false, // Use queues by default for React consistency\n ...options\n });\n } catch (error) {\n const errorObj = error instanceof Error ? error : new Error(String(error));\n \n if (errorHandler) {\n errorHandler(errorObj, action, payload);\n } else {\n // Default: Log error but don't throw (React-friendly)\n console.error(`[ActionRegister] Dispatch failed for action '${String(action)}':`, errorObj);\n }\n }\n };\n}\n\n/**\n * πŸ†• React development utilities\n * \n * Provides debugging and development helpers specifically for React environments.\n */\nexport const ReactDevUtils = {\n /**\n * Enable detailed React integration debugging\n */\n enableDebugMode(): void {\n if (typeof window !== 'undefined') {\n (window as any).__CONTEXT_ACTION_REACT_DEBUG__ = true;\n }\n },\n\n /**\n * Disable React integration debugging\n */\n disableDebugMode(): void {\n if (typeof window !== 'undefined') {\n (window as any).__CONTEXT_ACTION_REACT_DEBUG__ = false;\n }\n },\n\n /**\n * Check if React debug mode is enabled\n */\n isDebugMode(): boolean {\n return typeof window !== 'undefined' && \n Boolean((window as any).__CONTEXT_ACTION_REACT_DEBUG__);\n },\n\n /**\n * Log React-specific debugging information\n */\n log(component: string, action: string, message: string, data?: any): void {\n if (this.isDebugMode()) {\n console.log(`🎯 [React-ActionRegister] [${component}] ${action}: ${message}`, data || '');\n }\n },\n\n /**\n * Get React integration statistics\n */\n getStats(registry: ActionRegister<any>): {\n totalHandlers: number;\n reactHandlers: number;\n registryInfo: ReturnType<ActionRegister<any>['getRegistryInfo']>;\n } {\n const registryInfo = registry.getRegistryInfo();\n \n // Count React handlers (handlers with 'react' in their ID)\n let reactHandlers = 0;\n registry.getRegisteredActions().forEach((action: keyof any) => {\n const stats = registry.getActionStats(action);\n if (stats) {\n stats.handlersByPriority.forEach((priorityGroup: any) => {\n priorityGroup.handlers.forEach((handler: any) => {\n if (handler.id.includes('react')) {\n reactHandlers++;\n }\n });\n });\n }\n });\n\n return {\n totalHandlers: registryInfo.totalHandlers,\n reactHandlers,\n registryInfo\n };\n }\n};\n\n/**\n * πŸ†• React Error Boundary integration\n * \n * Utilities for integrating ActionRegister errors with React Error Boundaries.\n */\nexport class ReactActionError extends Error {\n public readonly action: string;\n public readonly payload?: any;\n public readonly handlerId?: string;\n public readonly timestamp: number;\n\n constructor(\n message: string,\n action: string,\n payload?: any,\n handlerId?: string,\n originalError?: Error\n ) {\n super(message);\n this.name = 'ReactActionError';\n this.action = action;\n this.payload = payload;\n this.handlerId = handlerId;\n this.timestamp = Date.now();\n\n // Maintain original error stack if available\n if (originalError && originalError.stack) {\n this.stack = originalError.stack;\n }\n }\n\n /**\n * Create a React Error Boundary compatible error\n */\n static fromActionError(\n originalError: Error,\n action: string,\n payload?: any,\n handlerId?: string\n ): ReactActionError {\n return new ReactActionError(\n `Action '${action}' failed: ${originalError.message}`,\n action,\n payload,\n handlerId,\n originalError\n );\n }\n}\n\n/**\n * πŸ†• Type guard for React Action Errors\n * \n * @param error - Error to check\n * @returns True if error is a ReactActionError\n */\nexport function isReactActionError(error: any): error is ReactActionError {\n return error instanceof ReactActionError;\n}"],"mappings":";;;;;;;;;;AAyBA,SAAS,qBACP,OACA,cACc;CACd,MAAM,WAAW,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO;AACnE,QAAO;EACL,WAAW,aAAa;EACxB,OAAO;EACP,WAAW,KAAK;EAChB,UAAU,aAAa,OAAO,WAAW,aAAa;;;;;;;;;;;;;;;;;;;;;;;AAwB1D,eAAsB,kBACpB,SACA,kBACe;CAEf,IAAI,IAAI;CACR,MAAMA,sBAA2C;CACjD,MAAMC,SAAwE;AAE9E,QAAO,IAAI,QAAQ,SAAS,QAAQ;AAElC,MAAI,QAAQ,WAAW,QAAQ,WAC7B;EAGF,MAAM,eAAe,QAAQ,SAAS;AACtC,UAAQ,eAAe;EACvB,MAAM,aAAa,iBAAiB,cAAc;AAElD,MAAI;AAEF,OAAI,QAAQ,QACV;GAGF,MAAM,SAAS,aAAa,QAAQ,QAAQ,SAAS;AAErD,OAAI,aAAa,OAAO,UAAU;IAEhC,MAAM,gBAAgB,kBAAkB,UAAU,MAAM,SAAS;AACjE,QAAI,kBAAkB,UAAa,CAAC,QAAQ,WAC1C,SAAQ,QAAQ,KAAK;cAInB,kBAAkB,SAAS;IAE7B,MAAM,2BAA2B,OAC9B,MAAK,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AAiB,MAAkB;AACxE,MAAI,KAAK,cACP,SAAQ,IAAI,8BAA8B,UAAU,IAAI,OAAO,IAAI,WAAW,QAAQ;;CAO1F,SAAS,UAIP;EACA,MAAM,eAAe,SAAS;EAG9B,IAAI,gBAAgB;AACpB,WAAS,uBAAuB,SAAS,WAAsB;GAC7D,MAAM,QAAQ,SAAS,eAAe;AACtC,OAAI,MACF,OAAM,mBAAmB,SAAS,kBAAuB;AACvD,kBAAc,SAAS,SAAS,YAAiB;AAC/C,SAAI,QAAQ,GAAG,SAAS,SACtB;;;;AAOV,SAAO;GACL,eAAe,aAAa;GAC5B;GACA;;;;;;;;;AAUN,IAAa,mBAAb,MAAa,yBAAyB,MAAM;CAM1C,YACE,SACA,QACA,SACA,WACA,eACA;AACA,QAAM;AACN,OAAK,OAAO;AACZ,OAAK,SAAS;AACd,OAAK,UAAU;AACf,OAAK,YAAY;AACjB,OAAK,YAAY,KAAK;AAGtB,MAAI,iBAAiB,cAAc,MACjC,MAAK,QAAQ,cAAc;;;;;CAO/B,OAAO,gBACL,eACA,QACA,SACA,WACkB;AAClB,SAAO,IAAI,iBACT,WAAW,OAAO,YAAY,cAAc,WAC5C,QACA,SACA,WACA;;;;;;;;;AAWN,SAAgB,mBAAmB,OAAuC;AACxE,QAAO,iBAAiB"}
1
+ {"version":3,"file":"index.js","names":["nonBlockingPromises: Array<Promise<any>>","errors: Array<{ handlerId: string; error: Error; timestamp: number }>","error: any","handlerErrors: HandlerError[]","handlerResult: R | undefined","keysToDelete: string[]","name: string","queuedOperation: QueuedOperation<T>","signals: AbortSignal[]","cleanups: (() => void)[]","autoAbortController: AbortController | undefined","effectiveSignal: AbortSignal","registration: HandlerRegistration<T[K], R>","throttleMs: number | undefined","debounceMs: number | undefined","context: PipelineContext<T[K], any>","context: PipelineContext<T[K], R>","executionError: Error | undefined","handlerResults: Array<{\n id: string;\n executed: boolean;\n duration?: number;\n result?: R;\n error?: Error;\n metadata?: Record<string, any>;\n }>","errors: Array<{\n handlerId: string;\n error: Error;\n timestamp: number;\n }>","executionResult: ExecutionResult<R>","currentUnregister: UnregisterFunction | undefined"],"sources":["../src/execution-modes.ts","../src/action-guard.ts","../src/concurrency/OperationQueue.ts","../src/ActionRegister.ts","../src/react-helpers.ts"],"sourcesContent":["/**\n * @fileoverview Execution mode implementations for ActionRegister\n * \n * Provides three different execution strategies for action handler pipelines:\n * - Sequential: Execute handlers one after another in priority order\n * - Parallel: Execute all handlers simultaneously\n * - Race: First handler to complete wins, others are cancelled\n */\n\nimport type { \n HandlerRegistration, \n PipelineContext, \n PipelineController,\n HandlerError\n} from './types.js';\n\n/**\n * Create standardized error handling for handlers\n * \n * @param error - The error that occurred\n * @param registration - The handler registration that failed\n * @returns Standardized HandlerError object\n * \n * @internal\n */\nfunction handleExecutionError<T, R>(\n error: any,\n registration: HandlerRegistration<T, R>\n): HandlerError {\n const errorObj = error instanceof Error ? error : new Error(String(error));\n return {\n handlerId: registration.id,\n error: errorObj,\n timestamp: Date.now(),\n severity: registration.config.blocking ? 'blocking' : 'non-blocking'\n };\n}\n\n/**\n * Execute handlers in sequential mode (one after another)\n * \n * Executes action handlers one at a time in priority order (highest first).\n * Supports both blocking and non-blocking handlers, with proper abort and\n * termination handling. Handlers can modify payload for subsequent handlers\n * and jump to different priority levels.\n * \n * @template T - The payload type for the action\n * @template R - The result type for handlers\n * \n * @param context - Pipeline execution context containing handlers and state\n * @param createController - Factory function for creating pipeline controllers\n * \n * @throws {Error} When a blocking handler fails\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/dispatch-patterns\n * \n * @public\n */\nexport async function executeSequential<T, R = void>(\n context: PipelineContext<T, R>,\n createController: (registration: HandlerRegistration<T, R>, index: number) => PipelineController<T, R>\n): Promise<void> {\n\n let i = 0;\n const nonBlockingPromises: Array<Promise<any>> = [];\n const errors: Array<{ handlerId: string; error: Error; timestamp: number }> = [];\n \n while (i < context.handlers.length) {\n // Check for abort or termination\n if (context.aborted || context.terminated) {\n break;\n }\n\n const registration = context.handlers[i];\n context.currentIndex = i;\n const controller = createController(registration, i);\n\n try {\n // Check for abort before executing handler\n if (context.aborted) {\n break;\n }\n \n const result = registration.handler(context.payload, controller);\n\n if (registration.config.blocking) {\n // πŸ†• Blocking handlers: Wait for completion (sync or async)\n const handlerResult = result instanceof Promise ? await result : result;\n if (handlerResult !== undefined && !context.terminated) {\n context.results.push(handlerResult as R);\n }\n } else {\n // πŸ†• Non-blocking handlers: Handle differently for sync vs async\n if (result instanceof Promise) {\n // Non-blocking async: Track promise with error handling\n const promiseWithErrorHandling = result\n .then(asyncResult => {\n if (asyncResult !== undefined && !context.terminated) {\n context.results.push(asyncResult as R);\n }\n return asyncResult;\n })\n .catch(error => {\n // πŸ†• Non-blocking async handler error collection\n const handlerError = handleExecutionError(error, registration);\n errors.push({\n handlerId: handlerError.handlerId,\n error: handlerError.error,\n timestamp: handlerError.timestamp\n });\n return undefined; // Return undefined for failed non-blocking handlers\n });\n \n nonBlockingPromises.push(promiseWithErrorHandling);\n } else if (result !== undefined && !context.terminated) {\n // Non-blocking sync: Immediately collect result\n context.results.push(result as R);\n }\n }\n\n /** Check if pipeline was terminated by controller.return() */\n if (context.terminated) {\n break;\n }\n\n /** Handle jump to priority AFTER handler execution */\n if (context.jumpToPriority !== undefined) {\n const jumpIndex = context.handlers.findIndex(\n handler => handler.config.priority === context.jumpToPriority\n );\n \n if (jumpIndex !== -1) {\n i = jumpIndex;\n context.jumpToPriority = undefined;\n continue;\n } else {\n context.jumpToPriority = undefined;\n i++;\n }\n } else {\n i++;\n }\n\n } catch (error: any) {\n // πŸ†• Maintain backward compatibility: any sync error fails pipeline\n const handlerError = handleExecutionError(error, registration);\n \n // For backward compatibility: all synchronous errors fail the pipeline\n throw handlerError.error;\n }\n }\n \n // πŸ†• Wait for all non-blocking promises with error collection\n if (nonBlockingPromises.length > 0) {\n await Promise.allSettled(nonBlockingPromises);\n }\n\n // πŸ”§ Store collected errors in context for ExecutionResult with proper typing\n if (errors.length > 0) {\n // Convert to proper HandlerError format\n const handlerErrors: HandlerError[] = errors.map(err => ({\n handlerId: err.handlerId,\n error: err.error,\n timestamp: err.timestamp,\n severity: 'non-blocking' as const\n }));\n \n // Add to context with proper typing\n (context as PipelineContext<any, any> & { collectedErrors?: HandlerError[] }).collectedErrors = handlerErrors;\n }\n}\n\n/**\n * Execute handlers in parallel mode (all at once)\n * \n * Executes all qualifying action handlers simultaneously using Promise.allSettled.\n * Supports both blocking and non-blocking handlers. Blocking handlers can still\n * fail the entire pipeline if they throw errors.\n * \n * @template T - The payload type for the action\n * @template R - The result type for handlers\n * \n * @param context - Pipeline execution context containing handlers and state\n * @param createController - Factory function for creating pipeline controllers\n * \n * @throws {Error} When any blocking handler fails\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/dispatch-patterns#parallel-execution\n * \n * @public\n */\nexport async function executeParallel<T, R = void>(\n context: PipelineContext<T, R>,\n createController: (registration: HandlerRegistration<T, R>, index: number) => PipelineController<T, R>\n): Promise<void> {\n\n /** All handlers are runnable */\n const runnableHandlers = context.handlers;\n\n /** Create promises for all handlers */\n const handlerPromises = runnableHandlers.map(async (registration, _index) => {\n const controller = createController(registration, _index);\n \n try {\n const result = registration.handler(context.payload, controller);\n \n let handlerResult: R | undefined;\n if (result instanceof Promise) {\n const resolved = await result;\n handlerResult = resolved as R | undefined;\n } else {\n handlerResult = result as R | undefined;\n }\n \n /** Collect result if handler returned something and pipeline wasn't terminated */\n if (handlerResult !== undefined && !context.terminated) {\n context.results.push(handlerResult);\n }\n \n return { \n success: true, \n handlerId: registration.id, \n result: handlerResult,\n terminated: context.terminated \n };\n \n } catch (error: any) {\n // πŸ†• Consistent error object creation\n const handlerError = handleExecutionError(error, registration);\n \n if (handlerError.severity === 'blocking') {\n throw handlerError.error;\n }\n \n return { success: false, handlerId: registration.id, error: handlerError.error };\n }\n });\n\n /** Wait for all handlers to complete */\n const results = await Promise.allSettled(handlerPromises);\n \n /** Check for any rejected blocking handlers */\n const failures = results.filter((result, index) => {\n if (result.status === 'rejected') {\n const registration = runnableHandlers[index];\n return registration.config.blocking;\n }\n return false;\n });\n\n if (failures.length > 0) {\n const firstFailure = failures[0] as PromiseRejectedResult;\n throw firstFailure.reason;\n }\n\n /** Check if any handler terminated the pipeline */\n const terminatedResults = results.filter(result => \n result.status === 'fulfilled' && result.value.terminated\n );\n \n if (terminatedResults.length > 0) {\n context.terminated = true;\n // In parallel mode, we can't determine which handler's termination result to use,\n // so we use the first one that terminated\n const firstTerminated = terminatedResults[0] as PromiseFulfilledResult<any>;\n context.terminationResult = firstTerminated.value.result;\n }\n}\n\n/**\n * Execute handlers in race mode (first to complete wins)\n * \n * Executes all qualifying handlers simultaneously using Promise.race, where\n * the first handler to complete determines the pipeline result. Other handlers\n * are effectively cancelled. Useful for scenarios where you want the fastest\n * response from multiple equivalent handlers.\n * \n * @template T - The payload type for the action\n * @template R - The result type for handlers\n * \n * @param context - Pipeline execution context containing handlers and state\n * @param createController - Factory function for creating pipeline controllers\n * \n * @throws {Error} When the winning handler fails and is blocking\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/dispatch-patterns#race-execution\n * \n * @public\n */\nexport async function executeRace<T, R = void>(\n context: PipelineContext<T, R>,\n createController: (registration: HandlerRegistration<T, R>, index: number) => PipelineController<T, R>\n): Promise<void> {\n\n /** All handlers are runnable */\n const runnableHandlers = context.handlers;\n\n if (runnableHandlers.length === 0) {\n return;\n }\n\n /** Create promises for all handlers */\n const handlerPromises = runnableHandlers.map(async (registration, _index) => {\n const controller = createController(registration, _index);\n \n try {\n const result = registration.handler(context.payload, controller);\n \n let handlerResult: R | undefined;\n if (result instanceof Promise) {\n const resolved = await result;\n handlerResult = resolved as R | undefined;\n } else {\n handlerResult = result as R | undefined;\n }\n \n return { \n success: true, \n handlerId: registration.id, \n registration,\n result: handlerResult,\n terminated: context.terminated\n };\n \n } catch (error: any) {\n // πŸ†• Consistent error object creation\n const handlerError = handleExecutionError(error, registration);\n return { success: false, handlerId: registration.id, error: handlerError.error, registration };\n }\n });\n\n /** Race all handlers */\n const winner = await Promise.race(handlerPromises);\n\n /** If the winner failed and was blocking, throw the error */\n if (!winner.success && winner.registration?.config.blocking) {\n throw winner.error;\n }\n\n /** Collect result from the winning handler */\n if (winner.success && winner.result !== undefined) {\n context.results.push(winner.result);\n }\n\n /** Check if the winning handler terminated the pipeline */\n if (winner.success && winner.terminated) {\n context.terminated = true;\n context.terminationResult = winner.result;\n }\n}","/**\n * @fileoverview Action Guard system for debouncing, throttling and blocking\n * \n * Provides rate limiting and user experience optimization for actions through\n * debouncing (wait for pause) and throttling (limit frequency) mechanisms.\n * Used internally by ActionRegister to control action execution timing.\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/\n */\n\n\n/**\n * Action guard state tracking for debouncing and throttling\n * \n * Tracks timing and execution state for action execution control.\n * Maintains separate state for each action to enable independent\n * rate limiting per action type.\n * \n * @internal\n */\ninterface GuardState {\n /** Timestamp of last successful execution for throttling calculations */\n lastExecuted: number;\n \n /** Active debounce timer - cleared when new debounce requests arrive */\n debounceTimer?: NodeJS.Timeout;\n \n /** Active throttle timer - tracks when throttle period will end */\n throttleTimer?: NodeJS.Timeout;\n \n /** Flag indicating if action is currently in throttled state */\n isThrottled: boolean;\n \n /** Current debounce promise - reused for concurrent calls */\n debouncePromise?: Promise<boolean>;\n \n /** Resolve function for current debounce promise */\n debounceResolve?: (value: boolean) => void;\n}\n\n/**\n * Action Guard system for managing action execution timing\n * \n * Provides performance optimization and user experience enhancement through\n * debouncing and throttling mechanisms. Debouncing waits for a pause in calls\n * before executing, while throttling limits execution frequency.\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * \n * @example Manual Usage (Advanced)\n * ```typescript\n * const guard = new ActionGuard()\n * \n * // Manual debouncing\n * if (await guard.debounce('search', 300)) {\n * performSearch() // Only executes after 300ms pause\n * }\n * \n * // Manual throttling\n * if (guard.throttle('scroll', 100)) {\n * updateUI() // Max once per 100ms\n * }\n * ```\n * \n * @internal\n */\nexport class ActionGuard {\n private guards = new Map<string, GuardState>();\n private cleanupInterval?: NodeJS.Timeout;\n private readonly maxIdleTime: number = 60000; // 1 minute\n private readonly cleanupIntervalMs: number = 30000; // 30 seconds\n\n constructor(autoCleanup: boolean = true) {\n if (autoCleanup) {\n this.startAutoCleanup();\n }\n }\n\n /**\n * Start automatic cleanup of idle guard states\n * \n * @internal\n */\n private startAutoCleanup(): void {\n this.cleanupInterval = setInterval(() => {\n const now = Date.now();\n const keysToDelete: string[] = [];\n \n // Collect keys to delete (avoid modifying map during iteration)\n this.guards.forEach((state, key) => {\n const isIdle = now - state.lastExecuted > this.maxIdleTime;\n const hasActiveTimers = state.debounceTimer || state.throttleTimer;\n \n if (isIdle && !hasActiveTimers) {\n keysToDelete.push(key);\n }\n });\n \n // Batch delete idle guards\n if (keysToDelete.length > 0) {\n keysToDelete.forEach(key => this.guards.delete(key));\n // Optional debug logging for cleanup\n if (typeof process !== 'undefined' && process.env?.DEBUG_CONTEXT_ACTION) {\n console.debug(`[ActionGuard] Cleaned up ${keysToDelete.length} idle guards`);\n }\n }\n }, this.cleanupIntervalMs);\n }\n\n /**\n * Apply debouncing to an action\n * \n * Debouncing waits for a specified delay after the last call before allowing\n * execution. Each new call resets the timer. Useful for search inputs, resize\n * handlers, and other high-frequency user interactions.\n * \n * @param actionKey - Unique identifier for the action being debounced\n * @param debounceMs - Delay in milliseconds to wait after the last call\n * \n * @returns Promise resolving to true if execution should proceed, false if cancelled\n * \n * @example Search Input Debouncing\n * ```typescript\n * // Only search after user stops typing for 300ms\n * if (await guard.debounce('userSearch', 300)) {\n * performSearch(query)\n * }\n * ```\n * \n * @internal\n */\n async debounce(actionKey: string, debounceMs: number): Promise<boolean> {\n\n /** Get or create guard state for this action */\n let state = this.guards.get(actionKey);\n if (!state) {\n /** Initialize new guard state with default values */\n state = {\n lastExecuted: 0,\n isThrottled: false\n };\n this.guards.set(actionKey, state);\n }\n\n /** Clear any existing debounce timer to restart the delay period */\n if (state.debounceTimer) {\n clearTimeout(state.debounceTimer);\n // Resolve previous debounce with false if exists\n if (state.debounceResolve) {\n state.debounceResolve(false);\n state.debounceResolve = undefined;\n }\n }\n\n /** Create new debounce promise */\n return new Promise<boolean>((resolve) => {\n // Store new resolve function\n state!.debounceResolve = resolve;\n \n // Set new timer\n state!.debounceTimer = setTimeout(() => {\n /** Clean up timer and resolver references */\n state!.debounceTimer = undefined;\n state!.debounceResolve = undefined;\n /** Update last execution timestamp */\n state!.lastExecuted = Date.now();\n resolve(true);\n }, debounceMs);\n });\n }\n\n /**\n * Apply throttling to an action\n * \n * Throttling limits execution frequency by ensuring a minimum interval between\n * calls. Unlike debouncing, throttling executes immediately on the first call\n * and then blocks subsequent calls until the interval expires.\n * \n * @param actionKey - Unique identifier for the action being throttled\n * @param throttleMs - Minimum interval in milliseconds between executions\n * \n * @returns True if execution should proceed, false if currently throttled\n * \n * @example Scroll Handler Throttling\n * ```typescript\n * // Update scroll position max once per 100ms\n * if (guard.throttle('scrollUpdate', 100)) {\n * updateScrollPosition()\n * }\n * ```\n * \n * @internal\n */\n throttle(actionKey: string, throttleMs: number): boolean {\n\n /** Get or create guard state for this action */\n let state = this.guards.get(actionKey);\n if (!state) {\n /** Initialize new guard state with default values */\n state = {\n lastExecuted: 0,\n isThrottled: false\n };\n this.guards.set(actionKey, state);\n }\n\n const now = Date.now();\n const timeSinceLastExecution = now - state.lastExecuted;\n\n /** Check if enough time has passed since last execution */\n /** If throttle period has elapsed, allow immediate execution */\n if (timeSinceLastExecution >= throttleMs) {\n /** Update execution timestamp and clear throttled state */\n state.lastExecuted = now;\n state.isThrottled = false;\n \n \n return true;\n }\n\n /** If already in throttled state, don't create duplicate timers */\n /** This prevents timer accumulation and unnecessary processing */\n if (state.isThrottled) {\n return false;\n }\n\n /** Set throttle timer to automatically clear the throttled state */\n /** Calculate remaining time until throttle period expires */\n state.isThrottled = true;\n const remainingTime = throttleMs - timeSinceLastExecution;\n \n /** Create timer to reset throttled state when period expires */\n state.throttleTimer = setTimeout(() => {\n /** Clear throttled state and timer reference */\n state!.isThrottled = false;\n state!.throttleTimer = undefined;\n }, remainingTime);\n\n\n return false;\n }\n\n /**\n * Clear all guard state for a specific action\n * \n * Removes debounce and throttle timers for the specified action,\n * preventing memory leaks and allowing immediate re-execution.\n * \n * @param actionKey - Action identifier to clear guards for\n * \n * @internal\n */\n clearGuards(actionKey: string): void {\n \n const state = this.guards.get(actionKey);\n if (state) {\n /** Clear debounce timer if active to prevent memory leaks */\n if (state.debounceTimer) {\n clearTimeout(state.debounceTimer);\n // Cancel waiting debounce calls\n if (state.debounceResolve) {\n state.debounceResolve(false);\n state.debounceResolve = undefined;\n }\n state.debounceTimer = undefined;\n }\n /** Clear throttle timer if active to prevent memory leaks */\n if (state.throttleTimer) {\n clearTimeout(state.throttleTimer);\n state.throttleTimer = undefined;\n }\n /** Remove guard state from memory */\n this.guards.delete(actionKey);\n \n }\n }\n\n /**\n * Clear all guard states for all actions\n * \n * Removes all active debounce and throttle timers, useful for cleanup\n * when shutting down the action system or resetting state.\n * \n * @internal\n */\n clearAll(): void {\n \n /** Iterate through all guard states and clear their timers */\n /** This prevents memory leaks when clearing the entire guard system */\n this.guards.forEach((state) => {\n /** Clear any active debounce timers */\n if (state.debounceTimer) {\n clearTimeout(state.debounceTimer);\n // Cancel waiting debounce calls\n if (state.debounceResolve) {\n state.debounceResolve(false);\n }\n }\n /** Clear any active throttle timers */\n if (state.throttleTimer) {\n clearTimeout(state.throttleTimer);\n }\n });\n \n /** Remove all guard states from memory */\n this.guards.clear();\n }\n\n /**\n * Get current guard state for debugging purposes\n * \n * Returns the internal state for a specific action, including timer\n * information and execution timestamps.\n * \n * @param actionKey - Action identifier to inspect\n * @returns Guard state or undefined if no state exists\n * \n * @internal\n */\n getGuardState(actionKey: string): GuardState | undefined {\n return this.guards.get(actionKey);\n }\n\n /**\n * Get all active guard states for debugging purposes\n * \n * Returns a copy of all current guard states, useful for monitoring\n * and debugging rate limiting behavior across all actions.\n * \n * @returns Map of action keys to their guard states\n * \n * @internal\n */\n getAllGuardStates(): Map<string, GuardState> {\n return new Map(this.guards);\n }\n\n /**\n * πŸ†• Explicit destroy method for comprehensive cleanup\n * \n * Cleans up all timers, promises, and intervals to prevent memory leaks.\n * Should be called when ActionGuard is no longer needed.\n * \n * @internal\n */\n destroy(): void {\n // Stop auto cleanup interval\n if (this.cleanupInterval) {\n clearInterval(this.cleanupInterval);\n this.cleanupInterval = undefined;\n }\n \n // Clear all existing guards\n this.clearAll();\n }\n\n /**\n * πŸ†• Get statistics about active guards\n * \n * @returns Statistics about guard usage\n * \n * @internal\n */\n getStats(): { activeGuards: number; withTimers: number } {\n let withTimers = 0;\n this.guards.forEach(state => {\n if (state.debounceTimer || state.throttleTimer) {\n withTimers++;\n }\n });\n \n return {\n activeGuards: this.guards.size,\n withTimers\n };\n }\n}","/**\n * λ™μ‹œμ„± 문제 해결을 μœ„ν•œ μž‘μ—… 큐 μ‹œμŠ€ν…œ\n * \n * λͺ¨λ“  μƒνƒœ λ³€κ²½ μž‘μ—…μ„ μ§λ ¬ν™”ν•˜μ—¬ race condition을 λ°©μ§€ν•©λ‹ˆλ‹€.\n */\n\nexport interface QueuedOperation<T = any> {\n id: string;\n operation: () => T | Promise<T>;\n resolve: (value: T) => void;\n reject: (error: unknown) => void;\n priority?: number;\n timestamp: number;\n}\n\n/**\n * μž‘μ—… 큐 κ΄€λ¦¬μž\n * \n * 핡심 κΈ°λŠ₯:\n * 1. μž‘μ—… 직렬화 - λͺ¨λ“  μž‘μ—…μ„ μˆœμ„œλŒ€λ‘œ μ‹€ν–‰\n * 2. μš°μ„ μˆœμœ„ 지원 - μ€‘μš”ν•œ μž‘μ—… μš°μ„  처리\n * 3. μ—λŸ¬ 처리 - κ°œλ³„ μž‘μ—… μ‹€νŒ¨κ°€ 전체에 영ν–₯ μ£Όμ§€ μ•ŠμŒ\n * 4. λ©”λͺ¨λ¦¬ 관리 - μ™„λ£Œλœ μž‘μ—… μžλ™ 정리\n * 5. πŸ†• λ™μ‹œμ„± μ œμ–΄ - maxConcurrency둜 λ™μ‹œ μ‹€ν–‰ μ œν•œ\n */\nexport class OperationQueue {\n private queue: QueuedOperation[] = [];\n private processingPromise: Promise<void> | null = null;\n private operationCounter = 0;\n \n // πŸ†• Concurrency control\n private activeOperations = 0;\n private readonly maxConcurrency: number;\n private readonly runningOperations = new Set<Promise<any>>();\n \n constructor(\n private name: string = 'OperationQueue', \n maxConcurrency: number = 1\n ) {\n this.maxConcurrency = Math.max(1, maxConcurrency);\n }\n\n /**\n * μž‘μ—…μ„ 큐에 μΆ”κ°€ν•˜κ³  μ‹€ν–‰ κ²°κ³Όλ₯Ό λ°˜ν™˜\n * \n * @param operation μ‹€ν–‰ν•  μž‘μ—…\n * @param priority μš°μ„ μˆœμœ„ (λ†’μ„μˆ˜λ‘ λ¨Όμ € μ‹€ν–‰)\n * @returns Promise둜 λž˜ν•‘λœ μž‘μ—… κ²°κ³Ό\n */\n enqueue<T>(operation: () => T | Promise<T>, priority: number = 0): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n const queuedOperation: QueuedOperation<T> = {\n id: `${this.name}-${++this.operationCounter}`,\n operation,\n resolve,\n reject,\n priority,\n timestamp: Date.now()\n };\n\n // μš°μ„ μˆœμœ„μ— 따라 μ‚½μž… μœ„μΉ˜ κ²°μ •\n let insertIndex = this.queue.length;\n for (let i = 0; i < this.queue.length; i++) {\n if ((this.queue[i].priority || 0) < priority) {\n insertIndex = i;\n break;\n }\n }\n\n this.queue.splice(insertIndex, 0, queuedOperation);\n \n // 큐 처리 μ‹œμž‘ (이미 처리 쀑이면 λ¬΄μ‹œλ¨)\n this.processQueue();\n });\n }\n\n /**\n * πŸ†• 큐 처리 메인 둜직 - λ™μ‹œμ„± μ œμ–΄ 지원\n * \n * maxConcurrency에 따라 λ™μ‹œ μ‹€ν–‰ μž‘μ—… 수λ₯Ό μ œν•œν•˜μ—¬ λ™μ‹œμ„± 문제 λ°©μ§€\n */\n private async processQueue(): Promise<void> {\n if (this.processingPromise) {\n return this.processingPromise;\n }\n \n this.processingPromise = this._doProcess();\n try {\n await this.processingPromise;\n } finally {\n this.processingPromise = null;\n }\n }\n \n private async _doProcess(): Promise<void> {\n while (this.queue.length > 0 || this.runningOperations.size > 0) {\n // πŸ†• λ™μ‹œμ„± μ œμ–΄: maxConcurrency 만큼만 λ™μ‹œ μ‹€ν–‰\n while (this.queue.length > 0 && this.activeOperations < this.maxConcurrency) {\n const operation = this.queue.shift()!;\n this.activeOperations++;\n \n // πŸ†• 비동기 μž‘μ—… μ‹€ν–‰ 및 좔적\n const operationPromise = this.executeOperation(operation);\n this.runningOperations.add(operationPromise);\n \n // πŸ†• μž‘μ—… μ™„λ£Œ μ‹œ 정리\n operationPromise.finally(() => {\n this.activeOperations--;\n this.runningOperations.delete(operationPromise);\n });\n }\n \n // πŸ†• μ‹€ν–‰ 쀑인 μž‘μ—…μ΄ 있으면 ν•˜λ‚˜κ°€ μ™„λ£Œλ  λ•ŒκΉŒμ§€ λŒ€κΈ°\n if (this.runningOperations.size > 0) {\n await Promise.race(this.runningOperations);\n }\n }\n }\n \n /**\n * πŸ†• κ°œλ³„ μž‘μ—… μ‹€ν–‰ 둜직\n */\n private async executeOperation<T>(operation: QueuedOperation<T>): Promise<void> {\n try {\n // μž‘μ—… μ‹€ν–‰ (동기/비동기 λͺ¨λ‘ 지원)\n const result = await Promise.resolve(operation.operation());\n operation.resolve(result);\n } catch (error) {\n // κ°œλ³„ μž‘μ—… μ‹€νŒ¨λŠ” 전체 큐에 영ν–₯ μ£Όμ§€ μ•ŠμŒ\n operation.reject(error);\n }\n }\n\n /**\n * πŸ†• ν˜„μž¬ 큐 μƒνƒœ 쑰회 (λ””λ²„κΉ…μš©) - λ™μ‹œμ„± 정보 포함\n */\n getQueueInfo() {\n return {\n name: this.name,\n queueLength: this.queue.length,\n isProcessing: Boolean(this.processingPromise),\n activeOperations: this.activeOperations,\n maxConcurrency: this.maxConcurrency,\n runningOperationsCount: this.runningOperations.size,\n operations: this.queue.map(op => ({\n id: op.id,\n priority: op.priority,\n timestamp: op.timestamp\n }))\n };\n }\n \n /**\n * πŸ†• λ™μ‹œμ„± μ„€μ • 쑰회\n */\n getConcurrencyInfo() {\n return {\n maxConcurrency: this.maxConcurrency,\n activeOperations: this.activeOperations,\n availableSlots: this.maxConcurrency - this.activeOperations,\n queuedOperations: this.queue.length,\n efficiency: this.activeOperations / this.maxConcurrency\n };\n }\n\n /**\n * 큐 λΉ„μš°κΈ° (ν…ŒμŠ€νŠΈμš©)\n */\n clear(): void {\n // λŒ€κΈ° 쀑인 μž‘μ—…λ“€μ—κ²Œ μ·¨μ†Œ μ•Œλ¦Ό\n this.queue.forEach(operation => {\n operation.reject(new Error('Queue cleared'));\n });\n \n this.queue = [];\n this.processingPromise = null;\n }\n\n /**\n * 큐 크기 쑰회\n */\n get size(): number {\n return this.queue.length;\n }\n\n /**\n * 처리 쀑 μ—¬λΆ€ 쑰회 \n */\n get processing(): boolean {\n return Boolean(this.processingPromise);\n }\n}","\nimport {\n ActionPayloadMap,\n ActionHandler,\n HandlerConfig,\n HandlerRegistration,\n PipelineContext,\n PipelineController,\n ActionRegisterConfig,\n UnregisterFunction,\n ExecutionMode,\n ExecutionResult,\n ActionRegistryInfo,\n ActionHandlerStats,\n} from './types.js';\nimport { executeSequential, executeParallel, executeRace } from './execution-modes.js';\nimport { ActionGuard } from './action-guard.js';\nimport { OperationQueue } from './concurrency/OperationQueue.js';\n\n/**\n * Action Register for managing action handlers with priority-based execution\n * \n * Central action registration and dispatch system providing type-safe action pipeline management.\n * Supports sequential, parallel, and race execution modes with advanced handler filtering,\n * throttling, debouncing, and comprehensive result collection.\n * \n * @template TActionMap - Action payload mapping interface extending ActionPayloadMap\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/\n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/register-delegation\n * \n * @public\n */\nexport class ActionRegister<T extends ActionPayloadMap = ActionPayloadMap> {\n private pipelines = new Map<keyof T, Array<HandlerRegistration<any, any>>>();\n private readonly actionGuard: ActionGuard;\n private executionMode: ExecutionMode = 'sequential';\n private actionExecutionModes = new Map<keyof T, ExecutionMode>();\n public readonly name: string;\n private readonly registryConfig: ActionRegisterConfig['registry'];\n\n // πŸ†• Performance optimizations\n private readonly isDebugMode: boolean;\n private readonly maxHandlersPerAction: number;\n\n // πŸ†• λ™μ‹œμ„± 문제 해결을 μœ„ν•œ 큐 μ‹œμŠ€ν…œ (conditional)\n private dispatchQueue?: OperationQueue;\n\n // πŸ”§ Performance optimization: Filter cache\n private filterCache = new Map<string, HandlerRegistration<any, any>[]>();\n private filterCacheMaxSize = 100; // Prevent memory bloat\n\n constructor(config: ActionRegisterConfig = {}) {\n this.name = config.name || 'ActionRegister';\n this.registryConfig = config.registry;\n this.maxHandlersPerAction = config.registry?.maxHandlersPerAction ?? 1000;\n \n // πŸ†• Environment variable check cached (performance optimization)\n this.isDebugMode = Boolean(\n this.registryConfig?.debug && \n process.env.NODE_ENV === 'development'\n );\n \n // Guard creation with improved cleanup handling\n this.actionGuard = new ActionGuard(this.registryConfig?.autoCleanup !== false);\n \n // πŸ†• Conditional queue system initialization\n if (config.registry?.useConcurrencyQueue !== false) {\n this.dispatchQueue = new OperationQueue(`${this.name}-Dispatch`);\n }\n \n if (this.registryConfig?.defaultExecutionMode) {\n this.executionMode = this.registryConfig.defaultExecutionMode;\n }\n \n this.log('ActionRegister initialized', {\n defaultExecutionMode: this.executionMode,\n autoCleanup: this.registryConfig?.autoCleanup !== false,\n concurrencyQueue: Boolean(this.dispatchQueue),\n debugMode: this.isDebugMode\n });\n }\n\n /**\n * Register an action handler with optional configuration\n * \n * @param action - The action type to register handler for\n * @param handler - The handler function to execute\n * @param config - Optional handler configuration including priority, tags, etc.\n * \n * @returns Unregister function to remove this handler\n * \n * @throws {Error} When maximum handlers limit is reached\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * \n * @public\n */\n register<K extends keyof T, R = void>(\n action: K,\n handler: ActionHandler<T[K], R>,\n config: HandlerConfig = {}\n ): UnregisterFunction {\n // πŸ”„ μž„μ‹œλ‘œ κΈ°μ‘΄ κ΅¬ν˜„ μœ μ§€ν•˜λ˜ κ°œμ„ λœ 방식 적용\n // 동기적 APIλ₯Ό μœ μ§€ν•˜λ©΄μ„œ λ‚΄λΆ€μ μœΌλ‘œλ§Œ λ™μ‹œμ„± 보호\n \n // πŸ†• Optimized handler ID generation\n const handlerId = config.id || this.generateHandlerId(action);\n \n // πŸ†• Direct synchronous registration\n const unregisterFn = this._performRegistrationSync(action, handler, config, handlerId);\n \n return unregisterFn;\n }\n\n /**\n * πŸ†• Unified logging method with cached debug mode check\n */\n private log(message: string, data?: unknown, level: 'log' | 'warn' | 'error' = 'log') {\n if (this.isDebugMode) {\n const timestamp = new Date().toISOString();\n console[level](`🎯 [${timestamp}] [${this.name}] ${message}`, data || '');\n }\n }\n\n /**\n * πŸ†• Generate unique handler ID using crypto\n */\n private generateHandlerId<K extends keyof T>(action: K): string {\n // Use crypto.randomUUID() for guaranteed uniqueness\n const uuid = crypto.randomUUID();\n return `${String(action)}_${uuid.slice(0, 8)}`;\n }\n\n /**\n * πŸ”§ Create and merge AbortSignal instances with proper cleanup\n * \n * @param options Dispatch options containing signal and autoAbort configuration\n * @returns [effectiveSignal, autoAbortController, cleanupFunction]\n */\n private createAbortSignal(options?: import('./types.js').DispatchOptions): [\n AbortSignal | undefined, \n AbortController | undefined, \n () => void\n ] {\n const signals: AbortSignal[] = [];\n const cleanups: (() => void)[] = [];\n let autoAbortController: AbortController | undefined;\n\n // Add existing signal if provided\n if (options?.signal) {\n signals.push(options.signal);\n }\n\n // Create auto-abort controller if enabled\n if (options?.autoAbort?.enabled) {\n autoAbortController = new AbortController();\n signals.push(autoAbortController.signal);\n }\n\n // No signals to merge\n if (signals.length === 0) {\n return [undefined, autoAbortController, () => {}];\n }\n\n // Single signal - no merge needed\n if (signals.length === 1) {\n return [signals[0], autoAbortController, () => cleanups.forEach(c => c())];\n }\n\n // Multiple signals - use AbortSignal.any() if available, fallback to manual merge\n let effectiveSignal: AbortSignal;\n \n if (typeof AbortSignal.any === 'function') {\n // Modern browsers with AbortSignal.any()\n effectiveSignal = AbortSignal.any(signals);\n } else {\n // Fallback: Create controller and link all signals\n const mergedController = new AbortController();\n effectiveSignal = mergedController.signal;\n \n signals.forEach(signal => {\n if (signal.aborted) {\n mergedController.abort();\n } else {\n const abortHandler = () => mergedController.abort();\n signal.addEventListener('abort', abortHandler, { once: true });\n cleanups.push(() => signal.removeEventListener('abort', abortHandler));\n }\n });\n }\n\n const cleanup = () => {\n cleanups.forEach(c => {\n try {\n c();\n } catch (error) {\n this.log('Cleanup error during AbortSignal cleanup', error, 'warn');\n }\n });\n };\n\n return [effectiveSignal, autoAbortController, cleanup];\n }\n\n /**\n * πŸ†• Perform synchronous handler registration\n */\n private _performRegistrationSync<K extends keyof T, R = void>(\n action: K,\n handler: ActionHandler<T[K], R>,\n config: HandlerConfig,\n handlerId: string\n ): UnregisterFunction {\n // Create handler registration with defaults\n const registration: HandlerRegistration<T[K], R> = {\n handler,\n config: {\n priority: config.priority ?? 0,\n id: handlerId,\n blocking: config.blocking ?? false,\n once: config.once ?? false,\n debounce: config.debounce ?? undefined,\n throttle: config.throttle ?? undefined,\n replaceExisting: config.replaceExisting ?? false,\n } as Required<HandlerConfig>,\n id: handlerId,\n };\n \n // Initialize pipeline if it doesn't exist\n if (!this.pipelines.has(action)) {\n this.pipelines.set(action, []);\n }\n\n const pipeline = this.pipelines.get(action)!;\n \n // Check handler limit\n if (pipeline.length >= this.maxHandlersPerAction) {\n console.warn(`Handler limit (${this.maxHandlersPerAction}) reached for action \"${String(action)}\". Registration ignored.`);\n return () => {}; // No-op unregister\n }\n const existingIndex = pipeline.findIndex(reg => reg.id === handlerId);\n\n // πŸ†• Enhanced duplicate ID handling with replaceExisting support and cleanup\n if (existingIndex !== -1) {\n if (config.replaceExisting) {\n // πŸ”§ Memory leak fix: Clean up existing handler before replacement\n const oldRegistration = pipeline[existingIndex];\n \n // Call cleanup if available on the old handler\n if (oldRegistration && typeof (oldRegistration as any).cleanup === 'function') {\n try {\n (oldRegistration as any).cleanup();\n } catch (cleanupError) {\n this.log(`Cleanup error for replaced handler: ${String(action)}`, cleanupError, 'warn');\n }\n }\n \n // Replace existing handler\n pipeline[existingIndex] = registration;\n \n // Re-sort pipeline since priority might have changed\n pipeline.sort((a, b) => b.config.priority - a.config.priority);\n \n // πŸ”§ Invalidate filter cache when pipeline changes\n this.invalidateFilterCache();\n \n this.log(`Handler replaced: ${String(action)}`, {\n handlerId,\n priority: config.priority,\n totalHandlers: pipeline.length,\n oldHandlerCleaned: Boolean((oldRegistration as any).cleanup)\n });\n\n // Return unregister function for the replaced registration\n return () => {\n const index = pipeline.findIndex(reg => reg.id === handlerId && reg === registration);\n if (index !== -1) {\n pipeline.splice(index, 1);\n // πŸ”§ Invalidate filter cache when pipeline changes\n this.invalidateFilterCache();\n this.log(`Replaced handler unregistered: ${String(action)}`, { handlerId });\n }\n };\n } else {\n // Default mode: reject duplicate (backward compatibility)\n this.log(`Handler duplicate ignored: ${String(action)}`, {\n handlerId,\n note: 'Use replaceExisting:true to replace'\n }, 'warn');\n return () => {}; // No-op unregister\n }\n }\n \n // Add handler to pipeline\n pipeline.push(registration);\n \n // πŸ†• μ¦‰μ‹œ μ •λ ¬ (λ™μ‹œμ„± 보호)\n pipeline.sort((a, b) => b.config.priority - a.config.priority);\n \n // πŸ”§ Invalidate filter cache when pipeline changes\n this.invalidateFilterCache();\n \n this.log(`Handler registered: ${String(action)}`, {\n handlerId,\n priority: config.priority,\n totalHandlers: pipeline.length\n });\n \n // πŸ” μΆ”κ°€ 디버그: 등둝 μ¦‰μ‹œ νŒŒμ΄ν”„λΌμΈ μƒνƒœ 좜λ ₯\n console.log(`πŸ” [DEBUG] Action '${String(action)}' pipeline after registration:`, {\n totalHandlers: pipeline.length,\n handlers: pipeline.map(h => ({ id: h.config.id, priority: h.config.priority })),\n pipelineExists: this.pipelines.has(action),\n canDispatch: this.hasHandlers(action)\n });\n\n // Return unregister function that removes this specific registration\n return () => {\n const index = pipeline.findIndex((reg) => reg.id === handlerId && reg === registration);\n if (index !== -1) {\n pipeline.splice(index, 1);\n // πŸ”§ Invalidate filter cache when pipeline changes\n this.invalidateFilterCache();\n this.log(`Handler unregistered: ${String(action)}`, {\n handlerId,\n remainingHandlers: pipeline.length\n });\n }\n };\n }\n\n\n /**\n * Dispatch an action with optional execution options\n * \n * @param action - The action type to dispatch\n * @param payload - The action payload data\n * @param options - Optional dispatch options (execution mode, filters, etc.)\n * \n * @returns Promise that resolves when all handlers complete\n * \n * @throws {Error} When action dispatching fails\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * \n * @public\n */\n async dispatch<K extends keyof T>(\n action: K,\n payload?: T[K],\n options?: import('./types.js').DispatchOptions\n ): Promise<void> {\n // πŸ†• Conditional queue usage for performance\n if (options?.immediate || !this.dispatchQueue) {\n // Bypass queue for immediate execution or when queues disabled\n return this._performDispatch(action, payload, options);\n } else {\n // Use queue for concurrency protection\n return this.dispatchQueue.enqueue(async () => {\n return this._performDispatch(action, payload, options);\n });\n }\n }\n\n /**\n * πŸ†• μ‹€μ œ λ””μŠ€νŒ¨μΉ˜ μž‘μ—… μˆ˜ν–‰ (νμ—μ„œ 호좜됨)\n */\n private async _performDispatch<K extends keyof T>(\n action: K,\n payload?: T[K],\n options?: import('./types.js').DispatchOptions\n ): Promise<void> {\n // πŸ” λ””μŠ€νŒ¨μΉ˜ μ‹œμž‘ 디버그\n console.log(`πŸš€ [DEBUG] Starting dispatch for action '${String(action)}':`, {\n hasPayload: payload !== undefined,\n payloadType: payload?.constructor?.name || typeof payload,\n options: options ? Object.keys(options) : 'none',\n timestamp: new Date().toISOString()\n });\n \n // Simple Event object detection for development\n if (payload instanceof Event && process.env.NODE_ENV === 'development') {\n console.warn(`Event object passed to action \"${String(action)}\"`, payload.type);\n }\n \n // πŸ”§ Improved AbortSignal handling with cleaner merge logic\n const [effectiveSignal, autoAbortController, cleanup] = this.createAbortSignal(options);\n \n if (options?.autoAbort?.onControllerCreated && autoAbortController) {\n options.autoAbort.onControllerCreated(autoAbortController);\n }\n \n // Check if dispatch is aborted before starting\n if (effectiveSignal?.aborted) {\n console.log(`🚫 [DEBUG] Dispatch aborted before execution for '${String(action)}'`);\n return;\n }\n \n const pipeline = this.pipelines.get(action);\n \n // πŸ” νŒŒμ΄ν”„λΌμΈ 쑴재 μ—¬λΆ€ 디버그\n console.log(`πŸ” [DEBUG] Pipeline lookup for '${String(action)}':`, {\n pipelineExists: Boolean(pipeline),\n handlersCount: pipeline?.length || 0,\n allRegisteredActions: Array.from(this.pipelines.keys()),\n pipelineMap: Object.fromEntries(Array.from(this.pipelines.entries()).map(([k, v]) => [k, v.length]))\n });\n \n if (!pipeline || pipeline.length === 0) {\n console.log(`⚠️ [DEBUG] No handlers found for action '${String(action)}', dispatch cancelled`);\n return;\n }\n\n // πŸ†• Optimize filtering - only copy array if filtering is needed\n const filteredHandlers = options?.filter \n ? this.filterHandlers(pipeline, options.filter)\n : pipeline;\n\n // Apply ActionGuard controls - check both dispatch options and handler configs\n const actionKey = String(action);\n \n // Get throttle/debounce settings from dispatch options or handler configs\n let throttleMs: number | undefined;\n let debounceMs: number | undefined;\n \n // Priority: dispatch options > handler config\n if (options?.throttle !== undefined) {\n throttleMs = options.throttle;\n } else if (filteredHandlers.length > 0) {\n // Use throttle from the first handler that has it (handlers are sorted by priority)\n for (const handler of filteredHandlers) {\n if (handler.config.throttle !== undefined) {\n throttleMs = handler.config.throttle;\n break;\n }\n }\n }\n \n if (options?.debounce !== undefined) {\n debounceMs = options.debounce;\n } else if (filteredHandlers.length > 0) {\n // Use debounce from the first handler that has it (handlers are sorted by priority)\n for (const handler of filteredHandlers) {\n if (handler.config.debounce !== undefined) {\n debounceMs = handler.config.debounce;\n break;\n }\n }\n }\n \n // Apply debounce if specified\n if (debounceMs !== undefined) {\n const shouldProceed = await this.actionGuard.debounce(actionKey, debounceMs);\n if (!shouldProceed) {\n return; // Debounced - don't execute\n }\n }\n \n // Apply throttle if specified\n if (throttleMs !== undefined) {\n const shouldProceed = this.actionGuard.throttle(actionKey, throttleMs);\n if (!shouldProceed) {\n return; // Throttled - don't execute\n }\n }\n\n // Determine execution mode for this action (with option override)\n const currentExecutionMode = options?.executionMode || \n this.actionExecutionModes.get(action) || \n this.executionMode;\n\n // Create pipeline execution context\n const context: PipelineContext<T[K], any> = {\n action: String(action),\n payload: payload as T[K],\n handlers: filteredHandlers, // Use filtered handlers\n aborted: false,\n abortReason: undefined,\n currentIndex: 0,\n jumpToPriority: undefined,\n executionMode: currentExecutionMode,\n \n // New result collection fields\n results: [],\n terminated: false,\n terminationResult: undefined,\n };\n\n \n // Add abort listener if signal provided (use effectiveSignal for auto-abort)\n const abortHandler = effectiveSignal ? () => {\n context.aborted = true;\n context.abortReason = 'Action dispatch aborted by signal';\n } : undefined;\n \n if (effectiveSignal && abortHandler) {\n effectiveSignal.addEventListener('abort', abortHandler);\n }\n \n try {\n await this.executePipeline(context, autoAbortController, options?.autoAbort);\n this.log(`Pipeline execution succeeded for ${String(action)}`);\n } catch (error) {\n this.log(`Pipeline execution failed for ${String(action)}`, error, 'error');\n throw error;\n } finally {\n // πŸ”§ Use cleanup function from createAbortSignal\n cleanup();\n }\n }\n\n /**\n * Dispatch an action and return detailed execution results\n * \n * @param action - The action type to dispatch\n * @param payload - The action payload data\n * @param options - Optional dispatch options including result collection strategy\n * \n * @returns Promise resolving to comprehensive execution results\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * \n * @public\n */\n async dispatchWithResult<K extends keyof T, R = void>(\n action: K,\n payload?: T[K],\n options?: import('./types.js').DispatchOptions\n ): Promise<ExecutionResult<R>> {\n const _startTime = Date.now();\n \n // πŸ”§ Improved AbortSignal handling with cleaner merge logic (same as dispatch)\n const [effectiveSignal, autoAbortController, cleanup] = this.createAbortSignal(options);\n \n if (options?.autoAbort?.onControllerCreated && autoAbortController) {\n options.autoAbort.onControllerCreated(autoAbortController);\n }\n \n // Check if dispatch is aborted before starting\n if (effectiveSignal?.aborted) {\n return {\n success: false,\n aborted: true,\n abortReason: 'Action dispatch aborted by signal',\n terminated: false,\n result: undefined as any,\n successResults: [] as any,\n results: [],\n failedResults: [],\n execution: {\n duration: 0,\n handlersExecuted: 0,\n handlersSkipped: 0,\n handlersFailed: 0,\n startTime: _startTime,\n endTime: _startTime,\n },\n handlers: [],\n errors: [],\n };\n }\n \n const pipeline = this.pipelines.get(action);\n \n if (!pipeline || pipeline.length === 0) {\n return {\n success: true,\n aborted: false,\n terminated: false,\n result: undefined as any,\n successResults: [] as any,\n results: [],\n failedResults: [],\n execution: {\n duration: 0,\n handlersExecuted: 0,\n handlersSkipped: 0,\n handlersFailed: 0,\n startTime: _startTime,\n endTime: _startTime,\n },\n handlers: [],\n errors: [],\n };\n }\n\n // πŸ†• Optimize filtering - only copy array if filtering is needed\n const filteredHandlers = options?.filter \n ? this.filterHandlers(pipeline, options.filter)\n : pipeline;\n\n // Apply ActionGuard controls - check both dispatch options and handler configs\n const actionKey = String(action);\n \n // Get throttle/debounce settings from dispatch options or handler configs\n let throttleMs: number | undefined;\n let debounceMs: number | undefined;\n \n // Priority: dispatch options > handler config\n if (options?.throttle !== undefined) {\n throttleMs = options.throttle;\n } else if (filteredHandlers.length > 0) {\n // Use throttle from the first handler that has it (handlers are sorted by priority)\n for (const handler of filteredHandlers) {\n if (handler.config.throttle !== undefined) {\n throttleMs = handler.config.throttle;\n break;\n }\n }\n }\n \n if (options?.debounce !== undefined) {\n debounceMs = options.debounce;\n } else if (filteredHandlers.length > 0) {\n // Use debounce from the first handler that has it (handlers are sorted by priority)\n for (const handler of filteredHandlers) {\n if (handler.config.debounce !== undefined) {\n debounceMs = handler.config.debounce;\n break;\n }\n }\n }\n \n // Apply debounce if specified\n if (debounceMs !== undefined) {\n const shouldProceed = await this.actionGuard.debounce(actionKey, debounceMs);\n if (!shouldProceed) {\n return {\n success: false,\n aborted: true,\n abortReason: 'Debounced execution',\n terminated: false,\n result: undefined as any,\n successResults: [] as any,\n results: [],\n failedResults: [],\n execution: {\n duration: Date.now() - _startTime,\n handlersExecuted: 0,\n handlersSkipped: pipeline.length,\n handlersFailed: 0,\n startTime: _startTime,\n endTime: Date.now(),\n },\n handlers: [],\n errors: [],\n };\n }\n }\n \n // Apply throttle if specified\n if (throttleMs !== undefined) {\n const shouldProceed = this.actionGuard.throttle(actionKey, throttleMs);\n if (!shouldProceed) {\n return {\n success: false,\n aborted: true,\n abortReason: 'Throttled execution',\n terminated: false,\n result: undefined as any,\n successResults: [] as any,\n results: [],\n failedResults: [],\n execution: {\n duration: Date.now() - _startTime,\n handlersExecuted: 0,\n handlersSkipped: pipeline.length,\n handlersFailed: 0,\n startTime: _startTime,\n endTime: Date.now(),\n },\n handlers: [],\n errors: [],\n };\n }\n }\n\n // Determine execution mode for this action (with option override)\n const currentExecutionMode = options?.executionMode || \n this.actionExecutionModes.get(action) || \n this.executionMode;\n\n // Create pipeline execution context\n const context: PipelineContext<T[K], R> = {\n action: String(action),\n payload: payload as T[K],\n handlers: filteredHandlers,\n aborted: false,\n abortReason: undefined,\n currentIndex: 0,\n jumpToPriority: undefined,\n executionMode: currentExecutionMode,\n \n // Result collection fields\n results: [],\n terminated: false,\n terminationResult: undefined,\n };\n\n let executionError: Error | undefined;\n const handlerResults: Array<{\n id: string;\n executed: boolean;\n duration?: number;\n result?: R;\n error?: Error;\n metadata?: Record<string, any>;\n }> = [];\n\n const errors: Array<{\n handlerId: string;\n error: Error;\n timestamp: number;\n }> = [];\n\n // Initialize handler tracking - all handlers start as not executed\n filteredHandlers.forEach(handler => {\n handlerResults.push({\n id: handler.config.id,\n executed: false,\n });\n });\n\n // Add abort listener if signal provided (use effectiveSignal for auto-abort)\n const abortHandler = effectiveSignal ? () => {\n context.aborted = true;\n context.abortReason = 'Action dispatch aborted by signal';\n } : undefined;\n \n if (effectiveSignal && abortHandler) {\n effectiveSignal.addEventListener('abort', abortHandler);\n }\n \n try {\n await this.executePipeline(context, autoAbortController, options?.autoAbort);\n \n // Mark executed handlers based on context.currentIndex\n // In sequential mode, handlers 0 to currentIndex were executed\n // In parallel/race mode, all handlers that didn't error were executed\n const executedCount = Math.min(context.currentIndex + (context.aborted ? 0 : 1), filteredHandlers.length);\n for (let i = 0; i < executedCount; i++) {\n const handlerResult = handlerResults.find(hr => hr.id === filteredHandlers[i].config.id);\n if (handlerResult) {\n handlerResult.executed = true;\n }\n }\n } catch (error) {\n executionError = error instanceof Error ? error : new Error(String(error));\n errors.push({\n handlerId: 'pipeline',\n error: executionError,\n timestamp: Date.now(),\n });\n \n // Mark executed handlers even when there's an error\n const executedCount = Math.min(context.currentIndex + 1, filteredHandlers.length);\n for (let i = 0; i < executedCount; i++) {\n const handlerResult = handlerResults.find(hr => hr.id === filteredHandlers[i].config.id);\n if (handlerResult) {\n handlerResult.executed = true;\n }\n }\n } finally {\n // πŸ”§ Use cleanup function from createAbortSignal\n cleanup();\n }\n\n const endTime = Date.now();\n \n // Process results based on options\n const processedResult = this.processResults(context, options?.result);\n\n // πŸ”§ Type safety: Separate successful results from failed ones\n const successResults = context.results.filter((result): result is R => result !== undefined);\n const failedResults = errors.map(err => ({\n handlerId: err.handlerId,\n error: err.error,\n expectedType: typeof processedResult\n }));\n\n // Build execution result with improved type safety\n const executionResult: ExecutionResult<R> = {\n success: !executionError && !context.aborted,\n aborted: context.aborted,\n abortReason: context.abortReason,\n terminated: context.terminated,\n result: processedResult,\n successResults: successResults,\n results: context.results,\n failedResults,\n execution: {\n duration: endTime - _startTime,\n handlersExecuted: context.currentIndex + (context.aborted ? 0 : 1),\n handlersSkipped: Math.max(0, filteredHandlers.length - (context.currentIndex + 1)),\n handlersFailed: errors.length,\n startTime: _startTime,\n endTime,\n },\n handlers: handlerResults,\n errors: errors.map(err => ({\n handlerId: err.handlerId,\n error: err.error,\n timestamp: err.timestamp,\n severity: 'non-blocking' as const\n })),\n };\n\n /** Clean up one-time handlers after execution */\n this.cleanupOneTimeHandlers(action, context.handlers);\n\n return executionResult;\n }\n\n /**\n * πŸ”§ Generate cache key for filter options\n */\n private generateFilterCacheKey(filterOptions?: import('./types.js').DispatchOptions['filter']): string {\n if (!filterOptions) {\n return 'no-filter';\n }\n \n // Create deterministic cache key from filter options\n const key = [\n filterOptions.handlerIds?.sort().join(',') || 'none',\n filterOptions.excludeHandlerIds?.sort().join(',') || 'none',\n filterOptions.priority?.min?.toString() || 'none',\n filterOptions.priority?.max?.toString() || 'none',\n filterOptions.custom ? 'custom' : 'none'\n ].join('|');\n \n return key;\n }\n\n /**\n * πŸ”§ Clear filter cache when pipelines change\n */\n private invalidateFilterCache(): void {\n this.filterCache.clear();\n }\n\n private filterHandlers(\n handlers: HandlerRegistration<any, any>[],\n filterOptions?: import('./types.js').DispatchOptions['filter']\n ): HandlerRegistration<any, any>[] {\n if (!filterOptions) {\n return handlers;\n }\n\n // πŸ”§ Performance optimization: Use cache for filter results\n const cacheKey = this.generateFilterCacheKey(filterOptions);\n \n // Skip cache for custom filter functions (can't be cached safely)\n if (!filterOptions.custom) {\n const cached = this.filterCache.get(cacheKey);\n if (cached) {\n return cached;\n }\n }\n\n // πŸ†• Use filter method directly (already returns new array)\n const filtered = handlers.filter(registration => {\n const config = registration.config;\n\n // πŸ†• Short-circuit evaluation for performance\n if (filterOptions.handlerIds?.length && \n !filterOptions.handlerIds.includes(config.id)) {\n return false;\n }\n\n if (filterOptions.excludeHandlerIds?.length && \n filterOptions.excludeHandlerIds.includes(config.id)) {\n return false;\n }\n\n // πŸ†• Enhanced priority filtering\n if (filterOptions.priority) {\n if (filterOptions.priority.min !== undefined && \n config.priority < filterOptions.priority.min) {\n return false;\n }\n if (filterOptions.priority.max !== undefined && \n config.priority > filterOptions.priority.max) {\n return false;\n }\n }\n\n if (filterOptions.custom && !filterOptions.custom(config)) {\n return false;\n }\n\n return true;\n });\n\n // πŸ”§ Cache the result if no custom filter\n if (!filterOptions.custom) {\n // Prevent cache bloat\n if (this.filterCache.size >= this.filterCacheMaxSize) {\n // Remove oldest entries (simple LRU approximation)\n const firstKey = this.filterCache.keys().next().value;\n if (firstKey) {\n this.filterCache.delete(firstKey);\n }\n }\n \n this.filterCache.set(cacheKey, filtered);\n }\n\n return filtered;\n }\n\n private processResults<R>(\n context: PipelineContext<any, R>,\n resultOptions?: import('./types.js').DispatchOptions['result']\n ): R | undefined {\n if (!resultOptions || !resultOptions.collect) {\n return undefined;\n }\n\n const results = context.results;\n \n // Handle termination result\n if (context.terminated && context.terminationResult !== undefined) {\n return context.terminationResult;\n }\n\n // Apply maxResults limit\n const limitedResults = resultOptions.maxResults \n ? results.slice(0, resultOptions.maxResults)\n : results;\n\n if (limitedResults.length === 0) {\n return undefined;\n }\n\n // Process results based on strategy\n switch (resultOptions.strategy) {\n case 'first':\n return limitedResults[0];\n case 'last':\n return limitedResults[limitedResults.length - 1];\n case 'all':\n return limitedResults as unknown as R;\n case 'merge':\n if (resultOptions.merger) {\n return resultOptions.merger(limitedResults);\n }\n // Default merge: return last result\n return limitedResults[limitedResults.length - 1];\n case 'custom':\n if (resultOptions.merger) {\n return resultOptions.merger(limitedResults);\n }\n throw new Error('Custom result strategy requires a merger function');\n default:\n // Default: return all results\n return limitedResults as unknown as R;\n }\n }\n\n private async executePipeline<K extends keyof T>(\n context: PipelineContext<T[K], any>, \n autoAbortController?: AbortController,\n autoAbortOptions?: { allowHandlerAbort?: boolean }\n ): Promise<void> {\n const createController = (_registration: HandlerRegistration<T[K], any>, _index: number): PipelineController<T[K], any> => {\n return {\n abort: (reason?: string) => {\n context.aborted = true;\n context.abortReason = reason;\n \n // Auto-abort: Handler can trigger pipeline abort if enabled\n if (autoAbortController && autoAbortOptions?.allowHandlerAbort) {\n autoAbortController.abort(reason);\n }\n },\n modifyPayload: (modifier: (payload: T[K]) => T[K]) => {\n context.payload = modifier(context.payload);\n },\n getPayload: () => context.payload,\n jumpToPriority: (priority: number) => {\n context.jumpToPriority = priority;\n },\n return: (result: any) => {\n context.terminated = true;\n context.terminationResult = result;\n },\n setResult: (result: any) => {\n context.results.push(result);\n },\n getResults: () => {\n return [...context.results];\n },\n mergeResult: (merger: (previousResults: any[], currentResult: any) => any) => {\n const currentResult = context.results[context.results.length - 1];\n const previousResults = context.results.slice(0, -1);\n const mergedResult = merger(previousResults, currentResult);\n context.results[context.results.length - 1] = mergedResult;\n },\n };\n };\n\n switch (context.executionMode) {\n case 'sequential':\n await executeSequential<T[K], any>(context, createController);\n break;\n case 'parallel':\n await executeParallel<T[K], any>(context, createController);\n break;\n case 'race':\n await executeRace<T[K], any>(context, createController);\n break;\n default:\n throw new Error(`Unknown execution mode: ${context.executionMode}`);\n }\n\n this.cleanupOneTimeHandlers(context.action as K, context.handlers);\n }\n\n private cleanupOneTimeHandlers<K extends keyof T>(action: K, executedHandlers: HandlerRegistration<any, any>[]): void {\n const pipeline = this.pipelines.get(action);\n if (!pipeline) return;\n\n const oneTimeHandlers = executedHandlers.filter(reg => reg.config.once);\n if (oneTimeHandlers.length === 0) return;\n\n oneTimeHandlers.forEach(registration => {\n const index = pipeline.findIndex(reg => reg.id === registration.id);\n if (index !== -1) {\n pipeline.splice(index, 1);\n \n if (this.registryConfig?.debug && process.env.NODE_ENV === 'development') {\n console.log(`🎯 One-time handler removed: ${String(action)}`, {\n handlerId: registration.id,\n remainingHandlers: pipeline.length,\n registry: this.name\n });\n }\n }\n });\n }\n\n\n /**\n * Get the number of registered handlers for an action\n * \n * @param action - The action type to count handlers for\n * \n * @returns Number of registered handlers\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * \n * @public\n */\n getHandlerCount<K extends keyof T>(action: K): number {\n const pipeline = this.pipelines.get(action);\n return pipeline ? pipeline.length : 0;\n }\n\n /**\n * Check if an action has any registered handlers\n * \n * @param action - The action type to check\n * \n * @returns True if action has handlers, false otherwise\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * \n * @public\n */\n hasHandlers<K extends keyof T>(action: K): boolean {\n return this.getHandlerCount(action) > 0;\n }\n\n /**\n * Get all registered action types\n * \n * @returns Array of all registered action types\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * \n * @public\n */\n getRegisteredActions(): (keyof T)[] {\n return Array.from(this.pipelines.keys());\n }\n\n /**\n * Remove all handlers for a specific action\n * \n * @param action - The action type to clear handlers for\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * \n * @public\n */\n clearAction<K extends keyof T>(action: K): void {\n this.pipelines.delete(action);\n // πŸ”§ Invalidate filter cache when pipeline changes\n this.invalidateFilterCache();\n }\n\n /**\n * Remove all handlers for all actions\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * \n * @public\n */\n clearAll(): void {\n this.pipelines.clear();\n // πŸ”§ Invalidate filter cache when pipeline changes\n this.invalidateFilterCache();\n }\n\n /**\n * Get the name of this action register\n * \n * @returns The register name\n * \n * @see https://mineclover.github.io/context-action/en/guide/patterns/action/basic-usage\n * \n * @public\n */\n getName(): string {\n return this.name;\n }\n\n /**\n * Get comprehensive registry information (similar to DeclarativeStoreRegistry pattern)\n * \n * @returns Registry information including actions, handlers, and execution modes\n */\n getRegistryInfo(): ActionRegistryInfo<T> {\n const totalHandlers = Array.from(this.pipelines.values()).reduce(\n (total, pipeline) => total + pipeline.length, \n 0\n );\n \n return {\n name: this.name,\n totalActions: this.pipelines.size,\n totalHandlers,\n registeredActions: Array.from(this.pipelines.keys()),\n actionExecutionModes: new Map(this.actionExecutionModes),\n defaultExecutionMode: this.executionMode,\n };\n }\n\n /**\n * Get detailed statistics for a specific action\n * \n * @param action Action name to get statistics for\n * @returns Detailed handler statistics\n */\n getActionStats<K extends keyof T>(action: K): ActionHandlerStats<T> | null {\n const pipeline = this.pipelines.get(action);\n if (!pipeline) {\n return null;\n }\n\n // Group handlers by priority\n const priorityMap = new Map<number, typeof pipeline>();\n pipeline.forEach(handler => {\n if (!priorityMap.has(handler.config.priority)) {\n priorityMap.set(handler.config.priority, []);\n }\n priorityMap.get(handler.config.priority)!.push(handler);\n });\n\n const handlersByPriority = Array.from(priorityMap.entries())\n .sort(([a], [b]) => b - a) // Sort by priority (highest first)\n .map(([priority, handlers]) => ({\n priority,\n handlers: handlers.map(h => ({\n id: h.config.id,\n }))\n }));\n\n // Execution statistics are no longer tracked\n const executionStats = undefined;\n\n return {\n action,\n handlerCount: pipeline.length,\n totalHandlers: pipeline.length,\n handlersByPriority,\n executionStats,\n };\n }\n\n /**\n * Get statistics for all registered actions\n * \n * @returns Array of statistics for all actions\n */\n getAllActionStats(): Array<ActionHandlerStats<T>> {\n return Array.from(this.pipelines.keys())\n .map(action => this.getActionStats(action))\n .filter((stats): stats is ActionHandlerStats<T> => stats !== null);\n }\n\n\n /**\n * Set execution mode for a specific action\n * \n * @param action Action name\n * @param mode Execution mode to set\n */\n setActionExecutionMode<K extends keyof T>(action: K, mode: ExecutionMode): void {\n this.actionExecutionModes.set(action, mode);\n \n if (this.registryConfig?.debug && process.env.NODE_ENV === 'development') {\n console.log(`🎯 Execution mode set for action '${String(action)}': ${mode}`);\n }\n }\n\n /**\n * Get execution mode for a specific action\n * \n * @param action Action name\n * @returns Execution mode for the action, or default if not set\n */\n getActionExecutionMode<K extends keyof T>(action: K): ExecutionMode {\n return this.actionExecutionModes.get(action) || this.executionMode;\n }\n\n /**\n * Remove execution mode override for a specific action\n * \n * @param action Action name\n */\n removeActionExecutionMode<K extends keyof T>(action: K): void {\n this.actionExecutionModes.delete(action);\n \n if (this.registryConfig?.debug && process.env.NODE_ENV === 'development') {\n console.log(`🎯 Execution mode reset for action '${String(action)}' to default: ${this.executionMode}`);\n }\n }\n\n\n /**\n * Get registry configuration (for debugging and inspection)\n * \n * @returns Current registry configuration\n */\n getRegistryConfig(): ActionRegisterConfig['registry'] {\n return this.registryConfig;\n }\n\n /**\n * Check if registry has debug mode enabled\n * \n * @returns Whether debug mode is enabled\n */\n isDebugEnabled(): boolean {\n return this.isDebugMode;\n }\n\n /**\n * πŸ†• Destroy method for comprehensive cleanup\n * \n * Cleans up all internal resources including pipelines, guards, queues, and statistics.\n * Should be called when the ActionRegister is no longer needed to prevent memory leaks.\n * \n * @public\n */\n destroy(): void {\n // Clean up all pipelines\n this.pipelines.clear();\n \n // Clean up guard system\n this.actionGuard.destroy();\n \n // Clean up queues if they exist\n this.dispatchQueue?.clear?.();\n \n this.actionExecutionModes.clear();\n \n // πŸ”§ Clean up performance caches\n this.filterCache.clear();\n \n this.log('ActionRegister destroyed');\n }\n}","/**\n * @fileoverview React integration helpers for ActionRegister\n * \n * Provides React-specific utilities and hooks for seamless integration\n * with React components and lifecycle management.\n * \n * Note: This file provides utilities for React integration but does not\n * have direct React dependencies. Import React types externally when used.\n */\n\nimport type { \n ActionPayloadMap, \n ActionHandler, \n HandlerConfig,\n UnregisterFunction\n} from './types.js';\nimport type { ActionRegister } from './ActionRegister.js';\n\n/**\n * πŸ”§ Create action handler registration configuration for React components\n * \n * Creates a configuration object that can be used with React's useEffect to properly\n * register and unregister action handlers with lifecycle management and cleanup.\n * This is NOT a hook - it's a factory function for React hook integration.\n * \n * @template T - ActionPayloadMap type\n * @template K - Action key type\n * \n * @param registry - ActionRegister instance\n * @param action - Action name to register handler for\n * @param handler - Handler function (should be memoized with useCallback)\n * @param config - Handler configuration\n * \n * @returns Configuration object with register/unregister functions\n * \n * @example Basic Usage with useEffect\n * ```tsx\n * import { useCallback, useEffect } from 'react';\n * import { createActionHandler } from '@context-action/core/react-helpers';\n * \n * function MyComponent() {\n * const registry = useActionRegister();\n * \n * const handleUserUpdate = useCallback(async (payload, controller) => {\n * // Handler logic here\n * }, []);\n * \n * useEffect(() => {\n * const { register, unregister } = createActionHandler(\n * registry,\n * 'updateUser',\n * handleUserUpdate,\n * { priority: 10 }\n * );\n * \n * const cleanup = register();\n * return () => {\n * cleanup();\n * unregister();\n * };\n * }, [registry, handleUserUpdate]);\n * }\n * ```\n * \n * @example With Automatic Cleanup\n * ```tsx\n * const [userId, setUserId] = useState('123');\n * \n * const handleUserUpdate = useCallback(async (payload, controller) => {\n * console.log('Updating user:', userId, payload);\n * }, [userId]);\n * \n * useEffect(() => {\n * const handlerManager = createActionHandler(\n * registry,\n * 'updateUser',\n * handleUserUpdate,\n * { priority: 10 }\n * );\n * \n * // Simplified registration with automatic cleanup\n * return handlerManager.registerWithCleanup();\n * }, [registry, handleUserUpdate, userId]);\n * ```\n * \n * @public\n */\nexport function createActionHandler<T extends ActionPayloadMap, K extends keyof T>(\n registry: ActionRegister<T>,\n action: K,\n handler: ActionHandler<T[K]>,\n config?: HandlerConfig\n): {\n register: () => UnregisterFunction;\n unregister: () => void;\n registerWithCleanup: () => () => void;\n config: Required<HandlerConfig>;\n} {\n const finalConfig = createReactHandlerConfig(String(action), undefined, config);\n let currentUnregister: UnregisterFunction | undefined;\n let isRegistered = false;\n \n return {\n /**\n * Register the handler and return cleanup function\n */\n register(): UnregisterFunction {\n if (isRegistered && currentUnregister) {\n // Clean up previous registration\n currentUnregister();\n }\n \n currentUnregister = registry.register(action, handler, finalConfig);\n isRegistered = true;\n \n return currentUnregister;\n },\n \n /**\n * Unregister the handler if currently registered\n */\n unregister(): void {\n if (isRegistered && currentUnregister) {\n currentUnregister();\n currentUnregister = undefined;\n isRegistered = false;\n }\n },\n \n /**\n * Register and return cleanup function (React useEffect pattern)\n */\n registerWithCleanup(): () => void {\n const unregisterFn = this.register();\n \n return () => {\n unregisterFn();\n this.unregister();\n };\n },\n \n config: finalConfig\n };\n}\n\n/**\n * πŸ†• React handler configuration factory\n * \n * Creates optimized handler configurations for React environments with\n * proper cleanup and unique ID generation.\n * \n * @template T - ActionPayloadMap type\n * @template K - Action key type\n * \n * @param action - Action name\n * @param componentId - Optional component identifier for debugging\n * @param config - Base handler configuration\n * \n * @returns Optimized configuration for React environments\n * \n * @example\n * ```tsx\n * function MyComponent({ userId }: { userId: string }) {\n * const registry = useActionRegister();\n * \n * useEffect(() => {\n * const config = createReactHandlerConfig('updateUser', 'MyComponent', {\n * priority: 10\n * });\n * \n * const unregister = registry.register('updateUser', handler, config);\n * return unregister;\n * }, [registry, handler]);\n * }\n * ```\n * \n * @public\n */\nexport function createReactHandlerConfig(\n action: string,\n componentId?: string,\n config: HandlerConfig = {}\n): Required<HandlerConfig> {\n const timestamp = Date.now();\n const random = Math.random().toString(36).substr(2, 5);\n \n return {\n priority: config.priority ?? 0,\n id: config.id || `${componentId || 'react'}_${action}_${timestamp}_${random}`,\n blocking: config.blocking ?? false,\n once: config.once ?? false,\n debounce: config.debounce ?? undefined,\n throttle: config.throttle ?? undefined,\n // πŸ†• React-optimized defaults\n replaceExisting: true, // Always replace in React (handles HMR/remounting)\n } as Required<HandlerConfig>;\n}\n\n/**\n * πŸ†• React action dispatcher factory\n * \n * Creates a dispatcher function optimized for React component usage\n * with proper error boundaries and async handling.\n * \n * @template T - ActionPayloadMap type\n * \n * @param registry - ActionRegister instance\n * @param errorHandler - Optional error handler for unhandled dispatch errors\n * \n * @returns Optimized dispatch function for React components\n * \n * @example\n * ```tsx\n * function MyComponent() {\n * const registry = useActionRegister();\n * \n * const dispatch = createReactDispatcher(registry, (error, action, payload) => {\n * console.error(`Failed to dispatch ${action}:`, error);\n * });\n * \n * const handleClick = useCallback(() => {\n * dispatch('userClick', { buttonId: 'submit' });\n * }, [dispatch]);\n * }\n * ```\n * \n * @public\n */\nexport function createReactDispatcher<T extends ActionPayloadMap>(\n registry: ActionRegister<T>,\n errorHandler?: (error: Error, action: keyof T, payload?: any) => void\n) {\n return async <K extends keyof T>(\n action: K,\n payload?: T[K],\n options?: Parameters<ActionRegister<T>['dispatch']>[2]\n ): Promise<void> => {\n try {\n await registry.dispatch(action, payload, {\n // πŸ†• React-optimized dispatch options\n immediate: false, // Use queues by default for React consistency\n ...options\n });\n } catch (error) {\n const errorObj = error instanceof Error ? error : new Error(String(error));\n \n if (errorHandler) {\n errorHandler(errorObj, action, payload);\n } else {\n // Default: Log error but don't throw (React-friendly)\n console.error(`[ActionRegister] Dispatch failed for action '${String(action)}':`, errorObj);\n }\n }\n };\n}\n\n/**\n * πŸ†• React development utilities\n * \n * Provides debugging and development helpers specifically for React environments.\n */\nexport const ReactDevUtils = {\n /**\n * Enable detailed React integration debugging\n */\n enableDebugMode(): void {\n if (typeof window !== 'undefined') {\n (window as any).__CONTEXT_ACTION_REACT_DEBUG__ = true;\n }\n },\n\n /**\n * Disable React integration debugging\n */\n disableDebugMode(): void {\n if (typeof window !== 'undefined') {\n (window as any).__CONTEXT_ACTION_REACT_DEBUG__ = false;\n }\n },\n\n /**\n * Check if React debug mode is enabled\n */\n isDebugMode(): boolean {\n return typeof window !== 'undefined' && \n Boolean((window as any).__CONTEXT_ACTION_REACT_DEBUG__);\n },\n\n /**\n * Log React-specific debugging information\n */\n log(component: string, action: string, message: string, data?: any): void {\n if (this.isDebugMode()) {\n console.log(`🎯 [React-ActionRegister] [${component}] ${action}: ${message}`, data || '');\n }\n },\n\n /**\n * Get React integration statistics\n */\n getStats(registry: ActionRegister<any>): {\n totalHandlers: number;\n reactHandlers: number;\n registryInfo: ReturnType<ActionRegister<any>['getRegistryInfo']>;\n } {\n const registryInfo = registry.getRegistryInfo();\n \n // Count React handlers (handlers with 'react' in their ID)\n let reactHandlers = 0;\n registry.getRegisteredActions().forEach((action: keyof any) => {\n const stats = registry.getActionStats(action);\n if (stats) {\n stats.handlersByPriority.forEach((priorityGroup: any) => {\n priorityGroup.handlers.forEach((handler: any) => {\n if (handler.id.includes('react')) {\n reactHandlers++;\n }\n });\n });\n }\n });\n\n return {\n totalHandlers: registryInfo.totalHandlers,\n reactHandlers,\n registryInfo\n };\n }\n};\n\n/**\n * πŸ†• React Error Boundary integration\n * \n * Utilities for integrating ActionRegister errors with React Error Boundaries.\n */\nexport class ReactActionError extends Error {\n public readonly action: string;\n public readonly payload?: any;\n public readonly handlerId?: string;\n public readonly timestamp: number;\n\n constructor(\n message: string,\n action: string,\n payload?: any,\n handlerId?: string,\n originalError?: Error\n ) {\n super(message);\n this.name = 'ReactActionError';\n this.action = action;\n this.payload = payload;\n this.handlerId = handlerId;\n this.timestamp = Date.now();\n\n // Maintain original error stack if available\n if (originalError && originalError.stack) {\n this.stack = originalError.stack;\n }\n }\n\n /**\n * Create a React Error Boundary compatible error\n */\n static fromActionError(\n originalError: Error,\n action: string,\n payload?: any,\n handlerId?: string\n ): ReactActionError {\n return new ReactActionError(\n `Action '${action}' failed: ${originalError.message}`,\n action,\n payload,\n handlerId,\n originalError\n );\n }\n}\n\n/**\n * πŸ†• Type guard for React Action Errors\n * \n * @param error - Error to check\n * @returns True if error is a ReactActionError\n */\nexport function isReactActionError(error: any): error is ReactActionError {\n return error instanceof ReactActionError;\n}"],"mappings":";;;;;;;;;;AAyBA,SAAS,qBACP,OACA,cACc;CACd,MAAM,WAAW,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO;AACnE,QAAO;EACL,WAAW,aAAa;EACxB,OAAO;EACP,WAAW,KAAK;EAChB,UAAU,aAAa,OAAO,WAAW,aAAa;;;;;;;;;;;;;;;;;;;;;;;AAwB1D,eAAsB,kBACpB,SACA,kBACe;CAEf,IAAI,IAAI;CACR,MAAMA,sBAA2C;CACjD,MAAMC,SAAwE;AAE9E,QAAO,IAAI,QAAQ,SAAS,QAAQ;AAElC,MAAI,QAAQ,WAAW,QAAQ,WAC7B;EAGF,MAAM,eAAe,QAAQ,SAAS;AACtC,UAAQ,eAAe;EACvB,MAAM,aAAa,iBAAiB,cAAc;AAElD,MAAI;AAEF,OAAI,QAAQ,QACV;GAGF,MAAM,SAAS,aAAa,QAAQ,QAAQ,SAAS;AAErD,OAAI,aAAa,OAAO,UAAU;IAEhC,MAAM,gBAA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I,OAAO,WAAW,YACpB,CAAC,OAAe,iCAAiC;;CAOrD,cAAuB;AACrB,SAAO,OAAO,WAAW,eAClB,QAAS,OAAe;;CAMjC,IAAI,WAAmB,QAAgB,SAAiB,MAAkB;AACxE,MAAI,KAAK,cACP,SAAQ,IAAI,8BAA8B,UAAU,IAAI,OAAO,IAAI,WAAW,QAAQ;;CAO1F,SAAS,UAIP;EACA,MAAM,eAAe,SAAS;EAG9B,IAAI,gBAAgB;AACpB,WAAS,uBAAuB,SAAS,WAAsB;GAC7D,MAAM,QAAQ,SAAS,eAAe;AACtC,OAAI,MACF,OAAM,mBAAmB,SAAS,kBAAuB;AACvD,kBAAc,SAAS,SAAS,YAAiB;AAC/C,SAAI,QAAQ,GAAG,SAAS,SACtB;;;;AAOV,SAAO;GACL,eAAe,aAAa;GAC5B;GACA;;;;;;;;;AAUN,IAAa,mBAAb,MAAa,yBAAyB,MAAM;CAM1C,YACE,SACA,QACA,SACA,WACA,eACA;AACA,QAAM;AACN,OAAK,OAAO;AACZ,OAAK,SAAS;AACd,OAAK,UAAU;AACf,OAAK,YAAY;AACjB,OAAK,YAAY,KAAK;AAGtB,MAAI,iBAAiB,cAAc,MACjC,MAAK,QAAQ,cAAc;;;;;CAO/B,OAAO,gBACL,eACA,QACA,SACA,WACkB;AAClB,SAAO,IAAI,iBACT,WAAW,OAAO,YAAY,cAAc,WAC5C,QACA,SACA,WACA;;;;;;;;;AAWN,SAAgB,mBAAmB,OAAuC;AACxE,QAAO,iBAAiB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@context-action/core",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "description": "Type-safe action pipeline management library for JavaScript/TypeScript",
6
6
  "main": "dist/index.cjs",
@@ -75,5 +75,5 @@
75
75
  "engines": {
76
76
  "node": ">=18.0.0"
77
77
  },
78
- "gitHead": "8dd84af4f474784e1765b23662b3118b8150a3c8"
78
+ "gitHead": "9a377c2b5a81cb998f8739c3914bf9f4fb55df20"
79
79
  }