@brandlab-digital/site-core 3.19.1 → 4.0.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.
@@ -0,0 +1,87 @@
1
+ /**
2
+ * The shared convention for registry places whose copy differs from the registry name or takes "on". Everything not
3
+ * listed reads as the registry names it, with "in", and a region with `articleForm: 'the'` takes "the" in sentences.
4
+ */
5
+ export const BRANDLAB_PLACE_NAME_CONVENTIONS = Object.freeze({
6
+ // Sydney regions and sub-regions.
7
+ 'northern-beaches': { placeWord: 'on' },
8
+ 'north-shore': { placeWord: 'on' },
9
+ 'lower-north-shore': { placeWord: 'on', article: 'the' },
10
+ 'upper-north-shore': { placeWord: 'on', article: 'the' },
11
+ 'ryde-area': { label: 'Ryde area', article: 'the' },
12
+ 'st-george': { article: 'none' },
13
+ // Central Coast.
14
+ 'central-coast': { placeWord: 'on' },
15
+ // Islands.
16
+ 'dangar-island': { placeWord: 'on' },
17
+ 'scotland-island': { placeWord: 'on' },
18
+ 'st-huberts-island': { placeWord: 'on' },
19
+ });
20
+ const PLACE_WORDS = ['in', 'on'];
21
+ function assertOverride(slug, override) {
22
+ for (const key of Object.keys(override)) {
23
+ if (!['label', 'article', 'inSentence', 'placeWord'].includes(key))
24
+ throw new Error(`Place name "${slug}": ${key} is not a place-name field.`);
25
+ }
26
+ for (const key of ['label', 'inSentence']) {
27
+ const value = override[key];
28
+ if (value !== undefined && (typeof value !== 'string' || !value.trim() || value.trim() !== value)) {
29
+ throw new Error(`Place name "${slug}": ${key} must be trimmed, non-empty text.`);
30
+ }
31
+ }
32
+ if (override.placeWord !== undefined && !PLACE_WORDS.includes(override.placeWord)) {
33
+ throw new Error(`Place name "${slug}": placeWord must be "in" or "on".`);
34
+ }
35
+ if (override.article !== undefined && override.article !== 'the' && override.article !== 'none') {
36
+ throw new Error(`Place name "${slug}": article must be "the" or "none".`);
37
+ }
38
+ }
39
+ function registryPlaces(registry) {
40
+ const places = new Map();
41
+ for (const locality of [...registry.suburbs, ...registry.nonSuburbLocalities])
42
+ places.set(locality.slug, { name: locality.name, article: 'none' });
43
+ for (const subRegion of registry.subRegions)
44
+ places.set(subRegion.slug, { name: subRegion.name, article: 'none' });
45
+ for (const region of registry.regions)
46
+ places.set(region.slug, { name: region.name, article: region.articleForm });
47
+ return places;
48
+ }
49
+ /**
50
+ * Binds the shared convention and the site's own names to its registry. A legacy alias reads as the place it
51
+ * resolves to, under its own slug.
52
+ */
53
+ export function definePlaceNames(input) {
54
+ const overrides = input.overrides ?? {};
55
+ for (const [slug, override] of Object.entries(overrides))
56
+ assertOverride(slug, override);
57
+ const places = registryPlaces(input.registry);
58
+ const cache = new Map();
59
+ const resolve = (slug) => {
60
+ const target = places.has(slug) ? slug : Object.hasOwn(input.registry.aliases, slug) ? input.registry.aliases[slug] : slug;
61
+ const place = places.get(target);
62
+ const own = Object.hasOwn(overrides, slug) ? overrides[slug] : Object.hasOwn(overrides, target) ? overrides[target] : undefined;
63
+ const shared = Object.hasOwn(BRANDLAB_PLACE_NAME_CONVENTIONS, target) ? BRANDLAB_PLACE_NAME_CONVENTIONS[target] : undefined;
64
+ const label = own?.label ?? shared?.label ?? place?.name;
65
+ if (label === undefined)
66
+ return undefined;
67
+ const article = own?.article ?? shared?.article ?? place?.article ?? 'none';
68
+ const inSentence = own?.inSentence ?? (own?.label === undefined ? shared?.inSentence : undefined) ?? (article === 'the' ? `the ${label}` : label);
69
+ const placeWord = own?.placeWord ?? shared?.placeWord ?? 'in';
70
+ return Object.freeze({ slug, label, inSentence, placeWord, withPlaceWord: `${placeWord} ${inSentence}` });
71
+ };
72
+ const names = {
73
+ of(slug) {
74
+ if (!cache.has(slug))
75
+ cache.set(slug, resolve(slug));
76
+ return cache.get(slug);
77
+ },
78
+ get(slug) {
79
+ const name = names.of(slug);
80
+ if (!name)
81
+ throw new Error(`"${slug}" is not a registry place, and the site gives it no name.`);
82
+ return name;
83
+ },
84
+ };
85
+ return names;
86
+ }
87
+ //# source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GAAG,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;YAC3B,IAAI,CAAC,IAAI;gBAAE,MAAM,IAAI,KAAK,CAAC,IAAI,IAAI,2DAA2D,CAAC,CAAA;YAC/F,OAAO,IAAI,CAAA;QACb,CAAC;KACF,CAAA;IACD,OAAO,KAAK,CAAA;AACd,CAAC","sourcesContent":["/**\n * Place names as visible copy reads them (3.20.0; website standard, \"Place names\"). Each place carries its own place\n * word and the templates use it: \"on the Northern Beaches\", \"in the Ryde area\", \"in Castle Hill\", \"on St Huberts\n * Island\". Regions keep \"the\" in sentences (\"across the Northern Beaches\"); a bare region name is fine only as a label\n * or breadcrumb. \"Area\" stays lower case.\n *\n * The registry keeps the official facts (its `name`, `seoName` and `articleForm` never change here); this module is\n * the copy convention layered over them, with the site's own names on top. Titles may stay keyword-led and use the\n * registry's `seoName`; visible headings and sentences use these names. Renaming a label in visible text never\n * changes a slug: a slug change is a route change and Romie's decision.\n */\nimport type { GeographyRegistry } from './locations.js'\n\n/** The word before a place in a sentence: \"in\" for ordinary suburbs and most regions, \"on\" for the coasts, shores and islands. */\nexport type BrandlabPlaceWord = 'in' | 'on'\n\n/** How copy names one place. */\nexport interface BrandlabPlaceName {\n /** The registry (or site-owned) slug. */\n readonly slug: string\n /** A label, breadcrumb, list item or map title: \"Ryde area\", \"Northern Beaches\", \"Castle Hill\". */\n readonly label: string\n /** The name inside a sentence: \"the Ryde area\", \"the Northern Beaches\", \"Western Sydney\", \"The Rocks\". */\n readonly inSentence: string\n /** \"in\" or \"on\". */\n readonly placeWord: BrandlabPlaceWord\n /** The place with its word, for headings and sentences: \"on the Northern Beaches\", \"in Castle Hill\". */\n readonly withPlaceWord: string\n}\n\n/** A site's own name for one place; every field is optional and falls back to the shared convention. */\nexport interface BrandlabPlaceNameOverride {\n /** The label (\"Sydney CBD\"). */\n readonly label?: string\n /** Whether sentences put \"the\" before the label (\"the Ryde area\"); the registry's `articleForm` otherwise. */\n readonly article?: 'the' | 'none'\n /** The whole in-sentence form, when \"the\" + label is not enough. */\n readonly inSentence?: string\n readonly placeWord?: BrandlabPlaceWord\n}\n\n/**\n * The shared convention for registry places whose copy differs from the registry name or takes \"on\". Everything not\n * listed reads as the registry names it, with \"in\", and a region with `articleForm: 'the'` takes \"the\" in sentences.\n */\nexport const BRANDLAB_PLACE_NAME_CONVENTIONS: Readonly<Record<string, BrandlabPlaceNameOverride>> = Object.freeze({\n // Sydney regions and sub-regions.\n 'northern-beaches': { placeWord: 'on' },\n 'north-shore': { placeWord: 'on' },\n 'lower-north-shore': { placeWord: 'on', article: 'the' },\n 'upper-north-shore': { placeWord: 'on', article: 'the' },\n 'ryde-area': { label: 'Ryde area', article: 'the' },\n 'st-george': { article: 'none' },\n // Central Coast.\n 'central-coast': { placeWord: 'on' },\n // Islands.\n 'dangar-island': { placeWord: 'on' },\n 'scotland-island': { placeWord: 'on' },\n 'st-huberts-island': { placeWord: 'on' },\n})\n\nexport interface BrandlabPlaceNamesInput {\n /** The registry the site's places come from (sydneyGeography or centralCoastGeography). */\n readonly registry: GeographyRegistry\n /**\n * The site's own names, by slug, over the shared convention: `{ sydney: { label: 'Sydney CBD' } }`. A site-owned\n * town (outside the registry) needs at least its `label` here.\n */\n readonly overrides?: Readonly<Record<string, BrandlabPlaceNameOverride>>\n}\n\n/** A site's place names. Build it once with `definePlaceNames` and read every visible place name through it. */\nexport interface BrandlabPlaceNames {\n /** The place's names, or undefined for a slug that is neither a registry place (or alias) nor overridden. */\n of(slug: string): BrandlabPlaceName | undefined\n /** Like `of`, but throws for an unknown slug, so a missing name never ships as a slug. */\n get(slug: string): BrandlabPlaceName\n}\n\nconst PLACE_WORDS: readonly BrandlabPlaceWord[] = ['in', 'on']\n\nfunction assertOverride(slug: string, override: BrandlabPlaceNameOverride) {\n for (const key of Object.keys(override)) {\n if (!['label', 'article', 'inSentence', 'placeWord'].includes(key)) throw new Error(`Place name \"${slug}\": ${key} is not a place-name field.`)\n }\n for (const key of ['label', 'inSentence'] as const) {\n const value = override[key]\n if (value !== undefined && (typeof value !== 'string' || !value.trim() || value.trim() !== value)) {\n throw new Error(`Place name \"${slug}\": ${key} must be trimmed, non-empty text.`)\n }\n }\n if (override.placeWord !== undefined && !PLACE_WORDS.includes(override.placeWord)) {\n throw new Error(`Place name \"${slug}\": placeWord must be \"in\" or \"on\".`)\n }\n if (override.article !== undefined && override.article !== 'the' && override.article !== 'none') {\n throw new Error(`Place name \"${slug}\": article must be \"the\" or \"none\".`)\n }\n}\n\ninterface RegistryPlace {\n readonly name: string\n readonly article: 'the' | 'none'\n}\n\nfunction registryPlaces(registry: GeographyRegistry): ReadonlyMap<string, RegistryPlace> {\n const places = new Map<string, RegistryPlace>()\n for (const locality of [...registry.suburbs, ...registry.nonSuburbLocalities]) places.set(locality.slug, { name: locality.name, article: 'none' })\n for (const subRegion of registry.subRegions) places.set(subRegion.slug, { name: subRegion.name, article: 'none' })\n for (const region of registry.regions) places.set(region.slug, { name: region.name, article: region.articleForm })\n return places\n}\n\n/**\n * Binds the shared convention and the site's own names to its registry. A legacy alias reads as the place it\n * resolves to, under its own slug.\n */\nexport function definePlaceNames(input: BrandlabPlaceNamesInput): BrandlabPlaceNames {\n const overrides = input.overrides ?? {}\n for (const [slug, override] of Object.entries(overrides)) assertOverride(slug, override)\n const places = registryPlaces(input.registry)\n const cache = new Map<string, BrandlabPlaceName | undefined>()\n const resolve = (slug: string): BrandlabPlaceName | undefined => {\n const target = places.has(slug) ? slug : Object.hasOwn(input.registry.aliases, slug) ? input.registry.aliases[slug]! : slug\n const place = places.get(target)\n const own = Object.hasOwn(overrides, slug) ? overrides[slug]! : Object.hasOwn(overrides, target) ? overrides[target]! : undefined\n const shared = Object.hasOwn(BRANDLAB_PLACE_NAME_CONVENTIONS, target) ? BRANDLAB_PLACE_NAME_CONVENTIONS[target]! : undefined\n const label = own?.label ?? shared?.label ?? place?.name\n if (label === undefined) return undefined\n const article = own?.article ?? shared?.article ?? place?.article ?? 'none'\n const inSentence = own?.inSentence ?? (own?.label === undefined ? shared?.inSentence : undefined) ?? (article === 'the' ? `the ${label}` : label)\n const placeWord = own?.placeWord ?? shared?.placeWord ?? 'in'\n return Object.freeze({ slug, label, inSentence, placeWord, withPlaceWord: `${placeWord} ${inSentence}` })\n }\n const names: BrandlabPlaceNames = {\n of(slug) {\n if (!cache.has(slug)) cache.set(slug, resolve(slug))\n return cache.get(slug)\n },\n get(slug) {\n const name = names.of(slug)\n if (!name) throw new Error(`\"${slug}\" is not a registry place, and the site gives it no name.`)\n return name\n },\n }\n return names\n}\n"]}
package/dist/schema.d.ts CHANGED
@@ -89,7 +89,12 @@ export declare function buildWebPageSchema(input: {
89
89
  mainEntityId?: string;
90
90
  inLanguage?: string;
91
91
  }): BrandlabSchemaNode;
