@overmap-ai/core 1.0.52 → 1.0.53-fix-not-send-org-in-payload.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 +300 -33
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +300 -33
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/sdk.d.ts +2 -1
- package/dist/sdk/services/IssueService.d.ts +2 -2
- package/dist/sdk/services/IssueTypeService.d.ts +9 -0
- package/dist/sdk/services/UserFormService.d.ts +10 -2
- package/dist/sdk/services/index.d.ts +1 -0
- package/dist/store/slices/categorySlice.d.ts +1 -0
- package/dist/store/slices/documentSlice.d.ts +29 -56
- package/dist/store/slices/formRevisionSlice.d.ts +1 -0
- package/dist/store/slices/formSlice.d.ts +7 -0
- package/dist/store/slices/formSubmissionSlice.d.ts +2 -0
- package/dist/store/slices/index.d.ts +1 -0
- package/dist/store/slices/issueSlice.d.ts +6 -1
- package/dist/store/slices/issueTypeSlice.d.ts +20 -0
- package/dist/store/slices/projectFileSlice.d.ts +1 -0
- package/dist/store/slices/workspaceSlice.d.ts +1 -0
- package/dist/store/store.d.ts +4 -1
- package/dist/typings/models/attachments.d.ts +2 -3
- package/dist/typings/models/base.d.ts +4 -0
- package/dist/typings/models/documents.d.ts +3 -6
- package/dist/typings/models/forms.d.ts +3 -3
- package/dist/typings/models/index.d.ts +1 -0
- package/dist/typings/models/issueTypes.d.ts +8 -0
- package/dist/typings/models/issues.d.ts +4 -5
- package/dist/typings/models/organizations.d.ts +2 -3
- package/package.json +1 -1
|
@@ -668,15 +668,15 @@ var __publicField = (obj, key, value) => {
|
|
|
668
668
|
};
|
|
669
669
|
const migrations = [initialVersioning, signOut, signOut, createOutboxState];
|
|
670
670
|
const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
|
|
671
|
-
const initialState$
|
|
671
|
+
const initialState$r = {
|
|
672
672
|
accessToken: "",
|
|
673
673
|
refreshToken: "",
|
|
674
674
|
isLoggedIn: false
|
|
675
675
|
};
|
|
676
676
|
const authSlice = toolkit.createSlice({
|
|
677
677
|
name: "auth",
|
|
678
|
-
initialState: initialState$
|
|
679
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
678
|
+
initialState: initialState$r,
|
|
679
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$r)),
|
|
680
680
|
reducers: {
|
|
681
681
|
setTokens: (state, action) => {
|
|
682
682
|
state.accessToken = action.payload.accessToken;
|
|
@@ -1420,7 +1420,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1420
1420
|
return getLocalDateString(date);
|
|
1421
1421
|
return relative.format(days, "days");
|
|
1422
1422
|
});
|
|
1423
|
-
const initialState$
|
|
1423
|
+
const initialState$q = {
|
|
1424
1424
|
categories: {},
|
|
1425
1425
|
usedCategoryColors: [],
|
|
1426
1426
|
categoryVisibility: {
|
|
@@ -1430,8 +1430,8 @@ var __publicField = (obj, key, value) => {
|
|
|
1430
1430
|
};
|
|
1431
1431
|
const categorySlice = toolkit.createSlice({
|
|
1432
1432
|
name: "categories",
|
|
1433
|
-
initialState: initialState$
|
|
1434
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1433
|
+
initialState: initialState$q,
|
|
1434
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
|
|
1435
1435
|
reducers: {
|
|
1436
1436
|
setCategories: (state, action) => {
|
|
1437
1437
|
if (!Array.isArray(action.payload))
|
|
@@ -1603,14 +1603,14 @@ var __publicField = (obj, key, value) => {
|
|
|
1603
1603
|
delete state.attachments[attachmentId];
|
|
1604
1604
|
}
|
|
1605
1605
|
}
|
|
1606
|
-
const initialState$
|
|
1606
|
+
const initialState$p = {
|
|
1607
1607
|
components: {},
|
|
1608
1608
|
attachments: {}
|
|
1609
1609
|
};
|
|
1610
1610
|
const componentSlice = toolkit.createSlice({
|
|
1611
1611
|
name: "components",
|
|
1612
|
-
initialState: initialState$
|
|
1613
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1612
|
+
initialState: initialState$p,
|
|
1613
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
|
|
1614
1614
|
reducers: {
|
|
1615
1615
|
addComponent: (state, action) => {
|
|
1616
1616
|
state.components[action.payload.offline_id] = action.payload;
|
|
@@ -1766,13 +1766,13 @@ var __publicField = (obj, key, value) => {
|
|
|
1766
1766
|
removeAllComponentsOfType
|
|
1767
1767
|
} = componentSlice.actions;
|
|
1768
1768
|
const componentReducer = componentSlice.reducer;
|
|
1769
|
-
const initialState$
|
|
1769
|
+
const initialState$o = {
|
|
1770
1770
|
completionsByComponentId: {}
|
|
1771
1771
|
};
|
|
1772
1772
|
const componentStageCompletionSlice = toolkit.createSlice({
|
|
1773
1773
|
name: "componentStageCompletions",
|
|
1774
|
-
initialState: initialState$
|
|
1775
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1774
|
+
initialState: initialState$o,
|
|
1775
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
|
|
1776
1776
|
reducers: {
|
|
1777
1777
|
addStageCompletion: (state, action) => {
|
|
1778
1778
|
let stageToCompletionDateMapping = state.completionsByComponentId[action.payload.component];
|
|
@@ -1823,13 +1823,13 @@ var __publicField = (obj, key, value) => {
|
|
|
1823
1823
|
return Object.keys(state.componentStageCompletionReducer.completionsByComponentId[component.offline_id] ?? {});
|
|
1824
1824
|
};
|
|
1825
1825
|
const componentStageCompletionReducer = componentStageCompletionSlice.reducer;
|
|
1826
|
-
const initialState$
|
|
1826
|
+
const initialState$n = {
|
|
1827
1827
|
stages: {}
|
|
1828
1828
|
};
|
|
1829
1829
|
const componentStageSlice = toolkit.createSlice({
|
|
1830
1830
|
name: "componentStages",
|
|
1831
|
-
initialState: initialState$
|
|
1832
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1831
|
+
initialState: initialState$n,
|
|
1832
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
|
|
1833
1833
|
reducers: {
|
|
1834
1834
|
addStages: (state, action) => {
|
|
1835
1835
|
Object.assign(state.stages, toOfflineIdRecord(action.payload));
|
|
@@ -1939,15 +1939,15 @@ var __publicField = (obj, key, value) => {
|
|
|
1939
1939
|
);
|
|
1940
1940
|
const { addStages, updateStages, removeStages, linkStageToForm, unlinkStageToForm } = componentStageSlice.actions;
|
|
1941
1941
|
const componentStageReducer = componentStageSlice.reducer;
|
|
1942
|
-
const initialState$
|
|
1942
|
+
const initialState$m = {
|
|
1943
1943
|
componentTypes: {},
|
|
1944
1944
|
hiddenComponentTypeIds: {},
|
|
1945
1945
|
attachments: {}
|
|
1946
1946
|
};
|
|
1947
1947
|
const componentTypeSlice = toolkit.createSlice({
|
|
1948
1948
|
name: "componentTypes",
|
|
1949
|
-
initialState: initialState$
|
|
1950
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1949
|
+
initialState: initialState$m,
|
|
1950
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
|
|
1951
1951
|
reducers: {
|
|
1952
1952
|
addComponentType: (state, action) => {
|
|
1953
1953
|
state.componentTypes[action.payload.offline_id] = action.payload;
|
|
@@ -2058,13 +2058,13 @@ var __publicField = (obj, key, value) => {
|
|
|
2058
2058
|
deleteComponentType
|
|
2059
2059
|
} = componentTypeSlice.actions;
|
|
2060
2060
|
const componentTypeReducer = componentTypeSlice.reducer;
|
|
2061
|
-
const initialState$
|
|
2061
|
+
const initialState$l = {
|
|
2062
2062
|
workspaces: {},
|
|
2063
2063
|
activeWorkspaceId: null
|
|
2064
2064
|
};
|
|
2065
2065
|
const workspaceSlice = toolkit.createSlice({
|
|
2066
2066
|
name: "workspace",
|
|
2067
|
-
initialState: initialState$
|
|
2067
|
+
initialState: initialState$l,
|
|
2068
2068
|
// The `reducers` field lets us define reducers and generate associated actions
|
|
2069
2069
|
reducers: {
|
|
2070
2070
|
setWorkspaces: (state, action) => {
|
|
@@ -2121,7 +2121,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2121
2121
|
);
|
|
2122
2122
|
const workspaceReducer = workspaceSlice.reducer;
|
|
2123
2123
|
const maxRecentIssues = 10;
|
|
2124
|
-
const initialState$
|
|
2124
|
+
const initialState$k = {
|
|
2125
2125
|
issues: {},
|
|
2126
2126
|
attachments: {},
|
|
2127
2127
|
comments: {},
|
|
@@ -2133,9 +2133,9 @@ var __publicField = (obj, key, value) => {
|
|
|
2133
2133
|
};
|
|
2134
2134
|
const issueSlice = toolkit.createSlice({
|
|
2135
2135
|
name: "issues",
|
|
2136
|
-
initialState: initialState$
|
|
2136
|
+
initialState: initialState$k,
|
|
2137
2137
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
2138
|
-
Object.assign(state, initialState$
|
|
2138
|
+
Object.assign(state, initialState$k);
|
|
2139
2139
|
}),
|
|
2140
2140
|
reducers: {
|
|
2141
2141
|
setIssues: (state, action) => {
|
|
@@ -2166,6 +2166,16 @@ var __publicField = (obj, key, value) => {
|
|
|
2166
2166
|
}
|
|
2167
2167
|
state.issues[action.payload.offline_id] = action.payload;
|
|
2168
2168
|
},
|
|
2169
|
+
addIssues: (state, action) => {
|
|
2170
|
+
for (const issue of action.payload) {
|
|
2171
|
+
if (issue.offline_id in state.issues) {
|
|
2172
|
+
throw new Error(`Tried to add duplicate issue with ID: ${issue.offline_id}`);
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
for (const issue of action.payload) {
|
|
2176
|
+
state.issues[issue.offline_id] = issue;
|
|
2177
|
+
}
|
|
2178
|
+
},
|
|
2169
2179
|
addIssueAttachment: addAttachment,
|
|
2170
2180
|
addIssueAttachments: addAttachments,
|
|
2171
2181
|
addIssueUpdate: (state, action) => {
|
|
@@ -2197,6 +2207,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2197
2207
|
throw new Error(`Failed to remove issue because ID doesn't exist: ${action.payload}`);
|
|
2198
2208
|
}
|
|
2199
2209
|
},
|
|
2210
|
+
removeIssues: (state, action) => {
|
|
2211
|
+
for (const issueId of action.payload) {
|
|
2212
|
+
delete state.issues[issueId];
|
|
2213
|
+
}
|
|
2214
|
+
},
|
|
2200
2215
|
removeIssueAttachment: removeAttachment,
|
|
2201
2216
|
removeIssueUpdate: (state, action) => {
|
|
2202
2217
|
if (action.payload in state.updates) {
|
|
@@ -2301,6 +2316,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2301
2316
|
addIssueAttachment,
|
|
2302
2317
|
addIssueAttachments,
|
|
2303
2318
|
addIssue,
|
|
2319
|
+
addIssues,
|
|
2304
2320
|
addIssueUpdate,
|
|
2305
2321
|
addIssueUpdates,
|
|
2306
2322
|
addOrReplaceIssueComment,
|
|
@@ -2309,6 +2325,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2309
2325
|
removeIssueAttachment,
|
|
2310
2326
|
removeAttachmentsOfIssue,
|
|
2311
2327
|
removeIssue,
|
|
2328
|
+
removeIssues,
|
|
2312
2329
|
removeIssueUpdate,
|
|
2313
2330
|
removeIssueUpdates,
|
|
2314
2331
|
removeRecentIssue,
|
|
@@ -2543,6 +2560,80 @@ var __publicField = (obj, key, value) => {
|
|
|
2543
2560
|
}
|
|
2544
2561
|
);
|
|
2545
2562
|
const issueReducer = issueSlice.reducer;
|
|
2563
|
+
const initialState$j = {
|
|
2564
|
+
issueTypes: {}
|
|
2565
|
+
};
|
|
2566
|
+
const issueTypeSlice = toolkit.createSlice({
|
|
2567
|
+
name: "issueTypes",
|
|
2568
|
+
initialState: initialState$j,
|
|
2569
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
2570
|
+
Object.assign(state, initialState$j);
|
|
2571
|
+
}),
|
|
2572
|
+
reducers: {
|
|
2573
|
+
setIssueTypes: (state, action) => {
|
|
2574
|
+
for (const issueType of action.payload) {
|
|
2575
|
+
state.issueTypes[issueType.offline_id] = issueType;
|
|
2576
|
+
}
|
|
2577
|
+
},
|
|
2578
|
+
setIssueType: (state, action) => {
|
|
2579
|
+
state.issueTypes[action.payload.offline_id] = action.payload;
|
|
2580
|
+
},
|
|
2581
|
+
addIssueType: (state, action) => {
|
|
2582
|
+
if (action.payload.offline_id in state.issueTypes) {
|
|
2583
|
+
throw new Error(`IssueType with offline_id ${action.payload.offline_id} already exists in the store.`);
|
|
2584
|
+
}
|
|
2585
|
+
state.issueTypes[action.payload.offline_id] = action.payload;
|
|
2586
|
+
},
|
|
2587
|
+
updateIssueType: (state, action) => {
|
|
2588
|
+
if (!(action.payload.offline_id in state.issueTypes)) {
|
|
2589
|
+
throw new Error(`IssueType with offline_id ${action.payload.offline_id} does not exist in the store.`);
|
|
2590
|
+
}
|
|
2591
|
+
state.issueTypes[action.payload.offline_id] = action.payload;
|
|
2592
|
+
},
|
|
2593
|
+
removeIssueType: (state, action) => {
|
|
2594
|
+
if (!(action.payload in state.issueTypes)) {
|
|
2595
|
+
throw new Error(`IssueType with offline_id ${action.payload} does not exist in the store.`);
|
|
2596
|
+
}
|
|
2597
|
+
delete state.issueTypes[action.payload];
|
|
2598
|
+
}
|
|
2599
|
+
}
|
|
2600
|
+
});
|
|
2601
|
+
const { setIssueTypes, setIssueType, addIssueType, updateIssueType, removeIssueType } = issueTypeSlice.actions;
|
|
2602
|
+
const selectIssueTypeMapping = (state) => {
|
|
2603
|
+
return state.issueTypeReducer.issueTypes;
|
|
2604
|
+
};
|
|
2605
|
+
const selectIssueTypes = toolkit.createSelector(selectIssueTypeMapping, (issueTypes) => {
|
|
2606
|
+
return Object.values(issueTypes);
|
|
2607
|
+
});
|
|
2608
|
+
const selectIssueType = restructureCreateSelectorWithArgs(
|
|
2609
|
+
toolkit.createSelector(
|
|
2610
|
+
[selectIssueTypeMapping, (_, issueTypeId) => issueTypeId],
|
|
2611
|
+
(issueTypesMapping, issueTypeId) => {
|
|
2612
|
+
return issueTypesMapping[issueTypeId];
|
|
2613
|
+
}
|
|
2614
|
+
)
|
|
2615
|
+
);
|
|
2616
|
+
const selectIssueTypesOfOrganization = restructureCreateSelectorWithArgs(
|
|
2617
|
+
toolkit.createSelector(
|
|
2618
|
+
[selectIssueTypes, (_, organizationId) => organizationId],
|
|
2619
|
+
(issueTypes, organizationId) => {
|
|
2620
|
+
return issueTypes.filter((issueType) => issueType.organization === organizationId);
|
|
2621
|
+
}
|
|
2622
|
+
)
|
|
2623
|
+
);
|
|
2624
|
+
const selectIssuesOfIssueType = restructureCreateSelectorWithArgs(
|
|
2625
|
+
toolkit.createSelector(
|
|
2626
|
+
[(state) => state.issueReducer.issues, (_, issueTypeId) => issueTypeId],
|
|
2627
|
+
(issuesMapping, issueTypeId) => {
|
|
2628
|
+
return Object.values(issuesMapping).filter((issue) => issue.issue_type === issueTypeId);
|
|
2629
|
+
}
|
|
2630
|
+
)
|
|
2631
|
+
);
|
|
2632
|
+
const selectIssuesOfIssueTypeCount = (issueTypeId) => (state) => {
|
|
2633
|
+
var _a2;
|
|
2634
|
+
return ((_a2 = selectIssuesOfIssueType(issueTypeId)(state)) == null ? void 0 : _a2.length) ?? 0;
|
|
2635
|
+
};
|
|
2636
|
+
const issueTypeReducer = issueTypeSlice.reducer;
|
|
2546
2637
|
const initialState$i = {
|
|
2547
2638
|
s3Urls: {}
|
|
2548
2639
|
};
|
|
@@ -3771,6 +3862,14 @@ var __publicField = (obj, key, value) => {
|
|
|
3771
3862
|
}
|
|
3772
3863
|
)
|
|
3773
3864
|
);
|
|
3865
|
+
const selectFormOfIssueType = restructureCreateSelectorWithArgs(
|
|
3866
|
+
toolkit.createSelector(
|
|
3867
|
+
[selectFormMapping, (_state, issueTypeId) => issueTypeId],
|
|
3868
|
+
(userForms, issueTypeId) => {
|
|
3869
|
+
return Object.values(userForms).find((userForm) => userForm.issue_type === issueTypeId);
|
|
3870
|
+
}
|
|
3871
|
+
)
|
|
3872
|
+
);
|
|
3774
3873
|
const selectFormsCount = toolkit.createSelector([selectFormMapping], (userForms) => {
|
|
3775
3874
|
return Object.keys(userForms).length;
|
|
3776
3875
|
});
|
|
@@ -3936,6 +4035,43 @@ var __publicField = (obj, key, value) => {
|
|
|
3936
4035
|
}
|
|
3937
4036
|
)
|
|
3938
4037
|
);
|
|
4038
|
+
const selectFormSubmissionsByFormRevisions = toolkit.createSelector([selectFormRevisionMapping, selectFormSubmissions], (revisions, submissions) => {
|
|
4039
|
+
var _a2;
|
|
4040
|
+
const submissionMapping = {};
|
|
4041
|
+
for (const revisionId in revisions) {
|
|
4042
|
+
submissionMapping[revisionId] = [];
|
|
4043
|
+
}
|
|
4044
|
+
for (const submission of submissions) {
|
|
4045
|
+
(_a2 = submissionMapping[submission.form_revision]) == null ? void 0 : _a2.push(submission);
|
|
4046
|
+
}
|
|
4047
|
+
return submissionMapping;
|
|
4048
|
+
});
|
|
4049
|
+
const selectSortedFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
|
|
4050
|
+
toolkit.createSelector(
|
|
4051
|
+
[
|
|
4052
|
+
selectFormRevisionMapping,
|
|
4053
|
+
selectFormSubmissionsByFormRevisions,
|
|
4054
|
+
(_state, formId2) => formId2
|
|
4055
|
+
],
|
|
4056
|
+
(revisionsMapping, submissionsByRevision, formId2) => {
|
|
4057
|
+
const submissionsByFormRevisions = {};
|
|
4058
|
+
for (const revisionId in revisionsMapping) {
|
|
4059
|
+
const revision = revisionsMapping[revisionId];
|
|
4060
|
+
const submissionsOfRevision = submissionsByRevision[revisionId];
|
|
4061
|
+
if (revision && submissionsOfRevision && revision.form === formId2) {
|
|
4062
|
+
submissionsByFormRevisions[revisionId] = submissionsOfRevision.sort(
|
|
4063
|
+
(a, b) => a.submitted_at < b.submitted_at ? -1 : 1
|
|
4064
|
+
);
|
|
4065
|
+
}
|
|
4066
|
+
}
|
|
4067
|
+
return Object.entries(submissionsByFormRevisions).sort((a, b) => {
|
|
4068
|
+
const aRevision = revisionsMapping[a[0]];
|
|
4069
|
+
const bRevision = revisionsMapping[b[0]];
|
|
4070
|
+
return formRevisionSortFn(aRevision, bRevision);
|
|
4071
|
+
}).map(([_revisionId, submissions]) => submissions).flat();
|
|
4072
|
+
}
|
|
4073
|
+
)
|
|
4074
|
+
);
|
|
3939
4075
|
const selectFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
3940
4076
|
toolkit.createSelector(
|
|
3941
4077
|
[selectFormSubmissions, (_state, issueId) => issueId],
|
|
@@ -4338,6 +4474,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4338
4474
|
componentStageReducer,
|
|
4339
4475
|
componentTypeReducer,
|
|
4340
4476
|
issueReducer,
|
|
4477
|
+
issueTypeReducer,
|
|
4341
4478
|
mapReducer,
|
|
4342
4479
|
organizationReducer,
|
|
4343
4480
|
outboxReducer,
|
|
@@ -6282,7 +6419,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6282
6419
|
// Basic CRUD functions
|
|
6283
6420
|
// TODO: Once all models are represented in `Created<TModel>`, use `Created` in `OptimisticModelResult`, so we don't
|
|
6284
6421
|
// have to repeat it for all optimistic model results (all optimistic results are created).
|
|
6285
|
-
add(issue) {
|
|
6422
|
+
add(issue, issue_type = null) {
|
|
6286
6423
|
const { store } = this.client;
|
|
6287
6424
|
const dateWithoutMilliseconds = /* @__PURE__ */ new Date();
|
|
6288
6425
|
const state = store.getState();
|
|
@@ -6308,7 +6445,8 @@ var __publicField = (obj, key, value) => {
|
|
|
6308
6445
|
method: HttpMethod.POST,
|
|
6309
6446
|
url: "/issues/",
|
|
6310
6447
|
queryParams: {
|
|
6311
|
-
workspace_id: workspaceId
|
|
6448
|
+
workspace_id: workspaceId,
|
|
6449
|
+
...issue_type ? { issue_type } : {}
|
|
6312
6450
|
},
|
|
6313
6451
|
payload: issuePayload,
|
|
6314
6452
|
blockers: [
|
|
@@ -6493,6 +6631,103 @@ var __publicField = (obj, key, value) => {
|
|
|
6493
6631
|
store.dispatch(setIssues(result));
|
|
6494
6632
|
}
|
|
6495
6633
|
}
|
|
6634
|
+
class IssueTypeService extends BaseApiService {
|
|
6635
|
+
add(payload) {
|
|
6636
|
+
const { store } = this.client;
|
|
6637
|
+
const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
|
|
6638
|
+
if (!activeOrganizationId) {
|
|
6639
|
+
throw new Error(`No active organization, got ${activeOrganizationId} for activeOrganizationId.`);
|
|
6640
|
+
}
|
|
6641
|
+
const offlineIssueType = offline({
|
|
6642
|
+
...payload,
|
|
6643
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6644
|
+
created_by: store.getState().userReducer.currentUser.id,
|
|
6645
|
+
organization: activeOrganizationId
|
|
6646
|
+
});
|
|
6647
|
+
store.dispatch(addIssueType(offlineIssueType));
|
|
6648
|
+
const promise = this.enqueueRequest({
|
|
6649
|
+
method: HttpMethod.POST,
|
|
6650
|
+
url: `/organizations/${activeOrganizationId}/issue-types/`,
|
|
6651
|
+
// Sending only whats needed here
|
|
6652
|
+
payload: {
|
|
6653
|
+
offline_id: offlineIssueType.offline_id,
|
|
6654
|
+
submitted_at: offlineIssueType.submitted_at,
|
|
6655
|
+
icon: offlineIssueType.icon,
|
|
6656
|
+
icon_color: offlineIssueType.icon_color,
|
|
6657
|
+
name: offlineIssueType.name,
|
|
6658
|
+
description: offlineIssueType.description
|
|
6659
|
+
},
|
|
6660
|
+
blockers: [],
|
|
6661
|
+
blocks: [offlineIssueType.offline_id]
|
|
6662
|
+
});
|
|
6663
|
+
promise.then((createdIssueType) => {
|
|
6664
|
+
store.dispatch(setIssueType(createdIssueType));
|
|
6665
|
+
}).catch(() => {
|
|
6666
|
+
store.dispatch(removeIssueType(offlineIssueType.offline_id));
|
|
6667
|
+
});
|
|
6668
|
+
return [offlineIssueType, promise];
|
|
6669
|
+
}
|
|
6670
|
+
update(issueTypeFields) {
|
|
6671
|
+
const { store } = this.client;
|
|
6672
|
+
const issueTypeToBeUpdated = store.getState().issueTypeReducer.issueTypes[issueTypeFields.offline_id];
|
|
6673
|
+
if (!issueTypeToBeUpdated) {
|
|
6674
|
+
throw new Error(`IssueType with offline_id ${issueTypeFields.offline_id} does not exist in the store.`);
|
|
6675
|
+
}
|
|
6676
|
+
const offlineUpdatedIssueType = {
|
|
6677
|
+
...issueTypeToBeUpdated,
|
|
6678
|
+
...issueTypeFields
|
|
6679
|
+
};
|
|
6680
|
+
store.dispatch(updateIssueType(offlineUpdatedIssueType));
|
|
6681
|
+
const promise = this.enqueueRequest({
|
|
6682
|
+
method: HttpMethod.PATCH,
|
|
6683
|
+
url: `/issues/types/${issueTypeFields.offline_id}/`,
|
|
6684
|
+
payload: issueTypeFields,
|
|
6685
|
+
blockers: [issueTypeFields.offline_id],
|
|
6686
|
+
blocks: [issueTypeFields.offline_id]
|
|
6687
|
+
});
|
|
6688
|
+
promise.then((updatedIssueType) => {
|
|
6689
|
+
store.dispatch(setIssueType(updatedIssueType));
|
|
6690
|
+
}).catch(() => {
|
|
6691
|
+
store.dispatch(setIssueType(issueTypeToBeUpdated));
|
|
6692
|
+
});
|
|
6693
|
+
return [offlineUpdatedIssueType, promise];
|
|
6694
|
+
}
|
|
6695
|
+
delete(issueTypeId) {
|
|
6696
|
+
const { store } = this.client;
|
|
6697
|
+
const issueTypeToDelete = store.getState().issueTypeReducer.issueTypes[issueTypeId];
|
|
6698
|
+
if (!issueTypeToDelete) {
|
|
6699
|
+
throw new Error(`IssueType with offline_id ${issueTypeId} does not exist in the store.`);
|
|
6700
|
+
}
|
|
6701
|
+
const issuesOfIssueType = selectIssuesOfIssueType(issueTypeId)(store.getState()) ?? [];
|
|
6702
|
+
store.dispatch(removeIssueType(issueTypeId));
|
|
6703
|
+
store.dispatch(removeIssues(issuesOfIssueType.map((issue) => issue.offline_id)));
|
|
6704
|
+
const promise = this.enqueueRequest({
|
|
6705
|
+
method: HttpMethod.DELETE,
|
|
6706
|
+
url: `/issues/types/${issueTypeId}/`,
|
|
6707
|
+
blockers: [issueTypeId],
|
|
6708
|
+
blocks: []
|
|
6709
|
+
});
|
|
6710
|
+
promise.catch(() => {
|
|
6711
|
+
store.dispatch(setIssueType(issueTypeToDelete));
|
|
6712
|
+
store.dispatch(addIssues(issuesOfIssueType));
|
|
6713
|
+
});
|
|
6714
|
+
return promise;
|
|
6715
|
+
}
|
|
6716
|
+
async refreshStore() {
|
|
6717
|
+
const { store } = this.client;
|
|
6718
|
+
const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
|
|
6719
|
+
if (!activeOrganizationId) {
|
|
6720
|
+
throw new Error(`No active organization, got ${activeOrganizationId} for activeOrganizationId.`);
|
|
6721
|
+
}
|
|
6722
|
+
const result = await this.enqueueRequest({
|
|
6723
|
+
method: HttpMethod.GET,
|
|
6724
|
+
url: `/organizations/${activeOrganizationId}/issue-types/`,
|
|
6725
|
+
blockers: [],
|
|
6726
|
+
blocks: []
|
|
6727
|
+
});
|
|
6728
|
+
store.dispatch(setIssueTypes(result));
|
|
6729
|
+
}
|
|
6730
|
+
}
|
|
6496
6731
|
class MainService extends BaseApiService {
|
|
6497
6732
|
async fetchInitialData(replaceExisting, uuid2) {
|
|
6498
6733
|
if (replaceExisting) {
|
|
@@ -6668,6 +6903,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6668
6903
|
});
|
|
6669
6904
|
void this.client.documents.refreshStore();
|
|
6670
6905
|
void this.client.issueUpdates.refreshStore();
|
|
6906
|
+
void this.client.issueTypes.refreshStore();
|
|
6671
6907
|
}
|
|
6672
6908
|
store.dispatch(setIsFetchingInitialData(false));
|
|
6673
6909
|
if (overwrite) {
|
|
@@ -7037,7 +7273,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7037
7273
|
});
|
|
7038
7274
|
});
|
|
7039
7275
|
}
|
|
7040
|
-
async add(state, initialRevision, url, ownerUser, ownerOrganization, componentTypeId) {
|
|
7276
|
+
async add(state, initialRevision, url, ownerUser, ownerOrganization, componentTypeId, issueTypeId) {
|
|
7041
7277
|
if (!!ownerUser === !!ownerOrganization) {
|
|
7042
7278
|
throw new Error("Exactly one of ownerUser and ownerOrganization must be defined.");
|
|
7043
7279
|
}
|
|
@@ -7048,7 +7284,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7048
7284
|
const currentUser = state.userReducer.currentUser;
|
|
7049
7285
|
const activeWorkspaceId = state.workspaceReducer.activeWorkspaceId;
|
|
7050
7286
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7051
|
-
const offlineFormPayload = offline({});
|
|
7287
|
+
const offlineFormPayload = offline({ ...ownerAttrs });
|
|
7052
7288
|
const offlineRevisionPayload = offline({ ...initialRevision, submitted_at: submittedAt });
|
|
7053
7289
|
const retForm = {
|
|
7054
7290
|
...offlineFormPayload,
|
|
@@ -7057,6 +7293,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7057
7293
|
submitted_at: submittedAt,
|
|
7058
7294
|
created_by: currentUser.id,
|
|
7059
7295
|
...componentTypeId && { component_type: componentTypeId },
|
|
7296
|
+
...issueTypeId && { issue_type: issueTypeId },
|
|
7060
7297
|
...ownerAttrs
|
|
7061
7298
|
};
|
|
7062
7299
|
const { payloadWithoutImage, images } = await separateImageFromFields(offlineRevisionPayload);
|
|
@@ -7080,9 +7317,10 @@ var __publicField = (obj, key, value) => {
|
|
|
7080
7317
|
payload: {
|
|
7081
7318
|
...offlineFormPayload,
|
|
7082
7319
|
...componentTypeId && { component_type: componentTypeId },
|
|
7320
|
+
...issueTypeId && { issue_type: issueTypeId },
|
|
7083
7321
|
initial_revision: payloadWithoutImage
|
|
7084
7322
|
},
|
|
7085
|
-
blockers: componentTypeId ? [componentTypeId] : [],
|
|
7323
|
+
blockers: componentTypeId ? [componentTypeId] : issueTypeId ? [issueTypeId] : [],
|
|
7086
7324
|
blocks: [offlineFormPayload.offline_id, payloadWithoutImage.offline_id]
|
|
7087
7325
|
});
|
|
7088
7326
|
const attachImagesPromises = this.getAttachImagePromises(images, offlineRevisionPayload.offline_id);
|
|
@@ -7094,7 +7332,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7094
7332
|
const settledPromise = Promise.all([formPromise, ...attachImagesPromises]).then(() => formPromise);
|
|
7095
7333
|
return [retForm, retRevision, formPromise, settledPromise];
|
|
7096
7334
|
}
|
|
7097
|
-
async addForOrganization(initialRevision,
|
|
7335
|
+
async addForOrganization(initialRevision, attachedTo) {
|
|
7098
7336
|
const state = this.client.store.getState();
|
|
7099
7337
|
const activeOrganizationId = state.organizationReducer.activeOrganizationId;
|
|
7100
7338
|
if (!activeOrganizationId) {
|
|
@@ -7106,13 +7344,22 @@ var __publicField = (obj, key, value) => {
|
|
|
7106
7344
|
`/forms/in-organization/${activeOrganizationId}/`,
|
|
7107
7345
|
void 0,
|
|
7108
7346
|
activeOrganizationId,
|
|
7109
|
-
componentTypeId
|
|
7347
|
+
attachedTo && "componentTypeId" in attachedTo ? attachedTo.componentTypeId : void 0,
|
|
7348
|
+
attachedTo && "issueTypeId" in attachedTo ? attachedTo.issueTypeId : void 0
|
|
7110
7349
|
);
|
|
7111
7350
|
}
|
|
7112
|
-
async addForCurrentUser(initialRevision,
|
|
7351
|
+
async addForCurrentUser(initialRevision, attachedTo) {
|
|
7113
7352
|
const state = this.client.store.getState();
|
|
7114
7353
|
const currentUser = state.userReducer.currentUser;
|
|
7115
|
-
return await this.add(
|
|
7354
|
+
return await this.add(
|
|
7355
|
+
state,
|
|
7356
|
+
initialRevision,
|
|
7357
|
+
"/forms/my-forms/",
|
|
7358
|
+
currentUser.id,
|
|
7359
|
+
void 0,
|
|
7360
|
+
attachedTo && "componentTypeId" in attachedTo ? attachedTo.componentTypeId : void 0,
|
|
7361
|
+
attachedTo && "issueTypeId" in attachedTo ? attachedTo.issueTypeId : void 0
|
|
7362
|
+
);
|
|
7116
7363
|
}
|
|
7117
7364
|
async createRevision(formId2, revision) {
|
|
7118
7365
|
const offlineRevision = offline(revision);
|
|
@@ -8392,6 +8639,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8392
8639
|
__publicField(this, "organizations", new OrganizationService(this));
|
|
8393
8640
|
__publicField(this, "organizationAccess", new OrganizationAccessService(this));
|
|
8394
8641
|
__publicField(this, "issues", new IssueService(this));
|
|
8642
|
+
__publicField(this, "issueTypes", new IssueTypeService(this));
|
|
8395
8643
|
__publicField(this, "issueComments", new IssueCommentService(this));
|
|
8396
8644
|
__publicField(this, "issueUpdates", new IssueUpdateService(this));
|
|
8397
8645
|
__publicField(this, "workspaces", new WorkspaceService(this));
|
|
@@ -14834,7 +15082,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14834
15082
|
}, [filter, maxResults, ownerFilter]);
|
|
14835
15083
|
const userForms = useAppSelector(selectFilteredForms(ownerFilterOptions)) ?? [];
|
|
14836
15084
|
const userFormMapping = useAppSelector(selectFormMapping);
|
|
14837
|
-
const attachableUserForms = userForms.filter((form) => !form.component_type);
|
|
15085
|
+
const attachableUserForms = userForms.filter((form) => !form.component_type && !form.issue_type);
|
|
14838
15086
|
const attachableUserFormMapping = Object.values(userFormMapping).filter(
|
|
14839
15087
|
(form) => !form.component_type
|
|
14840
15088
|
);
|
|
@@ -16287,6 +16535,7 @@ var __publicField = (obj, key, value) => {
|
|
|
16287
16535
|
exports2.IssuePriority = IssuePriority;
|
|
16288
16536
|
exports2.IssueService = IssueService;
|
|
16289
16537
|
exports2.IssueStatus = IssueStatus;
|
|
16538
|
+
exports2.IssueTypeService = IssueTypeService;
|
|
16290
16539
|
exports2.IssueUpdateChange = IssueUpdateChange;
|
|
16291
16540
|
exports2.IssueUpdateService = IssueUpdateService;
|
|
16292
16541
|
exports2.LicenseLevel = LicenseLevel;
|
|
@@ -16371,8 +16620,10 @@ var __publicField = (obj, key, value) => {
|
|
|
16371
16620
|
exports2.addIssueAttachments = addIssueAttachments;
|
|
16372
16621
|
exports2.addIssueComment = addIssueComment;
|
|
16373
16622
|
exports2.addIssueComments = addIssueComments;
|
|
16623
|
+
exports2.addIssueType = addIssueType;
|
|
16374
16624
|
exports2.addIssueUpdate = addIssueUpdate;
|
|
16375
16625
|
exports2.addIssueUpdates = addIssueUpdates;
|
|
16626
|
+
exports2.addIssues = addIssues;
|
|
16376
16627
|
exports2.addLicenses = addLicenses;
|
|
16377
16628
|
exports2.addOrReplaceCategories = addOrReplaceCategories;
|
|
16378
16629
|
exports2.addOrReplaceIssueComment = addOrReplaceIssueComment;
|
|
@@ -16484,6 +16735,8 @@ var __publicField = (obj, key, value) => {
|
|
|
16484
16735
|
exports2.issueReducer = issueReducer;
|
|
16485
16736
|
exports2.issueSlice = issueSlice;
|
|
16486
16737
|
exports2.issueToSearchResult = issueToSearchResult;
|
|
16738
|
+
exports2.issueTypeReducer = issueTypeReducer;
|
|
16739
|
+
exports2.issueTypeSlice = issueTypeSlice;
|
|
16487
16740
|
exports2.licenseReducer = licenseReducer;
|
|
16488
16741
|
exports2.licenseSlice = licenseSlice;
|
|
16489
16742
|
exports2.linkStageToForm = linkStageToForm;
|
|
@@ -16542,8 +16795,10 @@ var __publicField = (obj, key, value) => {
|
|
|
16542
16795
|
exports2.removeIssueAttachment = removeIssueAttachment;
|
|
16543
16796
|
exports2.removeIssueComment = removeIssueComment;
|
|
16544
16797
|
exports2.removeIssueComments = removeIssueComments;
|
|
16798
|
+
exports2.removeIssueType = removeIssueType;
|
|
16545
16799
|
exports2.removeIssueUpdate = removeIssueUpdate;
|
|
16546
16800
|
exports2.removeIssueUpdates = removeIssueUpdates;
|
|
16801
|
+
exports2.removeIssues = removeIssues;
|
|
16547
16802
|
exports2.removeOrganizationAccess = removeOrganizationAccess;
|
|
16548
16803
|
exports2.removeProjectAccess = removeProjectAccess;
|
|
16549
16804
|
exports2.removeProjectAccessesOfProject = removeProjectAccessesOfProject;
|
|
@@ -16647,6 +16902,7 @@ var __publicField = (obj, key, value) => {
|
|
|
16647
16902
|
exports2.selectForm = selectForm;
|
|
16648
16903
|
exports2.selectFormMapping = selectFormMapping;
|
|
16649
16904
|
exports2.selectFormOfComponentType = selectFormOfComponentType;
|
|
16905
|
+
exports2.selectFormOfIssueType = selectFormOfIssueType;
|
|
16650
16906
|
exports2.selectFormRevision = selectFormRevision;
|
|
16651
16907
|
exports2.selectFormRevisionMapping = selectFormRevisionMapping;
|
|
16652
16908
|
exports2.selectFormRevisions = selectFormRevisions;
|
|
@@ -16655,6 +16911,7 @@ var __publicField = (obj, key, value) => {
|
|
|
16655
16911
|
exports2.selectFormSubmissionAttachmentsMapping = selectFormSubmissionAttachmentsMapping;
|
|
16656
16912
|
exports2.selectFormSubmissions = selectFormSubmissions;
|
|
16657
16913
|
exports2.selectFormSubmissionsByComponents = selectFormSubmissionsByComponents;
|
|
16914
|
+
exports2.selectFormSubmissionsByFormRevisions = selectFormSubmissionsByFormRevisions;
|
|
16658
16915
|
exports2.selectFormSubmissionsMapping = selectFormSubmissionsMapping;
|
|
16659
16916
|
exports2.selectFormSubmissionsOfComponent = selectFormSubmissionsOfComponent;
|
|
16660
16917
|
exports2.selectFormSubmissionsOfForm = selectFormSubmissionsOfForm;
|
|
@@ -16673,9 +16930,15 @@ var __publicField = (obj, key, value) => {
|
|
|
16673
16930
|
exports2.selectIssueAttachments = selectIssueAttachments;
|
|
16674
16931
|
exports2.selectIssueCountOfCategory = selectIssueCountOfCategory;
|
|
16675
16932
|
exports2.selectIssueMapping = selectIssueMapping;
|
|
16933
|
+
exports2.selectIssueType = selectIssueType;
|
|
16934
|
+
exports2.selectIssueTypeMapping = selectIssueTypeMapping;
|
|
16935
|
+
exports2.selectIssueTypes = selectIssueTypes;
|
|
16936
|
+
exports2.selectIssueTypesOfOrganization = selectIssueTypesOfOrganization;
|
|
16676
16937
|
exports2.selectIssueUpdateMapping = selectIssueUpdateMapping;
|
|
16677
16938
|
exports2.selectIssueUpdatesOfIssue = selectIssueUpdatesOfIssue;
|
|
16678
16939
|
exports2.selectIssues = selectIssues;
|
|
16940
|
+
exports2.selectIssuesOfIssueType = selectIssuesOfIssueType;
|
|
16941
|
+
exports2.selectIssuesOfIssueTypeCount = selectIssuesOfIssueTypeCount;
|
|
16679
16942
|
exports2.selectLatestFormRevisionByForm = selectLatestFormRevisionByForm;
|
|
16680
16943
|
exports2.selectLatestFormRevisionOfForm = selectLatestFormRevisionOfForm;
|
|
16681
16944
|
exports2.selectLatestFormRevisionsOfComponentTypes = selectLatestFormRevisionsOfComponentTypes;
|
|
@@ -16718,6 +16981,7 @@ var __publicField = (obj, key, value) => {
|
|
|
16718
16981
|
exports2.selectRootDocuments = selectRootDocuments;
|
|
16719
16982
|
exports2.selectShowTooltips = selectShowTooltips;
|
|
16720
16983
|
exports2.selectSortedEmailDomains = selectSortedEmailDomains;
|
|
16984
|
+
exports2.selectSortedFormSubmissionsOfForm = selectSortedFormSubmissionsOfForm;
|
|
16721
16985
|
exports2.selectSortedOrganizationLicenses = selectSortedOrganizationLicenses;
|
|
16722
16986
|
exports2.selectSortedOrganizationUsers = selectSortedOrganizationUsers;
|
|
16723
16987
|
exports2.selectSortedProjectUsers = selectSortedProjectUsers;
|
|
@@ -16777,6 +17041,8 @@ var __publicField = (obj, key, value) => {
|
|
|
16777
17041
|
exports2.setIssueAttachments = setIssueAttachments;
|
|
16778
17042
|
exports2.setIssueComment = setIssueComment;
|
|
16779
17043
|
exports2.setIssueComments = setIssueComments;
|
|
17044
|
+
exports2.setIssueType = setIssueType;
|
|
17045
|
+
exports2.setIssueTypes = setIssueTypes;
|
|
16780
17046
|
exports2.setIssueUpdates = setIssueUpdates;
|
|
16781
17047
|
exports2.setIssues = setIssues;
|
|
16782
17048
|
exports2.setLicenses = setLicenses;
|
|
@@ -16828,6 +17094,7 @@ var __publicField = (obj, key, value) => {
|
|
|
16828
17094
|
exports2.updateFormSubmissions = updateFormSubmissions;
|
|
16829
17095
|
exports2.updateIssue = updateIssue;
|
|
16830
17096
|
exports2.updateIssueAttachment = updateIssueAttachment;
|
|
17097
|
+
exports2.updateIssueType = updateIssueType;
|
|
16831
17098
|
exports2.updateLicense = updateLicense;
|
|
16832
17099
|
exports2.updateOrCreateProject = updateOrCreateProject;
|
|
16833
17100
|
exports2.updateOrganizationAccess = updateOrganizationAccess;
|