index.ts — astro Source File
Architecture documentation for index.ts, a typescript file in the astro codebase. 2 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 6a679d4b_630e_f633_6afc_2156b3582adf["index.ts"] d44bf569_36b0_df5d_cf6a_ab8eca8d428d["astro:actions"] 6a679d4b_630e_f633_6afc_2156b3582adf --> d44bf569_36b0_df5d_cf6a_ab8eca8d428d 82c23b20_84b3_3038_cd30_be2e0f2ef654["zod"] 6a679d4b_630e_f633_6afc_2156b3582adf --> 82c23b20_84b3_3038_cd30_be2e0f2ef654 style 6a679d4b_630e_f633_6afc_2156b3582adf fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { defineAction, ActionError } from 'astro:actions';
import { z } from 'astro/zod';
const passwordSchema = z
.string()
.min(8, 'Password should be at least 8 chars length')
.max(128, 'Password length exceeded. Max 128 chars.');
export const server = {
imageUploadInChunks: defineAction({
accept: 'form',
input: z.discriminatedUnion('type', [
z.object({
type: z.literal('first-chunk'),
image: z.instanceof(File),
alt: z.string(),
}),
z.object({ type: z.literal('rest-chunk'), image: z.instanceof(File), uploadId: z.string() }),
]),
handler: async (data) => {
if (data.type === 'first-chunk') {
const uploadId = Math.random().toString(36).slice(2);
return {
uploadId,
};
} else {
return {
uploadId: data.uploadId,
};
}
},
}),
subscribe: defineAction({
input: z.object({ channel: z.string() }),
handler: async ({ channel }) => {
return {
channel,
subscribeButtonState: 'smashed',
};
},
}),
subscribeFromServer: defineAction({
input: z.object({ channel: z.string() }),
handler: async ({ channel }, { url }) => {
return {
// Returned to ensure path rewrites are respected
url: url.pathname,
channel,
subscribeButtonState: 'smashed',
};
},
}),
comment: defineAction({
accept: 'form',
input: z.object({ channel: z.string(), comment: z.string() }),
handler: async ({ channel, comment }) => {
return {
channel,
comment,
};
// ... (134 more lines)
Dependencies
- astro:actions
- 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 2 module(s): astro:actions, zod.
Where is index.ts in the architecture?
index.ts is located at packages/astro/test/fixtures/actions/src/actions/index.ts (directory: packages/astro/test/fixtures/actions/src/actions).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free