@gallop.software/studio 1.0.2 → 1.0.4

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.
@@ -4570,37 +4570,35 @@ function StudioDetailView() {
4570
4570
  currentFile: focusedItem.name
4571
4571
  });
4572
4572
  try {
4573
+ const imageKey = focusedItem.path.replace(/^public\//, "");
4574
+ const formattedKey = imageKey.startsWith("/") ? imageKey : `/${imageKey}`;
4573
4575
  const response = await fetch("/api/studio/reprocess", {
4574
4576
  method: "POST",
4575
4577
  headers: { "Content-Type": "application/json" },
4576
4578
  body: JSON.stringify({
4577
- paths: [focusedItem.path]
4579
+ imageKeys: [formattedKey]
4578
4580
  })
4579
4581
  });
4582
+ const data = await response.json();
4580
4583
  if (!response.ok) {
4581
- throw new Error("Processing failed");
4582
- }
4583
- const reader = _optionalChain([response, 'access', _58 => _58.body, 'optionalAccess', _59 => _59.getReader, 'call', _60 => _60()]);
4584
- if (!reader) {
4585
- throw new Error("No response body");
4584
+ throw new Error(data.error || "Processing failed");
4586
4585
  }
4587
- const decoder = new TextDecoder();
4588
- let buffer = "";
4589
- while (true) {
4590
- const { done, value } = await reader.read();
4591
- if (done) break;
4592
- buffer += decoder.decode(value, { stream: true });
4593
- const lines = buffer.split("\n");
4594
- buffer = lines.pop() || "";
4595
- for (const line of lines) {
4596
- if (line.startsWith("data: ")) {
4597
- try {
4598
- const data = JSON.parse(line.slice(6));
4599
- setProcessProgress(data);
4600
- } catch (e6) {
4601
- }
4602
- }
4603
- }
4586
+ if (_optionalChain([data, 'access', _58 => _58.processed, 'optionalAccess', _59 => _59.length]) > 0) {
4587
+ setProcessProgress({
4588
+ current: 1,
4589
+ total: 1,
4590
+ percent: 100,
4591
+ status: "complete",
4592
+ message: `Processed ${focusedItem.name}`
4593
+ });
4594
+ } else if (_optionalChain([data, 'access', _60 => _60.errors, 'optionalAccess', _61 => _61.length]) > 0) {
4595
+ setProcessProgress({
4596
+ current: 0,
4597
+ total: 1,
4598
+ percent: 0,
4599
+ status: "error",
4600
+ message: `Failed to process: ${data.errors.join(", ")}`
4601
+ });
4604
4602
  }
4605
4603
  triggerRefresh();
4606
4604
  } catch (error) {
@@ -4610,7 +4608,7 @@ function StudioDetailView() {
4610
4608
  total: 1,
4611
4609
  percent: 0,
4612
4610
  status: "error",
4613
- message: "Failed to process image"
4611
+ message: error instanceof Error ? error.message : "Failed to process image"
4614
4612
  });
4615
4613
  }
4616
4614
  };
@@ -5762,4 +5760,4 @@ var StudioUI_default = StudioUI;
5762
5760
 
5763
5761
 
5764
5762
  exports.StudioUI = StudioUI; exports.default = StudioUI_default;
5765
- //# sourceMappingURL=StudioUI-GWMM47P7.js.map
5763
+ //# sourceMappingURL=StudioUI-FCQJK23M.js.map