@trops/dash-core 0.1.232 → 0.1.233

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.
@@ -32248,7 +32248,7 @@ async function installThemeFromRegistry$1(win, appId, packageName) {
32248
32248
 
32249
32249
  const contentType = response.headers.get("content-type") || "";
32250
32250
  const arrayBuffer = await response.arrayBuffer();
32251
- const zipBuffer = Buffer.from(arrayBuffer);
32251
+ let zipBuffer = Buffer.from(arrayBuffer);
32252
32252
  console.log(`${TAG} [3/5 Download] size=${zipBuffer.length} bytes`);
32253
32253
 
32254
32254
  if (zipBuffer.length === 0) {
@@ -32272,8 +32272,10 @@ async function installThemeFromRegistry$1(win, appId, packageName) {
32272
32272
  let themeData;
32273
32273
 
32274
32274
  if (contentType.includes("application/json")) {
32275
- // Registry served theme data as JSON directly parse and use it
32276
- console.log(`${TAG} [4/5 Extract] JSON response — parsing directly`);
32275
+ // Registry returns JSON with a downloadUrl pointing to the actual ZIP
32276
+ console.log(
32277
+ `${TAG} [3/5 Download] JSON response — checking for downloadUrl`,
32278
+ );
32277
32279
  let jsonData;
32278
32280
  try {
32279
32281
  jsonData = JSON.parse(zipBuffer.toString("utf-8"));
@@ -32285,16 +32287,52 @@ async function installThemeFromRegistry$1(win, appId, packageName) {
32285
32287
  }
32286
32288
  if (jsonData.error) {
32287
32289
  console.log(
32288
- `${TAG} [4/5 Extract] FAIL — JSON error: ${jsonData.error}`,
32290
+ `${TAG} [3/5 Download] FAIL — JSON error: ${jsonData.error}`,
32289
32291
  );
32290
32292
  return {
32291
32293
  success: false,
32292
32294
  error: `Download failed: ${jsonData.error}`,
32293
32295
  };
32294
32296
  }
32295
- // The response may be raw theme data, or wrapped in a data/theme key
32296
- themeData = jsonData.data || jsonData.theme || jsonData;
32297
- } else {
32297
+ if (jsonData.downloadUrl) {
32298
+ // Follow the pre-signed URL to get the actual ZIP
32299
+ console.log(`${TAG} [3/5 Download] following downloadUrl to fetch ZIP`);
32300
+ let zipResponse;
32301
+ try {
32302
+ zipResponse = await fetch(jsonData.downloadUrl);
32303
+ } catch (fetchErr) {
32304
+ return {
32305
+ success: false,
32306
+ error: `Download failed: could not fetch ZIP from storage (${fetchErr.message}).`,
32307
+ };
32308
+ }
32309
+ if (!zipResponse.ok) {
32310
+ return {
32311
+ success: false,
32312
+ error: `Download failed: storage returned ${zipResponse.status} ${zipResponse.statusText}`,
32313
+ };
32314
+ }
32315
+ const zipArrayBuffer = await zipResponse.arrayBuffer();
32316
+ zipBuffer = Buffer.from(zipArrayBuffer);
32317
+ console.log(
32318
+ `${TAG} [3/5 Download] ZIP fetched, size=${zipBuffer.length} bytes`,
32319
+ );
32320
+ if (zipBuffer.length === 0) {
32321
+ return {
32322
+ success: false,
32323
+ error: "Download failed: storage returned an empty ZIP file.",
32324
+ };
32325
+ }
32326
+ } else {
32327
+ // No downloadUrl — treat as direct theme data
32328
+ console.log(
32329
+ `${TAG} [4/5 Extract] JSON response with no downloadUrl — using as theme data`,
32330
+ );
32331
+ themeData = jsonData.data || jsonData.theme || jsonData;
32332
+ }
32333
+ }
32334
+
32335
+ if (!themeData) {
32298
32336
  // ZIP response — extract .theme.json from archive
32299
32337
  let zip;
32300
32338
  try {