@overmap-ai/core 1.0.53-team-links.0 → 1.0.53-team-links.1

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.
@@ -7153,6 +7153,7 @@ class MainService extends BaseApiService {
7153
7153
  });
7154
7154
  void this.client.userForms.refreshStore().then(() => {
7155
7155
  void this.client.userFormSubmissions.refreshStore().then();
7156
+ void this.client.userFormTeamLinks.refreshStore().then();
7156
7157
  });
7157
7158
  }
7158
7159
  if (currentProjectId) {
@@ -7171,9 +7172,13 @@ class MainService extends BaseApiService {
7171
7172
  store.dispatch(setProjectAttachments(project_attachments));
7172
7173
  store.dispatch(setDocumentAttachments(document_attachments));
7173
7174
  });
7174
- void this.client.documents.refreshStore();
7175
+ void this.client.documents.refreshStore().then(() => {
7176
+ void this.client.documentTeamLinks.refreshStore().then();
7177
+ });
7175
7178
  void this.client.issueUpdates.refreshStore();
7176
- void this.client.issueTypes.refreshStore();
7179
+ void this.client.issueTypes.refreshStore().then(() => {
7180
+ void this.client.issueTypeTeamLinks.refreshStore().then();
7181
+ });
7177
7182
  }
7178
7183
  store.dispatch(setIsFetchingInitialData(false));
7179
7184
  if (overwrite) {
@@ -8967,6 +8972,116 @@ class DocumentTeamLinkService extends BaseApiService {
8967
8972
  store.dispatch(setDocumentTeamLinks(result));
8968
8973
  }
8969
8974
  }
