Home / Type/ AstroActionContext Type — astro Architecture

AstroActionContext Type — astro Architecture

Architecture documentation for the AstroActionContext type/interface in server.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  e1f23583_87d3_4d49_5ccb_b6e549033e02["AstroActionContext"]
  12df90c3_b0fe_d858_b821_5011b6067fdb["server.ts"]
  e1f23583_87d3_4d49_5ccb_b6e549033e02 -->|defined in| 12df90c3_b0fe_d858_b821_5011b6067fdb
  style e1f23583_87d3_4d49_5ccb_b6e549033e02 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/actions/runtime/server.ts lines 128–152

interface 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;
}

Frequently Asked Questions

What is the AstroActionContext type?
AstroActionContext is a type/interface in the astro codebase, defined in packages/astro/src/actions/runtime/server.ts.
Where is AstroActionContext defined?
AstroActionContext is defined in packages/astro/src/actions/runtime/server.ts at line 128.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free