Interface IComputeSchema<T>

IComputeSchema

Defines the schema for a compute, including its configuration and dependencies.

interface IComputeSchema<T extends IComputeData = IComputeData> {
    callbacks?: Partial<IComputeCallbacks<T>>;
    computeName: string;
    dependsOn?: string[];
    docDescription?: string;
    getComputeData: (clientId: string, computeName: string) => T | Promise<T>;
    middlewares?: IComputeMiddleware<T>[];
    shared?: boolean;
    ttl?: number;
}

Type Parameters

  • T extends IComputeData = IComputeData

    Type extending IComputeData.

Properties

callbacks?: Partial<IComputeCallbacks<T>>

Optional callbacks for compute lifecycle events.

computeName: string

The name of the compute.

dependsOn?: string[]

Array of state names the compute depends on.

docDescription?: string

Optional description for documentation purposes.

getComputeData: (clientId: string, computeName: string) => T | Promise<T>

Type declaration

    • (clientId: string, computeName: string): T | Promise<T>
    • Parameters

      • clientId: string

        The client identifier.

      • computeName: string

        The name of the compute.

      Returns T | Promise<T>

      The computed data or a promise resolving to it.

Function to retrieve or compute the data.

middlewares?: IComputeMiddleware<T>[]

Array of middleware functions to process compute data.

shared?: boolean

Indicates if the compute is shared across clients.

ttl?: number

Time-to-live for the compute data, in milliseconds.