@overmap-ai/core 1.0.65-strip-workspace-access.0 → 1.0.65-strip-workspace-access.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.
- package/dist/overmap-core.js +25 -65
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +25 -65
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/services/CategoryService.d.ts +1 -1
- package/dist/sdk/services/FormService.d.ts +0 -2
- package/dist/sdk/services/WorkspaceService.d.ts +1 -1
- package/dist/store/slices/formSlice.d.ts +0 -2
- package/dist/typings/models/base.d.ts +1 -1
- package/dist/typings/models/categories.d.ts +2 -2
- package/dist/typings/models/forms.d.ts +0 -1
- package/dist/typings/models/workspace.d.ts +3 -3
- package/package.json +1 -1
|
@@ -2363,29 +2363,18 @@ var __publicField = (obj, key, value) => {
|
|
|
2363
2363
|
(_state, search) => search
|
|
2364
2364
|
],
|
|
2365
2365
|
(formsMapping, revisions, search) => {
|
|
2366
|
-
const { searchTerm, maxResults,
|
|
2367
|
-
const favoriteMatches = [];
|
|
2366
|
+
const { searchTerm, maxResults, organization } = search;
|
|
2368
2367
|
const regularMatches = [];
|
|
2369
2368
|
for (const [formId, form] of Object.entries(formsMapping)) {
|
|
2370
|
-
if (favorites !== void 0 && form.favorite != favorites)
|
|
2371
|
-
continue;
|
|
2372
2369
|
if (Number.isInteger(organization) && organization !== form.organization) {
|
|
2373
2370
|
continue;
|
|
2374
2371
|
}
|
|
2375
2372
|
const latestRevision = _selectLatestFormRevision(revisions, formId);
|
|
2376
2373
|
if (latestRevision.title.toLowerCase().includes(searchTerm.toLowerCase())) {
|
|
2377
|
-
|
|
2378
|
-
favoriteMatches.push({ ...form, latestRevision });
|
|
2379
|
-
} else {
|
|
2380
|
-
regularMatches.push({ ...form, latestRevision });
|
|
2381
|
-
}
|
|
2382
|
-
}
|
|
2383
|
-
if (favoriteMatches.length >= maxResults) {
|
|
2384
|
-
break;
|
|
2374
|
+
regularMatches.push({ ...form, latestRevision });
|
|
2385
2375
|
}
|
|
2386
2376
|
}
|
|
2387
|
-
|
|
2388
|
-
return [...favoriteMatches, ...regularMatches.slice(0, maxRegularMatches)];
|
|
2377
|
+
return [...regularMatches.slice(0, maxResults)];
|
|
2389
2378
|
},
|
|
2390
2379
|
// as the argument is an object, we check the first level of properties for equality
|
|
2391
2380
|
{ memoizeOptions: { equalityCheck: shallowEqual } }
|
|
@@ -4035,10 +4024,17 @@ var __publicField = (obj, key, value) => {
|
|
|
4035
4024
|
}
|
|
4036
4025
|
}
|
|
4037
4026
|
class CategoryService extends BaseApiService {
|
|
4038
|
-
add(
|
|
4039
|
-
const
|
|
4040
|
-
const
|
|
4041
|
-
|
|
4027
|
+
add(payload, workspaceId) {
|
|
4028
|
+
const { store } = this.client;
|
|
4029
|
+
const createdBy = store.getState().userReducer.currentUser.id;
|
|
4030
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4031
|
+
const offlineCategory = offline({
|
|
4032
|
+
...payload,
|
|
4033
|
+
created_by: createdBy,
|
|
4034
|
+
submitted_at: submittedAt,
|
|
4035
|
+
workspace: workspaceId
|
|
4036
|
+
});
|
|
4037
|
+
this.dispatch(addCategory(offlineCategory));
|
|
4042
4038
|
const promise = this.enqueueRequest({
|
|
4043
4039
|
description: "Create Category",
|
|
4044
4040
|
method: HttpMethod.POST,
|
|
@@ -4047,10 +4043,10 @@ var __publicField = (obj, key, value) => {
|
|
|
4047
4043
|
workspace_id: workspaceId.toString()
|
|
4048
4044
|
},
|
|
4049
4045
|
payload: offlineCategory,
|
|
4050
|
-
blockers: [],
|
|
4046
|
+
blockers: [workspaceId],
|
|
4051
4047
|
blocks: [offlineCategory.offline_id]
|
|
4052
4048
|
});
|
|
4053
|
-
return [
|
|
4049
|
+
return [offlineCategory, promise];
|
|
4054
4050
|
}
|
|
4055
4051
|
update(category, workspaceId) {
|
|
4056
4052
|
const state = this.client.store.getState();
|
|
@@ -5701,48 +5697,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5701
5697
|
});
|
|
5702
5698
|
return [fullRevision, offlineFormRevisionAttachments, promise, attachmentsPromise];
|
|
5703
5699
|
}
|
|
5704
|
-
async favorite(formId, projectId) {
|
|
5705
|
-
const { store } = this.client;
|
|
5706
|
-
const state = store.getState();
|
|
5707
|
-
const form = state.formReducer.instances[formId];
|
|
5708
|
-
if (!form) {
|
|
5709
|
-
throw new Error(`Expected form to exist, got ${form}`);
|
|
5710
|
-
}
|
|
5711
|
-
this.dispatch(updateForm({ ...form, favorite: true }));
|
|
5712
|
-
try {
|
|
5713
|
-
await this.enqueueRequest({
|
|
5714
|
-
description: "Favorite form",
|
|
5715
|
-
method: HttpMethod.POST,
|
|
5716
|
-
url: `/forms/${formId}/favorite/${projectId}/`,
|
|
5717
|
-
blockers: [formId, `favorite-${formId}`],
|
|
5718
|
-
blocks: [`favorite-${formId}`]
|
|
5719
|
-
});
|
|
5720
|
-
} catch (e) {
|
|
5721
|
-
this.dispatch(updateForm(form));
|
|
5722
|
-
throw e;
|
|
5723
|
-
}
|
|
5724
|
-
}
|
|
5725
|
-
async unfavorite(formId, projectId) {
|
|
5726
|
-
const { store } = this.client;
|
|
5727
|
-
const state = store.getState();
|
|
5728
|
-
const form = state.formReducer.instances[formId];
|
|
5729
|
-
if (!form) {
|
|
5730
|
-
throw new Error(`Expected form to exist, got ${form}`);
|
|
5731
|
-
}
|
|
5732
|
-
this.dispatch(updateForm({ ...form, favorite: false }));
|
|
5733
|
-
try {
|
|
5734
|
-
return await this.enqueueRequest({
|
|
5735
|
-
description: "Unfavorite form",
|
|
5736
|
-
method: HttpMethod.DELETE,
|
|
5737
|
-
url: `/forms/${formId}/unfavorite/${projectId}/`,
|
|
5738
|
-
blockers: [formId, `favorite-${formId}`],
|
|
5739
|
-
blocks: [`favorite-${formId}`]
|
|
5740
|
-
});
|
|
5741
|
-
} catch (e) {
|
|
5742
|
-
this.dispatch(updateForm(form));
|
|
5743
|
-
throw e;
|
|
5744
|
-
}
|
|
5745
|
-
}
|
|
5746
5700
|
async delete(formId) {
|
|
5747
5701
|
const { store } = this.client;
|
|
5748
5702
|
const state = store.getState();
|
|
@@ -6203,13 +6157,19 @@ var __publicField = (obj, key, value) => {
|
|
|
6203
6157
|
}
|
|
6204
6158
|
}
|
|
6205
6159
|
class WorkspaceService extends BaseApiService {
|
|
6206
|
-
add(
|
|
6207
|
-
const
|
|
6160
|
+
add(payload) {
|
|
6161
|
+
const { store } = this.client;
|
|
6162
|
+
const createdBy = store.getState().userReducer.currentUser.id;
|
|
6163
|
+
const offlineWorkspace = offline({
|
|
6164
|
+
...payload,
|
|
6165
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6166
|
+
created_by: createdBy
|
|
6167
|
+
});
|
|
6208
6168
|
this.dispatch(addWorkspace(offlineWorkspace));
|
|
6209
6169
|
const promise = this.enqueueRequest({
|
|
6210
6170
|
description: "Create Workspace",
|
|
6211
6171
|
method: HttpMethod.POST,
|
|
6212
|
-
url: `/projects/${
|
|
6172
|
+
url: `/projects/${payload.project}/workspaces/`,
|
|
6213
6173
|
payload: offlineWorkspace,
|
|
6214
6174
|
blockers: ["add-workspace"],
|
|
6215
6175
|
blocks: [offlineWorkspace.offline_id]
|