Home / Function/ parseLiveEntry() — astro Function Reference

parseLiveEntry() — astro Function Reference

Architecture documentation for the parseLiveEntry() function in runtime.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  45b9cc16_8326_90a1_a556_3b8ba93f389c["parseLiveEntry()"]
  73d13646_8e80_972f_3adc_f28448b64e4d["runtime.ts"]
  45b9cc16_8326_90a1_a556_3b8ba93f389c -->|defined in| 73d13646_8e80_972f_3adc_f28448b64e4d
  fe4700a6_7c11_badc_8458_a816113467e1["createGetLiveCollection()"]
  fe4700a6_7c11_badc_8458_a816113467e1 -->|calls| 45b9cc16_8326_90a1_a556_3b8ba93f389c
  8a71210b_d179_6942_4f98_1fa03aecbe8f["createGetLiveEntry()"]
  8a71210b_d179_6942_4f98_1fa03aecbe8f -->|calls| 45b9cc16_8326_90a1_a556_3b8ba93f389c
  style 45b9cc16_8326_90a1_a556_3b8ba93f389c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/content/runtime.ts lines 54–91

async function parseLiveEntry(
	entry: LiveDataEntry,
	schema: zCore.$ZodType,
	collection: string,
): Promise<{ entry?: LiveDataEntry; error?: LiveCollectionError }> {
	try {
		const parsed = await z.safeParseAsync(schema, entry.data);
		if (!parsed.success) {
			return {
				error: new LiveCollectionValidationError(collection, entry.id, parsed.error),
			};
		}
		if (entry.cacheHint) {
			const cacheHint = cacheHintSchema.safeParse(entry.cacheHint);

			if (!cacheHint.success) {
				return {
					error: new LiveCollectionCacheHintError(collection, entry.id, cacheHint.error),
				};
			}
			entry.cacheHint = cacheHint.data;
		}
		return {
			entry: {
				...entry,
				data: parsed.data as Record<string, unknown>,
			},
		};
	} catch (error) {
		return {
			error: new LiveCollectionError(
				collection,
				`Unexpected error parsing entry ${entry.id} in collection ${collection}`,
				error as Error,
			),
		};
	}
}

Subdomains

Frequently Asked Questions

What does parseLiveEntry() do?
parseLiveEntry() is a function in the astro codebase, defined in packages/astro/src/content/runtime.ts.
Where is parseLiveEntry() defined?
parseLiveEntry() is defined in packages/astro/src/content/runtime.ts at line 54.
What calls parseLiveEntry()?
parseLiveEntry() is called by 2 function(s): createGetLiveCollection, createGetLiveEntry.

Analyze Your Own Codebase

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

Try Supermodel Free