From d9db3280ae567f5034635adefa8dbbd3547d0678 Mon Sep 17 00:00:00 2001 From: Theodor Diaconu Date: Mon, 7 Oct 2024 10:55:34 +0300 Subject: [PATCH] typedoc --- README.md | 1 - docs/classes/EventManager.html | 4 ++-- docs/classes/Store.html | 14 +++++++------- docs/classes/TaskRunner.html | 8 ++++---- docs/functions/event.html | 2 +- docs/functions/middleware.html | 2 +- docs/functions/resource.html | 2 +- docs/functions/run.html | 2 +- docs/functions/task.html | 2 +- docs/index.html | 1 - docs/interfaces/definitions.IEvent.html | 8 ++++---- docs/interfaces/definitions.IEventDefinition.html | 4 ++-- docs/interfaces/definitions.IEventMeta.html | 4 ++-- docs/interfaces/definitions.IHookDefinition.html | 6 +++--- docs/interfaces/definitions.IMeta.html | 4 ++-- docs/interfaces/definitions.IMiddleware.html | 4 ++-- .../definitions.IMiddlewareDefinition.html | 4 ++-- ...efinitions.IMiddlewareDefinitionConfigured.html | 4 ++-- .../definitions.IMiddlewareExecutionInput.html | 4 ++-- docs/interfaces/definitions.IMiddlewareMeta.html | 4 ++-- docs/interfaces/definitions.IResource.html | 8 ++++---- .../definitions.IResourceDefinintion.html | 6 +++--- docs/interfaces/definitions.IResourceMeta.html | 4 ++-- .../definitions.IResourceWithConfig.html | 4 ++-- docs/interfaces/definitions.ITask.html | 10 +++++----- docs/interfaces/definitions.ITaskDefinition.html | 8 ++++---- docs/interfaces/definitions.ITaskMeta.html | 4 ++-- docs/modules/definitions.html | 2 +- docs/types/definitions.AfterInitEventPayload.html | 2 +- docs/types/definitions.AfterRunEventPayload.html | 2 +- docs/types/definitions.BeforeInitEventPayload.html | 2 +- docs/types/definitions.BeforeRunEventPayload.html | 2 +- docs/types/definitions.DependencyMapType.html | 2 +- docs/types/definitions.DependencyValueType.html | 2 +- docs/types/definitions.DependencyValuesType.html | 2 +- docs/types/definitions.EventHandlerType.html | 2 +- docs/types/definitions.OnErrorEventPayload.html | 2 +- docs/types/definitions.RegisterableItems.html | 2 +- docs/variables/definitions.symbols.html | 2 +- docs/variables/globals.html | 2 +- 40 files changed, 76 insertions(+), 78 deletions(-) diff --git a/README.md b/README.md index 6baa742..882e34e 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@

Build Status -Build Status Coverage Status Docs

diff --git a/docs/classes/EventManager.html b/docs/classes/EventManager.html index 42371e3..b9a7d4b 100644 --- a/docs/classes/EventManager.html +++ b/docs/classes/EventManager.html @@ -156,14 +156,14 @@ --md-sys-color-surface-container-high: #e7e8ea; --md-sys-color-surface-container-highest: #e1e3e4 } -

Constructors

constructor +

Constructors

Accessors

Methods

Store class which is used to store all the resources, tasks, middleware and events.

-

Constructors

Constructors

Properties

eventManager: EventManager
events: Map<string, EventStoreElementType> = ...
logger: Logger
middlewares: Map<string, MiddlewareStoreElementType<any>> = ...
overrides: Map<string,
    | IResource<void, any, any>
    | ITask<any, any, {}, null>
    | IMiddleware<any>
    | IResourceWithConfig<any, any, any>> = ...
resources: Map<string, ResourceStoreElementType<any, any, {}>> = ...
root: ResourceStoreElementType<any, any, {}>
tasks: Map<string, TaskStoreElementType<any, any, any>> = ...

Accessors

Methods

  • middlewares are already stored in their final form and the check for them would be redundant

    -

    Parameters

    • id: string

    Returns void

  • Store the root before beginning registration

    -

    Parameters

    Returns void

  • When this is called, all overrides should have been stored in the "overrides" store.

    -

    Returns void

  • If you want to register something to the store you can use this function.

    -

    Type Parameters

    • C

    Parameters

    Returns void

