@swell/apps-sdk 1.0.154 → 1.0.155

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.mjs CHANGED
@@ -7627,7 +7627,7 @@ var MAX_TTL = YEAR;
7627
7627
  var SHORT_TTL = 5 * SECOND;
7628
7628
 
7629
7629
  // src/cache/worker-cache-proxy.ts
7630
- var CACHE_NAME = "swell-cache-v1";
7630
+ var CACHE_NAME = "swell-cache-v011";
7631
7631
  var CACHE_KEY_ORIGIN = "https://cache.swell.store";
7632
7632
  var WorkerCacheProxy = class {
7633
7633
  swell;
@@ -7676,6 +7676,7 @@ var WorkerCacheProxy = class {
7676
7676
  }
7677
7677
  });
7678
7678
  await cache.put(keyUrl, response);
7679
+ logger.debug("[SDK] cache put done", { keyUrl });
7679
7680
  } catch {
7680
7681
  }
7681
7682
  }
@@ -20505,9 +20506,9 @@ var ThemeLoader = class {
20505
20506
  fields: "id, name, type, file, file_path, hash"
20506
20507
  // NO file_data
20507
20508
  };
20509
+ const cache = new WorkerCacheProxy(this.swell);
20510
+ const versionHash = this.swell.swellHeaders["theme-version-hash"];
20508
20511
  try {
20509
- const cache = new WorkerCacheProxy(this.swell);
20510
- const versionHash = this.swell.swellHeaders["theme-version-hash"];
20511
20512
  const cached = await cache.get(
20512
20513
  "/:themes:configs",
20513
20514
  query,
@@ -20528,14 +20529,13 @@ var ThemeLoader = class {
20528
20529
  query
20529
20530
  );
20530
20531
  const configs = response?.results || [];
20531
- try {
20532
- const cache = new WorkerCacheProxy(this.swell);
20533
- const versionHash = this.swell.swellHeaders["theme-version-hash"];
20534
- await cache.put("/:themes:configs", query, configs, {
20535
- version: versionHash || null
20536
- });
20537
- } catch (err) {
20538
- logger.warn("[ThemeLoader] Cache write failed", err);
20532
+ const ctx = this.swell.workerCtx || globalThis.executionContext;
20533
+ if (ctx && typeof ctx.waitUntil === "function") {
20534
+ ctx.waitUntil(
20535
+ cache.put("/:themes:configs", query, configs, {
20536
+ version: versionHash || null
20537
+ })
20538
+ );
20539
20539
  }
20540
20540
  return configs;
20541
20541
  }