@brandlab-digital/site-core 3.11.0 → 3.12.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/strategy.d.ts +51 -3
- package/dist/strategy.d.ts.map +1 -1
- package/dist/strategy.js +114 -4
- package/dist/strategy.js.map +1 -1
- package/package.json +1 -1
package/dist/strategy.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The site strategy record (3.8.0). One literal per site, in `src/data/strategy.ts`, that the checks read.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* 3.8.0 holds what check D4 (same-trade distinctness) needs: the site's own look levers and the same-trade competitors
|
|
5
|
+
* with theirs. `navigation` (3.9.0) is what Romie recorded for the menu: an exact order, labels outside the closed
|
|
6
|
+
* list, whether Areas is a dropdown. 3.12.0 adds two optional parts the full tier reads: `phrases`, one owning page per
|
|
7
|
+
* primary phrase (E10), and `waves`, the dated release schedule of a location estate (the location indexing guard).
|
|
8
|
+
* Every location page is indexed (D4, 20 Oct 2026); the schedule only dates when each page enters the index and the
|
|
9
|
+
* sitemap.
|
|
7
10
|
*
|
|
8
11
|
* The levers are recorded values, not measurements: the person building the look writes them down, and D4 compares
|
|
9
12
|
* the records. A shared display font counts as the same lever, and an action hue within 20 degrees counts as the same.
|
|
@@ -61,6 +64,30 @@ export interface SiteCompetitor {
|
|
|
61
64
|
trade: string;
|
|
62
65
|
look: SiteLook;
|
|
63
66
|
}
|
|
67
|
+
/** A primary phrase and the one page that owns it (v2 §4.2, §5.3). */
|
|
68
|
+
export interface SitePhraseOwner {
|
|
69
|
+
/** The searched phrase, for example "blocked drains" or "plumber sydney". */
|
|
70
|
+
phrase: string;
|
|
71
|
+
/** The owning page's path, for example "/services/blocked-drains". */
|
|
72
|
+
route: string;
|
|
73
|
+
}
|
|
74
|
+
/** Phrase ownership: one page per primary phrase (E10). */
|
|
75
|
+
export interface SitePhrases {
|
|
76
|
+
/**
|
|
77
|
+
* The main trade, for example "plumber". The suburb page owns "{mainTrade} {suburb}" and the region page
|
|
78
|
+
* "{mainTrade} {region}", so there is no service-in-suburb page or service-region hub for it.
|
|
79
|
+
*/
|
|
80
|
+
mainTrade: string;
|
|
81
|
+
/** Every primary phrase with its owning page. No phrase has two owners. */
|
|
82
|
+
owners: readonly SitePhraseOwner[];
|
|
83
|
+
}
|
|
84
|
+
/** One wave of a location estate's release (v2 §4.4 step 8). */
|
|
85
|
+
export interface SiteReleaseWave {
|
|
86
|
+
/** YYYY-MM-DD: from this day the wave's pages are indexable and in the sitemap. */
|
|
87
|
+
releaseOn: string;
|
|
88
|
+
/** Paths or patterns: `*` matches within one path segment, `**` across segments, for example "/services/decking/*". */
|
|
89
|
+
routes: readonly string[];
|
|
90
|
+
}
|
|
64
91
|
/**
|
|
65
92
|
* Both fields are optional so a site can start the record before its look is settled; check D4 still fails a new
|
|
66
93
|
* build or redesign whose record lacks either.
|
|
@@ -72,7 +99,28 @@ export interface SiteStrategy {
|
|
|
72
99
|
look?: SiteLook;
|
|
73
100
|
/** The menu order, labels or Areas dropdown Romie recorded, when he recorded one (N1 reproduces it exactly). */
|
|
74
101
|
navigation?: BrandlabRecordedNavigation;
|
|
102
|
+
/** Phrase ownership (3.12.0). */
|
|
103
|
+
phrases?: SitePhrases;
|
|
104
|
+
/**
|
|
105
|
+
* The location estate's release waves, in date order (3.12.0). A location page a wave dates in the future may be
|
|
106
|
+
* noindex or out of the sitemap until that day; every other location page is indexable and listed now.
|
|
107
|
+
*/
|
|
108
|
+
waves?: readonly SiteReleaseWave[];
|
|
75
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Consecutive waves go out at least 14 and at most 28 days apart, and the next wave still to come is at most 28 days
|
|
112
|
+
* after the last one released (or after today when none is) (v2 §4.4 step 8: never all at once, never open-ended).
|
|
113
|
+
*/
|
|
114
|
+
export declare const SITE_WAVE_MIN_GAP_DAYS = 14;
|
|
115
|
+
export declare const SITE_WAVE_MAX_GAP_DAYS = 28;
|
|
116
|
+
/** A phrase as E10 compares it: lowercase words, "&" read as "and", punctuation dropped, a plural "s" dropped. */
|
|
117
|
+
export declare function normaliseSitePhrase(phrase: string): string;
|
|
118
|
+
/** Whether a path matches a wave route: an exact path, or a pattern with `*` (one segment) and `**` (any depth). */
|
|
119
|
+
export declare function matchesWaveRoute(path: string, route: string): boolean;
|
|
120
|
+
/** The wave that dates a path, or undefined when no wave lists it. */
|
|
121
|
+
export declare function waveForRoute(waves: readonly SiteReleaseWave[], path: string): SiteReleaseWave | undefined;
|
|
122
|
+
/** Today's date in Sydney, YYYY-MM-DD. */
|
|
123
|
+
export declare function sydneyToday(date?: Date): string;
|
|
76
124
|
/** Validates a site strategy record and returns it with its literal types kept. */
|
|
77
125
|
export declare function defineSiteStrategy<const T extends SiteStrategy>(strategy: T): T;
|
|
78
126
|
//# sourceMappingURL=strategy.d.ts.map
|
package/dist/strategy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strategy.d.ts","sourceRoot":"","sources":["../src/strategy.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"strategy.d.ts","sourceRoot":"","sources":["../src/strategy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAA;AAEjE,mGAAmG;AACnG,eAAO,MAAM,gBAAgB,sHAQnB,CAAA;AAEV,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE7D,oGAAoG;AACpG,MAAM,WAAW,aAAa;IAC5B,gEAAgE;IAChE,MAAM,EAAE,MAAM,CAAA;IACd,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAA;IACd,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAA;CACf;AAED,8FAA8F;AAC9F,MAAM,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AM,EAAE,CAAA;CAC1B;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,sFAAsF;IACtF,WAAW,CAAC,EAAE,SAAS,cAAc,EAAE,CAAA;IACvC,4BAA4B;IAC5B,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,gHAAgH;IAChH,UAAU,CAAC,EAAE,0BAA0B,CAAA;IACvC,iCAAiC;IACjC,OAAO,CAAC,EAAE,WAAW,CAAA;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,eAAe,EAAE,CAAA;CACnC;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,KAAK,CAAA;AACxC,eAAO,MAAM,sBAAsB,KAAK,CAAA;AAMxC,kHAAkH;AAClH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAS1D;AAED,oHAAoH;AACpH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAOrE;AAED,sEAAsE;AACtE,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,eAAe,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAEzG;AA6GD,0CAA0C;AAC1C,wBAAgB,WAAW,CAAC,IAAI,GAAE,IAAiB,GAAG,MAAM,CAE3D;AA2CD,mFAAmF;AACnF,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,CAAC,SAAS,YAAY,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAsB/E"}
|
package/dist/strategy.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The site strategy record (3.8.0). One literal per site, in `src/data/strategy.ts`, that the checks read.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* 3.8.0 holds what check D4 (same-trade distinctness) needs: the site's own look levers and the same-trade competitors
|
|
5
|
+
* with theirs. `navigation` (3.9.0) is what Romie recorded for the menu: an exact order, labels outside the closed
|
|
6
|
+
* list, whether Areas is a dropdown. 3.12.0 adds two optional parts the full tier reads: `phrases`, one owning page per
|
|
7
|
+
* primary phrase (E10), and `waves`, the dated release schedule of a location estate (the location indexing guard).
|
|
8
|
+
* Every location page is indexed (D4, 20 Oct 2026); the schedule only dates when each page enters the index and the
|
|
9
|
+
* sitemap.
|
|
7
10
|
*
|
|
8
11
|
* The levers are recorded values, not measurements: the person building the look writes them down, and D4 compares
|
|
9
12
|
* the records. A shared display font counts as the same lever, and an action hue within 20 degrees counts as the same.
|
|
@@ -19,6 +22,40 @@ export const SITE_LOOK_LEVERS = [
|
|
|
19
22
|
'photoTreatment',
|
|
20
23
|
'homeSections',
|
|
21
24
|
];
|
|
25
|
+
/**
|
|
26
|
+
* Consecutive waves go out at least 14 and at most 28 days apart, and the next wave still to come is at most 28 days
|
|
27
|
+
* after the last one released (or after today when none is) (v2 §4.4 step 8: never all at once, never open-ended).
|
|
28
|
+
*/
|
|
29
|
+
export const SITE_WAVE_MIN_GAP_DAYS = 14;
|
|
30
|
+
export const SITE_WAVE_MAX_GAP_DAYS = 28;
|
|
31
|
+
const ROUTE_PATTERN = /^\/(?:[A-Za-z0-9._~%*-]+(?:\/[A-Za-z0-9._~%*-]+)*)?$/;
|
|
32
|
+
const ISO_DAY = /^\d{4}-\d{2}-\d{2}$/;
|
|
33
|
+
const DAY_MS = 86_400_000;
|
|
34
|
+
/** A phrase as E10 compares it: lowercase words, "&" read as "and", punctuation dropped, a plural "s" dropped. */
|
|
35
|
+
export function normaliseSitePhrase(phrase) {
|
|
36
|
+
return phrase
|
|
37
|
+
.toLowerCase()
|
|
38
|
+
.replace(/&/g, ' and ')
|
|
39
|
+
.replace(/[^a-z0-9]+/g, ' ')
|
|
40
|
+
.trim()
|
|
41
|
+
.split(' ')
|
|
42
|
+
.map((word) => (word.length > 3 && word.endsWith('s') && !word.endsWith('ss') ? word.slice(0, -1) : word))
|
|
43
|
+
.join(' ');
|
|
44
|
+
}
|
|
45
|
+
/** Whether a path matches a wave route: an exact path, or a pattern with `*` (one segment) and `**` (any depth). */
|
|
46
|
+
export function matchesWaveRoute(path, route) {
|
|
47
|
+
if (!route.includes('*'))
|
|
48
|
+
return path === route;
|
|
49
|
+
const source = route
|
|
50
|
+
.split(/(\*\*|\*)/)
|
|
51
|
+
.map((part) => (part === '**' ? '.*' : part === '*' ? '[^/]*' : part.replace(/[.+?^${}()|[\]\\]/g, '\\$&')))
|
|
52
|
+
.join('');
|
|
53
|
+
return new RegExp(`^${source}$`).test(path);
|
|
54
|
+
}
|
|
55
|
+
/** The wave that dates a path, or undefined when no wave lists it. */
|
|
56
|
+
export function waveForRoute(waves, path) {
|
|
57
|
+
return waves.find((wave) => wave.routes.some((route) => matchesWaveRoute(path, route)));
|
|
58
|
+
}
|
|
22
59
|
const DOMAIN = /^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z]{2,}$/;
|
|
23
60
|
function assertText(value, field, maximum = 160) {
|
|
24
61
|
if (typeof value !== 'string' ||
|
|
@@ -94,11 +131,84 @@ function assertNavigation(navigation, field) {
|
|
|
94
131
|
throw new Error(`${field}.areas must be 'link' or 'menu'.`);
|
|
95
132
|
}
|
|
96
133
|
}
|
|
134
|
+
function assertRoute(value, field) {
|
|
135
|
+
if (typeof value !== 'string' || !ROUTE_PATTERN.test(value) || (value.length > 1 && value.endsWith('/'))) {
|
|
136
|
+
throw new Error(`${field} must be a root-relative path or pattern such as "/services/decking/*".`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function assertPhrases(phrases) {
|
|
140
|
+
assertExactKeys(phrases, ['mainTrade', 'owners'], 'strategy.phrases');
|
|
141
|
+
assertText(phrases.mainTrade, 'strategy.phrases.mainTrade', 80);
|
|
142
|
+
if (!Array.isArray(phrases.owners))
|
|
143
|
+
throw new Error('strategy.phrases.owners must be a list.');
|
|
144
|
+
const owners = new Map();
|
|
145
|
+
phrases.owners.forEach((owner, index) => {
|
|
146
|
+
const field = `strategy.phrases.owners[${index}]`;
|
|
147
|
+
assertExactKeys(owner, ['phrase', 'route'], field);
|
|
148
|
+
assertText(owner.phrase, `${field}.phrase`, 80);
|
|
149
|
+
assertRoute(owner.route, `${field}.route`);
|
|
150
|
+
if (owner.route.includes('*'))
|
|
151
|
+
throw new Error(`${field}.route must be one page's path, not a pattern.`);
|
|
152
|
+
const key = normaliseSitePhrase(owner.phrase);
|
|
153
|
+
const other = owners.get(key);
|
|
154
|
+
if (other !== undefined && other !== owner.route) {
|
|
155
|
+
throw new Error(`strategy.phrases gives "${owner.phrase}" two owners, ${other} and ${owner.route}; one page owns each phrase.`);
|
|
156
|
+
}
|
|
157
|
+
owners.set(key, owner.route);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
/** Today's date in Sydney, YYYY-MM-DD. */
|
|
161
|
+
export function sydneyToday(date = new Date()) {
|
|
162
|
+
return new Intl.DateTimeFormat('en-CA', { timeZone: 'Australia/Sydney', year: 'numeric', month: '2-digit', day: '2-digit' }).format(date);
|
|
163
|
+
}
|
|
164
|
+
function assertWaves(waves, today) {
|
|
165
|
+
if (!Array.isArray(waves))
|
|
166
|
+
throw new Error('strategy.waves must be a list.');
|
|
167
|
+
const seen = new Set();
|
|
168
|
+
let previous;
|
|
169
|
+
waves.forEach((wave, index) => {
|
|
170
|
+
const field = `strategy.waves[${index}]`;
|
|
171
|
+
assertExactKeys(wave, ['releaseOn', 'routes'], field);
|
|
172
|
+
const day = typeof wave.releaseOn === 'string' && ISO_DAY.test(wave.releaseOn) ? Date.parse(`${wave.releaseOn}T00:00:00Z`) : Number.NaN;
|
|
173
|
+
if (Number.isNaN(day) || new Date(day).toISOString().slice(0, 10) !== wave.releaseOn) {
|
|
174
|
+
throw new Error(`${field}.releaseOn must be a YYYY-MM-DD date.`);
|
|
175
|
+
}
|
|
176
|
+
const routes = wave.routes;
|
|
177
|
+
if (!Array.isArray(routes) || routes.length === 0)
|
|
178
|
+
throw new Error(`${field}.routes must list at least one path or pattern.`);
|
|
179
|
+
routes.forEach((route, routeIndex) => {
|
|
180
|
+
assertRoute(route, `${field}.routes[${routeIndex}]`);
|
|
181
|
+
if (seen.has(route))
|
|
182
|
+
throw new Error(`strategy.waves lists "${route}" in more than one wave.`);
|
|
183
|
+
seen.add(route);
|
|
184
|
+
});
|
|
185
|
+
if (previous !== undefined) {
|
|
186
|
+
const gap = (day - previous) / DAY_MS;
|
|
187
|
+
if (gap < SITE_WAVE_MIN_GAP_DAYS || gap > SITE_WAVE_MAX_GAP_DAYS) {
|
|
188
|
+
throw new Error(`${field}.releaseOn is ${gap} days after the wave before; waves go out in date order, ${SITE_WAVE_MIN_GAP_DAYS} to ${SITE_WAVE_MAX_GAP_DAYS} days apart.`);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
previous = day;
|
|
192
|
+
});
|
|
193
|
+
// The schedule never holds pages open-ended: the next wave follows the last released one (or today) within 28 days.
|
|
194
|
+
const next = waves.findIndex((wave) => wave.releaseOn > today);
|
|
195
|
+
if (next !== -1) {
|
|
196
|
+
const from = next > 0 ? waves[next - 1].releaseOn : today;
|
|
197
|
+
const gap = (Date.parse(`${waves[next].releaseOn}T00:00:00Z`) - Date.parse(`${from}T00:00:00Z`)) / DAY_MS;
|
|
198
|
+
if (gap > SITE_WAVE_MAX_GAP_DAYS) {
|
|
199
|
+
throw new Error(`strategy.waves[${next}].releaseOn is ${gap} days after ${next > 0 ? 'the last released wave' : 'today'}; the next wave goes out within ${SITE_WAVE_MAX_GAP_DAYS} days, so no page waits open-ended.`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
97
203
|
/** Validates a site strategy record and returns it with its literal types kept. */
|
|
98
204
|
export function defineSiteStrategy(strategy) {
|
|
99
|
-
assertKnownKeys(strategy, ['competitors', 'look', 'navigation'], 'strategy');
|
|
205
|
+
assertKnownKeys(strategy, ['competitors', 'look', 'navigation', 'phrases', 'waves'], 'strategy');
|
|
100
206
|
if (strategy.navigation !== undefined)
|
|
101
207
|
assertNavigation(strategy.navigation, 'strategy.navigation');
|
|
208
|
+
if (strategy.phrases !== undefined)
|
|
209
|
+
assertPhrases(strategy.phrases);
|
|
210
|
+
if (strategy.waves !== undefined)
|
|
211
|
+
assertWaves(strategy.waves, sydneyToday());
|
|
102
212
|
if (strategy.look !== undefined)
|
|
103
213
|
assertLook(strategy.look, 'strategy.look');
|
|
104
214
|
if (strategy.competitors === undefined)
|
package/dist/strategy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strategy.js","sourceRoot":"","sources":["../src/strategy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,mGAAmG;AACnG,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,aAAa;IACb,WAAW;IACX,aAAa;IACb,eAAe;IACf,WAAW;IACX,gBAAgB;IAChB,cAAc;CACN,CAAA;AAsEV,MAAM,MAAM,GAAG,mDAAmD,CAAA;AAElE,SAAS,UAAU,CAAC,KAAc,EAAE,KAAa,EAAE,OAAO,GAAG,GAAG;IAC9D,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,CAAC,KAAK,CAAC,IAAI,EAAE;QACb,KAAK,CAAC,IAAI,EAAE,KAAK,KAAK;QACtB,KAAK,CAAC,MAAM,GAAG,OAAO;QACtB,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,EACnC,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,iCAAiC,CAAC,CAAA;IAC5D,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,KAAc,EAAE,OAA0B,EAAE,KAAa;IAChF,IACE,CAAC,KAAK;QACN,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACpB,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,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,CAAC,+BAA+B,SAAS,mBAAmB,CAAC,CAAA;IAC3F,OAAO,QAAQ,CAAA;AACjB,CAAC","sourcesContent":["/**\n * The site strategy record (3.8.0). One literal per site, in `src/data/strategy.ts`, that the checks read.\n *\n * This release holds what check D4 (same-trade distinctness) needs: the site's own look levers and the same-trade\n * competitors with theirs. `navigation` (3.9.0) is what Romie recorded for the menu: an exact order, labels outside the\n * closed list, whether Areas is a dropdown. Later releases add phrases, tiers and the wave schedule to the same record.\n *\n * The levers are recorded values, not measurements: the person building the look writes them down, and D4 compares\n * the records. A shared display font counts as the same lever, and an action hue within 20 degrees counts as the same.\n * Card style, photo treatment and the home sections are the same only when every part of them matches.\n */\n\nimport type { BrandlabRecordedNavigation } from './navigation.js'\n\n/** The seven look levers D4 compares (Site System v2 §7.7), in the order the record lists them. */\nexport const SITE_LOOK_LEVERS = [\n 'displayFont',\n 'actionHue',\n 'heroVariant',\n 'headerVariant',\n 'cardStyle',\n 'photoTreatment',\n 'homeSections',\n] as const\n\nexport type SiteLookLever = (typeof SITE_LOOK_LEVERS)[number]\n\n/** The card tokens the site's cards use. Two card styles are the same only when all three match. */\nexport interface SiteCardStyle {\n /** The corner radius token value, for example \"16px\" or \"0\". */\n radius: string\n /** The border token value, for example \"1px solid line\" or \"none\". */\n border: string\n /** The shadow token value, for example \"soft\" or \"none\". */\n shadow: string\n}\n\n/** How the site treats photographs. Two treatments are the same only when all three match. */\nexport interface SitePhotoTreatment {\n /** The crop ratio, for example \"4:3\" or \"16:9\". */\n cropRatio: string\n /** The scrim over photographs, for example \"light gradient\" or \"none\". */\n scrim: string\n /** The frame around photographs, for example \"rounded\" or \"square\". */\n frame: string\n}\n\n/** The home page's section order and its signature sections. */\nexport interface SiteHomeSections {\n /** The home page's sections in order, by section id. */\n sectionOrder: readonly string[]\n /** The sections or elements that make the home page recognisable, for example \"grass-edge divider\". May be empty. */\n signatures: readonly string[]\n}\n\n/** One site's look, as recorded. */\nexport interface SiteLook {\n /** The display (heading) font family, for example \"Plus Jakarta Sans\". */\n displayFont: string\n /** The hue of the main action colour in degrees: 0 up to, not including, 360. */\n actionHue: number\n /** The hero variant the site uses, as its skin names it. */\n heroVariant: string\n /** The header variant the site uses, as its skin names it. */\n headerVariant: string\n cardStyle: SiteCardStyle\n photoTreatment: SitePhotoTreatment\n homeSections: SiteHomeSections\n}\n\n/** A same-trade business with an overlapping service area, and its recorded look. */\nexport interface SiteCompetitor {\n name: string\n /** The bare domain, lowercase, for example \"example.com.au\". */\n domain: string\n /** The trade it shares with this site, for example \"tree services\". */\n trade: string\n look: SiteLook\n}\n\n/**\n * Both fields are optional so a site can start the record before its look is settled; check D4 still fails a new\n * build or redesign whose record lacks either.\n */\nexport interface SiteStrategy {\n /** Same-trade competitors with overlapping regions, fellow Brandlab clients first. */\n competitors?: readonly SiteCompetitor[]\n /** This site's own look. */\n look?: SiteLook\n /** The menu order, labels or Areas dropdown Romie recorded, when he recorded one (N1 reproduces it exactly). */\n navigation?: BrandlabRecordedNavigation\n}\n\nconst DOMAIN = /^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,}$/\n\nfunction assertText(value: unknown, field: string, maximum = 160) {\n if (\n typeof value !== 'string' ||\n !value.trim() ||\n value.trim() !== value ||\n value.length > maximum ||\n /[\\u0000-\\u001f\\u007f]/.test(value)\n ) {\n throw new Error(`${field} must be bounded, trimmed text.`)\n }\n}\n\nfunction assertKnownKeys(value: unknown, allowed: readonly string[], field: string) {\n if (\n !value ||\n typeof value !== 'object' ||\n Array.isArray(value) ||\n ![Object.prototype, null].includes(Object.getPrototypeOf(value))\n ) {\n throw new Error(`${field} must be a plain object.`)\n }\n const unknown = Object.keys(value).find((key) => !allowed.includes(key))\n if (unknown) throw new Error(`${field}.${unknown} is not a supported strategy key.`)\n}\n\nfunction assertExactKeys(value: unknown, allowed: readonly string[], field: string, optional: readonly string[] = []) {\n assertKnownKeys(value, allowed, field)\n const missing = allowed.find((key) => !optional.includes(key) && !Object.hasOwn(value as object, key))\n if (missing) throw new Error(`${field}.${missing} is required.`)\n}\n\nfunction assertTextList(values: unknown, field: string, minimum: number) {\n if (!Array.isArray(values) || values.length < minimum) {\n throw new Error(`${field} must be a list${minimum > 0 ? ' with at least one entry' : ''}.`)\n }\n values.forEach((value, index) => assertText(value, `${field}[${index}]`, 80))\n const duplicate = values.find((value, index) => values.indexOf(value) !== index)\n if (duplicate !== undefined) throw new Error(`${field} lists \"${duplicate}\" more than once.`)\n}\n\nfunction assertLook(look: SiteLook, field: string) {\n assertExactKeys(look, SITE_LOOK_LEVERS, field)\n assertText(look.displayFont, `${field}.displayFont`)\n if (typeof look.actionHue !== 'number' || !Number.isFinite(look.actionHue) || look.actionHue < 0 || look.actionHue >= 360) {\n throw new Error(`${field}.actionHue must be a hue in degrees from 0 up to, but not including, 360.`)\n }\n assertText(look.heroVariant, `${field}.heroVariant`)\n assertText(look.headerVariant, `${field}.headerVariant`)\n assertExactKeys(look.cardStyle, ['radius', 'border', 'shadow'], `${field}.cardStyle`)\n for (const token of ['radius', 'border', 'shadow'] as const) assertText(look.cardStyle[token], `${field}.cardStyle.${token}`)\n assertExactKeys(look.photoTreatment, ['cropRatio', 'scrim', 'frame'], `${field}.photoTreatment`)\n for (const token of ['cropRatio', 'scrim', 'frame'] as const) assertText(look.photoTreatment[token], `${field}.photoTreatment.${token}`)\n assertExactKeys(look.homeSections, ['sectionOrder', 'signatures'], `${field}.homeSections`)\n assertTextList(look.homeSections.sectionOrder, `${field}.homeSections.sectionOrder`, 1)\n assertTextList(look.homeSections.signatures, `${field}.homeSections.signatures`, 0)\n}\n\nconst RECORDED_DATE = /^\\d{4}-\\d{2}-\\d{2}$/\n\nfunction assertNavigation(navigation: BrandlabRecordedNavigation, field: string) {\n const allowed = ['order', 'labels', 'areas', 'setBy', 'recordedOn']\n assertExactKeys(navigation, allowed, field, ['order', 'labels', 'areas'])\n assertText(navigation.setBy, `${field}.setBy`)\n if (typeof navigation.recordedOn !== 'string' || !RECORDED_DATE.test(navigation.recordedOn) || Number.isNaN(Date.parse(navigation.recordedOn))) {\n throw new Error(`${field}.recordedOn must be the date it was recorded, as YYYY-MM-DD.`)\n }\n if (navigation.order !== undefined) assertTextList(navigation.order, `${field}.order`, 1)\n if (navigation.labels !== undefined) {\n assertExactKeys(navigation.labels, navigation.labels && typeof navigation.labels === 'object' ? Object.keys(navigation.labels) : [], `${field}.labels`)\n for (const [key, label] of Object.entries(navigation.labels)) {\n assertText(key, `${field}.labels key`, 80)\n assertText(label, `${field}.labels.${key}`, 80)\n }\n }\n if (navigation.areas !== undefined && navigation.areas !== 'link' && navigation.areas !== 'menu') {\n throw new Error(`${field}.areas must be 'link' or 'menu'.`)\n }\n}\n\n/** Validates a site strategy record and returns it with its literal types kept. */\nexport function defineSiteStrategy<const T extends SiteStrategy>(strategy: T): T {\n assertKnownKeys(strategy, ['competitors', 'look', 'navigation'], 'strategy')\n if (strategy.navigation !== undefined) assertNavigation(strategy.navigation, 'strategy.navigation')\n if (strategy.look !== undefined) assertLook(strategy.look, 'strategy.look')\n if (strategy.competitors === undefined) return strategy\n if (!Array.isArray(strategy.competitors)) throw new Error('strategy.competitors must be a list.')\n strategy.competitors.forEach((competitor, index) => {\n const field = `strategy.competitors[${index}]`\n assertExactKeys(competitor, ['name', 'domain', 'trade', 'look'], field)\n assertText(competitor.name, `${field}.name`)\n assertText(competitor.trade, `${field}.trade`)\n if (typeof competitor.domain !== 'string' || !DOMAIN.test(competitor.domain)) {\n throw new Error(`${field}.domain must be a bare lowercase domain such as \"example.com.au\".`)\n }\n assertLook(competitor.look, `${field}.look`)\n })\n const domains = strategy.competitors.map((competitor) => competitor.domain)\n const duplicate = domains.find((domain, index) => domains.indexOf(domain) !== index)\n if (duplicate) throw new Error(`strategy.competitors lists \"${duplicate}\" more than once.`)\n return strategy\n}\n"]}
|
|
1
|
+
{"version":3,"file":"strategy.js","sourceRoot":"","sources":["../src/strategy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;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ACjG,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE;QACjD,MAAM,KAAK,GAAG,wBAAwB,KAAK,GAAG,CAAA;QAC9C,eAAe,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,CAAA;QACvE,UAAU,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,CAAA;QAC5C,UAAU,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,KAAK,QAAQ,CAAC,CAAA;QAC9C,IAAI,OAAO,UAAU,CAAC,MAAM,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7E,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,mEAAmE,CAAC,CAAA;QAC9F,CAAC;QACD,UAAU,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,CAAA;IAC9C,CAAC,CAAC,CAAA;IACF,MAAM,OAAO,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;IAC3E,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC,CAAA;IACpF,IAAI,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,SAAS,mBAAmB,CAAC,CAAA;IAC3F,OAAO,QAAQ,CAAA;AACjB,CAAC","sourcesContent":["/**\n * The site strategy record (3.8.0). One literal per site, in `src/data/strategy.ts`, that the checks read.\n *\n * 3.8.0 holds what check D4 (same-trade distinctness) needs: the site's own look levers and the same-trade competitors\n * with theirs. `navigation` (3.9.0) is what Romie recorded for the menu: an exact order, labels outside the closed\n * list, whether Areas is a dropdown. 3.12.0 adds two optional parts the full tier reads: `phrases`, one owning page per\n * primary phrase (E10), and `waves`, the dated release schedule of a location estate (the location indexing guard).\n * Every location page is indexed (D4, 20 Oct 2026); the schedule only dates when each page enters the index and the\n * sitemap.\n *\n * The levers are recorded values, not measurements: the person building the look writes them down, and D4 compares\n * the records. A shared display font counts as the same lever, and an action hue within 20 degrees counts as the same.\n * Card style, photo treatment and the home sections are the same only when every part of them matches.\n */\n\nimport type { BrandlabRecordedNavigation } from './navigation.js'\n\n/** The seven look levers D4 compares (Site System v2 §7.7), in the order the record lists them. */\nexport const SITE_LOOK_LEVERS = [\n 'displayFont',\n 'actionHue',\n 'heroVariant',\n 'headerVariant',\n 'cardStyle',\n 'photoTreatment',\n 'homeSections',\n] as const\n\nexport type SiteLookLever = (typeof SITE_LOOK_LEVERS)[number]\n\n/** The card tokens the site's cards use. Two card styles are the same only when all three match. */\nexport interface SiteCardStyle {\n /** The corner radius token value, for example \"16px\" or \"0\". */\n radius: string\n /** The border token value, for example \"1px solid line\" or \"none\". */\n border: string\n /** The shadow token value, for example \"soft\" or \"none\". */\n shadow: string\n}\n\n/** How the site treats photographs. Two treatments are the same only when all three match. */\nexport interface SitePhotoTreatment {\n /** The crop ratio, for example \"4:3\" or \"16:9\". */\n cropRatio: string\n /** The scrim over photographs, for example \"light gradient\" or \"none\". */\n scrim: string\n /** The frame around photographs, for example \"rounded\" or \"square\". */\n frame: string\n}\n\n/** The home page's section order and its signature sections. */\nexport interface SiteHomeSections {\n /** The home page's sections in order, by section id. */\n sectionOrder: readonly string[]\n /** The sections or elements that make the home page recognisable, for example \"grass-edge divider\". May be empty. */\n signatures: readonly string[]\n}\n\n/** One site's look, as recorded. */\nexport interface SiteLook {\n /** The display (heading) font family, for example \"Plus Jakarta Sans\". */\n displayFont: string\n /** The hue of the main action colour in degrees: 0 up to, not including, 360. */\n actionHue: number\n /** The hero variant the site uses, as its skin names it. */\n heroVariant: string\n /** The header variant the site uses, as its skin names it. */\n headerVariant: string\n cardStyle: SiteCardStyle\n photoTreatment: SitePhotoTreatment\n homeSections: SiteHomeSections\n}\n\n/** A same-trade business with an overlapping service area, and its recorded look. */\nexport interface SiteCompetitor {\n name: string\n /** The bare domain, lowercase, for example \"example.com.au\". */\n domain: string\n /** The trade it shares with this site, for example \"tree services\". */\n trade: string\n look: SiteLook\n}\n\n/** A primary phrase and the one page that owns it (v2 §4.2, §5.3). */\nexport interface SitePhraseOwner {\n /** The searched phrase, for example \"blocked drains\" or \"plumber sydney\". */\n phrase: string\n /** The owning page's path, for example \"/services/blocked-drains\". */\n route: string\n}\n\n/** Phrase ownership: one page per primary phrase (E10). */\nexport interface SitePhrases {\n /**\n * The main trade, for example \"plumber\". The suburb page owns \"{mainTrade} {suburb}\" and the region page\n * \"{mainTrade} {region}\", so there is no service-in-suburb page or service-region hub for it.\n */\n mainTrade: string\n /** Every primary phrase with its owning page. No phrase has two owners. */\n owners: readonly SitePhraseOwner[]\n}\n\n/** One wave of a location estate's release (v2 §4.4 step 8). */\nexport interface SiteReleaseWave {\n /** YYYY-MM-DD: from this day the wave's pages are indexable and in the sitemap. */\n releaseOn: string\n /** Paths or patterns: `*` matches within one path segment, `**` across segments, for example \"/services/decking/*\". */\n routes: readonly string[]\n}\n\n/**\n * Both fields are optional so a site can start the record before its look is settled; check D4 still fails a new\n * build or redesign whose record lacks either.\n */\nexport interface SiteStrategy {\n /** Same-trade competitors with overlapping regions, fellow Brandlab clients first. */\n competitors?: readonly SiteCompetitor[]\n /** This site's own look. */\n look?: SiteLook\n /** The menu order, labels or Areas dropdown Romie recorded, when he recorded one (N1 reproduces it exactly). */\n navigation?: BrandlabRecordedNavigation\n /** Phrase ownership (3.12.0). */\n phrases?: SitePhrases\n /**\n * The location estate's release waves, in date order (3.12.0). A location page a wave dates in the future may be\n * noindex or out of the sitemap until that day; every other location page is indexable and listed now.\n */\n waves?: readonly SiteReleaseWave[]\n}\n\n/**\n * Consecutive waves go out at least 14 and at most 28 days apart, and the next wave still to come is at most 28 days\n * after the last one released (or after today when none is) (v2 §4.4 step 8: never all at once, never open-ended).\n */\nexport const SITE_WAVE_MIN_GAP_DAYS = 14\nexport const SITE_WAVE_MAX_GAP_DAYS = 28\n\nconst ROUTE_PATTERN = /^\\/(?:[A-Za-z0-9._~%*-]+(?:\\/[A-Za-z0-9._~%*-]+)*)?$/\nconst ISO_DAY = /^\\d{4}-\\d{2}-\\d{2}$/\nconst DAY_MS = 86_400_000\n\n/** A phrase as E10 compares it: lowercase words, \"&\" read as \"and\", punctuation dropped, a plural \"s\" dropped. */\nexport function normaliseSitePhrase(phrase: string): string {\n return phrase\n .toLowerCase()\n .replace(/&/g, ' and ')\n .replace(/[^a-z0-9]+/g, ' ')\n .trim()\n .split(' ')\n .map((word) => (word.length > 3 && word.endsWith('s') && !word.endsWith('ss') ? word.slice(0, -1) : word))\n .join(' ')\n}\n\n/** Whether a path matches a wave route: an exact path, or a pattern with `*` (one segment) and `**` (any depth). */\nexport function matchesWaveRoute(path: string, route: string): boolean {\n if (!route.includes('*')) return path === route\n const source = route\n .split(/(\\*\\*|\\*)/)\n .map((part) => (part === '**' ? '.*' : part === '*' ? '[^/]*' : part.replace(/[.+?^${}()|[\\]\\\\]/g, '\\\\$&')))\n .join('')\n return new RegExp(`^${source}$`).test(path)\n}\n\n/** The wave that dates a path, or undefined when no wave lists it. */\nexport function waveForRoute(waves: readonly SiteReleaseWave[], path: string): SiteReleaseWave | undefined {\n return waves.find((wave) => wave.routes.some((route) => matchesWaveRoute(path, route)))\n}\n\nconst DOMAIN = /^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,}$/\n\nfunction assertText(value: unknown, field: string, maximum = 160) {\n if (\n typeof value !== 'string' ||\n !value.trim() ||\n value.trim() !== value ||\n value.length > maximum ||\n /[\\u0000-\\u001f\\u007f]/.test(value)\n ) {\n throw new Error(`${field} must be bounded, trimmed text.`)\n }\n}\n\nfunction assertKnownKeys(value: unknown, allowed: readonly string[], field: string) {\n if (\n !value ||\n typeof value !== 'object' ||\n Array.isArray(value) ||\n ![Object.prototype, null].includes(Object.getPrototypeOf(value))\n ) {\n throw new Error(`${field} must be a plain object.`)\n }\n const unknown = Object.keys(value).find((key) => !allowed.includes(key))\n if (unknown) throw new Error(`${field}.${unknown} is not a supported strategy key.`)\n}\n\nfunction assertExactKeys(value: unknown, allowed: readonly string[], field: string, optional: readonly string[] = []) {\n assertKnownKeys(value, allowed, field)\n const missing = allowed.find((key) => !optional.includes(key) && !Object.hasOwn(value as object, key))\n if (missing) throw new Error(`${field}.${missing} is required.`)\n}\n\nfunction assertTextList(values: unknown, field: string, minimum: number) {\n if (!Array.isArray(values) || values.length < minimum) {\n throw new Error(`${field} must be a list${minimum > 0 ? ' with at least one entry' : ''}.`)\n }\n values.forEach((value, index) => assertText(value, `${field}[${index}]`, 80))\n const duplicate = values.find((value, index) => values.indexOf(value) !== index)\n if (duplicate !== undefined) throw new Error(`${field} lists \"${duplicate}\" more than once.`)\n}\n\nfunction assertLook(look: SiteLook, field: string) {\n assertExactKeys(look, SITE_LOOK_LEVERS, field)\n assertText(look.displayFont, `${field}.displayFont`)\n if (typeof look.actionHue !== 'number' || !Number.isFinite(look.actionHue) || look.actionHue < 0 || look.actionHue >= 360) {\n throw new Error(`${field}.actionHue must be a hue in degrees from 0 up to, but not including, 360.`)\n }\n assertText(look.heroVariant, `${field}.heroVariant`)\n assertText(look.headerVariant, `${field}.headerVariant`)\n assertExactKeys(look.cardStyle, ['radius', 'border', 'shadow'], `${field}.cardStyle`)\n for (const token of ['radius', 'border', 'shadow'] as const) assertText(look.cardStyle[token], `${field}.cardStyle.${token}`)\n assertExactKeys(look.photoTreatment, ['cropRatio', 'scrim', 'frame'], `${field}.photoTreatment`)\n for (const token of ['cropRatio', 'scrim', 'frame'] as const) assertText(look.photoTreatment[token], `${field}.photoTreatment.${token}`)\n assertExactKeys(look.homeSections, ['sectionOrder', 'signatures'], `${field}.homeSections`)\n assertTextList(look.homeSections.sectionOrder, `${field}.homeSections.sectionOrder`, 1)\n assertTextList(look.homeSections.signatures, `${field}.homeSections.signatures`, 0)\n}\n\nconst RECORDED_DATE = /^\\d{4}-\\d{2}-\\d{2}$/\n\nfunction assertNavigation(navigation: BrandlabRecordedNavigation, field: string) {\n const allowed = ['order', 'labels', 'areas', 'setBy', 'recordedOn']\n assertExactKeys(navigation, allowed, field, ['order', 'labels', 'areas'])\n assertText(navigation.setBy, `${field}.setBy`)\n if (typeof navigation.recordedOn !== 'string' || !RECORDED_DATE.test(navigation.recordedOn) || Number.isNaN(Date.parse(navigation.recordedOn))) {\n throw new Error(`${field}.recordedOn must be the date it was recorded, as YYYY-MM-DD.`)\n }\n if (navigation.order !== undefined) assertTextList(navigation.order, `${field}.order`, 1)\n if (navigation.labels !== undefined) {\n assertExactKeys(navigation.labels, navigation.labels && typeof navigation.labels === 'object' ? Object.keys(navigation.labels) : [], `${field}.labels`)\n for (const [key, label] of Object.entries(navigation.labels)) {\n assertText(key, `${field}.labels key`, 80)\n assertText(label, `${field}.labels.${key}`, 80)\n }\n }\n if (navigation.areas !== undefined && navigation.areas !== 'link' && navigation.areas !== 'menu') {\n throw new Error(`${field}.areas must be 'link' or 'menu'.`)\n }\n}\n\nfunction assertRoute(value: unknown, field: string) {\n if (typeof value !== 'string' || !ROUTE_PATTERN.test(value) || (value.length > 1 && value.endsWith('/'))) {\n throw new Error(`${field} must be a root-relative path or pattern such as \"/services/decking/*\".`)\n }\n}\n\nfunction assertPhrases(phrases: SitePhrases) {\n assertExactKeys(phrases, ['mainTrade', 'owners'], 'strategy.phrases')\n assertText(phrases.mainTrade, 'strategy.phrases.mainTrade', 80)\n if (!Array.isArray(phrases.owners)) throw new Error('strategy.phrases.owners must be a list.')\n const owners = new Map<string, string>()\n phrases.owners.forEach((owner, index) => {\n const field = `strategy.phrases.owners[${index}]`\n assertExactKeys(owner, ['phrase', 'route'], field)\n assertText(owner.phrase, `${field}.phrase`, 80)\n assertRoute(owner.route, `${field}.route`)\n if (owner.route.includes('*')) throw new Error(`${field}.route must be one page's path, not a pattern.`)\n const key = normaliseSitePhrase(owner.phrase)\n const other = owners.get(key)\n if (other !== undefined && other !== owner.route) {\n throw new Error(`strategy.phrases gives \"${owner.phrase}\" two owners, ${other} and ${owner.route}; one page owns each phrase.`)\n }\n owners.set(key, owner.route)\n })\n}\n\n/** Today's date in Sydney, YYYY-MM-DD. */\nexport function sydneyToday(date: Date = new Date()): string {\n return new Intl.DateTimeFormat('en-CA', { timeZone: 'Australia/Sydney', year: 'numeric', month: '2-digit', day: '2-digit' }).format(date)\n}\n\nfunction assertWaves(waves: readonly SiteReleaseWave[], today: string) {\n if (!Array.isArray(waves)) throw new Error('strategy.waves must be a list.')\n const seen = new Set<string>()\n let previous: number | undefined\n waves.forEach((wave, index) => {\n const field = `strategy.waves[${index}]`\n assertExactKeys(wave, ['releaseOn', 'routes'], field)\n const day = typeof wave.releaseOn === 'string' && ISO_DAY.test(wave.releaseOn) ? Date.parse(`${wave.releaseOn}T00:00:00Z`) : Number.NaN\n if (Number.isNaN(day) || new Date(day).toISOString().slice(0, 10) !== wave.releaseOn) {\n throw new Error(`${field}.releaseOn must be a YYYY-MM-DD date.`)\n }\n const routes: readonly string[] = wave.routes\n if (!Array.isArray(routes) || routes.length === 0) throw new Error(`${field}.routes must list at least one path or pattern.`)\n routes.forEach((route: string, routeIndex: number) => {\n assertRoute(route, `${field}.routes[${routeIndex}]`)\n if (seen.has(route)) throw new Error(`strategy.waves lists \"${route}\" in more than one wave.`)\n seen.add(route)\n })\n if (previous !== undefined) {\n const gap = (day - previous) / DAY_MS\n if (gap < SITE_WAVE_MIN_GAP_DAYS || gap > SITE_WAVE_MAX_GAP_DAYS) {\n throw new Error(\n `${field}.releaseOn is ${gap} days after the wave before; waves go out in date order, ${SITE_WAVE_MIN_GAP_DAYS} to ${SITE_WAVE_MAX_GAP_DAYS} days apart.`,\n )\n }\n }\n previous = day\n })\n // The schedule never holds pages open-ended: the next wave follows the last released one (or today) within 28 days.\n const next = waves.findIndex((wave) => wave.releaseOn > today)\n if (next !== -1) {\n const from = next > 0 ? waves[next - 1]!.releaseOn : today\n const gap = (Date.parse(`${waves[next]!.releaseOn}T00:00:00Z`) - Date.parse(`${from}T00:00:00Z`)) / DAY_MS\n if (gap > SITE_WAVE_MAX_GAP_DAYS) {\n throw new Error(\n `strategy.waves[${next}].releaseOn is ${gap} days after ${next > 0 ? 'the last released wave' : 'today'}; the next wave goes out within ${SITE_WAVE_MAX_GAP_DAYS} days, so no page waits open-ended.`,\n )\n }\n }\n}\n\n/** Validates a site strategy record and returns it with its literal types kept. */\nexport function defineSiteStrategy<const T extends SiteStrategy>(strategy: T): T {\n assertKnownKeys(strategy, ['competitors', 'look', 'navigation', 'phrases', 'waves'], 'strategy')\n if (strategy.navigation !== undefined) assertNavigation(strategy.navigation, 'strategy.navigation')\n if (strategy.phrases !== undefined) assertPhrases(strategy.phrases)\n if (strategy.waves !== undefined) assertWaves(strategy.waves, sydneyToday())\n if (strategy.look !== undefined) assertLook(strategy.look, 'strategy.look')\n if (strategy.competitors === undefined) return strategy\n if (!Array.isArray(strategy.competitors)) throw new Error('strategy.competitors must be a list.')\n strategy.competitors.forEach((competitor, index) => {\n const field = `strategy.competitors[${index}]`\n assertExactKeys(competitor, ['name', 'domain', 'trade', 'look'], field)\n assertText(competitor.name, `${field}.name`)\n assertText(competitor.trade, `${field}.trade`)\n if (typeof competitor.domain !== 'string' || !DOMAIN.test(competitor.domain)) {\n throw new Error(`${field}.domain must be a bare lowercase domain such as \"example.com.au\".`)\n }\n assertLook(competitor.look, `${field}.look`)\n })\n const domains = strategy.competitors.map((competitor) => competitor.domain)\n const duplicate = domains.find((domain, index) => domains.indexOf(domain) !== index)\n if (duplicate) throw new Error(`strategy.competitors lists \"${duplicate}\" more than once.`)\n return strategy\n}\n"]}
|