@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.
@@ -1738,6 +1738,16 @@ const assetSlice = createSlice({
1738
1738
  }
1739
1739
  prevAssets = null;
1740
1740
  },
1741
+ updateAssets: (state, action) => {
1742
+ for (const asset of action.payload) {
1743
+ if (asset.offline_id in state.assets) {
1744
+ state.assets[asset.offline_id] = asset;
1745
+ } else {
1746
+ throw new Error(`Tried to update asset with ID that doesn't exist: ${asset.offline_id}`);
1747
+ }
1748
+ }
1749
+ prevAssets = null;
1750
+ },
1741
1751
  removeAsset: (state, action) => {
1742
1752
  if (action.payload in state.assets) {
1743
1753
  delete state.assets[action.payload];
@@ -1746,6 +1756,16 @@ const assetSlice = createSlice({
1746
1756
  }
1747
1757
  prevAssets = null;
1748
1758
  },
1759
+ removeAssets: (state, action) => {
1760
+ for (const assetId of action.payload) {
1761
+ if (assetId in state.assets) {
1762
+ delete state.assets[assetId];
1763
+ } else {
1764
+ throw new Error(`Failed to remove asset because ID doesn't exist: ${assetId}`);
1765
+ }
1766
+ }
1767
+ prevAssets = null;
1768
+ },
1749
1769
  removeAllAssetsOfType: (state, action) => {
1750
1770
  var _a2;
1751
1771
  for (const componentId in state.assets) {
@@ -1769,7 +1789,9 @@ const assetSlice = createSlice({
1769
1789
  const {
1770
1790
  addAsset,
1771
1791
  updateAsset,
1792
+ updateAssets,
1772
1793
  removeAsset,
1794
+ removeAssets,
1773
1795
  addAssetsInBatches,
1774
1796
  setAssets,
1775
1797
  removeAllAssetsOfType,
@@ -5494,13 +5516,9 @@ class AssetService extends BaseApiService {
5494
5516
  blocks: assetBatch.payload.assets.map((c) => c.offline_id).concat([batchId])
5495
5517
  });
5496
5518
  promise.then((result) => {
5497
- for (const assets of Object.values(result)) {
5498
- store.dispatch(updateAsset(assets));
5499
- }
5519
+ store.dispatch(updateAssets(Object.values(result)));
5500
5520
  }).catch(() => {
5501
- for (const asset of assetBatch.payload.assets) {
5502
- store.dispatch(removeAsset(asset.offline_id));
5503
- }
5521
+ store.dispatch(removeAssets(assetBatch.payload.assets.map((c) => c.offline_id)));
5504
5522
  });
5505
5523
  prevBatchId = assetBatch.batchId;
5506
5524
  return promise;
@@ -17088,6 +17106,7 @@ export {
17088
17106
  removeAssetAttachments,
17089
17107
  removeAssetTypeAttachment,
17090
17108
  removeAssetTypeAttachments,
17109
+ removeAssets,
17091
17110
  removeAttachmentsOfIssue,
17092
17111
  removeCategory,
17093
17112
  removeColor,
@@ -17405,6 +17424,7 @@ export {
17405
17424
  updateAssetAttachments,
17406
17425
  updateAssetTypeAttachment,
17407
17426
  updateAssetTypeAttachments,
17427
+ updateAssets,
17408
17428
  updateConversation,
17409
17429
  updateDocumentAttachment,
17410
17430
  updateDocumentAttachments,