@overmap-ai/core 1.0.71-fields.13 → 1.0.71-fields.14

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.
@@ -1587,13 +1587,6 @@ const selectProjectAccesses = createSelector(
1587
1587
  const selectProjectAccessById = (id) => (state) => {
1588
1588
  return state.projectAccessReducer.instances[id];
1589
1589
  };
1590
- const selectActiveProjectAccess = (state) => {
1591
- const currentUser = state.userReducer.currentUser;
1592
- const activeProjectId = state.projectReducer.activeProjectId;
1593
- return Object.values(state.projectAccessReducer.instances).find((projectAccess) => {
1594
- return projectAccess.user === (currentUser == null ? void 0 : currentUser.id) && projectAccess.project === activeProjectId;
1595
- }) ?? null;
1596
- };
1597
1590
  const selectProjectAccessForUser = (user) => (state) => {
1598
1591
  return Object.values(state.projectAccessReducer.instances).find(
1599
1592
  (projectAccess) => projectAccess.user === user.id
@@ -1608,8 +1601,7 @@ const selectProjectAccessUserMapping = (state) => {
1608
1601
  };
1609
1602
  const projectAccessReducer = projectAccessSlice.reducer;
1610
1603
  const initialState$u = {
1611
- projects: {},
1612
- activeProjectId: null
1604
+ projects: {}
1613
1605
  };
1614
1606
  const projectSlice = createSlice({
1615
1607
  name: "projects",
@@ -1623,19 +1615,9 @@ const projectSlice = createSlice({
1623
1615
  });
1624
1616
  state.projects = projectsMap;
1625
1617
  },
1626
- setActiveProjectId: (state, action) => {
1627
- state.activeProjectId = action.payload;
1628
- },
1629
- updateOrCreateProject: (state, action) => {
1618
+ updateProject: (state, action) => {
1630
1619
  state.projects[action.payload.id] = action.payload;
1631
1620
  },
1632
- // Takes a list of Projects and updates existing ones to match the payload, or adds them
1633
- // to the store if they are not already present
1634
- updateOrCreateProjects: (state, action) => {
1635
- action.payload.forEach((project) => {
1636
- state.projects[project.id] = project;
1637
- });
1638
- },
1639
1621
  deleteProject: (state, action) => {
1640
1622
  delete state.projects[action.payload.id];
1641
1623
  },
@@ -1645,50 +1627,12 @@ const projectSlice = createSlice({
1645
1627
  } else {
1646
1628
  throw new Error("Accept project invite: user is not in this project");
1647
1629
  }
1648
- },
1649
- addActiveProjectIssuesCount: (state, action) => {
1650
- if (!state.activeProjectId || !(state.activeProjectId in state.projects)) {
1651
- throw new Error("Update issues count: no active project");
1652
- }
1653
- if (!state.projects[state.activeProjectId].issues_count) {
1654
- state.projects[state.activeProjectId].issues_count = action.payload;
1655
- } else {
1656
- state.projects[state.activeProjectId].issues_count += action.payload;
1657
- }
1658
- },
1659
- addActiveProjectFormSubmissionsCount: (state, action) => {
1660
- if (state.activeProjectId && state.activeProjectId in state.projects) {
1661
- if (!state.projects[state.activeProjectId].form_submissions_count) {
1662
- state.projects[state.activeProjectId].form_submissions_count = action.payload;
1663
- } else {
1664
- state.projects[state.activeProjectId].form_submissions_count += action.payload;
1665
- }
1666
- } else {
1667
- throw new Error("Update form submissions count: no active project");
1668
- }
1669
1630
  }
1670
1631
  }
1671
1632
  });
1672
- const {
1673
- setProjects,
1674
- updateOrCreateProject,
1675
- updateOrCreateProjects: addOrReplaceProjects,
1676
- setActiveProjectId,
1677
- deleteProject,
1678
- acceptProjectInvite,
1679
- addActiveProjectIssuesCount,
1680
- addActiveProjectFormSubmissionsCount
1681
- } = projectSlice.actions;
1633
+ const { setProjects, updateProject, deleteProject, acceptProjectInvite } = projectSlice.actions;
1682
1634
  const projectReducer = projectSlice.reducer;
1683
1635
  const selectProjectMapping = (state) => state.projectReducer.projects;
1684
- const selectActiveProjectId = (state) => state.projectReducer.activeProjectId;
1685
- const selectActiveProject = (state) => {
1686
- const activeProjectId = selectActiveProjectId(state);
1687
- if (!activeProjectId) {
1688
- return null;
1689
- }
1690
- return state.projectReducer.projects[activeProjectId] ?? null;
1691
- };
1692
1636
  const selectProjectById = (id) => (state) => {
1693
1637
  return state.projectReducer.projects[id];
1694
1638
  };
@@ -1937,14 +1881,9 @@ const {
1937
1881
  resetProjectFileObjectUrls
1938
1882
  } = projectFileSlice.actions;
1939
1883
  const selectProjectFileMapping = (state) => state.projectFileReducer.projectFiles;
1940
- const selectProjectFiles = createSelector(
1941
- [selectProjectFileMapping, selectActiveProjectId],
1942
- (mapping, activeProjectId) => {
1943
- return fallbackToEmptyArray(
1944
- Object.values(mapping).filter((file) => file.project === activeProjectId).sort((a, b) => a.z_index - b.z_index)
1945
- );
1946
- }
1947
- );
1884
+ const selectProjectFiles = createSelector([selectProjectFileMapping], (mapping) => {
1885
+ return fallbackToEmptyArray(Object.values(mapping).sort((a, b) => a.z_index - b.z_index));
1886
+ });
1948
1887
  const selectActiveProjectFileId = (state) => state.projectFileReducer.activeProjectFileId;
1949
1888
  const selectIsImportingProjectFile = (state) => state.projectFileReducer.isImportingProjectFile;
1950
1889
  const selectProjectFileById = (id) => (state) => {
@@ -5115,7 +5054,6 @@ class IssueService extends BaseApiService {
5115
5054
  created_by: createdBy
5116
5055
  });
5117
5056
  this.dispatch(addIssue(offlineIssue));
5118
- this.dispatch(addActiveProjectIssuesCount(1));
5119
5057
  const promise = this.enqueueRequest({
5120
5058
  description: "Create issue",
5121
5059
  method: HttpMethod.POST,
@@ -5128,7 +5066,6 @@ class IssueService extends BaseApiService {
5128
5066
  this.dispatch(updateIssue(result));
5129
5067
  }).catch((error) => {
5130
5068
  this.dispatch(deleteIssue(offlineIssue.offline_id));
5131
- this.dispatch(addActiveProjectIssuesCount(-1));
5132
5069
  throw error;
5133
5070
  });
5134
5071
  return [offlineIssue, promise];
@@ -5244,7 +5181,6 @@ class IssueService extends BaseApiService {
5244
5181
  issueAssociationsRecord[issueAssociation.offline_id] = issueAssociation;
5245
5182
  const issueAssociations = Object.values(issueAssociationsRecord);
5246
5183
  this.dispatch(deleteIssue(id));
5247
- this.dispatch(addActiveProjectIssuesCount(-1));
5248
5184
  if (attachmentsOfIssue.length > 0)
5249
5185
  this.dispatch(deleteIssueAttachments(attachmentsOfIssue.map(({ offline_id }) => offline_id)));
5250
5186
  if (updatesOfIssue.length > 0)
@@ -5265,7 +5201,6 @@ class IssueService extends BaseApiService {
5265
5201
  this.dispatch(addIssue(backup));
5266
5202
  this.dispatch(addIssueAttachments(attachmentsOfIssue));
5267
5203
  this.dispatch(addIssueUpdates(updatesOfIssue));
5268
- this.dispatch(addActiveProjectIssuesCount(1));
5269
5204
  this.dispatch(addFormSubmissions(formSubmissionsOfIssue));
5270
5205
  this.dispatch(addIssueAssociations(issueAssociations));
5271
5206
  throw e;
@@ -5431,13 +5366,9 @@ class ProjectFileService extends BaseApiService {
5431
5366
  const { store } = this.client;
5432
5367
  const state = store.getState();
5433
5368
  const activeProjectFileId = state.projectFileReducer.activeProjectFileId;
5434
- const activeProjectId = state.projectReducer.activeProjectId;
5435
5369
  if (!activeProjectFileId) {
5436
5370
  throw new Error("No active project file");
5437
5371
  }
5438
- if (!activeProjectId) {
5439
- throw new Error("No active project");
5440
- }
5441
5372
  const activeProjectFile = state.projectFileReducer.projectFiles[activeProjectFileId];
5442
5373
  if (!activeProjectFile) {
5443
5374
  throw new Error("No active project file");
@@ -5462,7 +5393,7 @@ class ProjectFileService extends BaseApiService {
5462
5393
  this.client.files.uploadFileToS3(activeProjectFile.file_sha1).then(([fileProps]) => {
5463
5394
  resolve({
5464
5395
  method: HttpMethod.POST,
5465
- url: `/projects/${activeProjectId}/files/`,
5396
+ url: `/projects/${activeProjectFile.project}/files/`,
5466
5397
  payload: {
5467
5398
  ...activeProjectFile,
5468
5399
  ...fileProps
@@ -5577,7 +5508,7 @@ class ProjectService extends BaseApiService {
5577
5508
  if (!project.bounds && !project.canvas_bounds) {
5578
5509
  throw new Error("Project must either have bounds or canvas_bounds set");
5579
5510
  }
5580
- this.dispatch(updateOrCreateProject(project));
5511
+ this.dispatch(updateProject(project));
5581
5512
  return await this.enqueueRequest({
5582
5513
  description: "Update project",
5583
5514
  method: HttpMethod.PATCH,
@@ -5842,12 +5773,10 @@ class FormSubmissionService extends BaseUploadService {
5842
5773
  });
5843
5774
  this.dispatch(addFormSubmission(offlineSubmission));
5844
5775
  promise.then((result) => {
5845
- this.dispatch(addActiveProjectFormSubmissionsCount(1));
5846
5776
  this.dispatch(setFormSubmission(result));
5847
5777
  return result;
5848
5778
  }).catch(() => {
5849
5779
  this.dispatch(deleteFormSubmission(offlineSubmission.offline_id));
5850
- this.dispatch(addActiveProjectFormSubmissionsCount(-1));
5851
5780
  });
5852
5781
  return [offlineSubmission, promise];
5853
5782
  }
@@ -5894,7 +5823,6 @@ class FormSubmissionService extends BaseUploadService {
5894
5823
  }
5895
5824
  const submissionAttachments = selectAttachmentsOfFormSubmission(id)(state);
5896
5825
  this.dispatch(deleteFormSubmission(id));
5897
- this.dispatch(addActiveProjectFormSubmissionsCount(-1));
5898
5826
  this.dispatch(deleteFormSubmissionAttachments(submissionAttachments.map((x) => x.offline_id)));
5899
5827
  try {
5900
5828
  return await this.enqueueRequest({
@@ -5905,7 +5833,6 @@ class FormSubmissionService extends BaseUploadService {
5905
5833
  blocks: []
5906
5834
  });
5907
5835
  } catch (e) {
5908
- this.dispatch(addActiveProjectFormSubmissionsCount(1));
5909
5836
  this.dispatch(addFormSubmission(submissionToBeDeleted));
5910
5837
  this.dispatch(addFormSubmissionAttachments(submissionAttachments));
5911
5838
  throw e;
@@ -6752,15 +6679,14 @@ class DocumentAttachmentService extends BaseAttachmentService {
6752
6679
  }
6753
6680
  }
6754
6681
  class AgentService extends BaseApiService {
6755
- async startConversation(prompt) {
6756
- const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
6682
+ async startConversation(prompt, projectId) {
6757
6683
  return this.enqueueRequest({
6758
6684
  description: "Start agent conversation",
6759
6685
  method: HttpMethod.POST,
6760
6686
  url: "/agents/prompt/",
6761
6687
  payload: {
6762
6688
  prompt,
6763
- active_project: activeProjectId
6689
+ active_project: projectId
6764
6690
  },
6765
6691
  blockers: ["prompt"],
6766
6692
  blocks: ["prompt"]
@@ -6769,21 +6695,14 @@ class AgentService extends BaseApiService {
6769
6695
  return response;
6770
6696
  });
6771
6697
  }
6772
- /**
6773
- * Prompt the agent with a message.
6774
- * @param prompt The message to prompt the agent with.
6775
- * @param conversationId If continuing an existing message, the UUID of that conversation.
6776
- */
6777
- async continueConversation(prompt, conversationId) {
6778
- const { store } = this.client;
6779
- const activeProjectId = store.getState().projectReducer.activeProjectId;
6698
+ async continueConversation(prompt, conversationId, projectId) {
6780
6699
  return this.enqueueRequest({
6781
6700
  description: "Prompt agent",
6782
6701
  method: HttpMethod.POST,
6783
6702
  url: "/agents/prompt/",
6784
6703
  payload: {
6785
6704
  prompt,
6786
- active_project: activeProjectId
6705
+ active_project: projectId
6787
6706
  },
6788
6707
  blockers: ["prompt"],
6789
6708
  blocks: ["prompt"],
@@ -8220,8 +8139,6 @@ export {
8220
8139
  _selectLatestFormRevision,
8221
8140
  _setLatestRetryTime,
8222
8141
  acceptProjectInvite,
8223
- addActiveProjectFormSubmissionsCount,
8224
- addActiveProjectIssuesCount,
8225
8142
  addAsset,
8226
8143
  addAssetAttachment,
8227
8144
  addAssetAttachments,
@@ -8282,7 +8199,6 @@ export {
8282
8199
  addLicenses,
8283
8200
  addOrReplaceProjectFile,
8284
8201
  addOrReplaceProjectFiles,
8285
- addOrReplaceProjects,
8286
8202
  addProjectAttachment,
8287
8203
  addProjectAttachments,
8288
8204
  addTeam,
@@ -8531,10 +8447,7 @@ export {
8531
8447
  saveActiveProjectFileBounds,
8532
8448
  selectAccessToken,
8533
8449
  selectActiveOrganizationAccess,
8534
- selectActiveProject,
8535
- selectActiveProjectAccess,
8536
8450
  selectActiveProjectFileId,
8537
- selectActiveProjectId,
8538
8451
  selectActiveStatusLicenses,
8539
8452
  selectAllDocumentAttachments,
8540
8453
  selectAllProjectAttachments,
@@ -8738,7 +8651,6 @@ export {
8738
8651
  separateFilesFromValues,
8739
8652
  separateImageFromFields,
8740
8653
  setActiveProjectFileId,
8741
- setActiveProjectId,
8742
8654
  setAsset,
8743
8655
  setAssetAttachment,
8744
8656
  setAssetAttachments,
@@ -8859,8 +8771,8 @@ export {
8859
8771
  updateIssueTypeFieldsAttachments,
8860
8772
  updateIssueTypeFieldsMany,
8861
8773
  updateLicense,
8862
- updateOrCreateProject,
8863
8774
  updateOrganizationAccess,
8775
+ updateProject,
8864
8776
  updateProjectAccess,
8865
8777
  updateProjectAttachment,
8866
8778
  updateProjectAttachments,