import { CanAssignSignal, GetAssignmentReferences, GetNonAssignableElements, Tail } from './utility-types'; export type { CanAssignSignal }; /** * A middleware type that can modify the data * @typeParam T - The data type * @param data - The data to be modified * @returns The modified data or undefined * @example (data) => data + 1 * @example (data) => undefined // will stop the execution * @internal */ export type Pipe = (data: T) => Promise | undefined | T; export type CanAssignEach = D extends [infer H1, ...infer Tail1] ? (F extends [infer H2, ...infer Tail2] ? [ CanAssignSignal, ...CanAssignEach ] : []) : []; export type ScopeAsParameter, Current extends any[]> = (CanAssignEach<[S['__scope']['produces'], ...S['__scope']['parents']], Current>[number] extends true ? S : 'Argument Scope does not provide expected signals'); /** * Validate the Scope signals and replace the parameter type with an error message if they are not assignable * @internal */ export type NestedScope, Current extends any[]> = (CanAssignEach[number] extends true ? S : 'Parent signals do not satisfy the connected scope. Please use `.debug($ => $) for detailed assignment error'); /** * Provides 'debug' method to check the detailed assignment error message * @example .debug($ => $) * @internal */ export declare function useHelper, Signals>(): { debug>(_f: (p: GetAssignmentReferences) => T): void; }; /** * A signal is a middleware chain that can be used to modify the data * @typeParam T - The data type * @internal */ export declare class Signal { pipes: Pipe[]; addPipe(pipe: Pipe): void; emit(context: Context): Promise; } type Type = (new (...args: any[]) => T) | (abstract new (...args: any[]) => T); /** * Base class for all plugins and the core. Provides a signals mechanism to modify the data */ export declare class Scope { name: string; signal: Signal; parent?: any; __scope: { produces: Produces; parents: Parents; }; constructor(name: string); addPipe(middleware: Pipe): void; use>(scope: NestedScope): { debug, Produces | Parents[number]>>>(_f: (p: { [K in keyof T]: Produces | Parents[number]; }) => T): void; }; setParent(scope: Scope>): void; emit(context: C): Promise | undefined>; hasParent(): boolean; parentScope>(): Scope; parentScope(type: Type): T; } //# sourceMappingURL=scope.d.ts.map