92
- export type BrandlabLocalBusinessSchemaType = 'LocalBusiness' | 'ProfessionalService' | 'HomeAndConstructionBusiness' | 'Electrician' | 'GeneralContractor' | 'Plumber' | 'RoofingContractor';
92
+ /**
93
+ * The business node's schema.org type: `HomeAndConstructionBusiness` and its trade subtypes (3.20.0 adds HousePainter,
94
+ * HVACBusiness, Locksmith and MovingCompany). schema.org has no carpentry, landscaping, tree or demolition subtype:
95
+ * those trades use `HomeAndConstructionBusiness` (or `GeneralContractor`) and may name the trade with `additionalType`.
96
+ */
97
+ export type BrandlabLocalBusinessSchemaType = 'LocalBusiness' | 'ProfessionalService' | 'HomeAndConstructionBusiness' | 'Electrician' | 'GeneralContractor' | 'HousePainter' | 'HVACBusiness' | 'Locksmith' | 'MovingCompany' | 'Plumber' | 'RoofingContractor';
93
98
  export declare function buildLocalBusinessSchema(input: {
94
99
  id: string;
95
100
  schemaType: BrandlabLocalBusinessSchemaType;
@@ -97,6 +102,13 @@ export declare function buildLocalBusinessSchema(input: {
97
102
  description?: string;
98
103
  logoUrl?: string;
99
104
  imageUrls?: readonly string[];
105
+ /**
106
+ * 3.20.0: absolute URLs naming the trade where schema.org has no type for it, for example a carpenter's
107
+ * `https://www.wikidata.org/wiki/Q154549`. Never a second business type.
108
+ */
109
+ additionalType?: readonly string[];
110
+ /** 3.20.0: the business's map link, for example its Google Business Profile Maps URL. */
111
+ hasMap?: string;
100
112
  }): BrandlabSchemaNode;
101
113
  export declare function buildServiceSchema(input: {
102
114
  id: string;
@@ -126,9 +138,19 @@ export declare function buildBlogPostingSchema(input: {
126
138
  description: string;
127
139
  datePublished: string;
128
140
  dateModified?: string;
129
- authorNames: readonly string[];
141
+ /** Each named author, as a Person. */
142
+ authorNames?: readonly string[];
143
+ /**
144
+ * 3.20.0: authors that are nodes elsewhere in the graph, by `@id`, such as the business node when the byline is the
145
+ * business (a business is never typed as a Person). At least one author, named or by id.
146
+ */
147
+ authorIds?: readonly string[];
130
148
  publisherId: string;
131
149
  imageUrls?: readonly string[];
132
150
  mainEntityOfPageId?: string;
151
+ /** 3.20.0: the nodes the article is about, by `@id`, such as the service page's Service node. */
152
+ aboutIds?: readonly string[];
153
+ /** 3.20.0: the group of guides the article sits in, as visible on the site ("Costs"). */
154
+ articleSection?: string;
133
155
  }): BrandlabSchemaNode;
134
156
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAA;AACjE,OAAO,KAAK,EAAE,cAAc,IAAI,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAGhF,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI;IACtB,UAAU,EAAE,oBAAoB,CAAA;CACjC,GAAG,CAAC,CAAA;AAEL,MAAM,MAAM,cAAc,GAAG,sBAAsB,CAAA;AAEnD,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAOpD;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC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C1B,CAAA;IACD,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,sBAyBA;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAC5C,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,sCAAsC;IACtC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC/B;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC7B,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,iGAAiG;IACjG,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC5B,yFAAyF;IACzF,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,sBAqDA"}
package/dist/schema.js CHANGED
@@ -271,9 +271,20 @@ export function buildLocalBusinessSchema(input) {
271
271
  if (input.logoUrl)
272
272
  assertAbsoluteUrl(input.logoUrl, 'logoUrl');
273
273
  input.imageUrls?.forEach((url, index) => assertAbsoluteUrl(url, `imageUrls[${index}]`));
274
+ input.additionalType?.forEach((url, index) => assertAbsoluteUrl(url, `additionalType[${index}]`));
275
+ if (input.additionalType && new Set(input.additionalType).size !== input.additionalType.length) {
276
+ throw new Error('additionalType contains duplicates.');
277
+ }
278
+ if (input.hasMap !== undefined)
279
+ assertAbsoluteUrl(input.hasMap, 'hasMap');
274
280
  return assertSafeSchemaNode(compact({
275
281
  '@type': input.schemaType,
276
282
  '@id': input.id,
283
+ additionalType: input.additionalType && input.additionalType.length > 0
284
+ ? input.additionalType.length === 1
285
+ ? input.additionalType[0]
286
+ : [...input.additionalType]
287
+ : undefined,
277
288
  name: input.business.tradingName,
278
289
  legalName: input.business.legalName,
279
290
  url: input.business.canonicalUrl,
@@ -309,6 +320,7 @@ export function buildLocalBusinessSchema(input) {
309
320
  }))
310
321
  : undefined,
311
322
  taxID: input.business.abn,
323
+ hasMap: input.hasMap,
312
324
  sameAs: input.business.sameAs.length > 0 ? input.business.sameAs : undefined,
313
325
  }));
314
326
  }
@@ -369,10 +381,22 @@ export function buildBlogPostingSchema(input) {
369
381
  Date.parse(input.dateModified) < Date.parse(input.datePublished)) {
370
382
  throw new Error('dateModified cannot be earlier than datePublished.');
371
383
  }
372
- if (input.authorNames.length === 0)
373
- throw new Error('authorNames cannot be empty.');
374
- input.authorNames.forEach((name, index) => assertNonEmpty(name, `authorNames[${index}]`));
384
+ const authorNames = input.authorNames ?? [];
385
+ const authorIds = input.authorIds ?? [];
386
+ if (authorNames.length + authorIds.length === 0)
387
+ throw new Error('authorNames or authorIds must name at least one author.');
388
+ authorNames.forEach((name, index) => assertNonEmpty(name, `authorNames[${index}]`));
389
+ authorIds.forEach((id, index) => assertAbsoluteUrl(id, `authorIds[${index}]`));
390
+ if (new Set(authorIds).size !== authorIds.length)
391
+ throw new Error('authorIds contains duplicates.');
392
+ input.aboutIds?.forEach((id, index) => assertAbsoluteUrl(id, `aboutIds[${index}]`));
393
+ if (input.articleSection !== undefined)
394
+ assertNonEmpty(input.articleSection, 'articleSection');
375
395
  input.imageUrls?.forEach((url, index) => assertAbsoluteUrl(url, `imageUrls[${index}]`));
396
+ const authors = [
397
+ ...authorNames.map((name) => ({ '@type': 'Person', name })),
398
+ ...authorIds.map((id) => ({ '@id': id })),
399
+ ];
376
400
  return assertSafeSchemaNode(compact({
377
401
  '@type': 'BlogPosting',
378
402
  '@id': input.id,
@@ -381,12 +405,18 @@ export function buildBlogPostingSchema(input) {
381
405
  description: input.description,
382
406
  datePublished: input.datePublished,
383
407
  dateModified: input.dateModified ?? input.datePublished,
384
- author: input.authorNames.map((name) => ({ '@type': 'Person', name })),
408
+ author: authorIds.length > 0 && authorNames.length === 0 && authors.length === 1 ? authors[0] : authors,
385
409
  publisher: { '@id': input.publisherId },
386
410
  image: input.imageUrls,
387
411
  mainEntityOfPage: input.mainEntityOfPageId
388
412
  ? { '@id': input.mainEntityOfPageId }
389
413
  : { '@id': input.url },
414
+ about: input.aboutIds && input.aboutIds.length > 0
415
+ ? input.aboutIds.length === 1
416
+ ? { '@id': input.aboutIds[0] }
417
+ : input.aboutIds.map((id) => ({ '@id': id }))
418
+ : undefined,
419
+ articleSection: input.articleSection,
390
420
  }));
391
421
  }
392
422
  //# sourceMappingURL=schema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAQ9C,MAAM,UAAU,cAAc,CAAC,IAAa;IAC1C,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;SACxB,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC;SACxB,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC;SACxB,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC;SACxB,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC;SAC7B,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;AAClC,CAAC;AAED,MAAM,UAAU,YAAY,CAAoC,IAAO;IACrE,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAA;IAChF,CAAC;IACD,OAAO;QACL,UAAU,EAAE,oBAAoB;QAChC,GAAG,IAAI;KACR,CAAA;AACH,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,GAAG,KAAgB;IACnD,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACtC,MAAM,GAAG,GAAG,QAAQ;SACjB,GAAG,CAAC,CAAC,IAAI,EAAE,E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AE,KAAK,EAAE,KAAK,CAAC,WAAW,EAAE;QACvC,KAAK,EAAE,KAAK,CAAC,SAAS;QACtB,gBAAgB,EAAE,KAAK,CAAC,kBAAkB;YACxC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,kBAAkB,EAAE;YACrC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,EAAE;KACzB,CAAC,CACH,CAAA;AACH,CAAC","sourcesContent":["import type { BrandlabDerivedBusinessFacts } from './business.js'\nimport type { BreadcrumbItem as SemanticBreadcrumbItem } from './breadcrumbs.js'\nimport { getAbsoluteUrl } from './metadata.js'\n\nexport type Schema<T> = {\n '@context': 'https://schema.org'\n} & T\n\nexport type BreadcrumbItem = SemanticBreadcrumbItem\n\nexport function sanitizeJsonLd(data: unknown): string {\n return JSON.stringify(data)\n .replace(/</g, '\\\\u003c')\n .replace(/>/g, '\\\\u003e')\n .replace(/&/g, '\\\\u0026')\n .replace(/\\u2028/g, '\\\\u2028')\n .replace(/\\u2029/g, '\\\\u2029')\n}\n\nexport function createSchema<T extends Record<string, unknown>>(data: T): Schema<T> {\n if (Object.hasOwn(data, '@context')) {\n throw new Error('Schema builders own @context; pass only schema node fields.')\n }\n return {\n '@context': 'https://schema.org',\n ...data,\n }\n}\n\nexport function createSchemaGraph(...nodes: unknown[]): Schema<{ '@graph': unknown[] }> {\n const filtered = nodes.filter(Boolean)\n const ids = filtered\n .map((node) =>\n node && typeof node === 'object'\n ? (node as { '@id'?: unknown })['@id']\n : undefined,\n )\n .filter((id): id is string => typeof id === 'string')\n const duplicates = ids.filter((id, index) => ids.indexOf(id) !== index)\n\n if (duplicates.length > 0) {\n throw new Error(\n `Duplicate @id values in one schema graph: ${[...new Set(duplicates)].join(', ')}.`,\n )\n }\n\n return {\n '@context': 'https://schema.org',\n '@graph': filtered,\n }\n}\n\nexport function appendSchemaAnchor(url: string, anchor: string) {\n const cleanAnchor = anchor.replace(/^#+/, '')\n assertNonEmpty(cleanAnchor, 'anchor')\n assertAbsoluteUrl(url, 'url')\n const parsed = new URL(url)\n parsed.search = ''\n parsed.hash = ''\n const normalizedUrl = parsed.pathname === '/' ? parsed.origin + '/' : parsed.href.replace(/\\/$/, '')\n\n return `${normalizedUrl}#${cleanAnchor}`\n}\n\nexport interface SchemaIdRoutes {\n service: (slug: string) => string\n blogPost: (slug: string) => string\n}\n\nexport interface SchemaIdOptions {\n siteUrl: string\n anchors?: {\n business?: string\n website?: string\n service?: string\n article?: string\n }\n routes: SchemaIdRoutes\n}\n\nfunction normalizeSiteUrl(siteUrl: string) {\n assertAbsoluteUrl(siteUrl, 'siteUrl')\n const parsed = new URL(siteUrl)\n if (parsed.pathname !== '/' || parsed.search || parsed.hash) {\n throw new Error('siteUrl must be an absolute HTTPS origin.')\n }\n return parsed.origin\n}\n\nfunction absoluteUrl(siteUrl: string, pathOrUrl: string) {\n if (/^https?:/i.test(pathOrUrl)) {\n assertAbsoluteUrl(pathOrUrl, 'schema URL')\n return pathOrUrl\n }\n return getAbsoluteUrl(normalizeSiteUrl(siteUrl), pathOrUrl.startsWith('/') ? pathOrUrl : `/${pathOrUrl}`)\n}\n\nexport function createSchemaIdHelpers(options: SchemaIdOptions) {\n const siteUrl = normalizeSiteUrl(options.siteUrl)\n const anchors = {\n business: '/#business',\n website: '/#website',\n service: '#service',\n article: '#article',\n ...options.anchors,\n }\n\n return {\n businessId: () => `${siteUrl}${anchors.business}`,\n websiteId: () => `${siteUrl}${anchors.website}`,\n serviceIdForSlug: (slug: string) =>\n `${absoluteUrl(siteUrl, options.routes.service(slug))}${anchors.service}`,\n serviceIdForPath: (pathOrUrl: string) =>\n `${absoluteUrl(siteUrl, pathOrUrl)}${anchors.service}`,\n blogPostId: (slug: string) =>\n `${absoluteUrl(siteUrl, options.routes.blogPost(slug))}${anchors.article}`,\n blogPostPageId: (slug: string) => absoluteUrl(siteUrl, options.routes.blogPost(slug)),\n }\n}\n\n/**\n * BreadcrumbList JSON-LD for a trail. Only the final crumb (the current page) may\n * omit its href: Google rejects a list whose earlier ListItem has no `item`\n * (\"Missing field item\"), so such a trail throws (3.3.3), as defineBreadcrumbTrail does.\n */\nexport function buildBreadcrumbListSchema(\n breadcrumbs: BreadcrumbItem[],\n options: { absoluteUrl: (path: string) => string },\n) {\n return {\n '@type': 'BreadcrumbList',\n itemListElement: breadcrumbs.map((crumb, index) => {\n assertNonEmpty(crumb.name, `breadcrumbs[${index}].name`)\n if (!crumb.href && index < breadcrumbs.length - 1) {\n throw new Error(\n `breadcrumbs[${index}] (\"${crumb.name}\") has no href, but only the final breadcrumb may omit its URL: Google rejects a BreadcrumbList whose earlier item has no \"item\". Give it the page it names (for example its section index).`,\n )\n }\n const url = crumb.href ? options.absoluteUrl(crumb.href) : undefined\n if (url) assertAbsoluteUrl(url, `breadcrumbs[${index}].url`)\n return {\n '@type': 'ListItem',\n position: index + 1,\n name: crumb.name,\n item: url\n ? {\n '@type': 'WebPage',\n '@id': url,\n url,\n name: crumb.name,\n }\n : undefined,\n }\n }),\n }\n}\n\nexport type BrandlabSchemaNode = Record<string, unknown> & {\n '@type': string\n '@id'?: string\n}\n\nexport interface BrandlabSchemaExtension {\n node: BrandlabSchemaNode\n rationale: string\n visibleEvidence: string\n}\n\nconst PROHIBITED_SCHEMA_TYPES = new Set([\n 'AggregateRating',\n 'AggregateOffer',\n 'FAQPage',\n 'HowTo',\n 'Offer',\n 'OfferCatalog',\n 'Product',\n 'Review',\n])\nconst PROHIBITED_SCHEMA_PROPERTIES = new Set([\n 'aggregaterating',\n 'hasoffercatalog',\n 'itemoffered',\n 'offer',\n 'offers',\n 'review',\n 'reviews',\n])\n\nfunction compactSchemaTerm(value: string) {\n const direct = /^(?:https?:\\/\\/)?schema\\.org[/#]([^/#]+)$/i.exec(value)\n if (direct) return direct[1]!\n return value.toLowerCase().startsWith('schema:') ? value.slice('schema:'.length) : value\n}\n\nfunction assertNonEmpty(value: string, field: string) {\n if (!value.trim()) throw new Error(`${field} cannot be empty.`)\n}\n\nfunction assertAbsoluteUrl(value: string, field: string) {\n let url: URL\n try {\n url = new URL(value)\n } catch {\n throw new Error(`${field} must be an absolute HTTPS URL.`)\n }\n if (url.protocol !== 'https:' || url.username || url.password) {\n throw new Error(`${field} must be an absolute HTTPS URL.`)\n }\n}\n\nfunction assertSafeSchemaValue(\n value: unknown,\n path: string,\n ancestors = new WeakSet<object>(),\n) {\n if (!value || typeof value !== 'object') return\n\n if (ancestors.has(value)) {\n throw new Error(`Schema payload contains a cyclic value at ${path}.`)\n }\n ancestors.add(value)\n\n try {\n if (Array.isArray(value)) {\n value.forEach((item, index) =>\n assertSafeSchemaValue(item, `${path}[${index}]`, ancestors),\n )\n return\n }\n\n const object = value as Record<string, unknown>\n if (Object.hasOwn(object, '@context')) {\n if (path !== 'schema' || object['@context'] !== 'https://schema.org') {\n throw new Error(\n `Schema @context at ${path} must be the single top-level literal \"https://schema.org\"; custom, local, array and nested contexts are unsupported.`,\n )\n }\n }\n Object.entries(object).forEach(([key, child]) => {\n if (key === '@context') return\n\n if (key.startsWith('@') && !['@graph', '@id', '@type'].includes(key)) {\n throw new Error(`JSON-LD keyword \"${key}\" is unsupported at ${path}.`)\n }\n\n if (key === '@id' && typeof child === 'string') {\n assertAbsoluteUrl(child, `${path}.@id`)\n }\n\n if (key === '@type') {\n const types = Array.isArray(child) ? child : [child]\n types.forEach((type) => {\n const compactType = typeof type === 'string' ? compactSchemaTerm(type) : ''\n if (PROHIBITED_SCHEMA_TYPES.has(compactType)) {\n throw new Error(`Schema type \"${type}\" is prohibited at ${path}.`)\n }\n })\n }\n\n const compactProperty = compactSchemaTerm(key).toLowerCase()\n if (PROHIBITED_SCHEMA_PROPERTIES.has(compactProperty)) {\n throw new Error(`Schema property \"${key}\" is prohibited at ${path}.`)\n }\n\n assertSafeSchemaValue(child, `${path}.${key}`, ancestors)\n })\n } finally {\n ancestors.delete(value)\n }\n}\n\n/** Validates a complete JSON-LD payload before a rendering adapter serializes it. */\nexport function assertProofSafeSchema<T>(schema: T): T {\n if (\n !schema ||\n typeof schema !== 'object' ||\n Array.isArray(schema) ||\n (schema as Record<string, unknown>)['@context'] !== 'https://schema.org'\n ) {\n throw new Error(\n 'A rendered schema payload must use the literal \"https://schema.org\" @context.',\n )\n }\n assertSafeSchemaValue(schema, 'schema')\n return schema\n}\n\nexport function assertSafeSchemaNode(node: BrandlabSchemaNode) {\n assertNonEmpty(node['@type'], '@type')\n if (node['@id']) assertAbsoluteUrl(node['@id'], '@id')\n assertSafeSchemaValue(node, 'schema')\n return node\n}\n\n/** Builds a proof-safe graph from shared builders and reviewed extensions. */\nexport function buildSchemaGraph(options: {\n nodes: readonly (BrandlabSchemaNode | null | false | undefined)[]\n extensions?: readonly BrandlabSchemaExtension[]\n}) {\n const nodes = options.nodes.filter((node): node is BrandlabSchemaNode => Boolean(node))\n nodes.forEach(assertSafeSchemaNode)\n\n const extensionNodes = (options.extensions ?? []).map((extension, index) => {\n assertNonEmpty(extension.rationale, `extensions[${index}].rationale`)\n assertNonEmpty(extension.visibleEvidence, `extensions[${index}].visibleEvidence`)\n return assertSafeSchemaNode(extension.node)\n })\n\n const allNodes = [...nodes, ...extensionNodes]\n const ids = allNodes\n .map((node) => node['@id'])\n .filter((id): id is string => typeof id === 'string')\n const duplicateId = ids.find((id, index) => ids.indexOf(id) !== index)\n if (duplicateId) throw new Error(`Schema graph contains duplicate @id \"${duplicateId}\".`)\n\n return createSchemaGraph(...allNodes) as Schema<{\n '@graph': BrandlabSchemaNode[]\n }>\n}\n\nfunction compact<T extends Record<string, unknown>>(value: T): T {\n return Object.fromEntries(\n Object.entries(value).filter(([, entry]) => entry !== undefined),\n ) as T\n}\n\nexport function buildWebSiteSchema(input: {\n id: string\n url: string\n name: string\n publisherId?: string\n inLanguage?: string\n}) {\n assertNonEmpty(input.name, 'name')\n assertAbsoluteUrl(input.id, 'id')\n assertAbsoluteUrl(input.url, 'url')\n\n return assertSafeSchemaNode(\n compact({\n '@type': 'WebSite',\n '@id': input.id,\n url: input.url,\n name: input.name,\n publisher: input.publisherId ? { '@id': input.publisherId } : undefined,\n inLanguage: input.inLanguage,\n }),\n )\n}\n\nexport function buildWebPageSchema(input: {\n id: string\n url: string\n name: string\n description: string\n websiteId: string\n breadcrumbId?: string\n mainEntityId?: string\n inLanguage?: string\n}) {\n assertNonEmpty(input.name, 'name')\n assertNonEmpty(input.description, 'description')\n assertAbsoluteUrl(input.id, 'id')\n assertAbsoluteUrl(input.url, 'url')\n\n return assertSafeSchemaNode(\n compact({\n '@type': 'WebPage',\n '@id': input.id,\n url: input.url,\n name: input.name,\n description: input.description,\n isPartOf: { '@id': input.websiteId },\n breadcrumb: input.breadcrumbId ? { '@id': input.breadcrumbId } : undefined,\n mainEntity: input.mainEntityId ? { '@id': input.mainEntityId } : undefined,\n inLanguage: input.inLanguage,\n }),\n )\n}\n\nexport type BrandlabLocalBusinessSchemaType =\n | 'LocalBusiness'\n | 'ProfessionalService'\n | 'HomeAndConstructionBusiness'\n | 'Electrician'\n | 'GeneralContractor'\n | 'Plumber'\n | 'RoofingContractor'\n\nexport function buildLocalBusinessSchema(input: {\n id: string\n schemaType: BrandlabLocalBusinessSchemaType\n business: BrandlabDerivedBusinessFacts\n description?: string\n logoUrl?: string\n imageUrls?: readonly string[]\n}) {\n assertAbsoluteUrl(input.id, 'id')\n if (input.description !== undefined) assertNonEmpty(input.description, 'description')\n if (input.logoUrl) assertAbsoluteUrl(input.logoUrl, 'logoUrl')\n input.imageUrls?.forEach((url, index) => assertAbsoluteUrl(url, `imageUrls[${index}]`))\n\n return assertSafeSchemaNode(\n compact({\n '@type': input.schemaType,\n '@id': input.id,\n name: input.business.tradingName,\n legalName: input.business.legalName,\n url: input.business.canonicalUrl,\n telephone: input.business.phone?.schemaTelephone,\n email: input.business.email,\n description: input.description,\n logo: input.logoUrl,\n image: input.imageUrls && input.imageUrls.length > 0 ? input.imageUrls : undefined,\n address: input.business.publicAddress\n ? {\n '@type': 'PostalAddress',\n ...input.business.publicAddress,\n }\n : undefined,\n areaServed:\n input.business.serviceAreas.length > 0\n ? input.business.serviceAreas.map((area) => ({\n '@type':\n area.kind === 'city'\n ? 'City'\n : area.kind === 'state'\n ? 'State'\n : area.kind === 'country'\n ? 'Country'\n : 'Place',\n name: area.name,\n }))\n : undefined,\n openingHoursSpecification:\n input.business.openingHours.length > 0\n ? input.business.openingHours.map((period) => ({\n '@type': 'OpeningHoursSpecification',\n dayOfWeek: period.days,\n opens: period.opens,\n closes: period.closes,\n }))\n : undefined,\n taxID: input.business.abn,\n sameAs: input.business.sameAs.length > 0 ? input.business.sameAs : undefined,\n }),\n )\n}\n\nexport function buildServiceSchema(input: {\n id: string\n url: string\n name: string\n description: string\n serviceType: string\n providerId: string\n areaServed?: readonly string[]\n}) {\n assertAbsoluteUrl(input.id, 'id')\n assertAbsoluteUrl(input.url, 'url')\n assertNonEmpty(input.name, 'name')\n assertNonEmpty(input.description, 'description')\n assertNonEmpty(input.serviceType, 'serviceType')\n input.areaServed?.forEach((area, index) => assertNonEmpty(area, `areaServed[${index}]`))\n\n return assertSafeSchemaNode(\n compact({\n '@type': 'Service',\n '@id': input.id,\n url: input.url,\n name: input.name,\n description: input.description,\n serviceType: input.serviceType,\n provider: { '@id': input.providerId },\n areaServed:\n input.areaServed && input.areaServed.length > 0\n ? input.areaServed.map((name) => ({ '@type': 'Place', name }))\n : undefined,\n }),\n )\n}\n\nexport function buildLocationSchema(input: {\n id: string\n url: string\n name: string\n description: string\n websiteId: string\n place: {\n name: string\n containedInPlace?: string\n }\n businessId?: string\n}) {\n assertAbsoluteUrl(input.id, 'id')\n assertAbsoluteUrl(input.url, 'url')\n assertNonEmpty(input.name, 'name')\n assertNonEmpty(input.description, 'description')\n assertNonEmpty(input.place.name, 'place.name')\n\n return assertSafeSchemaNode(\n compact({\n '@type': 'WebPage',\n '@id': input.id,\n url: input.url,\n name: input.name,\n description: input.description,\n isPartOf: { '@id': input.websiteId },\n about: compact({\n '@type': 'Place',\n name: input.place.name,\n containedInPlace: input.place.containedInPlace\n ? { '@type': 'Place', name: input.place.containedInPlace }\n : undefined,\n }),\n mainEntity: input.businessId ? { '@id': input.businessId } : undefined,\n }),\n )\n}\n\nexport function buildBlogPostingSchema(input: {\n id: string\n url: string\n headline: string\n description: string\n datePublished: string\n dateModified?: string\n authorNames: readonly string[]\n publisherId: string\n imageUrls?: readonly string[]\n mainEntityOfPageId?: string\n}) {\n assertAbsoluteUrl(input.id, 'id')\n assertAbsoluteUrl(input.url, 'url')\n assertNonEmpty(input.headline, 'headline')\n assertNonEmpty(input.description, 'description')\n if (Number.isNaN(Date.parse(input.datePublished))) throw new Error('datePublished must be valid.')\n if (input.dateModified && Number.isNaN(Date.parse(input.dateModified))) {\n throw new Error('dateModified must be valid.')\n }\n if (\n input.dateModified &&\n Date.parse(input.dateModified) < Date.parse(input.datePublished)\n ) {\n throw new Error('dateModified cannot be earlier than datePublished.')\n }\n if (input.authorNames.length === 0) throw new Error('authorNames cannot be empty.')\n input.authorNames.forEach((name, index) => assertNonEmpty(name, `authorNames[${index}]`))\n input.imageUrls?.forEach((url, index) => assertAbsoluteUrl(url, `imageUrls[${index}]`))\n\n return assertSafeSchemaNode(\n compact({\n '@type': 'BlogPosting',\n '@id': input.id,\n url: input.url,\n headline: input.headline,\n description: input.description,\n datePublished: input.datePublished,\n dateModified: input.dateModified ?? input.datePublished,\n author: input.authorNames.map((name) => ({ '@type': 'Person', name })),\n publisher: { '@id': input.publisherId },\n image: input.imageUrls,\n mainEntityOfPage: input.mainEntityOfPageId\n ? { '@id': input.mainEntityOfPageId }\n : { '@id': input.url },\n }),\n )\n}\n"]}
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAQ9C,MAAM,UAAU,cAAc,CAAC,IAAa;IAC1C,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;SACxB,OAAO,CAAC,IAAI,EAAE,S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C,kBAAkB;YACxC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,kBAAkB,EAAE;YACrC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,EAAE;QACxB,KAAK,EACH,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;YACzC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;gBAC3B,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;gBAC9B,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;YAC/C,CAAC,CAAC,SAAS;QACf,cAAc,EAAE,KAAK,CAAC,cAAc;KACrC,CAAC,CACH,CAAA;AACH,CAAC","sourcesContent":["import type { BrandlabDerivedBusinessFacts } from './business.js'\nimport type { BreadcrumbItem as SemanticBreadcrumbItem } from './breadcrumbs.js'\nimport { getAbsoluteUrl } from './metadata.js'\n\nexport type Schema<T> = {\n '@context': 'https://schema.org'\n} & T\n\nexport type BreadcrumbItem = SemanticBreadcrumbItem\n\nexport function sanitizeJsonLd(data: unknown): string {\n return JSON.stringify(data)\n .replace(/</g, '\\\\u003c')\n .replace(/>/g, '\\\\u003e')\n .replace(/&/g, '\\\\u0026')\n .replace(/\\u2028/g, '\\\\u2028')\n .replace(/\\u2029/g, '\\\\u2029')\n}\n\nexport function createSchema<T extends Record<string, unknown>>(data: T): Schema<T> {\n if (Object.hasOwn(data, '@context')) {\n throw new Error('Schema builders own @context; pass only schema node fields.')\n }\n return {\n '@context': 'https://schema.org',\n ...data,\n }\n}\n\nexport function createSchemaGraph(...nodes: unknown[]): Schema<{ '@graph': unknown[] }> {\n const filtered = nodes.filter(Boolean)\n const ids = filtered\n .map((node) =>\n node && typeof node === 'object'\n ? (node as { '@id'?: unknown })['@id']\n : undefined,\n )\n .filter((id): id is string => typeof id === 'string')\n const duplicates = ids.filter((id, index) => ids.indexOf(id) !== index)\n\n if (duplicates.length > 0) {\n throw new Error(\n `Duplicate @id values in one schema graph: ${[...new Set(duplicates)].join(', ')}.`,\n )\n }\n\n return {\n '@context': 'https://schema.org',\n '@graph': filtered,\n }\n}\n\nexport function appendSchemaAnchor(url: string, anchor: string) {\n const cleanAnchor = anchor.replace(/^#+/, '')\n assertNonEmpty(cleanAnchor, 'anchor')\n assertAbsoluteUrl(url, 'url')\n const parsed = new URL(url)\n parsed.search = ''\n parsed.hash = ''\n const normalizedUrl = parsed.pathname === '/' ? parsed.origin + '/' : parsed.href.replace(/\\/$/, '')\n\n return `${normalizedUrl}#${cleanAnchor}`\n}\n\nexport interface SchemaIdRoutes {\n service: (slug: string) => string\n blogPost: (slug: string) => string\n}\n\nexport interface SchemaIdOptions {\n siteUrl: string\n anchors?: {\n business?: string\n website?: string\n service?: string\n article?: string\n }\n routes: SchemaIdRoutes\n}\n\nfunction normalizeSiteUrl(siteUrl: string) {\n assertAbsoluteUrl(siteUrl, 'siteUrl')\n const parsed = new URL(siteUrl)\n if (parsed.pathname !== '/' || parsed.search || parsed.hash) {\n throw new Error('siteUrl must be an absolute HTTPS origin.')\n }\n return parsed.origin\n}\n\nfunction absoluteUrl(siteUrl: string, pathOrUrl: string) {\n if (/^https?:/i.test(pathOrUrl)) {\n assertAbsoluteUrl(pathOrUrl, 'schema URL')\n return pathOrUrl\n }\n return getAbsoluteUrl(normalizeSiteUrl(siteUrl), pathOrUrl.startsWith('/') ? pathOrUrl : `/${pathOrUrl}`)\n}\n\nexport function createSchemaIdHelpers(options: SchemaIdOptions) {\n const siteUrl = normalizeSiteUrl(options.siteUrl)\n const anchors = {\n business: '/#business',\n website: '/#website',\n service: '#service',\n article: '#article',\n ...options.anchors,\n }\n\n return {\n businessId: () => `${siteUrl}${anchors.business}`,\n websiteId: () => `${siteUrl}${anchors.website}`,\n serviceIdForSlug: (slug: string) =>\n `${absoluteUrl(siteUrl, options.routes.service(slug))}${anchors.service}`,\n serviceIdForPath: (pathOrUrl: string) =>\n `${absoluteUrl(siteUrl, pathOrUrl)}${anchors.service}`,\n blogPostId: (slug: string) =>\n `${absoluteUrl(siteUrl, options.routes.blogPost(slug))}${anchors.article}`,\n blogPostPageId: (slug: string) => absoluteUrl(siteUrl, options.routes.blogPost(slug)),\n }\n}\n\n/**\n * BreadcrumbList JSON-LD for a trail. Only the final crumb (the current page) may\n * omit its href: Google rejects a list whose earlier ListItem has no `item`\n * (\"Missing field item\"), so such a trail throws (3.3.3), as defineBreadcrumbTrail does.\n */\nexport function buildBreadcrumbListSchema(\n breadcrumbs: BreadcrumbItem[],\n options: { absoluteUrl: (path: string) => string },\n) {\n return {\n '@type': 'BreadcrumbList',\n itemListElement: breadcrumbs.map((crumb, index) => {\n assertNonEmpty(crumb.name, `breadcrumbs[${index}].name`)\n if (!crumb.href && index < breadcrumbs.length - 1) {\n throw new Error(\n `breadcrumbs[${index}] (\"${crumb.name}\") has no href, but only the final breadcrumb may omit its URL: Google rejects a BreadcrumbList whose earlier item has no \"item\". Give it the page it names (for example its section index).`,\n )\n }\n const url = crumb.href ? options.absoluteUrl(crumb.href) : undefined\n if (url) assertAbsoluteUrl(url, `breadcrumbs[${index}].url`)\n return {\n '@type': 'ListItem',\n position: index + 1,\n name: crumb.name,\n item: url\n ? {\n '@type': 'WebPage',\n '@id': url,\n url,\n name: crumb.name,\n }\n : undefined,\n }\n }),\n }\n}\n\nexport type BrandlabSchemaNode = Record<string, unknown> & {\n '@type': string\n '@id'?: string\n}\n\nexport interface BrandlabSchemaExtension {\n node: BrandlabSchemaNode\n rationale: string\n visibleEvidence: string\n}\n\nconst PROHIBITED_SCHEMA_TYPES = new Set([\n 'AggregateRating',\n 'AggregateOffer',\n 'FAQPage',\n 'HowTo',\n 'Offer',\n 'OfferCatalog',\n 'Product',\n 'Review',\n])\nconst PROHIBITED_SCHEMA_PROPERTIES = new Set([\n 'aggregaterating',\n 'hasoffercatalog',\n 'itemoffered',\n 'offer',\n 'offers',\n 'review',\n 'reviews',\n])\n\nfunction compactSchemaTerm(value: string) {\n const direct = /^(?:https?:\\/\\/)?schema\\.org[/#]([^/#]+)$/i.exec(value)\n if (direct) return direct[1]!\n return value.toLowerCase().startsWith('schema:') ? value.slice('schema:'.length) : value\n}\n\nfunction assertNonEmpty(value: string, field: string) {\n if (!value.trim()) throw new Error(`${field} cannot be empty.`)\n}\n\nfunction assertAbsoluteUrl(value: string, field: string) {\n let url: URL\n try {\n url = new URL(value)\n } catch {\n throw new Error(`${field} must be an absolute HTTPS URL.`)\n }\n if (url.protocol !== 'https:' || url.username || url.password) {\n throw new Error(`${field} must be an absolute HTTPS URL.`)\n }\n}\n\nfunction assertSafeSchemaValue(\n value: unknown,\n path: string,\n ancestors = new WeakSet<object>(),\n) {\n if (!value || typeof value !== 'object') return\n\n if (ancestors.has(value)) {\n throw new Error(`Schema payload contains a cyclic value at ${path}.`)\n }\n ancestors.add(value)\n\n try {\n if (Array.isArray(value)) {\n value.forEach((item, index) =>\n assertSafeSchemaValue(item, `${path}[${index}]`, ancestors),\n )\n return\n }\n\n const object = value as Record<string, unknown>\n if (Object.hasOwn(object, '@context')) {\n if (path !== 'schema' || object['@context'] !== 'https://schema.org') {\n throw new Error(\n `Schema @context at ${path} must be the single top-level literal \"https://schema.org\"; custom, local, array and nested contexts are unsupported.`,\n )\n }\n }\n Object.entries(object).forEach(([key, child]) => {\n if (key === '@context') return\n\n if (key.startsWith('@') && !['@graph', '@id', '@type'].includes(key)) {\n throw new Error(`JSON-LD keyword \"${key}\" is unsupported at ${path}.`)\n }\n\n if (key === '@id' && typeof child === 'string') {\n assertAbsoluteUrl(child, `${path}.@id`)\n }\n\n if (key === '@type') {\n const types = Array.isArray(child) ? child : [child]\n types.forEach((type) => {\n const compactType = typeof type === 'string' ? compactSchemaTerm(type) : ''\n if (PROHIBITED_SCHEMA_TYPES.has(compactType)) {\n throw new Error(`Schema type \"${type}\" is prohibited at ${path}.`)\n }\n })\n }\n\n const compactProperty = compactSchemaTerm(key).toLowerCase()\n if (PROHIBITED_SCHEMA_PROPERTIES.has(compactProperty)) {\n throw new Error(`Schema property \"${key}\" is prohibited at ${path}.`)\n }\n\n assertSafeSchemaValue(child, `${path}.${key}`, ancestors)\n })\n } finally {\n ancestors.delete(value)\n }\n}\n\n/** Validates a complete JSON-LD payload before a rendering adapter serializes it. */\nexport function assertProofSafeSchema<T>(schema: T): T {\n if (\n !schema ||\n typeof schema !== 'object' ||\n Array.isArray(schema) ||\n (schema as Record<string, unknown>)['@context'] !== 'https://schema.org'\n ) {\n throw new Error(\n 'A rendered schema payload must use the literal \"https://schema.org\" @context.',\n )\n }\n assertSafeSchemaValue(schema, 'schema')\n return schema\n}\n\nexport function assertSafeSchemaNode(node: BrandlabSchemaNode) {\n assertNonEmpty(node['@type'], '@type')\n if (node['@id']) assertAbsoluteUrl(node['@id'], '@id')\n assertSafeSchemaValue(node, 'schema')\n return node\n}\n\n/** Builds a proof-safe graph from shared builders and reviewed extensions. */\nexport function buildSchemaGraph(options: {\n nodes: readonly (BrandlabSchemaNode | null | false | undefined)[]\n extensions?: readonly BrandlabSchemaExtension[]\n}) {\n const nodes = options.nodes.filter((node): node is BrandlabSchemaNode => Boolean(node))\n nodes.forEach(assertSafeSchemaNode)\n\n const extensionNodes = (options.extensions ?? []).map((extension, index) => {\n assertNonEmpty(extension.rationale, `extensions[${index}].rationale`)\n assertNonEmpty(extension.visibleEvidence, `extensions[${index}].visibleEvidence`)\n return assertSafeSchemaNode(extension.node)\n })\n\n const allNodes = [...nodes, ...extensionNodes]\n const ids = allNodes\n .map((node) => node['@id'])\n .filter((id): id is string => typeof id === 'string')\n const duplicateId = ids.find((id, index) => ids.indexOf(id) !== index)\n if (duplicateId) throw new Error(`Schema graph contains duplicate @id \"${duplicateId}\".`)\n\n return createSchemaGraph(...allNodes) as Schema<{\n '@graph': BrandlabSchemaNode[]\n }>\n}\n\nfunction compact<T extends Record<string, unknown>>(value: T): T {\n return Object.fromEntries(\n Object.entries(value).filter(([, entry]) => entry !== undefined),\n ) as T\n}\n\nexport function buildWebSiteSchema(input: {\n id: string\n url: string\n name: string\n publisherId?: string\n inLanguage?: string\n}) {\n assertNonEmpty(input.name, 'name')\n assertAbsoluteUrl(input.id, 'id')\n assertAbsoluteUrl(input.url, 'url')\n\n return assertSafeSchemaNode(\n compact({\n '@type': 'WebSite',\n '@id': input.id,\n url: input.url,\n name: input.name,\n publisher: input.publisherId ? { '@id': input.publisherId } : undefined,\n inLanguage: input.inLanguage,\n }),\n )\n}\n\nexport function buildWebPageSchema(input: {\n id: string\n url: string\n name: string\n description: string\n websiteId: string\n breadcrumbId?: string\n mainEntityId?: string\n inLanguage?: string\n}) {\n assertNonEmpty(input.name, 'name')\n assertNonEmpty(input.description, 'description')\n assertAbsoluteUrl(input.id, 'id')\n assertAbsoluteUrl(input.url, 'url')\n\n return assertSafeSchemaNode(\n compact({\n '@type': 'WebPage',\n '@id': input.id,\n url: input.url,\n name: input.name,\n description: input.description,\n isPartOf: { '@id': input.websiteId },\n breadcrumb: input.breadcrumbId ? { '@id': input.breadcrumbId } : undefined,\n mainEntity: input.mainEntityId ? { '@id': input.mainEntityId } : undefined,\n inLanguage: input.inLanguage,\n }),\n )\n}\n\n/**\n * The business node's schema.org type: `HomeAndConstructionBusiness` and its trade subtypes (3.20.0 adds HousePainter,\n * HVACBusiness, Locksmith and MovingCompany). schema.org has no carpentry, landscaping, tree or demolition subtype:\n * those trades use `HomeAndConstructionBusiness` (or `GeneralContractor`) and may name the trade with `additionalType`.\n */\nexport type BrandlabLocalBusinessSchemaType =\n | 'LocalBusiness'\n | 'ProfessionalService'\n | 'HomeAndConstructionBusiness'\n | 'Electrician'\n | 'GeneralContractor'\n | 'HousePainter'\n | 'HVACBusiness'\n | 'Locksmith'\n | 'MovingCompany'\n | 'Plumber'\n | 'RoofingContractor'\n\nexport function buildLocalBusinessSchema(input: {\n id: string\n schemaType: BrandlabLocalBusinessSchemaType\n business: BrandlabDerivedBusinessFacts\n description?: string\n logoUrl?: string\n imageUrls?: readonly string[]\n /**\n * 3.20.0: absolute URLs naming the trade where schema.org has no type for it, for example a carpenter's\n * `https://www.wikidata.org/wiki/Q154549`. Never a second business type.\n */\n additionalType?: readonly string[]\n /** 3.20.0: the business's map link, for example its Google Business Profile Maps URL. */\n hasMap?: string\n}) {\n assertAbsoluteUrl(input.id, 'id')\n if (input.description !== undefined) assertNonEmpty(input.description, 'description')\n if (input.logoUrl) assertAbsoluteUrl(input.logoUrl, 'logoUrl')\n input.imageUrls?.forEach((url, index) => assertAbsoluteUrl(url, `imageUrls[${index}]`))\n input.additionalType?.forEach((url, index) => assertAbsoluteUrl(url, `additionalType[${index}]`))\n if (input.additionalType && new Set(input.additionalType).size !== input.additionalType.length) {\n throw new Error('additionalType contains duplicates.')\n }\n if (input.hasMap !== undefined) assertAbsoluteUrl(input.hasMap, 'hasMap')\n\n return assertSafeSchemaNode(\n compact({\n '@type': input.schemaType,\n '@id': input.id,\n additionalType:\n input.additionalType && input.additionalType.length > 0\n ? input.additionalType.length === 1\n ? input.additionalType[0]\n : [...input.additionalType]\n : undefined,\n name: input.business.tradingName,\n legalName: input.business.legalName,\n url: input.business.canonicalUrl,\n telephone: input.business.phone?.schemaTelephone,\n email: input.business.email,\n description: input.description,\n logo: input.logoUrl,\n image: input.imageUrls && input.imageUrls.length > 0 ? input.imageUrls : undefined,\n address: input.business.publicAddress\n ? {\n '@type': 'PostalAddress',\n ...input.business.publicAddress,\n }\n : undefined,\n areaServed:\n input.business.serviceAreas.length > 0\n ? input.business.serviceAreas.map((area) => ({\n '@type':\n area.kind === 'city'\n ? 'City'\n : area.kind === 'state'\n ? 'State'\n : area.kind === 'country'\n ? 'Country'\n : 'Place',\n name: area.name,\n }))\n : undefined,\n openingHoursSpecification:\n input.business.openingHours.length > 0\n ? input.business.openingHours.map((period) => ({\n '@type': 'OpeningHoursSpecification',\n dayOfWeek: period.days,\n opens: period.opens,\n closes: period.closes,\n }))\n : undefined,\n taxID: input.business.abn,\n hasMap: input.hasMap,\n sameAs: input.business.sameAs.length > 0 ? input.business.sameAs : undefined,\n }),\n )\n}\n\nexport function buildServiceSchema(input: {\n id: string\n url: string\n name: string\n description: string\n serviceType: string\n providerId: string\n areaServed?: readonly string[]\n}) {\n assertAbsoluteUrl(input.id, 'id')\n assertAbsoluteUrl(input.url, 'url')\n assertNonEmpty(input.name, 'name')\n assertNonEmpty(input.description, 'description')\n assertNonEmpty(input.serviceType, 'serviceType')\n input.areaServed?.forEach((area, index) => assertNonEmpty(area, `areaServed[${index}]`))\n\n return assertSafeSchemaNode(\n compact({\n '@type': 'Service',\n '@id': input.id,\n url: input.url,\n name: input.name,\n description: input.description,\n serviceType: input.serviceType,\n provider: { '@id': input.providerId },\n areaServed:\n input.areaServed && input.areaServed.length > 0\n ? input.areaServed.map((name) => ({ '@type': 'Place', name }))\n : undefined,\n }),\n )\n}\n\nexport function buildLocationSchema(input: {\n id: string\n url: string\n name: string\n description: string\n websiteId: string\n place: {\n name: string\n containedInPlace?: string\n }\n businessId?: string\n}) {\n assertAbsoluteUrl(input.id, 'id')\n assertAbsoluteUrl(input.url, 'url')\n assertNonEmpty(input.name, 'name')\n assertNonEmpty(input.description, 'description')\n assertNonEmpty(input.place.name, 'place.name')\n\n return assertSafeSchemaNode(\n compact({\n '@type': 'WebPage',\n '@id': input.id,\n url: input.url,\n name: input.name,\n description: input.description,\n isPartOf: { '@id': input.websiteId },\n about: compact({\n '@type': 'Place',\n name: input.place.name,\n containedInPlace: input.place.containedInPlace\n ? { '@type': 'Place', name: input.place.containedInPlace }\n : undefined,\n }),\n mainEntity: input.businessId ? { '@id': input.businessId } : undefined,\n }),\n )\n}\n\nexport function buildBlogPostingSchema(input: {\n id: string\n url: string\n headline: string\n description: string\n datePublished: string\n dateModified?: string\n /** Each named author, as a Person. */\n authorNames?: readonly string[]\n /**\n * 3.20.0: authors that are nodes elsewhere in the graph, by `@id`, such as the business node when the byline is the\n * business (a business is never typed as a Person). At least one author, named or by id.\n */\n authorIds?: readonly string[]\n publisherId: string\n imageUrls?: readonly string[]\n mainEntityOfPageId?: string\n /** 3.20.0: the nodes the article is about, by `@id`, such as the service page's Service node. */\n aboutIds?: readonly string[]\n /** 3.20.0: the group of guides the article sits in, as visible on the site (\"Costs\"). */\n articleSection?: string\n}) {\n assertAbsoluteUrl(input.id, 'id')\n assertAbsoluteUrl(input.url, 'url')\n assertNonEmpty(input.headline, 'headline')\n assertNonEmpty(input.description, 'description')\n if (Number.isNaN(Date.parse(input.datePublished))) throw new Error('datePublished must be valid.')\n if (input.dateModified && Number.isNaN(Date.parse(input.dateModified))) {\n throw new Error('dateModified must be valid.')\n }\n if (\n input.dateModified &&\n Date.parse(input.dateModified) < Date.parse(input.datePublished)\n ) {\n throw new Error('dateModified cannot be earlier than datePublished.')\n }\n const authorNames = input.authorNames ?? []\n const authorIds = input.authorIds ?? []\n if (authorNames.length + authorIds.length === 0) throw new Error('authorNames or authorIds must name at least one author.')\n authorNames.forEach((name, index) => assertNonEmpty(name, `authorNames[${index}]`))\n authorIds.forEach((id, index) => assertAbsoluteUrl(id, `authorIds[${index}]`))\n if (new Set(authorIds).size !== authorIds.length) throw new Error('authorIds contains duplicates.')\n input.aboutIds?.forEach((id, index) => assertAbsoluteUrl(id, `aboutIds[${index}]`))\n if (input.articleSection !== undefined) assertNonEmpty(input.articleSection, 'articleSection')\n input.imageUrls?.forEach((url, index) => assertAbsoluteUrl(url, `imageUrls[${index}]`))\n const authors = [\n ...authorNames.map((name) => ({ '@type': 'Person', name })),\n ...authorIds.map((id) => ({ '@id': id })),\n ]\n\n return assertSafeSchemaNode(\n compact({\n '@type': 'BlogPosting',\n '@id': input.id,\n url: input.url,\n headline: input.headline,\n description: input.description,\n datePublished: input.datePublished,\n dateModified: input.dateModified ?? input.datePublished,\n author: authorIds.length > 0 && authorNames.length === 0 && authors.length === 1 ? authors[0] : authors,\n publisher: { '@id': input.publisherId },\n image: input.imageUrls,\n mainEntityOfPage: input.mainEntityOfPageId\n ? { '@id': input.mainEntityOfPageId }\n : { '@id': input.url },\n about:\n input.aboutIds && input.aboutIds.length > 0\n ? input.aboutIds.length === 1\n ? { '@id': input.aboutIds[0] }\n : input.aboutIds.map((id) => ({ '@id': id }))\n : undefined,\n articleSection: input.articleSection,\n }),\n )\n}\n"]}
@@ -5,7 +5,7 @@
5
5
  * list. The hero or page header comes first and the CTA band last; a site may record an alternative order per family.
6
6
  * The permit note is a line inside `LocalFacts` (permit trades), not a section of its own.
7
7
  *
8
- * `planSectionSequence` is the sequencer's logic (F15), shared by `SectionSequence` in site-next and the K8 and K12
8
+ * `planSectionSequence` is the sequencer's logic (F15), shared by a site's own section sequencer and the K8 and K12
9
9
  * checks: skip what has nothing true to show, enforce the cap (only optional and recommended sections drop),
10
10
  * alternate the light tones so neighbours differ (at most one `band` and one `photo`) and write the per-page manifest.
11
11
  *
@@ -5,7 +5,7 @@
5
5
  * list. The hero or page header comes first and the CTA band last; a site may record an alternative order per family.
6
6
  * The permit note is a line inside `LocalFacts` (permit trades), not a section of its own.
7
7
  *
8
- * `planSectionSequence` is the sequencer's logic (F15), shared by `SectionSequence` in site-next and the K8 and K12
8
+ * `planSectionSequence` is the sequencer's logic (F15), shared by a site's own section sequencer and the K8 and K12
9
9
  * checks: skip what has nothing true to show, enforce the cap (only optional and recommended sections drop),
10
10
  * alternate the light tones so neighbours differ (at most one `band` and one `photo`) and write the per-page manifest.
11
11
  *