Constructors

constructor +

Constructors

Properties

eventManager: EventManager
logger: Logger
runnerStore: Map<string, ((input: any) => Promise<any>)> = ...
store: Store

Methods

  • Begins the execution of an task. These are registered tasks and all sanity checks have been performed at this stage to ensure consistency of the object. +

Constructors

Properties

eventManager: EventManager
logger: Logger
runnerStore: Map<string, ((input: any) => Promise<any>)> = ...
store: Store

Methods

  • Begins the execution of an task. These are registered tasks and all sanity checks have been performed at this stage to ensure consistency of the object. This function can throw only if any of the event listeners or run function throws

    Type Parameters

    Parameters

    • task: ITask<TInput, TOutput, TDeps, null>

      the task to be run

    • input: TInput

      the input to be passed to the task

    • OptionaltaskDependencies: DependencyValuesType<TDeps>

      optional dependencies to be passed to the task, if not provided, the dependencies will be the ones already computed from the store.

      -

    Returns Promise<undefined | TOutput>

Function event

Function event

Function middleware

Function middleware

Function resource

Function resource

  • Type Parameters

    • C
    • V

    Parameters

    Returns Promise<V>

  • Type Parameters

    • C
    • V

    Parameters

    Returns Promise<V>

@bluelibs/runner - v1.5.0

BlueLibs Runner

Build Status -Build Status Coverage Status Docs

diff --git a/docs/interfaces/definitions.IEvent.html b/docs/interfaces/definitions.IEvent.html index 8602ddb..aa7a700 100644 --- a/docs/interfaces/definitions.IEvent.html +++ b/docs/interfaces/definitions.IEvent.html @@ -156,14 +156,14 @@ --md-sys-color-surface-container-high: #e7e8ea; --md-sys-color-surface-container-highest: #e1e3e4 } -

Interface IEvent<TPayload>

interface IEvent<TPayload> {
    data: TPayload;
    id: string;
    source: string;
    timestamp: Date;
}

Type Parameters

  • TPayload = any

Properties

data +

Interface IEvent<TPayload>

interface IEvent<TPayload> {
    data: TPayload;
    id: string;
    source: string;
    timestamp: Date;
}

Type Parameters

  • TPayload = any

Properties

Properties

data: TPayload

The data that the event carries. It can be anything.

-
id: string
source: string

The source of the event. This can be useful for debugging.

-
timestamp: Date

The timestamp when the event was created.

-

Interface IEventDefinition<TPayload>

interface IEventDefinition<TPayload> {
    id: string;
    meta?: IEventMeta;
}

Type Parameters

  • TPayload = void

Properties

id +

Interface IEventDefinition<TPayload>

interface IEventDefinition<TPayload> {
    id: string;
    meta?: IEventMeta;
}

Type Parameters

  • TPayload = void

Properties

Properties

id: string
meta?: IEventMeta
interface IEventMeta {
    description?: string;
    tags?: string[];
    title?: string;
}

Hierarchy (view full)

Properties

description? +
interface IEventMeta {
    description?: string;
    tags?: string[];
    title?: string;
}

Hierarchy (view full)

Properties

description?: string
tags?: string[]
title?: string

Interface IHookDefinition<D, T, B>

interface IHookDefinition<D, T, B> {
    early?: B;
    event: IEventDefinition<T> | "*";
    order?: number;
    run: ((event: IEvent<T>, dependencies: T extends true
        ? void
        : DependencyValuesType<D>) => void | Promise<void>);
}

Type Parameters

Properties

early? +

Interface IHookDefinition<D, T, B>

interface IHookDefinition<D, T, B> {
    early?: B;
    event: IEventDefinition<T> | "*";
    order?: number;
    run: ((event: IEvent<T>, dependencies: T extends true
        ? void
        : DependencyValuesType<D>) => void | Promise<void>);
}

Type Parameters

Properties

Properties

early?: B

These are hooks that run before any resource instantiation.

-
event: IEventDefinition<T> | "*"
order?: number

The higher the number, the higher the priority. +

event: IEventDefinition<T> | "*"
order?: number

The higher the number, the higher the priority. We recommend using numbers between -1000 and 1000.

