@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
|
@@ -5232,23 +5232,17 @@ var __publicField = (obj, key, value) => {
|
|
|
5232
5232
|
}
|
|
5233
5233
|
class ProjectService extends BaseApiService {
|
|
5234
5234
|
async add(payload) {
|
|
5235
|
-
if (!payload.organization_owner && !payload.user_owner) {
|
|
5236
|
-
throw new Error("Project type was not chosen when trying to create a project");
|
|
5237
|
-
}
|
|
5238
5235
|
if (!payload.bounds && !payload.canvas_bounds) {
|
|
5239
5236
|
throw new Error("Project must either have bounds or canvas_bounds set");
|
|
5240
5237
|
}
|
|
5241
|
-
const isOrganizationProject = !!payload.organization_owner;
|
|
5242
|
-
const url = isOrganizationProject ? `/organizations/${payload.organization_owner}/projects/` : "/projects/";
|
|
5243
|
-
const projectType = isOrganizationProject ? { organization_owner: payload.organization_owner } : { user_owner: payload.user_owner };
|
|
5244
5238
|
return await this.enqueueRequest({
|
|
5245
5239
|
description: "Create project",
|
|
5246
5240
|
method: HttpMethod.POST,
|
|
5247
|
-
url,
|
|
5241
|
+
url: "/projects/",
|
|
5248
5242
|
payload: {
|
|
5249
5243
|
name: payload.name,
|
|
5250
5244
|
bounds: payload.bounds,
|
|
5251
|
-
|
|
5245
|
+
organization_owner: payload.organization_owner
|
|
5252
5246
|
},
|
|
5253
5247
|
blockers: [],
|
|
5254
5248
|
blocks: []
|
|
@@ -5572,28 +5566,28 @@ var __publicField = (obj, key, value) => {
|
|
|
5572
5566
|
});
|
|
5573
5567
|
return [fullRevision, offlineFormRevisionAttachments, promise, attachmentsPromise];
|
|
5574
5568
|
}
|
|
5575
|
-
async delete(
|
|
5569
|
+
async delete(id) {
|
|
5576
5570
|
const { store } = this.client;
|
|
5577
5571
|
const state = store.getState();
|
|
5578
|
-
const form = selectFormById(
|
|
5572
|
+
const form = selectFormById(id)(state);
|
|
5579
5573
|
if (!form) {
|
|
5580
5574
|
throw new Error("Expected form to exist");
|
|
5581
5575
|
}
|
|
5582
|
-
const formSubmissions = selectFormSubmissionsOfForm(
|
|
5576
|
+
const formSubmissions = selectFormSubmissionsOfForm(id)(state);
|
|
5583
5577
|
if (formSubmissions.length > 0) {
|
|
5584
5578
|
this.dispatch(deleteFormSubmissions(formSubmissions.map(({ offline_id }) => offline_id)));
|
|
5585
5579
|
}
|
|
5586
|
-
const formRevisions = selectFormRevisionsOfForm(
|
|
5580
|
+
const formRevisions = selectFormRevisionsOfForm(id)(state);
|
|
5587
5581
|
if (formRevisions.length > 0) {
|
|
5588
5582
|
this.dispatch(deleteFormRevisions(formRevisions.map(({ offline_id }) => offline_id)));
|
|
5589
5583
|
}
|
|
5590
|
-
this.dispatch(deleteForm(
|
|
5584
|
+
this.dispatch(deleteForm(id));
|
|
5591
5585
|
try {
|
|
5592
5586
|
return await this.enqueueRequest({
|
|
5593
5587
|
description: "Delete form",
|
|
5594
5588
|
method: HttpMethod.DELETE,
|
|
5595
|
-
url: `/forms/${
|
|
5596
|
-
blockers: [
|
|
5589
|
+
url: `/forms/${id}/`,
|
|
5590
|
+
blockers: [id],
|
|
5597
5591
|
blocks: []
|
|
5598
5592
|
});
|
|
5599
5593
|
} catch (e) {
|
|
@@ -5961,23 +5955,23 @@ var __publicField = (obj, key, value) => {
|
|
|
5961
5955
|
deleteAttachmentsPromise
|
|
5962
5956
|
];
|
|
5963
5957
|
}
|
|
5964
|
-
async delete(
|
|
5958
|
+
async delete(id) {
|
|
5965
5959
|
const { store } = this.client;
|
|
5966
5960
|
const state = store.getState();
|
|
5967
|
-
const submissionToBeDeleted = selectFormSubmissionById(
|
|
5961
|
+
const submissionToBeDeleted = selectFormSubmissionById(id)(state);
|
|
5968
5962
|
if (!submissionToBeDeleted) {
|
|
5969
|
-
throw new Error(`Expected submission with offline_id ${
|
|
5963
|
+
throw new Error(`Expected submission with offline_id ${id} to exist`);
|
|
5970
5964
|
}
|
|
5971
|
-
const submissionAttachments = selectAttachmentsOfFormSubmission(
|
|
5972
|
-
this.dispatch(deleteFormSubmission(
|
|
5965
|
+
const submissionAttachments = selectAttachmentsOfFormSubmission(id)(state);
|
|
5966
|
+
this.dispatch(deleteFormSubmission(id));
|
|
5973
5967
|
this.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
5974
5968
|
this.dispatch(deleteFormSubmissionAttachments(submissionAttachments.map((x) => x.offline_id)));
|
|
5975
5969
|
try {
|
|
5976
5970
|
return await this.enqueueRequest({
|
|
5977
5971
|
description: "Delete user form submissions",
|
|
5978
5972
|
method: HttpMethod.DELETE,
|
|
5979
|
-
url: `/forms/submissions/${
|
|
5980
|
-
blockers: [
|
|
5973
|
+
url: `/forms/submissions/${id}/`,
|
|
5974
|
+
blockers: [id],
|
|
5981
5975
|
blocks: []
|
|
5982
5976
|
});
|
|
5983
5977
|
} catch (e) {
|
|
@@ -6083,22 +6077,22 @@ var __publicField = (obj, key, value) => {
|
|
|
6083
6077
|
});
|
|
6084
6078
|
return [workspace, promise];
|
|
6085
6079
|
}
|
|
6086
|
-
delete(
|
|
6080
|
+
delete(id) {
|
|
6087
6081
|
const { store } = this.client;
|
|
6088
|
-
const originalWorkspace = selectWorkspaceById(
|
|
6089
|
-
|
|
6082
|
+
const originalWorkspace = selectWorkspaceById(id)(store.getState());
|
|
6083
|
+
if (!originalWorkspace) {
|
|
6084
|
+
throw new Error(`Expected an existing workspace with id ${id}`);
|
|
6085
|
+
}
|
|
6086
|
+
this.dispatch(deleteWorkspace(id));
|
|
6090
6087
|
const promise = this.enqueueRequest({
|
|
6091
6088
|
description: "Delete Workspace",
|
|
6092
6089
|
method: HttpMethod.DELETE,
|
|
6093
|
-
url: `/workspaces/${
|
|
6094
|
-
blockers: [
|
|
6090
|
+
url: `/workspaces/${id}/`,
|
|
6091
|
+
blockers: [id],
|
|
6095
6092
|
blocks: []
|
|
6096
6093
|
});
|
|
6097
|
-
void promise.
|
|
6098
|
-
|
|
6099
|
-
if (originalWorkspace) {
|
|
6100
|
-
this.dispatch(addWorkspace(originalWorkspace));
|
|
6101
|
-
}
|
|
6094
|
+
void promise.catch((reason) => {
|
|
6095
|
+
this.dispatch(addWorkspace(originalWorkspace));
|
|
6102
6096
|
throw reason;
|
|
6103
6097
|
});
|
|
6104
6098
|
return promise;
|
|
@@ -6476,9 +6470,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6476
6470
|
method: HttpMethod.GET,
|
|
6477
6471
|
url: `/billing/${license.offline_id}/`,
|
|
6478
6472
|
isAuthNeeded: true,
|
|
6479
|
-
blockers: [
|
|
6480
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6481
|
-
],
|
|
6473
|
+
blockers: [license.organization_owner ? license.organization_owner.toString() : ""],
|
|
6482
6474
|
blocks: []
|
|
6483
6475
|
});
|
|
6484
6476
|
this.dispatch(updateLicense(result));
|
|
@@ -6490,9 +6482,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6490
6482
|
method: HttpMethod.DELETE,
|
|
6491
6483
|
url: `/billing/${license.offline_id}/suspend/`,
|
|
6492
6484
|
isAuthNeeded: true,
|
|
6493
|
-
blockers: [
|
|
6494
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6495
|
-
],
|
|
6485
|
+
blockers: [license.organization_owner ? license.organization_owner.toString() : ""],
|
|
6496
6486
|
blocks: []
|
|
6497
6487
|
});
|
|
6498
6488
|
this.dispatch(updateLicense(result));
|
|
@@ -6504,9 +6494,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6504
6494
|
method: HttpMethod.PATCH,
|
|
6505
6495
|
url: `/billing/${license.offline_id}/suspend/`,
|
|
6506
6496
|
isAuthNeeded: true,
|
|
6507
|
-
blockers: [
|
|
6508
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6509
|
-
],
|
|
6497
|
+
blockers: [license.organization_owner ? license.organization_owner.toString() : ""],
|
|
6510
6498
|
blocks: []
|
|
6511
6499
|
});
|
|
6512
6500
|
this.dispatch(updateLicense(result));
|
|
@@ -6518,9 +6506,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6518
6506
|
method: HttpMethod.DELETE,
|
|
6519
6507
|
url: `/billing/${license.offline_id}/`,
|
|
6520
6508
|
isAuthNeeded: true,
|
|
6521
|
-
blockers: [
|
|
6522
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6523
|
-
],
|
|
6509
|
+
blockers: [license.organization_owner ? license.organization_owner.toString() : ""],
|
|
6524
6510
|
blocks: []
|
|
6525
6511
|
});
|
|
6526
6512
|
this.dispatch(updateLicense(result));
|
|
@@ -6534,7 +6520,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6534
6520
|
isAuthNeeded: true,
|
|
6535
6521
|
payload: { project: project.id },
|
|
6536
6522
|
blockers: [
|
|
6537
|
-
license.organization_owner ? license.organization_owner.toString() :
|
|
6523
|
+
license.organization_owner ? license.organization_owner.toString() : "",
|
|
6538
6524
|
project.id ? project.id.toString() : ""
|
|
6539
6525
|
],
|
|
6540
6526
|
blocks: ["add-issue", "add-form-entry", "change-access-level", "add-workspace"]
|
|
@@ -6548,9 +6534,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6548
6534
|
method: HttpMethod.DELETE,
|
|
6549
6535
|
url: `/billing/${license.offline_id}/project/`,
|
|
6550
6536
|
isAuthNeeded: true,
|
|
6551
|
-
blockers: [
|
|
6552
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6553
|
-
],
|
|
6537
|
+
blockers: [license.organization_owner ? license.organization_owner.toString() : ""],
|
|
6554
6538
|
blocks: ["add-issue", "add-form-entry", "change-access-level", "add-workspace"]
|
|
6555
6539
|
});
|
|
6556
6540
|
this.dispatch(updateLicense(result));
|
|
@@ -6991,21 +6975,21 @@ var __publicField = (obj, key, value) => {
|
|
|
6991
6975
|
});
|
|
6992
6976
|
return [offlineUpdatedTeam, promise];
|
|
6993
6977
|
}
|
|
6994
|
-
async delete(
|
|
6978
|
+
async delete(id) {
|
|
6995
6979
|
const { store } = this.client;
|
|
6996
6980
|
const state = store.getState();
|
|
6997
|
-
const team = selectTeamById(
|
|
6981
|
+
const team = selectTeamById(id)(state);
|
|
6998
6982
|
if (!team) {
|
|
6999
|
-
throw new Error(`Expected team with id ${
|
|
6983
|
+
throw new Error(`Expected team with id ${id} to exist`);
|
|
7000
6984
|
}
|
|
7001
|
-
this.dispatch(deleteTeam(
|
|
6985
|
+
this.dispatch(deleteTeam(id));
|
|
7002
6986
|
try {
|
|
7003
6987
|
return await this.enqueueRequest({
|
|
7004
6988
|
description: "Delete team",
|
|
7005
6989
|
method: HttpMethod.DELETE,
|
|
7006
|
-
url: `/organizations/teams/${
|
|
7007
|
-
blockers: [
|
|
7008
|
-
blocks: [
|
|
6990
|
+
url: `/organizations/teams/${id}/`,
|
|
6991
|
+
blockers: [id],
|
|
6992
|
+
blocks: [id]
|
|
7009
6993
|
});
|
|
7010
6994
|
} catch (e) {
|
|
7011
6995
|
this.dispatch(setTeam(team));
|
|
@@ -7235,20 +7219,20 @@ var __publicField = (obj, key, value) => {
|
|
|
7235
7219
|
});
|
|
7236
7220
|
return [updatedGeoImage, promise];
|
|
7237
7221
|
}
|
|
7238
|
-
async delete(
|
|
7222
|
+
async delete(id) {
|
|
7239
7223
|
const { store } = this.client;
|
|
7240
7224
|
const state = store.getState();
|
|
7241
|
-
const geoImageToDelete = selectGeoImageById(
|
|
7225
|
+
const geoImageToDelete = selectGeoImageById(id)(state);
|
|
7242
7226
|
if (!geoImageToDelete) {
|
|
7243
|
-
throw new Error(`Map image with offline_id ${
|
|
7227
|
+
throw new Error(`Map image with offline_id ${id} does not exist in the store`);
|
|
7244
7228
|
}
|
|
7245
|
-
this.dispatch(deleteGeoImage(
|
|
7229
|
+
this.dispatch(deleteGeoImage(id));
|
|
7246
7230
|
const promise = this.enqueueRequest({
|
|
7247
7231
|
description: "Delete geo image",
|
|
7248
7232
|
method: HttpMethod.DELETE,
|
|
7249
|
-
url: `/geo-images/${
|
|
7250
|
-
blocks: [
|
|
7251
|
-
blockers: [
|
|
7233
|
+
url: `/geo-images/${id}/`,
|
|
7234
|
+
blocks: [id],
|
|
7235
|
+
blockers: [id]
|
|
7252
7236
|
});
|
|
7253
7237
|
promise.catch(() => {
|
|
7254
7238
|
this.dispatch(setGeoImage(geoImageToDelete));
|