index.ts — astro Source File
Architecture documentation for index.ts, a typescript file in the astro codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR ebb28c2e_30ab_5383_9ab7_66fe5053f766["index.ts"] f92f4288_d2a3_264d_4379_34b9b9c2c7f4["astro:db"] ebb28c2e_30ab_5383_9ab7_66fe5053f766 --> f92f4288_d2a3_264d_4379_34b9b9c2c7f4 58a2600d_f5df_9651_e0d8_9010ddeef24d["astro:actions"] ebb28c2e_30ab_5383_9ab7_66fe5053f766 --> 58a2600d_f5df_9651_e0d8_9010ddeef24d 0f49b6f2_8b44_baf8_7812_a8fa2dd0ca84["zod"] ebb28c2e_30ab_5383_9ab7_66fe5053f766 --> 0f49b6f2_8b44_baf8_7812_a8fa2dd0ca84 3189c52a_a4b4_0d79_f730_dd7c1d087bfc["actions"] ebb28c2e_30ab_5383_9ab7_66fe5053f766 --> 3189c52a_a4b4_0d79_f730_dd7c1d087bfc style ebb28c2e_30ab_5383_9ab7_66fe5053f766 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { db, Likes, eq, sql } from 'astro:db';
import { defineAction, type SafeResult } from 'astro:actions';
import { z } from 'astro/zod';
import { getActionState } from '@astrojs/react/actions';
export const server = {
blog: {
like: defineAction({
accept: 'form',
input: z.object({ postId: z.string() }),
handler: async ({ postId }) => {
await new Promise((r) => setTimeout(r, 1000));
const { likes } = await db
.update(Likes)
.set({
likes: sql`likes + 1`,
})
.where(eq(Likes.postId, postId))
.returning()
.get();
return likes;
},
}),
likeWithActionState: defineAction({
accept: 'form',
input: z.object({ postId: z.string() }),
handler: async ({ postId }, ctx) => {
await new Promise((r) => setTimeout(r, 200));
const state = await getActionState<SafeResult<any, number>>(ctx);
const previousLikes = state.data ?? 0;
const { likes } = await db
.update(Likes)
.set({
likes: previousLikes + 1,
})
.where(eq(Likes.postId, postId))
.returning()
.get();
return likes;
},
}),
},
};
Dependencies
- actions
- astro:actions
- astro:db
- zod
Source
Frequently Asked Questions
What does index.ts do?
index.ts is a source file in the astro codebase, written in typescript.
What does index.ts depend on?
index.ts imports 4 module(s): actions, astro:actions, astro:db, zod.
Where is index.ts in the architecture?
index.ts is located at packages/astro/e2e/fixtures/actions-react-19/src/actions/index.ts (directory: packages/astro/e2e/fixtures/actions-react-19/src/actions).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free