-
run: ((event: IEvent<T>, dependencies: T extends true
    ? void
    : DependencyValuesType<D>) => void | Promise<void>)
interface IMeta {
    description?: string;
    tags?: string[];
    title?: string;
}

Hierarchy (view full)

Properties

description? +
interface IMeta {
    description?: string;
    tags?: string[];
    title?: string;
}

Hierarchy (view full)

Properties

description?: string
tags?: string[]
title?: string

Interface IMiddleware<TDependencies>

interface IMiddleware<TDependencies> {
    dependencies: TDependencies | (() => TDependencies);
    id: string;
    meta?: IMiddlewareMeta;
    run: ((input: IMiddlewareExecutionInput, dependencies: DependencyValuesType<TDependencies>) => Promise<any>);
    global(): IMiddleware<TDependencies>;
}

Type Parameters

Hierarchy (view full)

Properties

dependencies +

Interface IMiddleware<TDependencies>

interface IMiddleware<TDependencies> {
    dependencies: TDependencies | (() => TDependencies);
    id: string;
    meta?: IMiddlewareMeta;
    run: ((input: IMiddlewareExecutionInput, dependencies: DependencyValuesType<TDependencies>) => Promise<any>);
    global(): IMiddleware<TDependencies>;
}

Type Parameters

Hierarchy (view full)

Properties

Methods

Properties

dependencies: TDependencies | (() => TDependencies)
id: string
run: ((input: IMiddlewareExecutionInput, dependencies: DependencyValuesType<TDependencies>) => Promise<any>)

Methods

Interface IMiddlewareDefinition<TDependencies>

interface IMiddlewareDefinition<TDependencies> {
    dependencies?: TDependencies | (() => TDependencies);
    id: string;
    meta?: IMiddlewareMeta;
    run: ((input: IMiddlewareExecutionInput, dependencies: DependencyValuesType<TDependencies>) => Promise<any>);
}

Type Parameters

Hierarchy (view full)

Properties

dependencies? +

Interface IMiddlewareDefinition<TDependencies>

interface IMiddlewareDefinition<TDependencies> {
    dependencies?: TDependencies | (() => TDependencies);
    id: string;
    meta?: IMiddlewareMeta;
    run: ((input: IMiddlewareExecutionInput, dependencies: DependencyValuesType<TDependencies>) => Promise<any>);
}

Type Parameters

Hierarchy (view full)

Properties

dependencies?: TDependencies | (() => TDependencies)
id: string
run: ((input: IMiddlewareExecutionInput, dependencies: DependencyValuesType<TDependencies>) => Promise<any>)

Interface IMiddlewareDefinitionConfigured<C>

interface IMiddlewareDefinitionConfigured<C> {
    config?: C;
    middleware: IMiddleware<C>;
}

Type Parameters

  • C extends Record<string, any> = {}

Properties

config? +

Interface IMiddlewareDefinitionConfigured<C>

interface IMiddlewareDefinitionConfigured<C> {
    config?: C;
    middleware: IMiddleware<C>;
}

Type Parameters

  • C extends Record<string, any> = {}

Properties

Properties

config?: C
middleware: IMiddleware<C>

Interface IMiddlewareExecutionInput

interface IMiddlewareExecutionInput {
    config?: any;
    input?: any;
    next: ((taskInputOrResourceConfig?: any) => Promise<any>);
    resourceDefinition?: IResource<void, any, any>;
    taskDefinition?: ITask<any, any, {}, null>;
}

Properties

config? +

Interface IMiddlewareExecutionInput

interface IMiddlewareExecutionInput {
    config?: any;
    input?: any;
    next: ((taskInputOrResourceConfig?: any) => Promise<any>);
    resourceDefinition?: IResource<void, any, any>;
    taskDefinition?: ITask<any, any, {}, null>;
}

Properties

config?: any
input?: any
next: ((taskInputOrResourceConfig?: any) => Promise<any>)
resourceDefinition?: IResource<void, any, any>
taskDefinition?: ITask<any, any, {}, null>
interface IMiddlewareMeta {
    description?: string;
    tags?: string[];
    title?: string;
}

Hierarchy (view full)

Properties

description? +
interface IMiddlewareMeta {
    description?: string;
    tags?: string[];
    title?: string;
}

