Home / File/ server.ts — astro Source File

server.ts — astro Source File

Architecture documentation for server.ts, a typescript file in the astro codebase. 6 imports, 0 dependents.

File typescript CoreAstro RenderingEngine 6 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  8e22779a_aadb_b425_7cff_7b649ae85e50["server.ts"]
  be18ffb8_46cb_5266_8b78_659c01f80146["../core/base-pipeline.js"]
  8e22779a_aadb_b425_7cff_7b649ae85e50 --> be18ffb8_46cb_5266_8b78_659c01f80146
  7216d952_4e4a_2d18_a85b_74b4ace79e2b["../core/constants.js"]
  8e22779a_aadb_b425_7cff_7b649ae85e50 --> 7216d952_4e4a_2d18_a85b_74b4ace79e2b
  8df634da_0f30_1e1f_1314_2439b0c9baab["../core/errors/errors-data.js"]
  8e22779a_aadb_b425_7cff_7b649ae85e50 --> 8df634da_0f30_1e1f_1314_2439b0c9baab
  dd6187d6_53c4_ce90_a1d1_3a0b5e7e7d3f["../../core/errors/errors.js"]
  8e22779a_aadb_b425_7cff_7b649ae85e50 --> dd6187d6_53c4_ce90_a1d1_3a0b5e7e7d3f
  b0bf0fd2_1ce5_745d_58fc_02deee5192bf["../actions/runtime/client.js"]
  8e22779a_aadb_b425_7cff_7b649ae85e50 --> b0bf0fd2_1ce5_745d_58fc_02deee5192bf
  2286831f_6846_d12f_ee48_bb914b8174cc["options"]
  8e22779a_aadb_b425_7cff_7b649ae85e50 --> 2286831f_6846_d12f_ee48_bb914b8174cc
  style 8e22779a_aadb_b425_7cff_7b649ae85e50 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { Pipeline } from '../../../core/base-pipeline.js';
import { pipelineSymbol } from '../../../core/constants.js';
import { ActionCalledFromServerError } from '../../../core/errors/errors-data.js';
import { AstroError } from '../../../core/errors/errors.js';
import { createGetActionPath, createActionsProxy } from '../client.js';
import { shouldAppendTrailingSlash } from 'virtual:astro:actions/options';

export { ACTION_QUERY_PARAMS } from '../../consts.js';
export { ActionError, isActionError, isInputError } from '../client.js';
export { defineAction, getActionContext } from '../server.js';
export type {
	ActionAPIContext,
	ActionClient,
	ActionErrorCode,
	ActionInputSchema,
	ActionReturnType,
	SafeResult,
} from '../types.js';

export const getActionPath = createGetActionPath({
	baseUrl: import.meta.env.BASE_URL,
	shouldAppendTrailingSlash,
});

export const actions = createActionsProxy({
	handleAction: async (param, path, context) => {
		const pipeline: Pipeline | undefined = context
			? Reflect.get(context, pipelineSymbol)
			: undefined;
		if (!pipeline) {
			throw new AstroError(ActionCalledFromServerError);
		}
		const action = await pipeline.getAction(path);
		if (!action) throw new Error(`Action not found: ${path}`);
		return action.bind(context)(param);
	},
});

Domain

Subdomains

Dependencies

  • ../../core/errors/errors.js
  • ../actions/runtime/client.js
  • ../core/base-pipeline.js
  • ../core/constants.js
  • ../core/errors/errors-data.js
  • options

Frequently Asked Questions

What does server.ts do?
server.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in server.ts?
server.ts defines 1 function(s): actions.handleAction.
What does server.ts depend on?
server.ts imports 6 module(s): ../../core/errors/errors.js, ../actions/runtime/client.js, ../core/base-pipeline.js, ../core/constants.js, ../core/errors/errors-data.js, options.
Where is server.ts in the architecture?
server.ts is located at packages/astro/src/actions/runtime/entrypoints/server.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/actions/runtime/entrypoints).

Analyze Your Own Codebase

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

Try Supermodel Free