@easy-web/core 1.5.0 → 1.7.0

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.
Files changed (149) hide show
  1. package/README.md +100 -2
  2. package/dist/contracts/capabilities.d.ts +38 -0
  3. package/dist/contracts/capabilities.d.ts.map +1 -1
  4. package/dist/contracts/content-composition.d.ts +144 -0
  5. package/dist/contracts/content-composition.d.ts.map +1 -0
  6. package/dist/contracts/content-composition.js +143 -0
  7. package/dist/contracts/content-composition.js.map +1 -0
  8. package/dist/contracts/index.d.ts +2 -0
  9. package/dist/contracts/index.d.ts.map +1 -1
  10. package/dist/contracts/index.js +2 -0
  11. package/dist/contracts/index.js.map +1 -1
  12. package/dist/contracts/traits.d.ts +98 -0
  13. package/dist/contracts/traits.d.ts.map +1 -0
  14. package/dist/contracts/traits.js +84 -0
  15. package/dist/contracts/traits.js.map +1 -0
  16. package/dist/demo/demo-content.d.ts +37 -0
  17. package/dist/demo/demo-content.d.ts.map +1 -0
  18. package/dist/demo/demo-content.js +171 -0
  19. package/dist/demo/demo-content.js.map +1 -0
  20. package/dist/demo/index.d.ts +3 -0
  21. package/dist/demo/index.d.ts.map +1 -0
  22. package/dist/demo/index.js +3 -0
  23. package/dist/demo/index.js.map +1 -0
  24. package/dist/demo/legal-shells.d.ts +18 -0
  25. package/dist/demo/legal-shells.d.ts.map +1 -0
  26. package/dist/demo/legal-shells.js +40 -0
  27. package/dist/demo/legal-shells.js.map +1 -0
  28. package/dist/i18n/cli-catalogs.d.ts +42 -0
  29. package/dist/i18n/cli-catalogs.d.ts.map +1 -0
  30. package/dist/i18n/cli-catalogs.js +29 -0
  31. package/dist/i18n/cli-catalogs.js.map +1 -0
  32. package/dist/i18n/create-localization.d.ts +37 -0
  33. package/dist/i18n/create-localization.d.ts.map +1 -0
  34. package/dist/i18n/create-localization.js +68 -0
  35. package/dist/i18n/create-localization.js.map +1 -0
  36. package/dist/i18n/explicit-formatters.d.ts +20 -0
  37. package/dist/i18n/explicit-formatters.d.ts.map +1 -0
  38. package/dist/i18n/explicit-formatters.js +18 -0
  39. package/dist/i18n/explicit-formatters.js.map +1 -0
  40. package/dist/i18n/index.d.ts +4 -0
  41. package/dist/i18n/index.d.ts.map +1 -1
  42. package/dist/i18n/index.js +4 -0
  43. package/dist/i18n/index.js.map +1 -1
  44. package/dist/i18n/locale-inputs.d.ts +18 -0
  45. package/dist/i18n/locale-inputs.d.ts.map +1 -0
  46. package/dist/i18n/locale-inputs.js +73 -0
  47. package/dist/i18n/locale-inputs.js.map +1 -0
  48. package/dist/index.d.ts +1 -0
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +1 -0
  51. package/dist/index.js.map +1 -1
  52. package/dist/recipes/admission.d.ts +161 -0
  53. package/dist/recipes/admission.d.ts.map +1 -0
  54. package/dist/recipes/admission.js +85 -0
  55. package/dist/recipes/admission.js.map +1 -0
  56. package/dist/recipes/graph.d.ts +101 -0
  57. package/dist/recipes/graph.d.ts.map +1 -0
  58. package/dist/recipes/graph.js +166 -0
  59. package/dist/recipes/graph.js.map +1 -0
  60. package/dist/recipes/index.d.ts +9 -0
  61. package/dist/recipes/index.d.ts.map +1 -0
  62. package/dist/recipes/index.js +9 -0
  63. package/dist/recipes/index.js.map +1 -0
  64. package/dist/recipes/mermaid.d.ts +3 -0
  65. package/dist/recipes/mermaid.d.ts.map +1 -0
  66. package/dist/recipes/mermaid.js +79 -0
  67. package/dist/recipes/mermaid.js.map +1 -0
  68. package/dist/recipes/registry.d.ts +82 -0
  69. package/dist/recipes/registry.d.ts.map +1 -0
  70. package/dist/recipes/registry.js +40 -0
  71. package/dist/recipes/registry.js.map +1 -0
  72. package/dist/recipes/schema.d.ts +129 -0
  73. package/dist/recipes/schema.d.ts.map +1 -0
  74. package/dist/recipes/schema.js +41 -0
  75. package/dist/recipes/schema.js.map +1 -0
  76. package/dist/recipes/serialize.d.ts +20 -0
  77. package/dist/recipes/serialize.d.ts.map +1 -0
  78. package/dist/recipes/serialize.js +56 -0
  79. package/dist/recipes/serialize.js.map +1 -0
  80. package/dist/recipes/shell-recipe.d.ts +59 -0
  81. package/dist/recipes/shell-recipe.d.ts.map +1 -0
  82. package/dist/recipes/shell-recipe.js +145 -0
  83. package/dist/recipes/shell-recipe.js.map +1 -0
  84. package/dist/recipes/types.d.ts +72 -0
  85. package/dist/recipes/types.d.ts.map +1 -0
  86. package/dist/recipes/types.js +13 -0
  87. package/dist/recipes/types.js.map +1 -0
  88. package/dist/schemas/galleries.d.ts +2 -2
  89. package/dist/seo/build-info-manifest.d.ts +45 -0
  90. package/dist/seo/build-info-manifest.d.ts.map +1 -0
  91. package/dist/seo/build-info-manifest.js +39 -0
  92. package/dist/seo/build-info-manifest.js.map +1 -0
  93. package/dist/seo/build-info.d.ts +3 -0
  94. package/dist/seo/build-info.d.ts.map +1 -0
  95. package/dist/seo/build-info.js +45 -0
  96. package/dist/seo/build-info.js.map +1 -0
  97. package/dist/seo/index.d.ts +4 -0
  98. package/dist/seo/index.d.ts.map +1 -1
  99. package/dist/seo/index.js +25 -2
  100. package/dist/seo/index.js.map +1 -1
  101. package/dist/seo/routes/robots-txt.d.ts.map +1 -1
  102. package/dist/seo/routes/robots-txt.js +3 -1
  103. package/dist/seo/routes/robots-txt.js.map +1 -1
  104. package/dist/seo/routes/version-json.d.ts +4 -0
  105. package/dist/seo/routes/version-json.d.ts.map +1 -0
  106. package/dist/seo/routes/version-json.js +11 -0
  107. package/dist/seo/routes/version-json.js.map +1 -0
  108. package/package.json +17 -1
  109. package/src/components/DemoLegalShell.astro +36 -0
  110. package/src/contracts/__tests__/content-composition.test.ts +170 -0
  111. package/src/contracts/capabilities.ts +49 -0
  112. package/src/contracts/content-composition.ts +176 -0
  113. package/src/contracts/index.ts +2 -0
  114. package/src/contracts/traits.ts +107 -0
  115. package/src/demo/__tests__/demo-content.test.ts +107 -0
  116. package/src/demo/demo-content.ts +210 -0
  117. package/src/demo/index.ts +2 -0
  118. package/src/demo/legal-shells.ts +52 -0
  119. package/src/i18n/__tests__/create-localization.test.ts +138 -0
  120. package/src/i18n/__tests__/explicit-formatters.test.ts +82 -0
  121. package/src/i18n/cli-catalogs.ts +44 -0
  122. package/src/i18n/create-localization.ts +67 -0
  123. package/src/i18n/explicit-formatters.ts +36 -0
  124. package/src/i18n/index.ts +4 -0
  125. package/src/i18n/locale-inputs.ts +73 -0
  126. package/src/index.ts +1 -0
  127. package/src/recipes/__tests__/graph.test.ts +139 -0
  128. package/src/recipes/__tests__/protocol.test.ts +180 -0
  129. package/src/recipes/__tests__/serialize.test.ts +128 -0
  130. package/src/recipes/__tests__/shell-recipe.test.ts +75 -0
  131. package/src/recipes/admission.ts +77 -0
  132. package/src/recipes/graph.ts +244 -0
  133. package/src/recipes/index.ts +8 -0
  134. package/src/recipes/mermaid.ts +75 -0
  135. package/src/recipes/registry.ts +48 -0
  136. package/src/recipes/schema.ts +53 -0
  137. package/src/recipes/serialize.ts +77 -0
  138. package/src/recipes/shell-recipe.ts +162 -0
  139. package/src/recipes/types.ts +63 -0
  140. package/src/seo/__tests__/build-info-html.test.ts +19 -0
  141. package/src/seo/__tests__/build-info-integration.test.ts +107 -0
  142. package/src/seo/__tests__/build-info.test.ts +86 -0
  143. package/src/seo/__tests__/robots-txt.test.ts +8 -0
  144. package/src/seo/build-info-manifest.ts +49 -0
  145. package/src/seo/build-info.ts +44 -0
  146. package/src/seo/index.ts +28 -3
  147. package/src/seo/routes/robots-txt.ts +3 -1
  148. package/src/seo/routes/version-json.ts +13 -0
  149. package/src/seo/routes/version.astro +42 -0
