@chat-de-hp/site 0.3.4 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/check-core.d.ts.map +1 -1
- package/dist/check-core.js +45 -2
- package/dist/control-plane.d.ts +28 -28
- package/dist/control-plane.d.ts.map +1 -1
- package/dist/control-plane.js +31 -34
- package/package.json +8 -5
package/dist/check-core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-core.d.ts","sourceRoot":"","sources":["../src/check-core.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GACvB,aAAa,GACb,WAAW,GACX,MAAM,GACN,aAAa,CAAC;AAElB,MAAM,MAAM,oBAAoB,GAAG;IACjC,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;
|
|
1
|
+
{"version":3,"file":"check-core.d.ts","sourceRoot":"","sources":["../src/check-core.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GACvB,aAAa,GACb,WAAW,GACX,MAAM,GACN,aAAa,CAAC;AAElB,MAAM,MAAM,oBAAoB,GAAG;IACjC,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AA2BF;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAsB,2BAA2B,CAAC,OAAO,EAAE;IACzD,KAAK,EAAE,aAAa,CAAC,iBAAiB,CAAC,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IACtE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,iBAAiB,CAAC;CACzB,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAwBlC"}
|
package/dist/check-core.js
CHANGED
|
@@ -18,7 +18,7 @@ export async function checkSiteConformanceSources(options) {
|
|
|
18
18
|
return sortViolations(violations);
|
|
19
19
|
}
|
|
20
20
|
function checkSeedSchema(seed) {
|
|
21
|
-
|
|
21
|
+
const violations = seed.collections
|
|
22
22
|
.filter((collection) => collection.supportsDrafts && !collection.supportsRevisions)
|
|
23
23
|
.map((collection) => ({
|
|
24
24
|
field: collection.slug,
|
|
@@ -27,6 +27,36 @@ function checkSeedSchema(seed) {
|
|
|
27
27
|
message: `Collection "${collection.slug}" enables "drafts" without "revisions". Add "revisions", or remove "drafts" and do not use the publish flow.`,
|
|
28
28
|
rule: "seed-schema",
|
|
29
29
|
}));
|
|
30
|
+
const collections = new Set(seed.collections.map((collection) => collection.slug));
|
|
31
|
+
const unknownCollections = new Set();
|
|
32
|
+
for (const provided of seed.provided) {
|
|
33
|
+
const separator = provided.indexOf(".");
|
|
34
|
+
const collection = provided.slice(0, separator);
|
|
35
|
+
const field = provided.slice(separator + 1);
|
|
36
|
+
if (!collections.has(collection)) {
|
|
37
|
+
if (!unknownCollections.has(collection)) {
|
|
38
|
+
unknownCollections.add(collection);
|
|
39
|
+
violations.push({
|
|
40
|
+
field: collection,
|
|
41
|
+
file: seed.file,
|
|
42
|
+
line: 1,
|
|
43
|
+
message: `Content collection "${collection}" has seed data but no matching collection is declared.`,
|
|
44
|
+
rule: "seed-schema",
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (!seed.declared.has(provided)) {
|
|
50
|
+
violations.push({
|
|
51
|
+
field,
|
|
52
|
+
file: seed.file,
|
|
53
|
+
line: 1,
|
|
54
|
+
message: `Content field "${collection}.${field}" is provided but not declared in collection "${collection}".`,
|
|
55
|
+
rule: "seed-schema",
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return violations;
|
|
30
60
|
}
|
|
31
61
|
function sortViolations(violations) {
|
|
32
62
|
return violations.sort((left, right) => left.file.localeCompare(right.file) ||
|
|
@@ -534,10 +564,19 @@ function lineAt(code, index) {
|
|
|
534
564
|
function parseSeed(source) {
|
|
535
565
|
const parsed = JSON.parse(source.source);
|
|
536
566
|
const seedCollections = [];
|
|
567
|
+
const declared = new Set();
|
|
537
568
|
const fields = new Map();
|
|
569
|
+
const provided = new Set();
|
|
538
570
|
const seeded = new Set();
|
|
539
571
|
if (!isRecord(parsed)) {
|
|
540
|
-
return {
|
|
572
|
+
return {
|
|
573
|
+
collections: seedCollections,
|
|
574
|
+
declared,
|
|
575
|
+
fields,
|
|
576
|
+
file: source.file,
|
|
577
|
+
provided,
|
|
578
|
+
seeded,
|
|
579
|
+
};
|
|
541
580
|
}
|
|
542
581
|
const collections = Array.isArray(parsed.collections)
|
|
543
582
|
? parsed.collections
|
|
@@ -565,6 +604,7 @@ function parseSeed(source) {
|
|
|
565
604
|
const entries = fields.get(field.slug) ?? [];
|
|
566
605
|
entries.push({ collection: collectionSlug, slug: field.slug });
|
|
567
606
|
fields.set(field.slug, entries);
|
|
607
|
+
declared.add(`${collectionSlug}.${field.slug}`);
|
|
568
608
|
}
|
|
569
609
|
}
|
|
570
610
|
const content = isRecord(parsed.content) ? parsed.content : {};
|
|
@@ -577,6 +617,7 @@ function parseSeed(source) {
|
|
|
577
617
|
continue;
|
|
578
618
|
}
|
|
579
619
|
for (const [slug, value] of Object.entries(entry.data)) {
|
|
620
|
+
provided.add(`${collectionSlug}.${slug}`);
|
|
580
621
|
if (value !== null && value !== undefined && value !== "") {
|
|
581
622
|
seeded.add(`${collectionSlug}.${slug}`);
|
|
582
623
|
}
|
|
@@ -585,8 +626,10 @@ function parseSeed(source) {
|
|
|
585
626
|
}
|
|
586
627
|
return {
|
|
587
628
|
collections: seedCollections,
|
|
629
|
+
declared,
|
|
588
630
|
fields,
|
|
589
631
|
file: source.file,
|
|
632
|
+
provided,
|
|
590
633
|
seeded,
|
|
591
634
|
};
|
|
592
635
|
}
|
package/dist/control-plane.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type infer as InferSchema } from "zod/mini";
|
|
2
2
|
export declare const SITE_RUNTIME_NAME: "@chat-de-hp/site";
|
|
3
3
|
export declare const SITE_RUNTIME_VERSION: string;
|
|
4
4
|
export declare const SITE_RUNTIME_PROTOCOL_VERSION: 1;
|
|
5
|
-
export declare const siteRuntimeBindingSchema:
|
|
6
|
-
name:
|
|
7
|
-
type:
|
|
5
|
+
export declare const siteRuntimeBindingSchema: import("zod/mini").ZodMiniObject<{
|
|
6
|
+
name: import("zod/mini").ZodMiniString<string>;
|
|
7
|
+
type: import("zod/mini").ZodMiniEnum<{
|
|
8
8
|
d1: "d1";
|
|
9
9
|
images: "images";
|
|
10
10
|
kv_namespace: "kv_namespace";
|
|
@@ -12,20 +12,20 @@ export declare const siteRuntimeBindingSchema: z.ZodObject<{
|
|
|
12
12
|
send_email: "send_email";
|
|
13
13
|
worker_loader: "worker_loader";
|
|
14
14
|
}>;
|
|
15
|
-
},
|
|
16
|
-
export declare const siteRuntimeManifestSchema:
|
|
17
|
-
capabilities:
|
|
18
|
-
id:
|
|
19
|
-
provider:
|
|
20
|
-
schemaVersion:
|
|
21
|
-
},
|
|
22
|
-
primitives:
|
|
23
|
-
id:
|
|
24
|
-
schemaVersion:
|
|
25
|
-
},
|
|
26
|
-
requiredBindings:
|
|
27
|
-
name:
|
|
28
|
-
type:
|
|
15
|
+
}, import("zod/v4/core").$loose>;
|
|
16
|
+
export declare const siteRuntimeManifestSchema: import("zod/mini").ZodMiniObject<{
|
|
17
|
+
capabilities: import("zod/mini").ZodMiniArray<import("zod/mini").ZodMiniObject<{
|
|
18
|
+
id: import("zod/mini").ZodMiniString<string>;
|
|
19
|
+
provider: import("zod/mini").ZodMiniString<string>;
|
|
20
|
+
schemaVersion: import("zod/mini").ZodMiniNumber<number>;
|
|
21
|
+
}, import("zod/v4/core").$loose>>;
|
|
22
|
+
primitives: import("zod/mini").ZodMiniArray<import("zod/mini").ZodMiniObject<{
|
|
23
|
+
id: import("zod/mini").ZodMiniString<string>;
|
|
24
|
+
schemaVersion: import("zod/mini").ZodMiniNumber<number>;
|
|
25
|
+
}, import("zod/v4/core").$loose>>;
|
|
26
|
+
requiredBindings: import("zod/mini").ZodMiniArray<import("zod/mini").ZodMiniObject<{
|
|
27
|
+
name: import("zod/mini").ZodMiniString<string>;
|
|
28
|
+
type: import("zod/mini").ZodMiniEnum<{
|
|
29
29
|
d1: "d1";
|
|
30
30
|
images: "images";
|
|
31
31
|
kv_namespace: "kv_namespace";
|
|
@@ -33,15 +33,15 @@ export declare const siteRuntimeManifestSchema: z.ZodObject<{
|
|
|
33
33
|
send_email: "send_email";
|
|
34
34
|
worker_loader: "worker_loader";
|
|
35
35
|
}>;
|
|
36
|
-
},
|
|
37
|
-
runtime:
|
|
38
|
-
name:
|
|
39
|
-
protocolVersion:
|
|
40
|
-
version:
|
|
41
|
-
},
|
|
42
|
-
schemaVersion:
|
|
43
|
-
},
|
|
44
|
-
export type SiteRuntimeBinding =
|
|
45
|
-
export type SiteRuntimeManifest =
|
|
36
|
+
}, import("zod/v4/core").$loose>>;
|
|
37
|
+
runtime: import("zod/mini").ZodMiniObject<{
|
|
38
|
+
name: import("zod/mini").ZodMiniLiteral<"@chat-de-hp/site">;
|
|
39
|
+
protocolVersion: import("zod/mini").ZodMiniLiteral<1>;
|
|
40
|
+
version: import("zod/mini").ZodMiniString<string>;
|
|
41
|
+
}, import("zod/v4/core").$loose>;
|
|
42
|
+
schemaVersion: import("zod/mini").ZodMiniLiteral<1>;
|
|
43
|
+
}, import("zod/v4/core").$loose>;
|
|
44
|
+
export type SiteRuntimeBinding = InferSchema<typeof siteRuntimeBindingSchema>;
|
|
45
|
+
export type SiteRuntimeManifest = InferSchema<typeof siteRuntimeManifestSchema>;
|
|
46
46
|
export declare function parseSiteRuntimeManifest(value: unknown): SiteRuntimeManifest;
|
|
47
47
|
//# sourceMappingURL=control-plane.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-plane.d.ts","sourceRoot":"","sources":["../src/control-plane.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"control-plane.d.ts","sourceRoot":"","sources":["../src/control-plane.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,KAAK,IAAI,WAAW,EAQ1B,MAAM,UAAU,CAAC;AAIlB,eAAO,MAAM,iBAAiB,EAAG,kBAA2B,CAAC;AAC7D,eAAO,MAAM,oBAAoB,QAAsB,CAAC;AACxD,eAAO,MAAM,6BAA6B,EAAG,CAAU,CAAC;AAExD,eAAO,MAAM,wBAAwB;;;;;;;;;;gCAUnC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAqBpC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC9E,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAEhF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,CAQ5E"}
|
package/dist/control-plane.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { array, enum as enumSchema, int, literal, looseObject, minLength, number, positive, string, } from "zod/mini";
|
|
2
2
|
import packageJson from "../package.json" with { type: "json" };
|
|
3
3
|
export const SITE_RUNTIME_NAME = "@chat-de-hp/site";
|
|
4
4
|
export const SITE_RUNTIME_VERSION = packageJson.version;
|
|
5
5
|
export const SITE_RUNTIME_PROTOCOL_VERSION = 1;
|
|
6
|
-
export const siteRuntimeBindingSchema =
|
|
7
|
-
.
|
|
8
|
-
|
|
9
|
-
type: z.enum([
|
|
6
|
+
export const siteRuntimeBindingSchema = looseObject({
|
|
7
|
+
name: string().check(minLength(1)),
|
|
8
|
+
type: enumSchema([
|
|
10
9
|
"d1",
|
|
11
10
|
"images",
|
|
12
11
|
"kv_namespace",
|
|
@@ -14,34 +13,32 @@ export const siteRuntimeBindingSchema = z
|
|
|
14
13
|
"send_email",
|
|
15
14
|
"worker_loader",
|
|
16
15
|
]),
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
.object({
|
|
37
|
-
name: z.literal(SITE_RUNTIME_NAME),
|
|
38
|
-
protocolVersion: z.literal(SITE_RUNTIME_PROTOCOL_VERSION),
|
|
39
|
-
version: z.string().min(1),
|
|
40
|
-
})
|
|
41
|
-
.passthrough(),
|
|
42
|
-
schemaVersion: z.literal(1),
|
|
43
|
-
})
|
|
44
|
-
.passthrough();
|
|
16
|
+
});
|
|
17
|
+
export const siteRuntimeManifestSchema = looseObject({
|
|
18
|
+
capabilities: array(looseObject({
|
|
19
|
+
id: string().check(minLength(1)),
|
|
20
|
+
provider: string().check(minLength(1)),
|
|
21
|
+
schemaVersion: number().check(int(), positive()),
|
|
22
|
+
})),
|
|
23
|
+
primitives: array(looseObject({
|
|
24
|
+
id: string().check(minLength(1)),
|
|
25
|
+
schemaVersion: number().check(int(), positive()),
|
|
26
|
+
})),
|
|
27
|
+
requiredBindings: array(siteRuntimeBindingSchema),
|
|
28
|
+
runtime: looseObject({
|
|
29
|
+
name: literal(SITE_RUNTIME_NAME),
|
|
30
|
+
protocolVersion: literal(SITE_RUNTIME_PROTOCOL_VERSION),
|
|
31
|
+
version: string().check(minLength(1)),
|
|
32
|
+
}),
|
|
33
|
+
schemaVersion: literal(1),
|
|
34
|
+
});
|
|
45
35
|
export function parseSiteRuntimeManifest(value) {
|
|
46
|
-
|
|
36
|
+
try {
|
|
37
|
+
return siteRuntimeManifestSchema.parse(value);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
throw new Error("Invalid input: site runtime manifest failed validation.", {
|
|
41
|
+
cause: error,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
47
44
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chat-de-hp/site",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Managed Astro site runtime and primitive composition for Chat de HP",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
"README.md"
|
|
14
14
|
],
|
|
15
15
|
"type": "module",
|
|
16
|
+
"sideEffects": [
|
|
17
|
+
"./dist/primitives/forms-styles.css"
|
|
18
|
+
],
|
|
16
19
|
"exports": {
|
|
17
20
|
".": {
|
|
18
21
|
"types": "./dist/index.d.ts",
|
|
@@ -65,7 +68,7 @@
|
|
|
65
68
|
"dependencies": {
|
|
66
69
|
"@astrojs/cloudflare": "14.0.2",
|
|
67
70
|
"@astrojs/react": "6.0.0",
|
|
68
|
-
"@emdash-cms/cloudflare": "0.
|
|
71
|
+
"@emdash-cms/cloudflare": "0.36.0",
|
|
69
72
|
"@emdash-cms/plugin-forms": "0.2.4",
|
|
70
73
|
"jsonc-parser": "3.3.1",
|
|
71
74
|
"zod": "4.5.2"
|
|
@@ -73,7 +76,7 @@
|
|
|
73
76
|
"devDependencies": {
|
|
74
77
|
"@types/node": "20",
|
|
75
78
|
"astro": "7.0.4",
|
|
76
|
-
"emdash": "0.
|
|
79
|
+
"emdash": "0.36.0",
|
|
77
80
|
"react": "19.2.7",
|
|
78
81
|
"react-dom": "19.2.7",
|
|
79
82
|
"typescript": "5.8.3",
|
|
@@ -82,7 +85,7 @@
|
|
|
82
85
|
},
|
|
83
86
|
"peerDependencies": {
|
|
84
87
|
"astro": "^7.0.4",
|
|
85
|
-
"emdash": "0.
|
|
88
|
+
"emdash": "0.36.0",
|
|
86
89
|
"react": "^19.2.3",
|
|
87
90
|
"react-dom": "^19.2.3",
|
|
88
91
|
"wrangler": "^4.106.0"
|
|
@@ -100,7 +103,7 @@
|
|
|
100
103
|
],
|
|
101
104
|
"siteDependencies": {
|
|
102
105
|
"astro": "^7.0.4",
|
|
103
|
-
"emdash": "0.
|
|
106
|
+
"emdash": "0.36.0",
|
|
104
107
|
"react": "19.2.7",
|
|
105
108
|
"react-dom": "19.2.7"
|
|
106
109
|
},
|