Skip to content

Commit 365c04d

Browse files
authored
trying to update
1 parent 52119db commit 365c04d

File tree

11 files changed

+464
-18
lines changed

11 files changed

+464
-18
lines changed
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
{
2+
"$ref": "#/definitions/posts",
3+
"definitions": {
4+
"posts": {
5+
"type": "object",
6+
"properties": {
7+
"title": {
8+
"type": "string"
9+
},
10+
"published": {
11+
"anyOf": [
12+
{
13+
"type": "string",
14+
"format": "date-time"
15+
},
16+
{
17+
"type": "string",
18+
"format": "date"
19+
},
20+
{
21+
"type": "integer",
22+
"format": "unix-time"
23+
}
24+
]
25+
},
26+
"updated": {
27+
"anyOf": [
28+
{
29+
"type": "string",
30+
"format": "date-time"
31+
},
32+
{
33+
"type": "string",
34+
"format": "date"
35+
},
36+
{
37+
"type": "integer",
38+
"format": "unix-time"
39+
}
40+
]
41+
},
42+
"draft": {
43+
"type": "boolean",
44+
"default": false
45+
},
46+
"description": {
47+
"type": "string",
48+
"default": ""
49+
},
50+
"image": {
51+
"type": "string",
52+
"default": ""
53+
},
54+
"tags": {
55+
"type": "array",
56+
"items": {
57+
"type": "string"
58+
},
59+
"default": []
60+
},
61+
"category": {
62+
"anyOf": [
63+
{
64+
"anyOf": [
65+
{
66+
"not": {}
67+
},
68+
{
69+
"type": "string"
70+
}
71+
]
72+
},
73+
{
74+
"type": "null"
75+
}
76+
],
77+
"default": ""
78+
},
79+
"lang": {
80+
"type": "string",
81+
"default": ""
82+
},
83+
"pinned": {
84+
"type": "boolean",
85+
"default": false
86+
},
87+
"author": {
88+
"type": "string",
89+
"default": ""
90+
},
91+
"sourceLink": {
92+
"type": "string",
93+
"default": ""
94+
},
95+
"licenseName": {
96+
"type": "string",
97+
"default": ""
98+
},
99+
"licenseUrl": {
100+
"type": "string",
101+
"default": ""
102+
},
103+
"encrypted": {
104+
"type": "boolean",
105+
"default": false
106+
},
107+
"password": {
108+
"type": "string",
109+
"default": ""
110+
},
111+
"permalink": {
112+
"type": "string"
113+
},
114+
"prevTitle": {
115+
"type": "string",
116+
"default": ""
117+
},
118+
"prevSlug": {
119+
"type": "string",
120+
"default": ""
121+
},
122+
"nextTitle": {
123+
"type": "string",
124+
"default": ""
125+
},
126+
"nextSlug": {
127+
"type": "string",
128+
"default": ""
129+
},
130+
"$schema": {
131+
"type": "string"
132+
}
133+
},
134+
"required": [
135+
"title",
136+
"published"
137+
],
138+
"additionalProperties": false
139+
}
140+
},
141+
"$schema": "http://json-schema.org/draft-07/schema#"
142+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"$ref": "#/definitions/spec",
3+
"definitions": {
4+
"spec": {
5+
"type": "object",
6+
"properties": {
7+
"$schema": {
8+
"type": "string"
9+
}
10+
},
11+
"additionalProperties": false
12+
}
13+
},
14+
"$schema": "http://json-schema.org/draft-07/schema#"
15+
}

.astro/content-assets.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default new Map();

.astro/content-modules.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default new Map();

