@overmap-ai/core 1.0.58-asset-description.7 → 1.0.58-asset-description.8

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.
@@ -1728,6 +1728,16 @@ var __publicField = (obj, key, value) => {
1728
1728
  }
1729
1729
  prevAssets = null;
1730
1730
  },
1731
+ updateAssets: (state, action) => {
1732
+ for (const asset of action.payload) {
1733
+ if (asset.offline_id in state.assets) {
1734
+ state.assets[asset.offline_id] = asset;
1735
+ } else {
1736
+ throw new Error(`Tried to update asset with ID that doesn't exist: ${asset.offline_id}`);
1737
+ }
1738
+ }
1739
+ prevAssets = null;
1740
+ },
1731
1741
  removeAsset: (state, action) => {
1732
1742
  if (action.payload in state.assets) {
1733
1743
  delete state.assets[action.payload];
@@ -1736,6 +1746,16 @@ var __publicField = (obj, key, value) => {
1736
1746
  }
1737
1747
  prevAssets = null;
1738
1748
  },
1749
+ removeAssets: (state, action) => {
1750
+ for (const assetId of action.payload) {
1751
+ if (assetId in state.assets) {
1752
+ delete state.assets[assetId];
1753
+ } else {
1754
+ throw new Error(`Failed to remove asset because ID doesn't exist: ${assetId}`);
1755
+ }
1756
+ }
1757
+ prevAssets = null;
1758
+ },
1739
1759
  removeAllAssetsOfType: (state, action) => {
1740
1760
  var _a2;
1741
1761
  for (const componentId in state.assets) {
@@ -1759,7 +1779,9 @@ var __publicField = (obj, key, value) => {
1759
1779
  const {
1760
1780
  addAsset,
1761
1781
  updateAsset,
1782
+ updateAssets,
1762
1783
  removeAsset,
1784
+ removeAssets,
1763
1785
  addAssetsInBatches,
1764
1786
  setAssets,
1765
1787
  removeAllAssetsOfType,
@@ -5484,13 +5506,9 @@ var __publicField = (obj, key, value) => {
5484
5506
  blocks: assetBatch.payload.assets.map((c) => c.offline_id).concat([batchId])
5485
5507
  });
5486
5508
  promise.then((result) => {
5487
- for (const assets of Object.values(result)) {
5488
- store.dispatch(updateAsset(assets));
5489
- }
5509
+ store.dispatch(updateAssets(Object.values(result)));
5490
5510
  }).catch(() => {
5491
- for (const asset of assetBatch.payload.assets) {
5492
- store.dispatch(removeAsset(asset.offline_id));
5493
- }
5511
+ store.dispatch(removeAssets(assetBatch.payload.assets.map((c) => c.offline_id)));
5494
5512
  });
5495
5513
  prevBatchId = assetBatch.batchId;
5496
5514
  return promise;
@@ -17077,6 +17095,7 @@ var __publicField = (obj, key, value) => {
17077
17095
  exports2.removeAssetAttachments = removeAssetAttachments;
17078
17096
  exports2.removeAssetTypeAttachment = removeAssetTypeAttachment;
17079
17097
  exports2.removeAssetTypeAttachments = removeAssetTypeAttachments;
17098
+ exports2.removeAssets = removeAssets;
17080
17099
  exports2.removeAttachmentsOfIssue = removeAttachmentsOfIssue;
17081
17100
  exports2.removeCategory = removeCategory;
17082
17101
  exports2.removeColor = removeColor;
@@ -17394,6 +17413,7 @@ var __publicField = (obj, key, value) => {
17394
17413
  exports2.updateAssetAttachments = updateAssetAttachments;
17395
17414
  exports2.updateAssetTypeAttachment = updateAssetTypeAttachment;
17396
17415
  exports2.updateAssetTypeAttachments = updateAssetTypeAttachments;
17416
+ exports2.updateAssets = updateAssets;
17397
17417
  exports2.updateConversation = updateConversation;
17398
17418
  exports2.updateDocumentAttachment = updateDocumentAttachment;
17399
17419
  exports2.updateDocumentAttachments = updateDocumentAttachments;