Move to Astro
This commit is contained in:
204
.astro/types.d.ts
vendored
Normal file
204
.astro/types.d.ts
vendored
Normal file
@@ -0,0 +1,204 @@
|
||||
declare module 'astro:content' {
|
||||
export { z } from 'astro/zod';
|
||||
export type CollectionEntry<C extends keyof typeof entryMap> =
|
||||
(typeof entryMap)[C][keyof (typeof entryMap)[C]] & Render;
|
||||
|
||||
type BaseSchemaWithoutEffects =
|
||||
| import('astro/zod').AnyZodObject
|
||||
| import('astro/zod').ZodUnion<import('astro/zod').AnyZodObject[]>
|
||||
| import('astro/zod').ZodDiscriminatedUnion<string, import('astro/zod').AnyZodObject[]>
|
||||
| import('astro/zod').ZodIntersection<
|
||||
import('astro/zod').AnyZodObject,
|
||||
import('astro/zod').AnyZodObject
|
||||
>;
|
||||
|
||||
type BaseSchema =
|
||||
| BaseSchemaWithoutEffects
|
||||
| import('astro/zod').ZodEffects<BaseSchemaWithoutEffects>;
|
||||
|
||||
type BaseCollectionConfig<S extends BaseSchema> = {
|
||||
schema?: S;
|
||||
slug?: (entry: {
|
||||
id: CollectionEntry<keyof typeof entryMap>['id'];
|
||||
defaultSlug: string;
|
||||
collection: string;
|
||||
body: string;
|
||||
data: import('astro/zod').infer<S>;
|
||||
}) => string | Promise<string>;
|
||||
};
|
||||
export function defineCollection<S extends BaseSchema>(
|
||||
input: BaseCollectionConfig<S>
|
||||
): BaseCollectionConfig<S>;
|
||||
|
||||
type EntryMapKeys = keyof typeof entryMap;
|
||||
type AllValuesOf<T> = T extends any ? T[keyof T] : never;
|
||||
type ValidEntrySlug<C extends EntryMapKeys> = AllValuesOf<(typeof entryMap)[C]>['slug'];
|
||||
|
||||
export function getEntryBySlug<
|
||||
C extends keyof typeof entryMap,
|
||||
E extends ValidEntrySlug<C> | (string & {})
|
||||
>(
|
||||
collection: C,
|
||||
// Note that this has to accept a regular string too, for SSR
|
||||
entrySlug: E
|
||||
): E extends ValidEntrySlug<C>
|
||||
? Promise<CollectionEntry<C>>
|
||||
: Promise<CollectionEntry<C> | undefined>;
|
||||
export function getCollection<C extends keyof typeof entryMap, E extends CollectionEntry<C>>(
|
||||
collection: C,
|
||||
filter?: (entry: CollectionEntry<C>) => entry is E
|
||||
): Promise<E[]>;
|
||||
|
||||
type InferEntrySchema<C extends keyof typeof entryMap> = import('astro/zod').infer<
|
||||
Required<ContentConfig['collections'][C]>['schema']
|
||||
>;
|
||||
|
||||
type Render = {
|
||||
render(): Promise<{
|
||||
Content: import('astro').MarkdownInstance<{}>['Content'];
|
||||
headings: import('astro').MarkdownHeading[];
|
||||
remarkPluginFrontmatter: Record<string, any>;
|
||||
}>;
|
||||
};
|
||||
|
||||
const entryMap: {
|
||||
"blog": {
|
||||
"summer.mdx": {
|
||||
id: "summer.mdx",
|
||||
slug: "summer",
|
||||
body: string,
|
||||
collection: "blog",
|
||||
data: InferEntrySchema<"blog">
|
||||
},
|
||||
"week1.mdx": {
|
||||
id: "week1.mdx",
|
||||
slug: "week1",
|
||||
body: string,
|
||||
collection: "blog",
|
||||
data: InferEntrySchema<"blog">
|
||||
},
|
||||
"week2.mdx": {
|
||||
id: "week2.mdx",
|
||||
slug: "week2",
|
||||
body: string,
|
||||
collection: "blog",
|
||||
data: InferEntrySchema<"blog">
|
||||
},
|
||||
"week3.mdx": {
|
||||
id: "week3.mdx",
|
||||
slug: "week3",
|
||||
body: string,
|
||||
collection: "blog",
|
||||
data: InferEntrySchema<"blog">
|
||||
},
|
||||
"week4.mdx": {
|
||||
id: "week4.mdx",
|
||||
slug: "week4",
|
||||
body: string,
|
||||
collection: "blog",
|
||||
data: InferEntrySchema<"blog">
|
||||
},
|
||||
"week5-6.mdx": {
|
||||
id: "week5-6.mdx",
|
||||
slug: "week5-6",
|
||||
body: string,
|
||||
collection: "blog",
|
||||
data: InferEntrySchema<"blog">
|
||||
},
|
||||
"week7-8.mdx": {
|
||||
id: "week7-8.mdx",
|
||||
slug: "week7-8",
|
||||
body: string,
|
||||
collection: "blog",
|
||||
data: InferEntrySchema<"blog">
|
||||
},
|
||||
"week9-10.mdx": {
|
||||
id: "week9-10.mdx",
|
||||
slug: "week9-10",
|
||||
body: string,
|
||||
collection: "blog",
|
||||
data: InferEntrySchema<"blog">
|
||||
},
|
||||
"work1.mdx": {
|
||||
id: "work1.mdx",
|
||||
slug: "work1",
|
||||
body: string,
|
||||
collection: "blog",
|
||||
data: InferEntrySchema<"blog">
|
||||
},
|
||||
"work2.mdx": {
|
||||
id: "work2.mdx",
|
||||
slug: "work2",
|
||||
body: string,
|
||||
collection: "blog",
|
||||
data: InferEntrySchema<"blog">
|
||||
},
|
||||
"work3.mdx": {
|
||||
id: "work3.mdx",
|
||||
slug: "work3",
|
||||
body: string,
|
||||
collection: "blog",
|
||||
data: InferEntrySchema<"blog">
|
||||
},
|
||||
"work4.mdx": {
|
||||
id: "work4.mdx",
|
||||
slug: "work4",
|
||||
body: string,
|
||||
collection: "blog",
|
||||
data: InferEntrySchema<"blog">
|
||||
},
|
||||
"work5.mdx": {
|
||||
id: "work5.mdx",
|
||||
slug: "work5",
|
||||
body: string,
|
||||
collection: "blog",
|
||||
data: InferEntrySchema<"blog">
|
||||
},
|
||||
"work6.mdx": {
|
||||
id: "work6.mdx",
|
||||
slug: "work6",
|
||||
body: string,
|
||||
collection: "blog",
|
||||
data: InferEntrySchema<"blog">
|
||||
},
|
||||
"year2022-1.mdx": {
|
||||
id: "year2022-1.mdx",
|
||||
slug: "year2022-1",
|
||||
body: string,
|
||||
collection: "blog",
|
||||
data: InferEntrySchema<"blog">
|
||||
},
|
||||
"year2022-end.mdx": {
|
||||
id: "year2022-end.mdx",
|
||||
slug: "year2022-end",
|
||||
body: string,
|
||||
collection: "blog",
|
||||
data: InferEntrySchema<"blog">
|
||||
},
|
||||
"year2022-w1.mdx": {
|
||||
id: "year2022-w1.mdx",
|
||||
slug: "year2022-w1",
|
||||
body: string,
|
||||
collection: "blog",
|
||||
data: InferEntrySchema<"blog">
|
||||
},
|
||||
"year2022-w2.mdx": {
|
||||
id: "year2022-w2.mdx",
|
||||
slug: "year2022-w2",
|
||||
body: string,
|
||||
collection: "blog",
|
||||
data: InferEntrySchema<"blog">
|
||||
},
|
||||
"year2022-w3.mdx": {
|
||||
id: "year2022-w3.mdx",
|
||||
slug: "year2022-w3",
|
||||
body: string,
|
||||
collection: "blog",
|
||||
data: InferEntrySchema<"blog">
|
||||
},
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
type ContentConfig = typeof import("../src/content/config");
|
||||
}
|
||||
Reference in New Issue
Block a user