UNPKG

@kellanjs/actioncraft

Version:

Fluent, type-safe builder for Next.js server actions.

17 lines (16 loc) 1.44 kB
import type { Config, Schemas, Errors } from "../../types/builder.js"; import type { AllPossibleErrors } from "../../types/errors.js"; import type { Result } from "../../types/result.js"; import type { InferValidatedInput, InferRawInput, InferValidatedBindArgs, InferRawBindArgs } from "../../types/schemas.js"; /** * Validate input using the configured input schema. */ export declare function validateInput<TConfig extends Config, TSchemas extends Schemas, TErrors extends Errors>(schemas: TSchemas, config: TConfig, rawInput: InferRawInput<TSchemas> | undefined, actionId: string, actionName?: string): Promise<Result<InferValidatedInput<TSchemas>, AllPossibleErrors<TErrors, TConfig, TSchemas>>>; /** * Validate bound arguments using configured bind schemas. */ export declare function validateBindArgs<TConfig extends Config, TSchemas extends Schemas, TErrors extends Errors>(schemas: TSchemas, config: TConfig, bindArgs: InferRawBindArgs<TSchemas>, actionId: string, actionName?: string): Promise<Result<InferValidatedBindArgs<TSchemas>, AllPossibleErrors<TErrors, TConfig, TSchemas>>>; /** * Validate action output using configured output schema. */ export declare function validateOutput<TConfig extends Config, TSchemas extends Schemas, TErrors extends Errors, TData>(schemas: TSchemas, config: TConfig, data: TData, actionId: string, actionName?: string): Promise<Result<TData, AllPossibleErrors<TErrors, TConfig, TSchemas>>>;