@brandlab-digital/site-core 3.19.1 → 3.20.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.
package/dist/blog.d.ts CHANGED
@@ -5,6 +5,11 @@ export interface BrandlabBlogAuthor {
5
5
  id: string;
6
6
  name: string;
7
7
  profileUrl?: string;
8
+ /**
9
+ * 3.20.0: the `@id` of the graph node this author is, when the byline is the business (its `#business` node): the
10
+ * article's schema then refers to that node instead of typing the business as a Person.
11
+ */
12
+ schemaId?: string;
8
13
  }
9
14
  export interface BrandlabBlogPost {
10
15
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"blog.d.ts","sourceRoot":"","sources":["../src/blog.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAA;AAE9D,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,YAAY,CAAA;AACtD,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,WAAW,CAAA;AAE1D,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,mBAAmB,CAAA;IAC5B,MAAM,EAAE,sBAAsB,CAAA;IAC9B,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,0FAA0F;IAC1F,GAAG,CAAC,EAAE;QACJ,KAAK,EAAE,MAAM,CAAA;QACb,SAAS,CAAC,EAAE,yBAAyB,CAAA;KACtC,CAAA;IACD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,SAAS,kBAAkB,EAAE,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"}
package/dist/blog.js CHANGED
@@ -72,6 +72,8 @@ export function defineBlogPost(post) {
72
72
  }
73
73
  if (author.profileUrl)
74
74
  assertAbsoluteHttpsUrl(author.profileUrl, `authors[${index}].profileUrl`);
75
+ if (author.schemaId !== undefined)
76
+ assertAbsoluteHttpsUrl(author.schemaId, `authors[${index}].schemaId`);
75
77
  });
76
78
  post.categories?.forEach((category, index) => assertNonEmpty(category, `categories[${index}]`));
77
79
  post.tags?.forEach((tag, index) => assertNonEmpty(tag, `tags[${index}]`));
