[object Object]

← back to Dw Sarah Rowland Searchfix

auto-save: 2026-07-30T08:16:08 (3 files) — check-wiring.mjs read-snippet.mjs test-state.mjs

fd4e75f04c94c218a0f1dad777ecb73b53a4f913 · 2026-07-30 08:16:14 -0700 · Steve Abrams

Files touched

Diff

commit fd4e75f04c94c218a0f1dad777ecb73b53a4f913
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Thu Jul 30 08:16:14 2026 -0700

    auto-save: 2026-07-30T08:16:08 (3 files) — check-wiring.mjs read-snippet.mjs test-state.mjs
---
 check-wiring.mjs | 26 ++++++++++++++++++++++++++
 read-snippet.mjs | 10 ++++++++++
 test-state.mjs   | 15 +++++++++++++++
 3 files changed, 51 insertions(+)

diff --git a/check-wiring.mjs b/check-wiring.mjs
new file mode 100644
index 0000000..b006507
--- /dev/null
+++ b/check-wiring.mjs
@@ -0,0 +1,26 @@
+import fs from 'node:fs'; import os from 'node:os';
+const env = fs.readFileSync(`${os.homedir()}/Projects/secrets-manager/.env`,'utf8');
+const tok = (k)=> (env.match(new RegExp('^'+k+'=(.+)$','m'))||[])[1]?.trim();
+const THEME_TOK = tok('SHOPIFY_THEME_TOKEN') || tok('SHOPIFY_CONTENT_TOKEN') || tok('SHOPIFY_ADMIN_TOKEN');
+const STORE='designer-laboratory-sandbox.myshopify.com', API='2024-10';
+// resolve live (main) theme id
+const tr = await fetch(`https://${STORE}/admin/api/${API}/themes.json`,{headers:{'X-Shopify-Access-Token':THEME_TOK}});
+const themes=(await tr.json()).themes||[];
+const live=themes.find(t=>t.role==='main');
+console.log('LIVE theme:', live?`${live.id} "${live.name}"`:'(none / token lacks themes scope)');
+if(!live){ console.log(JSON.stringify(themes.slice(0,3))); process.exit(0); }
+// pull the asset list, grep filenames, then fetch the likely PDP files and grep for 'designer'
+const ar = await fetch(`https://${STORE}/admin/api/${API}/themes/${live.id}/assets.json`,{headers:{'X-Shopify-Access-Token':THEME_TOK}});
+const assets=(await ar.json()).assets||[];
+const candidates = assets.map(a=>a.key).filter(k=>/product|meta|spec|filter|search/i.test(k) && k.endsWith('.liquid'));
+console.log(`\nScanning ${candidates.length} candidate liquid files for "designer"...`);
+let hits=[];
+for(const key of candidates){
+  const r=await fetch(`https://${STORE}/admin/api/${API}/themes/${live.id}/assets.json?asset[key]=${encodeURIComponent(key)}`,{headers:{'X-Shopify-Access-Token':THEME_TOK}});
+  const body=(await r.json())?.asset?.value||'';
+  const m=body.match(/[^\n]*designer[^\n]*/gi);
+  if(m) hits.push({key, lines:[...new Set(m)].slice(0,4)});
+  await new Promise(z=>setTimeout(z,80));
+}
+if(!hits.length) console.log('  → NO theme file references "designer" anywhere.');
+else hits.forEach(h=>{ console.log(`\n  ${h.key}:`); h.lines.forEach(l=>console.log('     '+l.trim().slice(0,110))); });
diff --git a/read-snippet.mjs b/read-snippet.mjs
new file mode 100644
index 0000000..4f3edf2
--- /dev/null
+++ b/read-snippet.mjs
@@ -0,0 +1,10 @@
+import fs from 'node:fs'; import os from 'node:os';
+const env = fs.readFileSync(`${os.homedir()}/Projects/secrets-manager/.env`,'utf8');
+const tok=(k)=>(env.match(new RegExp('^'+k+'=(.+)$','m'))||[])[1]?.trim();
+const T=tok('SHOPIFY_THEME_TOKEN')||tok('SHOPIFY_CONTENT_TOKEN')||tok('SHOPIFY_ADMIN_TOKEN');
+const S='designer-laboratory-sandbox.myshopify.com',A='2024-10',ID='144396058675';
+const r=await fetch(`https://${S}/admin/api/${A}/themes/${ID}/assets.json?asset[key]=snippets/product-description-meta.liquid`,{headers:{'X-Shopify-Access-Token':T}});
+const body=(await r.json())?.asset?.value||'';
+// show the brand assignment + the Designer row + any custom.designer
+const lines=body.split('\n');
+lines.forEach((l,i)=>{ if(/assign\s+brand|brand\s*=|Designer|custom\.designer|metafields/i.test(l)) console.log(String(i+1).padStart(4),l.trim().slice(0,140)); });
diff --git a/test-state.mjs b/test-state.mjs
new file mode 100644
index 0000000..a614bcb
--- /dev/null
+++ b/test-state.mjs
@@ -0,0 +1,15 @@
+import { gql } from './lib.mjs';
+import fs from 'node:fs';
+const products=JSON.parse(fs.readFileSync(new URL('./products.json',import.meta.url)));
+// pick 5 that were previously invisible (generic or koroseal-named titles, no 'Sarah Rowland' in title)
+const invis=products.filter(p=>!/sarah\s*rowland/i.test(p.title)).slice(0,5);
+const Q=`query($id:ID!){ product(id:$id){ title vendor
+  brand:metafield(namespace:"custom",key:"brand"){value}
+  gbrand:metafield(namespace:"global",key:"Brand"){value}
+  designer:metafield(namespace:"custom",key:"designer"){value} } }`;
+console.log('Sample of formerly-invisible products — what their Designer-row source holds:\n');
+for(const p of invis){
+  const d=(await gql(Q,{id:p.id})).product;
+  console.log(`• ${d.title.slice(0,42)}`);
+  console.log(`    vendor=${d.vendor}  custom.brand=${d.brand?.value??'∅'}  global.Brand=${d.gbrand?.value??'∅'}  custom.designer=${d.designer?.value??'∅'}`);
+}

← 08a1a5f auto-save: 2026-07-29T07:06:42 (8 files) — .gitignore apply.  ·  back to Dw Sarah Rowland Searchfix  ·  TK-10037: wire PDP Designer row to prefer custom.designer (l 6257f36 →