@overmap-ai/core 1.0.71-fields.8 → 1.0.71-org-projs-only.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 +1039 -1955
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +1039 -1955
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/services/AssetAttachmentService.d.ts +8 -32
- package/dist/sdk/services/AssetTypeAttachmentService.d.ts +9 -32
- package/dist/sdk/services/BaseAttachmentService.d.ts +20 -18
- package/dist/sdk/services/BaseUploadService.d.ts +1 -2
- package/dist/sdk/services/DocumentAttachmentService.d.ts +8 -30
- package/dist/sdk/services/FormService.d.ts +15 -13
- package/dist/sdk/services/FormSubmissionService.d.ts +29 -10
- package/dist/sdk/services/GeoImageService.d.ts +1 -1
- package/dist/sdk/services/IssueAssociationService.d.ts +2 -2
- package/dist/sdk/services/IssueAttachmentService.d.ts +8 -31
- package/dist/sdk/services/IssueService.d.ts +3 -0
- package/dist/sdk/services/ProjectAttachmentService.d.ts +8 -31
- package/dist/sdk/services/TeamService.d.ts +1 -1
- package/dist/sdk/services/WorkspaceService.d.ts +1 -1
- package/dist/sdk/services/index.d.ts +0 -11
- package/dist/store/slices/formRevisionSlice.d.ts +15 -14
- package/dist/store/slices/formSlice.d.ts +5 -1
- package/dist/store/slices/formSubmissionSlice.d.ts +6 -0
- package/dist/store/slices/index.d.ts +0 -8
- package/dist/store/store.d.ts +1 -9
- package/dist/typings/files.d.ts +4 -8
- package/dist/typings/models/assets.d.ts +0 -15
- package/dist/typings/models/attachments.d.ts +6 -1
- package/dist/typings/models/forms.d.ts +113 -12
- package/dist/typings/models/index.d.ts +0 -1
- package/dist/typings/models/issues.d.ts +0 -15
- package/dist/typings/models/store.d.ts +1 -9
- package/dist/utils/file.d.ts +2 -2
- package/package.json +3 -5
- package/dist/sdk/services/AssetTypeFieldValuesAttachmentService.d.ts +0 -12
- package/dist/sdk/services/AssetTypeFieldValuesService.d.ts +0 -20
- package/dist/sdk/services/AssetTypeFieldsAttachmentService.d.ts +0 -12
- package/dist/sdk/services/AssetTypeFieldsService.d.ts +0 -8
- package/dist/sdk/services/FormRevisionAttachmentService.d.ts +0 -12
- package/dist/sdk/services/FormRevisionService.d.ts +0 -8
- package/dist/sdk/services/FormSubmissionAttachmentService.d.ts +0 -13
- package/dist/sdk/services/IssueTypeFieldValuesAttachmentService.d.ts +0 -13
- package/dist/sdk/services/IssueTypeFieldValuesService.d.ts +0 -10
- package/dist/sdk/services/IssueTypeFieldsAttachmentService.d.ts +0 -12
- package/dist/sdk/services/IssueTypeFieldsService.d.ts +0 -8
- package/dist/store/slices/assetTypeFieldValuesAttachmentSlice.d.ts +0 -52
- package/dist/store/slices/assetTypeFieldValuesSlice.d.ts +0 -53
- package/dist/store/slices/assetTypeFieldsAttachmentSlice.d.ts +0 -52
- package/dist/store/slices/assetTypeFieldsSlice.d.ts +0 -53
- package/dist/store/slices/issueTypeFieldValuesAttachmentSlice.d.ts +0 -52
- package/dist/store/slices/issueTypeFieldValuesSlice.d.ts +0 -52
- package/dist/store/slices/issueTypeFieldsAttachmentSlice.d.ts +0 -52
- package/dist/store/slices/issueTypeFieldsSlice.d.ts +0 -54
- package/dist/typings/models/fields.d.ts +0 -16
package/dist/overmap-core.js
CHANGED
|
@@ -758,15 +758,15 @@ const wrapMigration = (migrator) => (state) => {
|
|
|
758
758
|
};
|
|
759
759
|
const migrations = [initialVersioning, signOut, signOut, createOutboxState];
|
|
760
760
|
const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
|
|
761
|
-
const initialState$
|
|
761
|
+
const initialState$B = {
|
|
762
762
|
accessToken: "",
|
|
763
763
|
refreshToken: "",
|
|
764
764
|
isLoggedIn: false
|
|
765
765
|
};
|
|
766
766
|
const authSlice = createSlice({
|
|
767
767
|
name: "auth",
|
|
768
|
-
initialState: initialState$
|
|
769
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
768
|
+
initialState: initialState$B,
|
|
769
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$B)),
|
|
770
770
|
reducers: {
|
|
771
771
|
setTokens: (state, action) => {
|
|
772
772
|
state.accessToken = action.payload.accessToken;
|
|
@@ -854,11 +854,11 @@ function createModelAdapter(computeModelId) {
|
|
|
854
854
|
};
|
|
855
855
|
}
|
|
856
856
|
const categoryAdapter = createModelAdapter((category) => category.offline_id);
|
|
857
|
-
const initialState$
|
|
857
|
+
const initialState$A = categoryAdapter.getInitialState({});
|
|
858
858
|
const categorySlice = createSlice({
|
|
859
859
|
name: "categories",
|
|
860
|
-
initialState: initialState$
|
|
861
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
860
|
+
initialState: initialState$A,
|
|
861
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$A)),
|
|
862
862
|
reducers: {
|
|
863
863
|
initializeCategories: categoryAdapter.initialize,
|
|
864
864
|
addCategory: categoryAdapter.addOne,
|
|
@@ -902,11 +902,11 @@ const selectIssueCountOfCategory = (categoryId) => (state) => {
|
|
|
902
902
|
};
|
|
903
903
|
const categoryReducer = categorySlice.reducer;
|
|
904
904
|
const assetAdapter = createModelAdapter((asset) => asset.offline_id);
|
|
905
|
-
const initialState$
|
|
905
|
+
const initialState$z = assetAdapter.getInitialState({});
|
|
906
906
|
const assetSlice = createSlice({
|
|
907
907
|
name: "assets",
|
|
908
|
-
initialState: initialState$
|
|
909
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
908
|
+
initialState: initialState$z,
|
|
909
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
|
|
910
910
|
reducers: {
|
|
911
911
|
initializeAssets: assetAdapter.initialize,
|
|
912
912
|
addAsset: assetAdapter.addOne,
|
|
@@ -958,11 +958,11 @@ const selectNumberOfAssetsOfAssetType = (assetTypeId) => (state) => {
|
|
|
958
958
|
};
|
|
959
959
|
const assetReducer = assetSlice.reducer;
|
|
960
960
|
const assetAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
961
|
-
const initialState$
|
|
961
|
+
const initialState$y = assetAttachmentAdapter.getInitialState({});
|
|
962
962
|
const assetAttachmentSlice = createSlice({
|
|
963
963
|
name: "assetAttachments",
|
|
964
|
-
initialState: initialState$
|
|
965
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
964
|
+
initialState: initialState$y,
|
|
965
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
|
|
966
966
|
reducers: {
|
|
967
967
|
initializeAssetAttachments: assetAttachmentAdapter.initialize,
|
|
968
968
|
addAssetAttachment: assetAttachmentAdapter.addOne,
|
|
@@ -1023,11 +1023,11 @@ const assetAttachmentReducer = assetAttachmentSlice.reducer;
|
|
|
1023
1023
|
const assetStageCompletionAdapter = createModelAdapter(
|
|
1024
1024
|
(stageCompletion) => stageCompletion.offline_id
|
|
1025
1025
|
);
|
|
1026
|
-
const initialState$
|
|
1026
|
+
const initialState$x = assetStageCompletionAdapter.getInitialState({});
|
|
1027
1027
|
const assetStageCompletionSlice = createSlice({
|
|
1028
1028
|
name: "assetStageCompletions",
|
|
1029
|
-
initialState: initialState$
|
|
1030
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1029
|
+
initialState: initialState$x,
|
|
1030
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
|
|
1031
1031
|
reducers: {
|
|
1032
1032
|
initializeAssetStageCompletions: assetStageCompletionAdapter.initialize,
|
|
1033
1033
|
addAssetStageCompletion: assetStageCompletionAdapter.addOne,
|
|
@@ -1089,11 +1089,11 @@ const selectAssetStageCompletionsByIds = restructureCreateSelectorWithArgs(
|
|
|
1089
1089
|
);
|
|
1090
1090
|
const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
|
|
1091
1091
|
const assetStageAdapter = createModelAdapter((assetStage) => assetStage.offline_id);
|
|
1092
|
-
const initialState$
|
|
1092
|
+
const initialState$w = assetStageAdapter.getInitialState({});
|
|
1093
1093
|
const assetStageSlice = createSlice({
|
|
1094
1094
|
name: "assetStages",
|
|
1095
|
-
initialState: initialState$
|
|
1096
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1095
|
+
initialState: initialState$w,
|
|
1096
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
|
|
1097
1097
|
reducers: {
|
|
1098
1098
|
initializeAssetStages: assetStageAdapter.initialize,
|
|
1099
1099
|
setAssetStage: assetStageAdapter.setOne,
|
|
@@ -1173,11 +1173,11 @@ const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
|
|
|
1173
1173
|
})
|
|
1174
1174
|
);
|
|
1175
1175
|
const assetTypeAdapter = createModelAdapter((assetType) => assetType.offline_id);
|
|
1176
|
-
const initialState$
|
|
1176
|
+
const initialState$v = assetTypeAdapter.getInitialState({});
|
|
1177
1177
|
const assetTypeSlice = createSlice({
|
|
1178
1178
|
name: "assetTypes",
|
|
1179
|
-
initialState: initialState$
|
|
1180
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1179
|
+
initialState: initialState$v,
|
|
1180
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
|
|
1181
1181
|
reducers: {
|
|
1182
1182
|
initializeAssetTypes: assetTypeAdapter.initialize,
|
|
1183
1183
|
setAssetType: assetTypeAdapter.setOne,
|
|
@@ -1230,11 +1230,11 @@ const assetTypeReducer = assetTypeSlice.reducer;
|
|
|
1230
1230
|
const assetTypeAttachmentAdapter = createModelAdapter(
|
|
1231
1231
|
(attachment) => attachment.offline_id
|
|
1232
1232
|
);
|
|
1233
|
-
const initialState$
|
|
1233
|
+
const initialState$u = assetTypeAttachmentAdapter.getInitialState({});
|
|
1234
1234
|
const assetTypeAttachmentSlice = createSlice({
|
|
1235
1235
|
name: "assetTypeAttachments",
|
|
1236
|
-
initialState: initialState$
|
|
1237
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1236
|
+
initialState: initialState$u,
|
|
1237
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$u)),
|
|
1238
1238
|
reducers: {
|
|
1239
1239
|
initializeAssetTypeAttachments: assetTypeAttachmentAdapter.initialize,
|
|
1240
1240
|
addAssetTypeAttachment: assetTypeAttachmentAdapter.addOne,
|
|
@@ -1293,12 +1293,12 @@ const selectAttachmentsOfAssetTypeByType = restructureCreateSelectorWithArgs(
|
|
|
1293
1293
|
);
|
|
1294
1294
|
const assetTypeAttachmentReducer = assetTypeAttachmentSlice.reducer;
|
|
1295
1295
|
const issueAdapter = createModelAdapter((issue) => issue.offline_id);
|
|
1296
|
-
const initialState$
|
|
1296
|
+
const initialState$t = issueAdapter.getInitialState({});
|
|
1297
1297
|
const issueSlice = createSlice({
|
|
1298
1298
|
name: "issues",
|
|
1299
|
-
initialState: initialState$
|
|
1299
|
+
initialState: initialState$t,
|
|
1300
1300
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
1301
|
-
Object.assign(state, initialState$
|
|
1301
|
+
Object.assign(state, initialState$t);
|
|
1302
1302
|
}),
|
|
1303
1303
|
reducers: {
|
|
1304
1304
|
initializeIssues: issueAdapter.initialize,
|
|
@@ -1330,12 +1330,12 @@ const selectIssuesByIds = restructureCreateSelectorWithArgs(
|
|
|
1330
1330
|
);
|
|
1331
1331
|
const issueReducer = issueSlice.reducer;
|
|
1332
1332
|
const issueTypeAdapter = createModelAdapter((issueType) => issueType.offline_id);
|
|
1333
|
-
const initialState$
|
|
1333
|
+
const initialState$s = issueTypeAdapter.getInitialState({});
|
|
1334
1334
|
const issueTypeSlice = createSlice({
|
|
1335
1335
|
name: "issueTypes",
|
|
1336
|
-
initialState: initialState$
|
|
1336
|
+
initialState: initialState$s,
|
|
1337
1337
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
1338
|
-
Object.assign(state, initialState$
|
|
1338
|
+
Object.assign(state, initialState$s);
|
|
1339
1339
|
}),
|
|
1340
1340
|
reducers: {
|
|
1341
1341
|
initializeIssueTypes: issueTypeAdapter.initialize,
|
|
@@ -1392,15 +1392,15 @@ const selectIssuesOfIssueTypeCount = (issueTypeId) => (state) => {
|
|
|
1392
1392
|
return selectIssuesOfIssueType(issueTypeId)(state).length;
|
|
1393
1393
|
};
|
|
1394
1394
|
const issueTypeReducer = issueTypeSlice.reducer;
|
|
1395
|
-
const initialState$
|
|
1395
|
+
const initialState$r = {
|
|
1396
1396
|
s3Urls: {}
|
|
1397
1397
|
};
|
|
1398
1398
|
const msPerHour = 1e3 * 60 * 60;
|
|
1399
1399
|
const msPerWeek = msPerHour * 24 * 7;
|
|
1400
1400
|
const fileSlice = createSlice({
|
|
1401
1401
|
name: "file",
|
|
1402
|
-
initialState: initialState$
|
|
1403
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1402
|
+
initialState: initialState$r,
|
|
1403
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$r)),
|
|
1404
1404
|
reducers: {
|
|
1405
1405
|
setUploadUrl: (state, action) => {
|
|
1406
1406
|
const { url, fields, sha1 } = action.payload;
|
|
@@ -1427,14 +1427,14 @@ const selectUploadUrl = (sha1) => (state) => {
|
|
|
1427
1427
|
return url;
|
|
1428
1428
|
};
|
|
1429
1429
|
const fileReducer = fileSlice.reducer;
|
|
1430
|
-
const initialState$
|
|
1430
|
+
const initialState$q = {
|
|
1431
1431
|
users: {},
|
|
1432
1432
|
currentUser: null
|
|
1433
1433
|
};
|
|
1434
1434
|
const userSlice = createSlice({
|
|
1435
1435
|
name: "users",
|
|
1436
|
-
initialState: initialState$
|
|
1437
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1436
|
+
initialState: initialState$q,
|
|
1437
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
|
|
1438
1438
|
reducers: {
|
|
1439
1439
|
setUsers: (state, action) => {
|
|
1440
1440
|
const usersMapping = {};
|
|
@@ -1492,11 +1492,11 @@ const selectUsersByIds = restructureCreateSelectorWithArgs(
|
|
|
1492
1492
|
const organizationAccessAdapter = createModelAdapter(
|
|
1493
1493
|
(organizationAccess) => organizationAccess.offline_id
|
|
1494
1494
|
);
|
|
1495
|
-
const initialState$
|
|
1495
|
+
const initialState$p = organizationAccessAdapter.getInitialState({});
|
|
1496
1496
|
const organizationAccessSlice = createSlice({
|
|
1497
1497
|
name: "organizationAccess",
|
|
1498
|
-
initialState: initialState$
|
|
1499
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1498
|
+
initialState: initialState$p,
|
|
1499
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
|
|
1500
1500
|
reducers: {
|
|
1501
1501
|
initializeOrganizationAccesses: organizationAccessAdapter.initialize,
|
|
1502
1502
|
updateOrganizationAccess: organizationAccessAdapter.updateOne,
|
|
@@ -1533,11 +1533,11 @@ const selectOrganizationAccessUserMapping = (state) => {
|
|
|
1533
1533
|
};
|
|
1534
1534
|
const organizationAccessReducer = organizationAccessSlice.reducer;
|
|
1535
1535
|
const licenseAdapter = createModelAdapter((license) => license.offline_id);
|
|
1536
|
-
const initialState$
|
|
1536
|
+
const initialState$o = licenseAdapter.getInitialState({});
|
|
1537
1537
|
const licenseSlice = createSlice({
|
|
1538
1538
|
name: "license",
|
|
1539
|
-
initialState: initialState$
|
|
1540
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1539
|
+
initialState: initialState$o,
|
|
1540
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
|
|
1541
1541
|
reducers: {
|
|
1542
1542
|
initializeLicences: licenseAdapter.initialize,
|
|
1543
1543
|
addLicenses: licenseAdapter.addMany,
|
|
@@ -1562,11 +1562,11 @@ const selectLicensesForProjectsMapping = createSelector(
|
|
|
1562
1562
|
);
|
|
1563
1563
|
const licenseReducer = licenseSlice.reducer;
|
|
1564
1564
|
const projectAccessAdapter = createModelAdapter((projectAccess) => projectAccess.offline_id);
|
|
1565
|
-
const initialState$
|
|
1565
|
+
const initialState$n = projectAccessAdapter.getInitialState({});
|
|
1566
1566
|
const projectAccessSlice = createSlice({
|
|
1567
1567
|
name: "projectAccess",
|
|
1568
|
-
initialState: initialState$
|
|
1569
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1568
|
+
initialState: initialState$n,
|
|
1569
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
|
|
1570
1570
|
reducers: {
|
|
1571
1571
|
initializeProjectAccesses: projectAccessAdapter.initialize,
|
|
1572
1572
|
updateProjectAccess: projectAccessAdapter.updateOne,
|
|
@@ -1607,14 +1607,14 @@ const selectProjectAccessUserMapping = (state) => {
|
|
|
1607
1607
|
return projectAccesses;
|
|
1608
1608
|
};
|
|
1609
1609
|
const projectAccessReducer = projectAccessSlice.reducer;
|
|
1610
|
-
const initialState$
|
|
1610
|
+
const initialState$m = {
|
|
1611
1611
|
projects: {},
|
|
1612
1612
|
activeProjectId: null
|
|
1613
1613
|
};
|
|
1614
1614
|
const projectSlice = createSlice({
|
|
1615
1615
|
name: "projects",
|
|
1616
|
-
initialState: initialState$
|
|
1617
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1616
|
+
initialState: initialState$m,
|
|
1617
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
|
|
1618
1618
|
reducers: {
|
|
1619
1619
|
setProjects: (state, action) => {
|
|
1620
1620
|
const projectsMap = {};
|
|
@@ -1721,13 +1721,13 @@ const selectSortedProjectUsers = createSelector(
|
|
|
1721
1721
|
});
|
|
1722
1722
|
}
|
|
1723
1723
|
);
|
|
1724
|
-
const initialState$
|
|
1724
|
+
const initialState$l = {
|
|
1725
1725
|
organizations: {}
|
|
1726
1726
|
};
|
|
1727
1727
|
const organizationSlice = createSlice({
|
|
1728
1728
|
name: "organizations",
|
|
1729
|
-
initialState: initialState$
|
|
1730
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1729
|
+
initialState: initialState$l,
|
|
1730
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
|
|
1731
1731
|
reducers: {
|
|
1732
1732
|
setOrganizations: (state, action) => {
|
|
1733
1733
|
for (const org of action.payload) {
|
|
@@ -1818,14 +1818,14 @@ const createOfflineAction = (request2, baseUrl, serviceName) => {
|
|
|
1818
1818
|
}
|
|
1819
1819
|
};
|
|
1820
1820
|
};
|
|
1821
|
-
const initialState$
|
|
1821
|
+
const initialState$k = {
|
|
1822
1822
|
deletedRequests: [],
|
|
1823
1823
|
latestRetryTime: 0
|
|
1824
1824
|
};
|
|
1825
1825
|
const outboxSlice = createSlice({
|
|
1826
1826
|
name: "outbox",
|
|
1827
|
-
initialState: initialState$
|
|
1828
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1827
|
+
initialState: initialState$k,
|
|
1828
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
|
|
1829
1829
|
reducers: {
|
|
1830
1830
|
// enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
|
|
1831
1831
|
// Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
|
|
@@ -1857,15 +1857,15 @@ const selectDeletedRequests = (state) => state.outboxReducer.deletedRequests;
|
|
|
1857
1857
|
const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
|
|
1858
1858
|
const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
|
|
1859
1859
|
const outboxReducer = outboxSlice.reducer;
|
|
1860
|
-
const initialState$
|
|
1860
|
+
const initialState$j = {
|
|
1861
1861
|
projectFiles: {},
|
|
1862
1862
|
activeProjectFileId: null,
|
|
1863
1863
|
isImportingProjectFile: false
|
|
1864
1864
|
};
|
|
1865
1865
|
const projectFileSlice = createSlice({
|
|
1866
1866
|
name: "projectFiles",
|
|
1867
|
-
initialState: initialState$
|
|
1868
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1867
|
+
initialState: initialState$j,
|
|
1868
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
|
|
1869
1869
|
reducers: {
|
|
1870
1870
|
addOrReplaceProjectFiles: (state, action) => {
|
|
1871
1871
|
for (let fileObj of action.payload) {
|
|
@@ -1952,11 +1952,11 @@ const selectProjectFileById = (id) => (state) => {
|
|
|
1952
1952
|
};
|
|
1953
1953
|
const projectFileReducer = projectFileSlice.reducer;
|
|
1954
1954
|
const projectAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
1955
|
-
const initialState$
|
|
1955
|
+
const initialState$i = projectAttachmentAdapter.getInitialState({});
|
|
1956
1956
|
const projectAttachmentSlice = createSlice({
|
|
1957
1957
|
name: "projectAttachments",
|
|
1958
|
-
initialState: initialState$
|
|
1959
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1958
|
+
initialState: initialState$i,
|
|
1959
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
|
|
1960
1960
|
reducers: {
|
|
1961
1961
|
initializeProjectAttachments: projectAttachmentAdapter.initialize,
|
|
1962
1962
|
addProjectAttachment: projectAttachmentAdapter.addOne,
|
|
@@ -2011,12 +2011,12 @@ const selectAttachmentsOfProjectByType = restructureCreateSelectorWithArgs(
|
|
|
2011
2011
|
)
|
|
2012
2012
|
);
|
|
2013
2013
|
const projectAttachmentReducer = projectAttachmentSlice.reducer;
|
|
2014
|
-
const initialState$
|
|
2014
|
+
const initialState$h = {
|
|
2015
2015
|
isRehydrated: false
|
|
2016
2016
|
};
|
|
2017
2017
|
const rehydratedSlice = createSlice({
|
|
2018
2018
|
name: "rehydrated",
|
|
2019
|
-
initialState: initialState$
|
|
2019
|
+
initialState: initialState$h,
|
|
2020
2020
|
// The `reducers` field lets us define reducers and generate associated actions
|
|
2021
2021
|
reducers: {
|
|
2022
2022
|
setRehydrated: (state, action) => {
|
|
@@ -2041,11 +2041,11 @@ const formRevisionSortFn = (formRevisionA, formRevisionB) => {
|
|
|
2041
2041
|
}
|
|
2042
2042
|
};
|
|
2043
2043
|
const formRevisionAdapter = createModelAdapter((revision) => revision.offline_id);
|
|
2044
|
-
const initialState$
|
|
2044
|
+
const initialState$g = formRevisionAdapter.getInitialState({});
|
|
2045
2045
|
const formRevisionsSlice = createSlice({
|
|
2046
2046
|
name: "formRevisions",
|
|
2047
|
-
initialState: initialState$
|
|
2048
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2047
|
+
initialState: initialState$g,
|
|
2048
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
|
|
2049
2049
|
reducers: {
|
|
2050
2050
|
initializeFormRevisions: formRevisionAdapter.initialize,
|
|
2051
2051
|
setFormRevision: formRevisionAdapter.setOne,
|
|
@@ -2104,13 +2104,24 @@ const selectFormRevisionsOfForm = restructureCreateSelectorWithArgs(
|
|
|
2104
2104
|
}
|
|
2105
2105
|
)
|
|
2106
2106
|
);
|
|
2107
|
+
const selectLatestFormRevisionByForm = createSelector([selectFormRevisionMapping], (revisions) => {
|
|
2108
|
+
const latestRevisions = {};
|
|
2109
|
+
for (const revision of Object.values(revisions)) {
|
|
2110
|
+
const formId = revision.form;
|
|
2111
|
+
const currentLatestRevision = latestRevisions[formId];
|
|
2112
|
+
if (!currentLatestRevision || currentLatestRevision.revision < revision.revision) {
|
|
2113
|
+
latestRevisions[formId] = revision;
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
return latestRevisions;
|
|
2117
|
+
});
|
|
2107
2118
|
const formRevisionReducer = formRevisionsSlice.reducer;
|
|
2108
2119
|
const formAdapter = createModelAdapter((form) => form.offline_id);
|
|
2109
|
-
const initialState$
|
|
2120
|
+
const initialState$f = formAdapter.getInitialState({});
|
|
2110
2121
|
const formSlice = createSlice({
|
|
2111
2122
|
name: "forms",
|
|
2112
|
-
initialState: initialState$
|
|
2113
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2123
|
+
initialState: initialState$f,
|
|
2124
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
|
|
2114
2125
|
reducers: {
|
|
2115
2126
|
initializeForms: formAdapter.initialize,
|
|
2116
2127
|
setForm: formAdapter.setOne,
|
|
@@ -2128,9 +2139,6 @@ const selectFormMapping = (state) => {
|
|
|
2128
2139
|
const selectForms = createSelector([selectFormMapping], (formsMapping) => {
|
|
2129
2140
|
return Object.values(formsMapping);
|
|
2130
2141
|
});
|
|
2131
|
-
const selectFormById = (formId) => (state) => {
|
|
2132
|
-
return state.formReducer.instances[formId];
|
|
2133
|
-
};
|
|
2134
2142
|
const selectFilteredForms = restructureCreateSelectorWithArgs(
|
|
2135
2143
|
createSelector(
|
|
2136
2144
|
[
|
|
@@ -2156,12 +2164,37 @@ const selectFilteredForms = restructureCreateSelectorWithArgs(
|
|
|
2156
2164
|
{ memoizeOptions: { equalityCheck: shallowEqual } }
|
|
2157
2165
|
)
|
|
2158
2166
|
);
|
|
2167
|
+
const selectFormById = (formId) => (state) => {
|
|
2168
|
+
return state.formReducer.instances[formId];
|
|
2169
|
+
};
|
|
2170
|
+
const selectFormOfAssetType = restructureCreateSelectorWithArgs(
|
|
2171
|
+
createSelector(
|
|
2172
|
+
[selectFormMapping, (_state, assetTypeId) => assetTypeId],
|
|
2173
|
+
(formsMapping, assetTypeId) => {
|
|
2174
|
+
return Object.values(formsMapping).find((form) => form.asset_type === assetTypeId);
|
|
2175
|
+
}
|
|
2176
|
+
)
|
|
2177
|
+
);
|
|
2178
|
+
const selectFormOfIssueType = restructureCreateSelectorWithArgs(
|
|
2179
|
+
createSelector(
|
|
2180
|
+
[selectFormMapping, (_state, issueTypeId) => issueTypeId],
|
|
2181
|
+
(formsMapping, issueTypeId) => {
|
|
2182
|
+
return Object.values(formsMapping).find((form) => form.issue_type === issueTypeId);
|
|
2183
|
+
}
|
|
2184
|
+
)
|
|
2185
|
+
);
|
|
2186
|
+
const selectFormsCount = createSelector([selectFormMapping], (formsMapping) => {
|
|
2187
|
+
return Object.keys(formsMapping).length;
|
|
2188
|
+
});
|
|
2189
|
+
const selectGeneralFormCount = createSelector([selectFormMapping], (formsMapping) => {
|
|
2190
|
+
return Object.values(formsMapping).filter((form) => !form.asset_type).length;
|
|
2191
|
+
});
|
|
2159
2192
|
const submissionAdapter = createModelAdapter((submission) => submission.offline_id);
|
|
2160
|
-
const initialState$
|
|
2193
|
+
const initialState$e = submissionAdapter.getInitialState({});
|
|
2161
2194
|
const formSubmissionSlice = createSlice({
|
|
2162
2195
|
name: "formSubmissions",
|
|
2163
|
-
initialState: initialState$
|
|
2164
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2196
|
+
initialState: initialState$e,
|
|
2197
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
|
|
2165
2198
|
reducers: {
|
|
2166
2199
|
initializeFormSubmissions: submissionAdapter.initialize,
|
|
2167
2200
|
setFormSubmission: submissionAdapter.setOne,
|
|
@@ -2217,6 +2250,43 @@ const selectFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
|
|
|
2217
2250
|
}
|
|
2218
2251
|
)
|
|
2219
2252
|
);
|
|
2253
|
+
const selectFormSubmissionsByFormRevisions = createSelector([selectFormRevisionMapping, selectFormSubmissions], (revisions, submissions) => {
|
|
2254
|
+
var _a2;
|
|
2255
|
+
const submissionMapping = {};
|
|
2256
|
+
for (const revisionId in revisions) {
|
|
2257
|
+
submissionMapping[revisionId] = [];
|
|
2258
|
+
}
|
|
2259
|
+
for (const submission of submissions) {
|
|
2260
|
+
(_a2 = submissionMapping[submission.form_revision]) == null ? void 0 : _a2.push(submission);
|
|
2261
|
+
}
|
|
2262
|
+
return submissionMapping;
|
|
2263
|
+
});
|
|
2264
|
+
const selectSortedFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
|
|
2265
|
+
createSelector(
|
|
2266
|
+
[
|
|
2267
|
+
selectFormRevisionMapping,
|
|
2268
|
+
selectFormSubmissionsByFormRevisions,
|
|
2269
|
+
(_state, formId) => formId
|
|
2270
|
+
],
|
|
2271
|
+
(revisionsMapping, submissionsByRevision, formId) => {
|
|
2272
|
+
const submissionsByFormRevisions = {};
|
|
2273
|
+
for (const revisionId in revisionsMapping) {
|
|
2274
|
+
const revision = revisionsMapping[revisionId];
|
|
2275
|
+
const submissionsOfRevision = submissionsByRevision[revisionId];
|
|
2276
|
+
if (revision && submissionsOfRevision && revision.form === formId) {
|
|
2277
|
+
submissionsByFormRevisions[revisionId] = submissionsOfRevision.sort(
|
|
2278
|
+
(a, b) => a.submitted_at < b.submitted_at ? -1 : 1
|
|
2279
|
+
);
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
return Object.entries(submissionsByFormRevisions).sort((a, b) => {
|
|
2283
|
+
const aRevision = revisionsMapping[a[0]];
|
|
2284
|
+
const bRevision = revisionsMapping[b[0]];
|
|
2285
|
+
return formRevisionSortFn(aRevision, bRevision);
|
|
2286
|
+
}).map(([_revisionId, submissions]) => submissions).flat();
|
|
2287
|
+
}
|
|
2288
|
+
)
|
|
2289
|
+
);
|
|
2220
2290
|
const selectFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
2221
2291
|
createSelector(
|
|
2222
2292
|
[selectFormSubmissions, (_state, issueId) => issueId],
|
|
@@ -2227,6 +2297,54 @@ const selectFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
|
2227
2297
|
}
|
|
2228
2298
|
)
|
|
2229
2299
|
);
|
|
2300
|
+
const selectAttachedFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
2301
|
+
createSelector(
|
|
2302
|
+
[
|
|
2303
|
+
(state) => state.issueReducer.instances,
|
|
2304
|
+
(state) => state.formReducer.instances,
|
|
2305
|
+
(state) => state.formRevisionReducer.instances,
|
|
2306
|
+
(state) => state.formSubmissionReducer.instances,
|
|
2307
|
+
(_state, issueId) => issueId
|
|
2308
|
+
],
|
|
2309
|
+
(issues, forms, formRevisions, submissions, issueId) => {
|
|
2310
|
+
const issue = issues[issueId];
|
|
2311
|
+
if (!issue)
|
|
2312
|
+
return [];
|
|
2313
|
+
if (!issue.issue_type) {
|
|
2314
|
+
return Object.values(submissions).filter((submission) => submission.issue === issueId);
|
|
2315
|
+
}
|
|
2316
|
+
const issueTypeForms = new Set(
|
|
2317
|
+
Object.keys(forms).filter((formId) => forms[formId].issue_type === issue.issue_type)
|
|
2318
|
+
);
|
|
2319
|
+
const issueTypeFormRevisions = new Set(
|
|
2320
|
+
Object.keys(formRevisions).filter(
|
|
2321
|
+
(formRevisionId) => issueTypeForms.has(formRevisions[formRevisionId].form)
|
|
2322
|
+
)
|
|
2323
|
+
);
|
|
2324
|
+
return Object.values(submissions).filter(
|
|
2325
|
+
(submission) => submission.issue === issueId && !issueTypeFormRevisions.has(submission.form_revision)
|
|
2326
|
+
);
|
|
2327
|
+
}
|
|
2328
|
+
)
|
|
2329
|
+
);
|
|
2330
|
+
const selectFormSubmissionsByIssues = restructureCreateSelectorWithArgs(
|
|
2331
|
+
createSelector(
|
|
2332
|
+
[selectFormSubmissions, (_state, issueIds) => issueIds],
|
|
2333
|
+
(submissions, issueIds) => {
|
|
2334
|
+
var _a2;
|
|
2335
|
+
const issueSubmissions = {};
|
|
2336
|
+
for (const issueId of issueIds) {
|
|
2337
|
+
issueSubmissions[issueId] = [];
|
|
2338
|
+
}
|
|
2339
|
+
for (const submission of submissions) {
|
|
2340
|
+
if (submission.issue && issueIds.includes(submission.issue)) {
|
|
2341
|
+
(_a2 = issueSubmissions[submission.issue]) == null ? void 0 : _a2.push(submission);
|
|
2342
|
+
}
|
|
2343
|
+
}
|
|
2344
|
+
return issueSubmissions;
|
|
2345
|
+
}
|
|
2346
|
+
)
|
|
2347
|
+
);
|
|
2230
2348
|
const selectFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
|
|
2231
2349
|
createSelector(
|
|
2232
2350
|
[selectFormSubmissions, (_state, assetId) => assetId],
|
|
@@ -2237,15 +2355,62 @@ const selectFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
|
|
|
2237
2355
|
}
|
|
2238
2356
|
)
|
|
2239
2357
|
);
|
|
2358
|
+
const selectAttachedFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
|
|
2359
|
+
createSelector(
|
|
2360
|
+
[
|
|
2361
|
+
(state) => state.assetReducer.instances,
|
|
2362
|
+
(state) => state.formReducer.instances,
|
|
2363
|
+
(state) => state.formRevisionReducer.instances,
|
|
2364
|
+
(state) => state.formSubmissionReducer.instances,
|
|
2365
|
+
(_state, assetId) => assetId
|
|
2366
|
+
],
|
|
2367
|
+
(assets, forms, formRevisions, submissions, assetId) => {
|
|
2368
|
+
const asset = assets[assetId];
|
|
2369
|
+
if (!asset)
|
|
2370
|
+
return [];
|
|
2371
|
+
if (!asset.asset_type) {
|
|
2372
|
+
return Object.values(submissions).filter((submission) => submission.asset === assetId);
|
|
2373
|
+
}
|
|
2374
|
+
const issueTypeForms = new Set(
|
|
2375
|
+
Object.keys(forms).filter((formId) => forms[formId].asset_type === asset.asset_type)
|
|
2376
|
+
);
|
|
2377
|
+
const issueTypeFormRevisions = new Set(
|
|
2378
|
+
Object.keys(formRevisions).filter(
|
|
2379
|
+
(formRevisionId) => issueTypeForms.has(formRevisions[formRevisionId].form)
|
|
2380
|
+
)
|
|
2381
|
+
);
|
|
2382
|
+
return Object.values(submissions).filter(
|
|
2383
|
+
(submission) => submission.asset === assetId && !issueTypeFormRevisions.has(submission.form_revision)
|
|
2384
|
+
);
|
|
2385
|
+
}
|
|
2386
|
+
)
|
|
2387
|
+
);
|
|
2388
|
+
const selectFormSubmissionsByAssets = createSelector(
|
|
2389
|
+
[selectFormSubmissionsMapping, selectAssetsMapping],
|
|
2390
|
+
(submissions, assets) => {
|
|
2391
|
+
var _a2;
|
|
2392
|
+
const assetSubmissionMapping = {};
|
|
2393
|
+
for (const assetId in assets) {
|
|
2394
|
+
assetSubmissionMapping[assetId] = [];
|
|
2395
|
+
}
|
|
2396
|
+
for (const submissionId in submissions) {
|
|
2397
|
+
const submission = submissions[submissionId];
|
|
2398
|
+
if (submission.asset) {
|
|
2399
|
+
(_a2 = assetSubmissionMapping[submission.asset]) == null ? void 0 : _a2.push(submission);
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
return assetSubmissionMapping;
|
|
2403
|
+
}
|
|
2404
|
+
);
|
|
2240
2405
|
const formSubmissionReducer = formSubmissionSlice.reducer;
|
|
2241
2406
|
const formSubmissionAttachmentAdapter = createModelAdapter(
|
|
2242
2407
|
(attachment) => attachment.offline_id
|
|
2243
2408
|
);
|
|
2244
|
-
const initialState$
|
|
2409
|
+
const initialState$d = formSubmissionAttachmentAdapter.getInitialState({});
|
|
2245
2410
|
const formSubmissionAttachmentSlice = createSlice({
|
|
2246
2411
|
name: "formSubmissionAttachments",
|
|
2247
|
-
initialState: initialState$
|
|
2248
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2412
|
+
initialState: initialState$d,
|
|
2413
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
|
|
2249
2414
|
reducers: {
|
|
2250
2415
|
initializeFormSubmissionAttachments: formSubmissionAttachmentAdapter.initialize,
|
|
2251
2416
|
addFormSubmissionAttachment: formSubmissionAttachmentAdapter.addOne,
|
|
@@ -2288,9 +2453,7 @@ const selectAttachmentsOfFormSubmission = restructureCreateSelectorWithArgs(
|
|
|
2288
2453
|
[selectFormSubmissionAttachmentsMapping, (_state, submissionId) => submissionId],
|
|
2289
2454
|
(attachmentsMapping, submissionId) => {
|
|
2290
2455
|
return fallbackToEmptyArray(
|
|
2291
|
-
Object.values(attachmentsMapping).filter(
|
|
2292
|
-
(attachment) => attachment.form_submission === submissionId
|
|
2293
|
-
)
|
|
2456
|
+
Object.values(attachmentsMapping).filter((attachment) => attachment.submission === submissionId)
|
|
2294
2457
|
);
|
|
2295
2458
|
}
|
|
2296
2459
|
)
|
|
@@ -2299,11 +2462,11 @@ const formSubmissionAttachmentReducer = formSubmissionAttachmentSlice.reducer;
|
|
|
2299
2462
|
const formRevisionAttachmentAdapter = createModelAdapter(
|
|
2300
2463
|
(attachment) => attachment.offline_id
|
|
2301
2464
|
);
|
|
2302
|
-
const initialState$
|
|
2465
|
+
const initialState$c = formRevisionAttachmentAdapter.getInitialState({});
|
|
2303
2466
|
const formRevisionAttachmentSlice = createSlice({
|
|
2304
2467
|
name: "formRevisionAttachments",
|
|
2305
|
-
initialState: initialState$
|
|
2306
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2468
|
+
initialState: initialState$c,
|
|
2469
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
|
|
2307
2470
|
reducers: {
|
|
2308
2471
|
initializeFormRevisionAttachments: formRevisionAttachmentAdapter.initialize,
|
|
2309
2472
|
addFormRevisionAttachment: formRevisionAttachmentAdapter.addOne,
|
|
@@ -2335,17 +2498,17 @@ const selectAttachmentsOfFormRevision = restructureCreateSelectorWithArgs(
|
|
|
2335
2498
|
[selectFormRevisionAttachmentsMapping, (_state, revisionId) => revisionId],
|
|
2336
2499
|
(attachments, revisionId) => {
|
|
2337
2500
|
return fallbackToEmptyArray(
|
|
2338
|
-
Object.values(attachments).filter((attachment) => attachment.
|
|
2501
|
+
Object.values(attachments).filter((attachment) => attachment.revision === revisionId)
|
|
2339
2502
|
);
|
|
2340
2503
|
}
|
|
2341
2504
|
)
|
|
2342
2505
|
);
|
|
2343
2506
|
const formRevisionAttachmentReducer = formRevisionAttachmentSlice.reducer;
|
|
2344
2507
|
const workspaceAdapter = createModelAdapter((workspace) => workspace.offline_id);
|
|
2345
|
-
const initialState$
|
|
2508
|
+
const initialState$b = workspaceAdapter.getInitialState({});
|
|
2346
2509
|
const workspaceSlice = createSlice({
|
|
2347
2510
|
name: "workspace",
|
|
2348
|
-
initialState: initialState$
|
|
2511
|
+
initialState: initialState$b,
|
|
2349
2512
|
reducers: {
|
|
2350
2513
|
initializeWorkspaces: workspaceAdapter.initialize,
|
|
2351
2514
|
setWorkspaces: workspaceAdapter.setMany,
|
|
@@ -2376,10 +2539,10 @@ const selectPermittedWorkspaceIds = createSelector(
|
|
|
2376
2539
|
);
|
|
2377
2540
|
const workspaceReducer = workspaceSlice.reducer;
|
|
2378
2541
|
const emailDomainAdapter = createModelAdapter((emailDomain) => emailDomain.offline_id);
|
|
2379
|
-
const initialState$
|
|
2542
|
+
const initialState$a = emailDomainAdapter.getInitialState({});
|
|
2380
2543
|
const emailDomainsSlice = createSlice({
|
|
2381
2544
|
name: "emailDomains",
|
|
2382
|
-
initialState: initialState$
|
|
2545
|
+
initialState: initialState$a,
|
|
2383
2546
|
reducers: {
|
|
2384
2547
|
initializeEmailDomains: emailDomainAdapter.initialize,
|
|
2385
2548
|
addEmailDomain: emailDomainAdapter.addOne,
|
|
@@ -2400,14 +2563,14 @@ const selectEmailDomainsOfOrganization = restructureCreateSelectorWithArgs(
|
|
|
2400
2563
|
)
|
|
2401
2564
|
);
|
|
2402
2565
|
const emailDomainsReducer = emailDomainsSlice.reducer;
|
|
2403
|
-
const initialState$
|
|
2566
|
+
const initialState$9 = {
|
|
2404
2567
|
documents: {}
|
|
2405
2568
|
};
|
|
2406
2569
|
const documentSlice = createSlice({
|
|
2407
2570
|
name: "documents",
|
|
2408
|
-
initialState: initialState$
|
|
2571
|
+
initialState: initialState$9,
|
|
2409
2572
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
2410
|
-
Object.assign(state, initialState$
|
|
2573
|
+
Object.assign(state, initialState$9);
|
|
2411
2574
|
}),
|
|
2412
2575
|
reducers: {
|
|
2413
2576
|
setDocuments: (state, action) => {
|
|
@@ -2596,11 +2759,11 @@ const selectRootDocuments = createSelector(
|
|
|
2596
2759
|
);
|
|
2597
2760
|
const documentsReducer = documentSlice.reducer;
|
|
2598
2761
|
const documentAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
2599
|
-
const initialState$
|
|
2762
|
+
const initialState$8 = documentAttachmentAdapter.getInitialState({});
|
|
2600
2763
|
const documentAttachmentSlice = createSlice({
|
|
2601
2764
|
name: "documentAttachments",
|
|
2602
|
-
initialState: initialState$
|
|
2603
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2765
|
+
initialState: initialState$8,
|
|
2766
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
|
|
2604
2767
|
reducers: {
|
|
2605
2768
|
initializeDocumentAttachments: documentAttachmentAdapter.initialize,
|
|
2606
2769
|
addDocumentAttachment: documentAttachmentAdapter.addOne,
|
|
@@ -2659,11 +2822,11 @@ const selectAttachmentsOfDocumentByType = restructureCreateSelectorWithArgs(
|
|
|
2659
2822
|
);
|
|
2660
2823
|
const documentAttachmentReducer = documentAttachmentSlice.reducer;
|
|
2661
2824
|
const teamAdapter = createModelAdapter((team) => team.offline_id);
|
|
2662
|
-
const initialState$
|
|
2825
|
+
const initialState$7 = teamAdapter.getInitialState({});
|
|
2663
2826
|
const teamSlice = createSlice({
|
|
2664
2827
|
name: "teams",
|
|
2665
|
-
initialState: initialState$
|
|
2666
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2828
|
+
initialState: initialState$7,
|
|
2829
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
|
|
2667
2830
|
reducers: {
|
|
2668
2831
|
setTeam: teamAdapter.setOne,
|
|
2669
2832
|
initializeTeams: teamAdapter.initialize,
|
|
@@ -2714,11 +2877,11 @@ const teamReducer = teamSlice.reducer;
|
|
|
2714
2877
|
const agentUserConversationAdapter = createModelAdapter(
|
|
2715
2878
|
(conversation) => conversation.offline_id
|
|
2716
2879
|
);
|
|
2717
|
-
const initialState$
|
|
2880
|
+
const initialState$6 = agentUserConversationAdapter.getInitialState({});
|
|
2718
2881
|
const agentsSlice = createSlice({
|
|
2719
2882
|
name: "agents",
|
|
2720
|
-
initialState: initialState$
|
|
2721
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2883
|
+
initialState: initialState$6,
|
|
2884
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
|
|
2722
2885
|
reducers: {
|
|
2723
2886
|
initializeConversations: agentUserConversationAdapter.initialize,
|
|
2724
2887
|
addConversation: agentUserConversationAdapter.addOne,
|
|
@@ -2740,11 +2903,11 @@ const selectConversation = restructureCreateSelectorWithArgs(
|
|
|
2740
2903
|
);
|
|
2741
2904
|
const agentsReducer = agentsSlice.reducer;
|
|
2742
2905
|
const issueCommentAdapter = createModelAdapter((comment) => comment.offline_id);
|
|
2743
|
-
const initialState$
|
|
2906
|
+
const initialState$5 = issueCommentAdapter.getInitialState({});
|
|
2744
2907
|
const issueCommentSlice = createSlice({
|
|
2745
2908
|
name: "issueComments",
|
|
2746
|
-
initialState: initialState$
|
|
2747
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2909
|
+
initialState: initialState$5,
|
|
2910
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
|
|
2748
2911
|
reducers: {
|
|
2749
2912
|
addIssueComment: issueCommentAdapter.addOne,
|
|
2750
2913
|
addIssueComments: issueCommentAdapter.addMany,
|
|
@@ -2773,11 +2936,11 @@ const selectCommentsOfIssue = restructureCreateSelectorWithArgs(
|
|
|
2773
2936
|
);
|
|
2774
2937
|
const issueCommentReducer = issueCommentSlice.reducer;
|
|
2775
2938
|
const issueUpdateAdapter = createModelAdapter((issueUpdate) => issueUpdate.offline_id);
|
|
2776
|
-
const initialState$
|
|
2939
|
+
const initialState$4 = issueUpdateAdapter.getInitialState({});
|
|
2777
2940
|
const issueUpdateSlice = createSlice({
|
|
2778
2941
|
name: "issueUpdates",
|
|
2779
|
-
initialState: initialState$
|
|
2780
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2942
|
+
initialState: initialState$4,
|
|
2943
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
|
|
2781
2944
|
reducers: {
|
|
2782
2945
|
initializeIssueUpdates: issueUpdateAdapter.setMany,
|
|
2783
2946
|
setIssueUpdate: issueUpdateAdapter.setOne,
|
|
@@ -2806,11 +2969,11 @@ const selectIssueUpdatesOfIssue = restructureCreateSelectorWithArgs(
|
|
|
2806
2969
|
);
|
|
2807
2970
|
const issueUpdateReducer = issueUpdateSlice.reducer;
|
|
2808
2971
|
const issueAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
2809
|
-
const initialState$
|
|
2972
|
+
const initialState$3 = issueAttachmentAdapter.getInitialState({});
|
|
2810
2973
|
const issueAttachmentSlice = createSlice({
|
|
2811
2974
|
name: "issueAttachments",
|
|
2812
|
-
initialState: initialState$
|
|
2813
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2975
|
+
initialState: initialState$3,
|
|
2976
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
|
|
2814
2977
|
reducers: {
|
|
2815
2978
|
initializeIssueAttachments: issueAttachmentAdapter.initialize,
|
|
2816
2979
|
addIssueAttachment: issueAttachmentAdapter.addOne,
|
|
@@ -2868,23 +3031,23 @@ const selectAttachmentsOfIssueByType = restructureCreateSelectorWithArgs(
|
|
|
2868
3031
|
)
|
|
2869
3032
|
);
|
|
2870
3033
|
const issueAttachmentReducer = issueAttachmentSlice.reducer;
|
|
2871
|
-
const initialState$
|
|
3034
|
+
const initialState$2 = {
|
|
2872
3035
|
version: 0
|
|
2873
3036
|
};
|
|
2874
3037
|
const versioningSlice = createSlice({
|
|
2875
3038
|
name: "versioning",
|
|
2876
|
-
initialState: initialState$
|
|
3039
|
+
initialState: initialState$2,
|
|
2877
3040
|
reducers: {}
|
|
2878
3041
|
});
|
|
2879
3042
|
const versioningReducer = versioningSlice.reducer;
|
|
2880
3043
|
const geoImageAdapter = createModelAdapter((model) => model.offline_id);
|
|
2881
|
-
const initialState$
|
|
3044
|
+
const initialState$1 = geoImageAdapter.getInitialState({});
|
|
2882
3045
|
const geoImageSlice = createSlice({
|
|
2883
3046
|
name: "geoImages",
|
|
2884
|
-
initialState: initialState$
|
|
3047
|
+
initialState: initialState$1,
|
|
2885
3048
|
extraReducers: (builder) => {
|
|
2886
3049
|
builder.addCase("RESET", (state) => {
|
|
2887
|
-
Object.assign(state, initialState$
|
|
3050
|
+
Object.assign(state, initialState$1);
|
|
2888
3051
|
});
|
|
2889
3052
|
},
|
|
2890
3053
|
reducers: {
|
|
@@ -2922,11 +3085,11 @@ const selectGeoImagesOfProject = restructureCreateSelectorWithArgs(
|
|
|
2922
3085
|
);
|
|
2923
3086
|
const geoImageReducer = geoImageSlice.reducer;
|
|
2924
3087
|
const issueAssociationAdapter = createModelAdapter((assoc) => assoc.offline_id);
|
|
2925
|
-
const initialState
|
|
3088
|
+
const initialState = issueAssociationAdapter.getInitialState({});
|
|
2926
3089
|
const issueAssociationSlice = createSlice({
|
|
2927
3090
|
name: "issueAssociations",
|
|
2928
|
-
initialState
|
|
2929
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState
|
|
3091
|
+
initialState,
|
|
3092
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState)),
|
|
2930
3093
|
reducers: {
|
|
2931
3094
|
initializeIssueAssociations: issueAssociationAdapter.initialize,
|
|
2932
3095
|
addIssueAssociation: issueAssociationAdapter.addOne,
|
|
@@ -2984,432 +3147,32 @@ const selectIssueAssociationsOfAsset = restructureCreateSelectorWithArgs(
|
|
|
2984
3147
|
)
|
|
2985
3148
|
);
|
|
2986
3149
|
const issueAssociationReducer = issueAssociationSlice.reducer;
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
const {
|
|
3008
|
-
initializeIssueTypeFieldValues,
|
|
3009
|
-
addIssueTypeFieldValues,
|
|
3010
|
-
addIssueTypeFieldValuesMany,
|
|
3011
|
-
setIssueTypeFieldValues,
|
|
3012
|
-
setIssueTypeFieldValuesMany,
|
|
3013
|
-
updateIssueTypeFieldValues,
|
|
3014
|
-
updateIssueTypeFieldValuesMany,
|
|
3015
|
-
deleteIssueTypeFieldValues,
|
|
3016
|
-
deleteIssueTypeFieldValuesMany
|
|
3017
|
-
} = issueTypeFieldValuesSlice.actions;
|
|
3018
|
-
const selectIssueTypeFieldValuesMapping = (state) => state.issueTypeFieldValuesReducer.instances;
|
|
3019
|
-
const selectIssueTypeFieldValues = createSelector([selectIssueTypeFieldValuesMapping], (fieldValuesMapping) => {
|
|
3020
|
-
return Object.values(fieldValuesMapping);
|
|
3021
|
-
});
|
|
3022
|
-
const selectIssueTypeFieldValuesOfIssue = restructureCreateSelectorWithArgs(
|
|
3023
|
-
createSelector([selectIssueTypeFieldValues, (_state, issueId) => issueId], (fieldValues, issueId) => {
|
|
3024
|
-
return fallbackToEmptyArray(fieldValues.filter((fieldValue) => fieldValue.issue === issueId));
|
|
3025
|
-
})
|
|
3026
|
-
);
|
|
3027
|
-
const selectIssueTypeFieldValuesById = (fieldValuesId) => (state) => {
|
|
3028
|
-
return state.issueTypeFieldValuesReducer.instances[fieldValuesId];
|
|
3029
|
-
};
|
|
3030
|
-
const issueTypeFieldValuesReducer = issueTypeFieldValuesSlice.reducer;
|
|
3031
|
-
const issueTypeFieldsAdapter = createModelAdapter((fields) => fields.offline_id);
|
|
3032
|
-
const initialState$6 = issueTypeFieldsAdapter.getInitialState({});
|
|
3033
|
-
const issueTypeFieldsSlice = createSlice({
|
|
3034
|
-
name: "issueTypeFields",
|
|
3035
|
-
initialState: initialState$6,
|
|
3036
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
|
|
3037
|
-
reducers: {
|
|
3038
|
-
initializeIssueTypeFields: issueTypeFieldsAdapter.initialize,
|
|
3039
|
-
addIssueTypeFields: issueTypeFieldsAdapter.addOne,
|
|
3040
|
-
addIssueTypeFieldsMany: issueTypeFieldsAdapter.addMany,
|
|
3041
|
-
setIssueTypeFields: issueTypeFieldsAdapter.setOne,
|
|
3042
|
-
setIssueTypeFieldsMany: issueTypeFieldsAdapter.setMany,
|
|
3043
|
-
updateIssueTypeFields: issueTypeFieldsAdapter.updateOne,
|
|
3044
|
-
updateIssueTypeFieldsMany: issueTypeFieldsAdapter.updateMany,
|
|
3045
|
-
deleteIssueTypeFields: issueTypeFieldsAdapter.deleteOne,
|
|
3046
|
-
deleteIssueTypeFieldsMany: issueTypeFieldsAdapter.deleteMany
|
|
3150
|
+
let clientStore;
|
|
3151
|
+
function setClientStore(store) {
|
|
3152
|
+
clientStore = store;
|
|
3153
|
+
}
|
|
3154
|
+
function getClientStore() {
|
|
3155
|
+
return clientStore;
|
|
3156
|
+
}
|
|
3157
|
+
let clientSDK;
|
|
3158
|
+
function setClientSDK(sdkCtor) {
|
|
3159
|
+
clientSDK = sdkCtor;
|
|
3160
|
+
}
|
|
3161
|
+
function getClientSDK() {
|
|
3162
|
+
return clientSDK;
|
|
3163
|
+
}
|
|
3164
|
+
const CLASS_NAME_TO_SERVICE = {};
|
|
3165
|
+
class BaseService {
|
|
3166
|
+
constructor(sdk) {
|
|
3167
|
+
__publicField(this, "client");
|
|
3168
|
+
CLASS_NAME_TO_SERVICE[this.constructor.name] = this;
|
|
3169
|
+
this.client = sdk;
|
|
3047
3170
|
}
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
initializeIssueTypeFields,
|
|
3051
|
-
addIssueTypeFields,
|
|
3052
|
-
addIssueTypeFieldsMany,
|
|
3053
|
-
setIssueTypeFields,
|
|
3054
|
-
setIssueTypeFieldsMany,
|
|
3055
|
-
updateIssueTypeFields,
|
|
3056
|
-
updateIssueTypeFieldsMany,
|
|
3057
|
-
deleteIssueTypeFields,
|
|
3058
|
-
deleteIssueTypeFieldsMany
|
|
3059
|
-
} = issueTypeFieldsSlice.actions;
|
|
3060
|
-
const selectIssueTypeFieldsMapping = (state) => state.issueTypeFieldsReducer.instances;
|
|
3061
|
-
const selectIssueTypeFields = createSelector([selectIssueTypeFieldsMapping], (fieldsMapping) => {
|
|
3062
|
-
return Object.values(fieldsMapping);
|
|
3063
|
-
});
|
|
3064
|
-
const selectIssueTypeFieldsOfIssueType = restructureCreateSelectorWithArgs(
|
|
3065
|
-
createSelector([selectIssueTypeFields, (_state, issueTypeId) => issueTypeId], (fields, issueTypeId) => {
|
|
3066
|
-
return fallbackToEmptyArray(fields.filter((field) => field.issue_type === issueTypeId));
|
|
3067
|
-
})
|
|
3068
|
-
);
|
|
3069
|
-
const selectLatestIssueTypeFieldsOfIssueType = restructureCreateSelectorWithArgs(
|
|
3070
|
-
createSelector([selectIssueTypeFields, (_state, id) => id], (fields, id) => {
|
|
3071
|
-
return fields.filter((field) => field.issue_type === id).sort((a, b) => a.submitted_at > b.submitted_at ? -1 : 1)[0];
|
|
3072
|
-
})
|
|
3073
|
-
);
|
|
3074
|
-
const selectIssueTypeValuesOfIssueType = restructureCreateSelectorWithArgs(
|
|
3075
|
-
createSelector(
|
|
3076
|
-
[selectIssueTypeFields, selectIssueTypeFieldValues, (_state, id) => id],
|
|
3077
|
-
(fields, fieldValues, id) => {
|
|
3078
|
-
const fieldsIds = new Set(
|
|
3079
|
-
fields.filter((field) => field.issue_type === id).map((field) => field.offline_id)
|
|
3080
|
-
);
|
|
3081
|
-
return fallbackToEmptyArray(fieldValues.filter((values) => fieldsIds.has(values.fields_revision)));
|
|
3082
|
-
}
|
|
3083
|
-
)
|
|
3084
|
-
);
|
|
3085
|
-
const selectIssueTypeFieldsById = (fieldsId) => (state) => {
|
|
3086
|
-
return state.issueTypeFieldsReducer.instances[fieldsId];
|
|
3087
|
-
};
|
|
3088
|
-
const issueTypeFieldsReducer = issueTypeFieldsSlice.reducer;
|
|
3089
|
-
const issueTypeFieldsAttachmentAdapter = createModelAdapter(
|
|
3090
|
-
(attachment) => attachment.offline_id
|
|
3091
|
-
);
|
|
3092
|
-
const initialState$5 = issueTypeFieldsAttachmentAdapter.getInitialState({});
|
|
3093
|
-
const issueTypeFieldsAttachmentSlice = createSlice({
|
|
3094
|
-
name: "issueTypeFieldsAttachments",
|
|
3095
|
-
initialState: initialState$5,
|
|
3096
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
|
|
3097
|
-
reducers: {
|
|
3098
|
-
initializeIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.initialize,
|
|
3099
|
-
addIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.addOne,
|
|
3100
|
-
addIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.addMany,
|
|
3101
|
-
setIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.setOne,
|
|
3102
|
-
setIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.setMany,
|
|
3103
|
-
updateIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.updateOne,
|
|
3104
|
-
updateIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.updateMany,
|
|
3105
|
-
deleteIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.deleteOne,
|
|
3106
|
-
deleteIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.deleteMany
|
|
3171
|
+
async enqueueRequest(requestDetails) {
|
|
3172
|
+
return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
|
|
3107
3173
|
}
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
initializeIssueTypeFieldsAttachments,
|
|
3111
|
-
addIssueTypeFieldsAttachment,
|
|
3112
|
-
addIssueTypeFieldsAttachments,
|
|
3113
|
-
setIssueTypeFieldsAttachment,
|
|
3114
|
-
setIssueTypeFieldsAttachments,
|
|
3115
|
-
updateIssueTypeFieldsAttachment,
|
|
3116
|
-
updateIssueTypeFieldsAttachments,
|
|
3117
|
-
deleteIssueTypeFieldsAttachment,
|
|
3118
|
-
deleteIssueTypeFieldsAttachments
|
|
3119
|
-
} = issueTypeFieldsAttachmentSlice.actions;
|
|
3120
|
-
const selectIssueTypeFieldsAttachmentsMapping = (state) => state.issueTypeFieldsAttachmentReducer.instances;
|
|
3121
|
-
const selectIssueTypeFieldsAttachments = createSelector(
|
|
3122
|
-
[selectIssueTypeFieldsAttachmentsMapping],
|
|
3123
|
-
(attachmentsMapping) => {
|
|
3124
|
-
return Object.values(attachmentsMapping);
|
|
3125
|
-
}
|
|
3126
|
-
);
|
|
3127
|
-
const selectAttachmentsOfIssueTypeFields = restructureCreateSelectorWithArgs(
|
|
3128
|
-
createSelector(
|
|
3129
|
-
[selectIssueTypeFieldsAttachments, (_state, fieldsRevision) => fieldsRevision],
|
|
3130
|
-
(attachments, fieldsRevision) => {
|
|
3131
|
-
return fallbackToEmptyArray(
|
|
3132
|
-
attachments.filter((attachment) => attachment.fields_revision === fieldsRevision)
|
|
3133
|
-
);
|
|
3134
|
-
}
|
|
3135
|
-
)
|
|
3136
|
-
);
|
|
3137
|
-
const selectIssueTypeFieldsAttachmentById = (attachmentId) => (state) => {
|
|
3138
|
-
return state.issueTypeFieldsAttachmentReducer.instances[attachmentId];
|
|
3139
|
-
};
|
|
3140
|
-
const issueTypeFieldsAttachmentReducer = issueTypeFieldsAttachmentSlice.reducer;
|
|
3141
|
-
const issueTypeFieldValuesAttachmentAdapter = createModelAdapter(
|
|
3142
|
-
(attachment) => attachment.offline_id
|
|
3143
|
-
);
|
|
3144
|
-
const initialState$4 = issueTypeFieldValuesAttachmentAdapter.getInitialState({});
|
|
3145
|
-
const issueTypeFieldValuesAttachmentSlice = createSlice({
|
|
3146
|
-
name: "issueTypeFieldValuesAttachments",
|
|
3147
|
-
initialState: initialState$4,
|
|
3148
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
|
|
3149
|
-
reducers: {
|
|
3150
|
-
initializeIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.initialize,
|
|
3151
|
-
addIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.addOne,
|
|
3152
|
-
addIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.addMany,
|
|
3153
|
-
setIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.setOne,
|
|
3154
|
-
setIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.setMany,
|
|
3155
|
-
updateIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.updateOne,
|
|
3156
|
-
updateIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.updateMany,
|
|
3157
|
-
deleteIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.deleteOne,
|
|
3158
|
-
deleteIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.deleteMany
|
|
3159
|
-
}
|
|
3160
|
-
});
|
|
3161
|
-
const {
|
|
3162
|
-
initializeIssueTypeFieldValuesAttachments,
|
|
3163
|
-
addIssueTypeFieldValuesAttachment,
|
|
3164
|
-
addIssueTypeFieldValuesAttachments,
|
|
3165
|
-
setIssueTypeFieldValuesAttachment,
|
|
3166
|
-
setIssueTypeFieldValuesAttachments,
|
|
3167
|
-
updateIssueTypeFieldValuesAttachment,
|
|
3168
|
-
updateIssueTypeFieldValuesAttachments,
|
|
3169
|
-
deleteIssueTypeFieldValuesAttachment,
|
|
3170
|
-
deleteIssueTypeFieldValuesAttachments
|
|
3171
|
-
} = issueTypeFieldValuesAttachmentSlice.actions;
|
|
3172
|
-
const selectIssueTypeFieldValuesAttachmentsMapping = (state) => state.issueTypeFieldValuesAttachmentReducer.instances;
|
|
3173
|
-
const selectIssueTypeFieldValuesAttachments = createSelector(
|
|
3174
|
-
[selectIssueTypeFieldValuesAttachmentsMapping],
|
|
3175
|
-
(attachmentsMapping) => {
|
|
3176
|
-
return Object.values(attachmentsMapping);
|
|
3177
|
-
}
|
|
3178
|
-
);
|
|
3179
|
-
const selectAttachmentsOfIssueTypeFieldValues = restructureCreateSelectorWithArgs(
|
|
3180
|
-
createSelector(
|
|
3181
|
-
[selectIssueTypeFieldValuesAttachments, (_state, fieldValuesId) => fieldValuesId],
|
|
3182
|
-
(attachments, fieldValuesId) => {
|
|
3183
|
-
return fallbackToEmptyArray(attachments.filter((attachment) => attachment.field_values === fieldValuesId));
|
|
3184
|
-
}
|
|
3185
|
-
)
|
|
3186
|
-
);
|
|
3187
|
-
const selectIssueTypeFieldValuesAttachmentById = (attachmentId) => (state) => {
|
|
3188
|
-
return state.issueTypeFieldValuesAttachmentReducer.instances[attachmentId];
|
|
3189
|
-
};
|
|
3190
|
-
const issueTypeFieldValuesAttachmentReducer = issueTypeFieldValuesAttachmentSlice.reducer;
|
|
3191
|
-
const assetTypeFieldsAdapter = createModelAdapter((fields) => fields.offline_id);
|
|
3192
|
-
const initialState$3 = assetTypeFieldsAdapter.getInitialState({});
|
|
3193
|
-
const assetTypeFieldsSlice = createSlice({
|
|
3194
|
-
name: "assetTypeFields",
|
|
3195
|
-
initialState: initialState$3,
|
|
3196
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
|
|
3197
|
-
reducers: {
|
|
3198
|
-
initializeAssetTypeFields: assetTypeFieldsAdapter.initialize,
|
|
3199
|
-
addAssetTypeFields: assetTypeFieldsAdapter.addOne,
|
|
3200
|
-
addAssetTypeFieldsMany: assetTypeFieldsAdapter.addMany,
|
|
3201
|
-
setAssetTypeFields: assetTypeFieldsAdapter.setOne,
|
|
3202
|
-
setAssetTypeFieldsMany: assetTypeFieldsAdapter.setMany,
|
|
3203
|
-
updateAssetTypeFields: assetTypeFieldsAdapter.updateOne,
|
|
3204
|
-
updateAssetTypeFieldsMany: assetTypeFieldsAdapter.updateMany,
|
|
3205
|
-
deleteAssetTypeFields: assetTypeFieldsAdapter.deleteOne,
|
|
3206
|
-
deleteAssetTypeFieldsMany: assetTypeFieldsAdapter.deleteMany
|
|
3207
|
-
}
|
|
3208
|
-
});
|
|
3209
|
-
const {
|
|
3210
|
-
initializeAssetTypeFields,
|
|
3211
|
-
addAssetTypeFields,
|
|
3212
|
-
addAssetTypeFieldsMany,
|
|
3213
|
-
setAssetTypeFields,
|
|
3214
|
-
setAssetTypeFieldsMany,
|
|
3215
|
-
updateAssetTypeFields,
|
|
3216
|
-
updateAssetTypeFieldsMany,
|
|
3217
|
-
deleteAssetTypeFields,
|
|
3218
|
-
deleteAssetTypeFieldsMany
|
|
3219
|
-
} = assetTypeFieldsSlice.actions;
|
|
3220
|
-
const selectAssetTypeFieldsMapping = (state) => state.assetTypeFieldsReducer.instances;
|
|
3221
|
-
const selectAssetTypeFields = createSelector([selectAssetTypeFieldsMapping], (fieldsMapping) => {
|
|
3222
|
-
return Object.values(fieldsMapping);
|
|
3223
|
-
});
|
|
3224
|
-
const selectAssetTypeFieldsOfAssetType = restructureCreateSelectorWithArgs(
|
|
3225
|
-
createSelector([selectAssetTypeFields, (_state, assetTypeId) => assetTypeId], (fields, assetTypeId) => {
|
|
3226
|
-
return fallbackToEmptyArray(fields.filter((field) => field.asset_type === assetTypeId));
|
|
3227
|
-
})
|
|
3228
|
-
);
|
|
3229
|
-
const selectLatestAssetTypeFieldsOfAssetType = restructureCreateSelectorWithArgs(
|
|
3230
|
-
createSelector([selectAssetTypeFields, (_state, id) => id], (fields, id) => {
|
|
3231
|
-
return fields.filter((field) => field.asset_type === id).sort((a, b) => a.submitted_at > b.submitted_at ? -1 : 1)[0];
|
|
3232
|
-
})
|
|
3233
|
-
);
|
|
3234
|
-
const selectAssetTypeFieldsById = (fieldsId) => (state) => {
|
|
3235
|
-
return state.assetTypeFieldsReducer.instances[fieldsId];
|
|
3236
|
-
};
|
|
3237
|
-
const assetTypeFieldsReducer = assetTypeFieldsSlice.reducer;
|
|
3238
|
-
const assetTypeFieldValuesAdapter = createModelAdapter(
|
|
3239
|
-
(fieldValues) => fieldValues.offline_id
|
|
3240
|
-
);
|
|
3241
|
-
const initialState$2 = assetTypeFieldValuesAdapter.getInitialState({});
|
|
3242
|
-
const assetTypeFieldValuesSlice = createSlice({
|
|
3243
|
-
name: "assetTypeFieldValues",
|
|
3244
|
-
initialState: initialState$2,
|
|
3245
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$2)),
|
|
3246
|
-
reducers: {
|
|
3247
|
-
initializeAssetTypeFieldValues: assetTypeFieldValuesAdapter.initialize,
|
|
3248
|
-
addAssetTypeFieldValues: assetTypeFieldValuesAdapter.addOne,
|
|
3249
|
-
addAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.addMany,
|
|
3250
|
-
setAssetTypeFieldValues: assetTypeFieldValuesAdapter.setOne,
|
|
3251
|
-
setAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.setMany,
|
|
3252
|
-
updateAssetTypeFieldValues: assetTypeFieldValuesAdapter.updateOne,
|
|
3253
|
-
updateAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.updateMany,
|
|
3254
|
-
deleteAssetTypeFieldValues: assetTypeFieldValuesAdapter.deleteOne,
|
|
3255
|
-
deleteAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.deleteMany
|
|
3256
|
-
}
|
|
3257
|
-
});
|
|
3258
|
-
const {
|
|
3259
|
-
initializeAssetTypeFieldValues,
|
|
3260
|
-
addAssetTypeFieldValues,
|
|
3261
|
-
addAssetTypeFieldValuesMany,
|
|
3262
|
-
setAssetTypeFieldValues,
|
|
3263
|
-
setAssetTypeFieldValuesMany,
|
|
3264
|
-
updateAssetTypeFieldValues,
|
|
3265
|
-
updateAssetTypeFieldValuesMany,
|
|
3266
|
-
deleteAssetTypeFieldValues,
|
|
3267
|
-
deleteAssetTypeFieldValuesMany
|
|
3268
|
-
} = assetTypeFieldValuesSlice.actions;
|
|
3269
|
-
const selectAssetTypeFieldValuesMapping = (state) => state.assetTypeFieldValuesReducer.instances;
|
|
3270
|
-
const selectAssetTypeFieldValues = createSelector([selectAssetTypeFieldValuesMapping], (fieldValuesMapping) => {
|
|
3271
|
-
return Object.values(fieldValuesMapping);
|
|
3272
|
-
});
|
|
3273
|
-
const selectAssetTypeFieldValuesOfAsset = restructureCreateSelectorWithArgs(
|
|
3274
|
-
createSelector([selectAssetTypeFieldValues, (_state, assetId) => assetId], (fieldValues, assetId) => {
|
|
3275
|
-
return fallbackToEmptyArray(fieldValues.filter((fieldValue) => fieldValue.asset === assetId));
|
|
3276
|
-
})
|
|
3277
|
-
);
|
|
3278
|
-
const selectAssetTypeValuesOfAssetType = restructureCreateSelectorWithArgs(
|
|
3279
|
-
createSelector(
|
|
3280
|
-
[selectAssetTypeFields, selectAssetTypeFieldValues, (_state, id) => id],
|
|
3281
|
-
(fields, fieldValues, id) => {
|
|
3282
|
-
const fieldsIds = new Set(
|
|
3283
|
-
fields.filter((field) => field.asset_type === id).map((field) => field.offline_id)
|
|
3284
|
-
);
|
|
3285
|
-
return fallbackToEmptyArray(fieldValues.filter((values) => fieldsIds.has(values.fields_revision)));
|
|
3286
|
-
}
|
|
3287
|
-
)
|
|
3288
|
-
);
|
|
3289
|
-
const selectAssetTypeFieldValuesById = (fieldValuesId) => (state) => {
|
|
3290
|
-
return state.assetTypeFieldValuesReducer.instances[fieldValuesId];
|
|
3291
|
-
};
|
|
3292
|
-
const assetTypeFieldValuesReducer = assetTypeFieldValuesSlice.reducer;
|
|
3293
|
-
const assetTypeFieldsAttachmentAdapter = createModelAdapter(
|
|
3294
|
-
(attachment) => attachment.offline_id
|
|
3295
|
-
);
|
|
3296
|
-
const initialState$1 = assetTypeFieldsAttachmentAdapter.getInitialState({});
|
|
3297
|
-
const assetTypeFieldsAttachmentSlice = createSlice({
|
|
3298
|
-
name: "assetTypeFieldsAttachments",
|
|
3299
|
-
initialState: initialState$1,
|
|
3300
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$1)),
|
|
3301
|
-
reducers: {
|
|
3302
|
-
initializeAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.initialize,
|
|
3303
|
-
addAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.addOne,
|
|
3304
|
-
addAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.addMany,
|
|
3305
|
-
setAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.setOne,
|
|
3306
|
-
setAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.setMany,
|
|
3307
|
-
updateAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.updateOne,
|
|
3308
|
-
updateAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.updateMany,
|
|
3309
|
-
deleteAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.deleteOne,
|
|
3310
|
-
deleteAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.deleteMany
|
|
3311
|
-
}
|
|
3312
|
-
});
|
|
3313
|
-
const {
|
|
3314
|
-
initializeAssetTypeFieldsAttachments,
|
|
3315
|
-
addAssetTypeFieldsAttachment,
|
|
3316
|
-
addAssetTypeFieldsAttachments,
|
|
3317
|
-
setAssetTypeFieldsAttachment,
|
|
3318
|
-
setAssetTypeFieldsAttachments,
|
|
3319
|
-
updateAssetTypeFieldsAttachment,
|
|
3320
|
-
updateAssetTypeFieldsAttachments,
|
|
3321
|
-
deleteAssetTypeFieldsAttachment,
|
|
3322
|
-
deleteAssetTypeFieldsAttachments
|
|
3323
|
-
} = assetTypeFieldsAttachmentSlice.actions;
|
|
3324
|
-
const selectAssetTypeFieldsAttachmentsMapping = (state) => state.assetTypeFieldsAttachmentReducer.instances;
|
|
3325
|
-
const selectAssetTypeFieldsAttachments = createSelector(
|
|
3326
|
-
[selectAssetTypeFieldsAttachmentsMapping],
|
|
3327
|
-
(attachmentsMapping) => {
|
|
3328
|
-
return Object.values(attachmentsMapping);
|
|
3329
|
-
}
|
|
3330
|
-
);
|
|
3331
|
-
const selectAttachmentsOfAssetTypeFields = restructureCreateSelectorWithArgs(
|
|
3332
|
-
createSelector([selectAssetTypeFieldsAttachments, (_state, id) => id], (attachments, id) => {
|
|
3333
|
-
return fallbackToEmptyArray(attachments.filter((attachment) => attachment.fields_revision === id));
|
|
3334
|
-
})
|
|
3335
|
-
);
|
|
3336
|
-
const selectAssetTypeFieldsAttachmentById = (attachmentId) => (state) => {
|
|
3337
|
-
return state.assetTypeFieldsAttachmentReducer.instances[attachmentId];
|
|
3338
|
-
};
|
|
3339
|
-
const assetTypeFieldsAttachmentReducer = assetTypeFieldsAttachmentSlice.reducer;
|
|
3340
|
-
const assetTypeFieldValuesAttachmentAdapter = createModelAdapter(
|
|
3341
|
-
(attachment) => attachment.offline_id
|
|
3342
|
-
);
|
|
3343
|
-
const initialState = assetTypeFieldValuesAttachmentAdapter.getInitialState({});
|
|
3344
|
-
const assetTypeFieldValuesAttachmentSlice = createSlice({
|
|
3345
|
-
name: "assetTypeFieldValuesAttachments",
|
|
3346
|
-
initialState,
|
|
3347
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState)),
|
|
3348
|
-
reducers: {
|
|
3349
|
-
initializeAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.initialize,
|
|
3350
|
-
addAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.addOne,
|
|
3351
|
-
addAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.addMany,
|
|
3352
|
-
setAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.setOne,
|
|
3353
|
-
setAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.setMany,
|
|
3354
|
-
updateAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.updateOne,
|
|
3355
|
-
updateAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.updateMany,
|
|
3356
|
-
deleteAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.deleteOne,
|
|
3357
|
-
deleteAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.deleteMany
|
|
3358
|
-
}
|
|
3359
|
-
});
|
|
3360
|
-
const {
|
|
3361
|
-
initializeAssetTypeFieldValuesAttachments,
|
|
3362
|
-
addAssetTypeFieldValuesAttachment,
|
|
3363
|
-
addAssetTypeFieldValuesAttachments,
|
|
3364
|
-
setAssetTypeFieldValuesAttachment,
|
|
3365
|
-
setAssetTypeFieldValuesAttachments,
|
|
3366
|
-
updateAssetTypeFieldValuesAttachment,
|
|
3367
|
-
updateAssetTypeFieldValuesAttachments,
|
|
3368
|
-
deleteAssetTypeFieldValuesAttachment,
|
|
3369
|
-
deleteAssetTypeFieldValuesAttachments
|
|
3370
|
-
} = assetTypeFieldValuesAttachmentSlice.actions;
|
|
3371
|
-
const selectAssetTypeFieldValuesAttachmentsMapping = (state) => state.assetTypeFieldValuesAttachmentReducer.instances;
|
|
3372
|
-
const selectAssetTypeFieldValuesAttachments = createSelector(
|
|
3373
|
-
[selectAssetTypeFieldValuesAttachmentsMapping],
|
|
3374
|
-
(attachmentsMapping) => {
|
|
3375
|
-
return Object.values(attachmentsMapping);
|
|
3376
|
-
}
|
|
3377
|
-
);
|
|
3378
|
-
const selectAttachmentsOfAssetTypeFieldValues = restructureCreateSelectorWithArgs(
|
|
3379
|
-
createSelector([selectAssetTypeFieldValuesAttachments, (_state, id) => id], (attachments, id) => {
|
|
3380
|
-
return fallbackToEmptyArray(attachments.filter((attachment) => attachment.field_values === id));
|
|
3381
|
-
})
|
|
3382
|
-
);
|
|
3383
|
-
const selectAssetTypeFieldValuesAttachmentById = (attachmentId) => (state) => {
|
|
3384
|
-
return state.assetTypeFieldValuesAttachmentReducer.instances[attachmentId];
|
|
3385
|
-
};
|
|
3386
|
-
const assetTypeFieldValuesAttachmentReducer = assetTypeFieldValuesAttachmentSlice.reducer;
|
|
3387
|
-
let clientStore;
|
|
3388
|
-
function setClientStore(store) {
|
|
3389
|
-
clientStore = store;
|
|
3390
|
-
}
|
|
3391
|
-
function getClientStore() {
|
|
3392
|
-
return clientStore;
|
|
3393
|
-
}
|
|
3394
|
-
let clientSDK;
|
|
3395
|
-
function setClientSDK(sdkCtor) {
|
|
3396
|
-
clientSDK = sdkCtor;
|
|
3397
|
-
}
|
|
3398
|
-
function getClientSDK() {
|
|
3399
|
-
return clientSDK;
|
|
3400
|
-
}
|
|
3401
|
-
const CLASS_NAME_TO_SERVICE = {};
|
|
3402
|
-
class BaseService {
|
|
3403
|
-
constructor(sdk) {
|
|
3404
|
-
__publicField(this, "client");
|
|
3405
|
-
CLASS_NAME_TO_SERVICE[this.constructor.name] = this;
|
|
3406
|
-
this.client = sdk;
|
|
3407
|
-
}
|
|
3408
|
-
async enqueueRequest(requestDetails) {
|
|
3409
|
-
return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
|
|
3410
|
-
}
|
|
3411
|
-
dispatch(action) {
|
|
3412
|
-
this.client.store.dispatch(action);
|
|
3174
|
+
dispatch(action) {
|
|
3175
|
+
this.client.store.dispatch(action);
|
|
3413
3176
|
}
|
|
3414
3177
|
}
|
|
3415
3178
|
const VERSION_REDUCER_KEY = "versioning";
|
|
@@ -3452,15 +3215,7 @@ const overmapReducers = {
|
|
|
3452
3215
|
issueCommentReducer,
|
|
3453
3216
|
issueUpdateReducer,
|
|
3454
3217
|
geoImageReducer,
|
|
3455
|
-
issueAssociationReducer
|
|
3456
|
-
issueTypeFieldsReducer,
|
|
3457
|
-
issueTypeFieldValuesReducer,
|
|
3458
|
-
issueTypeFieldsAttachmentReducer,
|
|
3459
|
-
issueTypeFieldValuesAttachmentReducer,
|
|
3460
|
-
assetTypeFieldsReducer,
|
|
3461
|
-
assetTypeFieldValuesReducer,
|
|
3462
|
-
assetTypeFieldsAttachmentReducer,
|
|
3463
|
-
assetTypeFieldValuesAttachmentReducer
|
|
3218
|
+
issueAssociationReducer
|
|
3464
3219
|
};
|
|
3465
3220
|
const overmapReducer = combineReducers(overmapReducers);
|
|
3466
3221
|
const resetStore = "RESET";
|
|
@@ -4102,6 +3857,9 @@ class CategoryService extends BaseApiService {
|
|
|
4102
3857
|
description: "Create Category",
|
|
4103
3858
|
method: HttpMethod.POST,
|
|
4104
3859
|
url: "/categories/",
|
|
3860
|
+
queryParams: {
|
|
3861
|
+
workspace_id: payload.workspace.toString()
|
|
3862
|
+
},
|
|
4105
3863
|
payload: offlineCategory,
|
|
4106
3864
|
blockers: [payload.workspace],
|
|
4107
3865
|
blocks: [offlineCategory.offline_id]
|
|
@@ -4314,10 +4072,7 @@ class AssetService extends BaseApiService {
|
|
|
4314
4072
|
const result = await this.enqueueRequest({
|
|
4315
4073
|
description: "Get assets",
|
|
4316
4074
|
method: HttpMethod.GET,
|
|
4317
|
-
url:
|
|
4318
|
-
queryParams: {
|
|
4319
|
-
project: projectId.toString()
|
|
4320
|
-
},
|
|
4075
|
+
url: `/projects/${projectId}/assets/`,
|
|
4321
4076
|
blockers: [],
|
|
4322
4077
|
blocks: []
|
|
4323
4078
|
});
|
|
@@ -4338,7 +4093,7 @@ class AssetStageCompletionService extends BaseApiService {
|
|
|
4338
4093
|
const promise = this.enqueueRequest({
|
|
4339
4094
|
description: "Add asset stage completion",
|
|
4340
4095
|
method: HttpMethod.POST,
|
|
4341
|
-
url: "/
|
|
4096
|
+
url: "/assets/completions/",
|
|
4342
4097
|
payload: {
|
|
4343
4098
|
offline_id: offlineStageCompletion.offline_id,
|
|
4344
4099
|
submitted_at: submittedAt,
|
|
@@ -4365,7 +4120,7 @@ class AssetStageCompletionService extends BaseApiService {
|
|
|
4365
4120
|
const promise = this.enqueueRequest({
|
|
4366
4121
|
description: "Delete asset stage completion",
|
|
4367
4122
|
method: HttpMethod.DELETE,
|
|
4368
|
-
url: `/
|
|
4123
|
+
url: `/assets/completions/${id}/`,
|
|
4369
4124
|
blockers: [id],
|
|
4370
4125
|
blocks: []
|
|
4371
4126
|
});
|
|
@@ -4391,7 +4146,7 @@ class AssetStageCompletionService extends BaseApiService {
|
|
|
4391
4146
|
const promise = this.enqueueRequest({
|
|
4392
4147
|
description: "Bulk create asset stage completions",
|
|
4393
4148
|
method: HttpMethod.POST,
|
|
4394
|
-
url: "/
|
|
4149
|
+
url: "/assets/completions/bulk/",
|
|
4395
4150
|
payload: {
|
|
4396
4151
|
submitted_at: submittedAt,
|
|
4397
4152
|
completions: payload
|
|
@@ -4413,7 +4168,7 @@ class AssetStageCompletionService extends BaseApiService {
|
|
|
4413
4168
|
const promise = this.enqueueRequest({
|
|
4414
4169
|
description: "Deleting asset stage completions",
|
|
4415
4170
|
method: HttpMethod.DELETE,
|
|
4416
|
-
url: "/
|
|
4171
|
+
url: "/assets/completions/bulk/",
|
|
4417
4172
|
payload: {
|
|
4418
4173
|
completion_ids: ids
|
|
4419
4174
|
},
|
|
@@ -4429,10 +4184,7 @@ class AssetStageCompletionService extends BaseApiService {
|
|
|
4429
4184
|
const result = await this.enqueueRequest({
|
|
4430
4185
|
description: "Get asset stage completions",
|
|
4431
4186
|
method: HttpMethod.GET,
|
|
4432
|
-
url:
|
|
4433
|
-
queryParams: {
|
|
4434
|
-
project: projectId.toString()
|
|
4435
|
-
},
|
|
4187
|
+
url: `/projects/${projectId}/asset-stage-completions/`,
|
|
4436
4188
|
blockers: [],
|
|
4437
4189
|
blocks: []
|
|
4438
4190
|
});
|
|
@@ -4453,7 +4205,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4453
4205
|
const promise = this.enqueueRequest({
|
|
4454
4206
|
description: "Add asset stages",
|
|
4455
4207
|
method: HttpMethod.POST,
|
|
4456
|
-
url: "/
|
|
4208
|
+
url: "/assets/stages/bulk/",
|
|
4457
4209
|
payload: {
|
|
4458
4210
|
submitted_at: submittedAt,
|
|
4459
4211
|
asset_type: assetTypeId,
|
|
@@ -4477,7 +4229,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4477
4229
|
return this.enqueueRequest({
|
|
4478
4230
|
description: "Edit asset stages",
|
|
4479
4231
|
method: HttpMethod.PATCH,
|
|
4480
|
-
url: `/
|
|
4232
|
+
url: `/assets/types/${assetTypeId}/bulk-update-stages/`,
|
|
4481
4233
|
payload: {
|
|
4482
4234
|
stages: stagesToUpdate
|
|
4483
4235
|
},
|
|
@@ -4495,7 +4247,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4495
4247
|
const promise = this.enqueueRequest({
|
|
4496
4248
|
description: "Delete asset stages",
|
|
4497
4249
|
method: HttpMethod.DELETE,
|
|
4498
|
-
url: "/
|
|
4250
|
+
url: "/assets/stages/bulk/",
|
|
4499
4251
|
payload: {
|
|
4500
4252
|
stage_ids: idsToDelete
|
|
4501
4253
|
},
|
|
@@ -4520,7 +4272,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4520
4272
|
const promise = this.enqueueRequest({
|
|
4521
4273
|
description: "Update asset stage",
|
|
4522
4274
|
method: HttpMethod.PATCH,
|
|
4523
|
-
url: `/
|
|
4275
|
+
url: `/assets/stages/${assetStage.offline_id}/`,
|
|
4524
4276
|
payload: {
|
|
4525
4277
|
name: payload.name,
|
|
4526
4278
|
description: payload.description,
|
|
@@ -4548,7 +4300,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4548
4300
|
await this.enqueueRequest({
|
|
4549
4301
|
description: "Link asset stage to form",
|
|
4550
4302
|
method: HttpMethod.POST,
|
|
4551
|
-
url: `/
|
|
4303
|
+
url: `/assets/stages/${stageId}/associate-with-form/`,
|
|
4552
4304
|
payload: { form: formId },
|
|
4553
4305
|
blockers: [stageId, formId],
|
|
4554
4306
|
blocks: [stageId]
|
|
@@ -4569,7 +4321,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4569
4321
|
await this.enqueueRequest({
|
|
4570
4322
|
description: "Unlink asset stage from form",
|
|
4571
4323
|
method: HttpMethod.DELETE,
|
|
4572
|
-
url: `/
|
|
4324
|
+
url: `/assets/stages/${stageId}/associate-with-form/`,
|
|
4573
4325
|
blockers: [stageId, formId],
|
|
4574
4326
|
blocks: [stageId]
|
|
4575
4327
|
});
|
|
@@ -4582,10 +4334,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4582
4334
|
const result = await this.enqueueRequest({
|
|
4583
4335
|
description: "Get asset stages",
|
|
4584
4336
|
method: HttpMethod.GET,
|
|
4585
|
-
url:
|
|
4586
|
-
queryParams: {
|
|
4587
|
-
project: projectId.toString()
|
|
4588
|
-
},
|
|
4337
|
+
url: `/projects/${projectId}/asset-stages/`,
|
|
4589
4338
|
blockers: [],
|
|
4590
4339
|
blocks: []
|
|
4591
4340
|
});
|
|
@@ -4602,12 +4351,7 @@ class BaseUploadService extends BaseApiService {
|
|
|
4602
4351
|
projectAttachmentReducer: projectAttachmentReducer2,
|
|
4603
4352
|
formRevisionAttachmentReducer: formRevisionAttachmentReducer2,
|
|
4604
4353
|
formSubmissionAttachmentReducer: formSubmissionAttachmentReducer2,
|
|
4605
|
-
geoImageReducer: geoImageReducer2
|
|
4606
|
-
// fields
|
|
4607
|
-
assetTypeFieldsAttachmentReducer: assetTypeFieldsAttachmentReducer2,
|
|
4608
|
-
assetTypeFieldValuesAttachmentReducer: assetTypeFieldValuesAttachmentReducer2,
|
|
4609
|
-
issueTypeFieldsAttachmentReducer: issueTypeFieldsAttachmentReducer2,
|
|
4610
|
-
issueTypeFieldValuesAttachmentReducer: issueTypeFieldValuesAttachmentReducer2
|
|
4354
|
+
geoImageReducer: geoImageReducer2
|
|
4611
4355
|
} = this.client.store.getState();
|
|
4612
4356
|
const objectsWithSha1 = [].concat(
|
|
4613
4357
|
Object.values(issueAttachmentReducer2.instances),
|
|
@@ -4617,11 +4361,7 @@ class BaseUploadService extends BaseApiService {
|
|
|
4617
4361
|
Object.values(projectAttachmentReducer2.instances),
|
|
4618
4362
|
Object.values(formRevisionAttachmentReducer2.instances),
|
|
4619
4363
|
Object.values(formSubmissionAttachmentReducer2.instances),
|
|
4620
|
-
Object.values(geoImageReducer2.instances)
|
|
4621
|
-
Object.values(assetTypeFieldsAttachmentReducer2.instances),
|
|
4622
|
-
Object.values(assetTypeFieldValuesAttachmentReducer2.instances),
|
|
4623
|
-
Object.values(issueTypeFieldsAttachmentReducer2.instances),
|
|
4624
|
-
Object.values(issueTypeFieldValuesAttachmentReducer2.instances)
|
|
4364
|
+
Object.values(geoImageReducer2.instances)
|
|
4625
4365
|
);
|
|
4626
4366
|
return objectsWithSha1.filter((object) => object.file_sha1 === sha1).length;
|
|
4627
4367
|
}
|
|
@@ -4643,20 +4383,41 @@ class BaseUploadService extends BaseApiService {
|
|
|
4643
4383
|
}
|
|
4644
4384
|
return promisesBySha1;
|
|
4645
4385
|
}
|
|
4646
|
-
async getFilePayload(file) {
|
|
4647
|
-
const sha1 = await hashFile(file);
|
|
4648
|
-
const filePayload = {
|
|
4649
|
-
sha1,
|
|
4650
|
-
file_type: file.type,
|
|
4651
|
-
extension: file.name.split(".").pop(),
|
|
4652
|
-
size: file.size
|
|
4653
|
-
};
|
|
4654
|
-
await this.client.files.addCache(file, sha1);
|
|
4655
|
-
return filePayload;
|
|
4656
|
-
}
|
|
4657
4386
|
}
|
|
4387
|
+
const AttachmentModelMeta = {
|
|
4388
|
+
[AttachmentModel.Issue]: {
|
|
4389
|
+
name: "issue",
|
|
4390
|
+
attachUrlPrefix: "/issues",
|
|
4391
|
+
deleteUrlPrefix: "/issues",
|
|
4392
|
+
fetchUrlPostfix: "/issue-attachments"
|
|
4393
|
+
},
|
|
4394
|
+
[AttachmentModel.Asset]: {
|
|
4395
|
+
name: "asset",
|
|
4396
|
+
attachUrlPrefix: "/assets",
|
|
4397
|
+
deleteUrlPrefix: "/assets",
|
|
4398
|
+
fetchUrlPostfix: "/asset-attachments"
|
|
4399
|
+
},
|
|
4400
|
+
[AttachmentModel.AssetType]: {
|
|
4401
|
+
name: "asset type",
|
|
4402
|
+
attachUrlPrefix: "/assets/types",
|
|
4403
|
+
deleteUrlPrefix: "/assets/types",
|
|
4404
|
+
fetchUrlPostfix: "/asset-type-attachments"
|
|
4405
|
+
},
|
|
4406
|
+
[AttachmentModel.Project]: {
|
|
4407
|
+
name: "project",
|
|
4408
|
+
attachUrlPrefix: "/projects",
|
|
4409
|
+
deleteUrlPrefix: "/projects",
|
|
4410
|
+
fetchUrlPostfix: "/attachments"
|
|
4411
|
+
},
|
|
4412
|
+
[AttachmentModel.Document]: {
|
|
4413
|
+
name: "document",
|
|
4414
|
+
attachUrlPrefix: "/documents",
|
|
4415
|
+
deleteUrlPrefix: "/documents",
|
|
4416
|
+
fetchUrlPostfix: "/document-attachments"
|
|
4417
|
+
}
|
|
4418
|
+
};
|
|
4658
4419
|
class BaseAttachmentService extends BaseUploadService {
|
|
4659
|
-
async
|
|
4420
|
+
async attachFiles(files, modelId, buildOfflineAttachment) {
|
|
4660
4421
|
var _a2;
|
|
4661
4422
|
const { store } = this.client;
|
|
4662
4423
|
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
@@ -4664,36 +4425,39 @@ class BaseAttachmentService extends BaseUploadService {
|
|
|
4664
4425
|
const offlineAttachments = [];
|
|
4665
4426
|
const attachmentPayloads = [];
|
|
4666
4427
|
const filePayloads = {};
|
|
4667
|
-
for (const
|
|
4668
|
-
const
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4428
|
+
for (const file of files) {
|
|
4429
|
+
const sha1 = await hashFile(file);
|
|
4430
|
+
if (!(sha1 in filePayloads)) {
|
|
4431
|
+
filePayloads[sha1] = {
|
|
4432
|
+
sha1,
|
|
4433
|
+
file_type: file.type,
|
|
4434
|
+
extension: file.name.split(".").pop(),
|
|
4435
|
+
size: file.size
|
|
4436
|
+
};
|
|
4437
|
+
await this.client.files.addCache(file, sha1);
|
|
4438
|
+
}
|
|
4439
|
+
const offlineAttachment = buildOfflineAttachment({
|
|
4673
4440
|
file,
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4441
|
+
sha1,
|
|
4442
|
+
submittedAt,
|
|
4443
|
+
createdBy,
|
|
4677
4444
|
description: "",
|
|
4678
4445
|
modelId
|
|
4679
4446
|
});
|
|
4680
4447
|
offlineAttachments.push(offlineAttachment);
|
|
4681
|
-
attachmentPayloads.push(
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
description: offlineAttachment.description,
|
|
4688
|
-
modelId
|
|
4689
|
-
})
|
|
4690
|
-
);
|
|
4448
|
+
attachmentPayloads.push({
|
|
4449
|
+
offline_id: offlineAttachment.offline_id,
|
|
4450
|
+
name: offlineAttachment.file_name,
|
|
4451
|
+
sha1: offlineAttachment.file_sha1,
|
|
4452
|
+
description: offlineAttachment.description
|
|
4453
|
+
});
|
|
4691
4454
|
}
|
|
4692
4455
|
this.dispatch(this.addAttachments(offlineAttachments));
|
|
4456
|
+
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
4693
4457
|
const promise = this.enqueueRequest({
|
|
4694
|
-
description: `
|
|
4458
|
+
description: `Attach files to ${meta.name}`,
|
|
4695
4459
|
method: HttpMethod.POST,
|
|
4696
|
-
url: `${
|
|
4460
|
+
url: `${meta.attachUrlPrefix}/${modelId}/attach/`,
|
|
4697
4461
|
payload: {
|
|
4698
4462
|
submitted_at: submittedAt,
|
|
4699
4463
|
attachments: attachmentPayloads,
|
|
@@ -4710,7 +4474,7 @@ class BaseAttachmentService extends BaseUploadService {
|
|
|
4710
4474
|
});
|
|
4711
4475
|
return [offlineAttachments, promise.then(({ attachments }) => attachments)];
|
|
4712
4476
|
}
|
|
4713
|
-
async
|
|
4477
|
+
async deleteAttachment(attachmendId) {
|
|
4714
4478
|
const { store } = this.client;
|
|
4715
4479
|
const attachment = this.selectAttachment(attachmendId)(store.getState());
|
|
4716
4480
|
if (!attachment) {
|
|
@@ -4719,10 +4483,11 @@ class BaseAttachmentService extends BaseUploadService {
|
|
|
4719
4483
|
);
|
|
4720
4484
|
}
|
|
4721
4485
|
this.dispatch(this.removeAttachment(attachment.offline_id));
|
|
4486
|
+
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
4722
4487
|
const promise = this.enqueueRequest({
|
|
4723
|
-
description:
|
|
4488
|
+
description: "Delete attachment",
|
|
4724
4489
|
method: HttpMethod.DELETE,
|
|
4725
|
-
url: `${
|
|
4490
|
+
url: `${meta.deleteUrlPrefix}/attachments/${attachmendId}/`,
|
|
4726
4491
|
blockers: [attachmendId],
|
|
4727
4492
|
blocks: []
|
|
4728
4493
|
});
|
|
@@ -4735,12 +4500,24 @@ class BaseAttachmentService extends BaseUploadService {
|
|
|
4735
4500
|
});
|
|
4736
4501
|
return promise;
|
|
4737
4502
|
}
|
|
4503
|
+
// Note that currently the fetching of attachments for all models dependds on the active projectId. This may change in the future. And
|
|
4504
|
+
// so for some attachment model services, this method will have to be overridden.
|
|
4505
|
+
async refreshStore(projectId, _organizationId) {
|
|
4506
|
+
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
4507
|
+
const result = await this.enqueueRequest({
|
|
4508
|
+
description: `Get ${meta.name} attachments`,
|
|
4509
|
+
method: HttpMethod.GET,
|
|
4510
|
+
url: `/projects/${projectId}${meta.fetchUrlPostfix}/`,
|
|
4511
|
+
blocks: [],
|
|
4512
|
+
blockers: []
|
|
4513
|
+
});
|
|
4514
|
+
this.dispatch(this.initializeAttachments(result));
|
|
4515
|
+
}
|
|
4738
4516
|
}
|
|
4739
4517
|
class AssetAttachmentService extends BaseAttachmentService {
|
|
4740
4518
|
constructor() {
|
|
4741
4519
|
super(...arguments);
|
|
4742
|
-
__publicField(this, "
|
|
4743
|
-
__publicField(this, "url", "/asset-attachments");
|
|
4520
|
+
__publicField(this, "attachmentModel", AttachmentModel.Asset);
|
|
4744
4521
|
__publicField(this, "initializeAttachments", initializeAssetAttachments);
|
|
4745
4522
|
__publicField(this, "addAttachments", addAssetAttachments);
|
|
4746
4523
|
__publicField(this, "updateAttachments", updateAssetAttachments);
|
|
@@ -4752,39 +4529,20 @@ class AssetAttachmentService extends BaseAttachmentService {
|
|
|
4752
4529
|
buildOfflineAttachment(data) {
|
|
4753
4530
|
return offline({
|
|
4754
4531
|
file: URL.createObjectURL(data.file),
|
|
4755
|
-
file_sha1: data.
|
|
4756
|
-
created_by: data.
|
|
4532
|
+
file_sha1: data.sha1,
|
|
4533
|
+
created_by: data.createdBy,
|
|
4757
4534
|
file_name: data.file.name,
|
|
4758
4535
|
file_type: data.file.type,
|
|
4759
|
-
submitted_at: data.
|
|
4536
|
+
submitted_at: data.submittedAt,
|
|
4760
4537
|
description: data.description,
|
|
4761
4538
|
asset: data.modelId
|
|
4762
4539
|
});
|
|
4763
4540
|
}
|
|
4764
|
-
|
|
4765
|
-
return
|
|
4766
|
-
...data,
|
|
4767
|
-
asset: data.modelId
|
|
4768
|
-
};
|
|
4769
|
-
}
|
|
4770
|
-
async bulkAdd(payloads) {
|
|
4771
|
-
return this._bulkAdd(payloads.map((p) => ({ modelId: p.assetId, file: p.file })));
|
|
4772
|
-
}
|
|
4773
|
-
async delete(id) {
|
|
4774
|
-
return this._delete(id);
|
|
4541
|
+
async attachFilesToAsset(files, assetId) {
|
|
4542
|
+
return this.attachFiles(files, assetId, this.buildOfflineAttachment.bind(this));
|
|
4775
4543
|
}
|
|
4776
|
-
async
|
|
4777
|
-
|
|
4778
|
-
description: "Get asset attachments",
|
|
4779
|
-
method: HttpMethod.GET,
|
|
4780
|
-
url: `${this.url}/`,
|
|
4781
|
-
queryParams: {
|
|
4782
|
-
project: projectId.toString()
|
|
4783
|
-
},
|
|
4784
|
-
blocks: [],
|
|
4785
|
-
blockers: []
|
|
4786
|
-
});
|
|
4787
|
-
this.dispatch(initializeAssetAttachments(result));
|
|
4544
|
+
async deleteAssetAttachment(attachmentId) {
|
|
4545
|
+
return this.deleteAttachment(attachmentId);
|
|
4788
4546
|
}
|
|
4789
4547
|
}
|
|
4790
4548
|
class AssetTypeService extends BaseApiService {
|
|
@@ -4801,7 +4559,7 @@ class AssetTypeService extends BaseApiService {
|
|
|
4801
4559
|
const promise = this.enqueueRequest({
|
|
4802
4560
|
description: "Create asset type",
|
|
4803
4561
|
method: HttpMethod.POST,
|
|
4804
|
-
url:
|
|
4562
|
+
url: `/projects/${payload.project}/asset-types/`,
|
|
4805
4563
|
payload: { ...offlineAssetType },
|
|
4806
4564
|
blockers: [],
|
|
4807
4565
|
blocks: [offlineAssetType.offline_id]
|
|
@@ -4827,7 +4585,7 @@ class AssetTypeService extends BaseApiService {
|
|
|
4827
4585
|
const promise = this.enqueueRequest({
|
|
4828
4586
|
description: "Update asset type",
|
|
4829
4587
|
method: HttpMethod.PATCH,
|
|
4830
|
-
url: `/
|
|
4588
|
+
url: `/assets/types/${payload.offline_id}/`,
|
|
4831
4589
|
payload: {
|
|
4832
4590
|
icon: payload.icon,
|
|
4833
4591
|
color: payload.color,
|
|
@@ -4861,7 +4619,7 @@ class AssetTypeService extends BaseApiService {
|
|
|
4861
4619
|
return this.enqueueRequest({
|
|
4862
4620
|
description: "Delete asset type",
|
|
4863
4621
|
method: HttpMethod.DELETE,
|
|
4864
|
-
url: `/
|
|
4622
|
+
url: `/assets/types/${assetTypeId}/`,
|
|
4865
4623
|
blockers: [assetTypeId],
|
|
4866
4624
|
blocks: []
|
|
4867
4625
|
}).catch((e) => {
|
|
@@ -4876,10 +4634,7 @@ class AssetTypeService extends BaseApiService {
|
|
|
4876
4634
|
const result = await this.enqueueRequest({
|
|
4877
4635
|
description: "Get asset types",
|
|
4878
4636
|
method: HttpMethod.GET,
|
|
4879
|
-
url:
|
|
4880
|
-
queryParams: {
|
|
4881
|
-
project: projectId.toString()
|
|
4882
|
-
},
|
|
4637
|
+
url: `/projects/${projectId}/asset-types/`,
|
|
4883
4638
|
blockers: [],
|
|
4884
4639
|
blocks: []
|
|
4885
4640
|
});
|
|
@@ -4889,8 +4644,8 @@ class AssetTypeService extends BaseApiService {
|
|
|
4889
4644
|
class AssetTypeAttachmentService extends BaseAttachmentService {
|
|
4890
4645
|
constructor() {
|
|
4891
4646
|
super(...arguments);
|
|
4892
|
-
__publicField(this, "
|
|
4893
|
-
__publicField(this, "
|
|
4647
|
+
__publicField(this, "attachmentModel", AttachmentModel.AssetType);
|
|
4648
|
+
__publicField(this, "initializeAttachments", initializeAssetTypeAttachments);
|
|
4894
4649
|
__publicField(this, "addAttachments", addAssetTypeAttachments);
|
|
4895
4650
|
__publicField(this, "updateAttachments", updateAssetTypeAttachments);
|
|
4896
4651
|
__publicField(this, "removeAttachments", deleteAssetTypeAttachments);
|
|
@@ -4901,39 +4656,20 @@ class AssetTypeAttachmentService extends BaseAttachmentService {
|
|
|
4901
4656
|
buildOfflineAttachment(data) {
|
|
4902
4657
|
return offline({
|
|
4903
4658
|
file: URL.createObjectURL(data.file),
|
|
4904
|
-
file_sha1: data.
|
|
4905
|
-
created_by: data.
|
|
4659
|
+
file_sha1: data.sha1,
|
|
4660
|
+
created_by: data.createdBy,
|
|
4906
4661
|
file_name: data.file.name,
|
|
4907
4662
|
file_type: data.file.type,
|
|
4908
|
-
submitted_at: data.
|
|
4663
|
+
submitted_at: data.submittedAt,
|
|
4909
4664
|
description: data.description,
|
|
4910
4665
|
asset_type: data.modelId
|
|
4911
4666
|
});
|
|
4912
4667
|
}
|
|
4913
|
-
|
|
4914
|
-
return
|
|
4915
|
-
...data,
|
|
4916
|
-
asset_type: data.modelId
|
|
4917
|
-
};
|
|
4918
|
-
}
|
|
4919
|
-
async bulkAdd(payloads) {
|
|
4920
|
-
return this._bulkAdd(payloads.map((p) => ({ modelId: p.assetTypeId, file: p.file })));
|
|
4921
|
-
}
|
|
4922
|
-
async delete(attachmentId) {
|
|
4923
|
-
return this._delete(attachmentId);
|
|
4668
|
+
async attachFilesToAssetType(files, assetTypeId) {
|
|
4669
|
+
return this.attachFiles(files, assetTypeId, this.buildOfflineAttachment.bind(this));
|
|
4924
4670
|
}
|
|
4925
|
-
async
|
|
4926
|
-
|
|
4927
|
-
description: "Get asset type attachments",
|
|
4928
|
-
method: HttpMethod.GET,
|
|
4929
|
-
url: `${this.url}/`,
|
|
4930
|
-
queryParams: {
|
|
4931
|
-
project: projectId.toString()
|
|
4932
|
-
},
|
|
4933
|
-
blocks: [],
|
|
4934
|
-
blockers: []
|
|
4935
|
-
});
|
|
4936
|
-
this.dispatch(initializeAssetTypeAttachments(result));
|
|
4671
|
+
async deleteAssetTypeAttachment(attachmentId) {
|
|
4672
|
+
return this.deleteAttachment(attachmentId);
|
|
4937
4673
|
}
|
|
4938
4674
|
}
|
|
4939
4675
|
class IssueCommentService extends BaseApiService {
|
|
@@ -4949,7 +4685,7 @@ class IssueCommentService extends BaseApiService {
|
|
|
4949
4685
|
const promise = this.enqueueRequest({
|
|
4950
4686
|
description: "Add issue comment",
|
|
4951
4687
|
method: HttpMethod.POST,
|
|
4952
|
-
url:
|
|
4688
|
+
url: `/issues/${payload.issue}/comment/`,
|
|
4953
4689
|
payload: offlineComment,
|
|
4954
4690
|
blockers: [payload.issue],
|
|
4955
4691
|
blocks: [offlineComment.offline_id]
|
|
@@ -4973,7 +4709,7 @@ class IssueCommentService extends BaseApiService {
|
|
|
4973
4709
|
const promise = this.enqueueRequest({
|
|
4974
4710
|
description: "Edit issue comment",
|
|
4975
4711
|
method: HttpMethod.PATCH,
|
|
4976
|
-
url: `/
|
|
4712
|
+
url: `/issues/comments/${payload.offline_id}/`,
|
|
4977
4713
|
payload,
|
|
4978
4714
|
blockers: [payload.offline_id],
|
|
4979
4715
|
blocks: [payload.offline_id]
|
|
@@ -4992,7 +4728,7 @@ class IssueCommentService extends BaseApiService {
|
|
|
4992
4728
|
const promise = this.enqueueRequest({
|
|
4993
4729
|
description: "Delete comment",
|
|
4994
4730
|
method: HttpMethod.DELETE,
|
|
4995
|
-
url: `/
|
|
4731
|
+
url: `/issues/comments/${id}/`,
|
|
4996
4732
|
blockers: [id],
|
|
4997
4733
|
blocks: []
|
|
4998
4734
|
});
|
|
@@ -5005,10 +4741,7 @@ class IssueCommentService extends BaseApiService {
|
|
|
5005
4741
|
const result = await this.enqueueRequest({
|
|
5006
4742
|
description: "Get comments",
|
|
5007
4743
|
method: HttpMethod.GET,
|
|
5008
|
-
url:
|
|
5009
|
-
queryParams: {
|
|
5010
|
-
project: projectId.toString()
|
|
5011
|
-
},
|
|
4744
|
+
url: `/projects/${projectId}/comments/`,
|
|
5012
4745
|
blockers: [],
|
|
5013
4746
|
blocks: []
|
|
5014
4747
|
});
|
|
@@ -5020,21 +4753,27 @@ class IssueUpdateService extends BaseApiService {
|
|
|
5020
4753
|
const result = await this.enqueueRequest({
|
|
5021
4754
|
description: "Get issue updates",
|
|
5022
4755
|
method: HttpMethod.GET,
|
|
5023
|
-
url:
|
|
5024
|
-
queryParams: {
|
|
5025
|
-
project: projectId.toString()
|
|
5026
|
-
},
|
|
4756
|
+
url: `/projects/${projectId}/issues/updates/`,
|
|
5027
4757
|
blockers: [],
|
|
5028
4758
|
blocks: []
|
|
5029
4759
|
});
|
|
5030
|
-
|
|
4760
|
+
let filteredResult = result.filter(onlyUniqueOfflineIds);
|
|
4761
|
+
filteredResult = filteredResult.map((comment) => {
|
|
4762
|
+
return { ...comment };
|
|
4763
|
+
});
|
|
4764
|
+
if (result.length !== filteredResult.length) {
|
|
4765
|
+
console.error(
|
|
4766
|
+
`Received duplicate comments from the API (new length ${filteredResult.length}); filtered in browser.`
|
|
4767
|
+
);
|
|
4768
|
+
}
|
|
4769
|
+
this.dispatch(initializeIssueUpdates(filteredResult));
|
|
5031
4770
|
}
|
|
5032
4771
|
}
|
|
5033
4772
|
class IssueAttachmentService extends BaseAttachmentService {
|
|
5034
4773
|
constructor() {
|
|
5035
4774
|
super(...arguments);
|
|
5036
|
-
__publicField(this, "
|
|
5037
|
-
__publicField(this, "
|
|
4775
|
+
__publicField(this, "attachmentModel", AttachmentModel.Issue);
|
|
4776
|
+
__publicField(this, "initializeAttachments", initializeIssueAttachments);
|
|
5038
4777
|
__publicField(this, "addAttachments", addIssueAttachments);
|
|
5039
4778
|
__publicField(this, "updateAttachments", updateIssueAttachments);
|
|
5040
4779
|
__publicField(this, "removeAttachments", deleteIssueAttachments);
|
|
@@ -5045,42 +4784,24 @@ class IssueAttachmentService extends BaseAttachmentService {
|
|
|
5045
4784
|
buildOfflineAttachment(data) {
|
|
5046
4785
|
return offline({
|
|
5047
4786
|
file: URL.createObjectURL(data.file),
|
|
5048
|
-
file_sha1: data.
|
|
5049
|
-
created_by: data.
|
|
4787
|
+
file_sha1: data.sha1,
|
|
4788
|
+
created_by: data.createdBy,
|
|
5050
4789
|
file_name: data.file.name,
|
|
5051
4790
|
file_type: data.file.type,
|
|
5052
|
-
submitted_at: data.
|
|
4791
|
+
submitted_at: data.submittedAt,
|
|
5053
4792
|
description: data.description,
|
|
5054
4793
|
issue: data.modelId
|
|
5055
4794
|
});
|
|
5056
4795
|
}
|
|
5057
|
-
|
|
5058
|
-
return
|
|
5059
|
-
...data,
|
|
5060
|
-
issue: data.modelId
|
|
5061
|
-
};
|
|
5062
|
-
}
|
|
5063
|
-
async bulkAdd(payloads) {
|
|
5064
|
-
return this._bulkAdd(payloads.map((p) => ({ modelId: p.issueId, file: p.file })));
|
|
5065
|
-
}
|
|
5066
|
-
async delete(id) {
|
|
5067
|
-
return this._delete(id);
|
|
4796
|
+
async attachFilesToIssue(files, issueId) {
|
|
4797
|
+
return this.attachFiles(files, issueId, this.buildOfflineAttachment.bind(this));
|
|
5068
4798
|
}
|
|
5069
|
-
async
|
|
5070
|
-
|
|
5071
|
-
description: "Get issue attachments",
|
|
5072
|
-
method: HttpMethod.GET,
|
|
5073
|
-
url: `${this.url}/`,
|
|
5074
|
-
queryParams: {
|
|
5075
|
-
project: projectId.toString()
|
|
5076
|
-
},
|
|
5077
|
-
blocks: [],
|
|
5078
|
-
blockers: []
|
|
5079
|
-
});
|
|
5080
|
-
this.dispatch(initializeIssueAttachments(result));
|
|
4799
|
+
async deleteIssueAttachment(attachmentId) {
|
|
4800
|
+
return this.deleteAttachment(attachmentId);
|
|
5081
4801
|
}
|
|
5082
4802
|
}
|
|
5083
4803
|
class IssueService extends BaseApiService {
|
|
4804
|
+
// Basic CRUD functions
|
|
5084
4805
|
add(payload) {
|
|
5085
4806
|
var _a2;
|
|
5086
4807
|
const { store } = this.client;
|
|
@@ -5098,6 +4819,10 @@ class IssueService extends BaseApiService {
|
|
|
5098
4819
|
description: "Create issue",
|
|
5099
4820
|
method: HttpMethod.POST,
|
|
5100
4821
|
url: "/issues/",
|
|
4822
|
+
queryParams: {
|
|
4823
|
+
workspace_id: payload.index_workspace,
|
|
4824
|
+
...payload.issue_type ? { issue_type: payload.issue_type } : {}
|
|
4825
|
+
},
|
|
5101
4826
|
payload: offlineIssue,
|
|
5102
4827
|
blockers: ["add-issue", ...offlineIssue.index_workspace ? [offlineIssue.index_workspace] : []],
|
|
5103
4828
|
blocks: [offlineIssue.offline_id]
|
|
@@ -5253,10 +4978,7 @@ class IssueService extends BaseApiService {
|
|
|
5253
4978
|
const result = await this.enqueueRequest({
|
|
5254
4979
|
description: "Get issues",
|
|
5255
4980
|
method: HttpMethod.GET,
|
|
5256
|
-
url:
|
|
5257
|
-
queryParams: {
|
|
5258
|
-
project: projectId.toString()
|
|
5259
|
-
},
|
|
4981
|
+
url: `/projects/${projectId}/issues/`,
|
|
5260
4982
|
blockers: [],
|
|
5261
4983
|
blocks: []
|
|
5262
4984
|
});
|
|
@@ -5276,7 +4998,7 @@ class IssueTypeService extends BaseApiService {
|
|
|
5276
4998
|
this.dispatch(addIssueType(offlineIssueType));
|
|
5277
4999
|
const promise = this.enqueueRequest({
|
|
5278
5000
|
method: HttpMethod.POST,
|
|
5279
|
-
url:
|
|
5001
|
+
url: `/organizations/${payload.organization}/issue-types/`,
|
|
5280
5002
|
// Sending only whats needed here
|
|
5281
5003
|
payload: {
|
|
5282
5004
|
offline_id: offlineIssueType.offline_id,
|
|
@@ -5310,7 +5032,7 @@ class IssueTypeService extends BaseApiService {
|
|
|
5310
5032
|
this.dispatch(updateIssueType(offlineUpdatedIssueType));
|
|
5311
5033
|
const promise = this.enqueueRequest({
|
|
5312
5034
|
method: HttpMethod.PATCH,
|
|
5313
|
-
url: `/
|
|
5035
|
+
url: `/issues/types/${payload.offline_id}/`,
|
|
5314
5036
|
payload,
|
|
5315
5037
|
blockers: [payload.offline_id],
|
|
5316
5038
|
blocks: [payload.offline_id]
|
|
@@ -5334,7 +5056,7 @@ class IssueTypeService extends BaseApiService {
|
|
|
5334
5056
|
this.dispatch(deleteIssues(issuesOfIssueType.map((issue) => issue.offline_id)));
|
|
5335
5057
|
const promise = this.enqueueRequest({
|
|
5336
5058
|
method: HttpMethod.DELETE,
|
|
5337
|
-
url: `/
|
|
5059
|
+
url: `/issues/types/${id}/`,
|
|
5338
5060
|
blockers: [id],
|
|
5339
5061
|
blocks: []
|
|
5340
5062
|
});
|
|
@@ -5347,10 +5069,7 @@ class IssueTypeService extends BaseApiService {
|
|
|
5347
5069
|
async refreshStore(organizationId) {
|
|
5348
5070
|
const result = await this.enqueueRequest({
|
|
5349
5071
|
method: HttpMethod.GET,
|
|
5350
|
-
url:
|
|
5351
|
-
queryParams: {
|
|
5352
|
-
organization: organizationId.toString()
|
|
5353
|
-
},
|
|
5072
|
+
url: `/organizations/${organizationId}/issue-types/`,
|
|
5354
5073
|
blockers: [],
|
|
5355
5074
|
blocks: []
|
|
5356
5075
|
});
|
|
@@ -5494,8 +5213,8 @@ class ProjectFileService extends BaseApiService {
|
|
|
5494
5213
|
class ProjectAttachmentService extends BaseAttachmentService {
|
|
5495
5214
|
constructor() {
|
|
5496
5215
|
super(...arguments);
|
|
5497
|
-
__publicField(this, "
|
|
5498
|
-
__publicField(this, "
|
|
5216
|
+
__publicField(this, "attachmentModel", AttachmentModel.Project);
|
|
5217
|
+
__publicField(this, "initializeAttachments", initializeProjectAttachments);
|
|
5499
5218
|
__publicField(this, "addAttachments", addProjectAttachments);
|
|
5500
5219
|
__publicField(this, "updateAttachments", updateProjectAttachments);
|
|
5501
5220
|
__publicField(this, "removeAttachments", deleteProjectAttachments);
|
|
@@ -5506,39 +5225,20 @@ class ProjectAttachmentService extends BaseAttachmentService {
|
|
|
5506
5225
|
buildOfflineAttachment(data) {
|
|
5507
5226
|
return offline({
|
|
5508
5227
|
file: URL.createObjectURL(data.file),
|
|
5509
|
-
file_sha1: data.
|
|
5510
|
-
created_by: data.
|
|
5228
|
+
file_sha1: data.sha1,
|
|
5229
|
+
created_by: data.createdBy,
|
|
5511
5230
|
file_name: data.file.name,
|
|
5512
5231
|
file_type: data.file.type,
|
|
5513
|
-
submitted_at: data.
|
|
5232
|
+
submitted_at: data.submittedAt,
|
|
5514
5233
|
description: data.description,
|
|
5515
5234
|
project: data.modelId
|
|
5516
5235
|
});
|
|
5517
5236
|
}
|
|
5518
|
-
|
|
5519
|
-
return
|
|
5520
|
-
...data,
|
|
5521
|
-
project: data.modelId
|
|
5522
|
-
};
|
|
5523
|
-
}
|
|
5524
|
-
async bulkAdd(payloads) {
|
|
5525
|
-
return this._bulkAdd(payloads.map((p) => ({ modelId: p.projectId, file: p.file })));
|
|
5526
|
-
}
|
|
5527
|
-
async delete(attachmentId) {
|
|
5528
|
-
return this._delete(attachmentId);
|
|
5237
|
+
async attachFilesToProject(files, projectId) {
|
|
5238
|
+
return this.attachFiles(files, projectId, this.buildOfflineAttachment.bind(this));
|
|
5529
5239
|
}
|
|
5530
|
-
async
|
|
5531
|
-
|
|
5532
|
-
description: "Get project attachments",
|
|
5533
|
-
method: HttpMethod.GET,
|
|
5534
|
-
url: `${this.url}/`,
|
|
5535
|
-
queryParams: {
|
|
5536
|
-
project: projectId.toString()
|
|
5537
|
-
},
|
|
5538
|
-
blockers: [],
|
|
5539
|
-
blocks: []
|
|
5540
|
-
});
|
|
5541
|
-
this.dispatch(initializeProjectAttachments(result));
|
|
5240
|
+
async deleteProjectAttachment(attachmentId) {
|
|
5241
|
+
return this.deleteAttachment(attachmentId);
|
|
5542
5242
|
}
|
|
5543
5243
|
}
|
|
5544
5244
|
class ProjectService extends BaseApiService {
|
|
@@ -5681,33 +5381,88 @@ const separateImageFromFields = async (fields) => {
|
|
|
5681
5381
|
return { fields: newFields, images };
|
|
5682
5382
|
};
|
|
5683
5383
|
class FormService extends BaseUploadService {
|
|
5684
|
-
|
|
5384
|
+
async bulkAddRevisionAttachments(revisionId, files) {
|
|
5685
5385
|
var _a2;
|
|
5686
|
-
const { store } = this.client;
|
|
5687
5386
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5688
|
-
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5689
|
-
const
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5387
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5388
|
+
const filePayloads = {};
|
|
5389
|
+
const offlineFormRevisionAttachments = [];
|
|
5390
|
+
const attachmentPayloads = [];
|
|
5391
|
+
for (const [fieldIdentifier, file] of Object.entries(files)) {
|
|
5392
|
+
const sha1 = await hashFile(file);
|
|
5393
|
+
if (!(sha1 in filePayloads)) {
|
|
5394
|
+
filePayloads[sha1] = {
|
|
5395
|
+
sha1,
|
|
5396
|
+
file_type: file.type,
|
|
5397
|
+
extension: file.name.split(".").pop(),
|
|
5398
|
+
size: file.size
|
|
5399
|
+
};
|
|
5400
|
+
await this.client.files.addCache(file, sha1);
|
|
5401
|
+
}
|
|
5402
|
+
const offlineFormRevisionAttachment = offline({
|
|
5403
|
+
file: URL.createObjectURL(file),
|
|
5404
|
+
file_type: file.type,
|
|
5405
|
+
file_name: file.name,
|
|
5406
|
+
file_sha1: sha1,
|
|
5407
|
+
created_by: createdBy,
|
|
5408
|
+
revision: revisionId,
|
|
5409
|
+
submitted_at: submittedAt,
|
|
5410
|
+
field_identifier: fieldIdentifier
|
|
5411
|
+
});
|
|
5412
|
+
offlineFormRevisionAttachments.push(offlineFormRevisionAttachment);
|
|
5413
|
+
const attachmentPayload = {
|
|
5414
|
+
offline_id: offlineFormRevisionAttachment.offline_id,
|
|
5415
|
+
name: file.name,
|
|
5416
|
+
field_identifier: fieldIdentifier,
|
|
5417
|
+
sha1
|
|
5418
|
+
};
|
|
5419
|
+
attachmentPayloads.push(attachmentPayload);
|
|
5420
|
+
}
|
|
5421
|
+
this.dispatch(addFormRevisionAttachments(offlineFormRevisionAttachments));
|
|
5422
|
+
const promise = this.enqueueRequest({
|
|
5423
|
+
description: "Attach files to form revision",
|
|
5424
|
+
method: HttpMethod.POST,
|
|
5425
|
+
url: `/forms/revisions/${revisionId}/attachments/bulk/`,
|
|
5426
|
+
payload: {
|
|
5427
|
+
submitted_at: submittedAt,
|
|
5428
|
+
attachments: attachmentPayloads,
|
|
5429
|
+
files: Object.values(filePayloads)
|
|
5430
|
+
},
|
|
5431
|
+
blockers: [revisionId],
|
|
5432
|
+
blocks: offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
5433
|
+
});
|
|
5434
|
+
promise.then((result) => {
|
|
5435
|
+
this.processPresignedUrls(result.presigned_urls);
|
|
5436
|
+
this.dispatch(updateFormRevisionAttachments(result.attachments));
|
|
5437
|
+
}).catch(() => {
|
|
5438
|
+
this.dispatch(
|
|
5439
|
+
deleteFormRevisionAttachments(
|
|
5440
|
+
offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
5441
|
+
)
|
|
5442
|
+
);
|
|
5693
5443
|
});
|
|
5444
|
+
return [offlineFormRevisionAttachments, promise.then(({ attachments }) => attachments)];
|
|
5445
|
+
}
|
|
5446
|
+
async add(ownerId, form, initialRevision, urlPrefix) {
|
|
5447
|
+
const { fields, images } = await separateImageFromFields(initialRevision.fields);
|
|
5694
5448
|
const offlineFormRevision = offline({
|
|
5695
5449
|
...initialRevision,
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5450
|
+
fields,
|
|
5451
|
+
created_by: form.created_by,
|
|
5452
|
+
form: form.offline_id,
|
|
5453
|
+
submitted_at: form.submitted_at,
|
|
5454
|
+
revision: "Pending"
|
|
5700
5455
|
});
|
|
5701
|
-
this.dispatch(addForm(
|
|
5456
|
+
this.dispatch(addForm(form));
|
|
5702
5457
|
this.dispatch(addFormRevision(offlineFormRevision));
|
|
5703
5458
|
const formPromise = this.enqueueRequest({
|
|
5704
5459
|
description: "Create form",
|
|
5705
5460
|
method: HttpMethod.POST,
|
|
5706
|
-
url:
|
|
5461
|
+
url: urlPrefix,
|
|
5707
5462
|
payload: {
|
|
5708
5463
|
// Sending exactly what is currently needed for the endpoint
|
|
5709
|
-
offline_id:
|
|
5710
|
-
submitted_at:
|
|
5464
|
+
offline_id: form.offline_id,
|
|
5465
|
+
submitted_at: form.submitted_at,
|
|
5711
5466
|
initial_revision: {
|
|
5712
5467
|
offline_id: offlineFormRevision.offline_id,
|
|
5713
5468
|
submitted_at: offlineFormRevision.submitted_at,
|
|
@@ -5716,41 +5471,134 @@ class FormService extends BaseUploadService {
|
|
|
5716
5471
|
fields: offlineFormRevision.fields
|
|
5717
5472
|
}
|
|
5718
5473
|
},
|
|
5719
|
-
blockers: [
|
|
5720
|
-
|
|
5721
|
-
...payload.organization ? [payload.organization.toString()] : []
|
|
5722
|
-
],
|
|
5723
|
-
blocks: [offlineForm.offline_id, offlineFormRevision.offline_id]
|
|
5474
|
+
blockers: [ownerId],
|
|
5475
|
+
blocks: [form.offline_id, offlineFormRevision.offline_id]
|
|
5724
5476
|
});
|
|
5477
|
+
const [offlineFormRevisionAttachments, attachmentsPromise] = await this.bulkAddRevisionAttachments(
|
|
5478
|
+
offlineFormRevision.offline_id,
|
|
5479
|
+
images
|
|
5480
|
+
);
|
|
5725
5481
|
void formPromise.catch((e) => {
|
|
5726
|
-
this.dispatch(deleteForm(
|
|
5482
|
+
this.dispatch(deleteForm(form.offline_id));
|
|
5727
5483
|
this.dispatch(deleteFormRevision(offlineFormRevision.offline_id));
|
|
5728
5484
|
throw e;
|
|
5729
5485
|
});
|
|
5730
|
-
return [
|
|
5486
|
+
return [form, offlineFormRevision, offlineFormRevisionAttachments, formPromise, attachmentsPromise];
|
|
5731
5487
|
}
|
|
5732
|
-
|
|
5488
|
+
addForOrganization(organizationId, initialRevision) {
|
|
5489
|
+
var _a2;
|
|
5490
|
+
const state = this.client.store.getState();
|
|
5491
|
+
const offlineForm = offline({
|
|
5492
|
+
favorite: false,
|
|
5493
|
+
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5494
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5495
|
+
organization: organizationId
|
|
5496
|
+
});
|
|
5497
|
+
return this.add(
|
|
5498
|
+
organizationId.toString(),
|
|
5499
|
+
offlineForm,
|
|
5500
|
+
initialRevision,
|
|
5501
|
+
`/organizations/${organizationId}/create-form/`
|
|
5502
|
+
);
|
|
5503
|
+
}
|
|
5504
|
+
addForProject(projectId, initialRevision) {
|
|
5505
|
+
var _a2;
|
|
5506
|
+
const state = this.client.store.getState();
|
|
5507
|
+
const offlineForm = offline({
|
|
5508
|
+
favorite: false,
|
|
5509
|
+
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5510
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5511
|
+
project: projectId
|
|
5512
|
+
});
|
|
5513
|
+
return this.add(projectId.toString(), offlineForm, initialRevision, `/projects/${projectId}/create-form/`);
|
|
5514
|
+
}
|
|
5515
|
+
addForIssueType(issueTypeId, initialRevision) {
|
|
5516
|
+
var _a2;
|
|
5517
|
+
const state = this.client.store.getState();
|
|
5518
|
+
const offlineForm = offline({
|
|
5519
|
+
favorite: false,
|
|
5520
|
+
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5521
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5522
|
+
issue_type: issueTypeId
|
|
5523
|
+
});
|
|
5524
|
+
return this.add(issueTypeId, offlineForm, initialRevision, `/issues/types/${issueTypeId}/create-form/`);
|
|
5525
|
+
}
|
|
5526
|
+
addForAssetType(assetTypeId, initialRevision) {
|
|
5527
|
+
var _a2;
|
|
5528
|
+
const state = this.client.store.getState();
|
|
5529
|
+
const offlineForm = offline({
|
|
5530
|
+
favorite: false,
|
|
5531
|
+
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5532
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5533
|
+
asset_type: assetTypeId
|
|
5534
|
+
});
|
|
5535
|
+
return this.add(assetTypeId, offlineForm, initialRevision, `/assets/types/${assetTypeId}/create-form/`);
|
|
5536
|
+
}
|
|
5537
|
+
async createRevision(formId, revision) {
|
|
5538
|
+
var _a2;
|
|
5539
|
+
const offlineRevision = offline(revision);
|
|
5540
|
+
const { store } = this.client;
|
|
5541
|
+
const state = store.getState();
|
|
5542
|
+
const createdBy = (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5543
|
+
const { fields, images } = await separateImageFromFields(offlineRevision.fields);
|
|
5544
|
+
const fullRevision = {
|
|
5545
|
+
...offlineRevision,
|
|
5546
|
+
fields,
|
|
5547
|
+
created_by: createdBy,
|
|
5548
|
+
revision: "Pending",
|
|
5549
|
+
form: formId,
|
|
5550
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
5551
|
+
};
|
|
5552
|
+
this.dispatch(addFormRevision(fullRevision));
|
|
5553
|
+
const promise = this.enqueueRequest({
|
|
5554
|
+
description: "Create form revision",
|
|
5555
|
+
method: HttpMethod.PATCH,
|
|
5556
|
+
url: `/forms/${formId}/`,
|
|
5557
|
+
payload: {
|
|
5558
|
+
initial_revision: {
|
|
5559
|
+
offline_id: fullRevision.offline_id,
|
|
5560
|
+
submitted_at: fullRevision.submitted_at,
|
|
5561
|
+
title: fullRevision.title,
|
|
5562
|
+
description: fullRevision.description,
|
|
5563
|
+
fields: fullRevision.fields
|
|
5564
|
+
}
|
|
5565
|
+
},
|
|
5566
|
+
blockers: [formId],
|
|
5567
|
+
blocks: [offlineRevision.offline_id]
|
|
5568
|
+
});
|
|
5569
|
+
const [offlineFormRevisionAttachments, attachmentsPromise] = await this.bulkAddRevisionAttachments(
|
|
5570
|
+
fullRevision.offline_id,
|
|
5571
|
+
images
|
|
5572
|
+
);
|
|
5573
|
+
void promise.then((result) => {
|
|
5574
|
+
this.dispatch(setFormRevision(result));
|
|
5575
|
+
}).catch(() => {
|
|
5576
|
+
this.dispatch(deleteFormRevision(fullRevision.offline_id));
|
|
5577
|
+
});
|
|
5578
|
+
return [fullRevision, offlineFormRevisionAttachments, promise, attachmentsPromise];
|
|
5579
|
+
}
|
|
5580
|
+
async delete(formId) {
|
|
5733
5581
|
const { store } = this.client;
|
|
5734
5582
|
const state = store.getState();
|
|
5735
|
-
const form = selectFormById(
|
|
5583
|
+
const form = selectFormById(formId)(state);
|
|
5736
5584
|
if (!form) {
|
|
5737
5585
|
throw new Error("Expected form to exist");
|
|
5738
5586
|
}
|
|
5739
|
-
const formSubmissions = selectFormSubmissionsOfForm(
|
|
5587
|
+
const formSubmissions = selectFormSubmissionsOfForm(formId)(state);
|
|
5740
5588
|
if (formSubmissions.length > 0) {
|
|
5741
5589
|
this.dispatch(deleteFormSubmissions(formSubmissions.map(({ offline_id }) => offline_id)));
|
|
5742
5590
|
}
|
|
5743
|
-
const formRevisions = selectFormRevisionsOfForm(
|
|
5591
|
+
const formRevisions = selectFormRevisionsOfForm(formId)(state);
|
|
5744
5592
|
if (formRevisions.length > 0) {
|
|
5745
5593
|
this.dispatch(deleteFormRevisions(formRevisions.map(({ offline_id }) => offline_id)));
|
|
5746
5594
|
}
|
|
5747
|
-
this.dispatch(deleteForm(
|
|
5595
|
+
this.dispatch(deleteForm(formId));
|
|
5748
5596
|
try {
|
|
5749
5597
|
return await this.enqueueRequest({
|
|
5750
5598
|
description: "Delete form",
|
|
5751
5599
|
method: HttpMethod.DELETE,
|
|
5752
|
-
url: `/forms/${
|
|
5753
|
-
blockers: [
|
|
5600
|
+
url: `/forms/${formId}/`,
|
|
5601
|
+
blockers: [formId],
|
|
5754
5602
|
blocks: []
|
|
5755
5603
|
});
|
|
5756
5604
|
} catch (e) {
|
|
@@ -5764,31 +5612,65 @@ class FormService extends BaseUploadService {
|
|
|
5764
5612
|
throw e;
|
|
5765
5613
|
}
|
|
5766
5614
|
}
|
|
5767
|
-
async refreshStore(projectId
|
|
5768
|
-
|
|
5769
|
-
const
|
|
5615
|
+
async refreshStore(projectId) {
|
|
5616
|
+
const forms = [];
|
|
5617
|
+
const revisions = [];
|
|
5618
|
+
const attachments = [];
|
|
5619
|
+
const projectFormsResult = await this.enqueueRequest({
|
|
5770
5620
|
description: "Fetch project forms",
|
|
5771
5621
|
method: HttpMethod.GET,
|
|
5772
|
-
url:
|
|
5773
|
-
queryParams: {
|
|
5774
|
-
project: projectId.toString()
|
|
5775
|
-
},
|
|
5622
|
+
url: `/projects/${projectId}/forms/`,
|
|
5776
5623
|
blockers: [projectId.toString()],
|
|
5777
5624
|
blocks: []
|
|
5778
5625
|
});
|
|
5779
|
-
|
|
5780
|
-
|
|
5626
|
+
for (const form of projectFormsResult.forms)
|
|
5627
|
+
forms.push(form);
|
|
5628
|
+
for (const revision of projectFormsResult.revisions)
|
|
5629
|
+
revisions.push(revision);
|
|
5630
|
+
for (const attachment of projectFormsResult.attachments)
|
|
5631
|
+
attachments.push(attachment);
|
|
5632
|
+
const organizationFormsResult = await this.enqueueRequest({
|
|
5781
5633
|
description: "Fetch organization forms",
|
|
5782
5634
|
method: HttpMethod.GET,
|
|
5783
|
-
url:
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5635
|
+
url: `/projects/${projectId}/organizations/forms/`,
|
|
5636
|
+
blockers: [projectId.toString()],
|
|
5637
|
+
blocks: []
|
|
5638
|
+
});
|
|
5639
|
+
for (const form of organizationFormsResult.forms)
|
|
5640
|
+
forms.push(form);
|
|
5641
|
+
for (const revision of organizationFormsResult.revisions)
|
|
5642
|
+
revisions.push(revision);
|
|
5643
|
+
for (const attachment of organizationFormsResult.attachments)
|
|
5644
|
+
attachments.push(attachment);
|
|
5645
|
+
const assetTypeFormsResult = await this.enqueueRequest({
|
|
5646
|
+
description: "Fetch asset type forms",
|
|
5647
|
+
method: HttpMethod.GET,
|
|
5648
|
+
url: `/projects/${projectId}/asset-types/forms/`,
|
|
5649
|
+
blockers: [projectId.toString()],
|
|
5650
|
+
blocks: []
|
|
5651
|
+
});
|
|
5652
|
+
for (const form of assetTypeFormsResult.forms)
|
|
5653
|
+
forms.push(form);
|
|
5654
|
+
for (const revision of assetTypeFormsResult.revisions)
|
|
5655
|
+
revisions.push(revision);
|
|
5656
|
+
for (const attachment of assetTypeFormsResult.attachments)
|
|
5657
|
+
attachments.push(attachment);
|
|
5658
|
+
const issueTypeFormsResult = await this.enqueueRequest({
|
|
5659
|
+
description: "Fetch issue type forms",
|
|
5660
|
+
method: HttpMethod.GET,
|
|
5661
|
+
url: `/projects/${projectId}/issue-types/forms/`,
|
|
5662
|
+
blockers: [projectId.toString()],
|
|
5788
5663
|
blocks: []
|
|
5789
5664
|
});
|
|
5790
|
-
|
|
5665
|
+
for (const form of issueTypeFormsResult.forms)
|
|
5666
|
+
forms.push(form);
|
|
5667
|
+
for (const revision of issueTypeFormsResult.revisions)
|
|
5668
|
+
revisions.push(revision);
|
|
5669
|
+
for (const attachment of issueTypeFormsResult.attachments)
|
|
5670
|
+
attachments.push(attachment);
|
|
5791
5671
|
this.dispatch(initializeForms(forms));
|
|
5672
|
+
this.dispatch(initializeFormRevisions(revisions));
|
|
5673
|
+
this.dispatch(initializeFormRevisionAttachments(attachments));
|
|
5792
5674
|
}
|
|
5793
5675
|
}
|
|
5794
5676
|
const isArrayOfFiles = (value) => {
|
|
@@ -5810,11 +5692,95 @@ const separateFilesFromValues = (values) => {
|
|
|
5810
5692
|
return { values: newValues, files };
|
|
5811
5693
|
};
|
|
5812
5694
|
class FormSubmissionService extends BaseUploadService {
|
|
5813
|
-
|
|
5695
|
+
async bulkAddSubmissionAttachments(submissionId, files) {
|
|
5696
|
+
var _a2;
|
|
5697
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5698
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5699
|
+
const filePayloads = {};
|
|
5700
|
+
const offlineFormSubmissionAttachments = [];
|
|
5701
|
+
const attachmentPayloads = [];
|
|
5702
|
+
for (const [fieldIdentifier, filesArray] of Object.entries(files)) {
|
|
5703
|
+
for (const file of filesArray) {
|
|
5704
|
+
const sha1 = await hashFile(file);
|
|
5705
|
+
if (!(sha1 in filePayloads)) {
|
|
5706
|
+
filePayloads[sha1] = {
|
|
5707
|
+
sha1,
|
|
5708
|
+
file_type: file.type,
|
|
5709
|
+
extension: file.name.split(".").pop(),
|
|
5710
|
+
size: file.size
|
|
5711
|
+
};
|
|
5712
|
+
await this.client.files.addCache(file, sha1);
|
|
5713
|
+
}
|
|
5714
|
+
const offlineFormSubmissionAttachment = offline({
|
|
5715
|
+
file: URL.createObjectURL(file),
|
|
5716
|
+
file_type: file.type,
|
|
5717
|
+
file_name: file.name,
|
|
5718
|
+
file_sha1: sha1,
|
|
5719
|
+
created_by: createdBy,
|
|
5720
|
+
submission: submissionId,
|
|
5721
|
+
submitted_at: submittedAt,
|
|
5722
|
+
field_identifier: fieldIdentifier
|
|
5723
|
+
});
|
|
5724
|
+
offlineFormSubmissionAttachments.push(offlineFormSubmissionAttachment);
|
|
5725
|
+
const attachmentPayload = {
|
|
5726
|
+
offline_id: offlineFormSubmissionAttachment.offline_id,
|
|
5727
|
+
name: file.name,
|
|
5728
|
+
sha1,
|
|
5729
|
+
field_identifier: fieldIdentifier
|
|
5730
|
+
};
|
|
5731
|
+
attachmentPayloads.push(attachmentPayload);
|
|
5732
|
+
}
|
|
5733
|
+
}
|
|
5734
|
+
this.dispatch(addFormSubmissionAttachments(offlineFormSubmissionAttachments));
|
|
5735
|
+
const promise = this.enqueueRequest({
|
|
5736
|
+
description: "Attach files to form submission",
|
|
5737
|
+
method: HttpMethod.POST,
|
|
5738
|
+
url: `/forms/submissions/${submissionId}/attachments/bulk/`,
|
|
5739
|
+
payload: {
|
|
5740
|
+
submitted_at: submittedAt,
|
|
5741
|
+
attachments: attachmentPayloads,
|
|
5742
|
+
files: Object.values(filePayloads)
|
|
5743
|
+
},
|
|
5744
|
+
blockers: [submissionId],
|
|
5745
|
+
blocks: offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
5746
|
+
});
|
|
5747
|
+
promise.then((result) => {
|
|
5748
|
+
this.processPresignedUrls(result.presigned_urls);
|
|
5749
|
+
this.dispatch(updateFormSubmissionAttachments(result.attachments));
|
|
5750
|
+
}).catch(() => {
|
|
5751
|
+
this.dispatch(
|
|
5752
|
+
deleteFormSubmissionAttachments(
|
|
5753
|
+
offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
5754
|
+
)
|
|
5755
|
+
);
|
|
5756
|
+
});
|
|
5757
|
+
return [offlineFormSubmissionAttachments, promise.then(({ attachments }) => attachments)];
|
|
5758
|
+
}
|
|
5759
|
+
async bulkDeleteSubmissionAttachments(submissionId, attachmentsIds) {
|
|
5760
|
+
const { store } = this.client;
|
|
5761
|
+
const state = store.getState();
|
|
5762
|
+
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
|
|
5763
|
+
this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
|
|
5764
|
+
try {
|
|
5765
|
+
await this.enqueueRequest({
|
|
5766
|
+
description: "Delete form submission attachments",
|
|
5767
|
+
method: HttpMethod.DELETE,
|
|
5768
|
+
url: `/forms/submissions/${submissionId}/attachments/bulk/`,
|
|
5769
|
+
payload: { attachments: attachmentsIds },
|
|
5770
|
+
blockers: [submissionId, ...attachmentsIds],
|
|
5771
|
+
blocks: []
|
|
5772
|
+
});
|
|
5773
|
+
} catch (e) {
|
|
5774
|
+
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
5775
|
+
throw e;
|
|
5776
|
+
}
|
|
5777
|
+
}
|
|
5778
|
+
// Outer promise is for hashing and caching files for submission attachments
|
|
5779
|
+
async add(payload) {
|
|
5814
5780
|
var _a2;
|
|
5815
5781
|
const { store } = this.client;
|
|
5816
5782
|
const state = store.getState();
|
|
5817
|
-
const { values } = separateFilesFromValues(payload.values);
|
|
5783
|
+
const { values, files } = separateFilesFromValues(payload.values);
|
|
5818
5784
|
const offlineSubmission = offline({
|
|
5819
5785
|
...payload,
|
|
5820
5786
|
values,
|
|
@@ -5824,7 +5790,7 @@ class FormSubmissionService extends BaseUploadService {
|
|
|
5824
5790
|
const promise = this.enqueueRequest({
|
|
5825
5791
|
description: "Respond to form",
|
|
5826
5792
|
method: HttpMethod.POST,
|
|
5827
|
-
url:
|
|
5793
|
+
url: `/forms/revisions/${payload.form_revision}/respond/`,
|
|
5828
5794
|
payload: offlineSubmission,
|
|
5829
5795
|
blockers: [payload.issue, payload.asset, payload.asset_stage, "add-form-entry"].filter(
|
|
5830
5796
|
(x) => x !== void 0
|
|
@@ -5832,6 +5798,10 @@ class FormSubmissionService extends BaseUploadService {
|
|
|
5832
5798
|
blocks: [offlineSubmission.offline_id]
|
|
5833
5799
|
});
|
|
5834
5800
|
this.dispatch(addFormSubmission(offlineSubmission));
|
|
5801
|
+
const [offlineFormSubmissionAttachments, attachmentsPromise] = await this.bulkAddSubmissionAttachments(
|
|
5802
|
+
offlineSubmission.offline_id,
|
|
5803
|
+
files
|
|
5804
|
+
);
|
|
5835
5805
|
promise.then((result) => {
|
|
5836
5806
|
this.dispatch(addActiveProjectFormSubmissionsCount(1));
|
|
5837
5807
|
this.dispatch(setFormSubmission(result));
|
|
@@ -5840,16 +5810,115 @@ class FormSubmissionService extends BaseUploadService {
|
|
|
5840
5810
|
this.dispatch(deleteFormSubmission(offlineSubmission.offline_id));
|
|
5841
5811
|
this.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
5842
5812
|
});
|
|
5843
|
-
return [offlineSubmission, promise];
|
|
5813
|
+
return [offlineSubmission, offlineFormSubmissionAttachments, promise, attachmentsPromise];
|
|
5844
5814
|
}
|
|
5845
|
-
|
|
5815
|
+
// Note currently the bulkAdd method is specific to form submissions for assets
|
|
5816
|
+
// TODO: adapt the support bulk adding to any model type
|
|
5817
|
+
async bulkAdd(args, batchSize) {
|
|
5818
|
+
const { formRevision, commonFieldValues, fieldValuesByAsset } = args;
|
|
5819
|
+
const { values: fileSeperatedCommonFieldValues, files: commonFiles } = separateFilesFromValues(commonFieldValues);
|
|
5820
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5821
|
+
const transactionId = v4();
|
|
5822
|
+
const assetIdBatches = chunkArray(Object.keys(fieldValuesByAsset), batchSize);
|
|
5823
|
+
const bulkAddBatches = await Promise.all(
|
|
5824
|
+
assetIdBatches.map(async (assetIdBatch) => {
|
|
5825
|
+
const batchId = v4();
|
|
5826
|
+
const submissionPayloads = [];
|
|
5827
|
+
const attachmentPayloads = [];
|
|
5828
|
+
const files = { ...commonFiles };
|
|
5829
|
+
for (const assetId of assetIdBatch) {
|
|
5830
|
+
const { values: fileSeperatedSubmissionSpecificValues, files: submissionSpecificFiles } = separateFilesFromValues(fieldValuesByAsset[assetId] ?? {});
|
|
5831
|
+
Object.assign(files, submissionSpecificFiles);
|
|
5832
|
+
const submissionPayload = offline({
|
|
5833
|
+
asset_id: assetId,
|
|
5834
|
+
form_data: fileSeperatedSubmissionSpecificValues
|
|
5835
|
+
});
|
|
5836
|
+
submissionPayloads.push(submissionPayload);
|
|
5837
|
+
for (const [fieldIdentifier, fileArray] of Object.entries(files)) {
|
|
5838
|
+
for (const file of fileArray) {
|
|
5839
|
+
const sha1 = await hashFile(file);
|
|
5840
|
+
await this.client.files.addCache(file, sha1);
|
|
5841
|
+
const attachmentPayload = offline({
|
|
5842
|
+
submission_id: submissionPayload.offline_id,
|
|
5843
|
+
sha1,
|
|
5844
|
+
name: file.name,
|
|
5845
|
+
field_identifier: fieldIdentifier
|
|
5846
|
+
});
|
|
5847
|
+
attachmentPayloads.push(attachmentPayload);
|
|
5848
|
+
}
|
|
5849
|
+
}
|
|
5850
|
+
}
|
|
5851
|
+
const filePaylods = [];
|
|
5852
|
+
for (const file of Object.values(files).flat()) {
|
|
5853
|
+
const sha1 = await hashFile(file);
|
|
5854
|
+
const filePayload = {
|
|
5855
|
+
sha1,
|
|
5856
|
+
extension: file.name.split(".").pop() || "",
|
|
5857
|
+
file_type: file.type,
|
|
5858
|
+
size: file.size
|
|
5859
|
+
};
|
|
5860
|
+
filePaylods.push(filePayload);
|
|
5861
|
+
}
|
|
5862
|
+
return {
|
|
5863
|
+
batchId,
|
|
5864
|
+
payload: {
|
|
5865
|
+
transaction_id: transactionId,
|
|
5866
|
+
form_data: fileSeperatedCommonFieldValues,
|
|
5867
|
+
submitted_at: submittedAt,
|
|
5868
|
+
submissions: submissionPayloads,
|
|
5869
|
+
attachments: attachmentPayloads,
|
|
5870
|
+
files: filePaylods
|
|
5871
|
+
}
|
|
5872
|
+
};
|
|
5873
|
+
})
|
|
5874
|
+
);
|
|
5875
|
+
const batchPromises = [];
|
|
5876
|
+
let prevBatchId = null;
|
|
5877
|
+
for (const batch of bulkAddBatches) {
|
|
5878
|
+
const { payload, batchId } = batch;
|
|
5879
|
+
const batchAssetIds = payload.submissions.map((x) => x.asset_id);
|
|
5880
|
+
const batchSubmissionOfflineIds = payload.submissions.map((x) => x.offline_id);
|
|
5881
|
+
const batchAttachmentsOfflineIds = payload.attachments.map((x) => x.offline_id);
|
|
5882
|
+
const blockers = batchAssetIds;
|
|
5883
|
+
if (prevBatchId)
|
|
5884
|
+
blockers.push(prevBatchId);
|
|
5885
|
+
const blocks = [...batchSubmissionOfflineIds, ...batchAttachmentsOfflineIds, batchId];
|
|
5886
|
+
const promise = this.enqueueRequest({
|
|
5887
|
+
description: "Bulk add form submissions",
|
|
5888
|
+
method: HttpMethod.POST,
|
|
5889
|
+
url: `/forms/revisions/${formRevision}/bulk-respond/`,
|
|
5890
|
+
payload,
|
|
5891
|
+
blockers,
|
|
5892
|
+
blocks
|
|
5893
|
+
});
|
|
5894
|
+
void promise.then(({ presigned_urls }) => {
|
|
5895
|
+
this.processPresignedUrls(presigned_urls);
|
|
5896
|
+
});
|
|
5897
|
+
prevBatchId = batchId;
|
|
5898
|
+
batchPromises.push(promise);
|
|
5899
|
+
}
|
|
5900
|
+
void Promise.all(batchPromises).then((results) => {
|
|
5901
|
+
const createdSubmissions = [];
|
|
5902
|
+
const createdAttachments = [];
|
|
5903
|
+
for (const result of results) {
|
|
5904
|
+
for (const createdSubmission of result.submissions)
|
|
5905
|
+
createdSubmissions.push(createdSubmission);
|
|
5906
|
+
for (const createdAttachment of result.attachments)
|
|
5907
|
+
createdAttachments.push(createdAttachment);
|
|
5908
|
+
}
|
|
5909
|
+
this.dispatch(addFormSubmissions(createdSubmissions));
|
|
5910
|
+
this.dispatch(addFormSubmissionAttachments(createdAttachments));
|
|
5911
|
+
});
|
|
5912
|
+
return batchPromises;
|
|
5913
|
+
}
|
|
5914
|
+
async update(payload) {
|
|
5846
5915
|
const { store } = this.client;
|
|
5847
5916
|
const state = store.getState();
|
|
5848
5917
|
const submissionToBeUpdated = selectFormSubmissionById(payload.offline_id)(state);
|
|
5849
5918
|
if (!submissionToBeUpdated) {
|
|
5850
5919
|
throw new Error(`Expected submission with offline_id ${payload.offline_id} to exist`);
|
|
5851
5920
|
}
|
|
5852
|
-
const { values } = separateFilesFromValues(payload.values ?? {});
|
|
5921
|
+
const { values, files } = separateFilesFromValues(payload.values ?? {});
|
|
5853
5922
|
const updatedSubmission = {
|
|
5854
5923
|
...submissionToBeUpdated,
|
|
5855
5924
|
...payload,
|
|
@@ -5863,36 +5932,57 @@ class FormSubmissionService extends BaseUploadService {
|
|
|
5863
5932
|
const promise = this.enqueueRequest({
|
|
5864
5933
|
description: "Delete user form submissions",
|
|
5865
5934
|
method: HttpMethod.PATCH,
|
|
5866
|
-
url: `/
|
|
5935
|
+
url: `/forms/submissions/${updatedSubmission.offline_id}/`,
|
|
5867
5936
|
// TODO: send just payload when FormSubmissionDeserializer is updated to handle partial updates
|
|
5868
5937
|
payload: updatedSubmission,
|
|
5869
5938
|
blockers: [updatedSubmission.offline_id],
|
|
5870
5939
|
blocks: [updatedSubmission.offline_id]
|
|
5871
5940
|
});
|
|
5941
|
+
const formSubmissionAttachments = selectAttachmentsOfFormSubmission(payload.offline_id)(state);
|
|
5942
|
+
const formSubmissionAttachmentIdsToBeDeleted = [];
|
|
5943
|
+
for (const attachment of formSubmissionAttachments) {
|
|
5944
|
+
if (attachment.field_identifier in files) {
|
|
5945
|
+
formSubmissionAttachmentIdsToBeDeleted.push(attachment.offline_id);
|
|
5946
|
+
}
|
|
5947
|
+
}
|
|
5948
|
+
const [offlineFormSubmissionAttachments, attachmentsPromise] = await this.bulkAddSubmissionAttachments(
|
|
5949
|
+
payload.offline_id,
|
|
5950
|
+
files
|
|
5951
|
+
);
|
|
5952
|
+
const deleteAttachmentsPromise = this.bulkDeleteSubmissionAttachments(
|
|
5953
|
+
payload.offline_id,
|
|
5954
|
+
formSubmissionAttachmentIdsToBeDeleted
|
|
5955
|
+
);
|
|
5872
5956
|
promise.then((result) => {
|
|
5873
5957
|
this.dispatch(setFormSubmission(result));
|
|
5874
5958
|
}).catch(() => {
|
|
5875
5959
|
this.dispatch(setFormSubmission(submissionToBeUpdated));
|
|
5876
5960
|
});
|
|
5877
|
-
return [
|
|
5961
|
+
return [
|
|
5962
|
+
updatedSubmission,
|
|
5963
|
+
offlineFormSubmissionAttachments,
|
|
5964
|
+
promise,
|
|
5965
|
+
attachmentsPromise,
|
|
5966
|
+
deleteAttachmentsPromise
|
|
5967
|
+
];
|
|
5878
5968
|
}
|
|
5879
|
-
async delete(
|
|
5969
|
+
async delete(submissionId) {
|
|
5880
5970
|
const { store } = this.client;
|
|
5881
5971
|
const state = store.getState();
|
|
5882
|
-
const submissionToBeDeleted = selectFormSubmissionById(
|
|
5972
|
+
const submissionToBeDeleted = selectFormSubmissionById(submissionId)(state);
|
|
5883
5973
|
if (!submissionToBeDeleted) {
|
|
5884
|
-
throw new Error(`Expected submission with offline_id ${
|
|
5974
|
+
throw new Error(`Expected submission with offline_id ${submissionId} to exist`);
|
|
5885
5975
|
}
|
|
5886
|
-
const submissionAttachments = selectAttachmentsOfFormSubmission(
|
|
5887
|
-
this.dispatch(deleteFormSubmission(
|
|
5976
|
+
const submissionAttachments = selectAttachmentsOfFormSubmission(submissionId)(state);
|
|
5977
|
+
this.dispatch(deleteFormSubmission(submissionId));
|
|
5888
5978
|
this.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
5889
5979
|
this.dispatch(deleteFormSubmissionAttachments(submissionAttachments.map((x) => x.offline_id)));
|
|
5890
5980
|
try {
|
|
5891
5981
|
return await this.enqueueRequest({
|
|
5892
5982
|
description: "Delete user form submissions",
|
|
5893
5983
|
method: HttpMethod.DELETE,
|
|
5894
|
-
url: `/
|
|
5895
|
-
blockers: [
|
|
5984
|
+
url: `/forms/submissions/${submissionId}/`,
|
|
5985
|
+
blockers: [submissionId],
|
|
5896
5986
|
blocks: []
|
|
5897
5987
|
});
|
|
5898
5988
|
} catch (e) {
|
|
@@ -5903,17 +5993,50 @@ class FormSubmissionService extends BaseUploadService {
|
|
|
5903
5993
|
}
|
|
5904
5994
|
}
|
|
5905
5995
|
async refreshStore(projectId) {
|
|
5906
|
-
const
|
|
5907
|
-
|
|
5996
|
+
const formSubmissions = {};
|
|
5997
|
+
const modelSubmissions = await this.enqueueRequest({
|
|
5998
|
+
description: "Fetch model submissions",
|
|
5908
5999
|
method: HttpMethod.GET,
|
|
5909
|
-
url:
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
|
|
6000
|
+
url: `/forms/in-project/${projectId}/submissions/model/latest/`,
|
|
6001
|
+
blockers: [],
|
|
6002
|
+
blocks: []
|
|
6003
|
+
});
|
|
6004
|
+
for (const modelSubmission of modelSubmissions) {
|
|
6005
|
+
formSubmissions[modelSubmission.offline_id] = modelSubmission;
|
|
6006
|
+
}
|
|
6007
|
+
const standaloneSubmissions = await this.enqueueRequest({
|
|
6008
|
+
description: "Fetch standalone submissions",
|
|
6009
|
+
method: HttpMethod.GET,
|
|
6010
|
+
url: `/forms/in-project/${projectId}/submissions/standalone/`,
|
|
6011
|
+
blockers: [],
|
|
6012
|
+
blocks: []
|
|
6013
|
+
});
|
|
6014
|
+
for (const standaloneSubmission of standaloneSubmissions) {
|
|
6015
|
+
formSubmissions[standaloneSubmission.offline_id] = standaloneSubmission;
|
|
6016
|
+
}
|
|
6017
|
+
this.dispatch(initializeFormSubmissions(Object.values(formSubmissions)));
|
|
6018
|
+
const attachments = {};
|
|
6019
|
+
const modelAttachments = await this.enqueueRequest({
|
|
6020
|
+
description: "Fetch model submission attachments",
|
|
6021
|
+
method: HttpMethod.GET,
|
|
6022
|
+
url: `/forms/in-project/${projectId}/attachments/model/latest/`,
|
|
6023
|
+
blockers: [],
|
|
6024
|
+
blocks: []
|
|
6025
|
+
});
|
|
6026
|
+
for (const modelAttachment of modelAttachments) {
|
|
6027
|
+
attachments[modelAttachment.offline_id] = modelAttachment;
|
|
6028
|
+
}
|
|
6029
|
+
const standaloneAttachments = await this.enqueueRequest({
|
|
6030
|
+
description: "Fetch standalone submission attachments",
|
|
6031
|
+
method: HttpMethod.GET,
|
|
6032
|
+
url: `/forms/in-project/${projectId}/attachments/standalone/`,
|
|
5913
6033
|
blockers: [],
|
|
5914
6034
|
blocks: []
|
|
5915
6035
|
});
|
|
5916
|
-
|
|
6036
|
+
for (const standaloneAttachent of standaloneAttachments) {
|
|
6037
|
+
attachments[standaloneAttachent.offline_id] = standaloneAttachent;
|
|
6038
|
+
}
|
|
6039
|
+
this.dispatch(initializeFormSubmissionAttachments(Object.values(attachments)));
|
|
5917
6040
|
}
|
|
5918
6041
|
}
|
|
5919
6042
|
class WorkspaceService extends BaseApiService {
|
|
@@ -5965,22 +6088,22 @@ class WorkspaceService extends BaseApiService {
|
|
|
5965
6088
|
});
|
|
5966
6089
|
return [workspace, promise];
|
|
5967
6090
|
}
|
|
5968
|
-
delete(
|
|
6091
|
+
delete(workspaceId) {
|
|
5969
6092
|
const { store } = this.client;
|
|
5970
|
-
const originalWorkspace = selectWorkspaceById(
|
|
5971
|
-
|
|
5972
|
-
throw new Error(`Expected an existing workspace with id ${id}`);
|
|
5973
|
-
}
|
|
5974
|
-
this.dispatch(deleteWorkspace(id));
|
|
6093
|
+
const originalWorkspace = selectWorkspaceById(workspaceId)(store.getState());
|
|
6094
|
+
this.dispatch(deleteWorkspace(workspaceId));
|
|
5975
6095
|
const promise = this.enqueueRequest({
|
|
5976
6096
|
description: "Delete Workspace",
|
|
5977
6097
|
method: HttpMethod.DELETE,
|
|
5978
|
-
url: `/workspaces/${
|
|
5979
|
-
blockers: [
|
|
6098
|
+
url: `/workspaces/${workspaceId}/`,
|
|
6099
|
+
blockers: [workspaceId],
|
|
5980
6100
|
blocks: []
|
|
5981
6101
|
});
|
|
5982
|
-
void promise.
|
|
5983
|
-
|
|
6102
|
+
void promise.then(() => {
|
|
6103
|
+
}).catch((reason) => {
|
|
6104
|
+
if (originalWorkspace) {
|
|
6105
|
+
this.dispatch(addWorkspace(originalWorkspace));
|
|
6106
|
+
}
|
|
5984
6107
|
throw reason;
|
|
5985
6108
|
});
|
|
5986
6109
|
return promise;
|
|
@@ -6615,8 +6738,8 @@ class DocumentService extends BaseApiService {
|
|
|
6615
6738
|
class DocumentAttachmentService extends BaseAttachmentService {
|
|
6616
6739
|
constructor() {
|
|
6617
6740
|
super(...arguments);
|
|
6618
|
-
__publicField(this, "
|
|
6619
|
-
__publicField(this, "
|
|
6741
|
+
__publicField(this, "attachmentModel", AttachmentModel.Document);
|
|
6742
|
+
__publicField(this, "initializeAttachments", initializeDocumentAttachments);
|
|
6620
6743
|
__publicField(this, "addAttachments", addDocumentAttachments);
|
|
6621
6744
|
__publicField(this, "updateAttachments", updateDocumentAttachments);
|
|
6622
6745
|
__publicField(this, "removeAttachments", deleteDocumentAttachments);
|
|
@@ -6627,23 +6750,17 @@ class DocumentAttachmentService extends BaseAttachmentService {
|
|
|
6627
6750
|
buildOfflineAttachment(data) {
|
|
6628
6751
|
return offline({
|
|
6629
6752
|
file: URL.createObjectURL(data.file),
|
|
6630
|
-
file_sha1: data.
|
|
6631
|
-
created_by: data.
|
|
6753
|
+
file_sha1: data.sha1,
|
|
6754
|
+
created_by: data.createdBy,
|
|
6632
6755
|
file_name: data.file.name,
|
|
6633
6756
|
file_type: data.file.type,
|
|
6634
|
-
submitted_at: data.
|
|
6757
|
+
submitted_at: data.submittedAt,
|
|
6635
6758
|
description: data.description,
|
|
6636
6759
|
document: data.modelId
|
|
6637
6760
|
});
|
|
6638
6761
|
}
|
|
6639
|
-
buildAttachmentPayload(data) {
|
|
6640
|
-
return {
|
|
6641
|
-
...data,
|
|
6642
|
-
document: data.modelId
|
|
6643
|
-
};
|
|
6644
|
-
}
|
|
6645
6762
|
// NOTE: overriding the method from BaseAttachmentService since document attachments get vectorized
|
|
6646
|
-
async
|
|
6763
|
+
async attachFilesToDocument(files, documentId) {
|
|
6647
6764
|
var _a2;
|
|
6648
6765
|
const { store } = this.client;
|
|
6649
6766
|
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
@@ -6652,36 +6769,40 @@ class DocumentAttachmentService extends BaseAttachmentService {
|
|
|
6652
6769
|
const attachmentPayloads = [];
|
|
6653
6770
|
const filePayloads = {};
|
|
6654
6771
|
const sha1ToAttachmentIds = {};
|
|
6655
|
-
for (const
|
|
6656
|
-
const
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6772
|
+
for (const file of files) {
|
|
6773
|
+
const sha1 = await hashFile(file);
|
|
6774
|
+
if (!(sha1 in filePayloads)) {
|
|
6775
|
+
filePayloads[sha1] = {
|
|
6776
|
+
sha1,
|
|
6777
|
+
file_type: file.type,
|
|
6778
|
+
extension: file.name.split(".").pop(),
|
|
6779
|
+
size: file.size
|
|
6780
|
+
};
|
|
6781
|
+
sha1ToAttachmentIds[sha1] = [];
|
|
6782
|
+
await this.client.files.addCache(file, sha1);
|
|
6661
6783
|
}
|
|
6662
6784
|
const offlineAttachment = this.buildOfflineAttachment({
|
|
6663
6785
|
file,
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6786
|
+
sha1,
|
|
6787
|
+
submittedAt,
|
|
6788
|
+
createdBy,
|
|
6667
6789
|
description: "",
|
|
6668
6790
|
modelId: documentId
|
|
6669
6791
|
});
|
|
6670
6792
|
offlineAttachments.push(offlineAttachment);
|
|
6671
6793
|
attachmentPayloads.push({
|
|
6672
6794
|
offline_id: offlineAttachment.offline_id,
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
file_extension: filePayload.extension,
|
|
6795
|
+
name: offlineAttachment.file_name,
|
|
6796
|
+
sha1: offlineAttachment.file_sha1,
|
|
6676
6797
|
description: offlineAttachment.description
|
|
6677
6798
|
});
|
|
6678
|
-
sha1ToAttachmentIds[
|
|
6799
|
+
sha1ToAttachmentIds[sha1].push(offlineAttachment.offline_id);
|
|
6679
6800
|
}
|
|
6680
6801
|
this.dispatch(this.addAttachments(offlineAttachments));
|
|
6681
6802
|
const promise = this.enqueueRequest({
|
|
6682
6803
|
description: "Attach files to document",
|
|
6683
6804
|
method: HttpMethod.POST,
|
|
6684
|
-
url:
|
|
6805
|
+
url: `/documents/${documentId}/attach/`,
|
|
6685
6806
|
payload: {
|
|
6686
6807
|
submitted_at: submittedAt,
|
|
6687
6808
|
attachments: attachmentPayloads,
|
|
@@ -6706,14 +6827,14 @@ class DocumentAttachmentService extends BaseAttachmentService {
|
|
|
6706
6827
|
});
|
|
6707
6828
|
return [offlineAttachments, promise.then(({ attachments }) => attachments)];
|
|
6708
6829
|
}
|
|
6709
|
-
async
|
|
6710
|
-
return this.
|
|
6830
|
+
async deleteDocumentAttachment(attachmentId) {
|
|
6831
|
+
return this.deleteAttachment(attachmentId);
|
|
6711
6832
|
}
|
|
6712
6833
|
makeReadable(attachmnentId) {
|
|
6713
6834
|
void this.enqueueRequest({
|
|
6714
6835
|
description: "Add attachment to AI assistant",
|
|
6715
6836
|
method: HttpMethod.PATCH,
|
|
6716
|
-
url: `/
|
|
6837
|
+
url: `/documents/attachments/${attachmnentId}/`,
|
|
6717
6838
|
payload: {
|
|
6718
6839
|
readable_to_assistant: true
|
|
6719
6840
|
},
|
|
@@ -6730,7 +6851,7 @@ class DocumentAttachmentService extends BaseAttachmentService {
|
|
|
6730
6851
|
blocks: [],
|
|
6731
6852
|
blockers: []
|
|
6732
6853
|
});
|
|
6733
|
-
this.dispatch(
|
|
6854
|
+
this.dispatch(this.initializeAttachments(projectDocumentAttachments));
|
|
6734
6855
|
const organizationDocumentAttachments = await this.enqueueRequest({
|
|
6735
6856
|
description: "Get document attachments",
|
|
6736
6857
|
method: HttpMethod.GET,
|
|
@@ -6865,21 +6986,21 @@ class TeamService extends BaseApiService {
|
|
|
6865
6986
|
});
|
|
6866
6987
|
return [offlineUpdatedTeam, promise];
|
|
6867
6988
|
}
|
|
6868
|
-
async delete(
|
|
6989
|
+
async delete(teamId) {
|
|
6869
6990
|
const { store } = this.client;
|
|
6870
6991
|
const state = store.getState();
|
|
6871
|
-
const team = selectTeamById(
|
|
6992
|
+
const team = selectTeamById(teamId)(state);
|
|
6872
6993
|
if (!team) {
|
|
6873
|
-
throw new Error(`Expected team with id ${
|
|
6994
|
+
throw new Error(`Expected team with id ${teamId} to exist`);
|
|
6874
6995
|
}
|
|
6875
|
-
this.dispatch(deleteTeam(
|
|
6996
|
+
this.dispatch(deleteTeam(teamId));
|
|
6876
6997
|
try {
|
|
6877
6998
|
return await this.enqueueRequest({
|
|
6878
6999
|
description: "Delete team",
|
|
6879
7000
|
method: HttpMethod.DELETE,
|
|
6880
|
-
url: `/organizations/teams/${
|
|
6881
|
-
blockers: [
|
|
6882
|
-
blocks: [
|
|
7001
|
+
url: `/organizations/teams/${teamId}/`,
|
|
7002
|
+
blockers: [teamId],
|
|
7003
|
+
blocks: [teamId]
|
|
6883
7004
|
});
|
|
6884
7005
|
} catch (e) {
|
|
6885
7006
|
this.dispatch(setTeam(team));
|
|
@@ -6974,11 +7095,17 @@ class GeoImageService extends BaseUploadService {
|
|
|
6974
7095
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
6975
7096
|
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
6976
7097
|
const projectId = payloadWithoutFile.project;
|
|
6977
|
-
const
|
|
7098
|
+
const sha1 = await hashFile(file);
|
|
7099
|
+
const filePayload = {
|
|
7100
|
+
sha1,
|
|
7101
|
+
file_type: file.type,
|
|
7102
|
+
extension: file.name.split(".").pop(),
|
|
7103
|
+
size: file.size
|
|
7104
|
+
};
|
|
6978
7105
|
const offlineMapImage = offline({
|
|
6979
7106
|
...payloadWithoutFile,
|
|
6980
7107
|
file_name: file.name,
|
|
6981
|
-
file_sha1:
|
|
7108
|
+
file_sha1: sha1,
|
|
6982
7109
|
file: URL.createObjectURL(file),
|
|
6983
7110
|
submitted_at: submittedAt,
|
|
6984
7111
|
created_by: createdBy
|
|
@@ -7021,16 +7148,23 @@ class GeoImageService extends BaseUploadService {
|
|
|
7021
7148
|
const offlineGeoImages = [];
|
|
7022
7149
|
const offlineIds = [];
|
|
7023
7150
|
const geoImagePayloads = [];
|
|
7024
|
-
const
|
|
7151
|
+
const filePayloadRecord = {};
|
|
7025
7152
|
for (const payloadAndFile of payloads) {
|
|
7026
7153
|
const { file, ...payload } = payloadAndFile;
|
|
7027
|
-
const
|
|
7028
|
-
if (!(
|
|
7029
|
-
|
|
7154
|
+
const sha1 = await hashFile(file);
|
|
7155
|
+
if (!(sha1 in filePayloadRecord)) {
|
|
7156
|
+
filePayloadRecord[sha1] = {
|
|
7157
|
+
sha1,
|
|
7158
|
+
file_type: file.type,
|
|
7159
|
+
extension: file.name.split(".").pop(),
|
|
7160
|
+
size: file.size
|
|
7161
|
+
};
|
|
7162
|
+
await this.client.files.addCache(file, sha1);
|
|
7163
|
+
}
|
|
7030
7164
|
const offlineMapImage = offline({
|
|
7031
7165
|
...payload,
|
|
7032
7166
|
file_name: file.name,
|
|
7033
|
-
file_sha1:
|
|
7167
|
+
file_sha1: sha1,
|
|
7034
7168
|
file: URL.createObjectURL(file),
|
|
7035
7169
|
submitted_at: submittedAt,
|
|
7036
7170
|
created_by: createdBy,
|
|
@@ -7059,7 +7193,7 @@ class GeoImageService extends BaseUploadService {
|
|
|
7059
7193
|
submitted_at: submittedAt,
|
|
7060
7194
|
project: projectId,
|
|
7061
7195
|
geo_images: geoImagePayloads,
|
|
7062
|
-
files: Object.values(
|
|
7196
|
+
files: Object.values(filePayloadRecord)
|
|
7063
7197
|
},
|
|
7064
7198
|
blocks: [projectId.toString()],
|
|
7065
7199
|
blockers: offlineIds
|
|
@@ -7096,20 +7230,20 @@ class GeoImageService extends BaseUploadService {
|
|
|
7096
7230
|
});
|
|
7097
7231
|
return [updatedGeoImage, promise];
|
|
7098
7232
|
}
|
|
7099
|
-
async delete(
|
|
7233
|
+
async delete(geoImageId) {
|
|
7100
7234
|
const { store } = this.client;
|
|
7101
7235
|
const state = store.getState();
|
|
7102
|
-
const geoImageToDelete = selectGeoImageById(
|
|
7236
|
+
const geoImageToDelete = selectGeoImageById(geoImageId)(state);
|
|
7103
7237
|
if (!geoImageToDelete) {
|
|
7104
|
-
throw new Error(`Map image with offline_id ${
|
|
7238
|
+
throw new Error(`Map image with offline_id ${geoImageId} does not exist in the store`);
|
|
7105
7239
|
}
|
|
7106
|
-
this.dispatch(deleteGeoImage(
|
|
7240
|
+
this.dispatch(deleteGeoImage(geoImageId));
|
|
7107
7241
|
const promise = this.enqueueRequest({
|
|
7108
7242
|
description: "Delete geo image",
|
|
7109
7243
|
method: HttpMethod.DELETE,
|
|
7110
|
-
url: `/geo-images/${
|
|
7111
|
-
blocks: [
|
|
7112
|
-
blockers: [
|
|
7244
|
+
url: `/geo-images/${geoImageId}/`,
|
|
7245
|
+
blocks: [geoImageId],
|
|
7246
|
+
blockers: [geoImageId]
|
|
7113
7247
|
});
|
|
7114
7248
|
promise.catch(() => {
|
|
7115
7249
|
this.dispatch(setGeoImage(geoImageToDelete));
|
|
@@ -7127,7 +7261,7 @@ class GeoImageService extends BaseUploadService {
|
|
|
7127
7261
|
this.dispatch(initializeGeoImages(result));
|
|
7128
7262
|
}
|
|
7129
7263
|
}
|
|
7130
|
-
class IssueAssociationService extends
|
|
7264
|
+
class IssueAssociationService extends BaseUploadService {
|
|
7131
7265
|
add(payload) {
|
|
7132
7266
|
var _a2;
|
|
7133
7267
|
const { store } = this.client;
|
|
@@ -7142,7 +7276,7 @@ class IssueAssociationService extends BaseApiService {
|
|
|
7142
7276
|
const promise = this.enqueueRequest({
|
|
7143
7277
|
description: "Add issue association",
|
|
7144
7278
|
method: HttpMethod.POST,
|
|
7145
|
-
url: "/
|
|
7279
|
+
url: "/issues/associations/",
|
|
7146
7280
|
payload: {
|
|
7147
7281
|
offline_id: offlineIssueAssociation.offline_id,
|
|
7148
7282
|
submitted_at: submittedAt,
|
|
@@ -7172,7 +7306,7 @@ class IssueAssociationService extends BaseApiService {
|
|
|
7172
7306
|
const promise = this.enqueueRequest({
|
|
7173
7307
|
description: "Delete issue association",
|
|
7174
7308
|
method: HttpMethod.DELETE,
|
|
7175
|
-
url: `/
|
|
7309
|
+
url: `/issues/associations/${id}/`,
|
|
7176
7310
|
blockers: [id],
|
|
7177
7311
|
blocks: []
|
|
7178
7312
|
});
|
|
@@ -7185,938 +7319,14 @@ class IssueAssociationService extends BaseApiService {
|
|
|
7185
7319
|
const issueAssociations = await this.enqueueRequest({
|
|
7186
7320
|
description: "Fetch issue associations",
|
|
7187
7321
|
method: HttpMethod.GET,
|
|
7188
|
-
url: "/
|
|
7189
|
-
queryParams: {
|
|
7322
|
+
url: "/issues/associations/",
|
|
7323
|
+
queryParams: { project_id: projectId.toString() },
|
|
7190
7324
|
blockers: [],
|
|
7191
7325
|
blocks: []
|
|
7192
7326
|
});
|
|
7193
7327
|
this.dispatch(initializeIssueAssociations(issueAssociations));
|
|
7194
7328
|
}
|
|
7195
7329
|
}
|
|
7196
|
-
class FormRevisionAttachmentService extends BaseUploadService {
|
|
7197
|
-
async bulkAdd(payloads) {
|
|
7198
|
-
var _a2;
|
|
7199
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7200
|
-
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7201
|
-
const filePayloads = {};
|
|
7202
|
-
const offlineFormRevisionAttachments = [];
|
|
7203
|
-
const attachmentPayloads = [];
|
|
7204
|
-
for (const payload of payloads) {
|
|
7205
|
-
const { revisionId, fieldIdentifier, file } = payload;
|
|
7206
|
-
const filePayload = await this.getFilePayload(file);
|
|
7207
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7208
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7209
|
-
const offlineFormRevisionAttachment = offline({
|
|
7210
|
-
file: URL.createObjectURL(file),
|
|
7211
|
-
file_type: file.type,
|
|
7212
|
-
file_name: file.name,
|
|
7213
|
-
file_sha1: filePayload.sha1,
|
|
7214
|
-
created_by: createdBy,
|
|
7215
|
-
form_revision: revisionId,
|
|
7216
|
-
submitted_at: submittedAt,
|
|
7217
|
-
field_identifier: fieldIdentifier
|
|
7218
|
-
});
|
|
7219
|
-
offlineFormRevisionAttachments.push(offlineFormRevisionAttachment);
|
|
7220
|
-
const attachmentPayload = {
|
|
7221
|
-
offline_id: offlineFormRevisionAttachment.offline_id,
|
|
7222
|
-
file_name: file.name,
|
|
7223
|
-
field_identifier: fieldIdentifier,
|
|
7224
|
-
file_extension: filePayload.extension,
|
|
7225
|
-
file_sha1: filePayload.sha1,
|
|
7226
|
-
form_revision: revisionId
|
|
7227
|
-
};
|
|
7228
|
-
attachmentPayloads.push(attachmentPayload);
|
|
7229
|
-
}
|
|
7230
|
-
this.dispatch(addFormRevisionAttachments(offlineFormRevisionAttachments));
|
|
7231
|
-
const promise = this.enqueueRequest({
|
|
7232
|
-
description: "Attach files to form revision",
|
|
7233
|
-
method: HttpMethod.POST,
|
|
7234
|
-
url: "/form-revision-attachments/bulk/",
|
|
7235
|
-
payload: {
|
|
7236
|
-
submitted_at: submittedAt,
|
|
7237
|
-
attachments: attachmentPayloads,
|
|
7238
|
-
files: Object.values(filePayloads)
|
|
7239
|
-
},
|
|
7240
|
-
blockers: offlineFormRevisionAttachments.map((attachment) => attachment.form_revision),
|
|
7241
|
-
blocks: offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
7242
|
-
});
|
|
7243
|
-
promise.then((result) => {
|
|
7244
|
-
this.processPresignedUrls(result.presigned_urls);
|
|
7245
|
-
this.dispatch(updateFormRevisionAttachments(result.attachments));
|
|
7246
|
-
}).catch(() => {
|
|
7247
|
-
this.dispatch(
|
|
7248
|
-
deleteFormRevisionAttachments(
|
|
7249
|
-
offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
7250
|
-
)
|
|
7251
|
-
);
|
|
7252
|
-
});
|
|
7253
|
-
return [offlineFormRevisionAttachments, promise.then(({ attachments }) => attachments)];
|
|
7254
|
-
}
|
|
7255
|
-
async refreshStore(projectId, organizationId) {
|
|
7256
|
-
let attachments = [];
|
|
7257
|
-
const projectFormRevisions = await this.enqueueRequest({
|
|
7258
|
-
description: "Fetch project form revision attachments",
|
|
7259
|
-
method: HttpMethod.GET,
|
|
7260
|
-
url: "/form-revision-attachments/",
|
|
7261
|
-
queryParams: {
|
|
7262
|
-
project: projectId.toString()
|
|
7263
|
-
},
|
|
7264
|
-
blockers: [projectId.toString()],
|
|
7265
|
-
blocks: []
|
|
7266
|
-
});
|
|
7267
|
-
attachments = attachments.concat(projectFormRevisions);
|
|
7268
|
-
const organizationFormRevisions = await this.enqueueRequest({
|
|
7269
|
-
description: "Fetch organization form revision attachments",
|
|
7270
|
-
method: HttpMethod.GET,
|
|
7271
|
-
url: "/form-revision-attachments/",
|
|
7272
|
-
queryParams: {
|
|
7273
|
-
organization: organizationId.toString()
|
|
7274
|
-
},
|
|
7275
|
-
blockers: [organizationId.toString()],
|
|
7276
|
-
blocks: []
|
|
7277
|
-
});
|
|
7278
|
-
attachments = attachments.concat(organizationFormRevisions);
|
|
7279
|
-
this.dispatch(initializeFormRevisionAttachments(attachments));
|
|
7280
|
-
}
|
|
7281
|
-
}
|
|
7282
|
-
class FormSubmissionAttachmentService extends BaseUploadService {
|
|
7283
|
-
async bulkAdd(payloads) {
|
|
7284
|
-
var _a2;
|
|
7285
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7286
|
-
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7287
|
-
const filePayloads = {};
|
|
7288
|
-
const offlineFormSubmissionAttachments = [];
|
|
7289
|
-
const attachmentPayloads = [];
|
|
7290
|
-
for (const payload of payloads) {
|
|
7291
|
-
const { submissionId, fieldIdentifier, file } = payload;
|
|
7292
|
-
const filePayload = await this.getFilePayload(file);
|
|
7293
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7294
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7295
|
-
const offlineFormSubmissionAttachment = offline({
|
|
7296
|
-
file: URL.createObjectURL(file),
|
|
7297
|
-
file_type: file.type,
|
|
7298
|
-
file_name: file.name,
|
|
7299
|
-
file_sha1: filePayload.sha1,
|
|
7300
|
-
created_by: createdBy,
|
|
7301
|
-
form_submission: submissionId,
|
|
7302
|
-
submitted_at: submittedAt,
|
|
7303
|
-
field_identifier: fieldIdentifier
|
|
7304
|
-
});
|
|
7305
|
-
offlineFormSubmissionAttachments.push(offlineFormSubmissionAttachment);
|
|
7306
|
-
const attachmentPayload = {
|
|
7307
|
-
offline_id: offlineFormSubmissionAttachment.offline_id,
|
|
7308
|
-
file_name: file.name,
|
|
7309
|
-
file_sha1: filePayload.sha1,
|
|
7310
|
-
file_extension: filePayload.extension,
|
|
7311
|
-
field_identifier: fieldIdentifier,
|
|
7312
|
-
form_submission: submissionId
|
|
7313
|
-
};
|
|
7314
|
-
attachmentPayloads.push(attachmentPayload);
|
|
7315
|
-
}
|
|
7316
|
-
this.dispatch(addFormSubmissionAttachments(offlineFormSubmissionAttachments));
|
|
7317
|
-
const promise = this.enqueueRequest({
|
|
7318
|
-
description: "Attach files to form submission",
|
|
7319
|
-
method: HttpMethod.POST,
|
|
7320
|
-
url: "/form-submission-attachments/bulk/",
|
|
7321
|
-
payload: {
|
|
7322
|
-
submitted_at: submittedAt,
|
|
7323
|
-
attachments: attachmentPayloads,
|
|
7324
|
-
files: Object.values(filePayloads)
|
|
7325
|
-
},
|
|
7326
|
-
blockers: offlineFormSubmissionAttachments.map((attachment) => attachment.form_submission),
|
|
7327
|
-
blocks: offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
7328
|
-
});
|
|
7329
|
-
promise.then((result) => {
|
|
7330
|
-
this.processPresignedUrls(result.presigned_urls);
|
|
7331
|
-
this.dispatch(updateFormSubmissionAttachments(result.attachments));
|
|
7332
|
-
}).catch((error) => {
|
|
7333
|
-
this.dispatch(
|
|
7334
|
-
deleteFormSubmissionAttachments(
|
|
7335
|
-
offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
7336
|
-
)
|
|
7337
|
-
);
|
|
7338
|
-
throw error;
|
|
7339
|
-
});
|
|
7340
|
-
return [offlineFormSubmissionAttachments, promise.then(({ attachments }) => attachments)];
|
|
7341
|
-
}
|
|
7342
|
-
async bulkDelete(attachmentsIds) {
|
|
7343
|
-
const { store } = this.client;
|
|
7344
|
-
const state = store.getState();
|
|
7345
|
-
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
|
|
7346
|
-
this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
|
|
7347
|
-
try {
|
|
7348
|
-
await this.enqueueRequest({
|
|
7349
|
-
description: "Delete form submission attachments",
|
|
7350
|
-
method: HttpMethod.DELETE,
|
|
7351
|
-
url: "/form-submission-attachments/bulk/",
|
|
7352
|
-
payload: { attachment_ids: attachmentsIds },
|
|
7353
|
-
blockers: attachmentsIds,
|
|
7354
|
-
blocks: []
|
|
7355
|
-
});
|
|
7356
|
-
} catch (e) {
|
|
7357
|
-
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
7358
|
-
throw e;
|
|
7359
|
-
}
|
|
7360
|
-
}
|
|
7361
|
-
async refreshStore(projectId) {
|
|
7362
|
-
const result = await this.enqueueRequest({
|
|
7363
|
-
description: "Get form submission attachments",
|
|
7364
|
-
method: HttpMethod.GET,
|
|
7365
|
-
url: "/form-submission-attachments/",
|
|
7366
|
-
queryParams: {
|
|
7367
|
-
project: projectId.toString()
|
|
7368
|
-
},
|
|
7369
|
-
blockers: [],
|
|
7370
|
-
blocks: []
|
|
7371
|
-
});
|
|
7372
|
-
this.dispatch(initializeFormSubmissionAttachments(result));
|
|
7373
|
-
}
|
|
7374
|
-
}
|
|
7375
|
-
class FormRevisionService extends BaseUploadService {
|
|
7376
|
-
add(payload) {
|
|
7377
|
-
var _a2;
|
|
7378
|
-
const { store } = this.client;
|
|
7379
|
-
const state = store.getState();
|
|
7380
|
-
const createdBy = (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7381
|
-
const offlineFormRevision = offline({
|
|
7382
|
-
...payload,
|
|
7383
|
-
created_by: createdBy,
|
|
7384
|
-
revision: "Pending",
|
|
7385
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7386
|
-
});
|
|
7387
|
-
this.dispatch(addFormRevision(offlineFormRevision));
|
|
7388
|
-
const promise = this.enqueueRequest({
|
|
7389
|
-
description: "Create form revision",
|
|
7390
|
-
method: HttpMethod.POST,
|
|
7391
|
-
url: "/form-revisions/",
|
|
7392
|
-
payload: offlineFormRevision,
|
|
7393
|
-
blockers: [payload.form],
|
|
7394
|
-
blocks: [offlineFormRevision.offline_id]
|
|
7395
|
-
});
|
|
7396
|
-
void promise.then((result) => {
|
|
7397
|
-
this.dispatch(setFormRevision(result));
|
|
7398
|
-
}).catch(() => {
|
|
7399
|
-
this.dispatch(deleteFormRevision(offlineFormRevision.offline_id));
|
|
7400
|
-
});
|
|
7401
|
-
return [offlineFormRevision, promise];
|
|
7402
|
-
}
|
|
7403
|
-
async refreshStore(projectId, organizationId) {
|
|
7404
|
-
let formRevisions = [];
|
|
7405
|
-
const projectFormRevisions = await this.enqueueRequest({
|
|
7406
|
-
description: "Fetch project form revisions",
|
|
7407
|
-
method: HttpMethod.GET,
|
|
7408
|
-
url: "/form-revisions/",
|
|
7409
|
-
queryParams: {
|
|
7410
|
-
project: projectId.toString()
|
|
7411
|
-
},
|
|
7412
|
-
blockers: [projectId.toString()],
|
|
7413
|
-
blocks: []
|
|
7414
|
-
});
|
|
7415
|
-
formRevisions = formRevisions.concat(projectFormRevisions);
|
|
7416
|
-
const organizationFormRevisions = await this.enqueueRequest({
|
|
7417
|
-
description: "Fetch organization form revisions",
|
|
7418
|
-
method: HttpMethod.GET,
|
|
7419
|
-
url: "/form-revisions/",
|
|
7420
|
-
queryParams: {
|
|
7421
|
-
organization: organizationId.toString()
|
|
7422
|
-
},
|
|
7423
|
-
blockers: [organizationId.toString()],
|
|
7424
|
-
blocks: []
|
|
7425
|
-
});
|
|
7426
|
-
formRevisions = formRevisions.concat(organizationFormRevisions);
|
|
7427
|
-
this.dispatch(initializeFormRevisions(formRevisions));
|
|
7428
|
-
}
|
|
7429
|
-
}
|
|
7430
|
-
class AssetTypeFieldsAttachmentService extends BaseUploadService {
|
|
7431
|
-
async bulkAdd(payloads) {
|
|
7432
|
-
var _a2;
|
|
7433
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7434
|
-
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7435
|
-
const filePayloads = {};
|
|
7436
|
-
const offlineAssetTypeFieldsAttachments = [];
|
|
7437
|
-
const attachmentPayloads = [];
|
|
7438
|
-
for (const payload of payloads) {
|
|
7439
|
-
const { fieldsRevisionId, fieldIdentifier, file } = payload;
|
|
7440
|
-
const filePayload = await this.getFilePayload(file);
|
|
7441
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7442
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7443
|
-
const offlineAssetTypeFieldsAttachment = offline({
|
|
7444
|
-
file: URL.createObjectURL(file),
|
|
7445
|
-
file_type: file.type,
|
|
7446
|
-
file_name: file.name,
|
|
7447
|
-
file_sha1: filePayload.sha1,
|
|
7448
|
-
created_by: createdBy,
|
|
7449
|
-
fields_revision: fieldsRevisionId,
|
|
7450
|
-
submitted_at: submittedAt,
|
|
7451
|
-
field_identifier: fieldIdentifier
|
|
7452
|
-
});
|
|
7453
|
-
offlineAssetTypeFieldsAttachments.push(offlineAssetTypeFieldsAttachment);
|
|
7454
|
-
const attachmentPayload = {
|
|
7455
|
-
offline_id: offlineAssetTypeFieldsAttachment.offline_id,
|
|
7456
|
-
file_name: file.name,
|
|
7457
|
-
field_identifier: fieldIdentifier,
|
|
7458
|
-
file_extension: filePayload.extension,
|
|
7459
|
-
file_sha1: filePayload.sha1,
|
|
7460
|
-
fields_revision: fieldsRevisionId
|
|
7461
|
-
};
|
|
7462
|
-
attachmentPayloads.push(attachmentPayload);
|
|
7463
|
-
}
|
|
7464
|
-
this.dispatch(addAssetTypeFieldsAttachments(offlineAssetTypeFieldsAttachments));
|
|
7465
|
-
const promise = this.enqueueRequest({
|
|
7466
|
-
description: "Add asset type fields attachments",
|
|
7467
|
-
method: HttpMethod.POST,
|
|
7468
|
-
url: "/asset-type-fields-attachments/bulk/",
|
|
7469
|
-
payload: {
|
|
7470
|
-
submitted_at: submittedAt,
|
|
7471
|
-
attachments: attachmentPayloads,
|
|
7472
|
-
files: Object.values(filePayloads)
|
|
7473
|
-
},
|
|
7474
|
-
blockers: offlineAssetTypeFieldsAttachments.map((attachment) => attachment.fields_revision),
|
|
7475
|
-
blocks: offlineAssetTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7476
|
-
});
|
|
7477
|
-
promise.then((result) => {
|
|
7478
|
-
this.processPresignedUrls(result.presigned_urls);
|
|
7479
|
-
this.dispatch(updateAssetTypeFieldsAttachments(result.attachments));
|
|
7480
|
-
}).catch(() => {
|
|
7481
|
-
this.dispatch(
|
|
7482
|
-
deleteAssetTypeFieldsAttachments(
|
|
7483
|
-
offlineAssetTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7484
|
-
)
|
|
7485
|
-
);
|
|
7486
|
-
});
|
|
7487
|
-
return [offlineAssetTypeFieldsAttachments, promise.then(({ attachments }) => attachments)];
|
|
7488
|
-
}
|
|
7489
|
-
async refreshStore(projectId) {
|
|
7490
|
-
const result = await this.enqueueRequest({
|
|
7491
|
-
description: "get asset type fields attachments",
|
|
7492
|
-
method: HttpMethod.GET,
|
|
7493
|
-
url: "/asset-type-fields-attachments/",
|
|
7494
|
-
queryParams: {
|
|
7495
|
-
project: projectId.toString()
|
|
7496
|
-
},
|
|
7497
|
-
blockers: [projectId.toString()],
|
|
7498
|
-
blocks: []
|
|
7499
|
-
});
|
|
7500
|
-
this.dispatch(initializeAssetTypeFieldsAttachments(result));
|
|
7501
|
-
}
|
|
7502
|
-
}
|
|
7503
|
-
class AssetTypeFieldsService extends BaseApiService {
|
|
7504
|
-
add(payload) {
|
|
7505
|
-
var _a2;
|
|
7506
|
-
const { store } = this.client;
|
|
7507
|
-
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7508
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7509
|
-
const offlineAssetTypeFields = offline({
|
|
7510
|
-
...payload,
|
|
7511
|
-
created_by: createdBy,
|
|
7512
|
-
submitted_at: submittedAt
|
|
7513
|
-
});
|
|
7514
|
-
this.dispatch(addAssetTypeFields(offlineAssetTypeFields));
|
|
7515
|
-
const promise = this.enqueueRequest({
|
|
7516
|
-
description: "Add Asset Type Fields",
|
|
7517
|
-
method: HttpMethod.POST,
|
|
7518
|
-
url: "/asset-type-fields/",
|
|
7519
|
-
payload: offlineAssetTypeFields,
|
|
7520
|
-
blockers: [offlineAssetTypeFields.asset_type],
|
|
7521
|
-
blocks: [offlineAssetTypeFields.offline_id]
|
|
7522
|
-
});
|
|
7523
|
-
promise.then((response) => {
|
|
7524
|
-
this.dispatch(updateAssetTypeFields(response));
|
|
7525
|
-
}).catch((error) => {
|
|
7526
|
-
this.dispatch(deleteAssetTypeFields(offlineAssetTypeFields.offline_id));
|
|
7527
|
-
throw error;
|
|
7528
|
-
});
|
|
7529
|
-
return [offlineAssetTypeFields, promise];
|
|
7530
|
-
}
|
|
7531
|
-
async refreshStore(projectId) {
|
|
7532
|
-
const result = await this.enqueueRequest({
|
|
7533
|
-
description: "Get Asset Type Fields",
|
|
7534
|
-
method: HttpMethod.GET,
|
|
7535
|
-
url: "/asset-type-fields/",
|
|
7536
|
-
queryParams: {
|
|
7537
|
-
project: projectId.toString()
|
|
7538
|
-
},
|
|
7539
|
-
blockers: [],
|
|
7540
|
-
blocks: []
|
|
7541
|
-
});
|
|
7542
|
-
this.dispatch(initializeAssetTypeFields(result));
|
|
7543
|
-
}
|
|
7544
|
-
}
|
|
7545
|
-
class AssetTypeFieldValuesService extends BaseApiService {
|
|
7546
|
-
add(payload) {
|
|
7547
|
-
var _a2;
|
|
7548
|
-
const { store } = this.client;
|
|
7549
|
-
const state = store.getState();
|
|
7550
|
-
const { values } = separateFilesFromValues(payload.values);
|
|
7551
|
-
const offlineAssetTypeFieldValues = offline({
|
|
7552
|
-
...payload,
|
|
7553
|
-
values,
|
|
7554
|
-
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
7555
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7556
|
-
});
|
|
7557
|
-
const promise = this.enqueueRequest({
|
|
7558
|
-
description: "Add asset type field values",
|
|
7559
|
-
method: HttpMethod.POST,
|
|
7560
|
-
url: "/asset-type-field-values/",
|
|
7561
|
-
payload: offlineAssetTypeFieldValues,
|
|
7562
|
-
blockers: [payload.asset, payload.fields_revision],
|
|
7563
|
-
blocks: [offlineAssetTypeFieldValues.offline_id]
|
|
7564
|
-
});
|
|
7565
|
-
this.dispatch(addAssetTypeFieldValues(offlineAssetTypeFieldValues));
|
|
7566
|
-
promise.then((result) => {
|
|
7567
|
-
this.dispatch(updateAssetTypeFieldValues(result));
|
|
7568
|
-
return result;
|
|
7569
|
-
}).catch(() => {
|
|
7570
|
-
this.dispatch(deleteAssetTypeFieldValues(offlineAssetTypeFieldValues.offline_id));
|
|
7571
|
-
});
|
|
7572
|
-
return [offlineAssetTypeFieldValues, promise];
|
|
7573
|
-
}
|
|
7574
|
-
bulkAdd(payload, batchSize) {
|
|
7575
|
-
var _a2;
|
|
7576
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7577
|
-
const { values } = separateFilesFromValues(payload.values);
|
|
7578
|
-
const offlineAssetTypeFieldValuesMany = [];
|
|
7579
|
-
const batches = chunkArray(payload.payloads, batchSize ?? payload.payloads.length);
|
|
7580
|
-
const batchPayloads = [];
|
|
7581
|
-
for (const batch of batches) {
|
|
7582
|
-
const assetTypeFieldValuesPayloads = [];
|
|
7583
|
-
for (const payload2 of batch) {
|
|
7584
|
-
const offlineAssetTypeFieldValues = offline({
|
|
7585
|
-
...payload2,
|
|
7586
|
-
values: separateFilesFromValues(payload2.values).values,
|
|
7587
|
-
created_by: (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
7588
|
-
submitted_at: submittedAt
|
|
7589
|
-
});
|
|
7590
|
-
offlineAssetTypeFieldValuesMany.push(offlineAssetTypeFieldValues);
|
|
7591
|
-
assetTypeFieldValuesPayloads.push({
|
|
7592
|
-
offline_id: offlineAssetTypeFieldValues.offline_id,
|
|
7593
|
-
asset: payload2.asset,
|
|
7594
|
-
fields_revision: payload2.fields_revision,
|
|
7595
|
-
published_at: payload2.published_at,
|
|
7596
|
-
values: offlineAssetTypeFieldValues.values
|
|
7597
|
-
});
|
|
7598
|
-
}
|
|
7599
|
-
batchPayloads.push({
|
|
7600
|
-
submitted_at: submittedAt,
|
|
7601
|
-
values,
|
|
7602
|
-
field_values: assetTypeFieldValuesPayloads
|
|
7603
|
-
});
|
|
7604
|
-
}
|
|
7605
|
-
this.dispatch(addAssetTypeFieldValuesMany(offlineAssetTypeFieldValuesMany));
|
|
7606
|
-
const promises = [];
|
|
7607
|
-
for (const payload2 of batchPayloads) {
|
|
7608
|
-
const assetIds = payload2.field_values.map((x) => x.asset);
|
|
7609
|
-
const assetTypeFieldsIds = payload2.field_values.map((x) => x.fields_revision);
|
|
7610
|
-
const assetTypeFieldValuesIds = payload2.field_values.map((x) => x.offline_id);
|
|
7611
|
-
const promise = this.enqueueRequest({
|
|
7612
|
-
description: "Bulk add asset type field values",
|
|
7613
|
-
method: HttpMethod.POST,
|
|
7614
|
-
url: "/asset-type-field-values/bulk/",
|
|
7615
|
-
payload: payload2,
|
|
7616
|
-
blockers: [...assetIds, ...assetTypeFieldsIds],
|
|
7617
|
-
blocks: assetTypeFieldValuesIds
|
|
7618
|
-
});
|
|
7619
|
-
promises.push(promise);
|
|
7620
|
-
}
|
|
7621
|
-
void Promise.all(promises).then((results) => {
|
|
7622
|
-
this.dispatch(updateAssetTypeFieldValuesMany(results.flat()));
|
|
7623
|
-
}).catch(() => {
|
|
7624
|
-
this.dispatch(deleteAssetTypeFieldValuesMany(offlineAssetTypeFieldValuesMany.map((x) => x.offline_id)));
|
|
7625
|
-
});
|
|
7626
|
-
return [offlineAssetTypeFieldValuesMany, promises];
|
|
7627
|
-
}
|
|
7628
|
-
update(payload) {
|
|
7629
|
-
const { store } = this.client;
|
|
7630
|
-
const state = store.getState();
|
|
7631
|
-
const assetTypeFieldValues = selectAssetTypeFieldValuesById(payload.offline_id)(state);
|
|
7632
|
-
if (!assetTypeFieldValues) {
|
|
7633
|
-
throw new Error(`Expected AssetTypeFieldValues with offline_id ${payload.offline_id} to exist`);
|
|
7634
|
-
}
|
|
7635
|
-
const { values } = separateFilesFromValues(payload.values ?? {});
|
|
7636
|
-
const updatedAssetTypeFieldValues = {
|
|
7637
|
-
...assetTypeFieldValues,
|
|
7638
|
-
...payload,
|
|
7639
|
-
// values could also have a partial update
|
|
7640
|
-
values: {
|
|
7641
|
-
...assetTypeFieldValues.values,
|
|
7642
|
-
...values
|
|
7643
|
-
}
|
|
7644
|
-
};
|
|
7645
|
-
this.dispatch(updateAssetTypeFieldValues(updatedAssetTypeFieldValues));
|
|
7646
|
-
const promise = this.enqueueRequest({
|
|
7647
|
-
description: "Delete asset type field values",
|
|
7648
|
-
method: HttpMethod.PATCH,
|
|
7649
|
-
url: `/asset-type-field-values/${payload.offline_id}/`,
|
|
7650
|
-
payload,
|
|
7651
|
-
blockers: [
|
|
7652
|
-
updatedAssetTypeFieldValues.offline_id,
|
|
7653
|
-
updatedAssetTypeFieldValues.fields_revision,
|
|
7654
|
-
updatedAssetTypeFieldValues.asset
|
|
7655
|
-
],
|
|
7656
|
-
blocks: [updatedAssetTypeFieldValues.offline_id]
|
|
7657
|
-
});
|
|
7658
|
-
promise.then((result) => {
|
|
7659
|
-
this.dispatch(updateAssetTypeFieldValues(result));
|
|
7660
|
-
}).catch(() => {
|
|
7661
|
-
this.dispatch(updateAssetTypeFieldValues(assetTypeFieldValues));
|
|
7662
|
-
});
|
|
7663
|
-
return [updatedAssetTypeFieldValues, promise];
|
|
7664
|
-
}
|
|
7665
|
-
async delete(id) {
|
|
7666
|
-
const { store } = this.client;
|
|
7667
|
-
const state = store.getState();
|
|
7668
|
-
const assetTypeFieldValues = selectAssetTypeFieldValuesById(id)(state);
|
|
7669
|
-
if (!assetTypeFieldValues) {
|
|
7670
|
-
throw new Error(`Expected submission with offline_id ${id} to exist`);
|
|
7671
|
-
}
|
|
7672
|
-
const assetTypeFieldValuesAttachments = selectAttachmentsOfAssetTypeFieldValues(id)(state);
|
|
7673
|
-
this.dispatch(deleteAssetTypeFieldValues(id));
|
|
7674
|
-
this.dispatch(deleteAssetTypeFieldValuesAttachments(assetTypeFieldValuesAttachments.map((x) => x.offline_id)));
|
|
7675
|
-
try {
|
|
7676
|
-
await this.enqueueRequest({
|
|
7677
|
-
description: "Delete asset type field values",
|
|
7678
|
-
method: HttpMethod.DELETE,
|
|
7679
|
-
url: `/asset-type-field-values/${id}/`,
|
|
7680
|
-
blockers: [id],
|
|
7681
|
-
blocks: []
|
|
7682
|
-
});
|
|
7683
|
-
} catch (e) {
|
|
7684
|
-
this.dispatch(addAssetTypeFieldValues(assetTypeFieldValues));
|
|
7685
|
-
this.dispatch(addAssetTypeFieldValuesAttachments(assetTypeFieldValuesAttachments));
|
|
7686
|
-
throw e;
|
|
7687
|
-
}
|
|
7688
|
-
}
|
|
7689
|
-
async refreshStore(projectId) {
|
|
7690
|
-
const result = await this.enqueueRequest({
|
|
7691
|
-
description: "Get asset type field values",
|
|
7692
|
-
method: HttpMethod.GET,
|
|
7693
|
-
url: "/asset-type-field-values/",
|
|
7694
|
-
queryParams: {
|
|
7695
|
-
project: projectId.toString()
|
|
7696
|
-
},
|
|
7697
|
-
blockers: [],
|
|
7698
|
-
blocks: []
|
|
7699
|
-
});
|
|
7700
|
-
this.dispatch(initializeAssetTypeFieldValues(result));
|
|
7701
|
-
}
|
|
7702
|
-
}
|
|
7703
|
-
class AssetTypeFieldValuesAttachmentService extends BaseUploadService {
|
|
7704
|
-
async bulkAdd(payloads, batchSize) {
|
|
7705
|
-
var _a2;
|
|
7706
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7707
|
-
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7708
|
-
const batches = chunkArray(payloads, batchSize ?? payloads.length);
|
|
7709
|
-
const offlineAssetTypeFieldValuesAttachments = [];
|
|
7710
|
-
const batchPayloads = [];
|
|
7711
|
-
for (const batch of batches) {
|
|
7712
|
-
const filePayloads = {};
|
|
7713
|
-
const attachmentPayloads = [];
|
|
7714
|
-
for (const payload of batch) {
|
|
7715
|
-
const { fieldValuesId, fieldIdentifier, file } = payload;
|
|
7716
|
-
const filePayload = await this.getFilePayload(file);
|
|
7717
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7718
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7719
|
-
const offlineAssetTypeFieldValuesAttachment = offline({
|
|
7720
|
-
file: URL.createObjectURL(file),
|
|
7721
|
-
file_type: file.type,
|
|
7722
|
-
file_name: file.name,
|
|
7723
|
-
file_sha1: filePayload.sha1,
|
|
7724
|
-
created_by: createdBy,
|
|
7725
|
-
field_values: fieldValuesId,
|
|
7726
|
-
submitted_at: submittedAt,
|
|
7727
|
-
field_identifier: fieldIdentifier
|
|
7728
|
-
});
|
|
7729
|
-
offlineAssetTypeFieldValuesAttachments.push(offlineAssetTypeFieldValuesAttachment);
|
|
7730
|
-
const attachmentPayload = {
|
|
7731
|
-
offline_id: offlineAssetTypeFieldValuesAttachment.offline_id,
|
|
7732
|
-
file_name: file.name,
|
|
7733
|
-
file_sha1: filePayload.sha1,
|
|
7734
|
-
file_extension: filePayload.extension,
|
|
7735
|
-
field_identifier: fieldIdentifier,
|
|
7736
|
-
field_values: fieldValuesId
|
|
7737
|
-
};
|
|
7738
|
-
attachmentPayloads.push(attachmentPayload);
|
|
7739
|
-
}
|
|
7740
|
-
batchPayloads.push({
|
|
7741
|
-
submitted_at: submittedAt,
|
|
7742
|
-
attachments: attachmentPayloads,
|
|
7743
|
-
files: Object.values(filePayloads)
|
|
7744
|
-
});
|
|
7745
|
-
}
|
|
7746
|
-
this.dispatch(addAssetTypeFieldValuesAttachments(offlineAssetTypeFieldValuesAttachments));
|
|
7747
|
-
const promises = batchPayloads.map((payload) => {
|
|
7748
|
-
return this.enqueueRequest({
|
|
7749
|
-
description: "Add asset type field values attachments",
|
|
7750
|
-
method: HttpMethod.POST,
|
|
7751
|
-
url: "/asset-type-field-values-attachments/bulk/",
|
|
7752
|
-
payload,
|
|
7753
|
-
blockers: payload.attachments.map((payload2) => payload2.field_values),
|
|
7754
|
-
blocks: payload.attachments.map((payload2) => payload2.offline_id)
|
|
7755
|
-
});
|
|
7756
|
-
});
|
|
7757
|
-
Promise.all(promises).then((result) => {
|
|
7758
|
-
for (const res of result)
|
|
7759
|
-
this.processPresignedUrls(res.presigned_urls);
|
|
7760
|
-
const attachments = result.flatMap((res) => res.attachments);
|
|
7761
|
-
this.dispatch(updateAssetTypeFieldValuesAttachments(attachments));
|
|
7762
|
-
}).catch((error) => {
|
|
7763
|
-
this.dispatch(
|
|
7764
|
-
deleteAssetTypeFieldValuesAttachments(
|
|
7765
|
-
offlineAssetTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
|
|
7766
|
-
)
|
|
7767
|
-
);
|
|
7768
|
-
throw error;
|
|
7769
|
-
});
|
|
7770
|
-
return [
|
|
7771
|
-
offlineAssetTypeFieldValuesAttachments,
|
|
7772
|
-
promises.map((promise) => promise.then(({ attachments }) => attachments))
|
|
7773
|
-
];
|
|
7774
|
-
}
|
|
7775
|
-
async bulkDelete(ids) {
|
|
7776
|
-
const { store } = this.client;
|
|
7777
|
-
const state = store.getState();
|
|
7778
|
-
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(ids)(state);
|
|
7779
|
-
this.dispatch(deleteFormSubmissionAttachments(ids));
|
|
7780
|
-
try {
|
|
7781
|
-
await this.enqueueRequest({
|
|
7782
|
-
description: "Delete asset type field values attachments",
|
|
7783
|
-
method: HttpMethod.DELETE,
|
|
7784
|
-
url: "/asset-type-field-values-attachments/bulk/",
|
|
7785
|
-
payload: { attachment_ids: ids },
|
|
7786
|
-
blockers: ids,
|
|
7787
|
-
blocks: []
|
|
7788
|
-
});
|
|
7789
|
-
} catch (e) {
|
|
7790
|
-
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
7791
|
-
throw e;
|
|
7792
|
-
}
|
|
7793
|
-
}
|
|
7794
|
-
async refreshStore(projectId) {
|
|
7795
|
-
const result = await this.enqueueRequest({
|
|
7796
|
-
description: "Get asset type field values attachments",
|
|
7797
|
-
method: HttpMethod.GET,
|
|
7798
|
-
url: "/asset-type-field-values-attachments/",
|
|
7799
|
-
queryParams: {
|
|
7800
|
-
project: projectId.toString()
|
|
7801
|
-
},
|
|
7802
|
-
blockers: [],
|
|
7803
|
-
blocks: []
|
|
7804
|
-
});
|
|
7805
|
-
this.dispatch(initializeAssetTypeFieldValuesAttachments(result));
|
|
7806
|
-
}
|
|
7807
|
-
}
|
|
7808
|
-
class IssueTypeFieldsAttachmentService extends BaseUploadService {
|
|
7809
|
-
async bulkAdd(payloads) {
|
|
7810
|
-
var _a2;
|
|
7811
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7812
|
-
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7813
|
-
const filePayloads = {};
|
|
7814
|
-
const offlineIssueTypeFieldsAttachments = [];
|
|
7815
|
-
const attachmentPayloads = [];
|
|
7816
|
-
for (const payload of payloads) {
|
|
7817
|
-
const { fieldsRevisionId, fieldIdentifier, file } = payload;
|
|
7818
|
-
const filePayload = await this.getFilePayload(file);
|
|
7819
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7820
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7821
|
-
const offlineIssueTypeFieldsAttachment = offline({
|
|
7822
|
-
file: URL.createObjectURL(file),
|
|
7823
|
-
file_type: file.type,
|
|
7824
|
-
file_name: file.name,
|
|
7825
|
-
file_sha1: filePayload.sha1,
|
|
7826
|
-
created_by: createdBy,
|
|
7827
|
-
fields_revision: fieldsRevisionId,
|
|
7828
|
-
submitted_at: submittedAt,
|
|
7829
|
-
field_identifier: fieldIdentifier
|
|
7830
|
-
});
|
|
7831
|
-
offlineIssueTypeFieldsAttachments.push(offlineIssueTypeFieldsAttachment);
|
|
7832
|
-
const attachmentPayload = {
|
|
7833
|
-
offline_id: offlineIssueTypeFieldsAttachment.offline_id,
|
|
7834
|
-
file_name: file.name,
|
|
7835
|
-
file_extension: filePayload.extension,
|
|
7836
|
-
field_identifier: fieldIdentifier,
|
|
7837
|
-
file_sha1: filePayload.sha1,
|
|
7838
|
-
fields_revision: fieldsRevisionId
|
|
7839
|
-
};
|
|
7840
|
-
attachmentPayloads.push(attachmentPayload);
|
|
7841
|
-
}
|
|
7842
|
-
this.dispatch(addIssueTypeFieldsAttachments(offlineIssueTypeFieldsAttachments));
|
|
7843
|
-
const promise = this.enqueueRequest({
|
|
7844
|
-
description: "Add issue type fields attachments",
|
|
7845
|
-
method: HttpMethod.POST,
|
|
7846
|
-
url: "/issue-type-fields-attachments/bulk/",
|
|
7847
|
-
payload: {
|
|
7848
|
-
submitted_at: submittedAt,
|
|
7849
|
-
attachments: attachmentPayloads,
|
|
7850
|
-
files: Object.values(filePayloads)
|
|
7851
|
-
},
|
|
7852
|
-
blockers: offlineIssueTypeFieldsAttachments.map((attachment) => attachment.fields_revision),
|
|
7853
|
-
blocks: offlineIssueTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7854
|
-
});
|
|
7855
|
-
promise.then((result) => {
|
|
7856
|
-
this.processPresignedUrls(result.presigned_urls);
|
|
7857
|
-
this.dispatch(updateIssueTypeFieldsAttachments(result.attachments));
|
|
7858
|
-
}).catch(() => {
|
|
7859
|
-
this.dispatch(
|
|
7860
|
-
deleteIssueTypeFieldsAttachments(
|
|
7861
|
-
offlineIssueTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7862
|
-
)
|
|
7863
|
-
);
|
|
7864
|
-
});
|
|
7865
|
-
return [offlineIssueTypeFieldsAttachments, promise.then(({ attachments }) => attachments)];
|
|
7866
|
-
}
|
|
7867
|
-
async refreshStore(organizationId) {
|
|
7868
|
-
const result = await this.enqueueRequest({
|
|
7869
|
-
description: "get issue type fields attachments",
|
|
7870
|
-
method: HttpMethod.GET,
|
|
7871
|
-
url: "/issue-type-fields-attachments/",
|
|
7872
|
-
queryParams: {
|
|
7873
|
-
organization: organizationId.toString()
|
|
7874
|
-
},
|
|
7875
|
-
blockers: [organizationId.toString()],
|
|
7876
|
-
blocks: []
|
|
7877
|
-
});
|
|
7878
|
-
this.dispatch(initializeIssueTypeFieldsAttachments(result));
|
|
7879
|
-
}
|
|
7880
|
-
}
|
|
7881
|
-
class IssueTypeFieldsService extends BaseApiService {
|
|
7882
|
-
add(payload) {
|
|
7883
|
-
var _a2;
|
|
7884
|
-
const { store } = this.client;
|
|
7885
|
-
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7886
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7887
|
-
const offlineIssueTypeFields = offline({
|
|
7888
|
-
...payload,
|
|
7889
|
-
created_by: createdBy,
|
|
7890
|
-
submitted_at: submittedAt
|
|
7891
|
-
});
|
|
7892
|
-
this.dispatch(addIssueTypeFields(offlineIssueTypeFields));
|
|
7893
|
-
const promise = this.enqueueRequest({
|
|
7894
|
-
description: "Add Issue Type Fields",
|
|
7895
|
-
method: HttpMethod.POST,
|
|
7896
|
-
url: "/issue-type-fields/",
|
|
7897
|
-
payload: offlineIssueTypeFields,
|
|
7898
|
-
blockers: [offlineIssueTypeFields.issue_type],
|
|
7899
|
-
blocks: [offlineIssueTypeFields.offline_id]
|
|
7900
|
-
});
|
|
7901
|
-
promise.then((response) => {
|
|
7902
|
-
this.dispatch(updateIssueTypeFields(response));
|
|
7903
|
-
}).catch((error) => {
|
|
7904
|
-
this.dispatch(deleteIssueTypeFields(offlineIssueTypeFields.offline_id));
|
|
7905
|
-
throw error;
|
|
7906
|
-
});
|
|
7907
|
-
return [offlineIssueTypeFields, promise];
|
|
7908
|
-
}
|
|
7909
|
-
async refreshStore(organizationId) {
|
|
7910
|
-
const result = await this.enqueueRequest({
|
|
7911
|
-
description: "Get Issue Type Fields",
|
|
7912
|
-
method: HttpMethod.GET,
|
|
7913
|
-
url: "/issue-type-fields/",
|
|
7914
|
-
queryParams: {
|
|
7915
|
-
organization: organizationId.toString()
|
|
7916
|
-
},
|
|
7917
|
-
blockers: [],
|
|
7918
|
-
blocks: []
|
|
7919
|
-
});
|
|
7920
|
-
this.dispatch(initializeIssueTypeFields(result));
|
|
7921
|
-
}
|
|
7922
|
-
}
|
|
7923
|
-
class IssueTypeFieldValuesAttachmentService extends BaseUploadService {
|
|
7924
|
-
async bulkAdd(payloads) {
|
|
7925
|
-
var _a2;
|
|
7926
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7927
|
-
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7928
|
-
const filePayloads = {};
|
|
7929
|
-
const offlineIssueTypeFieldValuesAttachments = [];
|
|
7930
|
-
const attachmentPayloads = [];
|
|
7931
|
-
for (const payload of payloads) {
|
|
7932
|
-
const { fieldValuesId, fieldIdentifier, file } = payload;
|
|
7933
|
-
const filePayload = await this.getFilePayload(file);
|
|
7934
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7935
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7936
|
-
const offlineIssueTypeFieldValuesAttachment = offline({
|
|
7937
|
-
file: URL.createObjectURL(file),
|
|
7938
|
-
file_type: file.type,
|
|
7939
|
-
file_name: file.name,
|
|
7940
|
-
file_sha1: filePayload.sha1,
|
|
7941
|
-
created_by: createdBy,
|
|
7942
|
-
field_values: fieldValuesId,
|
|
7943
|
-
submitted_at: submittedAt,
|
|
7944
|
-
field_identifier: fieldIdentifier
|
|
7945
|
-
});
|
|
7946
|
-
offlineIssueTypeFieldValuesAttachments.push(offlineIssueTypeFieldValuesAttachment);
|
|
7947
|
-
const attachmentPayload = {
|
|
7948
|
-
offline_id: offlineIssueTypeFieldValuesAttachment.offline_id,
|
|
7949
|
-
file_name: file.name,
|
|
7950
|
-
file_sha1: filePayload.sha1,
|
|
7951
|
-
file_extension: filePayload.extension,
|
|
7952
|
-
field_identifier: fieldIdentifier,
|
|
7953
|
-
field_values: fieldValuesId
|
|
7954
|
-
};
|
|
7955
|
-
attachmentPayloads.push(attachmentPayload);
|
|
7956
|
-
}
|
|
7957
|
-
this.dispatch(addIssueTypeFieldValuesAttachments(offlineIssueTypeFieldValuesAttachments));
|
|
7958
|
-
const promise = this.enqueueRequest({
|
|
7959
|
-
description: "Add issue type field values attachments",
|
|
7960
|
-
method: HttpMethod.POST,
|
|
7961
|
-
url: "/issue-type-field-values-attachments/bulk/",
|
|
7962
|
-
payload: {
|
|
7963
|
-
submitted_at: submittedAt,
|
|
7964
|
-
attachments: attachmentPayloads,
|
|
7965
|
-
files: Object.values(filePayloads)
|
|
7966
|
-
},
|
|
7967
|
-
blockers: offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.field_values),
|
|
7968
|
-
blocks: offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
|
|
7969
|
-
});
|
|
7970
|
-
promise.then(({ presigned_urls, attachments }) => {
|
|
7971
|
-
this.processPresignedUrls(presigned_urls);
|
|
7972
|
-
this.dispatch(updateIssueTypeFieldValuesAttachments(attachments));
|
|
7973
|
-
}).catch((error) => {
|
|
7974
|
-
this.dispatch(
|
|
7975
|
-
deleteIssueTypeFieldValuesAttachments(
|
|
7976
|
-
offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
|
|
7977
|
-
)
|
|
7978
|
-
);
|
|
7979
|
-
throw error;
|
|
7980
|
-
});
|
|
7981
|
-
return [offlineIssueTypeFieldValuesAttachments, promise.then(({ attachments }) => attachments)];
|
|
7982
|
-
}
|
|
7983
|
-
async bulkDelete(attachmentsIds) {
|
|
7984
|
-
const { store } = this.client;
|
|
7985
|
-
const state = store.getState();
|
|
7986
|
-
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
|
|
7987
|
-
this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
|
|
7988
|
-
try {
|
|
7989
|
-
await this.enqueueRequest({
|
|
7990
|
-
description: "Delete issue type field values attachments",
|
|
7991
|
-
method: HttpMethod.DELETE,
|
|
7992
|
-
url: "/issue-type-field-values-attachments/bulk/",
|
|
7993
|
-
payload: { attachment_ids: attachmentsIds },
|
|
7994
|
-
blockers: attachmentsIds,
|
|
7995
|
-
blocks: []
|
|
7996
|
-
});
|
|
7997
|
-
} catch (e) {
|
|
7998
|
-
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
7999
|
-
throw e;
|
|
8000
|
-
}
|
|
8001
|
-
}
|
|
8002
|
-
async refreshStore(projectId) {
|
|
8003
|
-
const result = await this.enqueueRequest({
|
|
8004
|
-
description: "Get issue type field values attachments",
|
|
8005
|
-
method: HttpMethod.GET,
|
|
8006
|
-
url: "/issue-type-field-values-attachments/",
|
|
8007
|
-
queryParams: {
|
|
8008
|
-
project: projectId.toString()
|
|
8009
|
-
},
|
|
8010
|
-
blockers: [],
|
|
8011
|
-
blocks: []
|
|
8012
|
-
});
|
|
8013
|
-
this.dispatch(initializeIssueTypeFieldValuesAttachments(result));
|
|
8014
|
-
}
|
|
8015
|
-
}
|
|
8016
|
-
class IssueTypeFieldValuesService extends BaseApiService {
|
|
8017
|
-
add(payload) {
|
|
8018
|
-
var _a2;
|
|
8019
|
-
const { store } = this.client;
|
|
8020
|
-
const state = store.getState();
|
|
8021
|
-
const { values } = separateFilesFromValues(payload.values);
|
|
8022
|
-
const offlineIssueTypeFieldValues = offline({
|
|
8023
|
-
...payload,
|
|
8024
|
-
values,
|
|
8025
|
-
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
8026
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
8027
|
-
});
|
|
8028
|
-
const promise = this.enqueueRequest({
|
|
8029
|
-
description: "Add issue type field values",
|
|
8030
|
-
method: HttpMethod.POST,
|
|
8031
|
-
url: "/issue-type-field-values/",
|
|
8032
|
-
payload: offlineIssueTypeFieldValues,
|
|
8033
|
-
blockers: [payload.issue, payload.fields_revision],
|
|
8034
|
-
blocks: [offlineIssueTypeFieldValues.offline_id]
|
|
8035
|
-
});
|
|
8036
|
-
this.dispatch(addIssueTypeFieldValues(offlineIssueTypeFieldValues));
|
|
8037
|
-
promise.then((result) => {
|
|
8038
|
-
this.dispatch(updateIssueTypeFieldValues(result));
|
|
8039
|
-
return result;
|
|
8040
|
-
}).catch(() => {
|
|
8041
|
-
this.dispatch(deleteIssueTypeFieldValues(offlineIssueTypeFieldValues.offline_id));
|
|
8042
|
-
});
|
|
8043
|
-
return [offlineIssueTypeFieldValues, promise];
|
|
8044
|
-
}
|
|
8045
|
-
update(payload) {
|
|
8046
|
-
const { store } = this.client;
|
|
8047
|
-
const state = store.getState();
|
|
8048
|
-
const issueTypeFieldValues = selectIssueTypeFieldValuesById(payload.offline_id)(state);
|
|
8049
|
-
if (!issueTypeFieldValues) {
|
|
8050
|
-
throw new Error(`Expected IssueTypeFieldValues with offline_id ${payload.offline_id} to exist`);
|
|
8051
|
-
}
|
|
8052
|
-
const { values } = separateFilesFromValues(payload.values ?? {});
|
|
8053
|
-
const updatedIssueTypeFieldValues = {
|
|
8054
|
-
...issueTypeFieldValues,
|
|
8055
|
-
...payload,
|
|
8056
|
-
// values could also have a partial update
|
|
8057
|
-
values: {
|
|
8058
|
-
...issueTypeFieldValues.values,
|
|
8059
|
-
...values
|
|
8060
|
-
}
|
|
8061
|
-
};
|
|
8062
|
-
this.dispatch(updateIssueTypeFieldValues(updatedIssueTypeFieldValues));
|
|
8063
|
-
const promise = this.enqueueRequest({
|
|
8064
|
-
description: "Update issue type field values",
|
|
8065
|
-
method: HttpMethod.PATCH,
|
|
8066
|
-
url: `/issue-type-field-values/${payload.offline_id}/`,
|
|
8067
|
-
payload,
|
|
8068
|
-
blockers: [
|
|
8069
|
-
updatedIssueTypeFieldValues.offline_id,
|
|
8070
|
-
updatedIssueTypeFieldValues.fields_revision,
|
|
8071
|
-
updatedIssueTypeFieldValues.issue
|
|
8072
|
-
],
|
|
8073
|
-
blocks: [updatedIssueTypeFieldValues.offline_id]
|
|
8074
|
-
});
|
|
8075
|
-
promise.then((result) => {
|
|
8076
|
-
this.dispatch(updateIssueTypeFieldValues(result));
|
|
8077
|
-
}).catch(() => {
|
|
8078
|
-
this.dispatch(updateIssueTypeFieldValues(issueTypeFieldValues));
|
|
8079
|
-
});
|
|
8080
|
-
return [updatedIssueTypeFieldValues, promise];
|
|
8081
|
-
}
|
|
8082
|
-
async delete(id) {
|
|
8083
|
-
const { store } = this.client;
|
|
8084
|
-
const state = store.getState();
|
|
8085
|
-
const issueTypeFieldValues = selectIssueTypeFieldValuesById(id)(state);
|
|
8086
|
-
if (!issueTypeFieldValues) {
|
|
8087
|
-
throw new Error(`Expected submission with offline_id ${id} to exist`);
|
|
8088
|
-
}
|
|
8089
|
-
const issueTypeFieldValuesAttachments = selectAttachmentsOfIssueTypeFieldValues(id)(state);
|
|
8090
|
-
this.dispatch(deleteIssueTypeFieldValues(id));
|
|
8091
|
-
this.dispatch(deleteIssueTypeFieldValuesAttachments(issueTypeFieldValuesAttachments.map((x) => x.offline_id)));
|
|
8092
|
-
try {
|
|
8093
|
-
await this.enqueueRequest({
|
|
8094
|
-
description: "Delete issue type field values",
|
|
8095
|
-
method: HttpMethod.DELETE,
|
|
8096
|
-
url: `/issue-type-field-values/${id}/`,
|
|
8097
|
-
blockers: [id],
|
|
8098
|
-
blocks: []
|
|
8099
|
-
});
|
|
8100
|
-
} catch (e) {
|
|
8101
|
-
this.dispatch(addIssueTypeFieldValues(issueTypeFieldValues));
|
|
8102
|
-
this.dispatch(addIssueTypeFieldValuesAttachments(issueTypeFieldValuesAttachments));
|
|
8103
|
-
throw e;
|
|
8104
|
-
}
|
|
8105
|
-
}
|
|
8106
|
-
async refreshStore(projectId) {
|
|
8107
|
-
const result = await this.enqueueRequest({
|
|
8108
|
-
description: "Get issue type field values",
|
|
8109
|
-
method: HttpMethod.GET,
|
|
8110
|
-
url: "/issue-type-field-values/",
|
|
8111
|
-
queryParams: {
|
|
8112
|
-
project: projectId.toString()
|
|
8113
|
-
},
|
|
8114
|
-
blockers: [],
|
|
8115
|
-
blocks: []
|
|
8116
|
-
});
|
|
8117
|
-
this.dispatch(initializeIssueTypeFieldValues(result));
|
|
8118
|
-
}
|
|
8119
|
-
}
|
|
8120
7330
|
var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
|
|
8121
7331
|
VerificationCodeType2[VerificationCodeType2["USER_REGISTRATION"] = 0] = "USER_REGISTRATION";
|
|
8122
7332
|
VerificationCodeType2[VerificationCodeType2["APPLICATION_INVITE"] = 2] = "APPLICATION_INVITE";
|
|
@@ -8134,10 +7344,6 @@ export {
|
|
|
8134
7344
|
AssetStageCompletionService,
|
|
8135
7345
|
AssetStageService,
|
|
8136
7346
|
AssetTypeAttachmentService,
|
|
8137
|
-
AssetTypeFieldValuesAttachmentService,
|
|
8138
|
-
AssetTypeFieldValuesService,
|
|
8139
|
-
AssetTypeFieldsAttachmentService,
|
|
8140
|
-
AssetTypeFieldsService,
|
|
8141
7347
|
AssetTypeService,
|
|
8142
7348
|
AttachmentModel,
|
|
8143
7349
|
BaseApiService,
|
|
@@ -8153,10 +7359,7 @@ export {
|
|
|
8153
7359
|
EmailDomainsService,
|
|
8154
7360
|
EmailVerificationService,
|
|
8155
7361
|
FileService,
|
|
8156
|
-
FormRevisionAttachmentService,
|
|
8157
|
-
FormRevisionService,
|
|
8158
7362
|
FormService,
|
|
8159
|
-
FormSubmissionAttachmentService,
|
|
8160
7363
|
FormSubmissionService,
|
|
8161
7364
|
GREEN,
|
|
8162
7365
|
GeoImageService,
|
|
@@ -8167,10 +7370,6 @@ export {
|
|
|
8167
7370
|
IssuePriority,
|
|
8168
7371
|
IssueService,
|
|
8169
7372
|
IssueStatus,
|
|
8170
|
-
IssueTypeFieldValuesAttachmentService,
|
|
8171
|
-
IssueTypeFieldValuesService,
|
|
8172
|
-
IssueTypeFieldsAttachmentService,
|
|
8173
|
-
IssueTypeFieldsService,
|
|
8174
7373
|
IssueTypeService,
|
|
8175
7374
|
IssueUpdateChange,
|
|
8176
7375
|
IssueUpdateService,
|
|
@@ -8210,14 +7409,6 @@ export {
|
|
|
8210
7409
|
addAssetType,
|
|
8211
7410
|
addAssetTypeAttachment,
|
|
8212
7411
|
addAssetTypeAttachments,
|
|
8213
|
-
addAssetTypeFieldValues,
|
|
8214
|
-
addAssetTypeFieldValuesAttachment,
|
|
8215
|
-
addAssetTypeFieldValuesAttachments,
|
|
8216
|
-
addAssetTypeFieldValuesMany,
|
|
8217
|
-
addAssetTypeFields,
|
|
8218
|
-
addAssetTypeFieldsAttachment,
|
|
8219
|
-
addAssetTypeFieldsAttachments,
|
|
8220
|
-
addAssetTypeFieldsMany,
|
|
8221
7412
|
addAssetTypes,
|
|
8222
7413
|
addAssets,
|
|
8223
7414
|
addCategory,
|
|
@@ -8246,14 +7437,6 @@ export {
|
|
|
8246
7437
|
addIssueComment,
|
|
8247
7438
|
addIssueComments,
|
|
8248
7439
|
addIssueType,
|
|
8249
|
-
addIssueTypeFieldValues,
|
|
8250
|
-
addIssueTypeFieldValuesAttachment,
|
|
8251
|
-
addIssueTypeFieldValuesAttachments,
|
|
8252
|
-
addIssueTypeFieldValuesMany,
|
|
8253
|
-
addIssueTypeFields,
|
|
8254
|
-
addIssueTypeFieldsAttachment,
|
|
8255
|
-
addIssueTypeFieldsAttachments,
|
|
8256
|
-
addIssueTypeFieldsMany,
|
|
8257
7440
|
addIssueUpdate,
|
|
8258
7441
|
addIssueUpdates,
|
|
8259
7442
|
addIssues,
|
|
@@ -8279,14 +7462,6 @@ export {
|
|
|
8279
7462
|
assetStageSlice,
|
|
8280
7463
|
assetTypeAttachmentReducer,
|
|
8281
7464
|
assetTypeAttachmentSlice,
|
|
8282
|
-
assetTypeFieldValuesAttachmentReducer,
|
|
8283
|
-
assetTypeFieldValuesAttachmentSlice,
|
|
8284
|
-
assetTypeFieldValuesReducer,
|
|
8285
|
-
assetTypeFieldValuesSlice,
|
|
8286
|
-
assetTypeFieldsAttachmentReducer,
|
|
8287
|
-
assetTypeFieldsAttachmentSlice,
|
|
8288
|
-
assetTypeFieldsReducer,
|
|
8289
|
-
assetTypeFieldsSlice,
|
|
8290
7465
|
assetTypeReducer,
|
|
8291
7466
|
assetTypeSlice,
|
|
8292
7467
|
authReducer,
|
|
@@ -8315,14 +7490,6 @@ export {
|
|
|
8315
7490
|
deleteAssetType,
|
|
8316
7491
|
deleteAssetTypeAttachment,
|
|
8317
7492
|
deleteAssetTypeAttachments,
|
|
8318
|
-
deleteAssetTypeFieldValues,
|
|
8319
|
-
deleteAssetTypeFieldValuesAttachment,
|
|
8320
|
-
deleteAssetTypeFieldValuesAttachments,
|
|
8321
|
-
deleteAssetTypeFieldValuesMany,
|
|
8322
|
-
deleteAssetTypeFields,
|
|
8323
|
-
deleteAssetTypeFieldsAttachment,
|
|
8324
|
-
deleteAssetTypeFieldsAttachments,
|
|
8325
|
-
deleteAssetTypeFieldsMany,
|
|
8326
7493
|
deleteAssetTypes,
|
|
8327
7494
|
deleteAssets,
|
|
8328
7495
|
deleteCategory,
|
|
@@ -8347,14 +7514,6 @@ export {
|
|
|
8347
7514
|
deleteIssueAttachments,
|
|
8348
7515
|
deleteIssueComment,
|
|
8349
7516
|
deleteIssueComments,
|
|
8350
|
-
deleteIssueTypeFieldValues,
|
|
8351
|
-
deleteIssueTypeFieldValuesAttachment,
|
|
8352
|
-
deleteIssueTypeFieldValuesAttachments,
|
|
8353
|
-
deleteIssueTypeFieldValuesMany,
|
|
8354
|
-
deleteIssueTypeFields,
|
|
8355
|
-
deleteIssueTypeFieldsAttachment,
|
|
8356
|
-
deleteIssueTypeFieldsAttachments,
|
|
8357
|
-
deleteIssueTypeFieldsMany,
|
|
8358
7517
|
deleteIssueUpdate,
|
|
8359
7518
|
deleteIssueUpdates,
|
|
8360
7519
|
deleteIssues,
|
|
@@ -8411,10 +7570,6 @@ export {
|
|
|
8411
7570
|
initializeAssetStageCompletions,
|
|
8412
7571
|
initializeAssetStages,
|
|
8413
7572
|
initializeAssetTypeAttachments,
|
|
8414
|
-
initializeAssetTypeFieldValues,
|
|
8415
|
-
initializeAssetTypeFieldValuesAttachments,
|
|
8416
|
-
initializeAssetTypeFields,
|
|
8417
|
-
initializeAssetTypeFieldsAttachments,
|
|
8418
7573
|
initializeAssetTypes,
|
|
8419
7574
|
initializeAssets,
|
|
8420
7575
|
initializeCategories,
|
|
@@ -8429,10 +7584,6 @@ export {
|
|
|
8429
7584
|
initializeGeoImages,
|
|
8430
7585
|
initializeIssueAssociations,
|
|
8431
7586
|
initializeIssueAttachments,
|
|
8432
|
-
initializeIssueTypeFieldValues,
|
|
8433
|
-
initializeIssueTypeFieldValuesAttachments,
|
|
8434
|
-
initializeIssueTypeFields,
|
|
8435
|
-
initializeIssueTypeFieldsAttachments,
|
|
8436
7587
|
initializeIssueTypes,
|
|
8437
7588
|
initializeIssueUpdates,
|
|
8438
7589
|
initializeIssues,
|
|
@@ -8451,14 +7602,6 @@ export {
|
|
|
8451
7602
|
issueCommentSlice,
|
|
8452
7603
|
issueReducer,
|
|
8453
7604
|
issueSlice,
|
|
8454
|
-
issueTypeFieldValuesAttachmentReducer,
|
|
8455
|
-
issueTypeFieldValuesAttachmentSlice,
|
|
8456
|
-
issueTypeFieldValuesReducer,
|
|
8457
|
-
issueTypeFieldValuesSlice,
|
|
8458
|
-
issueTypeFieldsAttachmentReducer,
|
|
8459
|
-
issueTypeFieldsAttachmentSlice,
|
|
8460
|
-
issueTypeFieldsReducer,
|
|
8461
|
-
issueTypeFieldsSlice,
|
|
8462
7605
|
issueTypeReducer,
|
|
8463
7606
|
issueTypeSlice,
|
|
8464
7607
|
issueUpdateReducer,
|
|
@@ -8531,22 +7674,7 @@ export {
|
|
|
8531
7674
|
selectAssetTypeAttachmentMapping,
|
|
8532
7675
|
selectAssetTypeAttachments,
|
|
8533
7676
|
selectAssetTypeById,
|
|
8534
|
-
selectAssetTypeFieldValues,
|
|
8535
|
-
selectAssetTypeFieldValuesAttachmentById,
|
|
8536
|
-
selectAssetTypeFieldValuesAttachments,
|
|
8537
|
-
selectAssetTypeFieldValuesAttachmentsMapping,
|
|
8538
|
-
selectAssetTypeFieldValuesById,
|
|
8539
|
-
selectAssetTypeFieldValuesMapping,
|
|
8540
|
-
selectAssetTypeFieldValuesOfAsset,
|
|
8541
|
-
selectAssetTypeFields,
|
|
8542
|
-
selectAssetTypeFieldsAttachmentById,
|
|
8543
|
-
selectAssetTypeFieldsAttachments,
|
|
8544
|
-
selectAssetTypeFieldsAttachmentsMapping,
|
|
8545
|
-
selectAssetTypeFieldsById,
|
|
8546
|
-
selectAssetTypeFieldsMapping,
|
|
8547
|
-
selectAssetTypeFieldsOfAssetType,
|
|
8548
7677
|
selectAssetTypeStagesMapping,
|
|
8549
|
-
selectAssetTypeValuesOfAssetType,
|
|
8550
7678
|
selectAssetTypes,
|
|
8551
7679
|
selectAssetTypesByIds,
|
|
8552
7680
|
selectAssetTypesMapping,
|
|
@@ -8554,20 +7682,18 @@ export {
|
|
|
8554
7682
|
selectAssetsByIds,
|
|
8555
7683
|
selectAssetsMapping,
|
|
8556
7684
|
selectAssetsOfAssetType,
|
|
7685
|
+
selectAttachedFormSubmissionsOfAsset,
|
|
7686
|
+
selectAttachedFormSubmissionsOfIssue,
|
|
8557
7687
|
selectAttachmentsOfAsset,
|
|
8558
7688
|
selectAttachmentsOfAssetByType,
|
|
8559
7689
|
selectAttachmentsOfAssetType,
|
|
8560
7690
|
selectAttachmentsOfAssetTypeByType,
|
|
8561
|
-
selectAttachmentsOfAssetTypeFieldValues,
|
|
8562
|
-
selectAttachmentsOfAssetTypeFields,
|
|
8563
7691
|
selectAttachmentsOfDocument,
|
|
8564
7692
|
selectAttachmentsOfDocumentByType,
|
|
8565
7693
|
selectAttachmentsOfFormRevision,
|
|
8566
7694
|
selectAttachmentsOfFormSubmission,
|
|
8567
7695
|
selectAttachmentsOfIssue,
|
|
8568
7696
|
selectAttachmentsOfIssueByType,
|
|
8569
|
-
selectAttachmentsOfIssueTypeFieldValues,
|
|
8570
|
-
selectAttachmentsOfIssueTypeFields,
|
|
8571
7697
|
selectAttachmentsOfProject,
|
|
8572
7698
|
selectAttachmentsOfProjectByType,
|
|
8573
7699
|
selectCategories,
|
|
@@ -8595,6 +7721,8 @@ export {
|
|
|
8595
7721
|
selectFilteredForms,
|
|
8596
7722
|
selectFormById,
|
|
8597
7723
|
selectFormMapping,
|
|
7724
|
+
selectFormOfAssetType,
|
|
7725
|
+
selectFormOfIssueType,
|
|
8598
7726
|
selectFormRevisionAttachmentsMapping,
|
|
8599
7727
|
selectFormRevisionById,
|
|
8600
7728
|
selectFormRevisionMapping,
|
|
@@ -8604,11 +7732,16 @@ export {
|
|
|
8604
7732
|
selectFormSubmissionAttachmentsMapping,
|
|
8605
7733
|
selectFormSubmissionById,
|
|
8606
7734
|
selectFormSubmissions,
|
|
7735
|
+
selectFormSubmissionsByAssets,
|
|
7736
|
+
selectFormSubmissionsByFormRevisions,
|
|
7737
|
+
selectFormSubmissionsByIssues,
|
|
8607
7738
|
selectFormSubmissionsMapping,
|
|
8608
7739
|
selectFormSubmissionsOfAsset,
|
|
8609
7740
|
selectFormSubmissionsOfForm,
|
|
8610
7741
|
selectFormSubmissionsOfIssue,
|
|
8611
7742
|
selectForms,
|
|
7743
|
+
selectFormsCount,
|
|
7744
|
+
selectGeneralFormCount,
|
|
8612
7745
|
selectGeoImageById,
|
|
8613
7746
|
selectGeoImageMapping,
|
|
8614
7747
|
selectGeoImages,
|
|
@@ -8630,22 +7763,7 @@ export {
|
|
|
8630
7763
|
selectIssueCountOfCategory,
|
|
8631
7764
|
selectIssueMapping,
|
|
8632
7765
|
selectIssueTypeById,
|
|
8633
|
-
selectIssueTypeFieldValues,
|
|
8634
|
-
selectIssueTypeFieldValuesAttachmentById,
|
|
8635
|
-
selectIssueTypeFieldValuesAttachments,
|
|
8636
|
-
selectIssueTypeFieldValuesAttachmentsMapping,
|
|
8637
|
-
selectIssueTypeFieldValuesById,
|
|
8638
|
-
selectIssueTypeFieldValuesMapping,
|
|
8639
|
-
selectIssueTypeFieldValuesOfIssue,
|
|
8640
|
-
selectIssueTypeFields,
|
|
8641
|
-
selectIssueTypeFieldsAttachmentById,
|
|
8642
|
-
selectIssueTypeFieldsAttachments,
|
|
8643
|
-
selectIssueTypeFieldsAttachmentsMapping,
|
|
8644
|
-
selectIssueTypeFieldsById,
|
|
8645
|
-
selectIssueTypeFieldsMapping,
|
|
8646
|
-
selectIssueTypeFieldsOfIssueType,
|
|
8647
7766
|
selectIssueTypeMapping,
|
|
8648
|
-
selectIssueTypeValuesOfIssueType,
|
|
8649
7767
|
selectIssueTypes,
|
|
8650
7768
|
selectIssueTypesByIds,
|
|
8651
7769
|
selectIssueTypesOfOrganization,
|
|
@@ -8654,9 +7772,8 @@ export {
|
|
|
8654
7772
|
selectIssuesByIds,
|
|
8655
7773
|
selectIssuesOfIssueType,
|
|
8656
7774
|
selectIssuesOfIssueTypeCount,
|
|
8657
|
-
|
|
7775
|
+
selectLatestFormRevisionByForm,
|
|
8658
7776
|
selectLatestFormRevisionOfForm,
|
|
8659
|
-
selectLatestIssueTypeFieldsOfIssueType,
|
|
8660
7777
|
selectLatestRetryTime,
|
|
8661
7778
|
selectLicense,
|
|
8662
7779
|
selectLicenseForProject,
|
|
@@ -8693,6 +7810,7 @@ export {
|
|
|
8693
7810
|
selectProjectsOfOrganization,
|
|
8694
7811
|
selectRehydrated,
|
|
8695
7812
|
selectRootDocuments,
|
|
7813
|
+
selectSortedFormSubmissionsOfForm,
|
|
8696
7814
|
selectSortedOrganizationUsers,
|
|
8697
7815
|
selectSortedProjectUsers,
|
|
8698
7816
|
selectStageFormIdsFromStageIds,
|
|
@@ -8711,8 +7829,6 @@ export {
|
|
|
8711
7829
|
selectWorkspaceById,
|
|
8712
7830
|
selectWorkspaceMapping,
|
|
8713
7831
|
selectWorkspaces,
|
|
8714
|
-
separateFilesFromValues,
|
|
8715
|
-
separateImageFromFields,
|
|
8716
7832
|
setActiveProjectFileId,
|
|
8717
7833
|
setActiveProjectId,
|
|
8718
7834
|
setAsset,
|
|
@@ -8723,14 +7839,6 @@ export {
|
|
|
8723
7839
|
setAssetType,
|
|
8724
7840
|
setAssetTypeAttachment,
|
|
8725
7841
|
setAssetTypeAttachments,
|
|
8726
|
-
setAssetTypeFieldValues,
|
|
8727
|
-
setAssetTypeFieldValuesAttachment,
|
|
8728
|
-
setAssetTypeFieldValuesAttachments,
|
|
8729
|
-
setAssetTypeFieldValuesMany,
|
|
8730
|
-
setAssetTypeFields,
|
|
8731
|
-
setAssetTypeFieldsAttachment,
|
|
8732
|
-
setAssetTypeFieldsAttachments,
|
|
8733
|
-
setAssetTypeFieldsMany,
|
|
8734
7842
|
setAssetTypes,
|
|
8735
7843
|
setAssets,
|
|
8736
7844
|
setConversation,
|
|
@@ -8756,14 +7864,6 @@ export {
|
|
|
8756
7864
|
setIssueComment,
|
|
8757
7865
|
setIssueComments,
|
|
8758
7866
|
setIssueType,
|
|
8759
|
-
setIssueTypeFieldValues,
|
|
8760
|
-
setIssueTypeFieldValuesAttachment,
|
|
8761
|
-
setIssueTypeFieldValuesAttachments,
|
|
8762
|
-
setIssueTypeFieldValuesMany,
|
|
8763
|
-
setIssueTypeFields,
|
|
8764
|
-
setIssueTypeFieldsAttachment,
|
|
8765
|
-
setIssueTypeFieldsAttachments,
|
|
8766
|
-
setIssueTypeFieldsMany,
|
|
8767
7867
|
setIssueUpdate,
|
|
8768
7868
|
setLoggedIn,
|
|
8769
7869
|
setOrganizations,
|
|
@@ -8796,14 +7896,6 @@ export {
|
|
|
8796
7896
|
updateAssetType,
|
|
8797
7897
|
updateAssetTypeAttachment,
|
|
8798
7898
|
updateAssetTypeAttachments,
|
|
8799
|
-
updateAssetTypeFieldValues,
|
|
8800
|
-
updateAssetTypeFieldValuesAttachment,
|
|
8801
|
-
updateAssetTypeFieldValuesAttachments,
|
|
8802
|
-
updateAssetTypeFieldValuesMany,
|
|
8803
|
-
updateAssetTypeFields,
|
|
8804
|
-
updateAssetTypeFieldsAttachment,
|
|
8805
|
-
updateAssetTypeFieldsAttachments,
|
|
8806
|
-
updateAssetTypeFieldsMany,
|
|
8807
7899
|
updateAssetTypes,
|
|
8808
7900
|
updateAssets,
|
|
8809
7901
|
updateCategory,
|
|
@@ -8826,14 +7918,6 @@ export {
|
|
|
8826
7918
|
updateIssueAttachment,
|
|
8827
7919
|
updateIssueAttachments,
|
|
8828
7920
|
updateIssueType,
|
|
8829
|
-
updateIssueTypeFieldValues,
|
|
8830
|
-
updateIssueTypeFieldValuesAttachment,
|
|
8831
|
-
updateIssueTypeFieldValuesAttachments,
|
|
8832
|
-
updateIssueTypeFieldValuesMany,
|
|
8833
|
-
updateIssueTypeFields,
|
|
8834
|
-
updateIssueTypeFieldsAttachment,
|
|
8835
|
-
updateIssueTypeFieldsAttachments,
|
|
8836
|
-
updateIssueTypeFieldsMany,
|
|
8837
7921
|
updateLicense,
|
|
8838
7922
|
updateOrCreateProject,
|
|
8839
7923
|
updateOrganizationAccess,
|