Hierarchy (view full)

Properties

description?: string
tags?: string[]
title?: string

Interface IResource<TConfig, TValue, TDependencies>

interface IResource<TConfig, TValue, TDependencies> {
    dependencies?: TDependencies | ((config: TConfig) => TDependencies);
    dispose?: ((value: TValue, config: TConfig, dependencies: DependencyValuesType<TDependencies>) => Promise<TValue>);
    events: {
        afterInit: IEventDefinition<AfterInitEventPayload<TConfig, TValue>>;
        beforeInit: IEventDefinition<BeforeInitEventPayload<TConfig>>;
        onError: IEventDefinition<OnErrorEventPayload>;
    };
    hooks: IHookDefinition<TDependencies, any, false>[] | ((config: TConfig) => IHookDefinition<TDependencies, any, false>[]);
    id: string;
    init?: ((config: TConfig, dependencies: DependencyValuesType<TDependencies>) => Promise<TValue>);
    meta?: IResourceMeta;
    middleware: IMiddlewareDefinition<any>[];
    overrides: (
        | IResource<void, any, any>
        | ITask<any, any, {}, null>
        | IMiddleware<any>
        | IResourceWithConfig<any, any, any>)[];
    register: RegisterableItems[] | ((config: TConfig) => RegisterableItems[]);
    with(config: TConfig): IResourceWithConfig<TConfig, TValue, TDependencies>;
}

Type Parameters

Hierarchy (view full)

Properties

dependencies? +

Interface IResource<TConfig, TValue, TDependencies>

interface IResource<TConfig, TValue, TDependencies> {
    dependencies?: TDependencies | ((config: TConfig) => TDependencies);
    dispose?: ((value: TValue, config: TConfig, dependencies: DependencyValuesType<TDependencies>) => Promise<TValue>);
    events: {
        afterInit: IEventDefinition<AfterInitEventPayload<TConfig, TValue>>;
        beforeInit: IEventDefinition<BeforeInitEventPayload<TConfig>>;
        onError: IEventDefinition<OnErrorEventPayload>;
    };
    hooks: IHookDefinition<TDependencies, any, false>[] | ((config: TConfig) => IHookDefinition<TDependencies, any, false>[]);
    id: string;
    init?: ((config: TConfig, dependencies: DependencyValuesType<TDependencies>) => Promise<TValue>);
    meta?: IResourceMeta;
    middleware: IMiddlewareDefinition<any>[];
    overrides: (
        | IResource<void, any, any>
        | ITask<any, any, {}, null>
        | IMiddleware<any>
        | IResourceWithConfig<any, any, any>)[];
    register: RegisterableItems[] | ((config: TConfig) => RegisterableItems[]);
    with(config: TConfig): IResourceWithConfig<TConfig, TValue, TDependencies>;
}

Type Parameters

Hierarchy (view full)

Properties

Methods

Properties

dependencies?: TDependencies | ((config: TConfig) => TDependencies)
dispose?: ((value: TValue, config: TConfig, dependencies: DependencyValuesType<TDependencies>) => Promise<TValue>)

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

+

Properties

dependencies?: TDependencies | ((config: TConfig) => TDependencies)
dispose?: ((value: TValue, config: TConfig, dependencies: DependencyValuesType<TDependencies>) => Promise<TValue>)

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

Type declaration

These events are automatically populated after the task has been defined.

-
hooks: IHookDefinition<TDependencies, any, false>[] | ((config: TConfig) => IHookDefinition<TDependencies, any, false>[])
id: string
init?: ((config: TConfig, dependencies: DependencyValuesType<TDependencies>) => Promise<TValue>)
middleware: IMiddlewareDefinition<any>[]
overrides: (
    | IResource<void, any, any>
    | ITask<any, any, {}, null>
    | IMiddleware<any>
    | IResourceWithConfig<any, any, any>)[]
register: RegisterableItems[] | ((config: TConfig) => RegisterableItems[])

Methods

Interface IResourceDefinintion<TConfig, TValue, TDependencies, THooks, TRegisterableItems>

