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