@tokenoftrust/cli 7.9.1 → 7.10.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenoftrust/cli",
3
- "version": "7.9.1",
3
+ "version": "7.10.0",
4
4
  "description": "Token of Trust developer CLI — clone a tenant store, run it locally with save→reload, and submit it for preview. Installs the `tot` command.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Token of Trust",
@@ -142,7 +142,7 @@ export function resolveStoreTimeZone(declared) {
142
142
 
143
143
 
144
144
  /** Every `seo` key (mirrors packages/public-runtime/src/declared-tenant-config.mjs). */
145
- export const SEO_KEYS = Object.freeze(["trailingSlash", "verbatimSeoTitles", "structuredData"]);
145
+ export const SEO_KEYS = Object.freeze(["trailingSlash", "verbatimSeoTitles", "structuredData", "siteVerification"]);
146
146
 
147
147
  /** Every `seo.structuredData` key. */
148
148
  export const STRUCTURED_DATA_KEYS = Object.freeze(["graphs", "names", "reviews", "onlyOn"]);
@@ -179,6 +179,31 @@ export const STRUCTURED_DATA_NAME_SOURCES = Object.freeze(["documentTitle", "tit
179
179
  const isPlainObject = (value) =>
180
180
  value !== null && typeof value === "object" && !Array.isArray(value);
181
181
 
182
+ /** Search-engine site-verification tokens: `seo.siteVerification` keys. */
183
+ export const SITE_VERIFICATION_KEYS = Object.freeze(["google", "bing"]);
184
+ /** A verification token is a bare token, never markup: letters, digits, `_`, `-`, `.`. */
185
+ export const SITE_VERIFICATION_TOKEN = /^[A-Za-z0-9._-]{1,200}$/;
186
+
187
+ /**
188
+ * @param {unknown} value
189
+ * @returns {string[]}
190
+ */
191
+ function siteVerificationProblems(value) {
192
+ if (!isPlainObject(value)) return ["`seo.siteVerification` must be an object"];
193
+ const problems = [];
194
+ for (const [key, tokens] of Object.entries(/** @type {Record<string, unknown>} */ (value))) {
195
+ if (!SITE_VERIFICATION_KEYS.includes(key)) {
196
+ problems.push(`\`seo.siteVerification.${key}\` is not a search engine (${SITE_VERIFICATION_KEYS.join(", ")})`);
197
+ continue;
198
+ }
199
+ const list = Array.isArray(tokens) ? tokens : [tokens];
200
+ if (list.length === 0 || !list.every((t) => typeof t === "string" && SITE_VERIFICATION_TOKEN.test(t))) {
201
+ problems.push(`\`seo.siteVerification.${key}\` must be a verification token (or a list of them): letters, digits, "_", "-", "."; paste the content value, not the whole tag`);
202
+ }
203
+ }
204
+ return problems;
205
+ }
206
+
182
207
  /**
183
208
  * What is wrong with a declared `seo` value, one sentence per problem; `[]` when it is valid.
184
209
  * A profile that names a node or page type the renderer does not build is refused whole: a
@@ -200,6 +225,7 @@ export function seoDeclarationProblems(seo) {
200
225
  if (source.verbatimSeoTitles !== undefined && typeof source.verbatimSeoTitles !== "boolean") {
201
226
  problems.push("`seo.verbatimSeoTitles` must be true or false");
202
227
  }
228
+ if (source.siteVerification !== undefined) problems.push(...siteVerificationProblems(source.siteVerification));
203
229
  const sd = source.structuredData;
204
230
  if (sd === undefined) return problems;
205
231
  if (!isPlainObject(sd)) return [...problems, "`seo.structuredData` must be an object"];
@@ -233,6 +233,7 @@ export const MANIFEST_SCOPES = [
233
233
  "orders:read-minimal",
234
234
  "orders:read-holds",
235
235
  "orders:webhook",
236
+ "orders:write-accounting-ref",
236
237
  "customers:read-minimal",
237
238
  "inventory:read",
238
239
  "inventory:write",