@kellanjs/actioncraft
Version:
Fluent, type-safe builder for Next.js server actions.
17 lines (16 loc) • 1.45 kB
TypeScript
import type { CrafterConfig, CrafterSchemas, CrafterErrors } from "../types/crafter.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 CrafterConfig, TSchemas extends CrafterSchemas, TErrors extends CrafterErrors>(schemas: TSchemas, config: TConfig, rawInput: InferRawInput<TSchemas> | undefined, actionId: string): Promise<Result<InferValidatedInput<TSchemas>, AllPossibleErrors<TErrors, TConfig, TSchemas>>>;
/**
* Validate bound arguments using configured bind schemas.
*/
export declare function validateBindArgs<TConfig extends CrafterConfig, TSchemas extends CrafterSchemas, TErrors extends CrafterErrors>(schemas: TSchemas, config: TConfig, bindArgs: InferRawBindArgs<TSchemas>, actionId: string): Promise<Result<InferValidatedBindArgs<TSchemas>, AllPossibleErrors<TErrors, TConfig, TSchemas>>>;
/**
* Validate action output using configured output schema.
*/
export declare function validateOutput<TConfig extends CrafterConfig, TSchemas extends CrafterSchemas, TErrors extends CrafterErrors, TData>(schemas: TSchemas, config: TConfig, data: TData, actionId: string): Promise<Result<TData, AllPossibleErrors<TErrors, TConfig, TSchemas>>>;