@context-action/core 0.9.0 → 0.9.2
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 +1 -206
- package/dist/index.d.cts +1 -29
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +1 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -202
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -2335,220 +2335,15 @@ var ActionRegister = class {
|
|
|
2335
2335
|
}
|
|
2336
2336
|
};
|
|
2337
2337
|
|
|
2338
|
-
//#endregion
|
|
2339
|
-
//#region src/react-helpers.ts
|
|
2340
|
-
/**
|
|
2341
|
-
* 🔧 Create action handler registration configuration for React components
|
|
2342
|
-
*
|
|
2343
|
-
* Creates a configuration object that can be used with React's useEffect to properly
|
|
2344
|
-
* register and unregister action handlers with lifecycle management and cleanup.
|
|
2345
|
-
* This is NOT a hook - it's a factory function for React hook integration.
|
|
2346
|
-
*
|
|
2347
|
-
* @template T - ActionPayloadMap type
|
|
2348
|
-
* @template K - Action key type
|
|
2349
|
-
*
|
|
2350
|
-
* @param registry - ActionRegister instance
|
|
2351
|
-
* @param action - Action name to register handler for
|
|
2352
|
-
* @param handler - Handler function (should be memoized with useCallback)
|
|
2353
|
-
* @param config - Handler configuration
|
|
2354
|
-
*
|
|
2355
|
-
* @returns Configuration object with register/unregister functions
|
|
2356
|
-
*
|
|
2357
|
-
* @example Basic Usage with useEffect
|
|
2358
|
-
* ```tsx
|
|
2359
|
-
* import { useCallback, useEffect } from 'react';
|
|
2360
|
-
* import { createActionHandler } from '@context-action/core/react-helpers';
|
|
2361
|
-
*
|
|
2362
|
-
* function MyComponent() {
|
|
2363
|
-
* const registry = useActionRegister();
|
|
2364
|
-
*
|
|
2365
|
-
* const handleUserUpdate = useCallback(async (payload, controller) => {
|
|
2366
|
-
* // Handler logic here
|
|
2367
|
-
* }, []);
|
|
2368
|
-
*
|
|
2369
|
-
* useEffect(() => {
|
|
2370
|
-
* const { register, unregister } = createActionHandler(
|
|
2371
|
-
* registry,
|
|
2372
|
-
* 'updateUser',
|
|
2373
|
-
* handleUserUpdate,
|
|
2374
|
-
* { priority: 10 }
|
|
2375
|
-
* );
|
|
2376
|
-
*
|
|
2377
|
-
* const cleanup = register();
|
|
2378
|
-
* return () => {
|
|
2379
|
-
* cleanup();
|
|
2380
|
-
* unregister();
|
|
2381
|
-
* };
|
|
2382
|
-
* }, [registry, handleUserUpdate]);
|
|
2383
|
-
* }
|
|
2384
|
-
* ```
|
|
2385
|
-
*
|
|
2386
|
-
* @example With Automatic Cleanup
|
|
2387
|
-
* ```tsx
|
|
2388
|
-
* const [userId, setUserId] = useState('123');
|
|
2389
|
-
*
|
|
2390
|
-
* const handleUserUpdate = useCallback(async (payload, controller) => {
|
|
2391
|
-
* console.log('Updating user:', userId, payload);
|
|
2392
|
-
* }, [userId]);
|
|
2393
|
-
*
|
|
2394
|
-
* useEffect(() => {
|
|
2395
|
-
* const handlerManager = createActionHandler(
|
|
2396
|
-
* registry,
|
|
2397
|
-
* 'updateUser',
|
|
2398
|
-
* handleUserUpdate,
|
|
2399
|
-
* { priority: 10 }
|
|
2400
|
-
* );
|
|
2401
|
-
*
|
|
2402
|
-
* // Simplified registration with automatic cleanup
|
|
2403
|
-
* return handlerManager.registerWithCleanup();
|
|
2404
|
-
* }, [registry, handleUserUpdate, userId]);
|
|
2405
|
-
* ```
|
|
2406
|
-
*
|
|
2407
|
-
* @public
|
|
2408
|
-
*/
|
|
2409
|
-
function createActionHandler(registry, action, handler, config) {
|
|
2410
|
-
const timestamp = Date.now();
|
|
2411
|
-
const random = Math.random().toString(36).substr(2, 5);
|
|
2412
|
-
const finalConfig = {
|
|
2413
|
-
priority: config?.priority ?? 0,
|
|
2414
|
-
id: config?.id || `react_${String(action)}_${timestamp}_${random}`,
|
|
2415
|
-
blocking: config?.blocking ?? false,
|
|
2416
|
-
once: config?.once ?? false,
|
|
2417
|
-
debounce: config?.debounce ?? void 0,
|
|
2418
|
-
throttle: config?.throttle ?? void 0,
|
|
2419
|
-
replaceExisting: true
|
|
2420
|
-
};
|
|
2421
|
-
let currentUnregister;
|
|
2422
|
-
let isRegistered = false;
|
|
2423
|
-
return {
|
|
2424
|
-
/**
|
|
2425
|
-
* Register the handler and return cleanup function
|
|
2426
|
-
*/
|
|
2427
|
-
register() {
|
|
2428
|
-
if (isRegistered && currentUnregister) currentUnregister();
|
|
2429
|
-
currentUnregister = registry.register(action, handler, finalConfig);
|
|
2430
|
-
isRegistered = true;
|
|
2431
|
-
return currentUnregister;
|
|
2432
|
-
},
|
|
2433
|
-
/**
|
|
2434
|
-
* Unregister the handler if currently registered
|
|
2435
|
-
*/
|
|
2436
|
-
unregister() {
|
|
2437
|
-
if (isRegistered && currentUnregister) {
|
|
2438
|
-
currentUnregister();
|
|
2439
|
-
currentUnregister = void 0;
|
|
2440
|
-
isRegistered = false;
|
|
2441
|
-
}
|
|
2442
|
-
},
|
|
2443
|
-
/**
|
|
2444
|
-
* Register and return cleanup function (React useEffect pattern)
|
|
2445
|
-
*/
|
|
2446
|
-
registerWithCleanup() {
|
|
2447
|
-
const unregisterFn = this.register();
|
|
2448
|
-
return () => {
|
|
2449
|
-
unregisterFn();
|
|
2450
|
-
this.unregister();
|
|
2451
|
-
};
|
|
2452
|
-
},
|
|
2453
|
-
config: finalConfig
|
|
2454
|
-
};
|
|
2455
|
-
}
|
|
2456
|
-
/**
|
|
2457
|
-
* 🆕 React development utilities
|
|
2458
|
-
*
|
|
2459
|
-
* Provides debugging and development helpers specifically for React environments.
|
|
2460
|
-
*/
|
|
2461
|
-
const ReactDevUtils = {
|
|
2462
|
-
/**
|
|
2463
|
-
* Enable detailed React integration debugging
|
|
2464
|
-
*/
|
|
2465
|
-
enableDebugMode() {
|
|
2466
|
-
if (typeof window !== "undefined") window.__CONTEXT_ACTION_REACT_DEBUG__ = true;
|
|
2467
|
-
},
|
|
2468
|
-
/**
|
|
2469
|
-
* Disable React integration debugging
|
|
2470
|
-
*/
|
|
2471
|
-
disableDebugMode() {
|
|
2472
|
-
if (typeof window !== "undefined") window.__CONTEXT_ACTION_REACT_DEBUG__ = false;
|
|
2473
|
-
},
|
|
2474
|
-
/**
|
|
2475
|
-
* Check if React debug mode is enabled
|
|
2476
|
-
*/
|
|
2477
|
-
isDebugMode() {
|
|
2478
|
-
return typeof window !== "undefined" && Boolean(window.__CONTEXT_ACTION_REACT_DEBUG__);
|
|
2479
|
-
},
|
|
2480
|
-
/**
|
|
2481
|
-
* Log React-specific debugging information
|
|
2482
|
-
*/
|
|
2483
|
-
log(component, action, message, data) {
|
|
2484
|
-
if (this.isDebugMode()) console.log(`🎯 [React-ActionRegister] [${component}] ${action}: ${message}`, data || "");
|
|
2485
|
-
},
|
|
2486
|
-
/**
|
|
2487
|
-
* Get React integration statistics
|
|
2488
|
-
*/
|
|
2489
|
-
getStats(registry) {
|
|
2490
|
-
const registryInfo = registry.getRegistryInfo();
|
|
2491
|
-
let reactHandlers = 0;
|
|
2492
|
-
registry.getRegisteredActions().forEach((action) => {
|
|
2493
|
-
const stats = registry.getActionStats(action);
|
|
2494
|
-
if (stats) stats.handlersByPriority.forEach((priorityGroup) => {
|
|
2495
|
-
priorityGroup.handlers.forEach((handler) => {
|
|
2496
|
-
if (handler.id.includes("react")) reactHandlers++;
|
|
2497
|
-
});
|
|
2498
|
-
});
|
|
2499
|
-
});
|
|
2500
|
-
return {
|
|
2501
|
-
totalHandlers: registryInfo.totalHandlers,
|
|
2502
|
-
reactHandlers,
|
|
2503
|
-
registryInfo
|
|
2504
|
-
};
|
|
2505
|
-
}
|
|
2506
|
-
};
|
|
2507
|
-
/**
|
|
2508
|
-
* 🆕 React Error Boundary integration
|
|
2509
|
-
*
|
|
2510
|
-
* Utilities for integrating ActionRegister errors with React Error Boundaries.
|
|
2511
|
-
*/
|
|
2512
|
-
var ReactActionError = class ReactActionError extends Error {
|
|
2513
|
-
constructor(message, action, payload, handlerId = void 0, originalError) {
|
|
2514
|
-
super(message);
|
|
2515
|
-
this.name = "ReactActionError";
|
|
2516
|
-
this.action = action;
|
|
2517
|
-
this.payload = payload;
|
|
2518
|
-
this.handlerId = handlerId;
|
|
2519
|
-
this.timestamp = Date.now();
|
|
2520
|
-
if (originalError?.stack) this.stack = originalError.stack;
|
|
2521
|
-
}
|
|
2522
|
-
/**
|
|
2523
|
-
* Create a React Error Boundary compatible error
|
|
2524
|
-
*/
|
|
2525
|
-
static fromActionError(originalError, action, payload, handlerId) {
|
|
2526
|
-
return new ReactActionError(`Action '${action}' failed: ${originalError.message}`, action, payload, handlerId, originalError);
|
|
2527
|
-
}
|
|
2528
|
-
};
|
|
2529
|
-
/**
|
|
2530
|
-
* 🆕 Type guard for React Action Errors
|
|
2531
|
-
*
|
|
2532
|
-
* @param error - Error to check
|
|
2533
|
-
* @returns True if error is a ReactActionError
|
|
2534
|
-
*/
|
|
2535
|
-
function isReactActionError(error) {
|
|
2536
|
-
return error instanceof ReactActionError;
|
|
2537
|
-
}
|
|
2538
|
-
|
|
2539
2338
|
//#endregion
|
|
2540
2339
|
exports.ActionGuard = ActionGuard;
|
|
2541
2340
|
exports.ActionRegister = ActionRegister;
|
|
2542
2341
|
exports.ActionRegisterDestroyedError = ActionRegisterDestroyedError;
|
|
2543
2342
|
exports.ActionTimeoutError = ActionTimeoutError;
|
|
2544
2343
|
exports.ActionValidationError = ActionValidationError;
|
|
2545
|
-
exports.ReactActionError = ReactActionError;
|
|
2546
|
-
exports.ReactDevUtils = ReactDevUtils;
|
|
2547
|
-
exports.createActionHandler = createActionHandler;
|
|
2548
2344
|
exports.executeParallel = executeParallel;
|
|
2549
2345
|
exports.executeRace = executeRace;
|
|
2550
2346
|
exports.executeSequential = executeSequential;
|
|
2551
2347
|
exports.isActionRegisterDestroyedError = isActionRegisterDestroyedError;
|
|
2552
2348
|
exports.isActionTimeoutError = isActionTimeoutError;
|
|
2553
|
-
exports.isActionValidationError = isActionValidationError;
|
|
2554
|
-
exports.isReactActionError = isReactActionError;
|
|
2349
|
+
exports.isActionValidationError = isActionValidationError;
|
package/dist/index.d.cts
CHANGED
|
@@ -306,34 +306,6 @@ declare function executeSequential<T, R = void>(context: PipelineContext<T, R>,
|
|
|
306
306
|
declare function executeParallel<T, R = void>(context: PipelineContext<T, R>, createController: (registration: HandlerRegistration<T, R>, index: number) => PipelineController<T, R>): Promise<void>;
|
|
307
307
|
declare function executeRace<T, R = void>(context: PipelineContext<T, R>, createController: (registration: HandlerRegistration<T, R>, index: number) => PipelineController<T, R>): Promise<void>;
|
|
308
308
|
//#endregion
|
|
309
|
-
//#region src/react-helpers.d.ts
|
|
310
|
-
declare function createActionHandler<T extends ActionPayloadMap, K extends keyof T>(registry: ActionRegister<T>, action: K, handler: ActionHandler<T[K]>, config?: HandlerConfig<T[K]>): {
|
|
311
|
-
register: () => UnregisterFunction;
|
|
312
|
-
unregister: () => void;
|
|
313
|
-
registerWithCleanup: () => () => void;
|
|
314
|
-
config: Required<HandlerConfig<T[K]>>;
|
|
315
|
-
};
|
|
316
|
-
declare const ReactDevUtils: {
|
|
317
|
-
enableDebugMode(): void;
|
|
318
|
-
disableDebugMode(): void;
|
|
319
|
-
isDebugMode(): boolean;
|
|
320
|
-
log(component: string, action: string, message: string, data?: unknown): void;
|
|
321
|
-
getStats(registry: ActionRegister<any>): {
|
|
322
|
-
totalHandlers: number;
|
|
323
|
-
reactHandlers: number;
|
|
324
|
-
registryInfo: ReturnType<ActionRegister<any>["getRegistryInfo"]>;
|
|
325
|
-
};
|
|
326
|
-
};
|
|
327
|
-
declare class ReactActionError extends Error {
|
|
328
|
-
readonly action: string;
|
|
329
|
-
readonly payload?: unknown;
|
|
330
|
-
readonly handlerId: string | undefined;
|
|
331
|
-
readonly timestamp: number;
|
|
332
|
-
constructor(message: string, action: string, payload?: unknown, handlerId?: string | undefined, originalError?: Error);
|
|
333
|
-
static fromActionError(originalError: Error, action: string, payload?: unknown, handlerId?: string): ReactActionError;
|
|
334
|
-
}
|
|
335
|
-
declare function isReactActionError(error: unknown): error is ReactActionError;
|
|
336
|
-
//#endregion
|
|
337
309
|
//#region src/errors.d.ts
|
|
338
310
|
interface ZodIssueLike {
|
|
339
311
|
message: string;
|
|
@@ -373,5 +345,5 @@ declare function isActionValidationError(error: unknown): error is ActionValidat
|
|
|
373
345
|
declare function isActionTimeoutError(error: unknown): error is ActionTimeoutError;
|
|
374
346
|
declare function isActionRegisterDestroyedError(error: unknown): error is ActionRegisterDestroyedError;
|
|
375
347
|
//#endregion
|
|
376
|
-
export { type ActionDispatcher, ActionGuard, type ActionHandler, type ActionPayloadMap, ActionRegister, type ActionRegisterConfig, ActionRegisterDestroyedError, type ActionSchemaLike, ActionTimeoutError, ActionValidationError, type DispatchOptions, type ExecutionMode, type ExecutionResult, type HandlerConfig, type HandlerRegistration, type PipelineContext, type PipelineController,
|
|
348
|
+
export { type ActionDispatcher, ActionGuard, type ActionHandler, type ActionPayloadMap, ActionRegister, type ActionRegisterConfig, ActionRegisterDestroyedError, type ActionSchemaLike, ActionTimeoutError, ActionValidationError, type DispatchOptions, type ExecutionMode, type ExecutionResult, type HandlerConfig, type HandlerRegistration, type PipelineContext, type PipelineController, type UnregisterFunction, executeParallel, executeRace, executeSequential, isActionRegisterDestroyedError, isActionTimeoutError, isActionValidationError };
|
|
377
349
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -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/
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/ActionRegister.ts","../src/action-guard.ts","../src/execution-modes.ts","../src/errors.ts"],"mappings":";KAmBY;UASK;EACf,UAAU;IACJ;IAAe;;IAEf;IACA;MACE;MACA;QAAmB;;;;;UAgPZ,mBAAmB,aAAa;WAQtC,SAAS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AmB,cAAc,oBAAoB,GAAG,IAAI,kBAAkB,mBAAmB,GAAG,KACnG;iBA8LmB,gBAAgB,GAAG,UACvC,SAAS,gBAAgB,GAAG,IAC5B,mBAAmB,cAAc,oBAAoB,GAAG,IAAI,kBAAkB,mBAAmB,GAAG,KACnG;iBA+HmB,YAAY,GAAG,UACnC,SAAS,gBAAgB,GAAG,IAC5B,mBAAmB,cAAc,oBAAoB,GAAG,IAAI,kBAAkB,mBAAmB,GAAG,KACnG;;;UC3Xc;EACf;EACA;EACA;;cAqCW,8BAA8B;EAEhC;WAGO;EAMJ,YAAA,gBAAgB;WAiBZ;MAKZ,mBAAmB;MAenB;MAeA;MAeA;MAOA;EASJ;;;;;;;cAgBW,2BAA2B;WAIpB;WACA;EAJT;EAGS,YAAA,gBACA;;cAQP,qCAAqC;WAI9B;WACA;EAJT;EAGS,YAAA,sBACA;;iBAcJ,wBACd,iBACC,SAAS;iBAKI,qBACd,iBACC,SAAS;iBAKI,+BACd,iBACC,SAAS"}
|
package/dist/index.d.ts
CHANGED
|
@@ -306,34 +306,6 @@ declare function executeSequential<T, R = void>(context: PipelineContext<T, R>,
|
|
|
306
306
|
declare function executeParallel<T, R = void>(context: PipelineContext<T, R>, createController: (registration: HandlerRegistration<T, R>, index: number) => PipelineController<T, R>): Promise<void>;
|
|
307
307
|
declare function executeRace<T, R = void>(context: PipelineContext<T, R>, createController: (registration: HandlerRegistration<T, R>, index: number) => PipelineController<T, R>): Promise<void>;
|
|
308
308
|
//#endregion
|
|
309
|
-
//#region src/react-helpers.d.ts
|
|
310
|
-
declare function createActionHandler<T extends ActionPayloadMap, K extends keyof T>(registry: ActionRegister<T>, action: K, handler: ActionHandler<T[K]>, config?: HandlerConfig<T[K]>): {
|
|
311
|
-
register: () => UnregisterFunction;
|
|
312
|
-
unregister: () => void;
|
|
313
|
-
registerWithCleanup: () => () => void;
|
|
314
|
-
config: Required<HandlerConfig<T[K]>>;
|
|
315
|
-
};
|
|
316
|
-
declare const ReactDevUtils: {
|
|
317
|
-
enableDebugMode(): void;
|
|
318
|
-
disableDebugMode(): void;
|
|
319
|
-
isDebugMode(): boolean;
|
|
320
|
-
log(component: string, action: string, message: string, data?: unknown): void;
|
|
321
|
-
getStats(registry: ActionRegister<any>): {
|
|
322
|
-
totalHandlers: number;
|
|
323
|
-
reactHandlers: number;
|
|
324
|
-
registryInfo: ReturnType<ActionRegister<any>["getRegistryInfo"]>;
|
|
325
|
-
};
|
|
326
|
-
};
|
|
327
|
-
declare class ReactActionError extends Error {
|
|
328
|
-
readonly action: string;
|
|
329
|
-
readonly payload?: unknown;
|
|
330
|
-
readonly handlerId: string | undefined;
|
|
331
|
-
readonly timestamp: number;
|
|
332
|
-
constructor(message: string, action: string, payload?: unknown, handlerId?: string | undefined, originalError?: Error);
|
|
333
|
-
static fromActionError(originalError: Error, action: string, payload?: unknown, handlerId?: string): ReactActionError;
|
|
334
|
-
}
|
|
335
|
-
declare function isReactActionError(error: unknown): error is ReactActionError;
|
|
336
|
-
//#endregion
|
|
337
309
|
//#region src/errors.d.ts
|
|
338
310
|
interface ZodIssueLike {
|
|
339
311
|
message: string;
|
|
@@ -373,5 +345,5 @@ declare function isActionValidationError(error: unknown): error is ActionValidat
|
|
|
373
345
|
declare function isActionTimeoutError(error: unknown): error is ActionTimeoutError;
|
|
374
346
|
declare function isActionRegisterDestroyedError(error: unknown): error is ActionRegisterDestroyedError;
|
|
375
347
|
//#endregion
|
|
376
|
-
export { type ActionDispatcher, ActionGuard, type ActionHandler, type ActionPayloadMap, ActionRegister, type ActionRegisterConfig, ActionRegisterDestroyedError, type ActionSchemaLike, ActionTimeoutError, ActionValidationError, type DispatchOptions, type ExecutionMode, type ExecutionResult, type HandlerConfig, type HandlerRegistration, type PipelineContext, type PipelineController,
|
|
348
|
+
export { type ActionDispatcher, ActionGuard, type ActionHandler, type ActionPayloadMap, ActionRegister, type ActionRegisterConfig, ActionRegisterDestroyedError, type ActionSchemaLike, ActionTimeoutError, ActionValidationError, type DispatchOptions, type ExecutionMode, type ExecutionResult, type HandlerConfig, type HandlerRegistration, type PipelineContext, type PipelineController, type UnregisterFunction, executeParallel, executeRace, executeSequential, isActionRegisterDestroyedError, isActionTimeoutError, isActionValidationError };
|
|
377
349
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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/
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/ActionRegister.ts","../src/action-guard.ts","../src/execution-modes.ts","../src/errors.ts"],"mappings":";KAmBY;UASK;EACf,UAAU;IACJ;IAAe;;IAEf;IACA;MACE;MACA;QAAmB;;;;;UAgPZ,mBAAmB,aAAa;WAQtC,SAAS;EAGlB,MAAM;EAGN,cAAc,WAAW,SAAS,MAAM;EAGxC,cAAc;EA+Bd,eAAe;EAIf,OAAO,QAAQ;EAGf,UAAU,QAAQ;EAGlB,cAAc;EAGd,YAAY,SAAS,iBAAiB,KAAK,eAAe,MAAM;;KAoEtD,cAAc,aAAa,aACrC,SAAS,GACT,YAAY,mBAAmB,GAAG,OAC/B,IAAI,QAAQ,YAAY;UA6BZ,cAAc;EAE7B;EAGA;EAGA;EAGA;EAGA;EAGA;EAGA;EAGA;EAGA,aAAa,SAAS;;UAgBP,oBAAoB,aAAa;EAEhD,SAAS,cAAc,GAAG;EAG1B,QAAQ,SAAS,cAAc;EAG/B;;KA0BU;UAcK,gBAAgB,aAAa;EAE5C;EAGA,SAAS;EAGT,UAAU,oBAAoB,GAAG;EAGjC,mBAAmB,oBAAoB,GAAG;EAG1C;EAGA,SAAS;EAGT,qBAAqB,GAAG,SAAS,QAAQ,KAAK,QAAQ;EAGtD,kBAAkB;EAGlB;EAGA;EAGA;EAGA;EAGA;EAGA;EAGA,eAAe;EAGf,SAAS;EAGT;EAGA,mBAAmB;;U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2330
2330
|
};
|
|
2331
2331
|
|
|
2332
2332
|
//#endregion
|
|
2333
|
-
|
|
2334
|
-
/**
|
|
2335
|
-
* 🔧 Create action handler registration configuration for React components
|
|
2336
|
-
*
|
|
2337
|
-
* Creates a configuration object that can be used with React's useEffect to properly
|
|
2338
|
-
* register and unregister action handlers with lifecycle management and cleanup.
|
|
2339
|
-
* This is NOT a hook - it's a factory function for React hook integration.
|
|
2340
|
-
*
|
|
2341
|
-
* @template T - ActionPayloadMap type
|
|
2342
|
-
* @template K - Action key type
|
|
2343
|
-
*
|
|
2344
|
-
* @param registry - ActionRegister instance
|
|
2345
|
-
* @param action - Action name to register handler for
|
|
2346
|
-
* @param handler - Handler function (should be memoized with useCallback)
|
|
2347
|
-
* @param config - Handler configuration
|
|
2348
|
-
*
|
|
2349
|
-
* @returns Configuration object with register/unregister functions
|
|
2350
|
-
*
|
|
2351
|
-
* @example Basic Usage with useEffect
|
|
2352
|
-
* ```tsx
|
|
2353
|
-
* import { useCallback, useEffect } from 'react';
|
|
2354
|
-
* import { createActionHandler } from '@context-action/core/react-helpers';
|
|
2355
|
-
*
|
|
2356
|
-
* function MyComponent() {
|
|
2357
|
-
* const registry = useActionRegister();
|
|
2358
|
-
*
|
|
2359
|
-
* const handleUserUpdate = useCallback(async (payload, controller) => {
|
|
2360
|
-
* // Handler logic here
|
|
2361
|
-
* }, []);
|
|
2362
|
-
*
|
|
2363
|
-
* useEffect(() => {
|
|
2364
|
-
* const { register, unregister } = createActionHandler(
|
|
2365
|
-
* registry,
|
|
2366
|
-
* 'updateUser',
|
|
2367
|
-
* handleUserUpdate,
|
|
2368
|
-
* { priority: 10 }
|
|
2369
|
-
* );
|
|
2370
|
-
*
|
|
2371
|
-
* const cleanup = register();
|
|
2372
|
-
* return () => {
|
|
2373
|
-
* cleanup();
|
|
2374
|
-
* unregister();
|
|
2375
|
-
* };
|
|
2376
|
-
* }, [registry, handleUserUpdate]);
|
|
2377
|
-
* }
|
|
2378
|
-
* ```
|
|
2379
|
-
*
|
|
2380
|
-
* @example With Automatic Cleanup
|
|
2381
|
-
* ```tsx
|
|
2382
|
-
* const [userId, setUserId] = useState('123');
|
|
2383
|
-
*
|
|
2384
|
-
* const handleUserUpdate = useCallback(async (payload, controller) => {
|
|
2385
|
-
* console.log('Updating user:', userId, payload);
|
|
2386
|
-
* }, [userId]);
|
|
2387
|
-
*
|
|
2388
|
-
* useEffect(() => {
|
|
2389
|
-
* const handlerManager = createActionHandler(
|
|
2390
|
-
* registry,
|
|
2391
|
-
* 'updateUser',
|
|
2392
|
-
* handleUserUpdate,
|
|
2393
|
-
* { priority: 10 }
|
|
2394
|
-
* );
|
|
2395
|
-
*
|
|
2396
|
-
* // Simplified registration with automatic cleanup
|
|
2397
|
-
* return handlerManager.registerWithCleanup();
|
|
2398
|
-
* }, [registry, handleUserUpdate, userId]);
|
|
2399
|
-
* ```
|
|
2400
|
-
*
|
|
2401
|
-
* @public
|
|
2402
|
-
*/
|
|
2403
|
-
function createActionHandler(registry, action, handler, config) {
|
|
2404
|
-
const timestamp = Date.now();
|
|
2405
|
-
const random = Math.random().toString(36).substr(2, 5);
|
|
2406
|
-
const finalConfig = {
|
|
2407
|
-
priority: config?.priority ?? 0,
|
|
2408
|
-
id: config?.id || `react_${String(action)}_${timestamp}_${random}`,
|
|
2409
|
-
blocking: config?.blocking ?? false,
|
|
2410
|
-
once: config?.once ?? false,
|
|
2411
|
-
debounce: config?.debounce ?? void 0,
|
|
2412
|
-
throttle: config?.throttle ?? void 0,
|
|
2413
|
-
replaceExisting: true
|
|
2414
|
-
};
|
|
2415
|
-
let currentUnregister;
|
|
2416
|
-
let isRegistered = false;
|
|
2417
|
-
return {
|
|
2418
|
-
/**
|
|
2419
|
-
* Register the handler and return cleanup function
|
|
2420
|
-
*/
|
|
2421
|
-
register() {
|
|
2422
|
-
if (isRegistered && currentUnregister) currentUnregister();
|
|
2423
|
-
currentUnregister = registry.register(action, handler, finalConfig);
|
|
2424
|
-
isRegistered = true;
|
|
2425
|
-
return currentUnregister;
|
|
2426
|
-
},
|
|
2427
|
-
/**
|
|
2428
|
-
* Unregister the handler if currently registered
|
|
2429
|
-
*/
|
|
2430
|
-
unregister() {
|
|
2431
|
-
if (isRegistered && currentUnregister) {
|
|
2432
|
-
currentUnregister();
|
|
2433
|
-
currentUnregister = void 0;
|
|
2434
|
-
isRegistered = false;
|
|
2435
|
-
}
|
|
2436
|
-
},
|
|
2437
|
-
/**
|
|
2438
|
-
* Register and return cleanup function (React useEffect pattern)
|
|
2439
|
-
*/
|
|
2440
|
-
registerWithCleanup() {
|
|
2441
|
-
const unregisterFn = this.register();
|
|
2442
|
-
return () => {
|
|
2443
|
-
unregisterFn();
|
|
2444
|
-
this.unregister();
|
|
2445
|
-
};
|
|
2446
|
-
},
|
|
2447
|
-
config: finalConfig
|
|
2448
|
-
};
|
|
2449
|
-
}
|
|
2450
|
-
/**
|
|
2451
|
-
* 🆕 React development utilities
|
|
2452
|
-
*
|
|
2453
|
-
* Provides debugging and development helpers specifically for React environments.
|
|
2454
|
-
*/
|
|
2455
|
-
const ReactDevUtils = {
|
|
2456
|
-
/**
|
|
2457
|
-
* Enable detailed React integration debugging
|
|
2458
|
-
*/
|
|
2459
|
-
enableDebugMode() {
|
|
2460
|
-
if (typeof window !== "undefined") window.__CONTEXT_ACTION_REACT_DEBUG__ = true;
|
|
2461
|
-
},
|
|
2462
|
-
/**
|
|
2463
|
-
* Disable React integration debugging
|
|
2464
|
-
*/
|
|
2465
|
-
disableDebugMode() {
|
|
2466
|
-
if (typeof window !== "undefined") window.__CONTEXT_ACTION_REACT_DEBUG__ = false;
|
|
2467
|
-
},
|
|
2468
|
-
/**
|
|
2469
|
-
* Check if React debug mode is enabled
|
|
2470
|
-
*/
|
|
2471
|
-
isDebugMode() {
|
|
2472
|
-
return typeof window !== "undefined" && Boolean(window.__CONTEXT_ACTION_REACT_DEBUG__);
|
|
2473
|
-
},
|
|
2474
|
-
/**
|
|
2475
|
-
* Log React-specific debugging information
|
|
2476
|
-
*/
|
|
2477
|
-
log(component, action, message, data) {
|
|
2478
|
-
if (this.isDebugMode()) console.log(`🎯 [React-ActionRegister] [${component}] ${action}: ${message}`, data || "");
|
|
2479
|
-
},
|
|
2480
|
-
/**
|
|
2481
|
-
* Get React integration statistics
|
|
2482
|
-
*/
|
|
2483
|
-
getStats(registry) {
|
|
2484
|
-
const registryInfo = registry.getRegistryInfo();
|
|
2485
|
-
let reactHandlers = 0;
|
|
2486
|
-
registry.getRegisteredActions().forEach((action) => {
|
|
2487
|
-
const stats = registry.getActionStats(action);
|
|
2488
|
-
if (stats) stats.handlersByPriority.forEach((priorityGroup) => {
|
|
2489
|
-
priorityGroup.handlers.forEach((handler) => {
|
|
2490
|
-
if (handler.id.includes("react")) reactHandlers++;
|
|
2491
|
-
});
|
|
2492
|
-
});
|
|
2493
|
-
});
|
|
2494
|
-
return {
|
|
2495
|
-
totalHandlers: registryInfo.totalHandlers,
|
|
2496
|
-
reactHandlers,
|
|
2497
|
-
registryInfo
|
|
2498
|
-
};
|
|
2499
|
-
}
|
|
2500
|
-
};
|
|
2501
|
-
/**
|
|
2502
|
-
* 🆕 React Error Boundary integration
|
|
2503
|
-
*
|
|
2504
|
-
* Utilities for integrating ActionRegister errors with React Error Boundaries.
|
|
2505
|
-
*/
|
|
2506
|
-
var ReactActionError = class ReactActionError extends Error {
|
|
2507
|
-
constructor(message, action, payload, handlerId = void 0, originalError) {
|
|
2508
|
-
super(message);
|
|
2509
|
-
this.name = "ReactActionError";
|
|
2510
|
-
this.action = action;
|
|
2511
|
-
this.payload = payload;
|
|
2512
|
-
this.handlerId = handlerId;
|
|
2513
|
-
this.timestamp = Date.now();
|
|
2514
|
-
if (originalError?.stack) this.stack = originalError.stack;
|
|
2515
|
-
}
|
|
2516
|
-
/**
|
|
2517
|
-
* Create a React Error Boundary compatible error
|
|
2518
|
-
*/
|
|
2519
|
-
static fromActionError(originalError, action, payload, handlerId) {
|
|
2520
|
-
return new ReactActionError(`Action '${action}' failed: ${originalError.message}`, action, payload, handlerId, originalError);
|
|
2521
|
-
}
|
|
2522
|
-
};
|
|
2523
|
-
/**
|
|
2524
|
-
* 🆕 Type guard for React Action Errors
|
|
2525
|
-
*
|
|
2526
|
-
* @param error - Error to check
|
|
2527
|
-
* @returns True if error is a ReactActionError
|
|
2528
|
-
*/
|
|
2529
|
-
function isReactActionError(error) {
|
|
2530
|
-
return error instanceof ReactActionError;
|
|
2531
|
-
}
|
|
2532
|
-
|
|
2533
|
-
//#endregion
|
|
2534
|
-
export { ActionGuard, ActionRegister, ActionRegisterDestroyedError, ActionTimeoutError, ActionValidationError, ReactActionError, ReactDevUtils, createActionHandler, executeParallel, executeRace, executeSequential, isActionRegisterDestroyedError, isActionTimeoutError, isActionValidationError, isReactActionError };
|
|
2333
|
+
export { ActionGuard, ActionRegister, ActionRegisterDestroyedError, ActionTimeoutError, ActionValidationError, executeParallel, executeRace, executeSequential, isActionRegisterDestroyedError, isActionTimeoutError, isActionValidationError };
|
|
2535
2334
|
//# sourceMappingURL=index.js.map
|