package/dist/blog.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"blog.js","sourceRoot":"","sources":["../src/blog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAA;AAqCxD,SAAS,cAAc,CAAC,KAAa,EAAE,KAAa;IAClD,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,mBAAmB,CAAC,CAAA;AACjE,CAAC;AAED,SAAS,SAAS,CAAC,KAAyB,EAAE,KAAa;IACzD,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAA;IAC5B,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IACnC,IAAI,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,wBAAwB,CAAC,CAAA;IAC9E,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,MAAM,aAAa,GAAG,IAAI,GAAG,CAAsB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAA;AACzE,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAyB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAA;AAClF,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAA4B;IACnE,WAAW;IACX,UAAU;CACX,CAAC,CAAA;AAEF,MAAM,UAAU,cAAc,CAAmC,IAA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U,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAA;QAEjD,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;QAE/B,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,IAAI,KAAK,EAAE,CAAA;IACxD,CAAC,CAAA;AACH,CAAC","sourcesContent":["import { normalizeBrandlabRoutePath } from './routes.js'\nimport type { BrandlabMetadataTitleMode } from './metadata.js'\n\nexport type BrandlabBlogAdapter = 'mdx' | 'structured'\nexport type BrandlabBlogPostStatus = 'draft' | 'published'\n\nexport interface BrandlabBlogAuthor {\n id: string\n name: string\n profileUrl?: string\n}\n\nexport interface BrandlabBlogPost {\n id: string\n slug: string\n path: string\n adapter: BrandlabBlogAdapter\n status: BrandlabBlogPostStatus\n headline: string\n description: string\n /** Optional reviewed search title. The visible and schema headline remains `headline`. */\n seo?: {\n title: string\n titleMode?: BrandlabMetadataTitleMode\n }\n publishedAt?: string\n modifiedAt?: string\n authors: readonly BrandlabBlogAuthor[]\n categories?: readonly string[]\n tags?: readonly string[]\n image?: {\n url: string\n alt: string\n }\n contentRef: string\n}\n\nfunction assertNonEmpty(value: string, field: string) {\n if (!value.trim()) throw new Error(`${field} cannot be empty.`)\n}\n\nfunction parseDate(value: string | undefined, field: string) {\n if (!value) return undefined\n const timestamp = Date.parse(value)\n if (Number.isNaN(timestamp)) throw new Error(`${field} must be a valid date.`)\n return timestamp\n}\n\nconst BLOG_ADAPTERS = new Set<BrandlabBlogAdapter>(['mdx', 'structured'])\nconst BLOG_POST_STATUSES = new Set<BrandlabBlogPostStatus>(['draft', 'published'])\nconst BLOG_METADATA_TITLE_MODES = new Set<BrandlabMetadataTitleMode>([\n 'templated',\n 'absolute',\n])\n\nexport function defineBlogPost<const T extends BrandlabBlogPost>(post: T): T {\n assertNonEmpty(post.id, 'id')\n assertNonEmpty(post.slug, 'slug')\n assertNonEmpty(post.path, 'path')\n assertNonEmpty(post.headline, 'headline')\n assertNonEmpty(post.description, 'description')\n assertNonEmpty(post.contentRef, 'contentRef')\n\n if (post.seo) {\n if (\n typeof post.seo.title !== 'string' ||\n !post.seo.title.trim() ||\n post.seo.title.trim() !== post.seo.title ||\n post.seo.title.length > 160 ||\n /[\\u0000-\\u001f\\u007f]/.test(post.seo.title)\n ) {\n throw new Error('seo.title must be bounded, trimmed, single-line text.')\n }\n if (\n post.seo.titleMode !== undefined &&\n !BLOG_METADATA_TITLE_MODES.has(post.seo.titleMode)\n ) {\n throw new Error('seo.titleMode must be \"templated\" or \"absolute\".')\n }\n }\n\n if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(post.id)) {\n throw new Error('id must be lowercase kebab-case.')\n }\n if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(post.slug)) {\n throw new Error('slug must be lowercase kebab-case.')\n }\n if (!BLOG_ADAPTERS.has(post.adapter)) {\n throw new Error('adapter must be \"mdx\" or \"structured\".')\n }\n if (!BLOG_POST_STATUSES.has(post.status)) {\n throw new Error('status must be \"draft\" or \"published\".')\n }\n try {\n normalizeBrandlabRoutePath(post.path)\n } catch {\n throw new Error('path must be root-relative without a query string or hash.')\n }\n if (post.path.split('/').filter(Boolean).at(-1) !== post.slug) {\n throw new Error('path must end with the canonical post slug.')\n }\n if (post.authors.length === 0) throw new Error('authors cannot be empty.')\n const authorIds = post.authors.map((author) => author.id)\n if (new Set(authorIds).size !== authorIds.length) {\n throw new Error('authors contains duplicate IDs.')\n }\n post.authors.forEach((author, index) => {\n assertNonEmpty(author.id, `authors[${index}].id`)\n assertNonEmpty(author.name, `authors[${index}].name`)\n if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(author.id)) {\n throw new Error(`authors[${index}].id must be lowercase kebab-case.`)\n }\n if (author.profileUrl) assertAbsoluteHttpsUrl(author.profileUrl, `authors[${index}].profileUrl`)\n })\n post.categories?.forEach((category, index) =>\n assertNonEmpty(category, `categories[${index}]`),\n )\n post.tags?.forEach((tag, index) => assertNonEmpty(tag, `tags[${index}]`))\n if (post.categories && new Set(post.categories).size !== post.categories.length) {\n throw new Error('categories contains duplicates.')\n }\n if (post.tags && new Set(post.tags).size !== post.tags.length) {\n throw new Error('tags contains duplicates.')\n }\n\n const publishedAt = parseDate(post.publishedAt, 'publishedAt')\n const modifiedAt = parseDate(post.modifiedAt, 'modifiedAt')\n if (post.status === 'published' && publishedAt === undefined) {\n throw new Error('A published post requires publishedAt.')\n }\n if (publishedAt !== undefined && modifiedAt !== undefined && modifiedAt < publishedAt) {\n throw new Error('modifiedAt cannot be earlier than publishedAt.')\n }\n\n if (post.image) {\n assertNonEmpty(post.image.url, 'image.url')\n assertNonEmpty(post.image.alt, 'image.alt')\n if (post.image.url.startsWith('/')) {\n normalizeBrandlabRoutePath(post.image.url)\n } else {\n assertAbsoluteHttpsUrl(post.image.url, 'image.url')\n }\n }\n\n return post\n}\n\nfunction assertAbsoluteHttpsUrl(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\nexport function isPublishedBlogPost(\n post: BrandlabBlogPost,\n now: Date = new Date(),\n): post is BrandlabBlogPost & { status: 'published'; publishedAt: string } {\n return (\n post.status === 'published' &&\n Boolean(post.publishedAt) &&\n Date.parse(post.publishedAt ?? '') <= now.getTime()\n )\n}\n\nexport function getPublishedBlogPosts(\n posts: readonly BrandlabBlogPost[],\n now: Date = new Date(),\n) {\n return posts\n .filter((post): post is BrandlabBlogPost & { status: 'published'; publishedAt: string } =>\n isPublishedBlogPost(post, now),\n )\n .sort((left, right) => Date.parse(right.publishedAt) - Date.parse(left.publishedAt))\n}\n\n/**\n * Heading anchor slug used by the fleet's MDX heading IDs: lower-case, drop\n * characters other than letters, digits, underscores, spaces and hyphens, then\n * hyphenate whitespace. Headings without usable text become `section`.\n */\nexport function slugifyHeading(text: string): string {\n const slug = text\n .toLowerCase()\n .replace(/[^\\w\\s-]/g, '')\n .replace(/\\s+/g, '-')\n .replace(/-+/g, '-')\n .trim()\n\n return slug.length > 0 ? slug : 'section'\n}\n\n/**\n * Returns a per-document slugger: create one per rendered article so repeated\n * heading text receives `-2`, `-3` suffixes in document order.\n */\nexport function createHeadingSlugger() {\n const slugCounts = new Map<string, number>()\n\n return (text: string): string => {\n const baseSlug = slugifyHeading(text)\n const count = (slugCounts.get(baseSlug) ?? 0) + 1\n\n slugCounts.set(baseSlug, count)\n\n return count === 1 ? baseSlug : `${baseSlug}-${count}`\n }\n}\n"]}
1
+ {"version":3,"file":"blog.js","sourceRoot":"","sources":["../src/blog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAA;AA0CxD,SAAS,cAAc,CAAC,KAAa,EAAE,KAAa;IAClD,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,mBAAmB,CAAC,CAAA;AACjE,CAAC;AAED,SAAS,SAAS,CAAC,KAAyB,EAAE,KAAa;IACzD,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAA;IAC5B,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IACnC,IAAI,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,wBAAwB,CAAC,CAAA;IAC9E,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,MAAM,aAAa,GAAG,IAAI,GAAG,CAAsB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAA;AACzE,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAyB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAA;AAClF,MAAM,yBAAyB,GAAG,IAAI,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GAGG;AACH,MAAM,UAAU,oBAAoB;IAClC,MAAM,UAAU,GAAG,IAAI,GAAG,EAAkB,CAAA;IAE5C,OAAO,CAAC,IAAY,EAAU,EAAE;QAC9B,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,CAAC,CAAA;QACrC,MAAM,KAAK,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAA;QAEjD,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;QAE/B,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,IAAI,KAAK,EAAE,CAAA;IACxD,CAAC,CAAA;AACH,CAAC","sourcesContent":["import { normalizeBrandlabRoutePath } from './routes.js'\nimport type { BrandlabMetadataTitleMode } from './metadata.js'\n\nexport type BrandlabBlogAdapter = 'mdx' | 'structured'\nexport type BrandlabBlogPostStatus = 'draft' | 'published'\n\nexport interface BrandlabBlogAuthor {\n id: string\n name: string\n profileUrl?: string\n /**\n * 3.20.0: the `@id` of the graph node this author is, when the byline is the business (its `#business` node): the\n * article's schema then refers to that node instead of typing the business as a Person.\n */\n schemaId?: string\n}\n\nexport interface BrandlabBlogPost {\n id: string\n slug: string\n path: string\n adapter: BrandlabBlogAdapter\n status: BrandlabBlogPostStatus\n headline: string\n description: string\n /** Optional reviewed search title. The visible and schema headline remains `headline`. */\n seo?: {\n title: string\n titleMode?: BrandlabMetadataTitleMode\n }\n publishedAt?: string\n modifiedAt?: string\n authors: readonly BrandlabBlogAuthor[]\n categories?: readonly string[]\n tags?: readonly string[]\n image?: {\n url: string\n alt: string\n }\n contentRef: string\n}\n\nfunction assertNonEmpty(value: string, field: string) {\n if (!value.trim()) throw new Error(`${field} cannot be empty.`)\n}\n\nfunction parseDate(value: string | undefined, field: string) {\n if (!value) return undefined\n const timestamp = Date.parse(value)\n if (Number.isNaN(timestamp)) throw new Error(`${field} must be a valid date.`)\n return timestamp\n}\n\nconst BLOG_ADAPTERS = new Set<BrandlabBlogAdapter>(['mdx', 'structured'])\nconst BLOG_POST_STATUSES = new Set<BrandlabBlogPostStatus>(['draft', 'published'])\nconst BLOG_METADATA_TITLE_MODES = new Set<BrandlabMetadataTitleMode>([\n 'templated',\n 'absolute',\n])\n\nexport function defineBlogPost<const T extends BrandlabBlogPost>(post: T): T {\n assertNonEmpty(post.id, 'id')\n assertNonEmpty(post.slug, 'slug')\n assertNonEmpty(post.path, 'path')\n assertNonEmpty(post.headline, 'headline')\n assertNonEmpty(post.description, 'description')\n assertNonEmpty(post.contentRef, 'contentRef')\n\n if (post.seo) {\n if (\n typeof post.seo.title !== 'string' ||\n !post.seo.title.trim() ||\n post.seo.title.trim() !== post.seo.title ||\n post.seo.title.length > 160 ||\n /[\\u0000-\\u001f\\u007f]/.test(post.seo.title)\n ) {\n throw new Error('seo.title must be bounded, trimmed, single-line text.')\n }\n if (\n post.seo.titleMode !== undefined &&\n !BLOG_METADATA_TITLE_MODES.has(post.seo.titleMode)\n ) {\n throw new Error('seo.titleMode must be \"templated\" or \"absolute\".')\n }\n }\n\n if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(post.id)) {\n throw new Error('id must be lowercase kebab-case.')\n }\n if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(post.slug)) {\n throw new Error('slug must be lowercase kebab-case.')\n }\n if (!BLOG_ADAPTERS.has(post.adapter)) {\n throw new Error('adapter must be \"mdx\" or \"structured\".')\n }\n if (!BLOG_POST_STATUSES.has(post.status)) {\n throw new Error('status must be \"draft\" or \"published\".')\n }\n try {\n normalizeBrandlabRoutePath(post.path)\n } catch {\n throw new Error('path must be root-relative without a query string or hash.')\n }\n if (post.path.split('/').filter(Boolean).at(-1) !== post.slug) {\n throw new Error('path must end with the canonical post slug.')\n }\n if (post.authors.length === 0) throw new Error('authors cannot be empty.')\n const authorIds = post.authors.map((author) => author.id)\n if (new Set(authorIds).size !== authorIds.length) {\n throw new Error('authors contains duplicate IDs.')\n }\n post.authors.forEach((author, index) => {\n assertNonEmpty(author.id, `authors[${index}].id`)\n assertNonEmpty(author.name, `authors[${index}].name`)\n if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(author.id)) {\n throw new Error(`authors[${index}].id must be lowercase kebab-case.`)\n }\n if (author.profileUrl) assertAbsoluteHttpsUrl(author.profileUrl, `authors[${index}].profileUrl`)\n if (author.schemaId !== undefined) assertAbsoluteHttpsUrl(author.schemaId, `authors[${index}].schemaId`)\n })\n post.categories?.forEach((category, index) =>\n assertNonEmpty(category, `categories[${index}]`),\n )\n post.tags?.forEach((tag, index) => assertNonEmpty(tag, `tags[${index}]`))\n if (post.categories && new Set(post.categories).size !== post.categories.length) {\n throw new Error('categories contains duplicates.')\n }\n if (post.tags && new Set(post.tags).size !== post.tags.length) {\n throw new Error('tags contains duplicates.')\n }\n\n const publishedAt = parseDate(post.publishedAt, 'publishedAt')\n const modifiedAt = parseDate(post.modifiedAt, 'modifiedAt')\n if (post.status === 'published' && publishedAt === undefined) {\n throw new Error('A published post requires publishedAt.')\n }\n if (publishedAt !== undefined && modifiedAt !== undefined && modifiedAt < publishedAt) {\n throw new Error('modifiedAt cannot be earlier than publishedAt.')\n }\n\n if (post.image) {\n assertNonEmpty(post.image.url, 'image.url')\n assertNonEmpty(post.image.alt, 'image.alt')\n if (post.image.url.startsWith('/')) {\n normalizeBrandlabRoutePath(post.image.url)\n } else {\n assertAbsoluteHttpsUrl(post.image.url, 'image.url')\n }\n }\n\n return post\n}\n\nfunction assertAbsoluteHttpsUrl(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\nexport function isPublishedBlogPost(\n post: BrandlabBlogPost,\n now: Date = new Date(),\n): post is BrandlabBlogPost & { status: 'published'; publishedAt: string } {\n return (\n post.status === 'published' &&\n Boolean(post.publishedAt) &&\n Date.parse(post.publishedAt ?? '') <= now.getTime()\n )\n}\n\nexport function getPublishedBlogPosts(\n posts: readonly BrandlabBlogPost[],\n now: Date = new Date(),\n) {\n return posts\n .filter((post): post is BrandlabBlogPost & { status: 'published'; publishedAt: string } =>\n isPublishedBlogPost(post, now),\n )\n .sort((left, right) => Date.parse(right.publishedAt) - Date.parse(left.publishedAt))\n}\n\n/**\n * Heading anchor slug used by the fleet's MDX heading IDs: lower-case, drop\n * characters other than letters, digits, underscores, spaces and hyphens, then\n * hyphenate whitespace. Headings without usable text become `section`.\n */\nexport function slugifyHeading(text: string): string {\n const slug = text\n .toLowerCase()\n .replace(/[^\\w\\s-]/g, '')\n .replace(/\\s+/g, '-')\n .replace(/-+/g, '-')\n .trim()\n\n return slug.length > 0 ? slug : 'section'\n}\n\n/**\n * Returns a per-document slugger: create one per rendered article so repeated\n * heading text receives `-2`, `-3` suffixes in document order.\n */\nexport function createHeadingSlugger() {\n const slugCounts = new Map<string, number>()\n\n return (text: string): string => {\n const baseSlug = slugifyHeading(text)\n const count = (slugCounts.get(baseSlug) ?? 0) + 1\n\n slugCounts.set(baseSlug, count)\n\n return count === 1 ? baseSlug : `${baseSlug}-${count}`\n }\n}\n"]}
package/dist/jobs.d.ts CHANGED
@@ -2,9 +2,13 @@
2
2
  * The job log (`src/data/jobs.ts`, 3.14.0): one row per completed job the owner has confirmed, shared by `NearbyJobs`,
3
3
  * project cards, the area map's job places and head-tier decisions. A job names its suburb (registry slug), service
4
4
  * and what was done; its month is optional, because owners often remember the job but not when (a card then shows the
5
- * suburb without "Recent" or a date: "Tree removal nearby: Ryde"). Photos are media-manifest ids, so each carries its
5
+ * suburb without "Recent" or a date: "Tree removal in Ryde"). Photos are media-manifest ids, so each carries its
6
6
  * provenance; only genuine photos of that job may illustrate it.