.astro/content.d.ts

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
declare module 'astro:content' {
2+
export interface RenderResult {
3+
Content: import('astro/runtime/server/index.js').AstroComponentFactory;
4+
headings: import('astro').MarkdownHeading[];
5+
remarkPluginFrontmatter: Record<string, any>;
6+
}
7+
interface Render {
8+
'.md': Promise<RenderResult>;
9+
}
10+
11+
export interface RenderedContent {
12+
html: string;
13+
metadata?: {
14+
imagePaths: Array<string>;
15+
[key: string]: unknown;
16+
};
17+
}
18+
}
19+
20+
declare module 'astro:content' {
21+
type Flatten<T> = T extends { [K: string]: infer U } ? U : never;
22+
23+
export type CollectionKey = keyof AnyEntryMap;
24+
export type CollectionEntry<C extends CollectionKey> = Flatten<AnyEntryMap[C]>;
25+
26+
export type ContentCollectionKey = keyof ContentEntryMap;
27+
export type DataCollectionKey = keyof DataEntryMap;
28+
29+
type AllValuesOf<T> = T extends any ? T[keyof T] : never;
30+
type ValidContentEntrySlug<C extends keyof ContentEntryMap> = AllValuesOf<
31+
ContentEntryMap[C]
32+
>['slug'];
33+
34+
export type ReferenceDataEntry<
35+
C extends CollectionKey,
36+
E extends keyof DataEntryMap[C] = string,
37+
> = {
38+
collection: C;
39+
id: E;
40+
};
41+
export type ReferenceContentEntry<
42+
C extends keyof ContentEntryMap,
43+
E extends ValidContentEntrySlug<C> | (string & {}) = string,
44+
> = {
45+
collection: C;
46+
slug: E;
47+
};
48+
export type ReferenceLiveEntry<C extends keyof LiveContentConfig['collections']> = {
49+
collection: C;
50+
id: string;
51+
};
52+
53+
/** @deprecated Use `getEntry` instead. */
54+
export function getEntryBySlug<
55+
C extends keyof ContentEntryMap,
56+
E extends ValidContentEntrySlug<C> | (string & {}),
57+
>(
58+
collection: C,
59+
// Note that this has to accept a regular string too, for SSR
60+
entrySlug: E,
61+
): E extends ValidContentEntrySlug<C>
62+
? Promise<CollectionEntry<C>>
63+
: Promise<CollectionEntry<C> | undefined>;
64+
65+
/** @deprecated Use `getEntry` instead. */
66+
export function getDataEntryById<C extends keyof DataEntryMap, E extends keyof DataEntryMap[C]>(
67+
collection: C,
68+
entryId: E,
69+
): Promise<CollectionEntry<C>>;
70+
71+
export function getCollection<C extends keyof AnyEntryMap, E extends CollectionEntry<C>>(
72+
collection: C,
73+
filter?: (entry: CollectionEntry<C>) => entry is E,
74+
): Promise<E[]>;
75+
export function getCollection<C extends keyof AnyEntryMap>(
76+
collection: C,
77+
filter?: (entry: CollectionEntry<C>) => unknown,
78+
): Promise<CollectionEntry<C>[]>;
79+
80+
export function getLiveCollection<C extends keyof LiveContentConfig['collections']>(
81+
collection: C,
82+
filter?: LiveLoaderCollectionFilterType<C>,
83+
): Promise<
84+
import('astro').LiveDataCollectionResult<LiveLoaderDataType<C>, LiveLoaderErrorType<C>>
85+
>;
86+
87+
export function getEntry<
88+
C extends keyof ContentEntryMap,
89+
E extends ValidContentEntrySlug<C> | (string & {}),
90+
>(
91+
entry: ReferenceContentEntry<C, E>,
92+
): E extends ValidContentEntrySlug<C>
93+
? Promise<CollectionEntry<C>>
94+
: Promise<CollectionEntry<C> | undefined>;
95+
export function getEntry<
96+
C extends keyof DataEntryMap,
97+
E extends keyof DataEntryMap[C] | (string & {}),
98+
>(
99+
entry: ReferenceDataEntry<C, E>,
100+
): E extends keyof DataEntryMap[C]
101+
? Promise<DataEntryMap[C][E]>
102+
: Promise<CollectionEntry<C> | undefined>;
103+
export function getEntry<
104+
C extends keyof ContentEntryMap,
105+
E extends ValidContentEntrySlug<C> | (string & {}),
106+
>(
107+
collection: C,
108+
slug: E,
109+
): E extends ValidContentEntrySlug<C>
110+
? Promise<CollectionEntry<C>>
111+
: Promise<CollectionEntry<C> | undefined>;
112+
export function getEntry<
113+
C extends keyof DataEntryMap,
114+
E extends keyof DataEntryMap[C] | (string & {}),
115+
>(
116+
collection: C,
117+
id: E,
118+
): E extends keyof DataEntryMap[C]
119+
? string extends keyof DataEntryMap[C]
120+
? Promise<DataEntryMap[C][E]> | undefined
121+
: Promise<DataEntryMap[C][E]>
122+
: Promise<CollectionEntry<C> | undefined>;
123+
export function getLiveEntry<C extends keyof LiveContentConfig['collections']>(
124+
collection: C,
125+
filter: string | LiveLoaderEntryFilterType<C>,
126+
): Promise<import('astro').LiveDataEntryResult<LiveLoaderDataType<C>, LiveLoaderErrorType<C>>>;
127+
128+
/** Resolve an array of entry references from the same collection */
129+
export function getEntries<C extends keyof ContentEntryMap>(
130+
entries: ReferenceContentEntry<C, ValidContentEntrySlug<C>>[],
131+
): Promise<CollectionEntry<C>[]>;
132+
export function getEntries<C extends keyof DataEntryMap>(
133+
entries: ReferenceDataEntry<C, keyof DataEntryMap[C]>[],
134+
): Promise<CollectionEntry<C>[]>;
135+
136+
export function render<C extends keyof AnyEntryMap>(
137+
entry: AnyEntryMap[C][string],
138+
): Promise<RenderResult>;
139+
140+
export function reference<C extends keyof AnyEntryMap>(
141+
collection: C,
142+
): import('astro/zod').ZodEffects<
143+
import('astro/zod').ZodString,
144+
C extends keyof ContentEntryMap
145+
? ReferenceContentEntry<C, ValidContentEntrySlug<C>>
146+
: ReferenceDataEntry<C, keyof DataEntryMap[C]>
147+
>;
148+
// Allow generic `string` to avoid excessive type errors in the config
149+
// if `dev` is not running to update as you edit.
150+
// Invalid collection names will be caught at build time.
151+
export function reference<C extends string>(
152+
collection: C,
153+
): import('astro/zod').ZodEffects<import('astro/zod').ZodString, never>;
154+
155+
type ReturnTypeOrOriginal<T> = T extends (...args: any[]) => infer R ? R : T;
156+
type InferEntrySchema<C extends keyof AnyEntryMap> = import('astro/zod').infer<
157+
ReturnTypeOrOriginal<Required<ContentConfig['collections'][C]>['schema']>
158+
>;
159+
160+
type ContentEntryMap = {
161+
162+
};
163+
164+
type DataEntryMap = {
165+
"posts": Record<string, {
166+
id: string;
167+
body?: string;
168+
collection: "posts";
169+
data: InferEntrySchema<"posts">;
170+
rendered?: RenderedContent;
171+
filePath?: string;
172+
}>;
173+
"spec": Record<string, {
174+
id: string;
175+
body?: string;
176+
collection: "spec";
177+
data: InferEntrySchema<"spec">;
178+
rendered?: RenderedContent;
179+
filePath?: string;
180+
}>;
181+
182+
};
183+
184+
type AnyEntryMap = ContentEntryMap & DataEntryMap;
185+
186+
type ExtractLoaderTypes<T> = T extends import('astro/loaders').LiveLoader<
187+
infer TData,
188+
infer TEntryFilter,
189+
infer TCollectionFilter,
190+
infer TError
191+
>
192+
? { data: TData; entryFilter: TEntryFilter; collectionFilter: TCollectionFilter; error: TError }
193+
: { data: never; entryFilter: never; collectionFilter: never; error: never };
194+
type ExtractDataType<T> = ExtractLoaderTypes<T>['data'];
195+
type ExtractEntryFilterType<T> = ExtractLoaderTypes<T>['entryFilter'];
196+
type ExtractCollectionFilterType<T> = ExtractLoaderTypes<T>['collectionFilter'];
197+
type ExtractErrorType<T> = ExtractLoaderTypes<T>['error'];
198+
199+
type LiveLoaderDataType<C extends keyof LiveContentConfig['collections']> =
200+
LiveContentConfig['collections'][C]['schema'] extends undefined
201+
? ExtractDataType<LiveContentConfig['collections'][C]['loader']>
202+
: import('astro/zod').infer<
203+
Exclude<LiveContentConfig['collections'][C]['schema'], undefined>
204+
>;
205+
type LiveLoaderEntryFilterType<C extends keyof LiveContentConfig['collections']> =
206+
ExtractEntryFilterType<LiveContentConfig['collections'][C]['loader']>;
207+
type LiveLoaderCollectionFilterType<C extends keyof LiveContentConfig['collections']> =
208+
ExtractCollectionFilterType<LiveContentConfig['collections'][C]['loader']>;
209+
type LiveLoaderErrorType<C extends keyof LiveContentConfig['collections']> = ExtractErrorType<
210+
LiveContentConfig['collections'][C]['loader']
211+
>;
212+
213+
export type ContentConfig = typeof import("../src/content.config.js");
214+
export type LiveContentConfig = never;
215+
}

.astro/data-store.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

.astro/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"_variables": {
3+
"lastUpdateCheck": 1765106639377
4+
}
5+
}

.astro/types.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/// <reference types="astro/client" />
2+
/// <reference path="content.d.ts" />

0 commit comments

Comments
 (0)