@fifthbell/brokaw 0.1.71 → 0.1.74
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/README.md +106 -1
- package/dist/captured-catalog-browser.d.ts +26 -0
- package/dist/captured-catalog-browser.js +42 -0
- package/dist/captured-catalog-reader.d.ts +16 -0
- package/dist/captured-catalog-reader.js +113 -0
- package/dist/captured-catalog.d.ts +28 -0
- package/dist/captured-catalog.js +138 -0
- package/dist/components/live-program/LiveProgram.js +119 -311
- package/dist/components/live-program/components/WorldClocks.js +2 -1
- package/dist/components/live-program/components/slides/LiveEventSlide.js +2 -4
- package/dist/components/live-program/events.d.ts +7 -0
- package/dist/components/live-program/events.js +28 -5
- package/dist/components/live-program/hooks/useSSE.js +1 -2
- package/dist/components/live-program/i18n.js +1 -1
- package/dist/components/live-program/live-program-config.d.ts +70 -0
- package/dist/components/live-program/live-program-config.js +228 -0
- package/dist/components/live-program/program-data.d.ts +22 -0
- package/dist/components/live-program/program-data.js +23 -0
- package/dist/components/live-program/program-reload.d.ts +11 -0
- package/dist/components/live-program/program-reload.js +21 -0
- package/dist/components/live-program/segments/ArticlesSegment.d.ts +5 -0
- package/dist/components/live-program/segments/ArticlesSegment.js +15 -11
- package/dist/components/live-program/segments/EarthquakeSegment.d.ts +4 -0
- package/dist/components/live-program/segments/EarthquakeSegment.js +13 -10
- package/dist/components/live-program/segments/MarketsSegment.js +7 -2
- package/dist/components/live-program/segments/WeatherSegment.d.ts +5 -0
- package/dist/components/live-program/segments/WeatherSegment.js +7 -2
- package/dist/components/live-program/segments/fetchLiveEvents.d.ts +6 -0
- package/dist/components/live-program/segments/fetchLiveEvents.js +42 -27
- package/dist/components/live-program/source-retention.d.ts +14 -0
- package/dist/components/live-program/source-retention.js +26 -0
- package/dist/cronkite-manifest.d.ts +35 -0
- package/dist/cronkite-manifest.js +5 -26
- package/dist/cronkite-manifest.json +48 -1
- package/dist/ignored-input.d.ts +14 -0
- package/dist/ignored-input.js +48 -0
- package/dist/layouts.d.ts +1 -1
- package/dist/live-program-page/index.html +2 -2
- package/dist/live-program-page/live-program-manifest.json +8 -8
- package/dist/live-program-page/live-program.v0.1.74.css +3 -0
- package/dist/live-program-page/live-program.v0.1.74.js +76 -0
- package/dist/live-program-release.js +6 -3
- package/dist/manifest-validation.js +3 -1
- package/dist/renderer.browser.js +2 -0
- package/dist/renderer.core.js +56 -21
- package/dist/renderer.d.ts +1 -0
- package/dist/renderer.js +1 -0
- package/dist/rum.d.ts +1 -1
- package/dist/rum.js +3 -1
- package/dist/schemas/canonical-document.schema.json +103 -15
- package/dist/schemas/feed-renderable-input.schema.json +0 -1
- package/dist/schemas/live-program-release-input.schema.json +0 -1
- package/dist/schemas/social-image-input.schema.json +0 -1
- package/dist/system-pages.d.ts +66 -0
- package/dist/system-pages.js +35 -0
- package/dist/types/canonical-article.js +3 -2
- package/dist/types/canonical-document-schema.generated.d.ts +168 -24
- package/dist/types/canonical-document-schema.generated.js +218 -32
- package/dist/types/canonical-document.generated.d.ts +74 -6
- package/dist/types/live-program-release-input.generated.d.ts +1 -0
- package/package.json +10 -4
- package/src/partial-deps.json +9 -0
- package/src/styles/compiled.css +1 -1
- package/src/templates/partials/blocks/tiktok.hbs +10 -8
- package/src/templates/partials/components/article-main.hbs +6 -5
- package/src/templates/partials/components/breaking-news.hbs +18 -14
- package/src/templates/partials/components/live-story/main.hbs +18 -14
- package/src/templates/partials/components/media/main.hbs +3 -2
- package/src/templates/partials/components/search/main.hbs +3 -3
- package/src/templates/partials/headers/header-main.hbs +11 -19
- package/src/templates/partials/shell/captured-catalog.hbs +1 -0
- package/dist/live-program-page/live-program.v0.1.71.css +0 -3
- package/dist/live-program-page/live-program.v0.1.71.js +0 -76
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { liveProgramPageFiles, } from "./renderer.node.js";
|
|
2
|
+
import { recordUnknownMembers } from "./ignored-input.js";
|
|
2
3
|
import { version } from "./version.js";
|
|
3
4
|
const PROGRAM_ID = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
4
5
|
function validateInput(input) {
|
|
@@ -6,10 +7,12 @@ function validateInput(input) {
|
|
|
6
7
|
throw new Error("live-program release input must be an object");
|
|
7
8
|
}
|
|
8
9
|
const values = input;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
// Both members are required; any other member is ignored and counted
|
|
11
|
+
// (gaulatti/ariston#217), and never reaches the page.
|
|
12
|
+
if (!Object.hasOwn(values, "apiBaseUrl") || !Object.hasOwn(values, "programId")) {
|
|
13
|
+
throw new Error("live-program release input requires apiBaseUrl and programId");
|
|
12
14
|
}
|
|
15
|
+
recordUnknownMembers(values, ["apiBaseUrl", "programId"], "live_program_release_field");
|
|
13
16
|
if (typeof values.programId !== "string" ||
|
|
14
17
|
!PROGRAM_ID.test(values.programId) ||
|
|
15
18
|
values.programId.length > 128) {
|
|
@@ -18,6 +18,8 @@ export function assertManifestAlignment(manifest, sources) {
|
|
|
18
18
|
if (!rendering.renderables[page.renderable]) {
|
|
19
19
|
throw new Error(`system page uses undeclared renderable: ${page.renderable}`);
|
|
20
20
|
}
|
|
21
|
-
assertSameOrderedValues(`system page ${page.renderable} languages`, page.variants.map((variant) => String(variant.document.language)).sort(),
|
|
21
|
+
assertSameOrderedValues(`system page ${page.renderable} languages`, page.variants.map((variant) => String(variant.document.language)).sort(), page.renderable === 'media-page'
|
|
22
|
+
? [sources.defaultLanguage]
|
|
23
|
+
: [...sources.languages].sort());
|
|
22
24
|
}
|
|
23
25
|
}
|
package/dist/renderer.browser.js
CHANGED
|
@@ -15,6 +15,7 @@ import shellDocStartStandardHbs from './templates/partials/shell/doc-start-stand
|
|
|
15
15
|
import shellDocStart404Hbs from './templates/partials/shell/doc-start-404.hbs?raw';
|
|
16
16
|
import shellRumLoaderHbs from './templates/partials/shell/rum-loader.hbs?raw';
|
|
17
17
|
import shellDocEndHbs from './templates/partials/shell/doc-end.hbs?raw';
|
|
18
|
+
import shellCapturedCatalogHbs from './templates/partials/shell/captured-catalog.hbs?raw';
|
|
18
19
|
import blockRichTextHbs from './templates/partials/blocks/rich-text.hbs?raw';
|
|
19
20
|
import blockHeadingHbs from './templates/partials/blocks/heading.hbs?raw';
|
|
20
21
|
import blockImageHbs from './templates/partials/blocks/image.hbs?raw';
|
|
@@ -88,6 +89,7 @@ const assets = {
|
|
|
88
89
|
'shell/doc-start-404': shellDocStart404Hbs,
|
|
89
90
|
'shell/rum-loader': shellRumLoaderHbs,
|
|
90
91
|
'shell/doc-end': shellDocEndHbs,
|
|
92
|
+
'shell/captured-catalog': shellCapturedCatalogHbs,
|
|
91
93
|
'blocks/rich-text': blockRichTextHbs,
|
|
92
94
|
'blocks/heading': blockHeadingHbs,
|
|
93
95
|
'blocks/image': blockImageHbs,
|
package/dist/renderer.core.js
CHANGED
|
@@ -1,22 +1,57 @@
|
|
|
1
1
|
import Handlebars from 'handlebars';
|
|
2
|
+
import { recordIgnoredInput } from './ignored-input.js';
|
|
2
3
|
import { layoutNames } from './layouts.js';
|
|
3
4
|
import { canonicalArticleSchema } from './types/canonical-article.js';
|
|
4
5
|
let initialized = false;
|
|
5
6
|
const layoutCache = new Map();
|
|
6
7
|
const removedBlockTypes = new Set(['truthSocial', 'truthsocial', 'truth-social', 'truth_social']);
|
|
8
|
+
// The block types, info-box tones and hero layouts this release renders. The
|
|
9
|
+
// contract accepts any other value (gaulatti/ariston#217); it is ignored,
|
|
10
|
+
// counted, and given the fallback below.
|
|
11
|
+
const knownBlockTypes = new Set([
|
|
12
|
+
'richText', 'heading', 'image', 'list', 'divider', 'infoBox', 'keyPoints', 'dataTable',
|
|
13
|
+
'liveUpdate', 'audio', 'youtube', 'x', 'instagram', 'tiktok', 'spotify', 'pullQuote'
|
|
14
|
+
]);
|
|
15
|
+
const knownHeadingLevels = new Set([2, 3, 4]);
|
|
16
|
+
const knownInfoBoxTones = new Set(['neutral', 'info', 'warning', 'success']);
|
|
17
|
+
const knownHeroLayouts = new Set(['spotlight', 'editorial']);
|
|
18
|
+
function normalizeBlock(block) {
|
|
19
|
+
if (!block || typeof block !== 'object')
|
|
20
|
+
return [block];
|
|
21
|
+
const record = block;
|
|
22
|
+
if (typeof record.type !== 'string')
|
|
23
|
+
return [block];
|
|
24
|
+
if (removedBlockTypes.has(record.type))
|
|
25
|
+
return [];
|
|
26
|
+
if (!knownBlockTypes.has(record.type)) {
|
|
27
|
+
// Fallback: a block this release does not render is dropped.
|
|
28
|
+
recordIgnoredInput('document_body_block_type');
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
if (record.type === 'heading' && typeof record.level === 'number' && !knownHeadingLevels.has(record.level)) {
|
|
32
|
+
// Fallback: an unknown heading level renders as level 2.
|
|
33
|
+
recordIgnoredInput('document_heading_level');
|
|
34
|
+
return [{ ...record, level: 2 }];
|
|
35
|
+
}
|
|
36
|
+
if (record.type === 'infoBox' && typeof record.tone === 'string' && !knownInfoBoxTones.has(record.tone)) {
|
|
37
|
+
// Fallback: an unknown tone renders as neutral.
|
|
38
|
+
recordIgnoredInput('document_info_box_tone');
|
|
39
|
+
return [{ ...record, tone: 'neutral' }];
|
|
40
|
+
}
|
|
41
|
+
return [block];
|
|
42
|
+
}
|
|
7
43
|
function normalizeDocument(doc) {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
44
|
+
const source = doc;
|
|
45
|
+
let normalized = doc;
|
|
46
|
+
if (typeof source.heroLayout === 'string' && !knownHeroLayouts.has(source.heroLayout)) {
|
|
47
|
+
// Fallback: an unknown hero layout is treated as absent.
|
|
48
|
+
recordIgnoredInput('document_hero_layout');
|
|
49
|
+
const { heroLayout: _ignored, ...rest } = normalized;
|
|
50
|
+
normalized = rest;
|
|
51
|
+
}
|
|
52
|
+
if (Array.isArray(source.body))
|
|
53
|
+
normalized = { ...normalized, body: source.body.flatMap(normalizeBlock) };
|
|
54
|
+
return normalized;
|
|
20
55
|
}
|
|
21
56
|
function registerHelpers() {
|
|
22
57
|
Handlebars.registerHelper('eq', (a, b) => a === b);
|
|
@@ -51,8 +86,12 @@ function registerHelpers() {
|
|
|
51
86
|
'sofascore-match': 'https://www.sofascore.com/football/match#id:{id}'
|
|
52
87
|
};
|
|
53
88
|
const template = typeof name === 'string' ? templates[name] : undefined;
|
|
54
|
-
if (!template)
|
|
55
|
-
|
|
89
|
+
if (!template) {
|
|
90
|
+
// As Cronkite's helper: an undeclared provider yields '', and every
|
|
91
|
+
// template guards its embed, so nothing renders (gaulatti/ariston#217).
|
|
92
|
+
recordIgnoredInput('embed_provider');
|
|
93
|
+
return '';
|
|
94
|
+
}
|
|
56
95
|
return template.replace(/\{([A-Za-z][A-Za-z0-9]*)\}/g, (_token, parameter) => {
|
|
57
96
|
const value = options.hash[parameter];
|
|
58
97
|
if (value === undefined || value === null || value === '') {
|
|
@@ -129,13 +168,9 @@ export function renderWithAssets(doc, assets) {
|
|
|
129
168
|
initializeHandlebars(assets);
|
|
130
169
|
}
|
|
131
170
|
const requestedLayout = doc.layout;
|
|
132
|
-
|
|
133
|
-
throw new Error(`Unknown layout "${requestedLayout ?? 'undefined'}". Expected one of: ${layoutNames.join(', ')}`);
|
|
134
|
-
}
|
|
135
|
-
const parsed = canonicalArticleSchema.parse(normalizeDocument(doc));
|
|
136
|
-
const template = layoutCache.get(parsed.layout);
|
|
171
|
+
const template = requestedLayout ? layoutCache.get(requestedLayout) : undefined;
|
|
137
172
|
if (!template) {
|
|
138
|
-
throw new Error(`
|
|
173
|
+
throw new Error(`Unknown layout "${requestedLayout ?? 'undefined'}". Expected one of: ${layoutNames.join(', ')}`);
|
|
139
174
|
}
|
|
140
|
-
return template(
|
|
175
|
+
return template(canonicalArticleSchema.parse(normalizeDocument(doc)));
|
|
141
176
|
}
|
package/dist/renderer.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { liveProgramReleaseFiles } from './live-program-release.js';
|
|
|
4
4
|
export { buildInstagramImageHtml, type InstagramImageTemplateParams } from './instagram-image-template.js';
|
|
5
5
|
export { outletConfig } from './outlet-config.js';
|
|
6
6
|
export { version } from './version.js';
|
|
7
|
+
export { IGNORED_INPUT_REASONS, ignoredInputCounts, type IgnoredInputReason } from './ignored-input.js';
|
|
7
8
|
export { cronkiteManifest } from './cronkite-manifest.js';
|
|
8
9
|
export { PROGRAM_TEMPLATE_CONTRACT_VERSION, PROGRAM_TEMPLATE_KIND, liveProgramTemplateContract } from './program-template-manifest.js';
|
|
9
10
|
export type { ProgramTemplateContract } from './program-template-manifest.js';
|
package/dist/renderer.js
CHANGED
|
@@ -3,5 +3,6 @@ export { liveProgramReleaseFiles } from './live-program-release.js';
|
|
|
3
3
|
export { buildInstagramImageHtml } from './instagram-image-template.js';
|
|
4
4
|
export { outletConfig } from './outlet-config.js';
|
|
5
5
|
export { version } from './version.js';
|
|
6
|
+
export { IGNORED_INPUT_REASONS, ignoredInputCounts } from './ignored-input.js';
|
|
6
7
|
export { cronkiteManifest } from './cronkite-manifest.js';
|
|
7
8
|
export { PROGRAM_TEMPLATE_CONTRACT_VERSION, PROGRAM_TEMPLATE_KIND, liveProgramTemplateContract } from './program-template-manifest.js';
|
package/dist/rum.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const rumConfigSchema: z.ZodObject<{
|
|
|
5
5
|
region: z.ZodString;
|
|
6
6
|
identityPoolId: z.ZodString;
|
|
7
7
|
guestRoleArn: z.ZodString;
|
|
8
|
-
}, z.core.$
|
|
8
|
+
}, z.core.$strip>;
|
|
9
9
|
export type RumConfig = z.infer<typeof rumConfigSchema>;
|
|
10
10
|
type RumPageType = 'article-page' | 'homepage' | 'category-page' | 'search-page' | '404' | 'live-story' | 'link-in-bio' | 'media-page';
|
|
11
11
|
type ContentLanguage = 'en' | 'es' | 'it';
|
package/dist/rum.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { recordUnknownMembers } from './ignored-input.js';
|
|
2
3
|
const awsRegion = z.string().regex(/^[a-z]{2}(?:-gov)?-[a-z]+-\d$/);
|
|
3
4
|
const uuid = z.string().uuid();
|
|
4
5
|
export const rumConfigSchema = z
|
|
@@ -11,7 +12,7 @@ export const rumConfigSchema = z
|
|
|
11
12
|
.string()
|
|
12
13
|
.regex(/^arn:(?:aws|aws-us-gov|aws-cn):iam::\d{12}:role\/[A-Za-z0-9+=,.@_\/-]{1,512}$/)
|
|
13
14
|
})
|
|
14
|
-
|
|
15
|
+
// Members other than these are stripped and never rendered (gaulatti/ariston#217).
|
|
15
16
|
.superRefine((config, context) => {
|
|
16
17
|
if (!config.identityPoolId.startsWith(`${config.region}:`)) {
|
|
17
18
|
context.addIssue({
|
|
@@ -34,6 +35,7 @@ const jsonForInlineScript = (value) => JSON.stringify(value)
|
|
|
34
35
|
*/
|
|
35
36
|
export function renderRumLoader(config, pageType, language) {
|
|
36
37
|
const parsed = rumConfigSchema.parse(config);
|
|
38
|
+
recordUnknownMembers(config, Object.keys(parsed), 'rum_config_field');
|
|
37
39
|
const endpoint = `https://dataplane.rum.${parsed.region}.amazonaws.com`;
|
|
38
40
|
return `<script data-brokaw-rum-loader>
|
|
39
41
|
(function () {
|
|
@@ -36,6 +36,28 @@
|
|
|
36
36
|
"description": "An open language tag. The active renderer declares the allowed set for each request.",
|
|
37
37
|
"examples": ["en", "pt-BR", "zh-Hant-TW"]
|
|
38
38
|
},
|
|
39
|
+
"capturedSelection": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"description": "CMS-issued captured-catalog selection (Brokaw captured-catalog contract v1). When present, every runtime reader on the page reads this selection instead of its current source; the browser adapter validates it in full. Members other than these are ignored and counted.",
|
|
42
|
+
"properties": {
|
|
43
|
+
"selectionId": { "type": "string", "minLength": 1, "maxLength": 200 },
|
|
44
|
+
"catalogUrl": { "type": "string", "format": "uri", "pattern": "^https://" },
|
|
45
|
+
"context": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"properties": {
|
|
48
|
+
"rendererVersion": { "type": "string", "minLength": 1, "maxLength": 200 },
|
|
49
|
+
"templateVersion": { "type": "string", "minLength": 1, "maxLength": 200 },
|
|
50
|
+
"tenant": { "type": "string", "minLength": 1, "maxLength": 200 },
|
|
51
|
+
"origin": { "type": "string", "format": "uri", "pattern": "^https://" },
|
|
52
|
+
"build": { "type": "string", "minLength": 1, "maxLength": 200 }
|
|
53
|
+
},
|
|
54
|
+
"required": ["rendererVersion", "templateVersion", "tenant", "origin", "build"],
|
|
55
|
+
"description": "Members other than these are ignored."
|
|
56
|
+
},
|
|
57
|
+
"locale": { "type": "string", "enum": ["en", "es", "it"] }
|
|
58
|
+
},
|
|
59
|
+
"required": ["selectionId", "catalogUrl", "context", "locale"]
|
|
60
|
+
},
|
|
39
61
|
"rumConfig": {
|
|
40
62
|
"type": "object",
|
|
41
63
|
"properties": {
|
|
@@ -116,11 +138,9 @@
|
|
|
116
138
|
"type": { "type": "string", "const": "heading" },
|
|
117
139
|
"text": { "type": "string" },
|
|
118
140
|
"level": {
|
|
119
|
-
"
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
{ "type": "number", "const": 4 }
|
|
123
|
-
]
|
|
141
|
+
"type": "number",
|
|
142
|
+
"description": "2, 3 or 4. Any other number renders as 2.",
|
|
143
|
+
"examples": [2, 3, 4]
|
|
124
144
|
}
|
|
125
145
|
},
|
|
126
146
|
"required": ["type", "text"]
|
|
@@ -162,7 +182,8 @@
|
|
|
162
182
|
"title": { "type": "string" },
|
|
163
183
|
"tone": {
|
|
164
184
|
"type": "string",
|
|
165
|
-
"
|
|
185
|
+
"description": "neutral, info, warning or success. Any other value renders as neutral.",
|
|
186
|
+
"examples": ["neutral", "info", "warning", "success"]
|
|
166
187
|
},
|
|
167
188
|
"html": { "type": "string" }
|
|
168
189
|
},
|
|
@@ -285,6 +306,14 @@
|
|
|
285
306
|
"attribution": { "type": "string" }
|
|
286
307
|
},
|
|
287
308
|
"required": ["type", "text"]
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"type": "object",
|
|
312
|
+
"description": "A block type this contract does not define. It is accepted and not rendered.",
|
|
313
|
+
"properties": {
|
|
314
|
+
"type": { "type": "string", "not": { "enum": ["richText", "heading", "image", "list", "divider", "infoBox", "keyPoints", "dataTable", "liveUpdate", "audio", "youtube", "x", "instagram", "tiktok", "spotify", "pullQuote"] } }
|
|
315
|
+
},
|
|
316
|
+
"required": ["type"]
|
|
288
317
|
}
|
|
289
318
|
]
|
|
290
319
|
}
|
|
@@ -391,7 +420,11 @@
|
|
|
391
420
|
"required": ["image"]
|
|
392
421
|
}
|
|
393
422
|
},
|
|
394
|
-
"heroLayout": {
|
|
423
|
+
"heroLayout": {
|
|
424
|
+
"type": "string",
|
|
425
|
+
"description": "spotlight or editorial. Any other value is treated as absent.",
|
|
426
|
+
"examples": ["spotlight", "editorial"]
|
|
427
|
+
},
|
|
395
428
|
"heroCategories": {
|
|
396
429
|
"type": "array",
|
|
397
430
|
"items": {
|
|
@@ -571,6 +604,28 @@
|
|
|
571
604
|
"description": "An open language tag. The active renderer declares the allowed set for each request.",
|
|
572
605
|
"examples": ["en", "pt-BR", "zh-Hant-TW"]
|
|
573
606
|
},
|
|
607
|
+
"capturedSelection": {
|
|
608
|
+
"type": "object",
|
|
609
|
+
"description": "CMS-issued captured-catalog selection (Brokaw captured-catalog contract v1). When present, every runtime reader on the page reads this selection instead of its current source; the browser adapter validates it in full. Members other than these are ignored and counted.",
|
|
610
|
+
"properties": {
|
|
611
|
+
"selectionId": { "type": "string", "minLength": 1, "maxLength": 200 },
|
|
612
|
+
"catalogUrl": { "type": "string", "format": "uri", "pattern": "^https://" },
|
|
613
|
+
"context": {
|
|
614
|
+
"type": "object",
|
|
615
|
+
"properties": {
|
|
616
|
+
"rendererVersion": { "type": "string", "minLength": 1, "maxLength": 200 },
|
|
617
|
+
"templateVersion": { "type": "string", "minLength": 1, "maxLength": 200 },
|
|
618
|
+
"tenant": { "type": "string", "minLength": 1, "maxLength": 200 },
|
|
619
|
+
"origin": { "type": "string", "format": "uri", "pattern": "^https://" },
|
|
620
|
+
"build": { "type": "string", "minLength": 1, "maxLength": 200 }
|
|
621
|
+
},
|
|
622
|
+
"required": ["rendererVersion", "templateVersion", "tenant", "origin", "build"],
|
|
623
|
+
"description": "Members other than these are ignored."
|
|
624
|
+
},
|
|
625
|
+
"locale": { "type": "string", "enum": ["en", "es", "it"] }
|
|
626
|
+
},
|
|
627
|
+
"required": ["selectionId", "catalogUrl", "context", "locale"]
|
|
628
|
+
},
|
|
574
629
|
"rumConfig": {
|
|
575
630
|
"type": "object",
|
|
576
631
|
"properties": {
|
|
@@ -651,11 +706,9 @@
|
|
|
651
706
|
"type": { "type": "string", "const": "heading" },
|
|
652
707
|
"text": { "type": "string" },
|
|
653
708
|
"level": {
|
|
654
|
-
"
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
{ "type": "number", "const": 4 }
|
|
658
|
-
]
|
|
709
|
+
"type": "number",
|
|
710
|
+
"description": "2, 3 or 4. Any other number renders as 2.",
|
|
711
|
+
"examples": [2, 3, 4]
|
|
659
712
|
}
|
|
660
713
|
},
|
|
661
714
|
"required": ["type", "text"]
|
|
@@ -697,7 +750,8 @@
|
|
|
697
750
|
"title": { "type": "string" },
|
|
698
751
|
"tone": {
|
|
699
752
|
"type": "string",
|
|
700
|
-
"
|
|
753
|
+
"description": "neutral, info, warning or success. Any other value renders as neutral.",
|
|
754
|
+
"examples": ["neutral", "info", "warning", "success"]
|
|
701
755
|
},
|
|
702
756
|
"html": { "type": "string" }
|
|
703
757
|
},
|
|
@@ -820,6 +874,14 @@
|
|
|
820
874
|
"attribution": { "type": "string" }
|
|
821
875
|
},
|
|
822
876
|
"required": ["type", "text"]
|
|
877
|
+
},
|
|
878
|
+
{
|
|
879
|
+
"type": "object",
|
|
880
|
+
"description": "A block type this contract does not define. It is accepted and not rendered.",
|
|
881
|
+
"properties": {
|
|
882
|
+
"type": { "type": "string", "not": { "enum": ["richText", "heading", "image", "list", "divider", "infoBox", "keyPoints", "dataTable", "liveUpdate", "audio", "youtube", "x", "instagram", "tiktok", "spotify", "pullQuote"] } }
|
|
883
|
+
},
|
|
884
|
+
"required": ["type"]
|
|
823
885
|
}
|
|
824
886
|
]
|
|
825
887
|
}
|
|
@@ -926,7 +988,11 @@
|
|
|
926
988
|
"required": ["image"]
|
|
927
989
|
}
|
|
928
990
|
},
|
|
929
|
-
"heroLayout": {
|
|
991
|
+
"heroLayout": {
|
|
992
|
+
"type": "string",
|
|
993
|
+
"description": "spotlight or editorial. Any other value is treated as absent.",
|
|
994
|
+
"examples": ["spotlight", "editorial"]
|
|
995
|
+
},
|
|
930
996
|
"heroCategories": {
|
|
931
997
|
"type": "array",
|
|
932
998
|
"items": {
|
|
@@ -1046,6 +1112,10 @@
|
|
|
1046
1112
|
"standalone-page"
|
|
1047
1113
|
]
|
|
1048
1114
|
},
|
|
1115
|
+
"assignmentMediaBaseUrl": {
|
|
1116
|
+
"type": "string",
|
|
1117
|
+
"description": "Completed assignment JSON directory supplied by the media-page producer."
|
|
1118
|
+
},
|
|
1049
1119
|
"authors": {
|
|
1050
1120
|
"type": "array",
|
|
1051
1121
|
"items": {
|
|
@@ -1083,7 +1153,25 @@
|
|
|
1083
1153
|
"body",
|
|
1084
1154
|
"layout"
|
|
1085
1155
|
],
|
|
1086
|
-
"additionalProperties": {}
|
|
1156
|
+
"additionalProperties": {},
|
|
1157
|
+
"allOf": [
|
|
1158
|
+
{
|
|
1159
|
+
"if": {
|
|
1160
|
+
"properties": { "layout": { "const": "media-page" } },
|
|
1161
|
+
"required": ["layout"]
|
|
1162
|
+
},
|
|
1163
|
+
"then": {
|
|
1164
|
+
"required": ["assignmentMediaBaseUrl"],
|
|
1165
|
+
"properties": {
|
|
1166
|
+
"assignmentMediaBaseUrl": {
|
|
1167
|
+
"type": "string",
|
|
1168
|
+
"format": "uri",
|
|
1169
|
+
"pattern": "^[Hh][Tt][Tt][Pp][Ss]?://[^/?#@\\s\\\\]+(?:/[^?#\\s\\\\]*)?/contents/assignments/(?![\\s\\S])"
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
]
|
|
1087
1175
|
}
|
|
1088
1176
|
],
|
|
1089
1177
|
"title": "Cronkite canonical document",
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
"$id": "https://fifthbell.com/schemas/social-image-input-v1.schema.json",
|
|
4
4
|
"title": "Fifthbell social image input",
|
|
5
5
|
"type": "object",
|
|
6
|
-
"additionalProperties": false,
|
|
7
6
|
"required": ["imageUrl", "categoryName", "title", "qrCodeHtml"],
|
|
8
7
|
"properties": {
|
|
9
8
|
"imageUrl": { "type": "string", "format": "uri" },
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { searchCopyByLanguage } from './search-copy.js';
|
|
2
|
+
export type Language = keyof typeof searchCopyByLanguage;
|
|
3
|
+
export declare const systemDocument: (layout: "404" | "search-page" | "media-page", language: Language, slug: string, title: string, excerpt: string, extra?: Record<string, unknown>) => {
|
|
4
|
+
id: string;
|
|
5
|
+
slug: string;
|
|
6
|
+
canonicalUrl: string;
|
|
7
|
+
contentVersion: string;
|
|
8
|
+
publishedAt: string;
|
|
9
|
+
updatedAt: string;
|
|
10
|
+
status: string;
|
|
11
|
+
title: string;
|
|
12
|
+
excerpt: string;
|
|
13
|
+
language: "en" | "es" | "it";
|
|
14
|
+
featured: boolean;
|
|
15
|
+
body: never[];
|
|
16
|
+
layout: "404" | "search-page" | "media-page";
|
|
17
|
+
authors: {
|
|
18
|
+
name: string;
|
|
19
|
+
slug: string;
|
|
20
|
+
}[];
|
|
21
|
+
categories: never[];
|
|
22
|
+
navigation: {
|
|
23
|
+
categories: never[];
|
|
24
|
+
};
|
|
25
|
+
logoLink: string;
|
|
26
|
+
seo: {
|
|
27
|
+
metaTitle: string;
|
|
28
|
+
metaDescription: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export declare const mediathekSystemPage: {
|
|
32
|
+
readonly renderable: "media-page";
|
|
33
|
+
readonly contentType: "text/html; charset=utf-8";
|
|
34
|
+
readonly cacheControl: "public, max-age=0, must-revalidate";
|
|
35
|
+
readonly variants: [{
|
|
36
|
+
readonly key: "html/mediathek/index.html";
|
|
37
|
+
readonly document: {
|
|
38
|
+
id: string;
|
|
39
|
+
slug: string;
|
|
40
|
+
canonicalUrl: string;
|
|
41
|
+
contentVersion: string;
|
|
42
|
+
publishedAt: string;
|
|
43
|
+
updatedAt: string;
|
|
44
|
+
status: string;
|
|
45
|
+
title: string;
|
|
46
|
+
excerpt: string;
|
|
47
|
+
language: "en" | "es" | "it";
|
|
48
|
+
featured: boolean;
|
|
49
|
+
body: never[];
|
|
50
|
+
layout: "404" | "search-page" | "media-page";
|
|
51
|
+
authors: {
|
|
52
|
+
name: string;
|
|
53
|
+
slug: string;
|
|
54
|
+
}[];
|
|
55
|
+
categories: never[];
|
|
56
|
+
navigation: {
|
|
57
|
+
categories: never[];
|
|
58
|
+
};
|
|
59
|
+
logoLink: string;
|
|
60
|
+
seo: {
|
|
61
|
+
metaTitle: string;
|
|
62
|
+
metaDescription: string;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
}];
|
|
66
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export const systemDocument = (layout, language, slug, title, excerpt, extra = {}) => ({
|
|
2
|
+
id: `system-${layout}-${language}`,
|
|
3
|
+
slug,
|
|
4
|
+
canonicalUrl: `https://fifthbell.com${slug}`,
|
|
5
|
+
contentVersion: '2026-09-21T00:00:00.000Z',
|
|
6
|
+
publishedAt: '2026-09-21T00:00:00.000Z',
|
|
7
|
+
updatedAt: '2026-09-21T00:00:00.000Z',
|
|
8
|
+
status: 'published',
|
|
9
|
+
title,
|
|
10
|
+
excerpt,
|
|
11
|
+
language,
|
|
12
|
+
featured: false,
|
|
13
|
+
body: [],
|
|
14
|
+
layout,
|
|
15
|
+
authors: [{ name: 'Fifthbell Newsroom', slug: 'fifthbell-newsroom' }],
|
|
16
|
+
categories: [],
|
|
17
|
+
navigation: { categories: [] },
|
|
18
|
+
logoLink: language === 'en' ? '/' : `/${language}`,
|
|
19
|
+
seo: {
|
|
20
|
+
metaTitle: `${title} | fifthbell`,
|
|
21
|
+
metaDescription: excerpt,
|
|
22
|
+
},
|
|
23
|
+
...extra,
|
|
24
|
+
});
|
|
25
|
+
export const mediathekSystemPage = {
|
|
26
|
+
renderable: 'media-page',
|
|
27
|
+
contentType: 'text/html; charset=utf-8',
|
|
28
|
+
cacheControl: 'public, max-age=0, must-revalidate',
|
|
29
|
+
variants: [{
|
|
30
|
+
key: 'html/mediathek/index.html',
|
|
31
|
+
document: systemDocument('media-page', 'en', '/mediathek', 'Mediathek', 'Browse photos from Fifthbell assignments.', {
|
|
32
|
+
assignmentMediaBaseUrl: 'https://cdn.fifthbell.com/contents/assignments/',
|
|
33
|
+
}),
|
|
34
|
+
}],
|
|
35
|
+
};
|
|
@@ -4,10 +4,11 @@ import { canonicalDocumentSchema } from "./canonical-document-schema.generated.j
|
|
|
4
4
|
const ajv = new Ajv2020({ allErrors: true, strict: false, useDefaults: true });
|
|
5
5
|
addContractFormats(ajv);
|
|
6
6
|
const validateCanonicalDocument = ajv.compile(canonicalDocumentSchema);
|
|
7
|
+
// After a failed validation Ajv always sets errors, each with a message.
|
|
7
8
|
function summarizeValidationErrors(errors) {
|
|
8
|
-
return
|
|
9
|
+
return errors
|
|
9
10
|
.slice(0, 8)
|
|
10
|
-
.map((error) => `${error.instancePath || "/"} ${error.message
|
|
11
|
+
.map((error) => `${error.instancePath || "/"} ${error.message}`)
|
|
11
12
|
.join("; ");
|
|
12
13
|
}
|
|
13
14
|
export const canonicalArticleSchema = {
|