@odla-ai/brand 0.8.1 → 0.8.3

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/dist/index.cjs CHANGED
@@ -503,7 +503,13 @@ function rowAsWritten(ns, row) {
503
503
  return changed ? out : row;
504
504
  }
505
505
  function receiptAsWritten(row) {
506
- return rowAsWritten(BRAND_NS.approvalReceipt, row);
506
+ const normalized = rowAsWritten(BRAND_NS.approvalReceipt, row);
507
+ if (!record(normalized)) return normalized;
508
+ const systemAttrs = Object.keys(normalized).filter((key) => key.startsWith("$"));
509
+ if (systemAttrs.length === 0) return normalized;
510
+ const out = { ...normalized };
511
+ for (const key of systemAttrs) delete out[key];
512
+ return out;
507
513
  }
508
514
  function proposalAsWritten(row) {
509
515
  return rowAsWritten(BRAND_NS.proposal, row);
@@ -4383,7 +4389,10 @@ async function activePalette(ctx, book) {
4383
4389
  book: {}
4384
4390
  }
4385
4391
  });
4386
- const palette = (result[BRAND_NS.palette] ?? [])[0];
4392
+ const palette = rowAsWritten(
4393
+ BRAND_NS.palette,
4394
+ (result[BRAND_NS.palette] ?? [])[0]
4395
+ );
4387
4396
  if (!palette || palette.bookId !== book.id || palette.status !== "active" || !palette.proposalId || !palette.approvalReceiptId || !palette.approvalActionDigest || !hasExactOneLink(palette.book, book.id)) throw new BrandConflictError(
4388
4397
  "active palette is missing valid approval provenance"
4389
4398
  );
@@ -4431,7 +4440,10 @@ async function approvedTypography(ctx, book) {
4431
4440
  book: {}
4432
4441
  }
4433
4442
  });
4434
- const section = (result[BRAND_NS.section] ?? [])[0];
4443
+ const section = rowAsWritten(
4444
+ BRAND_NS.section,
4445
+ (result[BRAND_NS.section] ?? [])[0]
4446
+ );
4435
4447
  if (!section || section.status !== "approved") return {};
4436
4448
  if (section.bookId !== book.id || section.kind !== "typography" || !section.approvalReceiptId || !section.approvalActionDigest || !hasExactOneLink(section.book, book.id)) throw new BrandConflictError(
4437
4449
  "approved typography is missing valid approval provenance"