@overmap-ai/core 1.0.70-depend-on-forms.0 → 1.0.71-depend-on-forms.0
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 +46 -62
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +46 -62
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/services/FormService.d.ts +1 -1
- package/dist/sdk/services/FormSubmissionService.d.ts +1 -1
- package/dist/sdk/services/GeoImageService.d.ts +1 -1
- package/dist/sdk/services/TeamService.d.ts +1 -1
- package/dist/sdk/services/WorkspaceService.d.ts +1 -1
- package/dist/typings/models/base.d.ts +1 -2
- package/dist/typings/models/license.d.ts +2 -2
- package/dist/typings/models/projects.d.ts +2 -4
- package/package.json +1 -1
package/dist/overmap-core.js
CHANGED
|
@@ -5243,23 +5243,17 @@ class ProjectAttachmentService extends BaseAttachmentService {
|
|
|
5243
5243
|
}
|
|
5244
5244
|
class ProjectService extends BaseApiService {
|
|
5245
5245
|
async add(payload) {
|
|
5246
|
-
if (!payload.organization_owner && !payload.user_owner) {
|
|
5247
|
-
throw new Error("Project type was not chosen when trying to create a project");
|
|
5248
|
-
}
|
|
5249
5246
|
if (!payload.bounds && !payload.canvas_bounds) {
|
|
5250
5247
|
throw new Error("Project must either have bounds or canvas_bounds set");
|
|
5251
5248
|
}
|
|
5252
|
-
const isOrganizationProject = !!payload.organization_owner;
|
|
5253
|
-
const url = isOrganizationProject ? `/organizations/${payload.organization_owner}/projects/` : "/projects/";
|
|
5254
|
-
const projectType = isOrganizationProject ? { organization_owner: payload.organization_owner } : { user_owner: payload.user_owner };
|
|
5255
5249
|
return await this.enqueueRequest({
|
|
5256
5250
|
description: "Create project",
|
|
5257
5251
|
method: HttpMethod.POST,
|
|
5258
|
-
url,
|
|
5252
|
+
url: "/projects/",
|
|
5259
5253
|
payload: {
|
|
5260
5254
|
name: payload.name,
|
|
5261
5255
|
bounds: payload.bounds,
|
|
5262
|
-
|
|
5256
|
+
organization_owner: payload.organization_owner
|
|
5263
5257
|
},
|
|
5264
5258
|
blockers: [],
|
|
5265
5259
|
blocks: []
|
|
@@ -5583,28 +5577,28 @@ class FormService extends BaseUploadService {
|
|
|
5583
5577
|
});
|
|
5584
5578
|
return [fullRevision, offlineFormRevisionAttachments, promise, attachmentsPromise];
|
|
5585
5579
|
}
|
|
5586
|
-
async delete(
|
|
5580
|
+
async delete(id) {
|
|
5587
5581
|
const { store } = this.client;
|
|
5588
5582
|
const state = store.getState();
|
|
5589
|
-
const form = selectFormById(
|
|
5583
|
+
const form = selectFormById(id)(state);
|
|
5590
5584
|
if (!form) {
|
|
5591
5585
|
throw new Error("Expected form to exist");
|
|
5592
5586
|
}
|
|
5593
|
-
const formSubmissions = selectFormSubmissionsOfForm(
|
|
5587
|
+
const formSubmissions = selectFormSubmissionsOfForm(id)(state);
|
|
5594
5588
|
if (formSubmissions.length > 0) {
|
|
5595
5589
|
this.dispatch(deleteFormSubmissions(formSubmissions.map(({ offline_id }) => offline_id)));
|
|
5596
5590
|
}
|
|
5597
|
-
const formRevisions = selectFormRevisionsOfForm(
|
|
5591
|
+
const formRevisions = selectFormRevisionsOfForm(id)(state);
|
|
5598
5592
|
if (formRevisions.length > 0) {
|
|
5599
5593
|
this.dispatch(deleteFormRevisions(formRevisions.map(({ offline_id }) => offline_id)));
|
|
5600
5594
|
}
|
|
5601
|
-
this.dispatch(deleteForm(
|
|
5595
|
+
this.dispatch(deleteForm(id));
|
|
5602
5596
|
try {
|
|
5603
5597
|
return await this.enqueueRequest({
|
|
5604
5598
|
description: "Delete form",
|
|
5605
5599
|
method: HttpMethod.DELETE,
|
|
5606
|
-
url: `/forms/${
|
|
5607
|
-
blockers: [
|
|
5600
|
+
url: `/forms/${id}/`,
|
|
5601
|
+
blockers: [id],
|
|
5608
5602
|
blocks: []
|
|
5609
5603
|
});
|
|
5610
5604
|
} catch (e) {
|
|
@@ -5972,23 +5966,23 @@ class FormSubmissionService extends BaseUploadService {
|
|
|
5972
5966
|
deleteAttachmentsPromise
|
|
5973
5967
|
];
|
|
5974
5968
|
}
|
|
5975
|
-
async delete(
|
|
5969
|
+
async delete(id) {
|
|
5976
5970
|
const { store } = this.client;
|
|
5977
5971
|
const state = store.getState();
|
|
5978
|
-
const submissionToBeDeleted = selectFormSubmissionById(
|
|
5972
|
+
const submissionToBeDeleted = selectFormSubmissionById(id)(state);
|
|
5979
5973
|
if (!submissionToBeDeleted) {
|
|
5980
|
-
throw new Error(`Expected submission with offline_id ${
|
|
5974
|
+
throw new Error(`Expected submission with offline_id ${id} to exist`);
|
|
5981
5975
|
}
|
|
5982
|
-
const submissionAttachments = selectAttachmentsOfFormSubmission(
|
|
5983
|
-
this.dispatch(deleteFormSubmission(
|
|
5976
|
+
const submissionAttachments = selectAttachmentsOfFormSubmission(id)(state);
|
|
5977
|
+
this.dispatch(deleteFormSubmission(id));
|
|
5984
5978
|
this.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
5985
5979
|
this.dispatch(deleteFormSubmissionAttachments(submissionAttachments.map((x) => x.offline_id)));
|
|
5986
5980
|
try {
|
|
5987
5981
|
return await this.enqueueRequest({
|
|
5988
5982
|
description: "Delete user form submissions",
|
|
5989
5983
|
method: HttpMethod.DELETE,
|
|
5990
|
-
url: `/forms/submissions/${
|
|
5991
|
-
blockers: [
|
|
5984
|
+
url: `/forms/submissions/${id}/`,
|
|
5985
|
+
blockers: [id],
|
|
5992
5986
|
blocks: []
|
|
5993
5987
|
});
|
|
5994
5988
|
} catch (e) {
|
|
@@ -6094,22 +6088,22 @@ class WorkspaceService extends BaseApiService {
|
|
|
6094
6088
|
});
|
|
6095
6089
|
return [workspace, promise];
|
|
6096
6090
|
}
|
|
6097
|
-
delete(
|
|
6091
|
+
delete(id) {
|
|
6098
6092
|
const { store } = this.client;
|
|
6099
|
-
const originalWorkspace = selectWorkspaceById(
|
|
6100
|
-
|
|
6093
|
+
const originalWorkspace = selectWorkspaceById(id)(store.getState());
|
|
6094
|
+
if (!originalWorkspace) {
|
|
6095
|
+
throw new Error(`Expected an existing workspace with id ${id}`);
|
|
6096
|
+
}
|
|
6097
|
+
this.dispatch(deleteWorkspace(id));
|
|
6101
6098
|
const promise = this.enqueueRequest({
|
|
6102
6099
|
description: "Delete Workspace",
|
|
6103
6100
|
method: HttpMethod.DELETE,
|
|
6104
|
-
url: `/workspaces/${
|
|
6105
|
-
blockers: [
|
|
6101
|
+
url: `/workspaces/${id}/`,
|
|
6102
|
+
blockers: [id],
|
|
6106
6103
|
blocks: []
|
|
6107
6104
|
});
|
|
6108
|
-
void promise.
|
|
6109
|
-
|
|
6110
|
-
if (originalWorkspace) {
|
|
6111
|
-
this.dispatch(addWorkspace(originalWorkspace));
|
|
6112
|
-
}
|
|
6105
|
+
void promise.catch((reason) => {
|
|
6106
|
+
this.dispatch(addWorkspace(originalWorkspace));
|
|
6113
6107
|
throw reason;
|
|
6114
6108
|
});
|
|
6115
6109
|
return promise;
|
|
@@ -6487,9 +6481,7 @@ class LicenseService extends BaseApiService {
|
|
|
6487
6481
|
method: HttpMethod.GET,
|
|
6488
6482
|
url: `/billing/${license.offline_id}/`,
|
|
6489
6483
|
isAuthNeeded: true,
|
|
6490
|
-
blockers: [
|
|
6491
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6492
|
-
],
|
|
6484
|
+
blockers: [license.organization_owner ? license.organization_owner.toString() : ""],
|
|
6493
6485
|
blocks: []
|
|
6494
6486
|
});
|
|
6495
6487
|
this.dispatch(updateLicense(result));
|
|
@@ -6501,9 +6493,7 @@ class LicenseService extends BaseApiService {
|
|
|
6501
6493
|
method: HttpMethod.DELETE,
|
|
6502
6494
|
url: `/billing/${license.offline_id}/suspend/`,
|
|
6503
6495
|
isAuthNeeded: true,
|
|
6504
|
-
blockers: [
|
|
6505
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6506
|
-
],
|
|
6496
|
+
blockers: [license.organization_owner ? license.organization_owner.toString() : ""],
|
|
6507
6497
|
blocks: []
|
|
6508
6498
|
});
|
|
6509
6499
|
this.dispatch(updateLicense(result));
|
|
@@ -6515,9 +6505,7 @@ class LicenseService extends BaseApiService {
|
|
|
6515
6505
|
method: HttpMethod.PATCH,
|
|
6516
6506
|
url: `/billing/${license.offline_id}/suspend/`,
|
|
6517
6507
|
isAuthNeeded: true,
|
|
6518
|
-
blockers: [
|
|
6519
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6520
|
-
],
|
|
6508
|
+
blockers: [license.organization_owner ? license.organization_owner.toString() : ""],
|
|
6521
6509
|
blocks: []
|
|
6522
6510
|
});
|
|
6523
6511
|
this.dispatch(updateLicense(result));
|
|
@@ -6529,9 +6517,7 @@ class LicenseService extends BaseApiService {
|
|
|
6529
6517
|
method: HttpMethod.DELETE,
|
|
6530
6518
|
url: `/billing/${license.offline_id}/`,
|
|
6531
6519
|
isAuthNeeded: true,
|
|
6532
|
-
blockers: [
|
|
6533
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6534
|
-
],
|
|
6520
|
+
blockers: [license.organization_owner ? license.organization_owner.toString() : ""],
|
|
6535
6521
|
blocks: []
|
|
6536
6522
|
});
|
|
6537
6523
|
this.dispatch(updateLicense(result));
|
|
@@ -6545,7 +6531,7 @@ class LicenseService extends BaseApiService {
|
|
|
6545
6531
|
isAuthNeeded: true,
|
|
6546
6532
|
payload: { project: project.id },
|
|
6547
6533
|
blockers: [
|
|
6548
|
-
license.organization_owner ? license.organization_owner.toString() :
|
|
6534
|
+
license.organization_owner ? license.organization_owner.toString() : "",
|
|
6549
6535
|
project.id ? project.id.toString() : ""
|
|
6550
6536
|
],
|
|
6551
6537
|
blocks: ["add-issue", "add-form-entry", "change-access-level", "add-workspace"]
|
|
@@ -6559,9 +6545,7 @@ class LicenseService extends BaseApiService {
|
|
|
6559
6545
|
method: HttpMethod.DELETE,
|
|
6560
6546
|
url: `/billing/${license.offline_id}/project/`,
|
|
6561
6547
|
isAuthNeeded: true,
|
|
6562
|
-
blockers: [
|
|
6563
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6564
|
-
],
|
|
6548
|
+
blockers: [license.organization_owner ? license.organization_owner.toString() : ""],
|
|
6565
6549
|
blocks: ["add-issue", "add-form-entry", "change-access-level", "add-workspace"]
|
|
6566
6550
|
});
|
|
6567
6551
|
this.dispatch(updateLicense(result));
|
|
@@ -7002,21 +6986,21 @@ class TeamService extends BaseApiService {
|
|
|
7002
6986
|
});
|
|
7003
6987
|
return [offlineUpdatedTeam, promise];
|
|
7004
6988
|
}
|
|
7005
|
-
async delete(
|
|
6989
|
+
async delete(id) {
|
|
7006
6990
|
const { store } = this.client;
|
|
7007
6991
|
const state = store.getState();
|
|
7008
|
-
const team = selectTeamById(
|
|
6992
|
+
const team = selectTeamById(id)(state);
|
|
7009
6993
|
if (!team) {
|
|
7010
|
-
throw new Error(`Expected team with id ${
|
|
6994
|
+
throw new Error(`Expected team with id ${id} to exist`);
|
|
7011
6995
|
}
|
|
7012
|
-
this.dispatch(deleteTeam(
|
|
6996
|
+
this.dispatch(deleteTeam(id));
|
|
7013
6997
|
try {
|
|
7014
6998
|
return await this.enqueueRequest({
|
|
7015
6999
|
description: "Delete team",
|
|
7016
7000
|
method: HttpMethod.DELETE,
|
|
7017
|
-
url: `/organizations/teams/${
|
|
7018
|
-
blockers: [
|
|
7019
|
-
blocks: [
|
|
7001
|
+
url: `/organizations/teams/${id}/`,
|
|
7002
|
+
blockers: [id],
|
|
7003
|
+
blocks: [id]
|
|
7020
7004
|
});
|
|
7021
7005
|
} catch (e) {
|
|
7022
7006
|
this.dispatch(setTeam(team));
|
|
@@ -7246,20 +7230,20 @@ class GeoImageService extends BaseUploadService {
|
|
|
7246
7230
|
});
|
|
7247
7231
|
return [updatedGeoImage, promise];
|
|
7248
7232
|
}
|
|
7249
|
-
async delete(
|
|
7233
|
+
async delete(id) {
|
|
7250
7234
|
const { store } = this.client;
|
|
7251
7235
|
const state = store.getState();
|
|
7252
|
-
const geoImageToDelete = selectGeoImageById(
|
|
7236
|
+
const geoImageToDelete = selectGeoImageById(id)(state);
|
|
7253
7237
|
if (!geoImageToDelete) {
|
|
7254
|
-
throw new Error(`Map image with offline_id ${
|
|
7238
|
+
throw new Error(`Map image with offline_id ${id} does not exist in the store`);
|
|
7255
7239
|
}
|
|
7256
|
-
this.dispatch(deleteGeoImage(
|
|
7240
|
+
this.dispatch(deleteGeoImage(id));
|
|
7257
7241
|
const promise = this.enqueueRequest({
|
|
7258
7242
|
description: "Delete geo image",
|
|
7259
7243
|
method: HttpMethod.DELETE,
|
|
7260
|
-
url: `/geo-images/${
|
|
7261
|
-
blocks: [
|
|
7262
|
-
blockers: [
|
|
7244
|
+
url: `/geo-images/${id}/`,
|
|
7245
|
+
blocks: [id],
|
|
7246
|
+
blockers: [id]
|
|
7263
7247
|
});
|
|
7264
7248
|
promise.catch(() => {
|
|
7265
7249
|
this.dispatch(setGeoImage(geoImageToDelete));
|