@tokenoftrust/storefront-runner 7.11.3 → 7.11.5

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.
@@ -63,7 +63,7 @@ function uploadRecordKey(tenantId: string, address: string): string {
63
63
  return `original-images/${tenantId}/uploads/${address}.json`;
64
64
  }
65
65
 
66
- async function readUploadedOriginalEntry(
66
+ export async function readUploadedOriginalEntry(
67
67
  bucket: CapturedOriginalBucket,
68
68
  tenantId: string,
69
69
  address: string,
@@ -315,22 +315,6 @@ export class SourceAuthorityStore {
315
315
  mutation,
316
316
  ],
317
317
  });
318
- for (const r of records.filter(
319
- (r) => r.kind === "check" || r.kind === "result",
320
- )) {
321
- const controlId = `source-control:${await digestJson({ key, kind: r.kind, id: r.id })}`;
322
- statements.push({
323
- sql: `INSERT INTO scrappy_commerce_inbox(tenant_id,stage,source,source_event_id,event_version,idempotency_key,payload_digest,received_at) SELECT tenant_id,stage,source,?,1,?,?,? FROM commerce_source_authority WHERE ${WHERE} AND mutation_id=?`,
324
- params: [
325
- controlId,
326
- controlId,
327
- r.digest,
328
- now,
329
- ...keyParams(key),
330
- mutation,
331
- ],
332
- });
333
- }
334
318
  if (replay)
335
319
  statements.push({
336
320
  sql: `INSERT INTO scrappy_caller_replay(tenant_id,stage,issuer,jti,seen_at) SELECT tenant_id,stage,?,?,? FROM commerce_source_authority WHERE ${WHERE} AND mutation_id=?`,
@@ -359,25 +343,40 @@ export class SourceAuthorityStore {
359
343
  mutation,
360
344
  ],
361
345
  });
362
- statements.push({
363
- sql: `INSERT INTO scrappy_shipment_audit(audit_id,tenant_id,stage,order_id,at,actor_id,kind,from_state,to_state)
364
- SELECT ?,tenant_id,stage,order_id,?,'commerce-source-authority','source-authority','source',?
365
- FROM scrappy_commerce_orders WHERE tenant_id=? AND stage=? AND source=? AND source_order_id=?
366
- AND EXISTS(SELECT 1 FROM commerce_source_authority WHERE ${WHERE} AND mutation_id=?)`,
367
- params: [
368
- `audit_${crypto.randomUUID()}`,
369
- `${now}#source-${state.version}`,
370
- state.pending || state.sync || state.holds.length || state.budget
371
- ? "held"
372
- : "verified",
373
- key.tenantId,
374
- key.stage,
375
- key.source,
376
- key.sourceOrderId,
377
- ...keyParams(key),
378
- mutation,
379
- ],
380
- });
346
+ // Record a source-authority audit entry only when durable authority health transitions
347
+ // (ignoring transient pending_check flips during healthy renewals).
348
+ const prevDurableStatus = !old
349
+ ? "none"
350
+ : !old.accepted_ledger_generation ||
351
+ old.source_sync_pending ||
352
+ old.unresolved_count ||
353
+ old.authority_budget
354
+ ? "held"
355
+ : "verified";
356
+ const nextDurableStatus =
357
+ !state.accepted || state.sync || state.holds.length > 0 || state.budget
358
+ ? "held"
359
+ : "verified";
360
+ if (nextDurableStatus !== prevDurableStatus) {
361
+ statements.push({
362
+ sql: `INSERT INTO scrappy_shipment_audit(audit_id,tenant_id,stage,order_id,at,actor_id,kind,from_state,to_state)
363
+ SELECT ?,tenant_id,stage,order_id,?,'commerce-source-authority','source-authority',?,?
364
+ FROM scrappy_commerce_orders WHERE tenant_id=? AND stage=? AND source=? AND source_order_id=?
365
+ AND EXISTS(SELECT 1 FROM commerce_source_authority WHERE ${WHERE} AND mutation_id=?)`,
366
+ params: [
367
+ `audit_${crypto.randomUUID()}`,
368
+ `${now}#source-${state.version}`,
369
+ prevDurableStatus,
370
+ nextDurableStatus,
371
+ key.tenantId,
372
+ key.stage,
373
+ key.source,
374
+ key.sourceOrderId,
375
+ ...keyParams(key),
376
+ mutation,
377
+ ],
378
+ });
379
+ }
381
380
  const result = await this.db.batchResults(statements);
382
381
  return Boolean(result[0]?.results.length);
383
382
  }
@@ -201,8 +201,18 @@ export async function tryServeStaticBundle(
201
201
  // `null` = the manifest proves this path is outside the bundle's static surface
202
202
  // (an app surface like /admin) — the caller owns it.
203
203
  if (!bundleResponse) return null;
204
- if (bundleCacheKey && cache) {
205
- await putCachedPage(cache, bundleCacheKey, bundleResponse);
204
+ if (bundleCacheKey && cache && bundleResponse.status === 200 && !bundleResponse.headers.has("set-cookie")) {
205
+ const cc = bundleResponse.headers.get("cache-control") ?? "";
206
+ if (!cc.includes("no-store") && !cc.includes("private")) {
207
+ if ((bundleResponse.headers.get("content-type") ?? "").includes("text/html")) {
208
+ await putCachedPage(cache, bundleCacheKey, bundleResponse);
209
+ } else {
210
+ const cloned = bundleResponse.clone();
211
+ const toStore = new Response(cloned.body, cloned);
212
+ toStore.headers.set("X-ToT-Cache", "stored");
213
+ await cache.put(bundleCacheKey, toStore).catch(() => void 0);
214
+ }
215
+ }
206
216
  }
207
217
  return bundleResponse;
208
218
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenoftrust/storefront-runner",
3
- "version": "7.11.3",
3
+ "version": "7.11.5",
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",
@@ -597,6 +597,9 @@ const PLATFORM_CUSTOM_PROPERTIES = [
597
597
  "--space-7",
598
598
  "--space-8",
599
599
  "--space-9",
600
+ "--space-10",
601
+ "--space-11",
602
+ "--space-12",
600
603
  "--container-max",
601
604
  "--section-rhythm",
602
605
  "--radius-sm",
@@ -610,6 +613,10 @@ const PLATFORM_CUSTOM_PROPERTIES = [
610
613
  "--shadow-md",
611
614
  "--shadow-lg",
612
615
  "--tap-target",
616
+ "--focus-ring",
617
+ "--surface-card",
618
+ "--text-muted",
619
+ "--display-size",
613
620
  ] as const;
614
621
 
615
622
  const NO_DECLARED_CUSTOM_PROPERTIES: ReadonlySet<string> = new Set(PLATFORM_CUSTOM_PROPERTIES);