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