package/dist/seo/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import sitemap from '@astrojs/sitemap';
2
2
  import { normalizeLocalizedPath, toServedPath, validateLocalizedPaths, } from '../i18n/index.js';
3
3
  import { createCrawlPolicy, isDisallowedPath } from './crawl-policy.js';
4
+ import { buildInfoManifest } from './build-info.js';
5
+ import { buildInfoOptionsSchema, serializeBuildInfo } from './build-info-manifest.js';
4
6
  function localeIdsOf(config) {
5
7
  return (config.i18n?.locales ?? []).map((locale) => typeof locale === 'string' ? locale : locale.path);
6
8
  }
@@ -38,6 +40,9 @@ function pathnameOf(page, config) {
38
40
  }
39
41
  return pathname;
40
42
  }
43
+ function isBuildInfoPath(pathname) {
44
+ return pathname === '/version' || pathname === '/version.json';
45
+ }
41
46
  export default function easyWebSeo(options = {}) {
42
47
  return {
43
48
  name: '@easy-web/seo',
@@ -49,6 +54,13 @@ export default function easyWebSeo(options = {}) {
49
54
  throw new Error('@easy-web/seo: `site` is required in astro.config.mjs');
50
55
  }
51
56
  const noIndex = options.noIndex ?? false;
57
+ const buildInfoOptions = options.buildInfo === undefined ? undefined : buildInfoOptionsSchema.parse(options.buildInfo);
58
+ const manifest = buildInfoOptions === undefined ? undefined : buildInfoManifest(buildInfoOptions, config.root);
59
+ if (manifest)
60
+ process.env.EASY_WEB_SEO_BUILD_INFO = serializeBuildInfo(manifest);
61
+ else
62
+ delete process.env.EASY_WEB_SEO_BUILD_INFO;
63
+ process.env.EASY_WEB_SEO_BUILD_INFO_JSON = String(buildInfoOptions?.json === true);
52
64
  const policy = createCrawlPolicy(noIndex);
53
65
  let sitemapI18n;
54
66
  if (config.i18n && config.i18n.locales.length > 0) {
@@ -99,8 +111,12 @@ export default function easyWebSeo(options = {}) {
99
111
  const sitemapIntegration = sitemap({
100
112
  ...(sitemapI18n ? { i18n: sitemapI18n } : {}),
101
113
  namespaces: { xhtml: true },
102
- filter: (page) => !isDisallowedPath(pathnameOf(page, config), policy) &&
103
- (options.filter?.(page) ?? true),
114
+ filter: (page) => {
115
+ const pathname = pathnameOf(page, config);
116
+ return !isDisallowedPath(pathname, policy) &&
117
+ !(manifest && isBuildInfoPath(pathname)) &&
118
+ (options.filter?.(page) ?? true);
119
+ },
104
120
  serialize: (item) => {
105
121
  // Re-render every <loc> through the same helper that produces the
106
122
  // canonical, so the two agree byte-for-byte. @astrojs/sitemap
@@ -154,6 +170,7 @@ export default function easyWebSeo(options = {}) {
154
170
  updateConfig({ integrations: [sitemapIntegration, validatorIntegration] });
155
171
  }
156
172
  process.env.EASY_WEB_SEO_NO_INDEX = String(noIndex);
173
+ process.env.EASY_WEB_SEO_BASE = config.base;
157
174
  // <SeoHead> is a component and cannot read astro.config, so the style
158
175
  // the sitemap uses is published here for it to reuse. Both surfaces
159
176
  // therefore derive the canonical URL form from one resolver.
@@ -163,6 +180,12 @@ export default function easyWebSeo(options = {}) {
163
180
  entrypoint: new URL('./routes/robots-txt.js', import.meta.url),
164
181
  prerender: true,
165
182
  });
183
+ if (manifest) {
184
+ injectRoute({ pattern: '/version', entrypoint: new URL('../../src/seo/routes/version.astro', import.meta.url), prerender: true });
185
+ if (buildInfoOptions?.json === true) {
186
+ injectRoute({ pattern: '/version.json', entrypoint: new URL('./routes/version-json.js', import.meta.url), prerender: true });
187
+ }
188
+ }
166
189
  },
167
190
  },
168
191
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/seo/index.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,kBAAkB,CAAA;AACtC,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,sBAAsB,GAGvB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AA0BvE,SAAS,WAAW,CAAC,MAAmB;IACtC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACjD,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAClD,CAAA;AACH,CAAC;AAED,SAAS,oBAAoB,CAC3B,MAAmB,EACnB,MAAwC;IAExC,8EAA8E;IAC9E,8EAA8E;IAC9E,yBAAyB;IACzB,IAAI,MAAM,CAAC,aAAa,KAAK,QAAQ;QAAE,OAAO,QA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AC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;oBAC9H,CAAC;gBACH,CAAC;YACH,CAAC;SACF;KACF,CAAA;AACH,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAoB,MAAM,mBAAmB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"robots-txt.d.ts","sourceRoot":"","sources":["../../../src/seo/routes/robots-txt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAsBrC,eAAO,MAAM,GAAG,EAAE,QAajB,CAAA"}
1
+ {"version":3,"file":"robots-txt.d.ts","sourceRoot":"","sources":["../../../src/seo/routes/robots-txt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAwBrC,eAAO,MAAM,GAAG,EAAE,QAajB,CAAA"}
@@ -8,8 +8,10 @@ function render(policy, site) {
8
8
  lines.push(`Allow: ${path}`);
9
9
  }
10
10
  if (policy.sitemap && site) {
11
+ const configuredBase = process.env.EASY_WEB_SEO_BASE ?? '/';
12
+ const base = `/${configuredBase.replace(/^\/+|\/+$/g, '')}`.replace(/^\/$/, '');
11
13
  lines.push('');
12
- lines.push(`Sitemap: ${new URL('sitemap-index.xml', site).href}`);
14
+ lines.push(`Sitemap: ${new URL(`${base}/sitemap-index.xml`, site).href}`);
13
15
  }
14
16
  return `${lines.join('\n')}\n`;
15
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"robots-txt.js","sourceRoot":"","sources":["../../../src/seo/routes/robots-txt.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAoB,MAAM,oBAAoB,CAAA;AAExE,SAAS,MAAM,CAAC,MAAmB,EAAE,IAAqB;IACxD,MAAM,KAAK,GAAG,CAAC,eAAe,CAAC,CAAA;IAE/B,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACnC,KAAK,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,CAAA;IAE9E,OAAO,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;QACxC,OAAO,EAAE,EAAE,cAAc,EAAE,2BAA2B,EAAE;KACzD,CAAC,CAAA;AACJ,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { APIRoute } from 'astro';
2
+ export declare const prerender = true;
3
+ export declare const GET: APIRoute;
4
+ //# sourceMappingURL=version-json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version-json.d.ts","sourceRoot":"","sources":["../../../src/seo/routes/version-json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGtC,eAAO,MAAM,SAAS,OAAO,CAAC;AAE9B,eAAO,MAAM,GAAG,EAAE,QAOhB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { readBuildInfo, serializeBuildInfo } from '../build-info-manifest.js';
2
+ export const prerender = true;
3
+ export const GET = () => new Response(serializeBuildInfo(readBuildInfo()), {
4
+ headers: {
5
+ 'Content-Type': 'application/json; charset=utf-8',
6
+ 'Cache-Control': 'no-store',
7
+ 'X-Content-Type-Options': 'nosniff',
8
+ 'X-Robots-Tag': 'noindex, nofollow',
9
+ },
10
+ });
11
+ //# sourceMappingURL=version-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version-json.js","sourceRoot":"","sources":["../../../src/seo/routes/version-json.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE9E,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC;AAE9B,MAAM,CAAC,MAAM,GAAG,GAAa,GAAG,EAAE,CAAC,IAAI,QAAQ,CAAC,kBAAkB,CAAC,aAAa,EAAE,CAAC,EAAE;IACjF,OAAO,EAAE;QACL,cAAc,EAAE,iCAAiC;QACjD,eAAe,EAAE,UAAU;QAC3B,wBAAwB,EAAE,SAAS;QACnC,cAAc,EAAE,mBAAmB;KACtC;CACJ,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easy-web/core",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -11,6 +11,22 @@
11
11
  "types": "./dist/contracts/index.d.ts",
12
12
  "import": "./dist/contracts/index.js"
13
13
  },
14
+ "./recipes": {
15
+ "types": "./dist/recipes/index.d.ts",
16
+ "import": "./dist/recipes/index.js"
17
+ },
18
+ "./recipes/schema": {
19
+ "types": "./dist/recipes/schema.d.ts",
20
+ "import": "./dist/recipes/schema.js"
21
+ },
22
+ "./recipes/registry": {
23
+ "types": "./dist/recipes/registry.d.ts",
24
+ "import": "./dist/recipes/registry.js"
25
+ },
26
+ "./demo": {
27
+ "types": "./dist/demo/index.d.ts",
28
+ "import": "./dist/demo/index.js"
29
+ },
14
30
  "./theme": {
15
31
  "types": "./dist/theme/index.d.ts",
16
32
  "import": "./dist/theme/index.js"
@@ -0,0 +1,36 @@
1
+ ---
2
+ /**
3
+ * DemoLegalShell - sample legal/privacy page shell with a prominent disclaimer.
4
+ * Reuses LegalLayout. Structural placeholder only, never legal advice.
5
+ */
6
+ import LegalLayout from './LegalLayout.astro';
7
+ import type { DemoLegalShell } from '../demo/legal-shells.js';
8
+
9
+ export interface Props {
10
+ shell: DemoLegalShell;
11
+ }
12
+
13
+ const { shell } = Astro.props;
14
+ ---
15
+
16
+ <LegalLayout title={shell.title}>
17
+ <div class="ew-demo-disclaimer" role="alert" data-demo-disclaimer>
18
+ <strong>{shell.disclaimer}</strong>
19
+ </div>
20
+ {shell.sections.map((s) => (
21
+ <section>
22
+ <h2>{s.heading}</h2>
23
+ <p>{s.body}</p>
24
+ </section>
25
+ ))}
26
+ </LegalLayout>
27
+
28
+ <style>
29
+ .ew-demo-disclaimer {
30
+ border: 3px solid var(--ew-danger, #b00020);
31
+ background: var(--ew-surface, #fff);
32
+ padding: var(--ew-space-4, 1rem);
33
+ margin: 0 0 var(--ew-space-6, 2rem);
34
+ text-align: center;
35
+ }
36
+ </style>
@@ -0,0 +1,170 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import {
3
+ composeContentTraitSchema,
4
+ contentCompositionSchema,
5
+ contentTypeDefinitionSchema,
6
+ moneyTraitSchema,
7
+ presentationBindings,
8
+ } from '../index.js';
9
+
10
+ const localization = {
11
+ contentLocales: ['de', 'en'],
12
+ } as const;
13
+
14
+ const genericTypes = [
15
+ {
16
+ name: 'configured product',
17
+ definition: {
18
+ id: 'catalog-item',
19
+ primary: true,
20
+ labels: { de: 'Produkte', en: 'Products' },
21
+ routes: { de: '/produkte/', en: '/en/products/' },
22
+ traits: ['title', 'slug', 'summary', 'body', 'image', 'cta', 'money', 'featured'],
23
+ bindings: ['homepage', 'list', 'detail', 'navigation', 'cms-admin'],
24
+ currency: 'EUR',
25
+ },
26
+ },
27
+ {
28
+ name: 'scheduled event',
29
+ definition: {
30
+ id: 'scheduled-event',
31
+ labels: { de: 'Termine', en: 'Events' },
32
+ routes: { de: '/termine/', en: '/en/events/' },
33
+ traits: ['title', 'slug', 'summary', 'body', 'schedule', 'location'],
34
+ bindings: ['list', 'detail', 'navigation', 'cms-admin'],
35
+ },
36
+ },
37
+ {
38
+ name: 'gallery item',
39
+ definition: {
40
+ id: 'gallery-item',
41
+ labels: { de: 'Galerie', en: 'Gallery' },
42
+ routes: { de: '/galerie/', en: '/en/gallery/' },
43
+ traits: ['title', 'slug', 'image', 'photos'],
44
+ bindings: ['list', 'navigation', 'cms-admin'],
45
+ },
46
+ },
47
+ ] as const;
48
+
49
+ describe('content composition contracts', () => {
50
+ it.each(genericTypes)('accepts a valid $name', ({ definition }) => {
51
+ // Given / When
52
+ const result = contentCompositionSchema.safeParse({ ...localization, contentTypes: [definition] });
53
+
54
+ // Then
55
+ expect(result.success).toBe(true);
56
+ });
57
+
58
+ it('keeps the presentation binding set closed', () => {
59
+ // Given / When
60
+ const result = contentTypeDefinitionSchema.safeParse({
61
+ ...genericTypes[2].definition,
62
+ bindings: ['search'],
63
+ });
64
+
65
+ // Then
66
+ expect(presentationBindings).toEqual(['homepage', 'list', 'detail', 'navigation', 'cms-admin']);
67
+ expect(result.success).toBe(false);
68
+ });
69
+
70
+ it('rejects a detail binding when the body trait is missing', () => {
71
+ // Given
72
+ const definition = { ...genericTypes[2].definition, bindings: ['detail'] };
73
+
74
+ // When
75
+ const result = contentCompositionSchema.safeParse({ ...localization, contentTypes: [definition] });
76
+
77
+ // Then
78
+ expect(result.error?.issues[0]?.message).toContain('Binding "detail" requires trait(s): body');
79
+ });
80
+
81
+ it('rejects a second primary content type', () => {
82
+ // Given
83
+ const definitions = genericTypes.slice(0, 2).map(({ definition }) => ({ ...definition, primary: true }));
84
+
85
+ // When
86
+ const result = contentCompositionSchema.safeParse({ ...localization, contentTypes: definitions });
87
+
88
+ // Then
89
+ expect(result.error?.issues.some((issue) => issue.message.includes('Only one primary content type'))).toBe(true);
90
+ });
91
+
92
+ it('rejects a reserved content route', () => {
93
+ // Given
94
+ const definition = { ...genericTypes[2].definition, routes: { de: '/admin/', en: '/en/gallery/' } };
95
+
96
+ // When
97
+ const result = contentCompositionSchema.safeParse({ ...localization, contentTypes: [definition] });
98
+
99
+ // Then
100
+ expect(result.error?.issues.some((issue) => issue.message.includes('Route "/admin/" is reserved'))).toBe(true);
101
+ });
102
+
103
+ it('rejects homepage binding without the featured trait', () => {
104
+ // Given
105
+ const definition = { ...genericTypes[2].definition, bindings: ['homepage'] };
106
+
107
+ // When
108
+ const result = contentCompositionSchema.safeParse({ ...localization, contentTypes: [definition] });
109
+
110
+ // Then
111
+ expect(result.error?.issues.some((issue) => issue.message.includes('featured'))).toBe(true);
112
+ });
113
+
114
+ it.each([
115
+ ['duplicate content type ID', { contentTypes: [genericTypes[1].definition, genericTypes[1].definition] }, 'Duplicate content type ID'],
116
+ ['missing localized label', { contentTypes: [{ ...genericTypes[1].definition, labels: { de: 'Termine' } }] }, 'Missing configured locale(s): en'],
117
+ ['colliding content route', {
118
+ contentTypes: [genericTypes[1].definition, { ...genericTypes[2].definition, routes: genericTypes[1].definition.routes }],
119
+ }, 'collides with content type'],
120
+ ] as const)('rejects %s', (_name, input, message) => {
121
+ // Given / When
122
+ const result = contentCompositionSchema.safeParse({ ...localization, ...input });
123
+
124
+ // Then
125
+ expect(result.error?.issues.some((issue) => issue.message.includes(message))).toBe(true);
126
+ });
127
+
128
+ it('requires currency only on money-enabled content selections', () => {
129
+ // Given / When
130
+ const missingMoneyCurrency = contentTypeDefinitionSchema.safeParse({
131
+ ...genericTypes[0].definition,
132
+ currency: undefined,
133
+ });
134
+ const currencyOnNonMoney = contentTypeDefinitionSchema.safeParse({
135
+ ...genericTypes[2].definition,
136
+ currency: 'EUR',
137
+ });
138
+
139
+ // Then
140
+ expect(missingMoneyCurrency.success).toBe(true);
141
+ expect(currencyOnNonMoney.success).toBe(false);
142
+ });
143
+ });
144
+
145
+ describe('content trait data schemas', () => {
146
+ it('composes selected trait shapes without allowing unselected fields', () => {
147
+ // Given
148
+ const schema = composeContentTraitSchema(['title', 'slug']);
149
+
150
+ // When
151
+ const selected = schema.safeParse({ title: 'Example', slug: 'example' });
152
+ const unselected = schema.safeParse({ title: 'Example', slug: 'example', currency: 'EUR' });
153
+
154
+ // Then
155
+ expect(selected.success).toBe(true);
156
+ expect(unselected.success).toBe(false);
157
+ });
158
+
159
+ it.each([
160
+ ['EUR', true],
161
+ ['usd', false],
162
+ ['ZZZ', false],
163
+ ] as const)('validates money currency %s', (currency, expected) => {
164
+ // Given / When
165
+ const result = moneyTraitSchema.safeParse({ amount: 25, currency });
166
+
167
+ // Then
168
+ expect(result.success).toBe(expected);
169
+ });
170
+ });
@@ -1,6 +1,20 @@
1
1
  import type { AstroComponentFactory } from 'astro/runtime/server/index.js';
2
+ import type { CurrencyCode } from '../i18n/locale-inputs.js';
3
+ import type { Link } from './types.js';
2
4
  import type { Image } from './types.js';
3
5
 
6
+ export interface HasTitle {
7
+ readonly title: string;
8
+ }
9
+
10
+ export interface HasSlug {
11
+ readonly slug: string;
12
+ }
13
+
14
+ export interface HasSummary {
15
+ readonly summary: string;
16
+ }
17
+
4
18
  export interface HasImage {
5
19
  image: Image;
6
20
  }
@@ -9,6 +23,41 @@ export interface HasPhotos {
9
23
  photos: Image[];
10
24
  }
11
25
 
26
+ export interface HasOrder {
27
+ readonly order: number;
28
+ }
29
+
30
+ export interface HasTaxonomy {
31
+ readonly taxonomy: readonly string[];
32
+ }
33
+
34
+ export interface HasPublication {
35
+ readonly publishDate: Date;
36
+ readonly modifiedDate?: Date;
37
+ }
38
+
39
+ export interface HasSchedule {
40
+ readonly startDate: Date;
41
+ readonly endDate?: Date;
42
+ }
43
+
44
+ export interface HasLocation {
45
+ readonly location: string;
46
+ }
47
+
48
+ export interface HasCta {
49
+ readonly cta: Link;
50
+ }
51
+
52
+ export interface HasMoney {
53
+ readonly amount: number;
54
+ readonly currency: CurrencyCode;
55
+ }
56
+
57
+ export interface HasFeatured {
58
+ readonly featured: boolean;
59
+ }
60
+
12
61
  export type RenderedContent = AstroComponentFactory;
13
62
 
14
63
  export interface HasBody {
@@ -0,0 +1,176 @@
1
+ import { z } from 'astro/zod';
2
+ import { contentLocaleSchema, optionalCurrencyCodeSchema } from '../i18n/locale-inputs.js';
3
+ import { normalizeLocalizedPath, validateLocalizedPaths } from '../i18n/localized-paths.js';
4
+ import { contentTraitSchema, type ContentTrait } from './traits.js';
5
+
6
+ export const presentationBindings = ['homepage', 'list', 'detail', 'navigation', 'cms-admin'] as const;
7
+ export const presentationBindingSchema = z.enum(presentationBindings);
8
+ export type PresentationBinding = z.infer<typeof presentationBindingSchema>;
9
+
10
+ export const presentationBindingRequirements = {
11
+ homepage: ['title', 'slug', 'image', 'featured'],
12
+ list: ['title', 'slug'],
13
+ detail: ['title', 'slug', 'body'],
14
+ navigation: ['title', 'slug'],
15
+ 'cms-admin': ['title', 'slug'],
16
+ } as const satisfies Readonly<Record<PresentationBinding, readonly ContentTrait[]>>;
17
+
18
+ export const contentTypeIdSchema = z.string()
19
+ .regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/, 'Content type ID must use lowercase kebab-case')
20
+ .brand<'ContentTypeId'>();
21
+ export type ContentTypeId = z.infer<typeof contentTypeIdSchema>;
22
+
23
+ const localizedTextSchema = z.record(z.string(), z.string().min(1)).readonly();
24
+ const localizedRoutesSchema = z.record(
25
+ z.string(),
26
+ z.string().regex(/^\/(?!\/)(?!.*[?#]).*$/, 'Route must be an absolute path without query or hash'),
27
+ ).readonly();
28
+ const selectedTraitsSchema = z.array(contentTraitSchema).min(1).superRefine((traits, context) => {
29
+ if (new Set(traits).size !== traits.length) {
30
+ context.addIssue({ code: z.ZodIssueCode.custom, message: 'Selected traits must be unique' });
31
+ }
32
+ }).readonly();
33
+ const selectedBindingsSchema = z.array(presentationBindingSchema).min(1).superRefine((bindings, context) => {
34
+ if (new Set(bindings).size !== bindings.length) {
35
+ context.addIssue({ code: z.ZodIssueCode.custom, message: 'Selected bindings must be unique' });
36
+ }
37
+ }).readonly();
38
+
39
+ const contentTypeBaseShape = {
40
+ id: contentTypeIdSchema,
41
+ primary: z.boolean().default(false),
42
+ labels: localizedTextSchema,
43
+ routes: localizedRoutesSchema,
44
+ bindings: selectedBindingsSchema,
45
+ };
46
+
47
+ const moneyContentTypeSchema = z.object({
48
+ ...contentTypeBaseShape,
49
+ traits: selectedTraitsSchema.refine((traits) => traits.includes('money'), 'Money selection must include the money trait'),
50
+ currency: optionalCurrencyCodeSchema,
51
+ }).strict().readonly();
52
+
53
+ const nonMoneyContentTypeSchema = z.object({
54
+ ...contentTypeBaseShape,
55
+ traits: selectedTraitsSchema.refine((traits) => !traits.includes('money'), 'Non-money selection cannot include the money trait'),
56
+ }).strict().readonly();
57
+
58
+ export const contentTypeDefinitionSchema = z.union([moneyContentTypeSchema, nonMoneyContentTypeSchema]);
59
+ export type ContentTypeDefinition = z.infer<typeof contentTypeDefinitionSchema>;
60
+
61
+ export const defaultReservedContentRoutes = ['/', '/404/', '/admin/'] as const;
62
+
63
+ export const contentCompositionSchema = z.object({
64
+ contentLocales: z.array(contentLocaleSchema).min(1).readonly(),
65
+ contentTypes: z.array(contentTypeDefinitionSchema).readonly(),
66
+ reservedRoutes: z.array(z.string()).default(() => [...defaultReservedContentRoutes]).readonly(),
67
+ }).strict().superRefine((composition, context) => {
68
+ const locales = composition.contentLocales;
69
+ const normalizedReserved = new Set(composition.reservedRoutes.map(normalizeLocalizedPath));
70
+ const ids = new Map<string, number>();
71
+ const routes = new Map<string, string>();
72
+ let primaryId: string | undefined;
73
+
74
+ composition.contentTypes.forEach((contentType, index) => {
75
+ const path = ['contentTypes', index] as const;
76
+ const existingId = ids.get(contentType.id);
77
+ if (existingId !== undefined) {
78
+ context.addIssue({
79
+ code: z.ZodIssueCode.custom,
80
+ path: [...path, 'id'],
81
+ message: `Duplicate content type ID "${contentType.id}"; first declared at contentTypes[${existingId}]`,
82
+ });
83
+ } else {
84
+ ids.set(contentType.id, index);
85
+ }
86
+
87
+ if (contentType.primary) {
88
+ if (primaryId !== undefined) {
89
+ context.addIssue({
90
+ code: z.ZodIssueCode.custom,
91
+ path: [...path, 'primary'],
92
+ message: `Only one primary content type is allowed; "${primaryId}" is already primary`,
93
+ });
94
+ } else {
95
+ primaryId = contentType.id;
96
+ }
97
+ }
98
+
99
+ validateLocales(contentType, locales, path, context);
100
+ validateBindings(contentType, path, context);
101
+ validateRoutes(contentType, path, normalizedReserved, routes, context);
102
+ });
103
+ }).readonly();
104
+
105
+ export type ContentComposition = z.infer<typeof contentCompositionSchema>;
106
+
107
+ function validateLocales(
108
+ contentType: ContentTypeDefinition,
109
+ locales: readonly string[],
110
+ path: readonly (string | number)[],
111
+ context: z.RefinementCtx,
112
+ ): void {
113
+ for (const [name, localized] of [['labels', contentType.labels], ['routes', contentType.routes]] as const) {
114
+ const declared = Object.keys(localized);
115
+ const missing = locales.filter((locale) => !declared.includes(locale));
116
+ const unknown = declared.filter((locale) => !locales.includes(locale));
117
+ if (missing.length > 0) context.addIssue({
118
+ code: z.ZodIssueCode.custom,
119
+ path: [...path, name],
120
+ message: `Missing configured locale(s): ${missing.join(', ')}`,
121
+ });
122
+ if (unknown.length > 0) context.addIssue({
123
+ code: z.ZodIssueCode.custom,
124
+ path: [...path, name],
125
+ message: `Unknown content locale(s): ${unknown.join(', ')}`,
126
+ });
127
+ }
128
+
129
+ for (const problem of validateLocalizedPaths([contentType.routes], locales)) {
130
+ context.addIssue({ code: z.ZodIssueCode.custom, path: [...path, 'routes'], message: problem });
131
+ }
132
+ }
133
+
134
+ function validateBindings(
135
+ contentType: ContentTypeDefinition,
136
+ path: readonly (string | number)[],
137
+ context: z.RefinementCtx,
138
+ ): void {
139
+ const selected = new Set(contentType.traits);
140
+ for (const binding of contentType.bindings) {
141
+ const missing = presentationBindingRequirements[binding].filter((trait) => !selected.has(trait));
142
+ if (missing.length > 0) context.addIssue({
143
+ code: z.ZodIssueCode.custom,
144
+ path: [...path, 'bindings'],
145
+ message: `Binding "${binding}" requires trait(s): ${missing.join(', ')}`,
146
+ });
147
+ }
148
+ }
149
+
150
+ function validateRoutes(
151
+ contentType: ContentTypeDefinition,
152
+ path: readonly (string | number)[],
153
+ reserved: ReadonlySet<string>,
154
+ routes: Map<string, string>,
155
+ context: z.RefinementCtx,
156
+ ): void {
157
+ for (const route of Object.values(contentType.routes)) {
158
+ const normalized = normalizeLocalizedPath(route);
159
+ if (reserved.has(normalized)) context.addIssue({
160
+ code: z.ZodIssueCode.custom,
161
+ path: [...path, 'routes'],
162
+ message: `Route "${route}" is reserved`,
163
+ });
164
+ const owner = routes.get(normalized);
165
+ if (owner !== undefined && owner !== contentType.id) context.addIssue({
166
+ code: z.ZodIssueCode.custom,
167
+ path: [...path, 'routes'],
168
+ message: `Route "${route}" collides with content type "${owner}"`,
169
+ });
170
+ routes.set(normalized, contentType.id);
171
+ }
172
+ }
173
+
174
+ export function parseContentComposition(input: unknown): ContentComposition {
175
+ return contentCompositionSchema.parse(input);
176
+ }
@@ -1,6 +1,8 @@
1
1
  export * from './capabilities.js';
2
+ export * from './content-composition.js';
2
3
  export * from './implements.js';
3
4
  export * from './props.js';
4
5
  export * from './publish.js';
5
6
  export * from './types.js';
7
+ export * from './traits.js';
6
8
  export * from './jsonld.js';