@overmap-ai/core 1.0.71-mapbox.4 → 1.0.71-mapbox.5
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
|
@@ -1751,39 +1751,26 @@ const selectDeletedRequests = (state) => state.outboxReducer.deletedRequests;
|
|
|
1751
1751
|
const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
|
|
1752
1752
|
const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
|
|
1753
1753
|
const outboxReducer = outboxSlice.reducer;
|
|
1754
|
-
const
|
|
1755
|
-
|
|
1754
|
+
const projectFileModelAdapter = createModelAdapter((projectFile) => projectFile.offline_id);
|
|
1755
|
+
const initialState$j = projectFileModelAdapter.getInitialState({
|
|
1756
1756
|
activeProjectFileId: null,
|
|
1757
1757
|
isImportingProjectFile: false
|
|
1758
|
-
};
|
|
1758
|
+
});
|
|
1759
1759
|
const projectFileSlice = createSlice({
|
|
1760
1760
|
name: "projectFiles",
|
|
1761
1761
|
initialState: initialState$j,
|
|
1762
1762
|
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
|
|
1763
1763
|
reducers: {
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
file = parts.slice(0, -1).join("/") + "/" + lastPart;
|
|
1775
|
-
console.warn("Fixed URL:", file);
|
|
1776
|
-
fileObj = { ...fileObj, file };
|
|
1777
|
-
}
|
|
1778
|
-
state.projectFiles[fileObj.offline_id] = fileObj;
|
|
1779
|
-
}
|
|
1780
|
-
},
|
|
1781
|
-
addOrReplaceProjectFile: (state, action) => {
|
|
1782
|
-
if (!action.payload.project) {
|
|
1783
|
-
throw new Error("ProjectFile has no project. A project must be set before storing.");
|
|
1784
|
-
}
|
|
1785
|
-
state.projectFiles[action.payload.offline_id] = action.payload;
|
|
1786
|
-
},
|
|
1764
|
+
initializeProjectFiles: projectFileModelAdapter.initialize,
|
|
1765
|
+
setProjectFile: projectFileModelAdapter.setOne,
|
|
1766
|
+
setProjectFiles: projectFileModelAdapter.setMany,
|
|
1767
|
+
addProjectFile: projectFileModelAdapter.addOne,
|
|
1768
|
+
addProjectFiles: projectFileModelAdapter.addMany,
|
|
1769
|
+
updateProjectFile: projectFileModelAdapter.updateOne,
|
|
1770
|
+
updateProjectFiles: projectFileModelAdapter.updateMany,
|
|
1771
|
+
deleteProjectFile: projectFileModelAdapter.deleteOne,
|
|
1772
|
+
deleteProjectFiles: projectFileModelAdapter.deleteMany,
|
|
1773
|
+
// TODO: move following to /web
|
|
1787
1774
|
setIsImportingProjectFile: (state, action) => {
|
|
1788
1775
|
state.isImportingProjectFile = action.payload;
|
|
1789
1776
|
},
|
|
@@ -1792,50 +1779,46 @@ const projectFileSlice = createSlice({
|
|
|
1792
1779
|
if (!activeProjectFileId) {
|
|
1793
1780
|
throw new Error("Tried to save bounds for active project file, but no active project file was set.");
|
|
1794
1781
|
}
|
|
1795
|
-
if (!state.
|
|
1782
|
+
if (!state.instances[activeProjectFileId]) {
|
|
1796
1783
|
throw new Error(
|
|
1797
1784
|
`Tried to save bounds for active project file, but project file with ID ${activeProjectFileId}
|
|
1798
1785
|
doesn't exist.`
|
|
1799
1786
|
);
|
|
1800
1787
|
}
|
|
1801
|
-
state.
|
|
1788
|
+
state.instances[activeProjectFileId].bounds = action.payload;
|
|
1802
1789
|
},
|
|
1803
|
-
// TODO: Move to MapContext. Should not be persisted.
|
|
1804
1790
|
setActiveProjectFileId: (state, action) => {
|
|
1805
1791
|
state.activeProjectFileId = action.payload;
|
|
1806
1792
|
},
|
|
1807
|
-
removeProjectFile: (state, action) => {
|
|
1808
|
-
delete state.projectFiles[action.payload];
|
|
1809
|
-
},
|
|
1810
|
-
removeProjectFilesOfProject: (state, action) => {
|
|
1811
|
-
const filesToDelete = Object.values(state.projectFiles).filter((file) => file.project === action.payload);
|
|
1812
|
-
for (const file of filesToDelete) {
|
|
1813
|
-
delete state.projectFiles[file.offline_id];
|
|
1814
|
-
}
|
|
1815
|
-
},
|
|
1816
1793
|
resetProjectFileObjectUrls: (state, ..._args) => {
|
|
1817
|
-
for (const key in state.
|
|
1818
|
-
delete state.
|
|
1794
|
+
for (const key in state.instances) {
|
|
1795
|
+
delete state.instances[key].objectURL;
|
|
1819
1796
|
}
|
|
1820
1797
|
}
|
|
1821
1798
|
}
|
|
1822
1799
|
});
|
|
1823
1800
|
const {
|
|
1824
|
-
|
|
1825
|
-
|
|
1801
|
+
initializeProjectFiles,
|
|
1802
|
+
setProjectFile,
|
|
1803
|
+
setProjectFiles,
|
|
1804
|
+
addProjectFile,
|
|
1805
|
+
addProjectFiles,
|
|
1806
|
+
updateProjectFile,
|
|
1807
|
+
updateProjectFiles,
|
|
1808
|
+
deleteProjectFile,
|
|
1809
|
+
deleteProjectFiles,
|
|
1810
|
+
// TODO: move following to /web
|
|
1826
1811
|
setIsImportingProjectFile,
|
|
1827
1812
|
setActiveProjectFileId,
|
|
1828
1813
|
saveActiveProjectFileBounds,
|
|
1829
|
-
removeProjectFile,
|
|
1830
|
-
removeProjectFilesOfProject,
|
|
1831
1814
|
resetProjectFileObjectUrls
|
|
1832
1815
|
} = projectFileSlice.actions;
|
|
1833
|
-
const selectProjectFileMapping = (state) => state.projectFileReducer.
|
|
1816
|
+
const selectProjectFileMapping = (state) => state.projectFileReducer.instances;
|
|
1834
1817
|
const selectProjectFiles = createSelector([selectProjectFileMapping], (mapping) => {
|
|
1835
1818
|
return fallbackToEmptyArray(Object.values(mapping).sort((a, b) => a.z_index - b.z_index));
|
|
1836
1819
|
});
|
|
1837
1820
|
const selectProjectFileById = (id) => (state) => {
|
|
1838
|
-
return state.projectFileReducer.
|
|
1821
|
+
return state.projectFileReducer.instances[id];
|
|
1839
1822
|
};
|
|
1840
1823
|
const selectActiveProjectFileId = (state) => state.projectFileReducer.activeProjectFileId;
|
|
1841
1824
|
const selectIsImportingProjectFile = (state) => state.projectFileReducer.isImportingProjectFile;
|
|
@@ -5014,7 +4997,7 @@ class ProjectFileService extends BaseApiService {
|
|
|
5014
4997
|
blocks: [file.offline_id]
|
|
5015
4998
|
});
|
|
5016
4999
|
void promise.then((result) => {
|
|
5017
|
-
this.dispatch(
|
|
5000
|
+
this.dispatch(updateProjectFile(result));
|
|
5018
5001
|
});
|
|
5019
5002
|
return promise;
|
|
5020
5003
|
}
|
|
@@ -5026,7 +5009,7 @@ class ProjectFileService extends BaseApiService {
|
|
|
5026
5009
|
if (!activeProjectFileId) {
|
|
5027
5010
|
throw new Error("No active project file");
|
|
5028
5011
|
}
|
|
5029
|
-
const activeProjectFile = state.projectFileReducer.
|
|
5012
|
+
const activeProjectFile = state.projectFileReducer.instances[activeProjectFileId];
|
|
5030
5013
|
if (!activeProjectFile) {
|
|
5031
5014
|
throw new Error("No active project file");
|
|
5032
5015
|
}
|
|
@@ -5065,7 +5048,7 @@ class ProjectFileService extends BaseApiService {
|
|
|
5065
5048
|
return this.enqueueRequest(requestDetails2);
|
|
5066
5049
|
});
|
|
5067
5050
|
void promise.then((result) => {
|
|
5068
|
-
this.dispatch(
|
|
5051
|
+
this.dispatch(updateProjectFile(result));
|
|
5069
5052
|
});
|
|
5070
5053
|
this.dispatch(saveActiveProjectFileBounds);
|
|
5071
5054
|
this.dispatch(setActiveProjectFileId(null));
|
|
@@ -5073,7 +5056,7 @@ class ProjectFileService extends BaseApiService {
|
|
|
5073
5056
|
return [activeProjectFile, promise];
|
|
5074
5057
|
}
|
|
5075
5058
|
delete(projectFileId) {
|
|
5076
|
-
this.dispatch(
|
|
5059
|
+
this.dispatch(deleteProjectFile(projectFileId));
|
|
5077
5060
|
return this.enqueueRequest({
|
|
5078
5061
|
method: HttpMethod.DELETE,
|
|
5079
5062
|
url: `/projects/files/${projectFileId}`,
|
|
@@ -5089,8 +5072,7 @@ class ProjectFileService extends BaseApiService {
|
|
|
5089
5072
|
blockers: [],
|
|
5090
5073
|
blocks: []
|
|
5091
5074
|
});
|
|
5092
|
-
this.dispatch(
|
|
5093
|
-
this.dispatch(addOrReplaceProjectFiles(result));
|
|
5075
|
+
this.dispatch(initializeProjectFiles(result));
|
|
5094
5076
|
}
|
|
5095
5077
|
}
|
|
5096
5078
|
class ProjectAttachmentService extends BaseAttachmentService {
|
|
@@ -5168,7 +5150,7 @@ class ProjectService extends BaseApiService {
|
|
|
5168
5150
|
throw new Error("Expected project to exist");
|
|
5169
5151
|
}
|
|
5170
5152
|
const filesToDelete = selectProjectFiles(state).filter((file) => file.project === projectId);
|
|
5171
|
-
this.dispatch(
|
|
5153
|
+
this.dispatch(deleteProjectFiles(filesToDelete.map(({ offline_id }) => offline_id)));
|
|
5172
5154
|
const attachmentsOfProject = selectAttachmentsOfProject(project.id)(state);
|
|
5173
5155
|
this.dispatch(deleteProjectAttachments(attachmentsOfProject.map(({ offline_id }) => offline_id)));
|
|
5174
5156
|
const projectAccesses = selectProjectAccesses(state);
|
|
@@ -5191,7 +5173,7 @@ class ProjectService extends BaseApiService {
|
|
|
5191
5173
|
} catch (e) {
|
|
5192
5174
|
this.dispatch(setProjects(Object.values(projects)));
|
|
5193
5175
|
this.dispatch(initializeProjectAccesses(Object.values(projectAccesses)));
|
|
5194
|
-
this.dispatch(
|
|
5176
|
+
this.dispatch(addProjectFiles(filesToDelete));
|
|
5195
5177
|
this.dispatch(setProjectAttachments(attachmentsOfProject));
|
|
5196
5178
|
this.dispatch({ type: "rehydrated/setRehydrated", payload: true });
|
|
5197
5179
|
if (license) {
|
|
@@ -7311,10 +7293,10 @@ export {
|
|
|
7311
7293
|
addIssueUpdates,
|
|
7312
7294
|
addIssues,
|
|
7313
7295
|
addLicenses,
|
|
7314
|
-
addOrReplaceProjectFile,
|
|
7315
|
-
addOrReplaceProjectFiles,
|
|
7316
7296
|
addProjectAttachment,
|
|
7317
7297
|
addProjectAttachments,
|
|
7298
|
+
addProjectFile,
|
|
7299
|
+
addProjectFiles,
|
|
7318
7300
|
addTeam,
|
|
7319
7301
|
addUsers,
|
|
7320
7302
|
addWorkspace,
|
|
@@ -7388,6 +7370,8 @@ export {
|
|
|
7388
7370
|
deleteProjectAccesses,
|
|
7389
7371
|
deleteProjectAttachment,
|
|
7390
7372
|
deleteProjectAttachments,
|
|
7373
|
+
deleteProjectFile,
|
|
7374
|
+
deleteProjectFiles,
|
|
7391
7375
|
deleteTeam,
|
|
7392
7376
|
deleteWorkspace,
|
|
7393
7377
|
dequeue,
|
|
@@ -7455,6 +7439,7 @@ export {
|
|
|
7455
7439
|
initializeOrganizationAccesses,
|
|
7456
7440
|
initializeProjectAccesses,
|
|
7457
7441
|
initializeProjectAttachments,
|
|
7442
|
+
initializeProjectFiles,
|
|
7458
7443
|
initializeTeams,
|
|
7459
7444
|
initializeWorkspaces,
|
|
7460
7445
|
isToday,
|
|
@@ -7503,8 +7488,6 @@ export {
|
|
|
7503
7488
|
rehydratedSlice,
|
|
7504
7489
|
removeDocuments,
|
|
7505
7490
|
removeIssueType,
|
|
7506
|
-
removeProjectFile,
|
|
7507
|
-
removeProjectFilesOfProject,
|
|
7508
7491
|
removeUser,
|
|
7509
7492
|
resetProjectFileObjectUrls,
|
|
7510
7493
|
resetStore,
|
|
@@ -7724,6 +7707,8 @@ export {
|
|
|
7724
7707
|
setProfilePicture,
|
|
7725
7708
|
setProjectAttachment,
|
|
7726
7709
|
setProjectAttachments,
|
|
7710
|
+
setProjectFile,
|
|
7711
|
+
setProjectFiles,
|
|
7727
7712
|
setProjects,
|
|
7728
7713
|
setRehydrated,
|
|
7729
7714
|
setTeam,
|
|
@@ -7778,6 +7763,8 @@ export {
|
|
|
7778
7763
|
updateProjectAccess,
|
|
7779
7764
|
updateProjectAttachment,
|
|
7780
7765
|
updateProjectAttachments,
|
|
7766
|
+
updateProjectFile,
|
|
7767
|
+
updateProjectFiles,
|
|
7781
7768
|
updateTeam,
|
|
7782
7769
|
updateWorkspace,
|
|
7783
7770
|
userReducer,
|