@overmap-ai/core 1.0.71-mapbox.3 → 1.0.71-mapbox.4
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 +12 -98
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +12 -98
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/services/AgentService.d.ts +2 -7
- package/dist/store/slices/projectAccessSlice.d.ts +0 -1
- package/dist/store/slices/projectFileSlice.d.ts +1 -1
- package/dist/store/slices/projectSlice.d.ts +3 -22
- package/package.json +1 -1
package/dist/overmap-core.js
CHANGED
|
@@ -1531,13 +1531,6 @@ const selectProjectAccesses = createSelector(
|
|
|
1531
1531
|
const selectProjectAccessById = (id) => (state) => {
|
|
1532
1532
|
return state.projectAccessReducer.instances[id];
|
|
1533
1533
|
};
|
|
1534
|
-
const selectActiveProjectAccess = (state) => {
|
|
1535
|
-
const currentUser = state.userReducer.currentUser;
|
|
1536
|
-
const activeProjectId = state.projectReducer.activeProjectId;
|
|
1537
|
-
return Object.values(state.projectAccessReducer.instances).find((projectAccess) => {
|
|
1538
|
-
return projectAccess.user === (currentUser == null ? void 0 : currentUser.id) && projectAccess.project === activeProjectId;
|
|
1539
|
-
}) ?? null;
|
|
1540
|
-
};
|
|
1541
1534
|
const selectProjectAccessForUser = (user) => (state) => {
|
|
1542
1535
|
return Object.values(state.projectAccessReducer.instances).find(
|
|
1543
1536
|
(projectAccess) => projectAccess.user === user.id
|
|
@@ -1552,8 +1545,7 @@ const selectProjectAccessUserMapping = (state) => {
|
|
|
1552
1545
|
};
|
|
1553
1546
|
const projectAccessReducer = projectAccessSlice.reducer;
|
|
1554
1547
|
const initialState$m = {
|
|
1555
|
-
projects: {}
|
|
1556
|
-
activeProjectId: null
|
|
1548
|
+
projects: {}
|
|
1557
1549
|
};
|
|
1558
1550
|
const projectSlice = createSlice({
|
|
1559
1551
|
name: "projects",
|
|
@@ -1567,19 +1559,9 @@ const projectSlice = createSlice({
|
|
|
1567
1559
|
});
|
|
1568
1560
|
state.projects = projectsMap;
|
|
1569
1561
|
},
|
|
1570
|
-
|
|
1571
|
-
state.activeProjectId = action.payload;
|
|
1572
|
-
},
|
|
1573
|
-
updateOrCreateProject: (state, action) => {
|
|
1562
|
+
updateProject: (state, action) => {
|
|
1574
1563
|
state.projects[action.payload.id] = action.payload;
|
|
1575
1564
|
},
|
|
1576
|
-
// Takes a list of Projects and updates existing ones to match the payload, or adds them
|
|
1577
|
-
// to the store if they are not already present
|
|
1578
|
-
updateOrCreateProjects: (state, action) => {
|
|
1579
|
-
action.payload.forEach((project) => {
|
|
1580
|
-
state.projects[project.id] = project;
|
|
1581
|
-
});
|
|
1582
|
-
},
|
|
1583
1565
|
deleteProject: (state, action) => {
|
|
1584
1566
|
delete state.projects[action.payload.id];
|
|
1585
1567
|
},
|
|
@@ -1589,52 +1571,12 @@ const projectSlice = createSlice({
|
|
|
1589
1571
|
} else {
|
|
1590
1572
|
throw new Error("Accept project invite: user is not in this project");
|
|
1591
1573
|
}
|
|
1592
|
-
},
|
|
1593
|
-
addActiveProjectIssuesCount: (state, action) => {
|
|
1594
|
-
if (!state.activeProjectId || !(state.activeProjectId in state.projects)) {
|
|
1595
|
-
throw new Error("Update issues count: no active project");
|
|
1596
|
-
}
|
|
1597
|
-
if (!state.projects[state.activeProjectId].issues_count) {
|
|
1598
|
-
state.projects[state.activeProjectId].issues_count = action.payload;
|
|
1599
|
-
} else {
|
|
1600
|
-
state.projects[state.activeProjectId].issues_count += action.payload;
|
|
1601
|
-
}
|
|
1602
|
-
},
|
|
1603
|
-
addActiveProjectFormSubmissionsCount: (state, action) => {
|
|
1604
|
-
if (state.activeProjectId && state.activeProjectId in state.projects) {
|
|
1605
|
-
if (!state.projects[state.activeProjectId].form_submissions_count) {
|
|
1606
|
-
state.projects[state.activeProjectId].form_submissions_count = action.payload;
|
|
1607
|
-
} else {
|
|
1608
|
-
state.projects[state.activeProjectId].form_submissions_count += action.payload;
|
|
1609
|
-
}
|
|
1610
|
-
} else {
|
|
1611
|
-
throw new Error("Update form submissions count: no active project");
|
|
1612
|
-
}
|
|
1613
1574
|
}
|
|
1614
1575
|
}
|
|
1615
1576
|
});
|
|
1616
|
-
const {
|
|
1617
|
-
setProjects,
|
|
1618
|
-
updateOrCreateProject,
|
|
1619
|
-
updateOrCreateProjects: addOrReplaceProjects,
|
|
1620
|
-
setActiveProjectId,
|
|
1621
|
-
deleteProject,
|
|
1622
|
-
acceptProjectInvite,
|
|
1623
|
-
addActiveProjectIssuesCount,
|
|
1624
|
-
addActiveProjectFormSubmissionsCount
|
|
1625
|
-
} = projectSlice.actions;
|
|
1577
|
+
const { setProjects, updateProject, deleteProject, acceptProjectInvite } = projectSlice.actions;
|
|
1626
1578
|
const projectReducer = projectSlice.reducer;
|
|
1627
1579
|
const selectProjectMapping = (state) => state.projectReducer.projects;
|
|
1628
|
-
const selectActiveProjectId = (state) => state.projectReducer.activeProjectId;
|
|
1629
|
-
const selectActiveProject = createSelector(
|
|
1630
|
-
[selectProjectMapping, selectActiveProjectId],
|
|
1631
|
-
(projectsMapping, activeprojectId) => {
|
|
1632
|
-
if (activeprojectId === null) {
|
|
1633
|
-
return null;
|
|
1634
|
-
}
|
|
1635
|
-
return projectsMapping[activeprojectId] ?? null;
|
|
1636
|
-
}
|
|
1637
|
-
);
|
|
1638
1580
|
const selectProjectById = (id) => (state) => {
|
|
1639
1581
|
return state.projectReducer.projects[id];
|
|
1640
1582
|
};
|
|
@@ -1889,14 +1831,9 @@ const {
|
|
|
1889
1831
|
resetProjectFileObjectUrls
|
|
1890
1832
|
} = projectFileSlice.actions;
|
|
1891
1833
|
const selectProjectFileMapping = (state) => state.projectFileReducer.projectFiles;
|
|
1892
|
-
const selectProjectFiles = createSelector(
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
return fallbackToEmptyArray(
|
|
1896
|
-
Object.values(mapping).filter((file) => file.project === activeProjectId).sort((a, b) => a.z_index - b.z_index)
|
|
1897
|
-
);
|
|
1898
|
-
}
|
|
1899
|
-
);
|
|
1834
|
+
const selectProjectFiles = createSelector([selectProjectFileMapping], (mapping) => {
|
|
1835
|
+
return fallbackToEmptyArray(Object.values(mapping).sort((a, b) => a.z_index - b.z_index));
|
|
1836
|
+
});
|
|
1900
1837
|
const selectProjectFileById = (id) => (state) => {
|
|
1901
1838
|
return state.projectFileReducer.projectFiles[id];
|
|
1902
1839
|
};
|
|
@@ -4768,7 +4705,6 @@ class IssueService extends BaseApiService {
|
|
|
4768
4705
|
created_by: createdBy
|
|
4769
4706
|
});
|
|
4770
4707
|
this.dispatch(addIssue(offlineIssue));
|
|
4771
|
-
this.dispatch(addActiveProjectIssuesCount(1));
|
|
4772
4708
|
const promise = this.enqueueRequest({
|
|
4773
4709
|
description: "Create issue",
|
|
4774
4710
|
method: HttpMethod.POST,
|
|
@@ -4785,7 +4721,6 @@ class IssueService extends BaseApiService {
|
|
|
4785
4721
|
this.dispatch(updateIssue(result));
|
|
4786
4722
|
}).catch((error) => {
|
|
4787
4723
|
this.dispatch(deleteIssue(offlineIssue.offline_id));
|
|
4788
|
-
this.dispatch(addActiveProjectIssuesCount(-1));
|
|
4789
4724
|
throw error;
|
|
4790
4725
|
});
|
|
4791
4726
|
return [offlineIssue, promise];
|
|
@@ -4901,7 +4836,6 @@ class IssueService extends BaseApiService {
|
|
|
4901
4836
|
issueAssociationsRecord[issueAssociation.offline_id] = issueAssociation;
|
|
4902
4837
|
const issueAssociations = Object.values(issueAssociationsRecord);
|
|
4903
4838
|
this.dispatch(deleteIssue(id));
|
|
4904
|
-
this.dispatch(addActiveProjectIssuesCount(-1));
|
|
4905
4839
|
if (attachmentsOfIssue.length > 0)
|
|
4906
4840
|
this.dispatch(deleteIssueAttachments(attachmentsOfIssue.map(({ offline_id }) => offline_id)));
|
|
4907
4841
|
if (updatesOfIssue.length > 0)
|
|
@@ -4922,7 +4856,6 @@ class IssueService extends BaseApiService {
|
|
|
4922
4856
|
this.dispatch(addIssue(backup));
|
|
4923
4857
|
this.dispatch(addIssueAttachments(attachmentsOfIssue));
|
|
4924
4858
|
this.dispatch(addIssueUpdates(updatesOfIssue));
|
|
4925
|
-
this.dispatch(addActiveProjectIssuesCount(1));
|
|
4926
4859
|
this.dispatch(addFormSubmissions(formSubmissionsOfIssue));
|
|
4927
4860
|
this.dispatch(addIssueAssociations(issueAssociations));
|
|
4928
4861
|
throw e;
|
|
@@ -5213,7 +5146,7 @@ class ProjectService extends BaseApiService {
|
|
|
5213
5146
|
if (!project.bounds && !project.canvas_bounds) {
|
|
5214
5147
|
throw new Error("Project must either have bounds or canvas_bounds set");
|
|
5215
5148
|
}
|
|
5216
|
-
this.dispatch(
|
|
5149
|
+
this.dispatch(updateProject(project));
|
|
5217
5150
|
return await this.enqueueRequest({
|
|
5218
5151
|
description: "Update project",
|
|
5219
5152
|
method: HttpMethod.PATCH,
|
|
@@ -5753,12 +5686,10 @@ class FormSubmissionService extends BaseUploadService {
|
|
|
5753
5686
|
files
|
|
5754
5687
|
);
|
|
5755
5688
|
promise.then((result) => {
|
|
5756
|
-
this.dispatch(addActiveProjectFormSubmissionsCount(1));
|
|
5757
5689
|
this.dispatch(setFormSubmission(result));
|
|
5758
5690
|
return result;
|
|
5759
5691
|
}).catch(() => {
|
|
5760
5692
|
this.dispatch(deleteFormSubmission(offlineSubmission.offline_id));
|
|
5761
|
-
this.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
5762
5693
|
});
|
|
5763
5694
|
return [offlineSubmission, offlineFormSubmissionAttachments, promise, attachmentsPromise];
|
|
5764
5695
|
}
|
|
@@ -5925,7 +5856,6 @@ class FormSubmissionService extends BaseUploadService {
|
|
|
5925
5856
|
}
|
|
5926
5857
|
const submissionAttachments = selectAttachmentsOfFormSubmission(id)(state);
|
|
5927
5858
|
this.dispatch(deleteFormSubmission(id));
|
|
5928
|
-
this.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
5929
5859
|
this.dispatch(deleteFormSubmissionAttachments(submissionAttachments.map((x) => x.offline_id)));
|
|
5930
5860
|
try {
|
|
5931
5861
|
return await this.enqueueRequest({
|
|
@@ -5936,7 +5866,6 @@ class FormSubmissionService extends BaseUploadService {
|
|
|
5936
5866
|
blocks: []
|
|
5937
5867
|
});
|
|
5938
5868
|
} catch (e) {
|
|
5939
|
-
this.dispatch(addActiveProjectFormSubmissionsCount(1));
|
|
5940
5869
|
this.dispatch(addFormSubmission(submissionToBeDeleted));
|
|
5941
5870
|
this.dispatch(addFormSubmissionAttachments(submissionAttachments));
|
|
5942
5871
|
throw e;
|
|
@@ -6813,15 +6742,14 @@ class DocumentAttachmentService extends BaseAttachmentService {
|
|
|
6813
6742
|
}
|
|
6814
6743
|
}
|
|
6815
6744
|
class AgentService extends BaseApiService {
|
|
6816
|
-
async startConversation(prompt) {
|
|
6817
|
-
const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
|
|
6745
|
+
async startConversation(prompt, projectId) {
|
|
6818
6746
|
return this.enqueueRequest({
|
|
6819
6747
|
description: "Start agent conversation",
|
|
6820
6748
|
method: HttpMethod.POST,
|
|
6821
6749
|
url: "/agents/prompt/",
|
|
6822
6750
|
payload: {
|
|
6823
6751
|
prompt,
|
|
6824
|
-
active_project:
|
|
6752
|
+
active_project: projectId
|
|
6825
6753
|
},
|
|
6826
6754
|
blockers: ["prompt"],
|
|
6827
6755
|
blocks: ["prompt"]
|
|
@@ -6830,21 +6758,14 @@ class AgentService extends BaseApiService {
|
|
|
6830
6758
|
return response;
|
|
6831
6759
|
});
|
|
6832
6760
|
}
|
|
6833
|
-
|
|
6834
|
-
* Prompt the agent with a message.
|
|
6835
|
-
* @param prompt The message to prompt the agent with.
|
|
6836
|
-
* @param conversationId If continuing an existing message, the UUID of that conversation.
|
|
6837
|
-
*/
|
|
6838
|
-
async continueConversation(prompt, conversationId) {
|
|
6839
|
-
const { store } = this.client;
|
|
6840
|
-
const activeProjectId = store.getState().projectReducer.activeProjectId;
|
|
6761
|
+
async continueConversation(prompt, conversationId, projectId) {
|
|
6841
6762
|
return this.enqueueRequest({
|
|
6842
6763
|
description: "Prompt agent",
|
|
6843
6764
|
method: HttpMethod.POST,
|
|
6844
6765
|
url: "/agents/prompt/",
|
|
6845
6766
|
payload: {
|
|
6846
6767
|
prompt,
|
|
6847
|
-
active_project:
|
|
6768
|
+
active_project: projectId
|
|
6848
6769
|
},
|
|
6849
6770
|
blockers: ["prompt"],
|
|
6850
6771
|
blocks: ["prompt"],
|
|
@@ -7348,8 +7269,6 @@ export {
|
|
|
7348
7269
|
_selectLatestFormRevision,
|
|
7349
7270
|
_setLatestRetryTime,
|
|
7350
7271
|
acceptProjectInvite,
|
|
7351
|
-
addActiveProjectFormSubmissionsCount,
|
|
7352
|
-
addActiveProjectIssuesCount,
|
|
7353
7272
|
addAsset,
|
|
7354
7273
|
addAssetAttachment,
|
|
7355
7274
|
addAssetAttachments,
|
|
@@ -7394,7 +7313,6 @@ export {
|
|
|
7394
7313
|
addLicenses,
|
|
7395
7314
|
addOrReplaceProjectFile,
|
|
7396
7315
|
addOrReplaceProjectFiles,
|
|
7397
|
-
addOrReplaceProjects,
|
|
7398
7316
|
addProjectAttachment,
|
|
7399
7317
|
addProjectAttachments,
|
|
7400
7318
|
addTeam,
|
|
@@ -7594,10 +7512,7 @@ export {
|
|
|
7594
7512
|
saveActiveProjectFileBounds,
|
|
7595
7513
|
selectAccessToken,
|
|
7596
7514
|
selectActiveOrganizationAccess,
|
|
7597
|
-
selectActiveProject,
|
|
7598
|
-
selectActiveProjectAccess,
|
|
7599
7515
|
selectActiveProjectFileId,
|
|
7600
|
-
selectActiveProjectId,
|
|
7601
7516
|
selectActiveStatusLicenses,
|
|
7602
7517
|
selectAllDocumentAttachments,
|
|
7603
7518
|
selectAllProjectAttachments,
|
|
@@ -7770,7 +7685,6 @@ export {
|
|
|
7770
7685
|
selectWorkspaceMapping,
|
|
7771
7686
|
selectWorkspaces,
|
|
7772
7687
|
setActiveProjectFileId,
|
|
7773
|
-
setActiveProjectId,
|
|
7774
7688
|
setAsset,
|
|
7775
7689
|
setAssetAttachment,
|
|
7776
7690
|
setAssetAttachments,
|
|
@@ -7859,8 +7773,8 @@ export {
|
|
|
7859
7773
|
updateIssueAttachments,
|
|
7860
7774
|
updateIssueType,
|
|
7861
7775
|
updateLicense,
|
|
7862
|
-
updateOrCreateProject,
|
|
7863
7776
|
updateOrganizationAccess,
|
|
7777
|
+
updateProject,
|
|
7864
7778
|
updateProjectAccess,
|
|
7865
7779
|
updateProjectAttachment,
|
|
7866
7780
|
updateProjectAttachments,
|