call-action.ts — astro Source File
Architecture documentation for call-action.ts, a typescript file in the astro codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR bf3e06e5_07ad_4a16_a0c0_261ab67d5a62["call-action.ts"] e6a2dc9f_6948_1e06_e648_bf517c8e5501["../../../dist/actions/runtime/server.js"] bf3e06e5_07ad_4a16_a0c0_261ab67d5a62 --> e6a2dc9f_6948_1e06_e648_bf517c8e5501 b452f73b_f98f_aa44_9234_6b4bf8f5bf18["../../dist/actions/runtime/types.js"] bf3e06e5_07ad_4a16_a0c0_261ab67d5a62 --> b452f73b_f98f_aa44_9234_6b4bf8f5bf18 28d85421_ad3d_44ba_f564_0d2e1297a535["../../dist/types/public/context.js"] bf3e06e5_07ad_4a16_a0c0_261ab67d5a62 --> 28d85421_ad3d_44ba_f564_0d2e1297a535 c6e6d952_1368_2c1c_2f3a_ad92a305600b["../../dist/zod.js"] bf3e06e5_07ad_4a16_a0c0_261ab67d5a62 --> c6e6d952_1368_2c1c_2f3a_ad92a305600b 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] bf3e06e5_07ad_4a16_a0c0_261ab67d5a62 --> 6b0635f9_51ea_77aa_767b_7857878e98a6 687364c6_0b6b_44e7_012a_aa483da82c1b["expect-type"] bf3e06e5_07ad_4a16_a0c0_261ab67d5a62 --> 687364c6_0b6b_44e7_012a_aa483da82c1b style bf3e06e5_07ad_4a16_a0c0_261ab67d5a62 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { describe, it } from 'node:test';
import { expectTypeOf } from 'expect-type';
import { defineAction } from '../../dist/actions/runtime/server.js';
import type { ActionReturnType } from '../../dist/actions/runtime/types.js';
import type { APIContext } from '../../dist/types/public/context.js';
import { z } from '../../dist/zod.js';
describe('Astro.callAction', () => {
it('Infers JSON action result on callAction', async () => {
const context: APIContext = {} as any;
const action = defineAction({
input: z.object({
name: z.string(),
}),
handler: async ({ name }) => {
return { name };
},
});
expectTypeOf(await context.callAction(action, { name: 'Ben' })).toEqualTypeOf<
ActionReturnType<typeof action>
>();
});
it('Infers form action result on callAction', async () => {
const context: APIContext = {} as any;
const action = defineAction({
accept: 'form',
input: z.object({
name: z.string(),
}),
handler: async ({ name }) => {
return { name };
},
});
expectTypeOf(await context.callAction(action, new FormData())).toEqualTypeOf<
ActionReturnType<typeof action>
>();
});
it('Infers orThrow action result on callAction', async () => {
const context: APIContext = {} as any;
const action = defineAction({
accept: 'form',
input: z.object({
name: z.string(),
}),
handler: async ({ name }) => {
return { name };
},
});
expectTypeOf(await context.callAction(action.orThrow, new FormData())).toEqualTypeOf<
ActionReturnType<(typeof action)['orThrow']>
>();
});
});
Domain
Dependencies
- ../../../dist/actions/runtime/server.js
- ../../dist/actions/runtime/types.js
- ../../dist/types/public/context.js
- ../../dist/zod.js
- expect-type
- node:test
Source
Frequently Asked Questions
What does call-action.ts do?
call-action.ts is a source file in the astro codebase, written in typescript. It belongs to the IntegrationAdapters domain.
What does call-action.ts depend on?
call-action.ts imports 6 module(s): ../../../dist/actions/runtime/server.js, ../../dist/actions/runtime/types.js, ../../dist/types/public/context.js, ../../dist/zod.js, expect-type, node:test.
Where is call-action.ts in the architecture?
call-action.ts is located at packages/astro/test/types/call-action.ts (domain: IntegrationAdapters, directory: packages/astro/test/types).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free