Configuration for the middleware application function
A Use function configured with the provided settings
import { useFactory } from '@daiso-tech/core/middleware';
// Create with default settings
const use = useFactory();
// Create with custom execution context
const customContext = new ExecutionContext(new MyAdapter());
const useWithContext = useFactory({ executionContext: customContext });
// Create with custom default priority
const useWithPriority = useFactory({ defaultPriority: 50 });
// Use the middleware application function
const wrappedFunc = use(myFunction, [middleware1, middleware2]);
const result = wrappedFunc(...args);
Creates a middleware application function with optional custom settings.
Returns a
Usefunction that can wrap invokables with middleware chains. The factory pattern allows reusing the same configuration across multiple invokables, including shared execution context and default middleware priority.