@tokenoftrust/storefront-runner 4.6.0 → 4.6.2

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.
@@ -137,10 +137,15 @@ export interface OrderSyncHealth {
137
137
  detail: string;
138
138
  }
139
139
 
140
- /** The sidebar's order-sync row, from the same source the Orders tab reads. */
140
+ /**
141
+ * The sidebar's order-sync row, from the same source the Orders tab reads. `status` is the ledger
142
+ * read; `null` means that read was unavailable, never that the ledger is healthy. A partner-api
143
+ * source has no ledger status and ignores it.
144
+ */
141
145
  export function orderSyncHealth(source: OrderSource, status: LedgerSyncStatus | null): OrderSyncHealth {
142
146
  if (source.kind === "not-connected") return { value: "Not connected", detail: orderSourceGapMessage(source.gap) };
143
- if (source.kind === "partner-api" || !status) return { value: "Connected", detail: "Reads this store's checkout orders." };
147
+ if (source.kind === "partner-api") return { value: "Connected", detail: "Reads this store's checkout orders." };
148
+ if (!status) return { value: "Check", detail: "Order sync status could not be read. Reload to try again." };
144
149
  if (status.unconfirmed.count > 0) {
145
150
  const n = status.unconfirmed.count;
146
151
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenoftrust/storefront-runner",
3
- "version": "4.6.0",
3
+ "version": "4.6.2",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "description": "World-shareable storefront runner: multi-tenant renderer on Astro/Cloudflare. No control plane.",
6
6
  "packageManager": "pnpm@11.9.0",
@@ -276,6 +276,10 @@ function assertFixtureTree(path) {
276
276
  if (info.isDirectory()) for (const name of readdirSync(path)) assertFixtureTree(join(path, name));
277
277
  }
278
278
 
279
+ export function assertPreviewBuildConfig(config) {
280
+ if (config.targetEnvironment !== "preview" || config.no_bundle !== true) throw fixedError("refresh_build_config_invalid");
281
+ }
282
+
279
283
  function embedsSha(path, sha) {
280
284
  for (const entry of readdirSync(path, { withFileTypes: true })) {
281
285
  const file = join(path, entry.name);
@@ -373,10 +377,10 @@ export const realEffects = {
373
377
  for (const [path, hash] of Object.entries(pin.files)) {
374
378
  if (digest(execFileSync("git", ["-C", catalog, "show", `${options.catalogSha}:${path}`], { stdio: ["ignore", "pipe", "pipe"], maxBuffer: 8 * 1024 * 1024 })) !== hash) throw fixedError("refresh_contract_hash_mismatch");
375
379
  }
376
- if (prior.storefrontSha === options.storefrontSha) return {};
377
380
  for (const rel of e2eCatalogFixtures(prior.preview)) {
378
381
  if (existsSync(join(prior.preview, rel)) && git(prior.preview, "ls-tree", "-r", "--name-only", options.storefrontSha, "--", rel)) throw fixedError("refresh_fixture_tracked_collision");
379
382
  }
383
+ if (prior.storefrontSha === options.storefrontSha) return {};
380
384
  let checkout;
381
385
  let catalogCheckout;
382
386
  try {
@@ -409,7 +413,7 @@ export const realEffects = {
409
413
  if (git(checkout, "rev-parse", "HEAD") !== options.storefrontSha || git(checkout, "status", "--porcelain", "--untracked-files=no")) throw fixedError("refresh_build_source_changed");
410
414
  const config = JSON.parse(readFileSync(join(checkout, "apps/storefront/dist/server/wrangler.json"), "utf8"));
411
415
  if (!embedsSha(join(checkout, "apps/storefront/dist/server"), options.storefrontSha)) throw fixedError("refresh_build_ref_missing");
412
- if (config.no_bundle !== true) throw fixedError("refresh_build_config_invalid");
416
+ assertPreviewBuildConfig(config);
413
417
  const priorConfig = JSON.parse(readFileSync(join(prior.checkout, "apps/storefront/dist/server/wrangler.json"), "utf8"));
414
418
  for (const key of ["d1_databases", "kv_namespaces", "r2_buckets", "durable_objects", "migrations"]) {
415
419
  if (JSON.stringify(config[key] ?? null) !== JSON.stringify(priorConfig[key] ?? null)) throw fixedError("refresh_state_bindings_changed");