Executes the given function within the specified context.
This method ensures the provided context is active during function execution,
making it accessible to get() calls within the function and any nested function calls.
When the function completes, the previous context (if any) is restored.
Useful for:
Note: This method is used for both asynchronous and synchronous execution.
The context value to set for the duration of the function execution
The function to execute within the context
The return value of the executed function
IMPORT_PATH:
"@daiso-tech/core/execution-context/contracts"Adapter contract for managing execution context storage and lifecycle.
This contract defines the contract for storing and retrieving context values in different execution environments (e.g., AsyncLocalStorage for Node.js, thread-local storage). It allows different adapters to implement context tracking differently based on the runtime.
The adapter provides context isolation, ensuring each execution path has its own context:
Common use cases: