Constructors

Properties

#interval: undefined | Timeout
#invocationHandles: Map<string, InvocationHandle<any>>
#registeredFunctions: Record<string, Record<number, {
    func: Func;
    opts: Options;
}>> = {}
#resources: Map<string, any>
defaultInvocationOptions: Options
logger: ILogger
store: IStore

Accessors

Methods

  • Retrieves a resource by name from the Resonate instance.

    Type Parameters

    • R

      The expected type of the resource.

    Parameters

    • name: string

      The unique string identifier of the resource to retrieve.

    Returns undefined | R

    The resource of type R if found, or undefined if not found.

    Remarks

    The method uses type assertion to cast the resource to type R. Ensure that the type parameter R matches the actual type of the stored resource to avoid runtime type errors.

  • Type Parameters

    • R

    Parameters

    • name: string
    • id: string
    • Rest ...argsWithOverrides: any[]

    Returns Promise<R>

  • Schedule a resonate function.

    Type Parameters

    Parameters

    • name: string

      The schedule name.

    • cron: string

      The schedule cron expression.

    • func: F

      The function to schedule.

    • Rest ...args: [...Params<F>[], PartialOptions?]

      The function arguments.

    Returns Promise<Schedule>

    The schedule object.

  • Schedule a resonate function that is already registered.

    Parameters

    • name: string

      The schedule name.

    • cron: string

      The schedule cron expression.

    • func: string

      The registered function name.

    • Rest ...args: any[]

      The function arguments.

    Returns Promise<Schedule>

    The schedule object.

  • Sets a global named resource for the Resonate instace. This resource will be available in all the children Contexts of the current top level execution.

    Caller is responsible of the life cycle of the resource.

    Parameters

    • name: string

      A unique string identifier for the resource.

    • resource: any

      The resource to be stored. Can be of any type.

    Returns void

    Throws

    Throws an error if a resource with the same name already exists in the current Resonate instace.

  • Start the resonate service which continually checks for pending promises every delay ms.

    Parameters

    • delay: number = 5000

      Frequency in ms to check for pending promises.

    Returns Promise<void>

  • Stop the resonate service.

    Returns Promise<void>