@swastikbhattacharyya/next-actions - v0.3.2
    Preparing search index...

    Class Action<InputSchema, Output, Context, ErrorMap>

    A composable, type-safe action builder for creating a validation and execution pipeline.

    This class enables step-by-step construction of an action by chaining validators and attaching a final action function. Each validator can inject some context or halt execution with an error. The final action executes only if all validators pass.

    Type Parameters

    • InputSchema extends $ZodType

      A Zod schema representing the shape of the action input.

    • Output extends void | object

      The payload returned on success.

    • Context extends object

      The accumulated context passed through the pipeline.

    • ErrorMap extends object

      A map where each key is an error code, and the corresponding value is the payload associated with that specific error.

    Index

    Constructors

    Methods

    • Defines the Zod schema for the action's input.

      This schema is not enforced automatically. To perform validation, use a validator like zodValidator.

      Type Parameters

      • Schema extends $ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>

      Parameters

      • schema: Schema

        The Zod schema to associate with the action.

      Returns Action<Schema, Output, Context & { inputSchema: Schema }, ErrorMap>

      Same instance with updated schema context.