interface IResourceDefinintion<TConfig, TValue, TDependencies, THooks, TRegisterableItems> {
    dependencies?: TDependencies | ((config: TConfig) => TDependencies);
    dispose?: ((value: TValue, config: TConfig, dependencies: DependencyValuesType<TDependencies>) => Promise<TValue>);
    hooks?: IHookDefinition<TDependencies, THooks, false>[] | ((config: TConfig) => IHookDefinition<TDependencies, THooks, false>[]);
    id: string;
    init?: ((config: TConfig, dependencies: DependencyValuesType<TDependencies>) => Promise<TValue>);
    meta?: IResourceMeta;
    middleware?: IMiddlewareDefinition<any>[];
    overrides?: (
        | IResource<void, any, any>
        | ITask<any, any, {}, null>
        | IMiddleware<any>
        | IResourceWithConfig<any, any, any>)[];
    register?: RegisterableItems[] | ((config: TConfig) => RegisterableItems[]);
}

Type Parameters

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

Hierarchy (view full)

Properties

dependencies? +

Interface IResourceDefinintion<TConfig, TValue, TDependencies, THooks, TRegisterableItems>

interface IResourceDefinintion<TConfig, TValue, TDependencies, THooks, TRegisterableItems> {
    dependencies?: TDependencies | ((config: TConfig) => TDependencies);
    dispose?: ((value: TValue, config: TConfig, dependencies: DependencyValuesType<TDependencies>) => Promise<TValue>);
    hooks?: IHookDefinition<TDependencies, THooks, false>[] | ((config: TConfig) => IHookDefinition<TDependencies, THooks, false>[]);
    id: string;
    init?: ((config: TConfig, dependencies: DependencyValuesType<TDependencies>) => Promise<TValue>);
    meta?: IResourceMeta;
    middleware?: IMiddlewareDefinition<any>[];
    overrides?: (
        | IResource<void, any, any>
        | ITask<any, any, {}, null>
        | IMiddleware<any>
        | IResourceWithConfig<any, any, any>)[];
    register?: RegisterableItems[] | ((config: TConfig) => RegisterableItems[]);
}

Type Parameters

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

Hierarchy (view full)

Properties

Properties

dependencies?: TDependencies | ((config: TConfig) => TDependencies)
dispose?: ((value: TValue, config: TConfig, dependencies: DependencyValuesType<TDependencies>) => Promise<TValue>)

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

+

Properties

dependencies?: TDependencies | ((config: TConfig) => TDependencies)
dispose?: ((value: TValue, config: TConfig, dependencies: DependencyValuesType<TDependencies>) => Promise<TValue>)

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

Type declaration

hooks?: IHookDefinition<TDependencies, THooks, false>[] | ((config: TConfig) => IHookDefinition<TDependencies, THooks, false>[])
id: string
init?: ((config: TConfig, dependencies: DependencyValuesType<TDependencies>) => Promise<TValue>)
middleware?: IMiddlewareDefinition<any>[]
overrides?: (
    | IResource<void, any, any>
    | ITask<any, any, {}, null>
    | IMiddleware<any>
    | IResourceWithConfig<any, any, any>)[]
register?: RegisterableItems[] | ((config: TConfig) => RegisterableItems[])
interface IResourceMeta {
    description?: string;
    tags?: string[];
    title?: string;
}

Hierarchy (view full)

Properties

description? +
interface IResourceMeta {
    description?: string;
    tags?: string[];
    title?: string;
}

Hierarchy (view full)

Properties

description?: string
tags?: string[]
title?: string

Interface IResourceWithConfig<TConfig, TValue, TDependencies>

interface IResourceWithConfig<TConfig, TValue, TDependencies> {
    config: TConfig;
    resource: IResource<TConfig, TValue, TDependencies>;
}

Type Parameters

Properties

config +

Interface IResourceWithConfig<TConfig, TValue, TDependencies>

interface IResourceWithConfig<TConfig, TValue, TDependencies> {
    config: TConfig;
    resource: IResource<TConfig, TValue, TDependencies>;
}

Type Parameters

Properties

Properties

config: TConfig

Interface ITask<TInput, TOutput, TDependencies, TEventDefinitionInput>

This is the response after the definition has been prepared. TODO: better naming?