7
7
  *
8
+ * Website standard (4 Nov 2026): each job card carries a small, plain label naming its own suburb (`jobPlaceLabel`),
9
+ * another suburb's name never goes in a heading, and a job is called nearby only when its suburb shares a border with
10
+ * the page's (`suburbsTouch` in `site-core/area-map`).
11
+ *
8
12
  * Distances rank job cards and are never printed: location copy carries no kilometre figures (L10).
9
13
  */
10
14
  import type { SuburbCentreLookup } from './locations.js';
@@ -46,16 +50,31 @@ export declare function jobPhotos(job: BrandlabJob, media: BrandlabMediaManifest
46
50
  readonly id: string;
47
51
  })[];
48
52
  /**
49
- * A job card's label: "{Service} in {Suburb}" for the page's own suburb, "{Service} nearby: {Suburb}" for any other
50
- * (L4 needs the "nearby" label). Only a dated job says "Recent" (or `prefix`; `''` for none) and ends with
51
- * ", {Month Year}": "Recent tree removal nearby: Ryde, May 2026", but "Tree removal nearby: Ryde" when the month is
52
- * unknown, because an undated job may not be recent.
53
+ * A job's label: "{Service} in {Suburb}", naming the job's own suburb, on its own suburb's page and any other (3.20.0;
54
+ * before, another suburb's job always read "nearby: {Suburb}"). "{Service} nearby: {Suburb}" only with `nearby: true`,
55
+ * for a job whose suburb shares a border with the page's (`suburbsTouch` in `site-core/area-map`). Only a dated job
56
+ * says "Recent" (or `prefix`; `''` for none) and ends with ", {Month Year}": "Recent tree removal in Ryde, May 2026",
57
+ * but "Tree removal in Ryde" when the month is unknown, because an undated job may not be recent. On a page about
58
+ * another suburb this names that suburb, so it is a caption or label, never a heading (`jobPlaceLabel` is the plain
59
+ * suburb label beside a heading about the work).
53
60
  */
