@lace-cloud/canvas 0.7.0 → 0.7.1

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.d.mts CHANGED
@@ -999,6 +999,14 @@ type SnapshotUrls = {
999
999
  layoutsUrl: string;
1000
1000
  fetch?: typeof fetch;
1001
1001
  meta?: SnapshotMeta;
1002
+ /**
1003
+ * Extra request headers sent with the bundle + layouts GETs. Same-origin
1004
+ * portal fetches carry the session cookie via `credentials: include`, but
1005
+ * the API still resolves org/team scope from `x-org-slug`/`x-team-slug`
1006
+ * headers — the caller must supply them here or the reads 400. Embed routes
1007
+ * authenticate via the token in the URL and omit this.
1008
+ */
1009
+ headers?: Record<string, string>;
1002
1010
  };
1003
1011
  type SnapshotCanvasEngineInput = SnapshotInProcess | SnapshotUrls;
1004
1012
  declare class SnapshotCanvasEngine implements CanvasEngine {
package/dist/index.d.ts CHANGED
@@ -999,6 +999,14 @@ type SnapshotUrls = {
999
999
  layoutsUrl: string;
1000
1000
  fetch?: typeof fetch;
1001
1001
  meta?: SnapshotMeta;
1002
+ /**
1003
+ * Extra request headers sent with the bundle + layouts GETs. Same-origin
1004
+ * portal fetches carry the session cookie via `credentials: include`, but
1005
+ * the API still resolves org/team scope from `x-org-slug`/`x-team-slug`
1006
+ * headers — the caller must supply them here or the reads 400. Embed routes
1007
+ * authenticate via the token in the URL and omit this.
1008
+ */
1009
+ headers?: Record<string, string>;
1002
1010
  };
1003
1011
  type SnapshotCanvasEngineInput = SnapshotInProcess | SnapshotUrls;
1004
1012
  declare class SnapshotCanvasEngine implements CanvasEngine {
package/dist/index.mjs CHANGED
@@ -17567,8 +17567,8 @@ var SnapshotCanvasEngine = class {
17567
17567
  }
17568
17568
  this.loadPromise = (async () => {
17569
17569
  const [bundleBytes, layoutsBytes] = await Promise.all([
17570
- this.fetchBytes(input.bundleUrl, "bundle"),
17571
- this.fetchBytes(input.layoutsUrl, "layouts")
17570
+ this.fetchBytes(input.bundleUrl, "bundle", input.headers),
17571
+ this.fetchBytes(input.layoutsUrl, "layouts", input.headers)
17572
17572
  ]);
17573
17573
  const bundle = Bundle.decode(bundleBytes);
17574
17574
  const layouts = LayoutsMap.decode(layoutsBytes).layouts ?? {};
@@ -17579,10 +17579,10 @@ var SnapshotCanvasEngine = class {
17579
17579
  }
17580
17580
  return this.loadPromise;
17581
17581
  }
17582
- async fetchBytes(url, label) {
17582
+ async fetchBytes(url, label, headers) {
17583
17583
  const res = await this.fetchImpl(url, {
17584
17584
  method: "GET",
17585
- headers: { accept: "application/octet-stream" },
17585
+ headers: { accept: "application/octet-stream", ...headers },
17586
17586
  // Credentials: include so same-origin portal fetches carry the
17587
17587
  // session cookie. Embed routes validate the token in the URL
17588
17588
  // instead, so this is a no-op there.