full site update
This commit is contained in:
32
node_modules/astro/dist/actions/runtime/virtual/server.d.ts
generated
vendored
32
node_modules/astro/dist/actions/runtime/virtual/server.d.ts
generated
vendored
@@ -1,6 +1,7 @@
|
||||
import { z } from 'zod';
|
||||
import type { APIContext } from '../../../types/public/index.js';
|
||||
import { type ActionAPIContext, type ErrorInferenceObject, type MaybePromise } from '../utils.js';
|
||||
import { type SafeResult } from './shared.js';
|
||||
import { deserializeActionResult, type SafeResult, type SerializedActionResult, serializeActionResult } from './shared.js';
|
||||
export * from './shared.js';
|
||||
export type ActionAccept = 'form' | 'json';
|
||||
export type ActionHandler<TInputSchema, TOutput> = TInputSchema extends z.ZodType ? (input: z.infer<TInputSchema>, context: ActionAPIContext) => MaybePromise<TOutput> : (input: any, context: ActionAPIContext) => MaybePromise<TOutput>;
|
||||
@@ -18,3 +19,32 @@ export declare function defineAction<TOutput, TAccept extends ActionAccept | und
|
||||
}): ActionClient<TOutput, TAccept, TInputSchema> & string;
|
||||
/** Transform form data to an object based on a Zod schema. */
|
||||
export declare function formDataToObject<T extends z.AnyZodObject>(formData: FormData, schema: T): Record<string, unknown>;
|
||||
export type AstroActionContext = {
|
||||
/** Information about an incoming action request. */
|
||||
action?: {
|
||||
/** Whether an action was called using an RPC function or by using an HTML form action. */
|
||||
calledFrom: 'rpc' | 'form';
|
||||
/** The name of the action. Useful to track the source of an action result during a redirect. */
|
||||
name: string;
|
||||
/** Programmatically call the action to get the result. */
|
||||
handler: () => Promise<SafeResult<any, any>>;
|
||||
};
|
||||
/**
|
||||
* Manually set the action result accessed via `getActionResult()`.
|
||||
* Calling this function from middleware will disable Astro's own action result handling.
|
||||
*/
|
||||
setActionResult(actionName: string, actionResult: SerializedActionResult): void;
|
||||
/**
|
||||
* Serialize an action result to stored in a cookie or session.
|
||||
* Also used to pass a result to Astro templates via `setActionResult()`.
|
||||
*/
|
||||
serializeActionResult: typeof serializeActionResult;
|
||||
/**
|
||||
* Deserialize an action result to access data and error objects.
|
||||
*/
|
||||
deserializeActionResult: typeof deserializeActionResult;
|
||||
};
|
||||
/**
|
||||
* Access information about Action requests from middleware.
|
||||
*/
|
||||
export declare function getActionContext(context: APIContext): AstroActionContext;
|
||||
|
Reference in New Issue
Block a user