@overmap-ai/core 1.0.60-geo-images.0 → 1.0.60-geo-images.2
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/overmap-core.js
CHANGED
|
@@ -7231,9 +7231,9 @@ class GeoImageService extends BaseUploadService {
|
|
|
7231
7231
|
const { store } = this.client;
|
|
7232
7232
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7233
7233
|
const currentUser = store.getState().userReducer.currentUser;
|
|
7234
|
-
const
|
|
7235
|
-
const
|
|
7236
|
-
const
|
|
7234
|
+
const offlineGeoImages = [];
|
|
7235
|
+
const offlineIds = [];
|
|
7236
|
+
const geoImagePayloads = [];
|
|
7237
7237
|
const filePayloadRecord = {};
|
|
7238
7238
|
for (const payloadAndFile of payloadAndFiles) {
|
|
7239
7239
|
const { payload, file } = payloadAndFile;
|
|
@@ -7256,9 +7256,9 @@ class GeoImageService extends BaseUploadService {
|
|
|
7256
7256
|
created_by: currentUser.id,
|
|
7257
7257
|
project: projectId
|
|
7258
7258
|
});
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7259
|
+
offlineGeoImages.push(offlineMapImage);
|
|
7260
|
+
offlineIds.push(offlineMapImage.offline_id);
|
|
7261
|
+
geoImagePayloads.push({
|
|
7262
7262
|
offline_id: offlineMapImage.offline_id,
|
|
7263
7263
|
sha1: offlineMapImage.file_sha1,
|
|
7264
7264
|
file_name: offlineMapImage.file_name,
|
|
@@ -7270,7 +7270,7 @@ class GeoImageService extends BaseUploadService {
|
|
|
7270
7270
|
original_date: offlineMapImage.original_date
|
|
7271
7271
|
});
|
|
7272
7272
|
}
|
|
7273
|
-
store.dispatch(addGeoImages(
|
|
7273
|
+
store.dispatch(addGeoImages(offlineGeoImages));
|
|
7274
7274
|
const promise = this.enqueueRequest({
|
|
7275
7275
|
description: "Bulk add geo images",
|
|
7276
7276
|
method: HttpMethod.POST,
|
|
@@ -7278,28 +7278,28 @@ class GeoImageService extends BaseUploadService {
|
|
|
7278
7278
|
payload: {
|
|
7279
7279
|
submitted_at: submittedAt,
|
|
7280
7280
|
project: projectId,
|
|
7281
|
-
geo_images:
|
|
7281
|
+
geo_images: geoImagePayloads,
|
|
7282
7282
|
files: Object.values(filePayloadRecord)
|
|
7283
7283
|
},
|
|
7284
7284
|
blocks: [projectId.toString()],
|
|
7285
|
-
blockers:
|
|
7285
|
+
blockers: offlineIds
|
|
7286
7286
|
});
|
|
7287
7287
|
promise.then((result) => {
|
|
7288
7288
|
this.processPresignedUrls(result.presigned_urls);
|
|
7289
|
-
store.dispatch(setGeoImages(result.
|
|
7289
|
+
store.dispatch(setGeoImages(result.geo_images));
|
|
7290
7290
|
}).catch(() => {
|
|
7291
|
-
store.dispatch(deleteGeoImages(
|
|
7291
|
+
store.dispatch(deleteGeoImages(offlineIds));
|
|
7292
7292
|
});
|
|
7293
|
-
return [
|
|
7293
|
+
return [offlineGeoImages, promise.then((result) => result.geo_images)];
|
|
7294
7294
|
}
|
|
7295
7295
|
update(payload) {
|
|
7296
7296
|
const { store } = this.client;
|
|
7297
7297
|
const state = store.getState();
|
|
7298
|
-
const
|
|
7299
|
-
if (!
|
|
7298
|
+
const geoImageToUpdate = selectGeoImageById(payload.offline_id)(state);
|
|
7299
|
+
if (!geoImageToUpdate) {
|
|
7300
7300
|
throw new Error(`Map image with offline_id ${payload.offline_id} does not exist in the store`);
|
|
7301
7301
|
}
|
|
7302
|
-
const updatedGeoImage = { ...
|
|
7302
|
+
const updatedGeoImage = { ...geoImageToUpdate, ...payload };
|
|
7303
7303
|
store.dispatch(updateGeoImage(updatedGeoImage));
|
|
7304
7304
|
const promise = this.enqueueRequest({
|
|
7305
7305
|
description: "Update geo image",
|
|
@@ -7312,15 +7312,15 @@ class GeoImageService extends BaseUploadService {
|
|
|
7312
7312
|
promise.then((result) => {
|
|
7313
7313
|
store.dispatch(setGeoImage(result));
|
|
7314
7314
|
}).catch(() => {
|
|
7315
|
-
store.dispatch(setGeoImage(
|
|
7315
|
+
store.dispatch(setGeoImage(geoImageToUpdate));
|
|
7316
7316
|
});
|
|
7317
7317
|
return [updatedGeoImage, promise];
|
|
7318
7318
|
}
|
|
7319
7319
|
async delete(geoImageId) {
|
|
7320
7320
|
const { store } = this.client;
|
|
7321
7321
|
const state = store.getState();
|
|
7322
|
-
const
|
|
7323
|
-
if (!
|
|
7322
|
+
const geoImageToDelete = selectGeoImageById(geoImageId)(state);
|
|
7323
|
+
if (!geoImageToDelete) {
|
|
7324
7324
|
throw new Error(`Map image with offline_id ${geoImageId} does not exist in the store`);
|
|
7325
7325
|
}
|
|
7326
7326
|
store.dispatch(deleteGeoImage(geoImageId));
|
|
@@ -7332,7 +7332,7 @@ class GeoImageService extends BaseUploadService {
|
|
|
7332
7332
|
blockers: [geoImageId]
|
|
7333
7333
|
});
|
|
7334
7334
|
promise.catch(() => {
|
|
7335
|
-
store.dispatch(setGeoImage(
|
|
7335
|
+
store.dispatch(setGeoImage(geoImageToDelete));
|
|
7336
7336
|
});
|
|
7337
7337
|
return promise;
|
|
7338
7338
|
}
|