UNPKG

@daiso-tech/core

Version:

The library offers flexible, framework-agnostic solutions for modern web applications, built on adaptable components that integrate seamlessly with popular frameworks like Next Js.

23 lines (22 loc) 956 B
/** * @module ExecutionContext */ import { type IExecutionContextAdapter } from "../../../../execution-context/contracts/_module.js"; import { type InvokableFn } from "../../../../utilities/_module.js"; /** * IMPORT_PATH: `"@daiso-tech/core/execution-context/als-execution-context-adapter"` * * Execution context adapter using Node.js AsyncLocalStorage. * * This adapter implements context storage using Node.js's AsyncLocalStorage API, * which provides automatic context propagation across async boundaries. * It ensures context values are maintained correctly through promises, callbacks, * and other asynchronous operations. * * Recommended for Node.js environments where async context isolation is needed. */ export declare class AlsExecutionContextAdapter<TValue> implements IExecutionContextAdapter<TValue> { private readonly als; get(): TValue | null; run<TReturn>(context: TValue, fn: InvokableFn<[], TReturn>): TReturn; }