-
interface ITask<TInput, TOutput, TDependencies, TEventDefinitionInput> {
    computedDependencies?: DependencyValuesType<TDependencies>;
    dependencies: TDependencies | (() => TDependencies);
    events: {
        afterRun: IEventDefinition<AfterRunEventPayload<TInput, TOutput>>;
        beforeRun: IEventDefinition<BeforeRunEventPayload<TInput>>;
        onError: IEventDefinition<OnErrorEventPayload>;
    };
    id: string;
    listenerOrder?: number;
    meta?: ITaskMeta;
    middleware: IMiddlewareDefinition<any>[];
    on?: IEventDefinition<TEventDefinitionInput>;
    run: ((input: TEventDefinitionInput extends null
        ? TInput
        : TEventDefinitionInput, dependencies: DependencyValuesType<TDependencies>) => TOutput);
}

Type Parameters

  • TInput = any
  • TOutput extends Promise<any> = any
  • TDependencies extends DependencyMapType = {}
  • TEventDefinitionInput = null

Hierarchy (view full)

Properties

interface ITask<TInput, TOutput, TDependencies, TEventDefinitionInput> {
    computedDependencies?: DependencyValuesType<TDependencies>;
    dependencies: TDependencies | (() => TDependencies);
    events: {
        afterRun: IEventDefinition<AfterRunEventPayload<TInput, TOutput>>;
        beforeRun: IEventDefinition<BeforeRunEventPayload<TInput>>;
        onError: IEventDefinition<OnErrorEventPayload>;
    };
    id: string;
    listenerOrder?: number;
    meta?: ITaskMeta;
    middleware: IMiddlewareDefinition<any>[];
    on?: IEventDefinition<TEventDefinitionInput>;
    run: ((input: TEventDefinitionInput extends null
        ? TInput
        : TEventDefinitionInput, dependencies: DependencyValuesType<TDependencies>) => TOutput);
}

Type Parameters

  • TInput = any
  • TOutput extends Promise<any> = any
  • TDependencies extends DependencyMapType = {}
  • TEventDefinitionInput = null

Hierarchy (view full)

Properties

Properties

computedDependencies?: DependencyValuesType<TDependencies>
dependencies: TDependencies | (() => TDependencies)

These events are automatically populated after the task has been defined.

-
id: string
listenerOrder?: number

This makes sense only when on is specified to provide the order of the execution. +

Properties

computedDependencies?: DependencyValuesType<TDependencies>
dependencies: TDependencies | (() => TDependencies)

These events are automatically populated after the task has been defined.

+
id: string
listenerOrder?: number

This makes sense only when on is specified to provide the order of the execution. The event with the lowest order will be executed first.

-
meta?: ITaskMeta
middleware: IMiddlewareDefinition<any>[]

Listen to events in a simple way

-
run: ((input: TEventDefinitionInput extends null
    ? TInput
    : TEventDefinitionInput, dependencies: DependencyValuesType<TDependencies>) => TOutput)

Interface ITaskDefinition<TInput, TOutput, TDependencies, TEventDefinitionInput>

interface ITaskDefinition<TInput, TOutput, TDependencies, TEventDefinitionInput> {
    dependencies?: TDependencies | (() => TDependencies);
    id: string;
    listenerOrder?: number;
    meta?: ITaskMeta;
    middleware?: IMiddlewareDefinition<any>[];
    on?: IEventDefinition<TEventDefinitionInput>;
    run: ((input: TEventDefinitionInput extends null
        ? TInput
        : TEventDefinitionInput, dependencies: DependencyValuesType<TDependencies>) => TOutput);
}

Type Parameters

  • TInput = any
  • TOutput extends Promise<any> = any
  • TDependencies extends DependencyMapType = {}
  • TEventDefinitionInput = null

Hierarchy (view full)

Properties

dependencies? +

Interface ITaskDefinition<TInput, TOutput, TDependencies, TEventDefinitionInput>

interface ITaskDefinition<TInput, TOutput, TDependencies, TEventDefinitionInput> {
    dependencies?: TDependencies | (() => TDependencies);
    id: string;
    listenerOrder?: number;
    meta?: ITaskMeta;
    middleware?: IMiddlewareDefinition<any>[];
    on?: IEventDefinition<TEventDefinitionInput>;
    run: ((input: TEventDefinitionInput extends null
        ? TInput
        : TEventDefinitionInput, dependencies: DependencyValuesType<TDependencies>) => TOutput);
}

