Interface IResourceMiddlewareConfigured<TConfig, TEnforceInputContract, TEnforceOutputContract, TDependencies>

interface IResourceMiddlewareConfigured<TConfig, TEnforceInputContract, TEnforceOutputContract, TDependencies> {
    __containsContract: true;
    [CONTRACT]: {
        config: TConfig;
        input: TEnforceInputContract;
        output: TEnforceOutputContract;
    };
    [symbolFilePath]: string;
    [symbolMiddlewareConfigured]: true;
    [symbolResourceMiddleware]: true;
    config: TConfig;
    configSchema?: IValidationSchema<TConfig>;
    dependencies: TDependencies | (() => TDependencies);
    everywhere?: boolean | ((resource: IResource<any, any, any, any, any, TagType[], ResourceMiddlewareAttachmentType[]>) => boolean);
    id: string;
    meta?: IMiddlewareMeta;
    run: ((input: IResourceMiddlewareExecutionInput<TEnforceInputContract extends void
        ? any
        : TEnforceInputContract, TEnforceOutputContract extends void
        ? any
        : TEnforceOutputContract>, dependencies: DependencyValuesType<TDependencies>, config: TConfig) => Promise<any>);
    tags: TagType[];
    with: ((config: TConfig) => IResourceMiddlewareConfigured<TConfig, TEnforceInputContract, TEnforceOutputContract, TDependencies>);
}

Type Parameters

  • TConfig = any
  • TEnforceInputContract = void
  • TEnforceOutputContract = void
  • TDependencies extends DependencyMapType = any

Hierarchy (view full)

Properties

__containsContract: true
[CONTRACT]: {
    config: TConfig;
    input: TEnforceInputContract;
    output: TEnforceOutputContract;
}
[symbolFilePath]: string
[symbolMiddlewareConfigured]: true
[symbolResourceMiddleware]: true
config: TConfig

Current configuration object (empty by default).

configSchema?: IValidationSchema<TConfig>

Optional validation schema for runtime config validation. When provided, middleware config will be validated when .with() is called.

dependencies: TDependencies | (() => TDependencies)

Static or lazy dependency map.

everywhere?: boolean | ((resource: IResource<any, any, any, any, any, TagType[], ResourceMiddlewareAttachmentType[]>) => boolean)
id: string
run: ((input: IResourceMiddlewareExecutionInput<TEnforceInputContract extends void
    ? any
    : TEnforceInputContract, TEnforceOutputContract extends void
    ? any
    : TEnforceOutputContract>, dependencies: DependencyValuesType<TDependencies>, config: TConfig) => Promise<any>)

The middleware body, called with resource execution input.

tags: TagType[]

Configure the middleware and return a marked, configured instance.