@decocms/parity 0.33.18 → 0.33.19

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.
Files changed (2) hide show
  1. package/dist/cli.js +22 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -57599,6 +57599,9 @@ async function getContentTypes(cfg, call = callCms) {
57599
57599
  path: `${SCHEMAS}/${cfg.account}.${cfg.store}/content-types`
57600
57600
  });
57601
57601
  }
57602
+ async function getSchemaMeta(cfg, call = callCms) {
57603
+ return call(cfg, { path: `${SCHEMAS}/${cfg.account}.${cfg.store}` });
57604
+ }
57602
57605
 
57603
57606
  // src/cms/authoring.ts
57604
57607
  function unwrapValue(node) {
@@ -57944,18 +57947,34 @@ async function cmsDoctorCommand(opts, call = callCms) {
57944
57947
  const session = describeSession(sessionState(process.env.PARITY_CMS_ACCOUNT));
57945
57948
  const pluginAdvice = vtexContentPluginAdvice();
57946
57949
  try {
57950
+ const entries = await listEntries(cfg, {}, call);
57951
+ const storesInUse = [...new Set(entries.map((e) => e.storeId).filter(Boolean))];
57952
+ const storeMismatch = storesInUse.length > 0 && !storesInUse.includes(cfg.store) ? `PARITY_CMS_STORE is "${cfg.store}", but entries on this account use ${storesInUse.map((s) => `"${s}"`).join(", ")}. A wrong store id answers 200 with empty results instead of an error.` : null;
57953
+ const schema = await getSchemaMeta(cfg, call).catch(() => null);
57947
57954
  const types = await getContentTypes(cfg, call);
57948
57955
  const drift = schemaDrift(types, opts.repo);
57949
57956
  const propDrift = propertyDrift(types, opts.repo);
57950
57957
  const blockingProps = propDrift.filter((d) => d.missingProps.length > 0);
57951
57958
  if (opts.json) {
57952
- console.log(JSON.stringify({ session, contentPlugin: pluginAdvice, contentTypes: Object.keys(types), drift, propDrift }, null, 2));
57953
- return drift.some((d) => d.missingOnAccount.length > 0) || blockingProps.length > 0 ? 1 : 0;
57959
+ console.log(JSON.stringify({
57960
+ session,
57961
+ contentPlugin: pluginAdvice,
57962
+ storeMismatch,
57963
+ schemaId: schema?.$id ?? null,
57964
+ contentTypes: Object.keys(types),
57965
+ drift,
57966
+ propDrift
57967
+ }, null, 2));
57968
+ return drift.some((d) => d.missingOnAccount.length > 0) || blockingProps.length > 0 || Boolean(storeMismatch) ? 1 : 0;
57954
57969
  }
57955
57970
  if (session)
57956
57971
  console.log(`${chalk7.green("✓")} ${session}`);
57957
57972
  if (pluginAdvice)
57958
57973
  console.log(`${chalk7.yellow("!")} ${pluginAdvice}`);
57974
+ if (storeMismatch)
57975
+ console.log(`${chalk7.red("✗")} ${storeMismatch}`);
57976
+ if (schema?.$id)
57977
+ console.log(chalk7.dim(` published schema: ${schema.$id}`));
57959
57978
  const blocking = drift.filter((d) => d.missingOnAccount.length > 0);
57960
57979
  if (blocking.length === 0 && propDrift.length === 0) {
57961
57980
  console.log(`${chalk7.green("✓")} every section the repo declares is published on the account`);
@@ -57974,7 +57993,7 @@ async function cmsDoctorCommand(opts, call = callCms) {
57974
57993
  for (const d of drift.filter((x) => x.missingInRepo.length > 0)) {
57975
57994
  console.log(`${chalk7.gray("·")} ${d.contentType}: ${d.missingInRepo.length} section(s) published but not in the repo ${chalk7.dim("(usually core components the repo never overrode)")}`);
57976
57995
  }
57977
- return blocking.length > 0 || blockingProps.length > 0 ? 1 : 0;
57996
+ return blocking.length > 0 || blockingProps.length > 0 || Boolean(storeMismatch) ? 1 : 0;
57978
57997
  } catch (err) {
57979
57998
  return fail(err);
57980
57999
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/parity",
3
- "version": "0.33.18",
3
+ "version": "0.33.19",
4
4
  "description": "E2E parity validator for site migrations. Compares prod vs cand and reports UI, functional, SEO, visual, and Web Vitals deltas with an LLM-ranked HTML report.",
5
5
  "type": "module",
6
6
  "license": "MIT",