54
61
  export declare function jobCardLabel(job: BrandlabJob, options: {
55
62
  readonly service: string;
56
63
  readonly suburbName: string;
57
64
  readonly pageSuburb?: string;
58
65
  readonly prefix?: string;
66
+ /** The job's suburb shares a border with the page's; ignored for the page's own suburb. */
67
+ readonly nearby?: boolean;
68
+ }): string;
69
+ /**
70
+ * A job card's small, plain place label (3.20.0): the job's suburb, then its month when known: "Ryde · May 2026", or
71
+ * "Ryde". With `nearby: true` (the suburbs share a border: `suburbsTouch` in `site-core/area-map`) it leads with
72
+ * "Nearby": "Nearby · Ryde · May 2026". It sits beside a heading about the work, so no heading names another suburb.
73
+ */
74
+ export declare function jobPlaceLabel(job: BrandlabJob, options: {
75
+ readonly suburbName: string;
76
+ readonly nearby?: boolean;
77
+ readonly separator?: string;
59
78
  }): string;
60
79
  export interface BrandlabNearbyJob<T extends BrandlabJob = BrandlabJob> {
61
80
  readonly job: T;
@@ -1 +1 @@
1
- {"version":3,"file":"jobs.d.ts","sourceRoot":"","sources":["../src/jobs.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAExD,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAE3E,MAAM,WAAW,WAAW;IAC1B,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,kEAAkE;IAClE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,wDAAwD;IACxD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,wCAAwC;IACxC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,wDAAwD;IACxD,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACnC,gFAAgF;IAChF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED,sGAAsG;AACtG,eAAO,MAAM,eAAe,KAAK,CAAA;AACjC,yCAAyC;AACzC,eAAO,MAAM,cAAc,IAAI,CAAA;AAY/B;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,GAAE;IAAE,QAAQ,CAAC,KAAK,CAAC,EA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AS,WAAW,EAAE,GAAG,MAAM,EAAE,CAEhE"}
package/dist/jobs.js CHANGED
@@ -67,20 +67,35 @@ function formatMonth(month) {
67
67
  return new Intl.DateTimeFormat('en-AU', { month: 'long', year: 'numeric', timeZone: 'UTC' }).format(new Date(`${month}-01T00:00:00Z`));
68
68
  }
69
69
  /**
70
- * A job card's label: "{Service} in {Suburb}" for the page's own suburb, "{Service} nearby: {Suburb}" for any other
71
- * (L4 needs the "nearby" label). Only a dated job says "Recent" (or `prefix`; `''` for none) and ends with
72
- * ", {Month Year}": "Recent tree removal nearby: Ryde, May 2026", but "Tree removal nearby: Ryde" when the month is
73
- * unknown, because an undated job may not be recent.
70
+ * A job's label: "{Service} in {Suburb}", naming the job's own suburb, on its own suburb's page and any other (3.20.0;
71
+ * before, another suburb's job always read "nearby: {Suburb}"). "{Service} nearby: {Suburb}" only with `nearby: true`,
72
+ * for a job whose suburb shares a border with the page's (`suburbsTouch` in `site-core/area-map`). Only a dated job
73
+ * says "Recent" (or `prefix`; `''` for none) and ends with ", {Month Year}": "Recent tree removal in Ryde, May 2026",
74
+ * but "Tree removal in Ryde" when the month is unknown, because an undated job may not be recent. On a page about
75
+ * another suburb this names that suburb, so it is a caption or label, never a heading (`jobPlaceLabel` is the plain
76
+ * suburb label beside a heading about the work).
74
77
  */
75
78
  export function jobCardLabel(job, options) {
76
79
  const service = options.service.trim().toLowerCase();
77
- const where = job.suburb === options.pageSuburb ? `in ${options.suburbName}` : `nearby: ${options.suburbName}`;
80
+ const where = job.suburb !== options.pageSuburb && options.nearby === true ? `nearby: ${options.suburbName}` : `in ${options.suburbName}`;
78
81
  if (!job.month)
79
82
  return `${capitalise(service)} ${where}`;
80
83
  const prefix = (options.prefix ?? 'Recent').trim();
81
84
  const lead = prefix ? `${prefix} ${service}` : capitalise(service);
82
85
  return `${lead} ${where}, ${formatMonth(job.month)}`;
83
86
  }
87
+ /**
88
+ * A job card's small, plain place label (3.20.0): the job's suburb, then its month when known: "Ryde · May 2026", or
89
+ * "Ryde". With `nearby: true` (the suburbs share a border: `suburbsTouch` in `site-core/area-map`) it leads with
90
+ * "Nearby": "Nearby · Ryde · May 2026". It sits beside a heading about the work, so no heading names another suburb.
91
+ */
92
+ export function jobPlaceLabel(job, options) {
93
+ const suburb = options.suburbName.trim();
94
+ if (!suburb)
95
+ throw new Error(`jobPlaceLabel: job "${job.id}" has no suburb name.`);
96
+ const separator = options.separator ?? ' · ';
97
+ return [...(options.nearby === true ? ['Nearby'] : []), suburb, ...(job.month ? [formatMonth(job.month)] : [])].join(separator);
98
+ }
84
99
  function capitalise(text) {
85
100
  return text.charAt(0).toUpperCase() + text.slice(1);
86
101
  }
package/dist/jobs.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"jobs.js","sourceRoot":"","sources":["../src/jobs.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAyBzD,sGAAsG;AACtG,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAA;AACjC,yCAAyC;AACzC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAA;AAE/B,MAAM,IAAI,GAAG,4BAA4B,CAAA;AACzC,MAAM,KAAK,GAAG,2BAA2B,CAAA;AACzC,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;AAE7F,SAAS,UAAU,CAAC,KAAc,EAAE,KAAa,EAAE,OAAe;IAChE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,OAAO,IAAI,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1I,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,iCAAiC,CAA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,IAAI,EAAE,CAAC;QACvB,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,GAAG,CAAC,OAAO,KAAK,OAAO,CAAC,OAAO;YAAE,SAAQ;QAC9E,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,KAAK,MAAM,CAAA;QACxC,MAAM,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QAC3D,IAAI,CAAC,EAAE;YAAE,SAAQ;QACjB,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;QACtE,IAAI,UAAU,IAAI,KAAK;YAAE,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAA;IACtE,CAAC;IACD,OAAO,KAAK;SACT,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;SACxH,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;AACpB,CAAC;AAED,mHAAmH;AACnH,MAAM,UAAU,SAAS,CAAC,IAA4B;IACpD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;AACtC,CAAC","sourcesContent":["/**\n * The job log (`src/data/jobs.ts`, 3.14.0): one row per completed job the owner has confirmed, shared by `NearbyJobs`,\n * project cards, the area map's job places and head-tier decisions. A job names its suburb (registry slug), service\n * and what was done; its month is optional, because owners often remember the job but not when (a card then shows the\n * suburb without \"Recent\" or a date: \"Tree removal nearby: Ryde\"). Photos are media-manifest ids, so each carries its\n * provenance; only genuine photos of that job may illustrate it.\n *\n * Distances rank job cards and are never printed: location copy carries no kilometre figures (L10).\n */\nimport type { SuburbCentreLookup } from './locations.js'\nimport { distanceBetweenCentresKm } from './locations.js'\nimport type { BrandlabMediaEntry, BrandlabMediaManifest } from './media.js'\n\nexport interface BrandlabJob {\n /** A stable kebab-case id; genuine photos of the job name it in their media entry's `job`. */\n readonly id: string\n /** The registry suburb slug, for example \"ryde\". */\n readonly suburb: string\n /** The service slug, as the site's service catalogue names it. */\n readonly service: string\n /** What was done, in one line of Australian English. */\n readonly outcome: string\n /**\n * The job's own short title (3.17.0), for example \"Leaning gum beside a pool\". A job card uses it where its label\n * would repeat another card's (\"Tree removal in Eastwood\" twice), or on every card with `cardTitle: 'job'`.\n */\n readonly title?: string\n /** YYYY-MM, when the owner knows it. */\n readonly month?: string\n /** Media-manifest ids of genuine photos of this job. */\n readonly photos?: readonly string[]\n /** Who confirmed the job and when, for example \"Owner, WhatsApp 3 Oct 2026\". */\n readonly source: string\n}\n\n/** Job cards show jobs within this distance of the page's suburb (v2: the 10 km cap on job cards). */\nexport const JOB_CARD_MAX_KM = 10\n/** Cards per page (playbook: 1 to 3). */\nexport const JOB_CARD_LIMIT = 3\n\nconst SLUG = /^[a-z0-9]+(?:-[a-z0-9]+)*$/\nconst MONTH = /^\\d{4}-(?:0[1-9]|1[0-2])$/\nconst JOB_KEYS = ['id', 'suburb', 'service', 'outcome', 'title', 'month', 'photos', 'source']\n\nfunction assertText(value: unknown, field: string, maximum: number) {\n if (typeof value !== 'string' || !value.trim() || value.trim() !== value || value.length > maximum || /[\\u0000-\\u001f\\u007f]/.test(value)) {\n throw new Error(`${field} must be bounded, trimmed text.`)\n }\n}\n\n/**\n * Validates the job log. With the media manifest, every photo must exist, be `genuine` (stock and AI images never\n * stand for the client's work) and, when its entry names a job, name this one.\n */\nexport function defineJobs<const T extends readonly BrandlabJob[]>(jobs: T, options: { readonly media?: BrandlabMediaManifest } = {}): T {\n if (!Array.isArray(jobs)) throw new Error('The job log must be a list.')\n const ids = new Set<string>()\n jobs.forEach((job, index) => {\n const field = `jobs[${index}]`\n if (!job || typeof job !== 'object' || Array.isArray(job)) throw new Error(`${field} must be a record.`)\n const unknown = Object.keys(job).find((key) => !JOB_KEYS.includes(key))\n if (unknown) throw new Error(`${field}.${unknown} is not a job field.`)\n if (typeof job.id !== 'string' || !SLUG.test(job.id)) throw new Error(`${field}.id must be a kebab-case id.`)\n if (ids.has(job.id)) throw new Error(`The job log lists \"${job.id}\" more than once.`)\n ids.add(job.id)\n if (typeof job.suburb !== 'string' || !SLUG.test(job.suburb)) throw new Error(`${field}.suburb must be the registry suburb slug.`)\n if (typeof job.service !== 'string' || !SLUG.test(job.service)) throw new Error(`${field}.service must be the service slug.`)\n assertText(job.outcome, `${field}.outcome`, 300)\n assertText(job.source, `${field}.source`, 200)\n if (job.title !== undefined) assertText(job.title, `${field}.title`, 80)\n if (job.month !== undefined && (typeof job.month !== 'string' || !MONTH.test(job.month))) throw new Error(`${field}.month must be YYYY-MM, or left out.`)\n if (job.photos !== undefined) {\n if (!Array.isArray(job.photos)) throw new Error(`${field}.photos must be a list of media ids.`)\n for (const id of job.photos) {\n if (!options.media) continue\n const entry = Object.hasOwn(options.media, id) ? options.media[id] : undefined\n if (!entry) throw new Error(`${field}.photos: \"${id}\" is not in the media manifest.`)\n if (entry.provenance !== 'genuine') throw new Error(`${field}.photos: \"${id}\" is ${entry.provenance}; only genuine photos show a job.`)\n if (entry.job !== undefined && entry.job !== job.id) throw new Error(`${field}.photos: \"${id}\" is a photo of ${entry.job}, not ${job.id}.`)\n }\n }\n })\n return jobs\n}\n\n/** A job's photos from the media manifest, in order, with their ids and provenance. */\nexport function jobPhotos(job: BrandlabJob, media: BrandlabMediaManifest): (BrandlabMediaEntry & { readonly id: string })[] {\n return (job.photos ?? []).flatMap((id) => (Object.hasOwn(media, id) ? [{ id, ...media[id]! }] : []))\n}\n\nfunction formatMonth(month: string): string {\n return new Intl.DateTimeFormat('en-AU', { month: 'long', year: 'numeric', timeZone: 'UTC' }).format(new Date(`${month}-01T00:00:00Z`))\n}\n\n/**\n * A job card's label: \"{Service} in {Suburb}\" for the page's own suburb, \"{Service} nearby: {Suburb}\" for any other\n * (L4 needs the \"nearby\" label). Only a dated job says \"Recent\" (or `prefix`; `''` for none) and ends with\n * \", {Month Year}\": \"Recent tree removal nearby: Ryde, May 2026\", but \"Tree removal nearby: Ryde\" when the month is\n * unknown, because an undated job may not be recent.\n */\nexport function jobCardLabel(\n job: BrandlabJob,\n options: { readonly service: string; readonly suburbName: string; readonly pageSuburb?: string; readonly prefix?: string },\n): string {\n const service = options.service.trim().toLowerCase()\n const where = job.suburb === options.pageSuburb ? `in ${options.suburbName}` : `nearby: ${options.suburbName}`\n if (!job.month) return `${capitalise(service)} ${where}`\n const prefix = (options.prefix ?? 'Recent').trim()\n const lead = prefix ? `${prefix} ${service}` : capitalise(service)\n return `${lead} ${where}, ${formatMonth(job.month)}`\n}\n\nfunction capitalise(text: string): string {\n return text.charAt(0).toUpperCase() + text.slice(1)\n}\n\nexport interface BrandlabNearbyJob<T extends BrandlabJob = BrandlabJob> {\n readonly job: T\n /** For ranking only; never printed. */\n readonly distanceKm: number\n readonly sameSuburb: boolean\n}\n\n/**\n * The job cards for a page about `origin`: its own suburb's jobs first, then other jobs by real distance between\n * registry centres, within `maxKm` (10) and at most `limit` (3); newest first among equals, undated last. Jobs whose\n * suburb has no centre are left out. Filter by `service` for a service-in-suburb page.\n */\nexport function nearbyJobs<T extends BrandlabJob>(\n origin: string,\n jobs: readonly T[],\n options: { readonly centreOf: SuburbCentreLookup; readonly service?: string; readonly maxKm?: number; readonly limit?: number },\n): BrandlabNearbyJob<T>[] {\n const from = options.centreOf(origin)\n if (!from) return []\n const maxKm = options.maxKm ?? JOB_CARD_MAX_KM\n const limit = options.limit ?? JOB_CARD_LIMIT\n const found: BrandlabNearbyJob<T>[] = []\n for (const job of jobs) {\n if (options.service !== undefined && job.service !== options.service) continue\n const sameSuburb = job.suburb === origin\n const to = sameSuburb ? from : options.centreOf(job.suburb)\n if (!to) continue\n const distanceKm = sameSuburb ? 0 : distanceBetweenCentresKm(from, to)\n if (distanceKm <= maxKm) found.push({ job, distanceKm, sameSuburb })\n }\n return found\n .sort((left, right) => left.distanceKm - right.distanceKm || (right.job.month ?? '').localeCompare(left.job.month ?? ''))\n .slice(0, limit)\n}\n\n/** One place per job, for the area map's job markers (`overviewMap`, `regionMap`, `suburbLocator` take `jobs`). */\nexport function jobPlaces(jobs: readonly BrandlabJob[]): string[] {\n return jobs.map((job) => job.suburb)\n}\n"]}
1
+ {"version":3,"file":"jobs.js","sourceRoot":"","sources":["../src/jobs.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAyBzD,sGAAsG;AACtG,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAA;AACjC,yCAAyC;AACzC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAA;AAE/B,MAAM,IAAI,GAAG,4BAA4B,CAAA;AACzC,MAAM,KAAK,GAAG,2BAA2B,CAAA;AACzC,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;AAE7F,SAAS,UAAU,CAAC,KAAc,EAAE,KAAa,EAAE,OAAe;IAChE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,OAAO,IAAI,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1I,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,iCAAiC,CAAC,CAAA;IAC5D,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;IACD,OAAO,KAAK;SACT,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;SACxH,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;AACpB,CAAC;AAED,mHAAmH;AACnH,MAAM,UAAU,SAAS,CAAC,IAA4B;IACpD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;AACtC,CAAC","sourcesContent":["/**\n * The job log (`src/data/jobs.ts`, 3.14.0): one row per completed job the owner has confirmed, shared by `NearbyJobs`,\n * project cards, the area map's job places and head-tier decisions. A job names its suburb (registry slug), service\n * and what was done; its month is optional, because owners often remember the job but not when (a card then shows the\n * suburb without \"Recent\" or a date: \"Tree removal in Ryde\"). Photos are media-manifest ids, so each carries its\n * provenance; only genuine photos of that job may illustrate it.\n *\n * Website standard (4 Nov 2026): each job card carries a small, plain label naming its own suburb (`jobPlaceLabel`),\n * another suburb's name never goes in a heading, and a job is called nearby only when its suburb shares a border with\n * the page's (`suburbsTouch` in `site-core/area-map`).\n *\n * Distances rank job cards and are never printed: location copy carries no kilometre figures (L10).\n */\nimport type { SuburbCentreLookup } from './locations.js'\nimport { distanceBetweenCentresKm } from './locations.js'\nimport type { BrandlabMediaEntry, BrandlabMediaManifest } from './media.js'\n\nexport interface BrandlabJob {\n /** A stable kebab-case id; genuine photos of the job name it in their media entry's `job`. */\n readonly id: string\n /** The registry suburb slug, for example \"ryde\". */\n readonly suburb: string\n /** The service slug, as the site's service catalogue names it. */\n readonly service: string\n /** What was done, in one line of Australian English. */\n readonly outcome: string\n /**\n * The job's own short title (3.17.0), for example \"Leaning gum beside a pool\". A job card uses it where its label\n * would repeat another card's (\"Tree removal in Eastwood\" twice), or on every card with `cardTitle: 'job'`.\n */\n readonly title?: string\n /** YYYY-MM, when the owner knows it. */\n readonly month?: string\n /** Media-manifest ids of genuine photos of this job. */\n readonly photos?: readonly string[]\n /** Who confirmed the job and when, for example \"Owner, WhatsApp 3 Oct 2026\". */\n readonly source: string\n}\n\n/** Job cards show jobs within this distance of the page's suburb (v2: the 10 km cap on job cards). */\nexport const JOB_CARD_MAX_KM = 10\n/** Cards per page (playbook: 1 to 3). */\nexport const JOB_CARD_LIMIT = 3\n\nconst SLUG = /^[a-z0-9]+(?:-[a-z0-9]+)*$/\nconst MONTH = /^\\d{4}-(?:0[1-9]|1[0-2])$/\nconst JOB_KEYS = ['id', 'suburb', 'service', 'outcome', 'title', 'month', 'photos', 'source']\n\nfunction assertText(value: unknown, field: string, maximum: number) {\n if (typeof value !== 'string' || !value.trim() || value.trim() !== value || value.length > maximum || /[\\u0000-\\u001f\\u007f]/.test(value)) {\n throw new Error(`${field} must be bounded, trimmed text.`)\n }\n}\n\n/**\n * Validates the job log. With the media manifest, every photo must exist, be `genuine` (stock and AI images never\n * stand for the client's work) and, when its entry names a job, name this one.\n */\nexport function defineJobs<const T extends readonly BrandlabJob[]>(jobs: T, options: { readonly media?: BrandlabMediaManifest } = {}): T {\n if (!Array.isArray(jobs)) throw new Error('The job log must be a list.')\n const ids = new Set<string>()\n jobs.forEach((job, index) => {\n const field = `jobs[${index}]`\n if (!job || typeof job !== 'object' || Array.isArray(job)) throw new Error(`${field} must be a record.`)\n const unknown = Object.keys(job).find((key) => !JOB_KEYS.includes(key))\n if (unknown) throw new Error(`${field}.${unknown} is not a job field.`)\n if (typeof job.id !== 'string' || !SLUG.test(job.id)) throw new Error(`${field}.id must be a kebab-case id.`)\n if (ids.has(job.id)) throw new Error(`The job log lists \"${job.id}\" more than once.`)\n ids.add(job.id)\n if (typeof job.suburb !== 'string' || !SLUG.test(job.suburb)) throw new Error(`${field}.suburb must be the registry suburb slug.`)\n if (typeof job.service !== 'string' || !SLUG.test(job.service)) throw new Error(`${field}.service must be the service slug.`)\n assertText(job.outcome, `${field}.outcome`, 300)\n assertText(job.source, `${field}.source`, 200)\n if (job.title !== undefined) assertText(job.title, `${field}.title`, 80)\n if (job.month !== undefined && (typeof job.month !== 'string' || !MONTH.test(job.month))) throw new Error(`${field}.month must be YYYY-MM, or left out.`)\n if (job.photos !== undefined) {\n if (!Array.isArray(job.photos)) throw new Error(`${field}.photos must be a list of media ids.`)\n for (const id of job.photos) {\n if (!options.media) continue\n const entry = Object.hasOwn(options.media, id) ? options.media[id] : undefined\n if (!entry) throw new Error(`${field}.photos: \"${id}\" is not in the media manifest.`)\n if (entry.provenance !== 'genuine') throw new Error(`${field}.photos: \"${id}\" is ${entry.provenance}; only genuine photos show a job.`)\n if (entry.job !== undefined && entry.job !== job.id) throw new Error(`${field}.photos: \"${id}\" is a photo of ${entry.job}, not ${job.id}.`)\n }\n }\n })\n return jobs\n}\n\n/** A job's photos from the media manifest, in order, with their ids and provenance. */\nexport function jobPhotos(job: BrandlabJob, media: BrandlabMediaManifest): (BrandlabMediaEntry & { readonly id: string })[] {\n return (job.photos ?? []).flatMap((id) => (Object.hasOwn(media, id) ? [{ id, ...media[id]! }] : []))\n}\n\nfunction formatMonth(month: string): string {\n return new Intl.DateTimeFormat('en-AU', { month: 'long', year: 'numeric', timeZone: 'UTC' }).format(new Date(`${month}-01T00:00:00Z`))\n}\n\n/**\n * A job's label: \"{Service} in {Suburb}\", naming the job's own suburb, on its own suburb's page and any other (3.20.0;\n * before, another suburb's job always read \"nearby: {Suburb}\"). \"{Service} nearby: {Suburb}\" only with `nearby: true`,\n * for a job whose suburb shares a border with the page's (`suburbsTouch` in `site-core/area-map`). Only a dated job\n * says \"Recent\" (or `prefix`; `''` for none) and ends with \", {Month Year}\": \"Recent tree removal in Ryde, May 2026\",\n * but \"Tree removal in Ryde\" when the month is unknown, because an undated job may not be recent. On a page about\n * another suburb this names that suburb, so it is a caption or label, never a heading (`jobPlaceLabel` is the plain\n * suburb label beside a heading about the work).\n */\nexport function jobCardLabel(\n job: BrandlabJob,\n options: {\n readonly service: string\n readonly suburbName: string\n readonly pageSuburb?: string\n readonly prefix?: string\n /** The job's suburb shares a border with the page's; ignored for the page's own suburb. */\n readonly nearby?: boolean\n },\n): string {\n const service = options.service.trim().toLowerCase()\n const where = job.suburb !== options.pageSuburb && options.nearby === true ? `nearby: ${options.suburbName}` : `in ${options.suburbName}`\n if (!job.month) return `${capitalise(service)} ${where}`\n const prefix = (options.prefix ?? 'Recent').trim()\n const lead = prefix ? `${prefix} ${service}` : capitalise(service)\n return `${lead} ${where}, ${formatMonth(job.month)}`\n}\n\n/**\n * A job card's small, plain place label (3.20.0): the job's suburb, then its month when known: \"Ryde · May 2026\", or\n * \"Ryde\". With `nearby: true` (the suburbs share a border: `suburbsTouch` in `site-core/area-map`) it leads with\n * \"Nearby\": \"Nearby · Ryde · May 2026\". It sits beside a heading about the work, so no heading names another suburb.\n */\nexport function jobPlaceLabel(\n job: BrandlabJob,\n options: { readonly suburbName: string; readonly nearby?: boolean; readonly separator?: string },\n): string {\n const suburb = options.suburbName.trim()\n if (!suburb) throw new Error(`jobPlaceLabel: job \"${job.id}\" has no suburb name.`)\n const separator = options.separator ?? ' · '\n return [...(options.nearby === true ? ['Nearby'] : []), suburb, ...(job.month ? [formatMonth(job.month)] : [])].join(separator)\n}\n\nfunction capitalise(text: string): string {\n return text.charAt(0).toUpperCase() + text.slice(1)\n}\n\nexport interface BrandlabNearbyJob<T extends BrandlabJob = BrandlabJob> {\n readonly job: T\n /** For ranking only; never printed. */\n readonly distanceKm: number\n readonly sameSuburb: boolean\n}\n\n/**\n * The job cards for a page about `origin`: its own suburb's jobs first, then other jobs by real distance between\n * registry centres, within `maxKm` (10) and at most `limit` (3); newest first among equals, undated last. Jobs whose\n * suburb has no centre are left out. Filter by `service` for a service-in-suburb page.\n */\nexport function nearbyJobs<T extends BrandlabJob>(\n origin: string,\n jobs: readonly T[],\n options: { readonly centreOf: SuburbCentreLookup; readonly service?: string; readonly maxKm?: number; readonly limit?: number },\n): BrandlabNearbyJob<T>[] {\n const from = options.centreOf(origin)\n if (!from) return []\n const maxKm = options.maxKm ?? JOB_CARD_MAX_KM\n const limit = options.limit ?? JOB_CARD_LIMIT\n const found: BrandlabNearbyJob<T>[] = []\n for (const job of jobs) {\n if (options.service !== undefined && job.service !== options.service) continue\n const sameSuburb = job.suburb === origin\n const to = sameSuburb ? from : options.centreOf(job.suburb)\n if (!to) continue\n const distanceKm = sameSuburb ? 0 : distanceBetweenCentresKm(from, to)\n if (distanceKm <= maxKm) found.push({ job, distanceKm, sameSuburb })\n }\n return found\n .sort((left, right) => left.distanceKm - right.distanceKm || (right.job.month ?? '').localeCompare(left.job.month ?? ''))\n .slice(0, limit)\n}\n\n/** One place per job, for the area map's job markers (`overviewMap`, `regionMap`, `suburbLocator` take `jobs`). */\nexport function jobPlaces(jobs: readonly BrandlabJob[]): string[] {\n return jobs.map((job) => job.suburb)\n}\n"]}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Place names as visible copy reads them (3.20.0; website standard, "Place names"). Each place carries its own place
3
+ * word and the templates use it: "on the Northern Beaches", "in the Ryde area", "in Castle Hill", "on St Huberts
4
+ * Island". Regions keep "the" in sentences ("across the Northern Beaches"); a bare region name is fine only as a label
5
+ * or breadcrumb. "Area" stays lower case.
6
+ *
7
+ * The registry keeps the official facts (its `name`, `seoName` and `articleForm` never change here); this module is
8
+ * the copy convention layered over them, with the site's own names on top. Titles may stay keyword-led and use the
9
+ * registry's `seoName`; visible headings and sentences use these names. Renaming a label in visible text never
10
+ * changes a slug: a slug change is a route change and Romie's decision.
11
+ */
12
+ import type { GeographyRegistry } from './locations.js';
13
+ /** The word before a place in a sentence: "in" for ordinary suburbs and most regions, "on" for the coasts, shores and islands. */
14
+ export type BrandlabPlaceWord = 'in' | 'on';
15
+ /** How copy names one place. */
16
+ export interface BrandlabPlaceName {
17
+ /** The registry (or site-owned) slug. */
18
+ readonly slug: string;
19
+ /** A label, breadcrumb, list item or map title: "Ryde area", "Northern Beaches", "Castle Hill". */
20
+ readonly label: string;
21
+ /** The name inside a sentence: "the Ryde area", "the Northern Beaches", "Western Sydney", "The Rocks". */
22
+ readonly inSentence: string;
23
+ /** "in" or "on". */
24
+ readonly placeWord: BrandlabPlaceWord;
25
+ /** The place with its word, for headings and sentences: "on the Northern Beaches", "in Castle Hill". */
26
+ readonly withPlaceWord: string;
27
+ }
28
+ /** A site's own name for one place; every field is optional and falls back to the shared convention. */
29
+ export interface BrandlabPlaceNameOverride {
30
+ /** The label ("Sydney CBD"). */
31
+ readonly label?: string;
32
+ /** Whether sentences put "the" before the label ("the Ryde area"); the registry's `articleForm` otherwise. */
33
+ readonly article?: 'the' | 'none';
34
+ /** The whole in-sentence form, when "the" + label is not enough. */
35
+ readonly inSentence?: string;
36
+ readonly placeWord?: BrandlabPlaceWord;
37
+ }
38
+ /**
39
+ * The shared convention for registry places whose copy differs from the registry name or takes "on". Everything not
40
+ * listed reads as the registry names it, with "in", and a region with `articleForm: 'the'` takes "the" in sentences.
41
+ */
42
+ export declare const BRANDLAB_PLACE_NAME_CONVENTIONS: Readonly<Record<string, BrandlabPlaceNameOverride>>;
43
+ export interface BrandlabPlaceNamesInput {
44
+ /** The registry the site's places come from (sydneyGeography or centralCoastGeography). */
45
+ readonly registry: GeographyRegistry;
46
+ /**
47
+ * The site's own names, by slug, over the shared convention: `{ sydney: { label: 'Sydney CBD' } }`. A site-owned
48
+ * town (outside the registry) needs at least its `label` here.
49
+ */
50
+ readonly overrides?: Readonly<Record<string, BrandlabPlaceNameOverride>>;
51
+ }
52
+ /** A site's place names. Build it once with `definePlaceNames` and read every visible place name through it. */
53
+ export interface BrandlabPlaceNames {
54
+ /** The place's names, or undefined for a slug that is neither a registry place (or alias) nor overridden. */
55
+ of(slug: string): BrandlabPlaceName | undefined;
56
+ /** Like `of`, but throws for an unknown slug, so a missing name never ships as a slug. */
57
+ get(slug: string): BrandlabPlaceName;
58
+ }
59
+ /**
60
+ * Binds the shared convention and the site's own names to its registry. A legacy alias reads as the place it
61
+ * resolves to, under its own slug.
62
+ */
63
+ export declare function definePlaceNames(input: BrandlabPlaceNamesInput): BrandlabPlaceNames;
64
+ //# sourceMappingURL=place-names.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"place-names.d.ts","sourceRoot":"","sources":["../src/place-names.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAEvD,kIAAkI;AAClI,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,IAAI,CAAA;AAE3C,gCAAgC;AAChC,MAAM,WAAW,iBAAiB;IAChC,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,mGAAmG;IACnG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,0GAA0G;IAC1G,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,oBAAoB;IACpB,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAA;IACrC,wGAAwG;IACxG,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CAC/B;AAED,wGAAwG;AACxG,MAAM,WAAW,yBAAyB;IACxC,gCAAgC;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,8GAA8G;IAC9G,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;IACjC,oEAAoE;IACpE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,iBAAiB,CAAA;CACvC;AAED;;;GAGG;AACH,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAc9F,CAAA;AAEF,MAAM,WAAW,uBAAuB;IACtC,2FAA2F;IAC3F,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;IACpC;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC,CAAA;CACzE;AAED,gHAAgH;AAChH,MAAM,WAAW,kBAAkB;IACjC,6GAA6G;IAC7G,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAAA;IAC/C,0FAA0F;IAC1F,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAAA;CACrC;AAmCD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,uBAAuB,GAAG,kBAAkB,CA6BnF"}
@@ -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
+ //# sourceMappingURL=place-names.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"place-names.js","sourceRoot":"","sources":["../src/place-names.ts"],"names":[],"mappings":"AAyCA;;;GAGG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAwD,MAAM,CAAC,MAAM,CAAC;IAChH,kCAAkC;IAClC,kBAAkB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;IACvC,aAAa,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;IAClC,mBAAmB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE;IACxD,mBAAmB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE;IACxD,WAAW,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE;IACnD,WAAW,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;IAChC,iBAAiB;IACjB,eAAe,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;IACpC,WAAW;IACX,eAAe,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;IACpC,iBAAiB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;IACtC,mBAAmB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;CACzC,CAAC,CAAA;AAoBF,MAAM,WAAW,GAAiC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;AAE9D,SAA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AE,GAAG,SAAS,IAAI,UAAU,EAAE,EAAE,CAAC,CAAA;IAC3G,CAAC,CAAA;IACD,MAAM,KAAK,GAAuB;QAChC,EAAE,CAAC,IAAI;YACL,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;gBAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;YACpD,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACxB,CAAC;QACD,GAAG,CAAC,IAAI;YACN,MAAM,IAAI,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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