Type Parameters

  • TInput = any
  • TOutput extends Promise<any> = any
  • TDependencies extends DependencyMapType = {}
  • TEventDefinitionInput = null

Hierarchy (view full)

Properties

dependencies?: TDependencies | (() => TDependencies)
id: string
listenerOrder?: number

This makes sense only when on is specified to provide the order of the execution. +

Properties

dependencies?: TDependencies | (() => TDependencies)
id: string
listenerOrder?: number

This makes sense only when on is specified to provide the order of the execution. The event with the lowest order will be executed first.

-
meta?: ITaskMeta
middleware?: IMiddlewareDefinition<any>[]

Listen to events in a simple way

-
run: ((input: TEventDefinitionInput extends null
    ? TInput
    : TEventDefinitionInput, dependencies: DependencyValuesType<TDependencies>) => TOutput)
interface ITaskMeta {
    description?: string;
    tags?: string[];
    title?: string;
}

Hierarchy (view full)

Properties

description? +
interface ITaskMeta {
    description?: string;
    tags?: string[];
    title?: string;
}

Hierarchy (view full)

Properties

description?: string
tags?: string[]
title?: string

Namespace definitions

Index

Interfaces

IEvent +

Namespace definitions

Index

Interfaces

IEvent IEventDefinition IEventMeta IHookDefinition diff --git a/docs/types/definitions.AfterInitEventPayload.html b/docs/types/definitions.AfterInitEventPayload.html index 26cdaeb..7401e30 100644 --- a/docs/types/definitions.AfterInitEventPayload.html +++ b/docs/types/definitions.AfterInitEventPayload.html @@ -156,7 +156,7 @@ --md-sys-color-surface-container-high: #e7e8ea; --md-sys-color-surface-container-highest: #e1e3e4 } -

Type Alias AfterInitEventPayload<TConfig, TValue>

AfterInitEventPayload<TConfig, TValue>: {
    config: TConfig;
    value: TValue;
}

Type Parameters

  • TConfig
  • TValue

Type Alias AfterInitEventPayload<TConfig, TValue>

AfterInitEventPayload<TConfig, TValue>: {
    config: TConfig;
    value: TValue;
}

Type Parameters

  • TConfig
  • TValue

Type Alias AfterRunEventPayload<TInput, TOutput>

AfterRunEventPayload<TInput, TOutput>: {
    input: TInput;
    output: TOutput;
}

Type Parameters

  • TInput
  • TOutput

Type Alias AfterRunEventPayload<TInput, TOutput>

AfterRunEventPayload<TInput, TOutput>: {
    input: TInput;
    output: TOutput;
}

Type Parameters

  • TInput
  • TOutput

Type Alias BeforeInitEventPayload<TConfig>

BeforeInitEventPayload<TConfig>: {
    config: TConfig;
}

Type Parameters

  • TConfig

Type Alias BeforeInitEventPayload<TConfig>

BeforeInitEventPayload<TConfig>: {
    config: TConfig;
}

Type Parameters

  • TConfig

Type Alias BeforeRunEventPayload<TInput>

BeforeRunEventPayload<TInput>: {
    input: TInput;
}

Type Parameters

  • TInput

Type Alias BeforeRunEventPayload<TInput>

BeforeRunEventPayload<TInput>: {
    input: TInput;
}

Type Parameters

  • TInput
DependencyMapType: Record<string,
    | ITask
    | IResource
    | IEventDefinition
    | IResourceWithConfig<any, any>>
DependencyMapType: Record<string,
    | ITask
    | IResource
    | IEventDefinition
    | IResourceWithConfig<any, any>>

Type Alias DependencyValueType<T>

DependencyValueType<T>: T extends ITask<any, any, any>
    ? TaskDependency<ExtractTaskInput<T>, ExtractTaskOutput<T>>
    : T extends IResource<any, any>
        ? ResourceDependency<ExtractResourceValue<T>>
        : T extends IEventDefinition<any>
            ? EventDependency<ExtractEventParams<T>>
            : never

Type Parameters

  • T

Type Alias DependencyValueType<T>

DependencyValueType<T>: T extends ITask<any, any, any>
    ? TaskDependency<ExtractTaskInput<T>, ExtractTaskOutput<T>>
    : T extends IResource<any, any>
        ? ResourceDependency<ExtractResourceValue<T>>
        : T extends IEventDefinition<any>
            ? EventDependency<ExtractEventParams<T>>
            : never

