Interface IResourceDefinition<TConfig, TValue, TDependencies, TContext, THooks, TRegisterableItems>

interface IResourceDefinition<TConfig, TValue, TDependencies, TContext, THooks, TRegisterableItems> {
    [symbolFilePath]?: string;
    [symbolIndexResource]?: boolean;
    context?: (() => TContext);
    dependencies?: TDependencies | ((config: TConfig) => TDependencies);
    dispose?: ((this: any, value: TValue, config: TConfig, dependencies: DependencyValuesType<TDependencies>, context: TContext) => Promise<void>);
    id?: string | symbol;
    init?: ((this: any, config: TConfig, dependencies: DependencyValuesType<TDependencies>, context: TContext) => Promise<TValue>);
    meta?: IResourceMeta;
    middleware?: MiddlewareAttachments[];
    overrides?: (
        | IMiddleware<any, any>
        | IResource<void, any, any, any>
        | ITask<any, any, {}, undefined>
        | IResourceWithConfig<any, any, any>)[];
    register?: RegisterableItems<any>[] | ((config: TConfig) => RegisterableItems<any>[]);
}

Type Parameters

  • TConfig = any
  • TValue = unknown
  • TDependencies extends DependencyMapType = {}
  • TContext = any
  • THooks = any
  • TRegisterableItems = any

Hierarchy (view full)

Properties

[symbolFilePath]?: string

This is optional and used from an index resource to get the correct caller.

[symbolIndexResource]?: boolean

This is used internally when creating index resources.

context?: (() => TContext)
dependencies?: TDependencies | ((config: TConfig) => TDependencies)
dispose?: ((this: any, value: TValue, config: TConfig, dependencies: DependencyValuesType<TDependencies>, context: TContext) => Promise<void>)

Clean-up function for the resource. This is called when the resource is no longer needed.

Type declaration

    • (this, value, config, dependencies, context): Promise<void>
    • Parameters

      Returns Promise<void>

      Promise

id?: string | symbol
init?: ((this: any, config: TConfig, dependencies: DependencyValuesType<TDependencies>, context: TContext) => Promise<TValue>)
middleware?: MiddlewareAttachments[]
overrides?: (
    | IMiddleware<any, any>
    | IResource<void, any, any, any>
    | ITask<any, any, {}, undefined>
    | IResourceWithConfig<any, any, any>)[]
register?: RegisterableItems<any>[] | ((config: TConfig) => RegisterableItems<any>[])