8975
+ class IssueTypeTeamLinkService extends BaseApiService {
8976
+ add(payload) {
8977
+ const { store } = this.client;
8978
+ const offlineIssueTypeTeamLink = offline({
8979
+ ...payload,
8980
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString()
8981
+ });
8982
+ store.dispatch(addIssueTypeTeamLink(offlineIssueTypeTeamLink));
8983
+ const promise = this.enqueueRequest({
8984
+ method: HttpMethod.POST,
8985
+ url: `/organizations/teams/${payload.team}/link-issue-type/`,
8986
+ payload: offlineIssueTypeTeamLink,
8987
+ blockers: [payload.team, payload.issue_type],
8988
+ blocks: [offlineIssueTypeTeamLink.offline_id]
8989
+ });
8990
+ promise.then((createdIssueTypeLink) => {
8991
+ store.dispatch(setIssueTypeTeamLink(createdIssueTypeLink));
8992
+ }).catch(() => {
8993
+ store.dispatch(deleteIssueTypeTeamLink(offlineIssueTypeTeamLink.offline_id));
8994
+ });
8995
+ return [offlineIssueTypeTeamLink, promise];
8996
+ }
8997
+ delete(issueTypeTeamLinkId) {
8998
+ const { store } = this.client;
8999
+ const issueTypeTeamLink = store.getState().issueTypeTeamLinkReducer.issueTypeTeamLinks[issueTypeTeamLinkId];
9000
+ if (!issueTypeTeamLink) {
9001
+ throw new Error(`No issue type team link found for ${issueTypeTeamLinkId}`);
9002
+ }
9003
+ store.dispatch(deleteIssueTypeTeamLink(issueTypeTeamLinkId));
9004
+ const promise = this.enqueueRequest({
9005
+ method: HttpMethod.DELETE,
9006
+ url: `/organizations/teams/issue-type-links/${issueTypeTeamLinkId}/`,
9007
+ blockers: [issueTypeTeamLink.offline_id],
9008
+ blocks: [issueTypeTeamLink.offline_id]
9009
+ });
9010
+ promise.catch(() => {
9011
+ store.dispatch(setIssueTypeTeamLink(issueTypeTeamLink));
9012
+ });
9013
+ return promise;
9014
+ }
9015
+ async refreshStore() {
9016
+ const { store } = this.client;
9017
+ const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
9018
+ if (!activeOrganizationId) {
9019
+ throw new Error(`No active organization, got ${activeOrganizationId} for activeOrganizationId.`);
9020
+ }
9021
+ const result = await this.enqueueRequest({
9022
+ method: HttpMethod.GET,
9023
+ url: `/organizations/${activeOrganizationId}/teams/issue-type-links/`,
9024
+ blockers: [],
9025
+ blocks: []
9026
+ });
9027
+ store.dispatch(setIssueTypeTeamLinks(result));
9028
+ }
9029
+ }
9030
+ class UserFormTeamLinkService extends BaseApiService {
9031
+ add(payload) {
9032
+ const { store } = this.client;
9033
+ const offlineUserFormTeamLink = offline({
9034
+ ...payload,
9035
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString()
9036
+ });
9037
+ store.dispatch(addUserFormTeamLink(offlineUserFormTeamLink));
9038
+ const promise = this.enqueueRequest({
9039
+ method: HttpMethod.POST,
9040
+ url: `/organizations/teams/${payload.team}/link-form/`,
9041
+ payload: offlineUserFormTeamLink,
9042
+ blockers: [payload.team, payload.form],
9043
+ blocks: [offlineUserFormTeamLink.offline_id]
9044
+ });
9045
+ promise.then((createdUserFormLink) => {
9046
+ store.dispatch(setUserFormTeamLink(createdUserFormLink));
9047
+ }).catch(() => {
9048
+ store.dispatch(deleteUserFormTeamLink(offlineUserFormTeamLink.offline_id));
9049
+ });
9050
+ return [offlineUserFormTeamLink, promise];
9051
+ }
9052
+ delete(userFormTeamLinkId) {
9053
+ const { store } = this.client;
9054
+ const userFormTeamLink = store.getState().userFormTeamLinkReducer.userFormTeamLinks[userFormTeamLinkId];
9055
+ if (!userFormTeamLink) {
9056
+ throw new Error(`No user form team link found for ${userFormTeamLinkId}`);
9057
+ }
9058
+ store.dispatch(deleteUserFormTeamLink(userFormTeamLinkId));
9059
+ const promise = this.enqueueRequest({
9060
+ method: HttpMethod.DELETE,
9061
+ url: `/organizations/teams/form-links/${userFormTeamLinkId}/`,
9062
+ blockers: [userFormTeamLink.offline_id],
9063
+ blocks: [userFormTeamLink.offline_id]
9064
+ });
9065
+ promise.catch(() => {
9066
+ store.dispatch(setUserFormTeamLink(userFormTeamLink));
9067
+ });
9068
+ return promise;
9069
+ }
9070
+ async refreshStore() {
9071
+ const { store } = this.client;
9072
+ const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
9073
+ if (!activeOrganizationId) {
9074
+ throw new Error(`No active organization, got ${activeOrganizationId} for activeOrganizationId.`);
9075
+ }
9076
+ const result = await this.enqueueRequest({
9077
+ method: HttpMethod.GET,
9078
+ url: `/organizations/${activeOrganizationId}/teams/form-links/`,
9079
+ blockers: [],
9080
+ blocks: []
9081
+ });
9082
+ store.dispatch(setUserFormTeamLinks(result));
9083
+ }
9084
+ }
8970
9085
  class OvermapSDK {
8971
9086
  constructor(apiUrl, store) {
8972
9087
  __publicField(this, "API_URL");
@@ -8999,6 +9114,8 @@ class OvermapSDK {
8999
9114
  __publicField(this, "documents", new DocumentService(this));
9000
9115
  __publicField(this, "teams", new TeamService(this));
9001
9116
  __publicField(this, "documentTeamLinks", new DocumentTeamLinkService(this));
9117
+ __publicField(this, "issueTypeTeamLinks", new IssueTypeTeamLinkService(this));
9118
+ __publicField(this, "userFormTeamLinks", new UserFormTeamLinkService(this));
9002
9119
  this.API_URL = apiUrl;
9003
9120
  this.store = store;
9004
9121
  }