@trops/dash-core 0.1.608 → 0.1.609

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.esm.js CHANGED
@@ -49948,66 +49948,79 @@ var WidgetsSection = function WidgetsSection(_ref) {
49948
49948
  return _context.abrupt("return");
49949
49949
  case 1:
49950
49950
  _context.prev = 1;
49951
- // Run deletes sequentially so a transient FS error on one draft
49952
- // doesn't poison the rest. drafts:delete is idempotent so a
49953
- // re-run of cleanup after a partial failure is safe.
49951
+ // Two classes of "draft" sit in the list:
49952
+ // 1. Canonical drafts: row in widget-drafts.json + on-disk
49953
+ // package dir under @ai-built/*-draft-*. drafts:delete
49954
+ // removes both halves in one IPC.
49955
+ // 2. Orphan drafts: package dir exists and matches the
49956
+ // `-draft-` naming, but no metadata row exists — leftovers
49957
+ // from sessions before the drafts API, or partial deletes.
49958
+ // classifyWidget() returns draftId=null for these, so the
49959
+ // drafts:delete path is unavailable. Fall back to the
49960
+ // regular widget uninstall path, which removes the dir
49961
+ // by packageId.
49962
+ // Deletes run sequentially; both IPCs are idempotent.
49954
49963
  _iterator = _createForOfIteratorHelper$k(bulkDraftsTarget);
49955
49964
  _context.prev = 2;
49956
49965
  _iterator.s();
49957
49966
  case 3:
49958
49967
  if ((_step = _iterator.n()).done) {
49959
- _context.next = 8;
49968
+ _context.next = 10;
49960
49969
  break;
49961
49970
  }
49962
49971
  draft = _step.value;
49963
- if (draft.draftId) {
49964
- _context.next = 4;
49972
+ _context.prev = 4;
49973
+ if (!(draft.draftId && (_window$mainApi = window.mainApi) !== null && _window$mainApi !== void 0 && (_window$mainApi = _window$mainApi.drafts) !== null && _window$mainApi !== void 0 && _window$mainApi["delete"])) {
49974
+ _context.next = 6;
49965
49975
  break;
49966
49976
  }
49967
- return _context.abrupt("continue", 7);
49968
- case 4:
49969
- _context.prev = 4;
49970
49977
  _context.next = 5;
49971
- return (_window$mainApi = window.mainApi) === null || _window$mainApi === void 0 || (_window$mainApi = _window$mainApi.drafts) === null || _window$mainApi === void 0 ? void 0 : _window$mainApi["delete"](draft.draftId);
49978
+ return window.mainApi.drafts["delete"](draft.draftId);
49972
49979
  case 5:
49973
49980
  _context.next = 7;
49974
49981
  break;
49975
49982
  case 6:
49976
- _context.prev = 6;
49977
- _context["catch"](4);
49983
+ _context.next = 7;
49984
+ return uninstallWidget(draft.name);
49978
49985
  case 7:
49979
- _context.next = 3;
49986
+ _context.next = 9;
49980
49987
  break;
49981
49988
  case 8:
49982
- _context.next = 10;
49983
- break;
49989
+ _context.prev = 8;
49990
+ _context["catch"](4);
49984
49991
  case 9:
49985
- _context.prev = 9;
49992
+ _context.next = 3;
49993
+ break;
49994
+ case 10:
49995
+ _context.next = 12;
49996
+ break;
49997
+ case 11:
49998
+ _context.prev = 11;
49986
49999
  _t2 = _context["catch"](2);
49987
50000
  _iterator.e(_t2);
49988
- case 10:
49989
- _context.prev = 10;
50001
+ case 12:
50002
+ _context.prev = 12;
49990
50003
  _iterator.f();
49991
- return _context.finish(10);
49992
- case 11:
49993
- _context.next = 12;
50004
+ return _context.finish(12);
50005
+ case 13:
50006
+ _context.next = 14;
49994
50007
  return refresh();
49995
- case 12:
50008
+ case 14:
49996
50009
  deletedNames = new Set(bulkDraftsTarget.map(function (d) {
49997
50010
  return d.name;
49998
50011
  }));
49999
50012
  if (deletedNames.has(selectedWidgetName)) {
50000
50013
  setSelectedWidgetName(null);
50001
50014
  }
50002
- case 13:
50003
- _context.prev = 13;
50015
+ case 15:
50016
+ _context.prev = 15;
50004
50017
  setBulkDraftsTarget(null);
50005
- return _context.finish(13);
50006
- case 14:
50018
+ return _context.finish(15);
50019
+ case 16:
50007
50020
  case "end":
50008
50021
  return _context.stop();
50009
50022
  }
50010
- }, _callee, null, [[1,, 13, 14], [2, 9, 10, 11], [4, 6]]);
50023
+ }, _callee, null, [[1,, 15, 16], [2, 11, 12, 13], [4, 8]]);
50011
50024
  }));
50012
50025
  return _handleConfirmBulkDraftCleanup.apply(this, arguments);
50013
50026
  }