Type Parameters

  • T

Type Alias DependencyValuesType<T>

DependencyValuesType<T>: {
    [K in keyof T]: DependencyValueType<T[K]>
}

Type Parameters

Type Alias DependencyValuesType<T>

DependencyValuesType<T>: {
    [K in keyof T]: DependencyValueType<T[K]>
}

Type Parameters

Type Alias EventHandlerType<T>

EventHandlerType<T>: ((event: IEvent<T>) => any | Promise<any>)

Type Parameters

  • T = any

Type Alias EventHandlerType<T>

EventHandlerType<T>: ((event: IEvent<T>) => any | Promise<any>)

Type Parameters

  • T = any
OnErrorEventPayload: {
    error: any;
    suppress(): void;
}

Type declaration

  • error: any
  • suppress:function
    • This function can be called to suppress the error from being thrown.

      -

      Returns void

RegisterableItems:
    | IResourceWithConfig<any>
    | IResource<any>
    | ITaskDefinition
    | IMiddlewareDefinition
    | IEventDefinition
RegisterableItems:
    | IResourceWithConfig<any>
    | IResource<any>
    | ITaskDefinition
    | IMiddlewareDefinition
    | IEventDefinition
symbols: {
    event: symbol;
    middleware: symbol;
    middlewareGlobal: symbol;
    resource: symbol;
    resourceWithConfig: symbol;
    task: symbol;
} = ...
symbols: {
    event: symbol;
    middleware: symbol;
    middlewareGlobal: symbol;
    resource: symbol;
    resourceWithConfig: symbol;
    task: symbol;
} = ...

Variable globalsConst

globals: {
    events: {
        afterInit: IEventDefinition<any>;
        beforeInit: IEventDefinition<any>;
        log: IEventDefinition<ILog>;
        resources: {
            afterInit: IEventDefinition<{
                config: any;
                resource: IResource<any, any, any>;
                value: any;
            }>;
            beforeInit: IEventDefinition<{
                config: any;
                resource: IResource<any, any, any>;
            }>;
            onError: IEventDefinition<{
                error: Error;
                resource: IResource<any, any, any>;
                suppress: (() => void);
            }>;
        };
        tasks: {
            afterRun: IEventDefinition<{
                input: any;
                output: any;
                task: ITask<any, any, any, null>;
            }>;
            beforeRun: IEventDefinition<{
                input: any;
                task: ITask<any, any, any, null>;
            }>;
            onError: IEventDefinition<{
                error: any;
                suppress: (() => void);
                task: ITask<any, any, any, null>;
            }>;
        };
    };
    resources: {
        eventManager: IResource<EventManager, EventManager, {}>;
        logger: IResource<Logger, Logger, {}>;
        store: IResource<Store, Store, {}>;
        taskRunner: IResource<TaskRunner, TaskRunner, {}>;
    };
} = ...

Variable globalsConst

globals: {
    events: {
        afterInit: IEventDefinition<any>;
        beforeInit: IEventDefinition<any>;
        log: IEventDefinition<ILog>;
        resources: {
            afterInit: IEventDefinition<{
                config: any;
                resource: IResource<any, any, any>;
                value: any;
            }>;
            beforeInit: IEventDefinition<{
                config: any;
                resource: IResource<any, any, any>;
            }>;
            onError: IEventDefinition<{
                error: Error;
                resource: IResource<any, any, any>;
                suppress: (() => void);
            }>;
        };
        tasks: {
            afterRun: IEventDefinition<{
                input: any;
                output: any;
                task: ITask<any, any, any, null>;
            }>;
            beforeRun: IEventDefinition<{
                input: any;
                task: ITask<any, any, any, null>;
            }>;
            onError: IEventDefinition<{
                error: any;
                suppress: (() => void);
                task: ITask<any, any, any, null>;
            }>;
        };
    };
    resources: {
        eventManager: IResource<EventManager, EventManager, {}>;
        logger: IResource<Logger, Logger, {}>;
        store: IResource<Store, Store, {}>;
        taskRunner: IResource<TaskRunner, TaskRunner, {}>;
    };
} = ...